From e674250ec560f3ecc74a739a3e06610969490b9c Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Fri, 11 Mar 2022 09:15:50 -0700 Subject: [PATCH] gpu: add Texture.setLabel Signed-off-by: Stephen Gutekanst --- gpu/src/NativeInstance.zig | 5 +++++ gpu/src/Texture.zig | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gpu/src/NativeInstance.zig b/gpu/src/NativeInstance.zig index a4298419..8583f011 100644 --- a/gpu/src/NativeInstance.zig +++ b/gpu/src/NativeInstance.zig @@ -556,6 +556,11 @@ const texture_vtable = Texture.VTable{ c.wgpuTextureRelease(@ptrCast(c.WGPUTexture, ptr)); } }).release, + .setLabel = (struct { + pub fn setLabel(ptr: *anyopaque, label: [:0]const u8) void { + c.wgpuTextureSetLabel(@ptrCast(c.WGPUTexture, ptr), label); + } + }).setLabel, }; fn wrapSampler(sampler: c.WGPUSampler) Sampler { diff --git a/gpu/src/Texture.zig b/gpu/src/Texture.zig index 65e07808..2caee81a 100644 --- a/gpu/src/Texture.zig +++ b/gpu/src/Texture.zig @@ -11,7 +11,7 @@ pub const VTable = struct { // TODO: // WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor); // WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture); - // WGPU_EXPORT void wgpuTextureSetLabel(WGPUTexture texture, char const * label); + setLabel: fn (ptr: *anyopaque, label: [:0]const u8) void, }; pub inline fn reference(texture: Texture) void { @@ -22,6 +22,10 @@ pub inline fn release(texture: Texture) void { texture.vtable.release(texture.ptr); } +pub inline fn setLabel(texture: Texture, label: [:0]const u8) void { + texture.vtable.setLabel(texture.ptr, label); +} + test "syntax" { _ = VTable; _ = reference;