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
|
|
@ -37,7 +37,7 @@ pub const VTable = struct {
|
||||||
// WGPU_EXPORT void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata);
|
// WGPU_EXPORT void wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void * userdata);
|
||||||
// WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPUSamplerDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPUSamplerDescriptor const * descriptor);
|
||||||
createShaderModule: fn (ptr: *anyopaque, descriptor: *const ShaderModule.Descriptor) ShaderModule,
|
createShaderModule: fn (ptr: *anyopaque, descriptor: *const ShaderModule.Descriptor) ShaderModule,
|
||||||
nativeCreateSwapChain: fn (ptr: *anyopaque, surface: Surface, descriptor: SwapChain.Descriptor) SwapChain,
|
nativeCreateSwapChain: fn (ptr: *anyopaque, surface: ?Surface, descriptor: SwapChain.Descriptor) SwapChain,
|
||||||
// WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor);
|
||||||
// WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device);
|
// WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device);
|
||||||
// WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName * features);
|
// WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName * features);
|
||||||
|
|
@ -73,7 +73,7 @@ pub inline fn createShaderModule(device: Device, descriptor: *const ShaderModule
|
||||||
return device.vtable.createShaderModule(device.ptr, descriptor);
|
return device.vtable.createShaderModule(device.ptr, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn nativeCreateSwapChain(device: Device, surface: Surface, descriptor: SwapChain.Descriptor) SwapChain {
|
pub inline fn nativeCreateSwapChain(device: Device, surface: ?Surface, descriptor: SwapChain.Descriptor) SwapChain {
|
||||||
return device.vtable.nativeCreateSwapChain(device.ptr, surface, descriptor);
|
return device.vtable.nativeCreateSwapChain(device.ptr, surface, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ const device_vtable = Device.VTable{
|
||||||
}
|
}
|
||||||
}).createShaderModule,
|
}).createShaderModule,
|
||||||
.nativeCreateSwapChain = (struct {
|
.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{
|
const desc = c.WGPUSwapChainDescriptor{
|
||||||
.nextInChain = null,
|
.nextInChain = null,
|
||||||
.label = if (descriptor.label) |l| @ptrCast([*c]const u8, l) else 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(
|
return wrapSwapChain(c.wgpuDeviceCreateSwapChain(
|
||||||
@ptrCast(c.WGPUDevice, ptr),
|
@ptrCast(c.WGPUDevice, ptr),
|
||||||
@ptrCast(c.WGPUSurface, surface.ptr),
|
if (surface) |surf| @ptrCast(c.WGPUSurface, surf.ptr) else null,
|
||||||
&desc,
|
&desc,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue