From c90f22811da8bf57d02c03115ddabeb40cc8f82d Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Fri, 11 Mar 2022 09:13:55 -0700 Subject: [PATCH] gpu: add Sampler.setLabel Signed-off-by: Stephen Gutekanst --- gpu/src/NativeInstance.zig | 5 +++++ gpu/src/Sampler.zig | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gpu/src/NativeInstance.zig b/gpu/src/NativeInstance.zig index 2cbbcda1..8a574457 100644 --- a/gpu/src/NativeInstance.zig +++ b/gpu/src/NativeInstance.zig @@ -571,6 +571,11 @@ const sampler_vtable = Sampler.VTable{ c.wgpuSamplerRelease(@ptrCast(c.WGPUSampler, ptr)); } }).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 { diff --git a/gpu/src/Sampler.zig b/gpu/src/Sampler.zig index 5eb08d9d..6f3866e7 100644 --- a/gpu/src/Sampler.zig +++ b/gpu/src/Sampler.zig @@ -8,8 +8,7 @@ vtable: *const VTable, pub const VTable = struct { reference: fn (ptr: *anyopaque) void, release: fn (ptr: *anyopaque) void, - // TODO: - // WGPU_EXPORT void wgpuSamplerSetLabel(WGPUSampler sampler, char const * label); + setLabel: fn (ptr: *anyopaque, label: [:0]const u8) void, }; pub inline fn reference(sampler: Sampler) void { @@ -20,6 +19,10 @@ pub inline fn release(sampler: Sampler) void { sampler.vtable.release(sampler.ptr); } +pub inline fn setLabel(sampler: Sampler, label: [:0]const u8) void { + sampler.vtable.setLabel(sampler.ptr, label); +} + test "syntax" { _ = VTable; _ = reference;