gpu: make Device.popErrorScope friendlier
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
2e611565b4
commit
dec1f08dd1
1 changed files with 9 additions and 3 deletions
|
|
@ -203,10 +203,16 @@ pub const Device = opaque {
|
||||||
|
|
||||||
pub inline fn popErrorScope(
|
pub inline fn popErrorScope(
|
||||||
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,
|
||||||
) bool {
|
) bool {
|
||||||
return Impl.devicePopErrorScope(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) {} else @ptrCast(Context, userdata));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Impl.devicePopErrorScope(device, Helper.callback, if (Context == void) null else context);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn pushErrorScope(device: *Device, filter: ErrorFilter) void {
|
pub inline fn pushErrorScope(device: *Device, filter: ErrorFilter) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue