gpu: update to latest Zig (c_void -> anyopaque)

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-12-20 15:36:45 -07:00
parent 4a27bf25ac
commit 62fbf78f9a

View file

@ -23,7 +23,7 @@ const c = @import("c.zig").c;
// #include <algorithm> // #include <algorithm>
// #include <cstring> // #include <cstring>
fn printDeviceError(error_type: c.WGPUErrorType, message: [*c]const u8, _: ?*c_void) callconv(.C) void { fn printDeviceError(error_type: c.WGPUErrorType, message: [*c]const u8, _: ?*anyopaque) callconv(.C) void {
switch (error_type) { switch (error_type) {
c.WGPUErrorType_Validation => std.debug.print("dawn: validation error: {s}\n", .{message}), c.WGPUErrorType_Validation => std.debug.print("dawn: validation error: {s}\n", .{message}),
c.WGPUErrorType_OutOfMemory => std.debug.print("dawn: out of memory: {s}\n", .{message}), c.WGPUErrorType_OutOfMemory => std.debug.print("dawn: out of memory: {s}\n", .{message}),
@ -192,13 +192,13 @@ fn discoverAdapter(instance: c.MachDawnNativeInstance, window: glfw.Window, typ:
if (typ == c.WGPUBackendType_OpenGL) { if (typ == c.WGPUBackendType_OpenGL) {
try glfw.makeContextCurrent(window); try glfw.makeContextCurrent(window);
const adapter_options = c.MachDawnNativeAdapterDiscoveryOptions_OpenGL{ const adapter_options = c.MachDawnNativeAdapterDiscoveryOptions_OpenGL{
.getProc = @ptrCast(fn ([*c]const u8) callconv(.C) ?*c_void, glfw.getProcAddress), .getProc = @ptrCast(fn ([*c]const u8) callconv(.C) ?*anyopaque, glfw.getProcAddress),
}; };
_ = c.machDawnNativeInstance_discoverAdapters(instance, typ, &adapter_options); _ = c.machDawnNativeInstance_discoverAdapters(instance, typ, &adapter_options);
} else if (typ == c.WGPUBackendType_OpenGLES) { } else if (typ == c.WGPUBackendType_OpenGLES) {
try glfw.makeContextCurrent(window); try glfw.makeContextCurrent(window);
const adapter_options = c.MachDawnNativeAdapterDiscoveryOptions_OpenGLES{ const adapter_options = c.MachDawnNativeAdapterDiscoveryOptions_OpenGLES{
.getProc = @ptrCast(fn ([*c]const u8) callconv(.C) ?*c_void, glfw.getProcAddress), .getProc = @ptrCast(fn ([*c]const u8) callconv(.C) ?*anyopaque, glfw.getProcAddress),
}; };
_ = c.machDawnNativeInstance_discoverAdapters(instance, typ, &adapter_options); _ = c.machDawnNativeInstance_discoverAdapters(instance, typ, &adapter_options);
} else { } else {