gpu: correct enums to snake_case

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-09 08:14:46 -07:00 committed by Stephen Gutekanst
parent 0017303cde
commit c3cfb77ac7
5 changed files with 124 additions and 128 deletions

View file

@ -26,14 +26,14 @@ pub fn main() !void {
const use_legacy_api = setup.backend_type == c.WGPUBackendType_OpenGL or setup.backend_type == c.WGPUBackendType_OpenGLES; const use_legacy_api = setup.backend_type == c.WGPUBackendType_OpenGL or setup.backend_type == c.WGPUBackendType_OpenGLES;
var descriptor: gpu.SwapChain.Descriptor = undefined; var descriptor: gpu.SwapChain.Descriptor = undefined;
if (!use_legacy_api) { if (!use_legacy_api) {
window_data.swap_chain_format = .BGRA8Unorm; window_data.swap_chain_format = .bgra8_unorm;
descriptor = .{ descriptor = .{
.label = "basic swap chain", .label = "basic swap chain",
.usage = .RenderAttachment, .usage = .render_attachment,
.format = window_data.swap_chain_format, .format = window_data.swap_chain_format,
.width = framebuffer_size.width, .width = framebuffer_size.width,
.height = framebuffer_size.height, .height = framebuffer_size.height,
.present_mode = .Fifo, .present_mode = .fifo,
.implementation = 0, .implementation = 0,
}; };
window_data.surface = sample_utils.createSurfaceForWindow( window_data.surface = sample_utils.createSurfaceForWindow(
@ -53,7 +53,7 @@ pub fn main() !void {
window_data.swap_chain_format = @intToEnum(gpu.TextureFormat, @intCast(u32, c.machUtilsBackendBinding_getPreferredSwapChainTextureFormat(binding))); window_data.swap_chain_format = @intToEnum(gpu.TextureFormat, @intCast(u32, c.machUtilsBackendBinding_getPreferredSwapChainTextureFormat(binding)));
window_data.swap_chain.?.configure( window_data.swap_chain.?.configure(
window_data.swap_chain_format, window_data.swap_chain_format,
.RenderAttachment, .render_attachment,
framebuffer_size.width, framebuffer_size.width,
framebuffer_size.height, framebuffer_size.height,
); );

View file

@ -1,18 +1,17 @@
pub const FeatureName = enum(u32) { pub const FeatureName = enum(u32) {
Undefined = 0x00000000, depth24_unorm_stencil8 = 0x00000002,
Depth24UnormStencil8 = 0x00000002, depth32_float_stencil8 = 0x00000003,
Depth32FloatStencil8 = 0x00000003, timestamp_query = 0x00000004,
TimestampQuery = 0x00000004, pipeline_statistics_query = 0x00000005,
PipelineStatisticsQuery = 0x00000005, texture_compression_bc = 0x00000006,
TextureCompressionBC = 0x00000006, texture_compression_etc2 = 0x00000007,
TextureCompressionETC2 = 0x00000007, texture_compression_astc = 0x00000008,
TextureCompressionASTC = 0x00000008, indirect_first_instance = 0x00000009,
IndirectFirstInstance = 0x00000009, depth_clamping = 0x000003e8,
DepthClamping = 0x000003E8, dawn_shader_float16 = 0x000003e9,
DawnShaderFloat16 = 0x000003E9, dawn_internal_usages = 0x000003ea,
DawnInternalUsages = 0x000003EA, dawn_multi_planar_formats = 0x000003eb,
DawnMultiPlanarFormats = 0x000003EB, dawn_native = 0x000003ec,
DawnNative = 0x000003EC,
}; };
// TODO: add featureNameString method // TODO: add featureNameString method

View file

@ -1,6 +1,5 @@
pub const PresentMode = enum(u32) { pub const PresentMode = enum(u32) {
// TODO: zig enums are not CamelCase immediate = 0x00000000,
Immediate = 0x00000000, mailbox = 0x00000001,
Mailbox = 0x00000001, fifo = 0x00000002,
Fifo = 0x00000002,
}; };

View file

@ -1,100 +1,99 @@
pub const TextureFormat = enum(u32) { pub const TextureFormat = enum(u32) {
// TODO: enums not CamelCase none = 0x00000000,
Undefined = 0x00000000, r8_unorm = 0x00000001,
R8Unorm = 0x00000001, r8_snorm = 0x00000002,
R8Snorm = 0x00000002, r8_uint = 0x00000003,
R8Uint = 0x00000003, r8_sint = 0x00000004,
R8Sint = 0x00000004, r16_uint = 0x00000005,
R16Uint = 0x00000005, r16_sint = 0x00000006,
R16Sint = 0x00000006, r16_float = 0x00000007,
R16Float = 0x00000007, rg8_unorm = 0x00000008,
RG8Unorm = 0x00000008, rg8_snorm = 0x00000009,
RG8Snorm = 0x00000009, rg8_uint = 0x0000000a,
RG8Uint = 0x0000000A, rg8_sint = 0x0000000b,
RG8Sint = 0x0000000B, r32_float = 0x0000000c,
R32Float = 0x0000000C, r32_uint = 0x0000000d,
R32Uint = 0x0000000D, r32_sint = 0x0000000e,
R32Sint = 0x0000000E, rg16_uint = 0x0000000f,
RG16Uint = 0x0000000F, rg16_sint = 0x00000010,
RG16Sint = 0x00000010, rg16_float = 0x00000011,
RG16Float = 0x00000011, rgba8_unorm = 0x00000012,
RGBA8Unorm = 0x00000012, rgba8_unorm_srgb = 0x00000013,
RGBA8UnormSrgb = 0x00000013, rgba8_snorm = 0x00000014,
RGBA8Snorm = 0x00000014, rgba8_uint = 0x00000015,
RGBA8Uint = 0x00000015, rgba8_sint = 0x00000016,
RGBA8Sint = 0x00000016, bgra8_unorm = 0x00000017,
BGRA8Unorm = 0x00000017, bgra8_unorm_srgb = 0x00000018,
BGRA8UnormSrgb = 0x00000018, rgb10a2_unorm = 0x00000019,
RGB10A2Unorm = 0x00000019, rg11b10u_float = 0x0000001a,
RG11B10Ufloat = 0x0000001A, rgb9e5u_float = 0x0000001b,
RGB9E5Ufloat = 0x0000001B, rg32_float = 0x0000001c,
RG32Float = 0x0000001C, rg32_uint = 0x0000001d,
RG32Uint = 0x0000001D, rg32_sint = 0x0000001e,
RG32Sint = 0x0000001E, rgba16_uint = 0x0000001f,
RGBA16Uint = 0x0000001F, rgba16_sint = 0x00000020,
RGBA16Sint = 0x00000020, rgba16_float = 0x00000021,
RGBA16Float = 0x00000021, rgba32_float = 0x00000022,
RGBA32Float = 0x00000022, rgba32_uint = 0x00000023,
RGBA32Uint = 0x00000023, rgba32_sint = 0x00000024,
RGBA32Sint = 0x00000024, stencil8 = 0x00000025,
Stencil8 = 0x00000025, depth16_unorm = 0x00000026,
Depth16Unorm = 0x00000026, depth24_plus = 0x00000027,
Depth24Plus = 0x00000027, depth24_plus_stencil8 = 0x00000028,
Depth24PlusStencil8 = 0x00000028, depth24_unorm_stencil8 = 0x00000029,
Depth24UnormStencil8 = 0x00000029, depth32_float = 0x0000002a,
Depth32Float = 0x0000002A, depth32_float_stencil8 = 0x0000002b,
Depth32FloatStencil8 = 0x0000002B, bc1rgba_unorm = 0x0000002c,
BC1RGBAUnorm = 0x0000002C, bc1rgba_unorm_srgb = 0x0000002d,
BC1RGBAUnormSrgb = 0x0000002D, bc2rgba_unorm = 0x0000002e,
BC2RGBAUnorm = 0x0000002E, bc2rgba_unorm_srgb = 0x0000002f,
BC2RGBAUnormSrgb = 0x0000002F, bc3rgba_unorm = 0x00000030,
BC3RGBAUnorm = 0x00000030, bc3rgba_unorm_srgb = 0x00000031,
BC3RGBAUnormSrgb = 0x00000031, bc4r_unorm = 0x00000032,
BC4RUnorm = 0x00000032, bc4r_snorm = 0x00000033,
BC4RSnorm = 0x00000033, bc5rg_unorm = 0x00000034,
BC5RGUnorm = 0x00000034, bc5rg_snorm = 0x00000035,
BC5RGSnorm = 0x00000035, bc6hrgbu_float = 0x00000036,
BC6HRGBUfloat = 0x00000036, bc6hrgb_float = 0x00000037,
BC6HRGBFloat = 0x00000037, bc7rgba_unorm = 0x00000038,
BC7RGBAUnorm = 0x00000038, bc7rgba_unorm_srgb = 0x00000039,
BC7RGBAUnormSrgb = 0x00000039, etc2rgb8_unorm = 0x0000003a,
ETC2RGB8Unorm = 0x0000003A, etc2rgb8_unorm_srgb = 0x0000003b,
ETC2RGB8UnormSrgb = 0x0000003B, etc2rgb8a1_unorm = 0x0000003c,
ETC2RGB8A1Unorm = 0x0000003C, etc2rgb8a1_unorm_srgb = 0x0000003d,
ETC2RGB8A1UnormSrgb = 0x0000003D, etc2rgba8_unorm = 0x0000003e,
ETC2RGBA8Unorm = 0x0000003E, etc2rgba8_unorm_srgb = 0x0000003f,
ETC2RGBA8UnormSrgb = 0x0000003F, eacr11_unorm = 0x00000040,
EACR11Unorm = 0x00000040, eacr11_snorm = 0x00000041,
EACR11Snorm = 0x00000041, eacrg11_unorm = 0x00000042,
EACRG11Unorm = 0x00000042, eacrg11_snorm = 0x00000043,
EACRG11Snorm = 0x00000043, astc4x4_unorm = 0x00000044,
ASTC4x4Unorm = 0x00000044, astc4x4_unorm_srgb = 0x00000045,
ASTC4x4UnormSrgb = 0x00000045, astc5x4_unorm = 0x00000046,
ASTC5x4Unorm = 0x00000046, astc5x4_unorm_srgb = 0x00000047,
ASTC5x4UnormSrgb = 0x00000047, astc5x5_unorm = 0x00000048,
ASTC5x5Unorm = 0x00000048, astc5x5_unorm_srgb = 0x00000049,
ASTC5x5UnormSrgb = 0x00000049, astc6x5_unorm = 0x0000004a,
ASTC6x5Unorm = 0x0000004A, astc6x5_unorm_srgb = 0x0000004b,
ASTC6x5UnormSrgb = 0x0000004B, astc6x6_unorm = 0x0000004c,
ASTC6x6Unorm = 0x0000004C, astc6x6_unorm_srgb = 0x0000004d,
ASTC6x6UnormSrgb = 0x0000004D, astc8x5_unorm = 0x0000004e,
ASTC8x5Unorm = 0x0000004E, astc8x5_unorm_srgb = 0x0000004f,
ASTC8x5UnormSrgb = 0x0000004F, astc8x6_unorm = 0x00000050,
ASTC8x6Unorm = 0x00000050, astc8x6_unorm_srgb = 0x00000051,
ASTC8x6UnormSrgb = 0x00000051, astc8x8_unorm = 0x00000052,
ASTC8x8Unorm = 0x00000052, astc8x8_unorm_srgb = 0x00000053,
ASTC8x8UnormSrgb = 0x00000053, astc10x5_unorm = 0x00000054,
ASTC10x5Unorm = 0x00000054, astc10x5_unorm_srgb = 0x00000055,
ASTC10x5UnormSrgb = 0x00000055, astc10x6_unorm = 0x00000056,
ASTC10x6Unorm = 0x00000056, astc10x6_unorm_srgb = 0x00000057,
ASTC10x6UnormSrgb = 0x00000057, astc10x8_unorm = 0x00000058,
ASTC10x8Unorm = 0x00000058, astc10x8_unorm_srgb = 0x00000059,
ASTC10x8UnormSrgb = 0x00000059, astc10x10_unorm = 0x0000005a,
ASTC10x10Unorm = 0x0000005A, astc10x10_unorm_srgb = 0x0000005b,
ASTC10x10UnormSrgb = 0x0000005B, astc12x10_unorm = 0x0000005c,
ASTC12x10Unorm = 0x0000005C, astc12x10_unorm_srgb = 0x0000005d,
ASTC12x10UnormSrgb = 0x0000005D, astc12x12_unorm = 0x0000005e,
ASTC12x12Unorm = 0x0000005E, astc12x12_unorm_srgb = 0x0000005f,
ASTC12x12UnormSrgb = 0x0000005F, r8bg8biplanar420_unorm = 0x00000060,
R8BG8Biplanar420Unorm = 0x00000060,
}; };

View file

@ -1,10 +1,9 @@
pub const TextureUsage = enum(u32) { pub const TextureUsage = enum(u32) {
// TODO: enums not CamelCase none = 0x00000000,
None = 0x00000000, copy_src = 0x00000001,
CopySrc = 0x00000001, copy_dst = 0x00000002,
CopyDst = 0x00000002, texture_binding = 0x00000004,
TextureBinding = 0x00000004, storage_binding = 0x00000008,
StorageBinding = 0x00000008, render_attachment = 0x00000010,
RenderAttachment = 0x00000010, present = 0x00000020,
Present = 0x00000020,
}; };