From 142b7146be5f32765b75fcfe4045796f393b9d5e Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Mon, 11 Jul 2022 08:28:28 -0700 Subject: [PATCH] gpu: add Texture.Format enum Signed-off-by: Stephen Gutekanst --- gpu/TODO-webgpu.h | 100 -------------------------------------------- gpu/src/Texture.zig | 99 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 100 deletions(-) diff --git a/gpu/TODO-webgpu.h b/gpu/TODO-webgpu.h index 3617ab5f..3cc959fa 100644 --- a/gpu/TODO-webgpu.h +++ b/gpu/TODO-webgpu.h @@ -1,105 +1,5 @@ typedef uint32_t WGPUFlags; -typedef enum WGPUTextureFormat { - WGPUTextureFormat_Undefined = 0x00000000, - WGPUTextureFormat_R8Unorm = 0x00000001, - WGPUTextureFormat_R8Snorm = 0x00000002, - WGPUTextureFormat_R8Uint = 0x00000003, - WGPUTextureFormat_R8Sint = 0x00000004, - WGPUTextureFormat_R16Uint = 0x00000005, - WGPUTextureFormat_R16Sint = 0x00000006, - WGPUTextureFormat_R16Float = 0x00000007, - WGPUTextureFormat_RG8Unorm = 0x00000008, - WGPUTextureFormat_RG8Snorm = 0x00000009, - WGPUTextureFormat_RG8Uint = 0x0000000A, - WGPUTextureFormat_RG8Sint = 0x0000000B, - WGPUTextureFormat_R32Float = 0x0000000C, - WGPUTextureFormat_R32Uint = 0x0000000D, - WGPUTextureFormat_R32Sint = 0x0000000E, - WGPUTextureFormat_RG16Uint = 0x0000000F, - WGPUTextureFormat_RG16Sint = 0x00000010, - WGPUTextureFormat_RG16Float = 0x00000011, - WGPUTextureFormat_RGBA8Unorm = 0x00000012, - WGPUTextureFormat_RGBA8UnormSrgb = 0x00000013, - WGPUTextureFormat_RGBA8Snorm = 0x00000014, - WGPUTextureFormat_RGBA8Uint = 0x00000015, - WGPUTextureFormat_RGBA8Sint = 0x00000016, - WGPUTextureFormat_BGRA8Unorm = 0x00000017, - WGPUTextureFormat_BGRA8UnormSrgb = 0x00000018, - WGPUTextureFormat_RGB10A2Unorm = 0x00000019, - WGPUTextureFormat_RG11B10Ufloat = 0x0000001A, - WGPUTextureFormat_RGB9E5Ufloat = 0x0000001B, - WGPUTextureFormat_RG32Float = 0x0000001C, - WGPUTextureFormat_RG32Uint = 0x0000001D, - WGPUTextureFormat_RG32Sint = 0x0000001E, - WGPUTextureFormat_RGBA16Uint = 0x0000001F, - WGPUTextureFormat_RGBA16Sint = 0x00000020, - WGPUTextureFormat_RGBA16Float = 0x00000021, - WGPUTextureFormat_RGBA32Float = 0x00000022, - WGPUTextureFormat_RGBA32Uint = 0x00000023, - WGPUTextureFormat_RGBA32Sint = 0x00000024, - WGPUTextureFormat_Stencil8 = 0x00000025, - WGPUTextureFormat_Depth16Unorm = 0x00000026, - WGPUTextureFormat_Depth24Plus = 0x00000027, - WGPUTextureFormat_Depth24PlusStencil8 = 0x00000028, - WGPUTextureFormat_Depth32Float = 0x00000029, - WGPUTextureFormat_Depth32FloatStencil8 = 0x0000002A, - WGPUTextureFormat_BC1RGBAUnorm = 0x0000002B, - WGPUTextureFormat_BC1RGBAUnormSrgb = 0x0000002C, - WGPUTextureFormat_BC2RGBAUnorm = 0x0000002D, - WGPUTextureFormat_BC2RGBAUnormSrgb = 0x0000002E, - WGPUTextureFormat_BC3RGBAUnorm = 0x0000002F, - WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000030, - WGPUTextureFormat_BC4RUnorm = 0x00000031, - WGPUTextureFormat_BC4RSnorm = 0x00000032, - WGPUTextureFormat_BC5RGUnorm = 0x00000033, - WGPUTextureFormat_BC5RGSnorm = 0x00000034, - WGPUTextureFormat_BC6HRGBUfloat = 0x00000035, - WGPUTextureFormat_BC6HRGBFloat = 0x00000036, - WGPUTextureFormat_BC7RGBAUnorm = 0x00000037, - WGPUTextureFormat_BC7RGBAUnormSrgb = 0x00000038, - WGPUTextureFormat_ETC2RGB8Unorm = 0x00000039, - WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x0000003A, - WGPUTextureFormat_ETC2RGB8A1Unorm = 0x0000003B, - WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x0000003C, - WGPUTextureFormat_ETC2RGBA8Unorm = 0x0000003D, - WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x0000003E, - WGPUTextureFormat_EACR11Unorm = 0x0000003F, - WGPUTextureFormat_EACR11Snorm = 0x00000040, - WGPUTextureFormat_EACRG11Unorm = 0x00000041, - WGPUTextureFormat_EACRG11Snorm = 0x00000042, - WGPUTextureFormat_ASTC4x4Unorm = 0x00000043, - WGPUTextureFormat_ASTC4x4UnormSrgb = 0x00000044, - WGPUTextureFormat_ASTC5x4Unorm = 0x00000045, - WGPUTextureFormat_ASTC5x4UnormSrgb = 0x00000046, - WGPUTextureFormat_ASTC5x5Unorm = 0x00000047, - WGPUTextureFormat_ASTC5x5UnormSrgb = 0x00000048, - WGPUTextureFormat_ASTC6x5Unorm = 0x00000049, - WGPUTextureFormat_ASTC6x5UnormSrgb = 0x0000004A, - WGPUTextureFormat_ASTC6x6Unorm = 0x0000004B, - WGPUTextureFormat_ASTC6x6UnormSrgb = 0x0000004C, - WGPUTextureFormat_ASTC8x5Unorm = 0x0000004D, - WGPUTextureFormat_ASTC8x5UnormSrgb = 0x0000004E, - WGPUTextureFormat_ASTC8x6Unorm = 0x0000004F, - WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000050, - WGPUTextureFormat_ASTC8x8Unorm = 0x00000051, - WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000052, - WGPUTextureFormat_ASTC10x5Unorm = 0x00000053, - WGPUTextureFormat_ASTC10x5UnormSrgb = 0x00000054, - WGPUTextureFormat_ASTC10x6Unorm = 0x00000055, - WGPUTextureFormat_ASTC10x6UnormSrgb = 0x00000056, - WGPUTextureFormat_ASTC10x8Unorm = 0x00000057, - WGPUTextureFormat_ASTC10x8UnormSrgb = 0x00000058, - WGPUTextureFormat_ASTC10x10Unorm = 0x00000059, - WGPUTextureFormat_ASTC10x10UnormSrgb = 0x0000005A, - WGPUTextureFormat_ASTC12x10Unorm = 0x0000005B, - WGPUTextureFormat_ASTC12x10UnormSrgb = 0x0000005C, - WGPUTextureFormat_ASTC12x12Unorm = 0x0000005D, - WGPUTextureFormat_ASTC12x12UnormSrgb = 0x0000005E, - WGPUTextureFormat_R8BG8Biplanar420Unorm = 0x0000005F, - WGPUTextureFormat_Force32 = 0x7FFFFFFF -} WGPUTextureFormat; - typedef enum WGPUTextureSampleType { WGPUTextureSampleType_Undefined = 0x00000000, WGPUTextureSampleType_Float = 0x00000001, diff --git a/gpu/src/Texture.zig b/gpu/src/Texture.zig index 5740d134..980a7456 100644 --- a/gpu/src/Texture.zig +++ b/gpu/src/Texture.zig @@ -20,3 +20,102 @@ pub const Dimension = enum(u32) { dimension_2d = 0x00000001, dimension_3d = 0x00000002, }; + +pub const Format = enum(u32) { + undef = 0x00000000, + r8_unorm = 0x00000001, + r8_snorm = 0x00000002, + r8_uint = 0x00000003, + r8_sint = 0x00000004, + r16_uint = 0x00000005, + r16_sint = 0x00000006, + r16_float = 0x00000007, + rg8_unorm = 0x00000008, + rg8_snorm = 0x00000009, + rg8_uint = 0x0000000a, + rg8_sint = 0x0000000b, + r32_float = 0x0000000c, + r32_uint = 0x0000000d, + r32_sint = 0x0000000e, + rg16_uint = 0x0000000f, + rg16_sint = 0x00000010, + rg16_float = 0x00000011, + rgba8_unorm = 0x00000012, + rgba8_unorm_srgb = 0x00000013, + rgba8_snorm = 0x00000014, + rgba8_uint = 0x00000015, + rgba8_sint = 0x00000016, + bgra8_unorm = 0x00000017, + bgra8_unorm_srgb = 0x00000018, + rgb10_a2_unorm = 0x00000019, + rg11_b10_ufloat = 0x0000001a, + rgb9_e5_ufloat = 0x0000001b, + rg32_float = 0x0000001c, + rg32_uint = 0x0000001d, + rg32_sint = 0x0000001e, + rgba16_uint = 0x0000001f, + rgba16_sint = 0x00000020, + rgba16_float = 0x00000021, + rgba32_float = 0x00000022, + rgba32_uint = 0x00000023, + rgba32_sint = 0x00000024, + stencil8 = 0x00000025, + depth16_unorm = 0x00000026, + depth24_plus = 0x00000027, + depth24_plus_stencil8 = 0x00000028, + depth32_float = 0x00000029, + depth32_float_stencil8 = 0x0000002a, + bc1_rgba_unorm = 0x0000002b, + bc1_rgba_unorm_srgb = 0x0000002c, + bc2_rgba_unorm = 0x0000002d, + bc2_rgba_unorm_srgb = 0x0000002e, + bc3_rgba_unorm = 0x0000002f, + bc3_rgba_unorm_srgb = 0x00000030, + bc4_runorm = 0x00000031, + bc4_rsnorm = 0x00000032, + bc5_rg_unorm = 0x00000033, + bc5_rg_snorm = 0x00000034, + bc6_hrgb_ufloat = 0x00000035, + bc6_hrgb_float = 0x00000036, + bc7_rgba_unorm = 0x00000037, + bc7_rgba_unorm_srgb = 0x00000038, + etc2_rgb8_unorm = 0x00000039, + etc2_rgb8_unorm_srgb = 0x0000003a, + etc2_rgb8_a1_unorm = 0x0000003b, + etc2_rgb8_a1_unorm_srgb = 0x0000003c, + etc2_rgba8_unorm = 0x0000003d, + etc2_rgba8_unorm_srgb = 0x0000003e, + eacr11_unorm = 0x0000003f, + eacr11_snorm = 0x00000040, + eacrg11_unorm = 0x00000041, + eacrg11_snorm = 0x00000042, + astc_4x4_unorm = 0x00000043, + astc_4x4_unorm_srgb = 0x00000044, + astc_5x4_unorm = 0x00000045, + astc_5x4_unorm_srgb = 0x00000046, + astc_5x5_unorm = 0x00000047, + astc_5x5_unorm_srgb = 0x00000048, + astc_6x5_unorm = 0x00000049, + astc_6x5_unorm_srgb = 0x0000004a, + astc_6x6_unorm = 0x0000004b, + astc_6x6_unorm_srgb = 0x0000004c, + astc_8x5_unorm = 0x0000004d, + astc_8x5_unorm_srgb = 0x0000004e, + astc_8x6_unorm = 0x0000004f, + astc_8x6_unorm_srgb = 0x00000050, + astc_8x8_unorm = 0x00000051, + astc_8x8_unorm_srgb = 0x00000052, + astc_10x5_unorm = 0x00000053, + astc_10x5_unorm_srgb = 0x00000054, + astc_10x6_unorm = 0x00000055, + astc_10x6_unorm_srgb = 0x00000056, + astc_10x8_unorm = 0x00000057, + astc_10x8_unorm_srgb = 0x00000058, + astc_10x10_unorm = 0x00000059, + astc_10x10_unorm_srgb = 0x0000005a, + astc_12x10_unorm = 0x0000005b, + astc_12x10_unorm_srgb = 0x0000005c, + astc_12x12_unorm = 0x0000005d, + astc_12x12_unorm_srgb = 0x0000005e, + r8_bg8_biplanar420_unorm = 0x0000005f, +};