gpu: add Texture.setLabel

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-11 09:15:50 -07:00 committed by Stephen Gutekanst
parent 7c94856ed6
commit e674250ec5
2 changed files with 10 additions and 1 deletions

View file

@ -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 {

View file

@ -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;