From 34ea41e319d725f56f9dce68f479a5cbe436f9aa Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Tue, 16 Aug 2022 20:17:59 -0700 Subject: [PATCH] gpu: add type-safety for chaining RenderPassDescriptorMaxDrawCount Signed-off-by: Stephen Gutekanst --- gpu/src/types.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gpu/src/types.zig b/gpu/src/types.zig index 773e5d24..c465dd1e 100644 --- a/gpu/src/types.zig +++ b/gpu/src/types.zig @@ -76,7 +76,12 @@ pub const ComputePassDescriptor = extern struct { }; pub const RenderPassDescriptor = extern struct { - next_in_chain: ?*const ChainedStruct = null, + pub const NextInChain = extern union { + generic: ?*const ChainedStruct, + max_draw_count: *const RenderPassDescriptorMaxDrawCount, + }; + + next_in_chain: NextInChain = .{ .generic = null }, label: ?[*:0]const u8 = null, color_attachment_count: u32 = 0, color_attachments: ?[*]const RenderPassColorAttachment = null, @@ -589,7 +594,6 @@ pub const PrimitiveState = extern struct { cull_mode: CullMode = .none, }; -/// TODO: Can be chained in gpu.RenderPassDescriptor pub const RenderPassDescriptorMaxDrawCount = extern struct { chain: ChainedStruct = .{ .next = null, .s_type = .render_pass_descriptor_max_draw_count }, max_draw_count: u64 = 50000000,