gpu: implement Device.loseForTesting
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
85d5de1077
commit
311f2967a5
2 changed files with 11 additions and 2 deletions
|
|
@ -70,8 +70,7 @@ pub const VTable = struct {
|
||||||
// TODO: should hasFeature be a helper method?
|
// TODO: should hasFeature be a helper method?
|
||||||
// WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeature feature);
|
// WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeature feature);
|
||||||
injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
|
injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
|
||||||
// loseForTesting: fn (ptr: *anyopaque) void,
|
loseForTesting: fn (ptr: *anyopaque) void,
|
||||||
// WGPU_EXPORT void wgpuDeviceLoseForTesting(WGPUDevice device);
|
|
||||||
// TODO: callback
|
// TODO: callback
|
||||||
// popErrorScope: fn (ptr: *anyopaque, callback: ErrorCallback) bool,
|
// popErrorScope: fn (ptr: *anyopaque, callback: ErrorCallback) bool,
|
||||||
// WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata);
|
// WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata);
|
||||||
|
|
@ -105,6 +104,10 @@ pub inline fn injectError(device: Device, typ: ErrorType, message: [*:0]const u8
|
||||||
device.vtable.injectError(device.ptr, typ, message);
|
device.vtable.injectError(device.ptr, typ, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub inline fn loseForTesting(device: Device) void {
|
||||||
|
device.vtable.loseForTesting(device.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
pub inline fn createBindGroup(device: Device, descriptor: *const BindGroup.Descriptor) BindGroup {
|
pub inline fn createBindGroup(device: Device, descriptor: *const BindGroup.Descriptor) BindGroup {
|
||||||
return device.vtable.createBindGroup(device.ptr, descriptor);
|
return device.vtable.createBindGroup(device.ptr, descriptor);
|
||||||
}
|
}
|
||||||
|
|
@ -209,6 +212,7 @@ test {
|
||||||
_ = release;
|
_ = release;
|
||||||
_ = getQueue;
|
_ = getQueue;
|
||||||
_ = injectError;
|
_ = injectError;
|
||||||
|
_ = loseForTesting;
|
||||||
_ = createBindGroup;
|
_ = createBindGroup;
|
||||||
_ = createBindGroupLayout;
|
_ = createBindGroupLayout;
|
||||||
_ = createSampler;
|
_ = createSampler;
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,11 @@ const device_vtable = Device.VTable{
|
||||||
c.wgpuDeviceInjectError(@ptrCast(c.WGPUDevice, ptr), @enumToInt(typ), message);
|
c.wgpuDeviceInjectError(@ptrCast(c.WGPUDevice, ptr), @enumToInt(typ), message);
|
||||||
}
|
}
|
||||||
}).injectError,
|
}).injectError,
|
||||||
|
.loseForTesting = (struct {
|
||||||
|
pub fn loseForTesting(ptr: *anyopaque) void {
|
||||||
|
c.wgpuDeviceLoseForTesting(@ptrCast(c.WGPUDevice, ptr));
|
||||||
|
}
|
||||||
|
}).loseForTesting,
|
||||||
.createBindGroup = (struct {
|
.createBindGroup = (struct {
|
||||||
pub fn createBindGroup(ptr: *anyopaque, descriptor: *const BindGroup.Descriptor) BindGroup {
|
pub fn createBindGroup(ptr: *anyopaque, descriptor: *const BindGroup.Descriptor) BindGroup {
|
||||||
var few_entries: [16]c.WGPUBindGroupEntry = undefined;
|
var few_entries: [16]c.WGPUBindGroupEntry = undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue