gpu: add ShaderStage flagset
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
17f3c174dc
commit
72d9a325fe
2 changed files with 22 additions and 10 deletions
|
|
@ -1,14 +1,5 @@
|
|||
typedef uint32_t WGPUFlags;
|
||||
|
||||
typedef enum WGPUShaderStage {
|
||||
WGPUShaderStage_None = 0x00000000,
|
||||
WGPUShaderStage_Vertex = 0x00000001,
|
||||
WGPUShaderStage_Fragment = 0x00000002,
|
||||
WGPUShaderStage_Compute = 0x00000004,
|
||||
WGPUShaderStage_Force32 = 0x7FFFFFFF
|
||||
} WGPUShaderStage;
|
||||
typedef WGPUFlags WGPUShaderStageFlags;
|
||||
|
||||
typedef enum WGPUTextureUsage {
|
||||
WGPUTextureUsage_None = 0x00000000,
|
||||
WGPUTextureUsage_CopySrc = 0x00000001,
|
||||
|
|
|
|||
|
|
@ -338,11 +338,32 @@ pub const MapMode = packed struct {
|
|||
|
||||
pub const undef = MapMode{};
|
||||
|
||||
pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool {
|
||||
pub fn equal(a: MapMode, b: MapMode) bool {
|
||||
return @truncate(u2, @bitCast(u32, a)) == @truncate(u2, @bitCast(u32, b));
|
||||
}
|
||||
};
|
||||
|
||||
pub const ShaderStage = packed struct {
|
||||
vertex: bool = false,
|
||||
fragment: bool = false,
|
||||
compute: bool = false,
|
||||
|
||||
_padding: u29 = 0,
|
||||
|
||||
comptime {
|
||||
std.debug.assert(
|
||||
@sizeOf(@This()) == @sizeOf(u32) and
|
||||
@bitSizeOf(@This()) == @bitSizeOf(u32),
|
||||
);
|
||||
}
|
||||
|
||||
pub const none = ShaderStage{};
|
||||
|
||||
pub fn equal(a: ShaderStage, b: ShaderStage) bool {
|
||||
return @truncate(u3, @bitCast(u32, a)) == @truncate(u3, @bitCast(u32, b));
|
||||
}
|
||||
};
|
||||
|
||||
test "BackendType name" {
|
||||
try testing.expectEqualStrings("Vulkan", BackendType.vulkan.name());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue