mach/gpu/src/ShaderModule.zig
Stephen Gutekanst e9ac31f264 gpu: implement Device.nativeCreateSwapChain, SwapChain
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-19 00:51:48 -07:00

43 lines
1 KiB
Zig

const ShaderModule = @This();
/// The type erased pointer to the ShaderModule implementation
/// Equal to c.WGPUShaderModule 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 wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata);
// WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char const * label);
};
pub inline fn reference(queue: ShaderModule) void {
queue.vtable.reference(queue.ptr);
}
pub inline fn release(queue: ShaderModule) void {
queue.vtable.release(queue.ptr);
}
pub const CodeTag = enum {
spirv,
wgsl,
};
pub const Descriptor = struct {
label: ?[]const u8 = null,
code: union(CodeTag) {
wgsl: [:0]const u8,
spirv: []const u32,
},
};
test "syntax" {
_ = VTable;
_ = reference;
_ = release;
_ = CodeTag;
_ = Descriptor;
}