gpu: add Texture.destroy

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-11 13:25:37 -07:00 committed by Stephen Gutekanst
parent 181e0a19f5
commit e9ac2a0f4f
2 changed files with 11 additions and 1 deletions

View file

@ -571,6 +571,11 @@ const texture_vtable = Texture.VTable{
c.wgpuTextureSetLabel(@ptrCast(c.WGPUTexture, ptr), label);
}
}).setLabel,
.destroy = (struct {
pub fn destroy(ptr: *anyopaque) void {
c.wgpuTextureDestroy(@ptrCast(c.WGPUTexture, ptr));
}
}).destroy,
};
fn wrapSampler(sampler: c.WGPUSampler) Sampler {

View file

@ -10,7 +10,7 @@ pub const VTable = struct {
release: fn (ptr: *anyopaque) void,
// TODO:
// WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor);
// WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture);
destroy: fn (ptr: *anyopaque) void,
setLabel: fn (ptr: *anyopaque, label: [:0]const u8) void,
};
@ -26,8 +26,13 @@ pub inline fn setLabel(texture: Texture, label: [:0]const u8) void {
texture.vtable.setLabel(texture.ptr, label);
}
pub inline fn destroy(texture: Texture) void {
texture.vtable.destroy(texture.ptr);
}
test "syntax" {
_ = VTable;
_ = reference;
_ = release;
_ = destroy;
}