gpu: add Device.createShaderModuleWGSL helper

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-16 21:59:46 -07:00
parent 4ba5640da4
commit 358baf08e2
3 changed files with 18 additions and 12 deletions

View file

@ -194,6 +194,20 @@ pub const Device = opaque {
return Impl.deviceCreateShaderModule(device, descriptor);
}
/// Helper to make createShaderModule invocations slightly nicer.
pub inline fn createShaderModuleWGSL(
device: *Device,
label: ?[*:0]const u8,
wgsl_source: [*:0]const u8,
) *ShaderModule {
return device.createShaderModule(&ShaderModule.Descriptor{
.next_in_chain = .{ .wgsl_descriptor = &.{
.source = wgsl_source,
} },
.label = label,
});
}
pub inline fn createSwapChain(device: *Device, surface: ?*Surface, descriptor: *const SwapChain.Descriptor) *SwapChain {
return Impl.deviceCreateSwapChain(device, surface, descriptor);
}