diff --git a/gpu/src/adapter.zig b/gpu/src/adapter.zig index 2ffd594d..87de1222 100644 --- a/gpu/src/adapter.zig +++ b/gpu/src/adapter.zig @@ -88,7 +88,7 @@ pub const Adapter = opaque { status, device, message, - if (Context == void) {} else @ptrCast(Context, userdata), + if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), ); } }; diff --git a/gpu/src/buffer.zig b/gpu/src/buffer.zig index 0c9fe066..3edad7bf 100644 --- a/gpu/src/buffer.zig +++ b/gpu/src/buffer.zig @@ -100,7 +100,7 @@ pub const Buffer = opaque { 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)); + callback(status, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata))); } }; Impl.bufferMapAsync(buffer, mode, offset, size, Helper.callback, if (Context == void) null else context); diff --git a/gpu/src/device.zig b/gpu/src/device.zig index 6dd9f45d..7e5e28ed 100644 --- a/gpu/src/device.zig +++ b/gpu/src/device.zig @@ -92,7 +92,7 @@ pub const Device = opaque { status, compute_pipeline, message, - if (Context == void) {} else @ptrCast(Context, userdata), + if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), ); } }; @@ -150,7 +150,7 @@ pub const Device = opaque { status, pipeline, message, - if (Context == void) {} else @ptrCast(Context, userdata), + if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), ); } }; @@ -209,7 +209,7 @@ pub const Device = opaque { const Context = @TypeOf(context); 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)); + callback(typ, message, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata))); } }; return Impl.devicePopErrorScope(device, Helper.callback, if (Context == void) null else context); @@ -228,7 +228,7 @@ pub const Device = opaque { const Context = @TypeOf(context); const Helper = struct { pub fn callback(reason: LostReason, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { - callback(reason, message, if (Context == void) {} else @ptrCast(Context, userdata)); + callback(reason, message, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata))); } }; Impl.deviceSetDeviceLostCallback(device, Helper.callback, if (Context == void) null else context); @@ -247,7 +247,7 @@ pub const Device = opaque { const Context = @TypeOf(context); const Helper = struct { pub fn callback(typ: LoggingType, message: [*:0]const u8, userdata: ?*anyopaque) callconv(.C) void { - callback(typ, message, if (Context == void) {} else @ptrCast(Context, userdata)); + callback(typ, message, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata))); } }; Impl.deviceSetLoggingCallback(device, Helper.callback, if (Context == void) null else context); @@ -262,7 +262,7 @@ pub const Device = opaque { const Context = @TypeOf(context); 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)); + callback(typ, message, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata))); } }; Impl.deviceSetUncapturedErrorCallback(device, Helper.callback, if (Context == void) null else context); diff --git a/gpu/src/instance.zig b/gpu/src/instance.zig index a2e88124..12e4b5a5 100644 --- a/gpu/src/instance.zig +++ b/gpu/src/instance.zig @@ -38,7 +38,7 @@ pub const Instance = opaque { status, adapter, message, - if (Context == void) {} else @ptrCast(Context, userdata), + if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), ); } }; diff --git a/gpu/src/queue.zig b/gpu/src/queue.zig index fde709dc..2b5005d3 100644 --- a/gpu/src/queue.zig +++ b/gpu/src/queue.zig @@ -39,7 +39,7 @@ pub const Queue = opaque { 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, userdata)); + callback(status, if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata))); } }; Impl.queueOnSubmittedWorkDone(queue, signal_value, Helper.callback, if (Context == void) null else context); diff --git a/gpu/src/shader_module.zig b/gpu/src/shader_module.zig index 98940c4c..e30fb2dc 100644 --- a/gpu/src/shader_module.zig +++ b/gpu/src/shader_module.zig @@ -40,7 +40,7 @@ pub const ShaderModule = opaque { callback( status, compilation_info, - if (Context == void) {} else @ptrCast(Context, userdata), + if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(Context), userdata)), ); } };