From 956681afbd2090cf478b09847468d4dbb24eb88f Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Fri, 11 Mar 2022 18:53:36 -0700 Subject: [PATCH] gpu: example: use gpu.BlendState Signed-off-by: Stephen Gutekanst --- gpu/examples/main.zig | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/gpu/examples/main.zig b/gpu/examples/main.zig index 401bc93c..00c86c28 100644 --- a/gpu/examples/main.zig +++ b/gpu/examples/main.zig @@ -89,17 +89,22 @@ pub fn main() !void { }); // Fragment state - var blend = std.mem.zeroes(c.WGPUBlendState); - blend.color.operation = c.WGPUBlendOperation_Add; - blend.color.srcFactor = c.WGPUBlendFactor_One; - blend.color.dstFactor = c.WGPUBlendFactor_One; - blend.alpha.operation = c.WGPUBlendOperation_Add; - blend.alpha.srcFactor = c.WGPUBlendFactor_One; - blend.alpha.dstFactor = c.WGPUBlendFactor_One; + const blend = gpu.BlendState{ + .color = .{ + .operation = .add, + .src_factor = .one, + .dst_factor = .one, + }, + .alpha = .{ + .operation = .add, + .src_factor = .one, + .dst_factor = .one, + }, + }; var color_target = std.mem.zeroes(c.WGPUColorTargetState); 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; var fragment = std.mem.zeroes(c.WGPUFragmentState);