gpu: nativeCreateSwapChain surface is optional
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
e9ac31f264
commit
6ecc6d97a1
2 changed files with 4 additions and 4 deletions
|
|
@ -343,7 +343,7 @@ const device_vtable = Device.VTable{
|
|||
}
|
||||
}).createShaderModule,
|
||||
.nativeCreateSwapChain = (struct {
|
||||
pub fn nativeCreateSwapChain(ptr: *anyopaque, surface: Surface, descriptor: SwapChain.Descriptor) SwapChain {
|
||||
pub fn nativeCreateSwapChain(ptr: *anyopaque, surface: ?Surface, descriptor: SwapChain.Descriptor) SwapChain {
|
||||
const desc = c.WGPUSwapChainDescriptor{
|
||||
.nextInChain = null,
|
||||
.label = if (descriptor.label) |l| @ptrCast([*c]const u8, l) else null,
|
||||
|
|
@ -356,7 +356,7 @@ const device_vtable = Device.VTable{
|
|||
};
|
||||
return wrapSwapChain(c.wgpuDeviceCreateSwapChain(
|
||||
@ptrCast(c.WGPUDevice, ptr),
|
||||
@ptrCast(c.WGPUSurface, surface.ptr),
|
||||
if (surface) |surf| @ptrCast(c.WGPUSurface, surf.ptr) else null,
|
||||
&desc,
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue