gpu: implement ExternalTexture

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-09 23:53:56 -07:00 committed by Stephen Gutekanst
parent 88e1894fbd
commit 616b1529f2
4 changed files with 52 additions and 11 deletions

View file

@ -0,0 +1,28 @@
const ExternalTexture = @This();
/// The type erased pointer to the ExternalTexture implementation
/// Equal to c.WGPUExternalTexture for NativeInstance.
ptr: *anyopaque,
vtable: *const VTable,
pub const VTable = struct {
reference: fn (ptr: *anyopaque) void,
release: fn (ptr: *anyopaque) void,
// TODO:
// WGPU_EXPORT void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture);
// WGPU_EXPORT void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, char const * label);
};
pub inline fn reference(texture: ExternalTexture) void {
texture.vtable.reference(texture.ptr);
}
pub inline fn release(texture: ExternalTexture) void {
texture.vtable.release(texture.ptr);
}
test "syntax" {
_ = VTable;
_ = reference;
_ = release;
}