gpu: add Sampler.setLabel

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-11 09:13:55 -07:00 committed by Stephen Gutekanst
parent acbb008492
commit c90f22811d
2 changed files with 10 additions and 2 deletions

View file

@ -571,6 +571,11 @@ const sampler_vtable = Sampler.VTable{
c.wgpuSamplerRelease(@ptrCast(c.WGPUSampler, ptr)); c.wgpuSamplerRelease(@ptrCast(c.WGPUSampler, ptr));
} }
}).release, }).release,
.setLabel = (struct {
pub fn setLabel(ptr: *anyopaque, label: [:0]const u8) void {
c.wgpuSamplerSetLabel(@ptrCast(c.WGPUSampler, ptr), label);
}
}).setLabel,
}; };
fn wrapRenderPipeline(pipeline: c.WGPURenderPipeline) RenderPipeline { fn wrapRenderPipeline(pipeline: c.WGPURenderPipeline) RenderPipeline {

View file

@ -8,8 +8,7 @@ vtable: *const VTable,
pub const VTable = struct { pub const VTable = struct {
reference: fn (ptr: *anyopaque) void, reference: fn (ptr: *anyopaque) void,
release: fn (ptr: *anyopaque) void, release: fn (ptr: *anyopaque) void,
// TODO: setLabel: fn (ptr: *anyopaque, label: [:0]const u8) void,
// WGPU_EXPORT void wgpuSamplerSetLabel(WGPUSampler sampler, char const * label);
}; };
pub inline fn reference(sampler: Sampler) void { pub inline fn reference(sampler: Sampler) void {
@ -20,6 +19,10 @@ pub inline fn release(sampler: Sampler) void {
sampler.vtable.release(sampler.ptr); sampler.vtable.release(sampler.ptr);
} }
pub inline fn setLabel(sampler: Sampler, label: [:0]const u8) void {
sampler.vtable.setLabel(sampler.ptr, label);
}
test "syntax" { test "syntax" {
_ = VTable; _ = VTable;
_ = reference; _ = reference;