gpu: implement Texture.createView

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-15 21:14:57 -07:00 committed by Stephen Gutekanst
parent 9fae887555
commit 856c98c4c1
2 changed files with 24 additions and 2 deletions

View file

@ -12,10 +12,9 @@ vtable: *const VTable,
pub const VTable = struct {
reference: fn (ptr: *anyopaque) void,
release: fn (ptr: *anyopaque) void,
// TODO:
// WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor);
destroy: fn (ptr: *anyopaque) void,
setLabel: fn (ptr: *anyopaque, label: [:0]const u8) void,
createView: fn (ptr: *anyopaque, descriptor: *const TextureView.Descriptor) TextureView,
};
pub inline fn reference(texture: Texture) void {
@ -34,6 +33,10 @@ pub inline fn destroy(texture: Texture) void {
texture.vtable.destroy(texture.ptr);
}
pub inline fn createView(texture: Texture, descriptor: *const TextureView.Descriptor) TextureView {
return texture.vtable.createView(texture.ptr, descriptor);
}
pub const Descriptor = struct {
label: ?[*:0]const u8 = null,
usage: Usage,