gpu: fix redeclaration of function parameter errors

This changed in the latest version of Zig to be more strict.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-18 22:55:41 -07:00
parent 9406326cd8
commit 381f2fe9c5
6 changed files with 22 additions and 22 deletions

View file

@ -83,7 +83,7 @@ pub const Adapter = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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( callback(
if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)),
status, 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 { pub inline fn reference(adapter: *Adapter) void {

View file

@ -121,11 +121,11 @@ pub const Buffer = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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); 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 { pub inline fn setLabel(buffer: *Buffer, label: [*:0]const u8) void {

View file

@ -107,7 +107,7 @@ pub const Device = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { const Helper = struct {
pub fn callback( pub fn cCallback(
status: CreatePipelineAsyncStatus, status: CreatePipelineAsyncStatus,
compute_pipeline: *ComputePipeline, compute_pipeline: *ComputePipeline,
message: [*:0]const u8, 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 { pub inline fn createErrorBuffer(device: *Device) *Buffer {
@ -169,7 +169,7 @@ pub const Device = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { const Helper = struct {
pub fn callback( pub fn cCallback(
status: CreatePipelineAsyncStatus, status: CreatePipelineAsyncStatus,
pipeline: *RenderPipeline, pipeline: *RenderPipeline,
message: [*:0]const u8, 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 { pub inline fn createSampler(device: *Device, descriptor: ?*const Sampler.Descriptor) *Sampler {
@ -263,11 +263,11 @@ pub const Device = opaque {
) bool { ) bool {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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); 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 { pub inline fn pushErrorScope(device: *Device, filter: ErrorFilter) void {
@ -282,11 +282,11 @@ pub const Device = opaque {
if (callback) |cb| { if (callback) |cb| {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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); 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 { } else {
Impl.deviceSetDeviceLostCallback(device, null, null); Impl.deviceSetDeviceLostCallback(device, null, null);
} }
@ -304,11 +304,11 @@ pub const Device = opaque {
if (callback) |cb| { if (callback) |cb| {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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); 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 { } else {
Impl.deviceSetLoggingCallback(device, null, null); Impl.deviceSetLoggingCallback(device, null, null);
} }
@ -322,11 +322,11 @@ pub const Device = opaque {
if (callback) |cb| { if (callback) |cb| {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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); 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 { } else {
Impl.deviceSetUncapturedErrorCallback(device, null, null); Impl.deviceSetUncapturedErrorCallback(device, null, null);
} }

View file

@ -34,7 +34,7 @@ pub const Instance = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { const Helper = struct {
pub fn callback( pub fn cCallback(
status: RequestAdapterStatus, status: RequestAdapterStatus,
adapter: *Adapter, adapter: *Adapter,
message: ?[*:0]const u8, 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 { pub inline fn reference(instance: *Instance) void {

View file

@ -39,11 +39,11 @@ pub const Queue = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { 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); 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 { pub inline fn setLabel(queue: *Queue, label: [*:0]const u8) void {

View file

@ -38,7 +38,7 @@ pub const ShaderModule = opaque {
) void { ) void {
const Context = @TypeOf(context); const Context = @TypeOf(context);
const Helper = struct { const Helper = struct {
pub fn callback( pub fn cCallback(
status: CompilationInfoRequestStatus, status: CompilationInfoRequestStatus,
compilation_info: *const CompilationInfo, compilation_info: *const CompilationInfo,
userdata: ?*anyopaque, 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 { pub inline fn setLabel(shader_module: *ShaderModule, label: [*:0]const u8) void {