gpu: implement Device.injectError
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
482d5aaa34
commit
13fcf8aac5
2 changed files with 13 additions and 2 deletions
|
|
@ -7,6 +7,7 @@
|
|||
//! https://gpuweb.github.io/gpuweb/#devices
|
||||
//! https://gpuweb.github.io/gpuweb/#gpuadapter
|
||||
const Feature = @import("enums.zig").Feature;
|
||||
const ErrorType = @import("enums.zig").ErrorType;
|
||||
const Limits = @import("data.zig").Limits;
|
||||
const Queue = @import("Queue.zig");
|
||||
const ShaderModule = @import("ShaderModule.zig");
|
||||
|
|
@ -69,8 +70,7 @@ pub const VTable = struct {
|
|||
getQueue: fn (ptr: *anyopaque) Queue,
|
||||
// TODO: should hasFeature be a helper method?
|
||||
// WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeature feature);
|
||||
// injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
|
||||
// WGPU_EXPORT void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, char const * message);
|
||||
injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
|
||||
// loseForTesting: fn (ptr: *anyopaque) void,
|
||||
// WGPU_EXPORT void wgpuDeviceLoseForTesting(WGPUDevice device);
|
||||
// TODO: callback
|
||||
|
|
@ -102,6 +102,10 @@ pub inline fn getQueue(device: Device) Queue {
|
|||
return device.vtable.getQueue(device.ptr);
|
||||
}
|
||||
|
||||
pub inline fn injectError(device: Device, typ: ErrorType, message: [*:0]const u8) void {
|
||||
device.vtable.injectError(device.ptr, typ, message);
|
||||
}
|
||||
|
||||
pub inline fn createBindGroup(device: Device, descriptor: *const BindGroup.Descriptor) BindGroup {
|
||||
return device.vtable.createBindGroup(device.ptr, descriptor);
|
||||
}
|
||||
|
|
@ -173,6 +177,7 @@ test {
|
|||
_ = reference;
|
||||
_ = release;
|
||||
_ = getQueue;
|
||||
_ = injectError;
|
||||
_ = createBindGroup;
|
||||
_ = createBindGroupLayout;
|
||||
_ = createShaderModule;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ const ComputePipeline = @import("ComputePipeline.zig");
|
|||
|
||||
const PresentMode = @import("enums.zig").PresentMode;
|
||||
const IndexFormat = @import("enums.zig").IndexFormat;
|
||||
const ErrorType = @import("enums.zig").ErrorType;
|
||||
|
||||
const ImageCopyBuffer = @import("structs.zig").ImageCopyBuffer;
|
||||
const ImageCopyTexture = @import("structs.zig").ImageCopyTexture;
|
||||
|
|
@ -321,6 +322,11 @@ const device_vtable = Device.VTable{
|
|||
return wrapQueue(c.wgpuDeviceGetQueue(@ptrCast(c.WGPUDevice, ptr)));
|
||||
}
|
||||
}).getQueue,
|
||||
.injectError = (struct {
|
||||
pub fn injectError(ptr: *anyopaque, typ: ErrorType, message: [*:0]const u8) void {
|
||||
c.wgpuDeviceInjectError(@ptrCast(c.WGPUDevice, ptr), @enumToInt(typ), message);
|
||||
}
|
||||
}).injectError,
|
||||
.createBindGroup = (struct {
|
||||
pub fn createBindGroup(ptr: *anyopaque, descriptor: *const BindGroup.Descriptor) BindGroup {
|
||||
var few_entries: [16]c.WGPUBindGroupEntry = undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue