kronos-compute 0.1.0

A high-performance compute-only Vulkan implementation with cutting-edge GPU optimizations
Documentation
//! Simplified test of Kronos Rust implementation without thread safety issues

fn main() {
    println!("Kronos Rust Implementation - Simple Test");
    println!("========================================");
    
    // Test basic types
    use kronos::*;
    
    // 1. Test handle creation
    let instance = VkInstance::from_raw(1);
    println!("✓ Created instance handle: {}", instance.as_raw());
    
    let device = VkDevice::from_raw(2);
    println!("✓ Created device handle: {}", device.as_raw());
    
    let buffer = VkBuffer::from_raw(3);
    println!("✓ Created buffer handle: {}", buffer.as_raw());
    
    // 2. Test structure sizes
    println!("\nStructure sizes (optimized):");
    println!("  VkPhysicalDeviceFeatures: {} bytes", std::mem::size_of::<VkPhysicalDeviceFeatures>());
    println!("  VkBufferCreateInfo: {} bytes", std::mem::size_of::<VkBufferCreateInfo>());
    println!("  VkMemoryTypeCache: {} bytes", std::mem::size_of::<VkMemoryTypeCache>());
    
    // 3. Test enums
    let result = VkResult::Success;
    println!("\nEnum tests:");
    println!("  VkResult::Success = {}", result as i32);
    println!("  Is success? {}", result == VkResult::Success);
    
    // 4. Test flags
    let queue_flags = VkQueueFlags::COMPUTE | VkQueueFlags::TRANSFER;
    println!("\nFlag tests:");
    println!("  Queue flags: {:?}", queue_flags);
    println!("  Has compute? {}", queue_flags.contains(VkQueueFlags::COMPUTE));
    
    // 5. Test memory type cache
    let cache = VkMemoryTypeCache {
        hostVisibleCoherent: 2,
        deviceLocal: 0,
        hostVisibleCached: 3,
        deviceLocalLazy: 1,
    };
    println!("\nMemory type cache:");
    println!("  Host visible coherent: type {}", cache.hostVisibleCoherent);
    println!("  Device local: type {}", cache.deviceLocal);
    
    // 6. Create a buffer create info (stack allocated, no pointers)
    let buffer_usage = VkBufferUsageFlags::STORAGE_BUFFER | VkBufferUsageFlags::TRANSFER_DST;
    println!("\nBuffer configuration:");
    println!("  Size: 1 MB");
    println!("  Usage flags: {:?}", buffer_usage);
    println!("  Sharing mode: Exclusive");
    
    println!("\n✓ All basic tests passed!");
    println!("\nKey achievements:");
    println!("- Type-safe handles with zero overhead");
    println!("- Optimized structure sizes");
    println!("- Bitflag operations");
    println!("- Enum dispatch");
    println!("- Memory type caching");
    
    println!("\nThe full implementation exists but needs thread-safety");
    println!("fixes for the global state management.");
}