diff --git a/gpu/src/adapter.zig b/gpu/src/adapter.zig index 211dc5bd..20ac86c1 100644 --- a/gpu/src/adapter.zig +++ b/gpu/src/adapter.zig @@ -83,7 +83,7 @@ pub const Adapter = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(status: RequestDeviceStatus, device: *Device, message: ?[*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(status: RequestDeviceStatus, device: *Device, message: ?[*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { callback( if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), status, @@ -92,7 +92,7 @@ pub const Adapter = opaque { ); } }; - Impl.adapterRequestDevice(adapter, descriptor, Helper.callback, if (Context == void) null else context); + Impl.adapterRequestDevice(adapter, descriptor, Helper.cCallback, if (Context == void) null else context); } pub inline fn reference(adapter: *Adapter) void { diff --git a/gpu/src/buffer.zig b/gpu/src/buffer.zig index ca06250b..09702a7d 100644 --- a/gpu/src/buffer.zig +++ b/gpu/src/buffer.zig @@ -121,11 +121,11 @@ pub const Buffer = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(status: MapAsyncStatus, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(status: MapAsyncStatus, userdata: ?*anyopaque) callconv(.C) void { callback(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), status); } }; - Impl.bufferMapAsync(buffer, mode, offset, size, Helper.callback, if (Context == void) null else context); + Impl.bufferMapAsync(buffer, mode, offset, size, Helper.cCallback, if (Context == void) null else context); } pub inline fn setLabel(buffer: *Buffer, label: [*:0]const u8) void { diff --git a/gpu/src/device.zig b/gpu/src/device.zig index 7049c3d0..90cfad82 100644 --- a/gpu/src/device.zig +++ b/gpu/src/device.zig @@ -107,7 +107,7 @@ pub const Device = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback( + pub fn cCallback( status: CreatePipelineAsyncStatus, compute_pipeline: *ComputePipeline, message: [*:0]const u8, @@ -121,7 +121,7 @@ pub const Device = opaque { ); } }; - Impl.deviceCreateComputePipelineAsync(device, descriptor, Helper.callback, if (Context == void) null else context); + Impl.deviceCreateComputePipelineAsync(device, descriptor, Helper.cCallback, if (Context == void) null else context); } pub inline fn createErrorBuffer(device: *Device) *Buffer { @@ -169,7 +169,7 @@ pub const Device = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback( + pub fn cCallback( status: CreatePipelineAsyncStatus, pipeline: *RenderPipeline, message: [*:0]const u8, @@ -183,7 +183,7 @@ pub const Device = opaque { ); } }; - Impl.deviceCreateRenderPipelineAsync(device, descriptor, Helper.callback, if (Context == void) null else context); + Impl.deviceCreateRenderPipelineAsync(device, descriptor, Helper.cCallback, if (Context == void) null else context); } pub inline fn createSampler(device: *Device, descriptor: ?*const Sampler.Descriptor) *Sampler { @@ -263,11 +263,11 @@ pub const Device = opaque { ) bool { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(typ: ErrorType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(typ: ErrorType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { callback(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), typ, message); } }; - return Impl.devicePopErrorScope(device, Helper.callback, if (Context == void) null else context); + return Impl.devicePopErrorScope(device, Helper.cCallback, if (Context == void) null else context); } pub inline fn pushErrorScope(device: *Device, filter: ErrorFilter) void { @@ -282,11 +282,11 @@ pub const Device = opaque { if (callback) |cb| { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(reason: LostReason, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(reason: LostReason, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { cb(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), reason, message); } }; - Impl.deviceSetDeviceLostCallback(device, Helper.callback, if (Context == void) null else context); + Impl.deviceSetDeviceLostCallback(device, Helper.cCallback, if (Context == void) null else context); } else { Impl.deviceSetDeviceLostCallback(device, null, null); } @@ -304,11 +304,11 @@ pub const Device = opaque { if (callback) |cb| { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(typ: LoggingType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(typ: LoggingType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { cb(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), typ, message); } }; - Impl.deviceSetLoggingCallback(device, Helper.callback, if (Context == void) null else context); + Impl.deviceSetLoggingCallback(device, Helper.cCallback, if (Context == void) null else context); } else { Impl.deviceSetLoggingCallback(device, null, null); } @@ -322,11 +322,11 @@ pub const Device = opaque { if (callback) |cb| { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(typ: ErrorType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(typ: ErrorType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { cb(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), typ, message); } }; - Impl.deviceSetUncapturedErrorCallback(device, Helper.callback, if (Context == void) null else context); + Impl.deviceSetUncapturedErrorCallback(device, Helper.cCallback, if (Context == void) null else context); } else { Impl.deviceSetUncapturedErrorCallback(device, null, null); } diff --git a/gpu/src/instance.zig b/gpu/src/instance.zig index c0d9dcd8..89bce322 100644 --- a/gpu/src/instance.zig +++ b/gpu/src/instance.zig @@ -34,7 +34,7 @@ pub const Instance = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback( + pub fn cCallback( status: RequestAdapterStatus, adapter: *Adapter, message: ?[*:0]const u8, @@ -48,7 +48,7 @@ pub const Instance = opaque { ); } }; - Impl.instanceRequestAdapter(instance, options, Helper.callback, if (Context == void) null else context); + Impl.instanceRequestAdapter(instance, options, Helper.cCallback, if (Context == void) null else context); } pub inline fn reference(instance: *Instance) void { diff --git a/gpu/src/queue.zig b/gpu/src/queue.zig index 3aee0502..799be464 100644 --- a/gpu/src/queue.zig +++ b/gpu/src/queue.zig @@ -39,11 +39,11 @@ pub const Queue = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback(status: WorkDoneStatus, userdata: ?*anyopaque) callconv(.C) void { + pub fn cCallback(status: WorkDoneStatus, userdata: ?*anyopaque) callconv(.C) void { 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); + Impl.queueOnSubmittedWorkDone(queue, signal_value, Helper.cCallback, if (Context == void) null else context); } pub inline fn setLabel(queue: *Queue, label: [*:0]const u8) void { diff --git a/gpu/src/shader_module.zig b/gpu/src/shader_module.zig index 8dc1b259..5d450cfa 100644 --- a/gpu/src/shader_module.zig +++ b/gpu/src/shader_module.zig @@ -38,7 +38,7 @@ pub const ShaderModule = opaque { ) void { const Context = @TypeOf(context); const Helper = struct { - pub fn callback( + pub fn cCallback( status: CompilationInfoRequestStatus, compilation_info: *const CompilationInfo, userdata: ?*anyopaque, @@ -50,7 +50,7 @@ pub const ShaderModule = opaque { ); } }; - Impl.shaderModuleGetCompilationInfo(shader_module, Helper.callback, if (Context == void) null else context); + Impl.shaderModuleGetCompilationInfo(shader_module, Helper.cCallback, if (Context == void) null else context); } pub inline fn setLabel(shader_module: *ShaderModule, label: [*:0]const u8) void {