gpu: add ColorTargetState

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-16 20:57:08 -07:00 committed by Stephen Gutekanst
parent 5b66e3fbe0
commit 44d378e102
2 changed files with 10 additions and 10 deletions

View file

@ -1,10 +1,3 @@
pub const ColorTargetState = extern struct {
next_in_chain: *const ChainedStruct,
format: TextureFormat,
blend: ?*const BlendState = null,
write_mask: ColorWriteMaskFlags,
};
pub const WGPUComputePipelineDescriptor = extern struct {
next_in_chain: *const ChainedStruct,
label: ?[*:0]const u8 = null,

View file

@ -300,7 +300,7 @@ pub const VertexStepMode = enum(u32) {
vertex_buffer_not_used = 0x00000002,
};
pub const ColorWriteMask = packed struct {
pub const ColorWriteMaskFlags = packed struct {
red: bool = false,
green: bool = false,
blue: bool = false,
@ -315,14 +315,14 @@ pub const ColorWriteMask = packed struct {
);
}
pub const all = ColorWriteMask{
pub const all = ColorWriteMaskFlags{
.red = true,
.green = true,
.blue = true,
.alpha = true,
};
pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool {
pub fn equal(a: ColorWriteMaskFlags, b: ColorWriteMaskFlags) bool {
return @truncate(u4, @bitCast(u32, a)) == @truncate(u4, @bitCast(u32, b));
}
};
@ -584,6 +584,13 @@ pub const VertexBufferLayout = extern struct {
attributes: [*]const VertexAttribute,
};
pub const ColorTargetState = extern struct {
next_in_chain: *const ChainedStruct,
format: Texture.Format,
blend: ?*const BlendState = null,
write_mask: ColorWriteMaskFlags,
};
test "BackendType name" {
try testing.expectEqualStrings("Vulkan", BackendType.vulkan.name());
}