gpu: make ctx parameters in callbacks always first
This matches the order of context parameters always being first in the Zig stdlib with e.g. sorting and similar places where a context parameter exists. Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
7f8c279cbc
commit
58600faa0d
7 changed files with 22 additions and 22 deletions
|
|
@ -35,12 +35,12 @@ pub const Queue = opaque {
|
|||
queue: *Queue,
|
||||
signal_value: u64,
|
||||
context: anytype,
|
||||
comptime callback: fn (status: WorkDoneStatus, ctx: @TypeOf(context)) callconv(.Inline) void,
|
||||
comptime callback: fn (ctx: @TypeOf(context), status: WorkDoneStatus) callconv(.Inline) void,
|
||||
) void {
|
||||
const Context = @TypeOf(context);
|
||||
const Helper = struct {
|
||||
pub fn callback(status: WorkDoneStatus, userdata: ?*anyopaque) callconv(.C) void {
|
||||
callback(status, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)));
|
||||
callback(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), status);
|
||||
}
|
||||
};
|
||||
Impl.queueOnSubmittedWorkDone(queue, signal_value, Helper.callback, if (Context == void) null else context);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue