gpu: implement Texture

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-09 11:48:39 -07:00 committed by Stephen Gutekanst
parent 13b4a93a87
commit 1563fc7246
4 changed files with 47 additions and 7 deletions

23
gpu/src/Texture.zig Normal file
View file

@ -0,0 +1,23 @@
const Texture = @This();
/// The type erased pointer to the Texture implementation
/// Equal to c.WGPUTexture for NativeInstance.
ptr: *anyopaque,
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);
// WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture);
// WGPU_EXPORT void wgpuTextureSetLabel(WGPUTexture texture, char const * label);
};
pub inline fn reference(texture: Texture) void {
texture.vtable.reference(texture.ptr);
}
pub inline fn release(texture: Texture) void {
texture.vtable.release(texture.ptr);
}