gpu: implement Device.popErrorScope

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-18 18:21:54 -07:00 committed by Stephen Gutekanst
parent ec59471765
commit 8df0c70c69
3 changed files with 59 additions and 3 deletions

View file

@ -10,6 +10,7 @@ const Feature = @import("enums.zig").Feature;
const ErrorType = @import("enums.zig").ErrorType;
const ErrorFilter = @import("enums.zig").ErrorFilter;
const Limits = @import("data.zig").Limits;
const ErrorCallback = @import("structs.zig").ErrorCallback;
const Queue = @import("Queue.zig");
const ShaderModule = @import("ShaderModule.zig");
const Surface = @import("Surface.zig");
@ -72,9 +73,7 @@ pub const VTable = struct {
// WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeature feature);
injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
loseForTesting: fn (ptr: *anyopaque) void,
// TODO: callback
// popErrorScope: fn (ptr: *anyopaque, callback: ErrorCallback) bool,
// WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata);
popErrorScope: fn (ptr: *anyopaque, callback: *ErrorCallback) bool,
pushErrorScope: fn (ptr: *anyopaque, filter: ErrorFilter) void,
// TODO: callback
// setDeviceLostCallback: fn (ptr: *anyopaque, callback: DeviceLostCallback) void,
@ -108,6 +107,10 @@ pub inline fn loseForTesting(device: Device) void {
device.vtable.loseForTesting(device.ptr);
}
pub inline fn popErrorScope(device: Device, callback: *ErrorCallback) bool {
return device.vtable.popErrorScope(device.ptr, callback);
}
pub inline fn pushErrorScope(device: Device, filter: ErrorFilter) void {
device.vtable.pushErrorScope(device.ptr, filter);
}
@ -217,6 +220,7 @@ test {
_ = getQueue;
_ = injectError;
_ = loseForTesting;
_ = popErrorScope;
_ = createBindGroup;
_ = pushErrorScope;
_ = createBindGroupLayout;