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
|
|
@ -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