From 26ecb102f7793ea1d861457fe46b99062aa965c6 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Mon, 11 Jul 2022 08:38:47 -0700 Subject: [PATCH] gpu: add VertexFormat enum Signed-off-by: Stephen Gutekanst --- gpu/TODO-webgpu.h | 36 ------------------------------------ gpu/src/types.zig | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/gpu/TODO-webgpu.h b/gpu/TODO-webgpu.h index 6d274193..1b5d5f60 100644 --- a/gpu/TODO-webgpu.h +++ b/gpu/TODO-webgpu.h @@ -1,41 +1,5 @@ typedef uint32_t WGPUFlags; - -typedef enum WGPUVertexFormat { - WGPUVertexFormat_Undefined = 0x00000000, - WGPUVertexFormat_Uint8x2 = 0x00000001, - WGPUVertexFormat_Uint8x4 = 0x00000002, - WGPUVertexFormat_Sint8x2 = 0x00000003, - WGPUVertexFormat_Sint8x4 = 0x00000004, - WGPUVertexFormat_Unorm8x2 = 0x00000005, - WGPUVertexFormat_Unorm8x4 = 0x00000006, - WGPUVertexFormat_Snorm8x2 = 0x00000007, - WGPUVertexFormat_Snorm8x4 = 0x00000008, - WGPUVertexFormat_Uint16x2 = 0x00000009, - WGPUVertexFormat_Uint16x4 = 0x0000000A, - WGPUVertexFormat_Sint16x2 = 0x0000000B, - WGPUVertexFormat_Sint16x4 = 0x0000000C, - WGPUVertexFormat_Unorm16x2 = 0x0000000D, - WGPUVertexFormat_Unorm16x4 = 0x0000000E, - WGPUVertexFormat_Snorm16x2 = 0x0000000F, - WGPUVertexFormat_Snorm16x4 = 0x00000010, - WGPUVertexFormat_Float16x2 = 0x00000011, - WGPUVertexFormat_Float16x4 = 0x00000012, - WGPUVertexFormat_Float32 = 0x00000013, - WGPUVertexFormat_Float32x2 = 0x00000014, - WGPUVertexFormat_Float32x3 = 0x00000015, - WGPUVertexFormat_Float32x4 = 0x00000016, - WGPUVertexFormat_Uint32 = 0x00000017, - WGPUVertexFormat_Uint32x2 = 0x00000018, - WGPUVertexFormat_Uint32x3 = 0x00000019, - WGPUVertexFormat_Uint32x4 = 0x0000001A, - WGPUVertexFormat_Sint32 = 0x0000001B, - WGPUVertexFormat_Sint32x2 = 0x0000001C, - WGPUVertexFormat_Sint32x3 = 0x0000001D, - WGPUVertexFormat_Sint32x4 = 0x0000001E, - WGPUVertexFormat_Force32 = 0x7FFFFFFF -} WGPUVertexFormat; - typedef enum WGPUVertexStepMode { WGPUVertexStepMode_Vertex = 0x00000000, WGPUVertexStepMode_Instance = 0x00000001, diff --git a/gpu/src/types.zig b/gpu/src/types.zig index 8716bd1e..2613e387 100644 --- a/gpu/src/types.zig +++ b/gpu/src/types.zig @@ -255,6 +255,40 @@ pub const StoreOp = enum(u32) { discard = 0x00000002, }; +pub const VertexFormat = enum(u32) { + undef = 0x00000000, + uint8x2 = 0x00000001, + uint8x4 = 0x00000002, + sint8x2 = 0x00000003, + sint8x4 = 0x00000004, + unorm8x2 = 0x00000005, + unorm8x4 = 0x00000006, + snorm8x2 = 0x00000007, + snorm8x4 = 0x00000008, + uint16x2 = 0x00000009, + uint16x4 = 0x0000000a, + sint16x2 = 0x0000000b, + sint16x4 = 0x0000000c, + unorm16x2 = 0x0000000d, + unorm16x4 = 0x0000000e, + snorm16x2 = 0x0000000f, + snorm16x4 = 0x00000010, + float16x2 = 0x00000011, + float16x4 = 0x00000012, + float32 = 0x00000013, + float32x2 = 0x00000014, + float32x3 = 0x00000015, + float32x4 = 0x00000016, + uint32 = 0x00000017, + uint32x2 = 0x00000018, + uint32x3 = 0x00000019, + uint32x4 = 0x0000001a, + sint32 = 0x0000001b, + sint32x2 = 0x0000001c, + sint32x3 = 0x0000001d, + sint32x4 = 0x0000001e, +}; + test "BackendType name" { try testing.expectEqualStrings("Vulkan", BackendType.vulkan.name()); }