pub const GpuAllocator = @import("GpuAllocator.zig");
pub const GpuArenaAllocator = @import("GpuArenaAllocator.zig");
pub const GpuBuffer = @import("GpuBuffer.zig");
pub const GpuDevice = @import("GpuDevice.zig");
pub const GpuCompute = @import("GpuCompute.zig");
pub const GpuRender = @import("GpuRender.zig");
pub const GpuTexture = @import("GpuTexture.zig");
pub const GpuTextureView = @import("GpuTextureView.zig");

pub const GpuTextureFormat = enum(c_uint) {
    Undefined = 0,
    R8Unorm = 1,
    R8Snorm = 2,
    R8Uint = 3,
    R8Sint = 4,
    R16Unorm = 5,
    R16Snorm = 6,
    R16Uint = 7,
    R16Sint = 8,
    R16Float = 9,
    RG8Unorm = 10,
    RG8Snorm = 11,
    RG8Uint = 12,
    RG8Sint = 13,
    R32Float = 14,
    R32Uint = 15,
    R32Sint = 16,
    RG16Unorm = 17,
    RG16Snorm = 18,
    RG16Uint = 19,
    RG16Sint = 20,
    RG16Float = 21,
    RGBA8Unorm = 22,
    RGBA8UnormSrgb = 23,
    RGBA8Snorm = 24,
    RGBA8Uint = 25,
    RGBA8Sint = 26,
    BGRA8Unorm = 27,
    BGRA8UnormSrgb = 28,
    RGB10A2Uint = 29,
    RGB10A2Unorm = 30,
    RG11B10Ufloat = 31,
    RGB9E5Ufloat = 32,
    RG32Float = 33,
    RG32Uint = 34,
    RG32Sint = 35,
    RGBA16Unorm = 36,
    RGBA16Snorm = 37,
    RGBA16Uint = 38,
    RGBA16Sint = 39,
    RGBA16Float = 40,
    RGBA32Float = 41,
    RGBA32Uint = 42,
    RGBA32Sint = 43,
    Stencil8 = 44,
    Depth16Unorm = 45,
    Depth24Plus = 46,
    Depth24PlusStencil8 = 47,
    Depth32Float = 48,
    Depth32FloatStencil8 = 49,
    BC1RGBAUnorm = 50,
    BC1RGBAUnormSrgb = 51,
    BC2RGBAUnorm = 52,
    BC2RGBAUnormSrgb = 53,
    BC3RGBAUnorm = 54,
    BC3RGBAUnormSrgb = 55,
    BC4RUnorm = 56,
    BC4RSnorm = 57,
    BC5RGUnorm = 58,
    BC5RGSnorm = 59,
    BC6HRGBUfloat = 60,
    BC6HRGBFloat = 61,
    BC7RGBAUnorm = 62,
    BC7RGBAUnormSrgb = 63,
    ETC2RGB8Unorm = 64,
    ETC2RGB8UnormSrgb = 65,
    ETC2RGB8A1Unorm = 66,
    ETC2RGB8A1UnormSrgb = 67,
    ETC2RGBA8Unorm = 68,
    ETC2RGBA8UnormSrgb = 69,
    EACR11Unorm = 70,
    EACR11Snorm = 71,
    EACRG11Unorm = 72,
    EACRG11Snorm = 73,
    ASTC4x4Unorm = 74,
    ASTC4x4UnormSrgb = 75,
    ASTC5x4Unorm = 76,
    ASTC5x4UnormSrgb = 77,
    ASTC5x5Unorm = 78,
    ASTC5x5UnormSrgb = 79,
    ASTC6x5Unorm = 80,
    ASTC6x5UnormSrgb = 81,
    ASTC6x6Unorm = 82,
    ASTC6x6UnormSrgb = 83,
    ASTC8x5Unorm = 84,
    ASTC8x5UnormSrgb = 85,
    ASTC8x6Unorm = 86,
    ASTC8x6UnormSrgb = 87,
    ASTC8x8Unorm = 88,
    ASTC8x8UnormSrgb = 89,
    ASTC10x5Unorm = 90,
    ASTC10x5UnormSrgb = 91,
    ASTC10x6Unorm = 92,
    ASTC10x6UnormSrgb = 93,
    ASTC10x8Unorm = 94,
    ASTC10x8UnormSrgb = 95,
    ASTC10x10Unorm = 96,
    ASTC10x10UnormSrgb = 97,
    ASTC12x10Unorm = 98,
    ASTC12x10UnormSrgb = 99,
    ASTC12x12Unorm = 100,
    ASTC12x12UnormSrgb = 101,
    Force32 = 2147483647,

    pub fn bytesPerPixel(format: GpuTextureFormat) u32 {
        return switch (format) {
            // 8-bit formats (1 byte)
            .R8Unorm, .R8Snorm, .R8Uint, .R8Sint, .Stencil8 => 1,

            // 16-bit formats (2 bytes)
            .R16Unorm,
            .R16Snorm,
            .R16Uint,
            .R16Sint,
            .R16Float,
            .RG8Unorm,
            .RG8Snorm,
            .RG8Uint,
            .RG8Sint,
            .Depth16Unorm,
            => 2,

            // 32-bit formats (4 bytes)
            .R32Float,
            .R32Uint,
            .R32Sint,
            .RG16Unorm,
            .RG16Snorm,
            .RG16Uint,
            .RG16Sint,
            .RG16Float,
            .RGBA8Unorm,
            .RGBA8UnormSrgb,
            .RGBA8Snorm,
            .RGBA8Uint,
            .RGBA8Sint,
            .BGRA8Unorm,
            .BGRA8UnormSrgb,
            .RGB10A2Uint,
            .RGB10A2Unorm,
            .RG11B10Ufloat,
            .RGB9E5Ufloat,
            .Depth24Plus,
            .Depth32Float,
            => 4,

            // 64-bit formats (8 bytes)
            .RG32Float,
            .RG32Uint,
            .RG32Sint,
            .RGBA16Unorm,
            .RGBA16Snorm,
            .RGBA16Uint,
            .RGBA16Sint,
            .RGBA16Float,
            .Depth24PlusStencil8, // 24-bit depth + 8-bit stencil layout padded to 4+4 or 1+3
            .Depth32FloatStencil8, // 32-bit float depth + 8-bit stencil (padded to 8 bytes)
            => 8,

            // 128-bit formats (16 bytes)
            .RGBA32Float, .RGBA32Uint, .RGBA32Sint => 16,

            // Block Compressed Formats (Handled separately)
            else => 0,
        };
    }
};

pub const GpuTextureUsage = enum(u64) {
    None = 0x0000000000000000,
    CopySrc = 0x0000000000000001,
    CopyDst = 0x0000000000000002,
    TextureBinding = 0x0000000000000004,
    StorageBinding = 0x0000000000000008,
    RenderAttachment = 0x0000000000000010,
    TransientAttachment = 0x0000000000000020,
};
