From 9a36a74e49a582b87ecf4f1329541b004bd534cf Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Tue, 16 Aug 2022 20:16:16 -0700 Subject: [PATCH] gpu: add type-safety for chaining PrimitiveDepthClipControl 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 90e0e020..773e5d24 100644 --- a/gpu/src/types.zig +++ b/gpu/src/types.zig @@ -571,14 +571,18 @@ pub const MultisampleState = extern struct { alpha_to_coverage_enabled: bool = false, }; -/// TODO: Can be chained in gpu.PrimitiveState pub const PrimitiveDepthClipControl = extern struct { chain: ChainedStruct = .{ .next = null, .s_type = .primitive_depth_clip_control }, unclipped_depth: bool = false, }; pub const PrimitiveState = extern struct { - next_in_chain: ?*const ChainedStruct = null, + pub const NextInChain = extern union { + generic: ?*const ChainedStruct, + primitive_depth_clip_control: *const PrimitiveDepthClipControl, + }; + + next_in_chain: NextInChain = .{ .generic = null }, topology: PrimitiveTopology = .triangle_list, strip_index_format: IndexFormat = .undef, front_face: FrontFace = .ccw,