From 7227e9a13f165d791474c39670e833cb57c6ac1e Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Wed, 17 Aug 2022 01:26:52 -0700 Subject: [PATCH] gpu: example: use default values, gpu helper APIs Signed-off-by: Stephen Gutekanst --- gpu/examples/main.zig | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gpu/examples/main.zig b/gpu/examples/main.zig index 9067aa10..6eb0b8d2 100644 --- a/gpu/examples/main.zig +++ b/gpu/examples/main.zig @@ -72,17 +72,16 @@ pub fn main() !void { .blend = &blend, .write_mask = gpu.ColorWriteMaskFlags.all, }; - const fragment = gpu.FragmentState{ + const fragment = gpu.FragmentState.init(.{ .module = fs_module, .entry_point = "main", - .target_count = 1, - .targets = &[_]gpu.ColorTargetState{color_target}, - }; + .targets = &.{color_target}, + }); const pipeline_descriptor = gpu.RenderPipeline.Descriptor{ .fragment = &fragment, .layout = null, .depth_stencil = null, - .vertex = .{ + .vertex = gpu.VertexState{ .module = vs_module, .entry_point = "main", }, @@ -152,12 +151,9 @@ fn frame(params: FrameParams) !void { }; const encoder = params.device.createCommandEncoder(null); - const render_pass_info = gpu.RenderPassDescriptor{ - .color_attachment_count = 1, - .color_attachments = &[_]gpu.RenderPassColorAttachment{color_attachment}, - .depth_stencil_attachment = null, - .occlusion_query_set = null, - }; + const render_pass_info = gpu.RenderPassDescriptor.init(.{ + .color_attachments = &.{color_attachment}, + }); const pass = encoder.beginRenderPass(&render_pass_info); pass.setPipeline(params.pipeline); pass.draw(3, 1, 0, 0);