gpu: add ColorWriteMask flagset
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
e218eef6cb
commit
81301ea2c1
2 changed files with 29 additions and 11 deletions
|
|
@ -1,16 +1,5 @@
|
|||
typedef uint32_t WGPUFlags;
|
||||
|
||||
typedef enum WGPUColorWriteMask {
|
||||
WGPUColorWriteMask_None = 0x00000000,
|
||||
WGPUColorWriteMask_Red = 0x00000001,
|
||||
WGPUColorWriteMask_Green = 0x00000002,
|
||||
WGPUColorWriteMask_Blue = 0x00000004,
|
||||
WGPUColorWriteMask_Alpha = 0x00000008,
|
||||
WGPUColorWriteMask_All = 0x0000000F,
|
||||
WGPUColorWriteMask_Force32 = 0x7FFFFFFF
|
||||
} WGPUColorWriteMask;
|
||||
typedef WGPUFlags WGPUColorWriteMaskFlags;
|
||||
|
||||
typedef enum WGPUMapMode {
|
||||
WGPUMapMode_None = 0x00000000,
|
||||
WGPUMapMode_Read = 0x00000001,
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue