gpu: implement BindGroup

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-10 00:10:32 -07:00 committed by Stephen Gutekanst
parent 616b1529f2
commit 9162a8136f
4 changed files with 51 additions and 67 deletions

27
gpu/src/BindGroup.zig Normal file
View file

@ -0,0 +1,27 @@
const BindGroup = @This();
/// The type erased pointer to the BindGroup implementation
/// Equal to c.WGPUBindGroup 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 wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, char const * label);
};
pub inline fn reference(group: BindGroup) void {
group.vtable.reference(group.ptr);
}
pub inline fn release(group: BindGroup) void {
group.vtable.release(group.ptr);
}
test "syntax" {
_ = VTable;
_ = reference;
_ = release;
}