gpu: example: use gpu.BlendState
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
400833c8c6
commit
956681afbd
1 changed files with 13 additions and 8 deletions
|
|
@ -89,17 +89,22 @@ pub fn main() !void {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fragment state
|
// Fragment state
|
||||||
var blend = std.mem.zeroes(c.WGPUBlendState);
|
const blend = gpu.BlendState{
|
||||||
blend.color.operation = c.WGPUBlendOperation_Add;
|
.color = .{
|
||||||
blend.color.srcFactor = c.WGPUBlendFactor_One;
|
.operation = .add,
|
||||||
blend.color.dstFactor = c.WGPUBlendFactor_One;
|
.src_factor = .one,
|
||||||
blend.alpha.operation = c.WGPUBlendOperation_Add;
|
.dst_factor = .one,
|
||||||
blend.alpha.srcFactor = c.WGPUBlendFactor_One;
|
},
|
||||||
blend.alpha.dstFactor = c.WGPUBlendFactor_One;
|
.alpha = .{
|
||||||
|
.operation = .add,
|
||||||
|
.src_factor = .one,
|
||||||
|
.dst_factor = .one,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
var color_target = std.mem.zeroes(c.WGPUColorTargetState);
|
var color_target = std.mem.zeroes(c.WGPUColorTargetState);
|
||||||
color_target.format = @enumToInt(window_data.swap_chain_format);
|
color_target.format = @enumToInt(window_data.swap_chain_format);
|
||||||
color_target.blend = &blend;
|
color_target.blend = @ptrCast(*const c.WGPUBlendState, &blend);
|
||||||
color_target.writeMask = c.WGPUColorWriteMask_All;
|
color_target.writeMask = c.WGPUColorWriteMask_All;
|
||||||
|
|
||||||
var fragment = std.mem.zeroes(c.WGPUFragmentState);
|
var fragment = std.mem.zeroes(c.WGPUFragmentState);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue