gpu: add ColorWriteMask flagset

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-11 08:50:37 -07:00 committed by Stephen Gutekanst
parent e218eef6cb
commit 81301ea2c1
2 changed files with 29 additions and 11 deletions

View file

@ -295,6 +295,35 @@ pub const VertexStepMode = enum(u32) {
vertex_buffer_not_used = 0x00000002,
};
pub const ColorWriteMask = packed struct {
red: bool = false,
green: bool = false,
blue: bool = false,
alpha: bool = false,
_pad0: u4 = 0,
_pad1: u8 = 0,
_pad2: u16 = 0,
comptime {
std.debug.assert(
@sizeOf(@This()) == @sizeOf(u32) and
@bitSizeOf(@This()) == @bitSizeOf(u32),
);
}
pub const all = ColorWriteMask{
.red = true,
.green = true,
.blue = true,
.alpha = true,
};
pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool {
return @bitCast(a, u32) == @bitCast(b, u32);
}
};
test "BackendType name" {
try testing.expectEqualStrings("Vulkan", BackendType.vulkan.name());
}