gpu: make Device.setUncapturedErrorCallback friendlier
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
be402d4b6d
commit
6f2f7056b7
1 changed files with 9 additions and 3 deletions
|
|
@ -194,10 +194,16 @@ pub const Device = opaque {
|
||||||
// TODO: presumably callback should be nullable for unsetting
|
// TODO: presumably callback should be nullable for unsetting
|
||||||
pub inline fn setUncapturedErrorCallback(
|
pub inline fn setUncapturedErrorCallback(
|
||||||
device: *Device,
|
device: *Device,
|
||||||
callback: ErrorCallback,
|
comptime Context: type,
|
||||||
userdata: ?*anyopaque,
|
comptime callback: fn (typ: ErrorType, message: [*:0]const u8, ctx: Context) callconv(.Inline) void,
|
||||||
|
context: Context,
|
||||||
) void {
|
) void {
|
||||||
Impl.deviceSetUncapturedErrorCallback(device, callback, userdata);
|
const Helper = struct {
|
||||||
|
pub fn callback(typ: ErrorType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void {
|
||||||
|
callback(typ, message, if (Context == void) {} orelse @ptrCast(Context, userdata));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Impl.deviceSetUncapturedErrorCallback(device, Helper.callback, if (Context == void) null orelse context);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn tick(device: *Device) void {
|
pub inline fn tick(device: *Device) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue