diff --git a/src/core/platform/wayland/Core.zig b/src/core/platform/wayland/Core.zig index a8d44027..1ce11d6a 100644 --- a/src/core/platform/wayland/Core.zig +++ b/src/core/platform/wayland/Core.zig @@ -84,7 +84,7 @@ const LibXkbCommon = struct { pub fn load() !LibXkbCommon { var lib: LibXkbCommon = undefined; - lib.handle = std.DynLib.openZ("libxkbcommon.so.0") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libxkbcommon.so.0") catch return error.LibraryNotFound; inline for (@typeInfo(LibXkbCommon).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -139,7 +139,7 @@ const LibWaylandClient = struct { pub fn load() !LibWaylandClient { var lib: LibWaylandClient = undefined; - lib.handle = std.DynLib.openZ("libwayland-client.so.0") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libwayland-client.so.0") catch return error.LibraryNotFound; inline for (@typeInfo(LibWaylandClient).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -590,7 +590,7 @@ fn keyboardHandleKeymap(user_data: *GlobalState, keyboard: ?*c.struct_wl_keyboar //Unmap the keymap std.os.munmap(map_str); //Close the fd - std.os.close(fd); + std.posix.close(fd); const state = user_data.libxkbcommon.xkb_state_new(keymap).?; // defer user_data.libxkbcommon.xkb_state_unref(state); @@ -1061,21 +1061,21 @@ pub fn update(self: *Core, app: anytype) !bool { } // while (libwaylandclient.wl_display_flush(self.display) == -1) { - // // if (std.os.errno() == std.os.E.AGAIN) { + // // if (std.os.errno() == std.posix.E.AGAIN) { // // log.err("flush error", .{}); // // return true; // // } - // var pollfd = [_]std.os.pollfd{ - // std.os.pollfd{ + // var pollfd = [_]std.posix.pollfd{ + // std.posix.pollfd{ // .fd = libwaylandclient.wl_display_get_fd(self.display), - // .events = std.os.POLL.OUT, + // .events = std.posix.POLL.OUT, // .revents = 0, // }, // }; - // while (try std.os.poll(&pollfd, -1) != 0) { - // // if (std.os.errno() == std.os.E.INTR or std.os.errno() == std.os.E.AGAIN) { + // while (try std.posix.poll(&pollfd, -1) != 0) { + // // if (std.os.errno() == std.posix.E.INTR or std.os.errno() == std.posix.E.AGAIN) { // // log.err("poll error", .{}); // // return true; // // } diff --git a/src/core/platform/x11/Core.zig b/src/core/platform/x11/Core.zig index afff7b55..226a0e22 100644 --- a/src/core/platform/x11/Core.zig +++ b/src/core/platform/x11/Core.zig @@ -90,7 +90,7 @@ const LibX11 = struct { pub fn load() !LibX11 { var lib: LibX11 = undefined; - lib.handle = std.DynLib.openZ("libX11.so.6") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libX11.so.6") catch return error.LibraryNotFound; inline for (@typeInfo(LibX11).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -112,7 +112,7 @@ const LibXCursor = struct { pub fn load() !LibXCursor { var lib: LibXCursor = undefined; - lib.handle = std.DynLib.openZ("libXcursor.so.1") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libXcursor.so.1") catch return error.LibraryNotFound; inline for (@typeInfo(LibXCursor).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -130,7 +130,7 @@ const LibXRR = struct { pub fn load() !LibXRR { var lib: LibXRR = undefined; - lib.handle = std.DynLib.openZ("libXrandr.so.1") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libXrandr.so.1") catch return error.LibraryNotFound; inline for (@typeInfo(LibXRR).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -165,7 +165,7 @@ const LibGL = struct { pub fn load() !LibGL { var lib: LibGL = undefined; - lib.handle = std.DynLib.openZ("libGL.so.1") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libGL.so.1") catch return error.LibraryNotFound; inline for (@typeInfo(LibGL).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -191,7 +191,7 @@ libgl: ?LibGL, libxcursor: ?LibXCursor, width: c_int, height: c_int, -empty_event_pipe: [2]std.os.fd_t, +empty_event_pipe: [2]std.c.fd_t, gl_ctx: ?*LibGL.Context, wm_protocols: c.Atom, wm_delete_window: c.Atom, @@ -340,7 +340,7 @@ pub fn init( }; defer _ = libx11.XFreeColormap(display, colormap); - const empty_event_pipe = try std.os.pipe(); + const empty_event_pipe = try std.posix.pipe(); for (0..2) |i| { const sf = try std.os.fcntl(empty_event_pipe[i], std.os.F.GETFL, 0); const df = try std.os.fcntl(empty_event_pipe[i], std.os.F.GETFD, 0); @@ -657,8 +657,8 @@ pub fn deinit(self: *Core) void { _ = self.libx11.XCloseDisplay(self.display); self.libx11.handle.close(); - std.os.close(self.empty_event_pipe[0]); - std.os.close(self.empty_event_pipe[1]); + std.posix.close(self.empty_event_pipe[0]); + std.posix.close(self.empty_event_pipe[1]); } // Secondary app-update thread @@ -1096,7 +1096,7 @@ pub inline fn outOfMemory(self: *Core) bool { // May be called from any thread. pub inline fn wakeMainThread(self: *Core) void { while (true) { - const result = std.os.write(self.empty_event_pipe[1], &.{0}) catch break; + const result = std.posix.write(self.empty_event_pipe[1], &.{0}) catch break; if (result == 1) break; } } diff --git a/src/gamemode.zig b/src/gamemode.zig index 58d0f0b1..4426a0a3 100644 --- a/src/gamemode.zig +++ b/src/gamemode.zig @@ -100,9 +100,9 @@ const linux_impl = struct { pub fn tryInit() LoadError!void { if (state == .init) return; - var dl = std.DynLib.openZ("libgamemode.so.0") catch |e| switch (e) { + var dl = std.DynLib.open("libgamemode.so.0") catch |e| switch (e) { // backwards-compatibility for old gamemode versions - error.FileNotFound => try std.DynLib.openZ("libgamemode.so"), + error.FileNotFound => try std.DynLib.open("libgamemode.so"), else => return e, }; errdefer dl.close(); @@ -116,7 +116,7 @@ const linux_impl = struct { }; } - state = .{ .init = .{ .lib = dl, .syms = sym_table } }; + state = State{ .init = .{ .lib = dl, .syms = sym_table } }; } /// Initialize gamemode, logging a possible failure. diff --git a/src/sysaudio/alsa.zig b/src/sysaudio/alsa.zig index e067753c..00f20a62 100644 --- a/src/sysaudio/alsa.zig +++ b/src/sysaudio/alsa.zig @@ -69,7 +69,7 @@ const Lib = struct { snd_mixer_selem_has_capture_channel: *const fn (?*c.snd_mixer_elem_t, c.snd_mixer_selem_channel_id_t) callconv(.C) c_int, pub fn load() !void { - lib.handle = std.DynLib.openZ("libasound.so") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libasound.so") catch return error.LibraryNotFound; inline for (@typeInfo(Lib).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -88,9 +88,9 @@ pub const Context = struct { user_data: ?*anyopaque, thread: std.Thread, aborted: std.atomic.Value(bool), - notify_fd: std.os.fd_t, - notify_wd: std.os.fd_t, - notify_pipe_fd: [2]std.os.fd_t, + notify_fd: std.c.fd_t, + notify_wd: std.c.fd_t, + notify_pipe_fd: [2]std.c.fd_t, }; pub fn init(allocator: std.mem.Allocator, options: main.Context.Options) !backends.Context { @@ -105,16 +105,16 @@ pub const Context = struct { .devices_info = util.DevicesInfo.init(), .watcher = blk: { if (options.deviceChangeFn) |deviceChangeFn| { - const notify_fd = std.os.inotify_init1(std.os.linux.IN.NONBLOCK) catch |err| switch (err) { + const notify_fd = std.posix.inotify_init1(std.os.linux.IN.NONBLOCK) catch |err| switch (err) { error.ProcessFdQuotaExceeded, error.SystemFdQuotaExceeded, error.SystemResources, => return error.SystemResources, error.Unexpected => unreachable, }; - errdefer std.os.close(notify_fd); + errdefer std.posix.close(notify_fd); - const notify_wd = std.os.inotify_add_watch( + const notify_wd = std.posix.inotify_add_watch( notify_fd, "/dev/snd", std.os.linux.IN.CREATE | std.os.linux.IN.DELETE, @@ -130,17 +130,17 @@ pub const Context = struct { error.Unexpected, => unreachable, }; - errdefer std.os.inotify_rm_watch(notify_fd, notify_wd); + errdefer std.posix.inotify_rm_watch(notify_fd, notify_wd); - const notify_pipe_fd = std.os.pipe2(.{ .NONBLOCK = true }) catch |err| switch (err) { + const notify_pipe_fd = std.posix.pipe2(.{ .NONBLOCK = true }) catch |err| switch (err) { error.ProcessFdQuotaExceeded, error.SystemFdQuotaExceeded, => return error.SystemResources, error.Unexpected => unreachable, }; errdefer { - std.os.close(notify_pipe_fd[0]); - std.os.close(notify_pipe_fd[1]); + std.posix.close(notify_pipe_fd[0]); + std.posix.close(notify_pipe_fd[1]); } break :blk .{ @@ -170,14 +170,14 @@ pub const Context = struct { pub fn deinit(ctx: *Context) void { if (ctx.watcher) |*watcher| { - watcher.aborted.store(true, .Unordered); - _ = std.os.write(watcher.notify_pipe_fd[1], "a") catch {}; + watcher.aborted.store(true, .unordered); + _ = std.posix.write(watcher.notify_pipe_fd[1], "a") catch {}; watcher.thread.join(); - std.os.close(watcher.notify_pipe_fd[0]); - std.os.close(watcher.notify_pipe_fd[1]); - std.os.inotify_rm_watch(watcher.notify_fd, watcher.notify_wd); - std.os.close(watcher.notify_fd); + std.posix.close(watcher.notify_pipe_fd[0]); + std.posix.close(watcher.notify_pipe_fd[1]); + std.posix.inotify_rm_watch(watcher.notify_fd, watcher.notify_wd); + std.posix.close(watcher.notify_fd); } for (ctx.devices_info.list.items) |d| @@ -192,21 +192,21 @@ pub const Context = struct { var scan = false; var last_crash: ?i64 = null; var buf: [2048]u8 = undefined; - var fds = [2]std.os.pollfd{ + var fds = [2]std.posix.pollfd{ .{ .fd = watcher.notify_fd, - .events = std.os.POLL.IN, + .events = std.posix.POLL.IN, .revents = 0, }, .{ .fd = watcher.notify_pipe_fd[0], - .events = std.os.POLL.IN, + .events = std.posix.POLL.IN, .revents = 0, }, }; - while (!watcher.aborted.load(.Unordered)) { - _ = std.os.poll(&fds, -1) catch |err| switch (err) { + while (!watcher.aborted.load(.unordered)) { + _ = std.posix.poll(&fds, -1) catch |err| switch (err) { error.NetworkSubsystemFailed, error.SystemResources, => { @@ -219,9 +219,9 @@ pub const Context = struct { }, error.Unexpected => unreachable, }; - if (watcher.notify_fd & std.os.POLL.IN != 0) { + if (watcher.notify_fd & std.posix.POLL.IN != 0) { while (true) { - const len = std.os.read(watcher.notify_fd, &buf) catch |err| { + const len = std.posix.read(watcher.notify_fd, &buf) catch |err| { if (err == error.WouldBlock) break; const ts = std.time.milliTimestamp(); if (last_crash) |lc| { @@ -273,7 +273,7 @@ pub const Context = struct { var ctl: ?*c.snd_ctl_t = undefined; _ = switch (-lib.snd_ctl_open(&ctl, card_id.ptr, 0)) { 0 => {}, - @intFromEnum(std.os.E.NOENT) => break, + @intFromEnum(std.posix.E.NOENT) => break, else => return error.OpeningDevice, }; defer _ = lib.snd_ctl_close(ctl); @@ -290,7 +290,7 @@ pub const Context = struct { const snd_stream = modeToStream(mode); lib.snd_pcm_info_set_stream(pcm_info, snd_stream); const err = lib.snd_ctl_pcm_info(ctl, pcm_info); - switch (@as(std.os.E, @enumFromInt(-err))) { + switch (@as(std.posix.E, @enumFromInt(-err))) { .SUCCESS => {}, .NOENT, .NXIO, @@ -554,7 +554,7 @@ pub const Player = struct { sample_rate: u24, pub fn deinit(player: *Player) void { - player.aborted.store(true, .Unordered); + player.aborted.store(true, .unordered); player.thread.join(); _ = lib.snd_mixer_close(player.mixer); @@ -579,7 +579,7 @@ pub const Player = struct { fn writeThread(player: *Player) void { var underrun = false; - while (!player.aborted.load(.Unordered)) { + while (!player.aborted.load(.unordered)) { if (!underrun) { player.writeFn( player.user_data, @@ -668,7 +668,7 @@ pub const Recorder = struct { sample_rate: u24, pub fn deinit(recorder: *Recorder) void { - recorder.aborted.store(true, .Unordered); + recorder.aborted.store(true, .unordered); recorder.thread.join(); _ = lib.snd_mixer_close(recorder.mixer); @@ -693,7 +693,7 @@ pub const Recorder = struct { fn readThread(recorder: *Recorder) void { var underrun = false; - while (!recorder.aborted.load(.Unordered)) { + while (!recorder.aborted.load(.unordered)) { if (!underrun) { recorder.readFn(recorder.user_data, recorder.sample_buffer[0..recorder.period_size]); } diff --git a/src/sysaudio/jack.zig b/src/sysaudio/jack.zig index 4d923a0b..22addc98 100644 --- a/src/sysaudio/jack.zig +++ b/src/sysaudio/jack.zig @@ -33,7 +33,7 @@ const Lib = struct { jack_port_type_size: *const fn () c_int, pub fn load() !void { - lib.handle = std.DynLib.openZ("libjack.so") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libjack.so") catch return error.LibraryNotFound; inline for (@typeInfo(Lib).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); diff --git a/src/sysaudio/pipewire.zig b/src/sysaudio/pipewire.zig index 2d6dd5e3..b3861727 100644 --- a/src/sysaudio/pipewire.zig +++ b/src/sysaudio/pipewire.zig @@ -33,7 +33,7 @@ const Lib = struct { pw_stream_get_state: *const fn (?*c.pw_stream, [*c][*c]const u8) callconv(.C) c.pw_stream_state, pub fn load() !void { - lib.handle = std.DynLib.openZ("libpipewire-0.3.so") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libpipewire-0.3.so") catch return error.LibraryNotFound; inline for (@typeInfo(Lib).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); @@ -395,7 +395,7 @@ pub const Player = struct { defer _ = lib.pw_stream_queue_buffer(player.stream, buf); buf.*.buffer.*.datas[0].chunk.*.offset = 0; - if (player.is_paused.load(.Unordered)) { + if (player.is_paused.load(.unordered)) { buf.*.buffer.*.datas[0].chunk.*.stride = 0; buf.*.buffer.*.datas[0].chunk.*.size = 0; return; @@ -429,15 +429,15 @@ pub const Player = struct { } pub fn play(player: *Player) !void { - player.is_paused.store(false, .Unordered); + player.is_paused.store(false, .unordered); } pub fn pause(player: *Player) !void { - player.is_paused.store(true, .Unordered); + player.is_paused.store(true, .unordered); } pub fn paused(player: *Player) bool { - return player.is_paused.load(.Unordered); + return player.is_paused.load(.unordered); } pub fn setVolume(player: *Player, vol: f32) !void { @@ -470,7 +470,7 @@ pub const Recorder = struct { defer _ = lib.pw_stream_queue_buffer(recorder.stream, buf); buf.*.buffer.*.datas[0].chunk.*.offset = 0; - if (recorder.is_paused.load(.Unordered)) { + if (recorder.is_paused.load(.unordered)) { buf.*.buffer.*.datas[0].chunk.*.stride = 0; buf.*.buffer.*.datas[0].chunk.*.size = 0; return; @@ -500,15 +500,15 @@ pub const Recorder = struct { } pub fn record(recorder: *Recorder) !void { - recorder.is_paused.store(false, .Unordered); + recorder.is_paused.store(false, .unordered); } pub fn pause(recorder: *Recorder) !void { - recorder.is_paused.store(true, .Unordered); + recorder.is_paused.store(true, .unordered); } pub fn paused(recorder: *Recorder) bool { - return recorder.is_paused.load(.Unordered); + return recorder.is_paused.load(.unordered); } pub fn setVolume(recorder: *Recorder, vol: f32) !void { diff --git a/src/sysaudio/pulseaudio.zig b/src/sysaudio/pulseaudio.zig index a2b58c73..9a14497c 100644 --- a/src/sysaudio/pulseaudio.zig +++ b/src/sysaudio/pulseaudio.zig @@ -61,7 +61,7 @@ const Lib = struct { pa_stream_get_sample_spec: *const fn (s: ?*c.pa_stream) [*c]const c.pa_sample_spec, pub fn load() !void { - lib.handle = std.DynLib.openZ("libpulse.so") catch return error.LibraryNotFound; + lib.handle = std.DynLib.open("libpulse.so") catch return error.LibraryNotFound; inline for (@typeInfo(Lib).Struct.fields[1..]) |field| { const name = std.fmt.comptimePrint("{s}\x00", .{field.name}); const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]); diff --git a/src/sysgpu/opengl/proc.zig b/src/sysgpu/opengl/proc.zig index d507c43c..70577798 100644 --- a/src/sysgpu/opengl/proc.zig +++ b/src/sysgpu/opengl/proc.zig @@ -16,7 +16,7 @@ fn getProcAddress(name_ptr: [*:0]const u8) c.PROC { } pub fn init() !void { - libgl = try std.DynLib.openZ("opengl32.dll"); + libgl = try std.DynLib.open("opengl32.dll"); } pub fn deinit() void { diff --git a/src/sysgpu/vulkan.zig b/src/sysgpu/vulkan.zig index 9e42b117..9440c7ab 100644 --- a/src/sysgpu/vulkan.zig +++ b/src/sysgpu/vulkan.zig @@ -28,7 +28,7 @@ pub fn init(alloc: std.mem.Allocator, options: InitOptions) !void { if (options.baseLoader) |baseLoader| { vkb = try proc.loadBase(baseLoader); } else { - libvulkan = try std.DynLib.openZ(switch (builtin.target.os.tag) { + libvulkan = try std.DynLib.open(switch (builtin.target.os.tag) { .windows => "vulkan-1.dll", .linux => "libvulkan.so.1", .macos => "libvulkan.1.dylib", @@ -132,24 +132,24 @@ pub const Instance = struct { &.{}; const instance_extensions: []const [*:0]const u8 = switch (builtin.target.os.tag) { .linux => &.{ - vk.extension_info.khr_surface.name, - vk.extension_info.khr_xlib_surface.name, - vk.extension_info.khr_xcb_surface.name, + vk.extensions.khr_surface.name, + vk.extensions.khr_xlib_surface.name, + vk.extensions.khr_xcb_surface.name, // TODO: renderdoc will not work with this extension - // vk.extension_info.khr_wayland_surface.name, + // vk.extensions.khr_wayland_surface.name, }, .windows => &.{ - vk.extension_info.khr_surface.name, - vk.extension_info.khr_win_32_surface.name, + vk.extensions.khr_surface.name, + vk.extensions.khr_win_32_surface.name, }, .macos, .ios => &.{ - vk.extension_info.khr_surface.name, - vk.extension_info.ext_metal_surface.name, + vk.extensions.khr_surface.name, + vk.extensions.ext_metal_surface.name, }, else => |tag| if (builtin.target.abi == .android) &.{ - vk.extension_info.khr_surface.name, - vk.extension_info.khr_android_surface.name, + vk.extensions.khr_surface.name, + vk.extensions.khr_android_surface.name, } else @compileError(std.fmt.comptimePrint("unsupported platform ({s})", .{@tagName(tag)})), @@ -490,7 +490,8 @@ pub const Device = struct { .indirect_first_instance => features.features.draw_indirect_first_instance = vk.TRUE, .shader_f16 => { var feature = vk.PhysicalDeviceShaderFloat16Int8FeaturesKHR{ - .s_type = .physical_device_shader_float16_int8_features_khr, + // physical_device_shader_float16_int8_features_khr + .s_type = vk.StructureType.physical_device_shader_float16_int8_features_khr, .shader_float_16 = vk.TRUE, }; features.p_next = @ptrCast(&feature); @@ -716,7 +717,7 @@ pub const Device = struct { &[_][*:0]const u8{"VK_LAYER_KHRONOS_validation"} else &.{}; - const device_extensions = &[_][*:0]const u8{vk.extension_info.khr_swapchain.name}; + const device_extensions = &[_][*:0]const u8{vk.extensions.khr_swapchain.name}; pub const ResolveKey = struct { format: vk.Format, diff --git a/src/sysgpu/vulkan/proc.zig b/src/sysgpu/vulkan/proc.zig index 2962d186..306db6bd 100644 --- a/src/sysgpu/vulkan/proc.zig +++ b/src/sysgpu/vulkan/proc.zig @@ -2,109 +2,121 @@ const std = @import("std"); const builtin = @import("builtin"); const vk = @import("vulkan"); -pub const BaseFunctions = vk.BaseWrapper(.{ - .createInstance = true, - .enumerateInstanceExtensionProperties = true, - .enumerateInstanceLayerProperties = true, - .getInstanceProcAddr = true, +pub const BaseFunctions = vk.BaseWrapper(&.{ + .{ + .base_commands = .{ + .createInstance = true, + .enumerateInstanceExtensionProperties = true, + .enumerateInstanceLayerProperties = true, + .getInstanceProcAddr = true, + }, + }, }); -pub const InstanceFunctions = vk.InstanceWrapper(.{ - .createDevice = true, - // TODO: renderdoc will not work with wayland - // .createWaylandSurfaceKHR = builtin.target.os.tag == .linux, - .createWin32SurfaceKHR = builtin.target.os.tag == .windows, - .createXlibSurfaceKHR = builtin.target.os.tag == .linux, - .destroyInstance = true, - .destroySurfaceKHR = true, - .enumerateDeviceExtensionProperties = true, - .enumerateDeviceLayerProperties = true, - .enumeratePhysicalDevices = true, - .getDeviceProcAddr = true, - .getPhysicalDeviceFeatures = true, - .getPhysicalDeviceFormatProperties = true, - .getPhysicalDeviceProperties = true, - .getPhysicalDeviceMemoryProperties = true, - .getPhysicalDeviceQueueFamilyProperties = true, - .getPhysicalDeviceSurfaceCapabilitiesKHR = true, - .getPhysicalDeviceSurfaceFormatsKHR = true, +pub const InstanceFunctions = vk.InstanceWrapper(&.{ + .{ + .instance_commands = .{ + .createDevice = true, + // TODO: renderdoc will not work with wayland + // .createWaylandSurfaceKHR = builtin.target.os.tag == .linux, + .createWin32SurfaceKHR = builtin.target.os.tag == .windows, + .createXlibSurfaceKHR = builtin.target.os.tag == .linux, + .destroyInstance = true, + .destroySurfaceKHR = true, + .enumerateDeviceExtensionProperties = true, + .enumerateDeviceLayerProperties = true, + .enumeratePhysicalDevices = true, + .getDeviceProcAddr = true, + .getPhysicalDeviceFeatures = true, + .getPhysicalDeviceFormatProperties = true, + .getPhysicalDeviceProperties = true, + .getPhysicalDeviceMemoryProperties = true, + .getPhysicalDeviceQueueFamilyProperties = true, + .getPhysicalDeviceSurfaceCapabilitiesKHR = true, + .getPhysicalDeviceSurfaceFormatsKHR = true, + }, + }, }); -pub const DeviceFunctions = vk.DeviceWrapper(.{ - .acquireNextImageKHR = true, - .allocateCommandBuffers = true, - .allocateDescriptorSets = true, - .allocateMemory = true, - .beginCommandBuffer = true, - .bindBufferMemory = true, - .bindImageMemory = true, - .cmdBeginRenderPass = true, - .cmdBindDescriptorSets = true, - .cmdBindIndexBuffer = true, - .cmdBindPipeline = true, - .cmdBindVertexBuffers = true, - .cmdCopyBuffer = true, - .cmdCopyBufferToImage = true, - .cmdCopyImage = true, - .cmdDispatch = true, - .cmdDraw = true, - .cmdDrawIndexed = true, - .cmdEndRenderPass = true, - .cmdPipelineBarrier = true, - .cmdSetScissor = true, - .cmdSetStencilReference = true, - .cmdSetViewport = true, - .createBuffer = true, - .createCommandPool = true, - .createComputePipelines = true, - .createDescriptorPool = true, - .createDescriptorSetLayout = true, - .createFence = true, - .createFramebuffer = true, - .createGraphicsPipelines = true, - .createImage = true, - .createImageView = true, - .createPipelineLayout = true, - .createRenderPass = true, - .createSampler = true, - .createSemaphore = true, - .createShaderModule = true, - .createSwapchainKHR = true, - .destroyBuffer = true, - .destroyCommandPool = true, - .destroyDescriptorPool = true, - .destroyDescriptorSetLayout = true, - .destroyDevice = true, - .destroyFence = true, - .destroyFramebuffer = true, - .destroyImage = true, - .destroyImageView = true, - .destroyPipeline = true, - .destroyPipelineLayout = true, - .destroyRenderPass = true, - .destroySampler = true, - .destroySemaphore = true, - .destroyShaderModule = true, - .destroySwapchainKHR = true, - .deviceWaitIdle = true, - .endCommandBuffer = true, - .freeCommandBuffers = true, - .freeDescriptorSets = true, - .freeMemory = true, - .getBufferMemoryRequirements = true, - .getDeviceQueue = true, - .getFenceStatus = true, - .getImageMemoryRequirements = true, - .getSwapchainImagesKHR = true, - .mapMemory = true, - .queuePresentKHR = true, - .queueSubmit = true, - .queueWaitIdle = true, - .resetCommandBuffer = true, - .resetFences = true, - .unmapMemory = true, - .updateDescriptorSets = true, - .waitForFences = true, +pub const DeviceFunctions = vk.DeviceWrapper(&.{ + .{ + .device_commands = .{ + .acquireNextImageKHR = true, + .allocateCommandBuffers = true, + .allocateDescriptorSets = true, + .allocateMemory = true, + .beginCommandBuffer = true, + .bindBufferMemory = true, + .bindImageMemory = true, + .cmdBeginRenderPass = true, + .cmdBindDescriptorSets = true, + .cmdBindIndexBuffer = true, + .cmdBindPipeline = true, + .cmdBindVertexBuffers = true, + .cmdCopyBuffer = true, + .cmdCopyBufferToImage = true, + .cmdCopyImage = true, + .cmdDispatch = true, + .cmdDraw = true, + .cmdDrawIndexed = true, + .cmdEndRenderPass = true, + .cmdPipelineBarrier = true, + .cmdSetScissor = true, + .cmdSetStencilReference = true, + .cmdSetViewport = true, + .createBuffer = true, + .createCommandPool = true, + .createComputePipelines = true, + .createDescriptorPool = true, + .createDescriptorSetLayout = true, + .createFence = true, + .createFramebuffer = true, + .createGraphicsPipelines = true, + .createImage = true, + .createImageView = true, + .createPipelineLayout = true, + .createRenderPass = true, + .createSampler = true, + .createSemaphore = true, + .createShaderModule = true, + .createSwapchainKHR = true, + .destroyBuffer = true, + .destroyCommandPool = true, + .destroyDescriptorPool = true, + .destroyDescriptorSetLayout = true, + .destroyDevice = true, + .destroyFence = true, + .destroyFramebuffer = true, + .destroyImage = true, + .destroyImageView = true, + .destroyPipeline = true, + .destroyPipelineLayout = true, + .destroyRenderPass = true, + .destroySampler = true, + .destroySemaphore = true, + .destroyShaderModule = true, + .destroySwapchainKHR = true, + .deviceWaitIdle = true, + .endCommandBuffer = true, + .freeCommandBuffers = true, + .freeDescriptorSets = true, + .freeMemory = true, + .getBufferMemoryRequirements = true, + .getDeviceQueue = true, + .getFenceStatus = true, + .getImageMemoryRequirements = true, + .getSwapchainImagesKHR = true, + .mapMemory = true, + .queuePresentKHR = true, + .queueSubmit = true, + .queueWaitIdle = true, + .resetCommandBuffer = true, + .resetFences = true, + .unmapMemory = true, + .updateDescriptorSets = true, + .waitForFences = true, + }, + }, }); pub const BaseLoader = *const fn (vk.Instance, [*:0]const u8) vk.PfnVoidFunction;