gpu: simplify callback context types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
48c8964679
commit
4ed932be0f
6 changed files with 33 additions and 33 deletions
|
|
@ -94,10 +94,10 @@ pub const Buffer = opaque {
|
|||
mode: MapModeFlags,
|
||||
offset: usize,
|
||||
size: usize,
|
||||
comptime Context: type,
|
||||
comptime callback: fn (status: MapAsyncStatus, ctx: Context) callconv(.Inline) void,
|
||||
context: Context,
|
||||
context: anytype,
|
||||
comptime callback: fn (status: MapAsyncStatus, ctx: @TypeOf(context)) callconv(.Inline) void,
|
||||
) void {
|
||||
const Context = @TypeOf(context);
|
||||
const Helper = struct {
|
||||
pub fn callback(status: MapAsyncStatus, userdata: ?*anyopaque) callconv(.C) void {
|
||||
callback(status, if (Context == void) {} else @ptrCast(Context, userdata));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue