From 66504ca724889555bf9fcfa4d1d8374f47969b2b Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Thu, 10 Mar 2022 00:15:35 -0700 Subject: [PATCH] gpu: implement BindGroupLayout Signed-off-by: Stephen Gutekanst --- gpu/src/BindGroupLayout.zig | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gpu/src/BindGroupLayout.zig diff --git a/gpu/src/BindGroupLayout.zig b/gpu/src/BindGroupLayout.zig new file mode 100644 index 00000000..94b4d2d0 --- /dev/null +++ b/gpu/src/BindGroupLayout.zig @@ -0,0 +1,27 @@ +const BindGroupLayout = @This(); + +/// The type erased pointer to the BindGroupLayout implementation +/// Equal to c.WGPUBindGroupLayout for NativeInstance. +ptr: *anyopaque, +vtable: *const VTable, + +pub const VTable = struct { + reference: fn (ptr: *anyopaque) void, + release: fn (ptr: *anyopaque) void, + // TODO: + // WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, char const * label); +}; + +pub inline fn reference(layout: BindGroupLayout) void { + layout.vtable.reference(layout.ptr); +} + +pub inline fn release(layout: BindGroupLayout) void { + layout.vtable.release(layout.ptr); +} + +test "syntax" { + _ = VTable; + _ = reference; + _ = release; +}