From 9b28403d9d90307ab38c3afc3cc6a3d8ac4b7fdc Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 24 Jul 2022 14:46:38 -0700 Subject: [PATCH] gpu: convert BindGroup from enum(usize) to *opaque Signed-off-by: Stephen Gutekanst --- gpu/src/bind_group.zig | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/gpu/src/bind_group.zig b/gpu/src/bind_group.zig index 34832b3f..038fde03 100644 --- a/gpu/src/bind_group.zig +++ b/gpu/src/bind_group.zig @@ -4,27 +4,22 @@ const TextureView = @import("texture_view.zig").TextureView; const ChainedStruct = @import("types.zig").ChainedStruct; const BindGroupLayout = @import("bind_group_layout.zig").BindGroupLayout; -pub const BindGroup = enum(usize) { - _, +pub const BindGroup = *opaque {}; - // TODO: verify there is a use case for nullable value of this type. - pub const none: BindGroup = @intToEnum(BindGroup, 0); - - pub const Entry = extern struct { - next_in_chain: *const ChainedStruct, - binding: u32, - buffer: Buffer = Buffer.none, // nullable - offset: u64, - size: u64, - sampler: Sampler = Sampler.none, // nullable - texture_view: TextureView = TextureView.none, // nullable - }; - - pub const Descriptor = extern struct { - next_in_chain: *const ChainedStruct, - label: ?[*:0]const u8 = null, - layout: BindGroupLayout, - entry_count: u32, - entries: [*]const Entry, - }; +pub const BindGroupEntry = extern struct { + next_in_chain: *const ChainedStruct, + binding: u32, + buffer: Buffer = Buffer.none, // nullable + offset: u64, + size: u64, + sampler: Sampler = Sampler.none, // nullable + texture_view: TextureView = TextureView.none, // nullable +}; + +pub const BindGroupDescriptor = extern struct { + next_in_chain: *const ChainedStruct, + label: ?[*:0]const u8 = null, + layout: BindGroupLayout, + entry_count: u32, + entries: [*]const BindGroupEntry, };