gpu: implement Device.tick

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-18 15:08:12 -07:00 committed by Stephen Gutekanst
parent 789f6291e4
commit 482d5aaa34
2 changed files with 11 additions and 2 deletions

View file

@ -87,8 +87,7 @@ pub const VTable = struct {
// TODO: callback // TODO: callback
// setUncapturedErrorCallback: fn (ptr: *anyopaque, callback: UncapturedErrorCallback) void, // setUncapturedErrorCallback: fn (ptr: *anyopaque, callback: UncapturedErrorCallback) void,
// WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata); // WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata);
// tick: fn (ptr: *anyopaque) void, tick: fn (ptr: *anyopaque) void,
// WGPU_EXPORT void wgpuDeviceTick(WGPUDevice device);
}; };
pub inline fn reference(device: Device) void { pub inline fn reference(device: Device) void {
@ -154,6 +153,10 @@ pub inline fn createRenderPipelineAsync(
device.vtable.createRenderPipelineAsync(device.ptr, descriptor, callback); device.vtable.createRenderPipelineAsync(device.ptr, descriptor, callback);
} }
pub inline fn tick(device: Device) void {
device.vtable.tick(device.ptr);
}
pub const Descriptor = struct { pub const Descriptor = struct {
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
required_features: ?[]Feature = null, required_features: ?[]Feature = null,
@ -180,6 +183,7 @@ test {
_ = createComputePipelineAsync; _ = createComputePipelineAsync;
_ = createRenderPipeline; _ = createRenderPipeline;
_ = createRenderPipelineAsync; _ = createRenderPipelineAsync;
_ = tick;
_ = Descriptor; _ = Descriptor;
_ = LostReason; _ = LostReason;
} }

View file

@ -533,6 +533,11 @@ const device_vtable = Device.VTable{
); );
} }
}).createRenderPipelineAsync, }).createRenderPipelineAsync,
.tick = (struct {
pub fn tick(ptr: *anyopaque) void {
c.wgpuDeviceTick(@ptrCast(c.WGPUDevice, ptr));
}
}.tick),
}; };
inline fn convertComputePipelineDescriptor(descriptor: *const ComputePipeline.Descriptor) c.WGPUComputePipelineDescriptor { inline fn convertComputePipelineDescriptor(descriptor: *const ComputePipeline.Descriptor) c.WGPUComputePipelineDescriptor {