gpu: implement RenderPipeline

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-09 11:57:49 -07:00 committed by Stephen Gutekanst
parent b29fa9e13d
commit 8684195e19
4 changed files with 52 additions and 11 deletions

View file

@ -0,0 +1,28 @@
const RenderPipeline = @This();
/// The type erased pointer to the RenderPipeline implementation
/// Equal to c.WGPURenderPipeline for NativeInstance.
ptr: *anyopaque,
vtable: *const VTable,
pub const VTable = struct {
reference: fn (ptr: *anyopaque) void,
release: fn (ptr: *anyopaque) void,
// TODO:
// WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex);
// WGPU_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, char const * label);
};
pub inline fn reference(pipeline: RenderPipeline) void {
pipeline.vtable.reference(pipeline.ptr);
}
pub inline fn release(pipeline: RenderPipeline) void {
pipeline.vtable.release(pipeline.ptr);
}
test "syntax" {
_ = VTable;
_ = reference;
_ = release;
}