diff --git a/build.zig b/build.zig index a02656a..948541d 100644 --- a/build.zig +++ b/build.zig @@ -1,33 +1,79 @@ const std = @import("std"); const path = std.fs.path; +const ArrayList = std.ArrayList; const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; +const Module = std.build.Module; const ig_build = @import("zig-imgui/imgui_build.zig"); const glslc_command = if (std.builtin.os.tag == .windows) "tools/win/glslc.exe" else "glslc"; pub fn build(b: *Builder) void { - const mode = b.standardReleaseOptions(); + var buffer: [1024]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buffer); + var allocator = fba.allocator(); + var module_names = ArrayList([]const u8).init(allocator); + var module_list = ArrayList(*Module).init(allocator); + + const mode = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); + // Add modules to the builder + const mod_vk = b.addModule("vk", .{ + .source_file = .{ .path = "include/vk.zig" }, + .dependencies = &.{}, + }); + module_names.append("vk") catch @panic(""); + module_list.append(mod_vk) catch @panic(""); + + const mod_glfw = b.addModule("glfw", .{ + .source_file = .{ .path = "include/glfw.zig" }, + .dependencies = &.{ + .{ .name = "vk", .module = mod_vk }, + }, + }); + module_names.append("glfw") catch @panic(""); + module_list.append(mod_glfw) catch @panic(""); + + const mod_cgltf = b.addModule("cgltf", .{ + .source_file = .{ .path = "include/cgltf.zig" }, + .dependencies = &.{}, + }); + module_names.append("cgltf") catch @panic(""); + module_list.append(mod_cgltf) catch @panic(""); + ig_build.addTestStep(b, "imgui:test", "zig-imgui/imgui", mode, target); - const exe = b.addExecutable("zig-gltf", "src/main.zig"); - setDependencies(exe, mode, target); - exe.install(); + const exe = b.addExecutable(.{ + .name = "zig-gltf", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); + setDependencies(exe, module_names, module_list, target); + b.installArtifact(exe); const run_step = b.step("run", "Run the project"); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_step.dependOn(&run_cmd.step); - const tests = b.addTest("src/all_tests.zig"); - setDependencies(tests, mode, target); + const tests = b.addTest(.{ + .root_source_file = .{ .path = "src/all_tests.zig" }, + .target = target, + .optimize = mode, + }); + setDependencies(tests, module_names, module_list, target); - const vscode_exe = b.addExecutable("vscode", "src/main.zig"); - setDependencies(vscode_exe, mode, target); + const vscode_exe = b.addExecutable(.{ + .name = "vscode", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); + setDependencies(vscode_exe, module_names, module_list, target); - const vscode_install = b.addInstallArtifact(vscode_exe); + const vscode_install = b.addInstallArtifact(vscode_exe, .{}); const vscode_step = b.step("vscode", "Build for VSCode"); vscode_step.dependOn(&vscode_install.step); @@ -36,18 +82,21 @@ pub fn build(b: *Builder) void { run_tests.dependOn(&tests.step); } -fn setDependencies(step: *LibExeObjStep, mode: std.builtin.Mode, target: std.zig.CrossTarget) void { - step.setBuildMode(mode); +fn setDependencies(step: *LibExeObjStep, module_names: ArrayList([]const u8), module_list: ArrayList(*Module), target: std.zig.CrossTarget) void { step.linkLibCpp(); ig_build.link(step, "zig-imgui/imgui"); - step.addPackagePath("vk", "include/vk.zig"); - step.addPackagePath("glfw", "include/glfw.zig"); - step.addPackagePath("cgltf", "include/cgltf.zig"); + // Add modules to the compilation step + for (module_names.items, module_list.items) |name, mod| { + step.addModule(name, mod); + } + + // Windows libraries if (target.getOs().tag == .windows) { - step.addObjectFile(if (target.getAbi() == .msvc) "lib/win/glfw3.lib" else "lib/win/libglfw3.a"); - step.addObjectFile("lib/win/vulkan-1.lib"); + const glfw = if (target.getAbi() == .msvc) "lib/win/glfw3.lib" else "lib/win/libglfw3.a"; + step.addObjectFile(.{ .path = glfw }); + step.addObjectFile(.{ .path = "lib/win/vulkan-1.lib" }); step.linkSystemLibrary("gdi32"); step.linkSystemLibrary("shell32"); if (step.kind == .exe) { @@ -58,7 +107,11 @@ fn setDependencies(step: *LibExeObjStep, mode: std.builtin.Mode, target: std.zig step.linkSystemLibrary("vulkan"); } - step.addCSourceFile("c_src/cgltf.c", &[_][]const u8{ "-std=c99", "-DCGLTF_IMPLEMENTATION", "-D_CRT_SECURE_NO_WARNINGS" }); + // C source code and flags + step.addCSourceFile(.{ + .file = .{ .path = "c_src/cgltf.c" }, + .flags = &[_][]const u8{ "-std=c99", "-DCGLTF_IMPLEMENTATION", "-D_CRT_SECURE_NO_WARNINGS" }, + }); } fn addShader(b: *Builder, exe: anytype, in_file: []const u8, out_file: []const u8) !void { diff --git a/include/cgltf.zig b/include/cgltf.zig index ab6caba..98f3ae7 100644 --- a/include/cgltf.zig +++ b/include/cgltf.zig @@ -5,14 +5,14 @@ pub const MutCString = [*:0]u8; pub const Bool32 = i32; -pub const FileType = enum (u32) { +pub const FileType = enum(u32) { invalid, gltf, glb, _, }; -pub const Result = enum (u32) { +pub const Result = enum(u32) { success, data_too_short, unknown_format, @@ -27,14 +27,14 @@ pub const Result = enum (u32) { }; pub const MemoryOptions = extern struct { - alloc: ?fn (?*anyopaque, usize) callconv(.C) ?*anyopaque = null, - free: ?fn (?*anyopaque, ?*anyopaque) callconv(.C) void = null, + alloc: ?*const fn (?*anyopaque, usize) callconv(.C) ?*anyopaque = null, + free: ?*const fn (?*anyopaque, ?*anyopaque) callconv(.C) void = null, user_data: ?*anyopaque = null, }; pub const FileOptions = extern struct { - read: ?fn (*const MemoryOptions, *const FileOptions, CString, *usize, *(?*anyopaque)) callconv(.C) Result = null, - release: ?fn (*const MemoryOptions, *const FileOptions, ?*anyopaque) callconv(.C) void = null, + read: ?*const fn (*const MemoryOptions, *const FileOptions, CString, *usize, *(?*anyopaque)) callconv(.C) Result = null, + release: ?*const fn (*const MemoryOptions, *const FileOptions, ?*anyopaque) callconv(.C) void = null, user_data: ?*anyopaque = null, }; @@ -45,14 +45,14 @@ pub const Options = extern struct { file: FileOptions = FileOptions{}, }; -pub const BufferViewType = enum (u32) { +pub const BufferViewType = enum(u32) { invalid, indices, vertices, _, }; -pub const AttributeType = enum (u32) { +pub const AttributeType = enum(u32) { invalid, position, normal, @@ -64,7 +64,7 @@ pub const AttributeType = enum (u32) { _, }; -pub const ComponentType = enum (u32) { +pub const ComponentType = enum(u32) { invalid, r_8, r_8u, @@ -75,7 +75,7 @@ pub const ComponentType = enum (u32) { _, }; -pub const Type = enum (u32) { +pub const Type = enum(u32) { invalid, scalar, vec2, @@ -87,7 +87,7 @@ pub const Type = enum (u32) { _, }; -pub const PrimitiveType = enum (u32) { +pub const PrimitiveType = enum(u32) { points, lines, line_loop, @@ -98,14 +98,14 @@ pub const PrimitiveType = enum (u32) { _, }; -pub const AlphaMode = enum (u32) { +pub const AlphaMode = enum(u32) { opaqueMode, mask, blend, _, }; -pub const AnimationPathType = enum (u32) { +pub const AnimationPathType = enum(u32) { invalid, translation, rotation, @@ -114,21 +114,21 @@ pub const AnimationPathType = enum (u32) { _, }; -pub const InterpolationType = enum (u32) { +pub const InterpolationType = enum(u32) { linear, step, cubic_spline, _, }; -pub const CameraType = enum (u32) { +pub const CameraType = enum(u32) { invalid, perspective, orthographic, _, }; -pub const LightType = enum (u32) { +pub const LightType = enum(u32) { invalid, directional, point, @@ -184,24 +184,24 @@ pub const Accessor = extern struct { is_sparse: Bool32, sparse: AccessorSparse, // valid only if is_sparse != 0 extras: Extras, - pub fn unpackFloatsCount(self: *const Accessor) callconv(.Inline) usize { + pub inline fn unpackFloatsCount(self: *const Accessor) usize { return cgltf_accessor_unpack_floats(self, null, 0); } - pub fn unpackFloats(self: *const Accessor, outBuffer: []f32) callconv(.Inline) []f32 { + pub inline fn unpackFloats(self: *const Accessor, outBuffer: []f32) []f32 { const actualCount = cgltf_accessor_unpack_floats(self, outBuffer.ptr, outBuffer.len); return outBuffer[0..actualCount]; } - pub fn readFloat(self: *const Accessor, index: usize, outFloats: []f32) callconv(.Inline) bool { + pub inline fn readFloat(self: *const Accessor, index: usize, outFloats: []f32) bool { assert(outFloats.len == numComponents(self.type)); const result = cgltf_accessor_read_float(self, index, outFloats.ptr, outFloats.len); return result != 0; } - pub fn readUint(self: *const Accessor, index: usize, outInts: []u32) callconv(.Inline) bool { + pub inline fn readUint(self: *const Accessor, index: usize, outInts: []u32) bool { assert(outInts.len == numComponents(self.type)); const result = cgltf_accessor_read_uint(self, index, outInts.ptr, outInts.len); return result != 0; } - pub fn readIndex(self: *const Accessor, index: usize) callconv(.Inline) usize { + pub inline fn readIndex(self: *const Accessor, index: usize) usize { return cgltf_accessor_read_index(self, index); } }; @@ -378,12 +378,12 @@ pub const Node = extern struct { scale: [3]f32, matrix: [16]f32, extras: Extras, - pub fn transformLocal(self: *const Node) callconv(.Inline) [16]f32 { + pub inline fn transformLocal(self: *const Node) [16]f32 { var transform: [16]f32 = undefined; cgltf_node_transform_local(self, &transform); return transform; } - pub fn transformWorld(self: *const Node) callconv(.Inline) [16]f32 { + pub inline fn transformWorld(self: *const Node) [16]f32 { var transform: [16]f32 = undefined; cgltf_node_transform_world(self, &transform); return transform; @@ -473,7 +473,7 @@ pub const Data = extern struct { memory: MemoryOptions, file: FileOptions, }; -pub fn parse(options: *const Options, data: []const u8) callconv(.Inline) !*Data { +pub inline fn parse(options: *const Options, data: []const u8) !*Data { var out_data: ?*Data = undefined; const result = cgltf_parse(options, data.ptr, data.len, &out_data); if (result == .success) return out_data.?; @@ -490,7 +490,7 @@ pub fn parse(options: *const Options, data: []const u8) callconv(.Inline) !*Data else => unreachable, } } -pub fn parseFile(options: Options, path: CString) callconv(.Inline) !*Data { +pub inline fn parseFile(options: Options, path: CString) !*Data { var out_data: ?*Data = undefined; const result = cgltf_parse_file(&options, path, &out_data); if (result == .success) return out_data.?; @@ -507,7 +507,7 @@ pub fn parseFile(options: Options, path: CString) callconv(.Inline) !*Data { else => unreachable, } } -pub fn loadBuffers(options: Options, data: *Data, gltf_path: CString) callconv(.Inline) !void { +pub inline fn loadBuffers(options: Options, data: *Data, gltf_path: CString) !void { const result = cgltf_load_buffers(&options, data, gltf_path); if (result == .success) return; switch (result) { @@ -523,22 +523,24 @@ pub fn loadBuffers(options: Options, data: *Data, gltf_path: CString) callconv(. else => unreachable, } } -pub fn loadBufferBase64(options: Options, size: usize, base64: []const u8) callconv(.Inline) ![]u8 { +pub inline fn loadBufferBase64(options: Options, size: usize, base64: []const u8) ![]u8 { assert(base64.len >= (size * 4 + 2) / 3); var out: ?*anyopaque = null; const result = cgltf_load_buffer_base64(&options, size, base64.ptr, &out); - if (result == .success) - return @ptrCast([*]u8, out.?)[0..size]; + if (result == .success) { + const temp: [*]u8 = @ptrCast(out.?); + return temp[0..size]; + } switch (result) { .io_error => return error.CgltfIOError, .out_of_memory => return error.OutOfMemory, else => unreachable, } } -pub fn validate(data: *Data) callconv(.Inline) Result { +pub inline fn validate(data: *Data) Result { return cgltf_validate(data); } -pub fn free(data: *Data) callconv(.Inline) void { +pub inline fn free(data: *Data) void { cgltf_free(data); } @@ -554,13 +556,13 @@ pub fn numComponents(inType: Type) usize { else => 1, }; } -pub fn copyExtrasJsonCount(data: *const Data, extras: *const Extras) callconv(.Inline) usize { +pub inline fn copyExtrasJsonCount(data: *const Data, extras: *const Extras) usize { var size: usize = 0; var result = cgltf_copy_extras_json(data, extras, null, &size); assert(result == .success); // can only fail on invalid size ptr return size; } -pub fn copyExtrasJson(data: *const Data, extras: *const Extras, outBuffer: []u8) callconv(.Inline) []u8 { +pub inline fn copyExtrasJson(data: *const Data, extras: *const Extras, outBuffer: []u8) []u8 { var size: usize = outBuffer.len; var result = cgltf_copy_extras_json(data, extras, outBuffer.ptr, &size); assert(result == .success); // can only fail on invalid size ptr diff --git a/include/glfw.zig b/include/glfw.zig index ade9ad9..b8b2fbb 100644 --- a/include/glfw.zig +++ b/include/glfw.zig @@ -1,29 +1,29 @@ -const vk = @import("vk.zig"); +const vk = @import("vk"); pub const GLFWmonitor = opaque {}; pub const GLFWwindow = opaque {}; pub const GLFWcursor = opaque {}; -pub const GLFWglproc = ?fn () callconv(.C) void; -pub const GLFWvkproc = ?fn () callconv(.C) void; -pub const GLFWerrorfun = ?fn (c_int, ?[*:0]const u8) callconv(.C) void; -pub const GLFWwindowposfun = ?fn (?*GLFWwindow, c_int, c_int) callconv(.C) void; -pub const GLFWwindowsizefun = ?fn (?*GLFWwindow, c_int, c_int) callconv(.C) void; -pub const GLFWwindowclosefun = ?fn (?*GLFWwindow) callconv(.C) void; -pub const GLFWwindowrefreshfun = ?fn (?*GLFWwindow) callconv(.C) void; -pub const GLFWwindowfocusfun = ?fn (?*GLFWwindow, c_int) callconv(.C) void; -pub const GLFWwindowiconifyfun = ?fn (?*GLFWwindow, c_int) callconv(.C) void; -pub const GLFWframebuffersizefun = ?fn (?*GLFWwindow, c_int, c_int) callconv(.C) void; -pub const GLFWmousebuttonfun = ?fn (?*GLFWwindow, c_int, c_int, c_int) callconv(.C) void; -pub const GLFWcursorposfun = ?fn (?*GLFWwindow, f64, f64) callconv(.C) void; -pub const GLFWcursorenterfun = ?fn (?*GLFWwindow, c_int) callconv(.C) void; -pub const GLFWscrollfun = ?fn (?*GLFWwindow, f64, f64) callconv(.C) void; -pub const GLFWkeyfun = ?fn (?*GLFWwindow, c_int, c_int, c_int, c_int) callconv(.C) void; -pub const GLFWcharfun = ?fn (?*GLFWwindow, c_uint) callconv(.C) void; -pub const GLFWcharmodsfun = ?fn (?*GLFWwindow, c_uint, c_int) callconv(.C) void; -pub const GLFWdropfun = ?fn (?*GLFWwindow, c_int, ?[*](?[*:0]const u8)) callconv(.C) void; -pub const GLFWmonitorfun = ?fn (?*GLFWmonitor, c_int) callconv(.C) void; -pub const GLFWjoystickfun = ?fn (c_int, c_int) callconv(.C) void; +pub const GLFWglproc = ?*const fn () callconv(.C) void; +pub const GLFWvkproc = ?*const fn () callconv(.C) void; +pub const GLFWerrorfun = ?*const fn (c_int, [*c]const u8) callconv(.C) void; +pub const GLFWwindowposfun = ?*const fn (?*GLFWwindow, c_int, c_int) callconv(.C) void; +pub const GLFWwindowsizefun = ?*const fn (?*GLFWwindow, c_int, c_int) callconv(.C) void; +pub const GLFWwindowclosefun = ?*const fn (?*GLFWwindow) callconv(.C) void; +pub const GLFWwindowrefreshfun = ?*const fn (?*GLFWwindow) callconv(.C) void; +pub const GLFWwindowfocusfun = ?*const fn (?*GLFWwindow, c_int) callconv(.C) void; +pub const GLFWwindowiconifyfun = ?*const fn (?*GLFWwindow, c_int) callconv(.C) void; +pub const GLFWframebuffersizefun = ?*const fn (?*GLFWwindow, c_int, c_int) callconv(.C) void; +pub const GLFWmousebuttonfun = ?*const fn (?*GLFWwindow, c_int, c_int, c_int) callconv(.C) void; +pub const GLFWcursorposfun = ?*const fn (?*GLFWwindow, f64, f64) callconv(.C) void; +pub const GLFWcursorenterfun = ?*const fn (?*GLFWwindow, c_int) callconv(.C) void; +pub const GLFWscrollfun = ?*const fn (?*GLFWwindow, f64, f64) callconv(.C) void; +pub const GLFWkeyfun = ?*const fn (?*GLFWwindow, c_int, c_int, c_int, c_int) callconv(.C) void; +pub const GLFWcharfun = ?*const fn (?*GLFWwindow, c_uint) callconv(.C) void; +pub const GLFWcharmodsfun = ?*const fn (?*GLFWwindow, c_uint, c_int) callconv(.C) void; +pub const GLFWdropfun = ?*const fn (?*GLFWwindow, c_int, ?[*](?[*:0]const u8)) callconv(.C) void; +pub const GLFWmonitorfun = ?*const fn (?*GLFWmonitor, c_int) callconv(.C) void; +pub const GLFWjoystickfun = ?*const fn (c_int, c_int) callconv(.C) void; pub const GLFWvidmode = extern struct { width: c_int, diff --git a/include/vk.zig b/include/vk.zig index 39ffbee..1ee57c9 100644 --- a/include/vk.zig +++ b/include/vk.zig @@ -29,10 +29,10 @@ pub fn FlagsMixin(comptime FlagType: type) type { return struct { pub const IntType = Flags; pub fn toInt(self: FlagType) Flags { - return @bitCast(Flags, self); + return @as(Flags, @bitCast(self)); } pub fn fromInt(value: Flags) FlagType { - return @bitCast(FlagType, value); + return @as(FlagType, @bitCast(value)); } pub fn with(a: FlagType, b: FlagType) FlagType { return fromInt(toInt(a) | toInt(b)); @@ -56,29 +56,36 @@ pub fn FlagsMixin(comptime FlagType: type) type { } pub const CallConv = if (builtin.os.tag == .windows) - std.os.windows.WINAPI - else if (builtin.abi == .android and (builtin.cpu.arch.isARM() or builtin.cpu.arch.isThumb()) and builtin.Target.arm.featureSetHas(builtin.cpu.features, .has_v7) and builtin.cpu.arch.ptrBitWidth() == 32) - // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" - // calling convention, i.e. float parameters are passed in registers. This - // is true even if the rest of the application passes floats on the stack, - // as it does by default when compiling for the armeabi-v7a NDK ABI. - builtin.CallingConvention.AAPCSVFP - else - builtin.CallingConvention.C; - + std.os.windows.WINAPI +else if (builtin.abi == .android and (builtin.cpu.arch.isARM() or builtin.cpu.arch.isThumb()) and builtin.Target.arm.featureSetHas(builtin.cpu.features, .has_v7) and builtin.cpu.arch.ptrBitWidth() == 32) + // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" + // calling convention, i.e. float parameters are passed in registers. This + // is true even if the rest of the application passes floats on the stack, + // as it does by default when compiling for the armeabi-v7a NDK ABI. + std.builtin.CallingConvention.AAPCSVFP +else + std.builtin.CallingConvention.C; pub const VERSION_1_0 = 1; -pub fn MAKE_VERSION(major: u32, minor: u32, patch: u32) u32 { return @shlExact(major, 22) | @shlExact(minor, 12) | patch; } +pub fn MAKE_VERSION(major: u32, minor: u32, patch: u32) u32 { + return @shlExact(major, 22) | @shlExact(minor, 12) | patch; +} // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. //pub const API_VERSION = MAKE_VERSION(1, 0, 0); // Patch version should always be set to 0 // Vulkan 1.0 version number -pub const API_VERSION_1_0 = MAKE_VERSION(1, 0, 0);// Patch version should always be set to 0 +pub const API_VERSION_1_0 = MAKE_VERSION(1, 0, 0); // Patch version should always be set to 0 -pub fn VERSION_MAJOR(version: u32) u32 { return version >> 22; } -pub fn VERSION_MINOR(version: u32) u32 { return (version >> 12) & 0x3ff; } -pub fn VERSION_PATCH(version: u32) u32 { return version & 0xfff; } +pub fn VERSION_MAJOR(version: u32) u32 { + return version >> 22; +} +pub fn VERSION_MINOR(version: u32) u32 { + return (version >> 12) & 0x3ff; +} +pub fn VERSION_PATCH(version: u32) u32 { + return version & 0xfff; +} // Version of this file pub const HEADER_VERSION = 132; @@ -3037,14 +3044,14 @@ pub const InstanceCreateInfo = extern struct { ppEnabledExtensionNames: [*]const CString = undefined, }; -pub const PFN_AllocationFunction = fn ( +pub const PFN_AllocationFunction = *const fn ( ?*anyopaque, usize, usize, SystemAllocationScope, ) callconv(CallConv) ?*anyopaque; -pub const PFN_ReallocationFunction = fn ( +pub const PFN_ReallocationFunction = *const fn ( ?*anyopaque, ?*anyopaque, usize, @@ -3052,19 +3059,19 @@ pub const PFN_ReallocationFunction = fn ( SystemAllocationScope, ) callconv(CallConv) ?*anyopaque; -pub const PFN_FreeFunction = fn ( +pub const PFN_FreeFunction = *const fn ( ?*anyopaque, ?*anyopaque, ) callconv(CallConv) void; -pub const PFN_InternalAllocationNotification = fn ( +pub const PFN_InternalAllocationNotification = *const fn ( ?*anyopaque, usize, InternalAllocationType, SystemAllocationScope, ) callconv(CallConv) void; -pub const PFN_InternalFreeNotification = fn ( +pub const PFN_InternalFreeNotification = *const fn ( ?*anyopaque, usize, InternalAllocationType, @@ -3281,7 +3288,7 @@ pub const PhysicalDeviceProperties = extern struct { vendorID: u32, deviceID: u32, deviceType: PhysicalDeviceType, - deviceName: [MAX_PHYSICAL_DEVICE_NAME_SIZE-1:0]u8, + deviceName: [MAX_PHYSICAL_DEVICE_NAME_SIZE - 1:0]u8, pipelineCacheUUID: [UUID_SIZE]u8, limits: PhysicalDeviceLimits, sparseProperties: PhysicalDeviceSparseProperties, @@ -3311,7 +3318,7 @@ pub const PhysicalDeviceMemoryProperties = extern struct { memoryHeaps: [MAX_MEMORY_HEAPS]MemoryHeap, }; -pub const PFN_VoidFunction = fn () callconv(CallConv) void; +pub const PFN_VoidFunction = *const fn () callconv(CallConv) void; pub const DeviceQueueCreateInfo = extern struct { sType: StructureType = .DEVICE_QUEUE_CREATE_INFO, @@ -3336,15 +3343,15 @@ pub const DeviceCreateInfo = extern struct { }; pub const ExtensionProperties = extern struct { - extensionName: [MAX_EXTENSION_NAME_SIZE-1:0]u8, + extensionName: [MAX_EXTENSION_NAME_SIZE - 1:0]u8, specVersion: u32, }; pub const LayerProperties = extern struct { - layerName: [MAX_EXTENSION_NAME_SIZE-1:0]u8, + layerName: [MAX_EXTENSION_NAME_SIZE - 1:0]u8, specVersion: u32, implementationVersion: u32, - description: [MAX_DESCRIPTION_SIZE-1:0]u8, + description: [MAX_DESCRIPTION_SIZE - 1:0]u8, }; pub const SubmitInfo = extern struct { @@ -4759,7 +4766,7 @@ pub extern fn vkCmdSetDepthBias( pub extern fn vkCmdSetBlendConstants( commandBuffer: CommandBuffer, - blendConstants: *const[4]f32, + blendConstants: *const [4]f32, ) callconv(CallConv) void; pub extern fn vkCmdSetDepthBounds( @@ -5062,10 +5069,10 @@ pub extern fn vkCmdExecuteCommands( pCommandBuffers: [*]const CommandBuffer, ) callconv(CallConv) void; -pub inline fn CreateInstance(createInfo: InstanceCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_LAYER_NOT_PRESENT,VK_EXTENSION_NOT_PRESENT,VK_INCOMPATIBLE_DRIVER,VK_UNDOCUMENTED_ERROR}!Instance { +pub inline fn CreateInstance(createInfo: InstanceCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_LAYER_NOT_PRESENT, VK_EXTENSION_NOT_PRESENT, VK_INCOMPATIBLE_DRIVER, VK_UNDOCUMENTED_ERROR }!Instance { var out_instance: Instance = undefined; const result = vkCreateInstance(&createInfo, pAllocator, &out_instance); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5085,11 +5092,11 @@ pub const EnumeratePhysicalDevicesResult = struct { result: Result, physicalDevices: []PhysicalDevice, }; -pub inline fn EnumeratePhysicalDevices(instance: Instance, physicalDevices: []PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!EnumeratePhysicalDevicesResult { +pub inline fn EnumeratePhysicalDevices(instance: Instance, physicalDevices: []PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!EnumeratePhysicalDevicesResult { var returnValues: EnumeratePhysicalDevicesResult = undefined; - var physicalDeviceCount: u32 = @intCast(u32, physicalDevices.len); + var physicalDeviceCount: u32 = @as(u32, @intCast(physicalDevices.len)); const result = vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, physicalDevices.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5101,10 +5108,10 @@ pub inline fn EnumeratePhysicalDevices(instance: Instance, physicalDevices: []Ph returnValues.result = result; return returnValues; } -pub inline fn EnumeratePhysicalDevicesCount(instance: Instance) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumeratePhysicalDevicesCount(instance: Instance) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!u32 { var out_physicalDeviceCount: u32 = undefined; const result = vkEnumeratePhysicalDevices(instance, &out_physicalDeviceCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5127,10 +5134,10 @@ pub inline fn GetPhysicalDeviceFormatProperties(physicalDevice: PhysicalDevice, return out_formatProperties; } -pub inline fn GetPhysicalDeviceImageFormatProperties(physicalDevice: PhysicalDevice, format: Format, inType: ImageType, tiling: ImageTiling, usage: ImageUsageFlags, flags: ImageCreateFlags) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_FORMAT_NOT_SUPPORTED,VK_UNDOCUMENTED_ERROR}!ImageFormatProperties { +pub inline fn GetPhysicalDeviceImageFormatProperties(physicalDevice: PhysicalDevice, format: Format, inType: ImageType, tiling: ImageTiling, usage: ImageUsageFlags, flags: ImageCreateFlags) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_FORMAT_NOT_SUPPORTED, VK_UNDOCUMENTED_ERROR }!ImageFormatProperties { var out_imageFormatProperties: ImageFormatProperties = undefined; const result = vkGetPhysicalDeviceImageFormatProperties(physicalDevice, format, inType, tiling, usage.toInt(), flags.toInt(), &out_imageFormatProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5149,7 +5156,7 @@ pub inline fn GetPhysicalDeviceProperties(physicalDevice: PhysicalDevice) Physic pub inline fn GetPhysicalDeviceQueueFamilyProperties(physicalDevice: PhysicalDevice, queueFamilyProperties: []QueueFamilyProperties) []QueueFamilyProperties { var out_queueFamilyProperties: []QueueFamilyProperties = undefined; - var queueFamilyPropertyCount: u32 = @intCast(u32, queueFamilyProperties.len); + var queueFamilyPropertyCount: u32 = @as(u32, @intCast(queueFamilyProperties.len)); vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyPropertyCount, queueFamilyProperties.ptr); out_queueFamilyProperties = queueFamilyProperties[0..queueFamilyPropertyCount]; return out_queueFamilyProperties; @@ -5169,10 +5176,10 @@ pub inline fn GetPhysicalDeviceMemoryProperties(physicalDevice: PhysicalDevice) pub const GetInstanceProcAddr = vkGetInstanceProcAddr; pub const GetDeviceProcAddr = vkGetDeviceProcAddr; -pub inline fn CreateDevice(physicalDevice: PhysicalDevice, createInfo: DeviceCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_EXTENSION_NOT_PRESENT,VK_FEATURE_NOT_PRESENT,VK_TOO_MANY_OBJECTS,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Device { +pub inline fn CreateDevice(physicalDevice: PhysicalDevice, createInfo: DeviceCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_EXTENSION_NOT_PRESENT, VK_FEATURE_NOT_PRESENT, VK_TOO_MANY_OBJECTS, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Device { var out_device: Device = undefined; const result = vkCreateDevice(physicalDevice, &createInfo, pAllocator, &out_device); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5193,11 +5200,11 @@ pub const EnumerateInstanceExtensionPropertiesResult = struct { result: Result, properties: []ExtensionProperties, }; -pub inline fn EnumerateInstanceExtensionProperties(pLayerName: ?CString, properties: []ExtensionProperties) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_LAYER_NOT_PRESENT,VK_UNDOCUMENTED_ERROR}!EnumerateInstanceExtensionPropertiesResult { +pub inline fn EnumerateInstanceExtensionProperties(pLayerName: ?CString, properties: []ExtensionProperties) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_LAYER_NOT_PRESENT, VK_UNDOCUMENTED_ERROR }!EnumerateInstanceExtensionPropertiesResult { var returnValues: EnumerateInstanceExtensionPropertiesResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkEnumerateInstanceExtensionProperties(pLayerName, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5209,10 +5216,10 @@ pub inline fn EnumerateInstanceExtensionProperties(pLayerName: ?CString, propert returnValues.result = result; return returnValues; } -pub inline fn EnumerateInstanceExtensionPropertiesCount(pLayerName: ?CString) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_LAYER_NOT_PRESENT,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumerateInstanceExtensionPropertiesCount(pLayerName: ?CString) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_LAYER_NOT_PRESENT, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkEnumerateInstanceExtensionProperties(pLayerName, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5227,11 +5234,11 @@ pub const EnumerateDeviceExtensionPropertiesResult = struct { result: Result, properties: []ExtensionProperties, }; -pub inline fn EnumerateDeviceExtensionProperties(physicalDevice: PhysicalDevice, pLayerName: ?CString, properties: []ExtensionProperties) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_LAYER_NOT_PRESENT,VK_UNDOCUMENTED_ERROR}!EnumerateDeviceExtensionPropertiesResult { +pub inline fn EnumerateDeviceExtensionProperties(physicalDevice: PhysicalDevice, pLayerName: ?CString, properties: []ExtensionProperties) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_LAYER_NOT_PRESENT, VK_UNDOCUMENTED_ERROR }!EnumerateDeviceExtensionPropertiesResult { var returnValues: EnumerateDeviceExtensionPropertiesResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkEnumerateDeviceExtensionProperties(physicalDevice, pLayerName, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5243,10 +5250,10 @@ pub inline fn EnumerateDeviceExtensionProperties(physicalDevice: PhysicalDevice, returnValues.result = result; return returnValues; } -pub inline fn EnumerateDeviceExtensionPropertiesCount(physicalDevice: PhysicalDevice, pLayerName: ?CString) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_LAYER_NOT_PRESENT,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumerateDeviceExtensionPropertiesCount(physicalDevice: PhysicalDevice, pLayerName: ?CString) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_LAYER_NOT_PRESENT, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkEnumerateDeviceExtensionProperties(physicalDevice, pLayerName, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5261,11 +5268,11 @@ pub const EnumerateInstanceLayerPropertiesResult = struct { result: Result, properties: []LayerProperties, }; -pub inline fn EnumerateInstanceLayerProperties(properties: []LayerProperties) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!EnumerateInstanceLayerPropertiesResult { +pub inline fn EnumerateInstanceLayerProperties(properties: []LayerProperties) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!EnumerateInstanceLayerPropertiesResult { var returnValues: EnumerateInstanceLayerPropertiesResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkEnumerateInstanceLayerProperties(&propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5276,10 +5283,10 @@ pub inline fn EnumerateInstanceLayerProperties(properties: []LayerProperties) er returnValues.result = result; return returnValues; } -pub inline fn EnumerateInstanceLayerPropertiesCount() error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumerateInstanceLayerPropertiesCount() error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkEnumerateInstanceLayerProperties(&out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5293,11 +5300,11 @@ pub const EnumerateDeviceLayerPropertiesResult = struct { result: Result, properties: []LayerProperties, }; -pub inline fn EnumerateDeviceLayerProperties(physicalDevice: PhysicalDevice, properties: []LayerProperties) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!EnumerateDeviceLayerPropertiesResult { +pub inline fn EnumerateDeviceLayerProperties(physicalDevice: PhysicalDevice, properties: []LayerProperties) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!EnumerateDeviceLayerPropertiesResult { var returnValues: EnumerateDeviceLayerPropertiesResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkEnumerateDeviceLayerProperties(physicalDevice, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5308,10 +5315,10 @@ pub inline fn EnumerateDeviceLayerProperties(physicalDevice: PhysicalDevice, pro returnValues.result = result; return returnValues; } -pub inline fn EnumerateDeviceLayerPropertiesCount(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumerateDeviceLayerPropertiesCount(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkEnumerateDeviceLayerProperties(physicalDevice, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5327,9 +5334,9 @@ pub inline fn GetDeviceQueue(device: Device, queueFamilyIndex: u32, queueIndex: return out_queue; } -pub inline fn QueueSubmit(queue: Queue, submits: []const SubmitInfo, fence: Fence) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!void { - const result = vkQueueSubmit(queue, @intCast(u32, submits.len), submits.ptr, fence); - if (@bitCast(c_int, result) < 0) { +pub inline fn QueueSubmit(queue: Queue, submits: []const SubmitInfo, fence: Fence) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!void { + const result = vkQueueSubmit(queue, @as(u32, @intCast(submits.len)), submits.ptr, fence); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5339,9 +5346,9 @@ pub inline fn QueueSubmit(queue: Queue, submits: []const SubmitInfo, fence: Fenc } } -pub inline fn QueueWaitIdle(queue: Queue) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn QueueWaitIdle(queue: Queue) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!void { const result = vkQueueWaitIdle(queue); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5351,9 +5358,9 @@ pub inline fn QueueWaitIdle(queue: Queue) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_ } } -pub inline fn DeviceWaitIdle(device: Device) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn DeviceWaitIdle(device: Device) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!void { const result = vkDeviceWaitIdle(device); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5363,10 +5370,10 @@ pub inline fn DeviceWaitIdle(device: Device) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_ } } -pub inline fn AllocateMemory(device: Device, allocateInfo: MemoryAllocateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_TOO_MANY_OBJECTS,VK_INVALID_EXTERNAL_HANDLE,VK_INVALID_OPAQUE_CAPTURE_ADDRESS,VK_UNDOCUMENTED_ERROR}!DeviceMemory { +pub inline fn AllocateMemory(device: Device, allocateInfo: MemoryAllocateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_TOO_MANY_OBJECTS, VK_INVALID_EXTERNAL_HANDLE, VK_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_UNDOCUMENTED_ERROR }!DeviceMemory { var out_memory: DeviceMemory = undefined; const result = vkAllocateMemory(device, &allocateInfo, pAllocator, &out_memory); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5381,9 +5388,9 @@ pub inline fn AllocateMemory(device: Device, allocateInfo: MemoryAllocateInfo, p pub const FreeMemory = vkFreeMemory; -pub inline fn MapMemory(device: Device, memory: DeviceMemory, offset: DeviceSize, size: DeviceSize, flags: MemoryMapFlags, ppData: ?**anyopaque) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_MEMORY_MAP_FAILED,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn MapMemory(device: Device, memory: DeviceMemory, offset: DeviceSize, size: DeviceSize, flags: MemoryMapFlags, ppData: ?**anyopaque) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_MEMORY_MAP_FAILED, VK_UNDOCUMENTED_ERROR }!void { const result = vkMapMemory(device, memory, offset, size, flags.toInt(), ppData); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5395,9 +5402,9 @@ pub inline fn MapMemory(device: Device, memory: DeviceMemory, offset: DeviceSize pub const UnmapMemory = vkUnmapMemory; -pub inline fn FlushMappedMemoryRanges(device: Device, memoryRanges: []const MappedMemoryRange) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkFlushMappedMemoryRanges(device, @intCast(u32, memoryRanges.len), memoryRanges.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn FlushMappedMemoryRanges(device: Device, memoryRanges: []const MappedMemoryRange) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkFlushMappedMemoryRanges(device, @as(u32, @intCast(memoryRanges.len)), memoryRanges.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5406,9 +5413,9 @@ pub inline fn FlushMappedMemoryRanges(device: Device, memoryRanges: []const Mapp } } -pub inline fn InvalidateMappedMemoryRanges(device: Device, memoryRanges: []const MappedMemoryRange) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkInvalidateMappedMemoryRanges(device, @intCast(u32, memoryRanges.len), memoryRanges.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn InvalidateMappedMemoryRanges(device: Device, memoryRanges: []const MappedMemoryRange) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkInvalidateMappedMemoryRanges(device, @as(u32, @intCast(memoryRanges.len)), memoryRanges.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5423,9 +5430,9 @@ pub inline fn GetDeviceMemoryCommitment(device: Device, memory: DeviceMemory) De return out_committedMemoryInBytes; } -pub inline fn BindBufferMemory(device: Device, buffer: Buffer, memory: DeviceMemory, memoryOffset: DeviceSize) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_OPAQUE_CAPTURE_ADDRESS,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn BindBufferMemory(device: Device, buffer: Buffer, memory: DeviceMemory, memoryOffset: DeviceSize) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_UNDOCUMENTED_ERROR }!void { const result = vkBindBufferMemory(device, buffer, memory, memoryOffset); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5435,9 +5442,9 @@ pub inline fn BindBufferMemory(device: Device, buffer: Buffer, memory: DeviceMem } } -pub inline fn BindImageMemory(device: Device, image: Image, memory: DeviceMemory, memoryOffset: DeviceSize) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn BindImageMemory(device: Device, image: Image, memory: DeviceMemory, memoryOffset: DeviceSize) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkBindImageMemory(device, image, memory, memoryOffset); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5460,7 +5467,7 @@ pub inline fn GetImageMemoryRequirements(device: Device, image: Image) MemoryReq pub inline fn GetImageSparseMemoryRequirements(device: Device, image: Image, sparseMemoryRequirements: []SparseImageMemoryRequirements) []SparseImageMemoryRequirements { var out_sparseMemoryRequirements: []SparseImageMemoryRequirements = undefined; - var sparseMemoryRequirementCount: u32 = @intCast(u32, sparseMemoryRequirements.len); + var sparseMemoryRequirementCount: u32 = @as(u32, @intCast(sparseMemoryRequirements.len)); vkGetImageSparseMemoryRequirements(device, image, &sparseMemoryRequirementCount, sparseMemoryRequirements.ptr); out_sparseMemoryRequirements = sparseMemoryRequirements[0..sparseMemoryRequirementCount]; return out_sparseMemoryRequirements; @@ -5473,7 +5480,7 @@ pub inline fn GetImageSparseMemoryRequirementsCount(device: Device, image: Image pub inline fn GetPhysicalDeviceSparseImageFormatProperties(physicalDevice: PhysicalDevice, format: Format, inType: ImageType, samples: SampleCountFlags, usage: ImageUsageFlags, tiling: ImageTiling, properties: []SparseImageFormatProperties) []SparseImageFormatProperties { var out_properties: []SparseImageFormatProperties = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, inType, samples.toInt(), usage.toInt(), tiling, &propertyCount, properties.ptr); out_properties = properties[0..propertyCount]; return out_properties; @@ -5484,9 +5491,9 @@ pub inline fn GetPhysicalDeviceSparseImageFormatPropertiesCount(physicalDevice: return out_propertyCount; } -pub inline fn QueueBindSparse(queue: Queue, bindInfo: []const BindSparseInfo, fence: Fence) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!void { - const result = vkQueueBindSparse(queue, @intCast(u32, bindInfo.len), bindInfo.ptr, fence); - if (@bitCast(c_int, result) < 0) { +pub inline fn QueueBindSparse(queue: Queue, bindInfo: []const BindSparseInfo, fence: Fence) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!void { + const result = vkQueueBindSparse(queue, @as(u32, @intCast(bindInfo.len)), bindInfo.ptr, fence); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5496,10 +5503,10 @@ pub inline fn QueueBindSparse(queue: Queue, bindInfo: []const BindSparseInfo, fe } } -pub inline fn CreateFence(device: Device, createInfo: FenceCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!Fence { +pub inline fn CreateFence(device: Device, createInfo: FenceCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!Fence { var out_fence: Fence = undefined; const result = vkCreateFence(device, &createInfo, pAllocator, &out_fence); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5511,9 +5518,9 @@ pub inline fn CreateFence(device: Device, createInfo: FenceCreateInfo, pAllocato pub const DestroyFence = vkDestroyFence; -pub inline fn ResetFences(device: Device, fences: []const Fence) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkResetFences(device, @intCast(u32, fences.len), fences.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn ResetFences(device: Device, fences: []const Fence) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkResetFences(device, @as(u32, @intCast(fences.len)), fences.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5522,9 +5529,9 @@ pub inline fn ResetFences(device: Device, fences: []const Fence) error{VK_OUT_OF } } -pub inline fn GetFenceStatus(device: Device, fence: Fence) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Result { +pub inline fn GetFenceStatus(device: Device, fence: Fence) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Result { const result = vkGetFenceStatus(device, fence); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5535,9 +5542,9 @@ pub inline fn GetFenceStatus(device: Device, fence: Fence) error{VK_OUT_OF_HOST_ return result; } -pub inline fn WaitForFences(device: Device, fences: []const Fence, waitAll: Bool32, timeout: u64) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Result { - const result = vkWaitForFences(device, @intCast(u32, fences.len), fences.ptr, waitAll, timeout); - if (@bitCast(c_int, result) < 0) { +pub inline fn WaitForFences(device: Device, fences: []const Fence, waitAll: Bool32, timeout: u64) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Result { + const result = vkWaitForFences(device, @as(u32, @intCast(fences.len)), fences.ptr, waitAll, timeout); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5548,10 +5555,10 @@ pub inline fn WaitForFences(device: Device, fences: []const Fence, waitAll: Bool return result; } -pub inline fn CreateSemaphore(device: Device, createInfo: SemaphoreCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!Semaphore { +pub inline fn CreateSemaphore(device: Device, createInfo: SemaphoreCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!Semaphore { var out_semaphore: Semaphore = undefined; const result = vkCreateSemaphore(device, &createInfo, pAllocator, &out_semaphore); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5563,10 +5570,10 @@ pub inline fn CreateSemaphore(device: Device, createInfo: SemaphoreCreateInfo, p pub const DestroySemaphore = vkDestroySemaphore; -pub inline fn CreateEvent(device: Device, createInfo: EventCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!Event { +pub inline fn CreateEvent(device: Device, createInfo: EventCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!Event { var out_event: Event = undefined; const result = vkCreateEvent(device, &createInfo, pAllocator, &out_event); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5578,9 +5585,9 @@ pub inline fn CreateEvent(device: Device, createInfo: EventCreateInfo, pAllocato pub const DestroyEvent = vkDestroyEvent; -pub inline fn GetEventStatus(device: Device, event: Event) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Result { +pub inline fn GetEventStatus(device: Device, event: Event) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Result { const result = vkGetEventStatus(device, event); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5591,9 +5598,9 @@ pub inline fn GetEventStatus(device: Device, event: Event) error{VK_OUT_OF_HOST_ return result; } -pub inline fn SetEvent(device: Device, event: Event) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn SetEvent(device: Device, event: Event) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkSetEvent(device, event); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5602,9 +5609,9 @@ pub inline fn SetEvent(device: Device, event: Event) error{VK_OUT_OF_HOST_MEMORY } } -pub inline fn ResetEvent(device: Device, event: Event) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn ResetEvent(device: Device, event: Event) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkResetEvent(device, event); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5613,10 +5620,10 @@ pub inline fn ResetEvent(device: Device, event: Event) error{VK_OUT_OF_HOST_MEMO } } -pub inline fn CreateQueryPool(device: Device, createInfo: QueryPoolCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!QueryPool { +pub inline fn CreateQueryPool(device: Device, createInfo: QueryPoolCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!QueryPool { var out_queryPool: QueryPool = undefined; const result = vkCreateQueryPool(device, &createInfo, pAllocator, &out_queryPool); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5628,9 +5635,9 @@ pub inline fn CreateQueryPool(device: Device, createInfo: QueryPoolCreateInfo, p pub const DestroyQueryPool = vkDestroyQueryPool; -pub inline fn GetQueryPoolResults(device: Device, queryPool: QueryPool, firstQuery: u32, queryCount: u32, data: []u8, stride: DeviceSize, flags: QueryResultFlags) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Result { - const result = vkGetQueryPoolResults(device, queryPool, firstQuery, queryCount, @intCast(usize, data.len), data.ptr, stride, flags.toInt()); - if (@bitCast(c_int, result) < 0) { +pub inline fn GetQueryPoolResults(device: Device, queryPool: QueryPool, firstQuery: u32, queryCount: u32, data: []u8, stride: DeviceSize, flags: QueryResultFlags) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Result { + const result = vkGetQueryPoolResults(device, queryPool, firstQuery, queryCount, @as(usize, @intCast(data.len)), data.ptr, stride, flags.toInt()); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5641,10 +5648,10 @@ pub inline fn GetQueryPoolResults(device: Device, queryPool: QueryPool, firstQue return result; } -pub inline fn CreateBuffer(device: Device, createInfo: BufferCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_OPAQUE_CAPTURE_ADDRESS,VK_UNDOCUMENTED_ERROR}!Buffer { +pub inline fn CreateBuffer(device: Device, createInfo: BufferCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_UNDOCUMENTED_ERROR }!Buffer { var out_buffer: Buffer = undefined; const result = vkCreateBuffer(device, &createInfo, pAllocator, &out_buffer); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5657,10 +5664,10 @@ pub inline fn CreateBuffer(device: Device, createInfo: BufferCreateInfo, pAlloca pub const DestroyBuffer = vkDestroyBuffer; -pub inline fn CreateBufferView(device: Device, createInfo: BufferViewCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!BufferView { +pub inline fn CreateBufferView(device: Device, createInfo: BufferViewCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!BufferView { var out_view: BufferView = undefined; const result = vkCreateBufferView(device, &createInfo, pAllocator, &out_view); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5672,10 +5679,10 @@ pub inline fn CreateBufferView(device: Device, createInfo: BufferViewCreateInfo, pub const DestroyBufferView = vkDestroyBufferView; -pub inline fn CreateImage(device: Device, createInfo: ImageCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!Image { +pub inline fn CreateImage(device: Device, createInfo: ImageCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!Image { var out_image: Image = undefined; const result = vkCreateImage(device, &createInfo, pAllocator, &out_image); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5693,10 +5700,10 @@ pub inline fn GetImageSubresourceLayout(device: Device, image: Image, subresourc return out_layout; } -pub inline fn CreateImageView(device: Device, createInfo: ImageViewCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!ImageView { +pub inline fn CreateImageView(device: Device, createInfo: ImageViewCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!ImageView { var out_view: ImageView = undefined; const result = vkCreateImageView(device, &createInfo, pAllocator, &out_view); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5708,10 +5715,10 @@ pub inline fn CreateImageView(device: Device, createInfo: ImageViewCreateInfo, p pub const DestroyImageView = vkDestroyImageView; -pub inline fn CreateShaderModule(device: Device, createInfo: ShaderModuleCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_SHADER_NV,VK_UNDOCUMENTED_ERROR}!ShaderModule { +pub inline fn CreateShaderModule(device: Device, createInfo: ShaderModuleCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_SHADER_NV, VK_UNDOCUMENTED_ERROR }!ShaderModule { var out_shaderModule: ShaderModule = undefined; const result = vkCreateShaderModule(device, &createInfo, pAllocator, &out_shaderModule); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5724,10 +5731,10 @@ pub inline fn CreateShaderModule(device: Device, createInfo: ShaderModuleCreateI pub const DestroyShaderModule = vkDestroyShaderModule; -pub inline fn CreatePipelineCache(device: Device, createInfo: PipelineCacheCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!PipelineCache { +pub inline fn CreatePipelineCache(device: Device, createInfo: PipelineCacheCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!PipelineCache { var out_pipelineCache: PipelineCache = undefined; const result = vkCreatePipelineCache(device, &createInfo, pAllocator, &out_pipelineCache); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5743,11 +5750,11 @@ pub const GetPipelineCacheDataResult = struct { result: Result, data: []u8, }; -pub inline fn GetPipelineCacheData(device: Device, pipelineCache: PipelineCache, data: []u8) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPipelineCacheDataResult { +pub inline fn GetPipelineCacheData(device: Device, pipelineCache: PipelineCache, data: []u8) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPipelineCacheDataResult { var returnValues: GetPipelineCacheDataResult = undefined; - var dataSize: usize = @intCast(usize, data.len); + var dataSize: usize = @as(usize, @intCast(data.len)); const result = vkGetPipelineCacheData(device, pipelineCache, &dataSize, data.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5758,10 +5765,10 @@ pub inline fn GetPipelineCacheData(device: Device, pipelineCache: PipelineCache, returnValues.result = result; return returnValues; } -pub inline fn GetPipelineCacheDataCount(device: Device, pipelineCache: PipelineCache) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!usize { +pub inline fn GetPipelineCacheDataCount(device: Device, pipelineCache: PipelineCache) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!usize { var out_dataSize: usize = undefined; const result = vkGetPipelineCacheData(device, pipelineCache, &out_dataSize, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5771,9 +5778,9 @@ pub inline fn GetPipelineCacheDataCount(device: Device, pipelineCache: PipelineC return out_dataSize; } -pub inline fn MergePipelineCaches(device: Device, dstCache: PipelineCache, srcCaches: []const PipelineCache) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkMergePipelineCaches(device, dstCache, @intCast(u32, srcCaches.len), srcCaches.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn MergePipelineCaches(device: Device, dstCache: PipelineCache, srcCaches: []const PipelineCache) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkMergePipelineCaches(device, dstCache, @as(u32, @intCast(srcCaches.len)), srcCaches.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5782,10 +5789,10 @@ pub inline fn MergePipelineCaches(device: Device, dstCache: PipelineCache, srcCa } } -pub inline fn CreateGraphicsPipelines(device: Device, pipelineCache: PipelineCache, createInfos: []const GraphicsPipelineCreateInfo, pAllocator: ?*const AllocationCallbacks, pipelines: []Pipeline) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_SHADER_NV,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CreateGraphicsPipelines(device: Device, pipelineCache: PipelineCache, createInfos: []const GraphicsPipelineCreateInfo, pAllocator: ?*const AllocationCallbacks, pipelines: []Pipeline) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_SHADER_NV, VK_UNDOCUMENTED_ERROR }!void { assert(pipelines.len >= createInfos.len); - const result = vkCreateGraphicsPipelines(device, pipelineCache, @intCast(u32, createInfos.len), createInfos.ptr, pAllocator, pipelines.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkCreateGraphicsPipelines(device, pipelineCache, @as(u32, @intCast(createInfos.len)), createInfos.ptr, pAllocator, pipelines.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5795,10 +5802,10 @@ pub inline fn CreateGraphicsPipelines(device: Device, pipelineCache: PipelineCac } } -pub inline fn CreateComputePipelines(device: Device, pipelineCache: PipelineCache, createInfos: []const ComputePipelineCreateInfo, pAllocator: ?*const AllocationCallbacks, pipelines: []Pipeline) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_SHADER_NV,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CreateComputePipelines(device: Device, pipelineCache: PipelineCache, createInfos: []const ComputePipelineCreateInfo, pAllocator: ?*const AllocationCallbacks, pipelines: []Pipeline) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_SHADER_NV, VK_UNDOCUMENTED_ERROR }!void { assert(pipelines.len >= createInfos.len); - const result = vkCreateComputePipelines(device, pipelineCache, @intCast(u32, createInfos.len), createInfos.ptr, pAllocator, pipelines.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkCreateComputePipelines(device, pipelineCache, @as(u32, @intCast(createInfos.len)), createInfos.ptr, pAllocator, pipelines.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5810,10 +5817,10 @@ pub inline fn CreateComputePipelines(device: Device, pipelineCache: PipelineCach pub const DestroyPipeline = vkDestroyPipeline; -pub inline fn CreatePipelineLayout(device: Device, createInfo: PipelineLayoutCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!PipelineLayout { +pub inline fn CreatePipelineLayout(device: Device, createInfo: PipelineLayoutCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!PipelineLayout { var out_pipelineLayout: PipelineLayout = undefined; const result = vkCreatePipelineLayout(device, &createInfo, pAllocator, &out_pipelineLayout); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5825,10 +5832,10 @@ pub inline fn CreatePipelineLayout(device: Device, createInfo: PipelineLayoutCre pub const DestroyPipelineLayout = vkDestroyPipelineLayout; -pub inline fn CreateSampler(device: Device, createInfo: SamplerCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_TOO_MANY_OBJECTS,VK_UNDOCUMENTED_ERROR}!Sampler { +pub inline fn CreateSampler(device: Device, createInfo: SamplerCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_TOO_MANY_OBJECTS, VK_UNDOCUMENTED_ERROR }!Sampler { var out_sampler: Sampler = undefined; const result = vkCreateSampler(device, &createInfo, pAllocator, &out_sampler); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5841,10 +5848,10 @@ pub inline fn CreateSampler(device: Device, createInfo: SamplerCreateInfo, pAllo pub const DestroySampler = vkDestroySampler; -pub inline fn CreateDescriptorSetLayout(device: Device, createInfo: DescriptorSetLayoutCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!DescriptorSetLayout { +pub inline fn CreateDescriptorSetLayout(device: Device, createInfo: DescriptorSetLayoutCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!DescriptorSetLayout { var out_setLayout: DescriptorSetLayout = undefined; const result = vkCreateDescriptorSetLayout(device, &createInfo, pAllocator, &out_setLayout); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5856,10 +5863,10 @@ pub inline fn CreateDescriptorSetLayout(device: Device, createInfo: DescriptorSe pub const DestroyDescriptorSetLayout = vkDestroyDescriptorSetLayout; -pub inline fn CreateDescriptorPool(device: Device, createInfo: DescriptorPoolCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_FRAGMENTATION,VK_UNDOCUMENTED_ERROR}!DescriptorPool { +pub inline fn CreateDescriptorPool(device: Device, createInfo: DescriptorPoolCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_FRAGMENTATION, VK_UNDOCUMENTED_ERROR }!DescriptorPool { var out_descriptorPool: DescriptorPool = undefined; const result = vkCreateDescriptorPool(device, &createInfo, pAllocator, &out_descriptorPool); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5874,15 +5881,15 @@ pub const DestroyDescriptorPool = vkDestroyDescriptorPool; pub inline fn ResetDescriptorPool(device: Device, descriptorPool: DescriptorPool, flags: DescriptorPoolResetFlags) error{VK_UNDOCUMENTED_ERROR}!void { const result = vkResetDescriptorPool(device, descriptorPool, flags.toInt()); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } } -pub inline fn AllocateDescriptorSets(device: Device, allocateInfo: DescriptorSetAllocateInfo, descriptorSets: []DescriptorSet) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_FRAGMENTED_POOL,VK_OUT_OF_POOL_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn AllocateDescriptorSets(device: Device, allocateInfo: DescriptorSetAllocateInfo, descriptorSets: []DescriptorSet) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_FRAGMENTED_POOL, VK_OUT_OF_POOL_MEMORY, VK_UNDOCUMENTED_ERROR }!void { assert(descriptorSets.len >= allocateInfo.descriptorSetCount); const result = vkAllocateDescriptorSets(device, &allocateInfo, descriptorSets.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5894,20 +5901,20 @@ pub inline fn AllocateDescriptorSets(device: Device, allocateInfo: DescriptorSet } pub inline fn FreeDescriptorSets(device: Device, descriptorPool: DescriptorPool, descriptorSets: []const DescriptorSet) error{VK_UNDOCUMENTED_ERROR}!void { - const result = vkFreeDescriptorSets(device, descriptorPool, @intCast(u32, descriptorSets.len), descriptorSets.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkFreeDescriptorSets(device, descriptorPool, @as(u32, @intCast(descriptorSets.len)), descriptorSets.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } } pub inline fn UpdateDescriptorSets(device: Device, descriptorWrites: []const WriteDescriptorSet, descriptorCopies: []const CopyDescriptorSet) void { - vkUpdateDescriptorSets(device, @intCast(u32, descriptorWrites.len), descriptorWrites.ptr, @intCast(u32, descriptorCopies.len), descriptorCopies.ptr); + vkUpdateDescriptorSets(device, @as(u32, @intCast(descriptorWrites.len)), descriptorWrites.ptr, @as(u32, @intCast(descriptorCopies.len)), descriptorCopies.ptr); } -pub inline fn CreateFramebuffer(device: Device, createInfo: FramebufferCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!Framebuffer { +pub inline fn CreateFramebuffer(device: Device, createInfo: FramebufferCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!Framebuffer { var out_framebuffer: Framebuffer = undefined; const result = vkCreateFramebuffer(device, &createInfo, pAllocator, &out_framebuffer); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5919,10 +5926,10 @@ pub inline fn CreateFramebuffer(device: Device, createInfo: FramebufferCreateInf pub const DestroyFramebuffer = vkDestroyFramebuffer; -pub inline fn CreateRenderPass(device: Device, createInfo: RenderPassCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!RenderPass { +pub inline fn CreateRenderPass(device: Device, createInfo: RenderPassCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!RenderPass { var out_renderPass: RenderPass = undefined; const result = vkCreateRenderPass(device, &createInfo, pAllocator, &out_renderPass); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5940,10 +5947,10 @@ pub inline fn GetRenderAreaGranularity(device: Device, renderPass: RenderPass) E return out_granularity; } -pub inline fn CreateCommandPool(device: Device, createInfo: CommandPoolCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!CommandPool { +pub inline fn CreateCommandPool(device: Device, createInfo: CommandPoolCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!CommandPool { var out_commandPool: CommandPool = undefined; const result = vkCreateCommandPool(device, &createInfo, pAllocator, &out_commandPool); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5955,9 +5962,9 @@ pub inline fn CreateCommandPool(device: Device, createInfo: CommandPoolCreateInf pub const DestroyCommandPool = vkDestroyCommandPool; -pub inline fn ResetCommandPool(device: Device, commandPool: CommandPool, flags: CommandPoolResetFlags) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn ResetCommandPool(device: Device, commandPool: CommandPool, flags: CommandPoolResetFlags) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkResetCommandPool(device, commandPool, flags.toInt()); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5966,10 +5973,10 @@ pub inline fn ResetCommandPool(device: Device, commandPool: CommandPool, flags: } } -pub inline fn AllocateCommandBuffers(device: Device, allocateInfo: CommandBufferAllocateInfo, commandBuffers: []CommandBuffer) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn AllocateCommandBuffers(device: Device, allocateInfo: CommandBufferAllocateInfo, commandBuffers: []CommandBuffer) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { assert(commandBuffers.len >= allocateInfo.commandBufferCount); const result = vkAllocateCommandBuffers(device, &allocateInfo, commandBuffers.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5979,12 +5986,12 @@ pub inline fn AllocateCommandBuffers(device: Device, allocateInfo: CommandBuffer } pub inline fn FreeCommandBuffers(device: Device, commandPool: CommandPool, commandBuffers: []const CommandBuffer) void { - vkFreeCommandBuffers(device, commandPool, @intCast(u32, commandBuffers.len), commandBuffers.ptr); + vkFreeCommandBuffers(device, commandPool, @as(u32, @intCast(commandBuffers.len)), commandBuffers.ptr); } -pub inline fn BeginCommandBuffer(commandBuffer: CommandBuffer, beginInfo: CommandBufferBeginInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn BeginCommandBuffer(commandBuffer: CommandBuffer, beginInfo: CommandBufferBeginInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkBeginCommandBuffer(commandBuffer, &beginInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -5993,9 +6000,9 @@ pub inline fn BeginCommandBuffer(commandBuffer: CommandBuffer, beginInfo: Comman } } -pub inline fn EndCommandBuffer(commandBuffer: CommandBuffer) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn EndCommandBuffer(commandBuffer: CommandBuffer) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkEndCommandBuffer(commandBuffer); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -6004,9 +6011,9 @@ pub inline fn EndCommandBuffer(commandBuffer: CommandBuffer) error{VK_OUT_OF_HOS } } -pub inline fn ResetCommandBuffer(commandBuffer: CommandBuffer, flags: CommandBufferResetFlags) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn ResetCommandBuffer(commandBuffer: CommandBuffer, flags: CommandBufferResetFlags) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkResetCommandBuffer(commandBuffer, flags.toInt()); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -6018,11 +6025,11 @@ pub inline fn ResetCommandBuffer(commandBuffer: CommandBuffer, flags: CommandBuf pub const CmdBindPipeline = vkCmdBindPipeline; pub inline fn CmdSetViewport(commandBuffer: CommandBuffer, firstViewport: u32, viewports: []const Viewport) void { - vkCmdSetViewport(commandBuffer, firstViewport, @intCast(u32, viewports.len), viewports.ptr); + vkCmdSetViewport(commandBuffer, firstViewport, @as(u32, @intCast(viewports.len)), viewports.ptr); } pub inline fn CmdSetScissor(commandBuffer: CommandBuffer, firstScissor: u32, scissors: []const Rect2D) void { - vkCmdSetScissor(commandBuffer, firstScissor, @intCast(u32, scissors.len), scissors.ptr); + vkCmdSetScissor(commandBuffer, firstScissor, @as(u32, @intCast(scissors.len)), scissors.ptr); } pub const CmdSetLineWidth = vkCmdSetLineWidth; @@ -6047,14 +6054,14 @@ pub inline fn CmdSetStencilReference(commandBuffer: CommandBuffer, faceMask: Ste } pub inline fn CmdBindDescriptorSets(commandBuffer: CommandBuffer, pipelineBindPoint: PipelineBindPoint, layout: PipelineLayout, firstSet: u32, descriptorSets: []const DescriptorSet, dynamicOffsets: []const u32) void { - vkCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, @intCast(u32, descriptorSets.len), descriptorSets.ptr, @intCast(u32, dynamicOffsets.len), dynamicOffsets.ptr); + vkCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, @as(u32, @intCast(descriptorSets.len)), descriptorSets.ptr, @as(u32, @intCast(dynamicOffsets.len)), dynamicOffsets.ptr); } pub const CmdBindIndexBuffer = vkCmdBindIndexBuffer; pub inline fn CmdBindVertexBuffers(commandBuffer: CommandBuffer, firstBinding: u32, buffers: []const Buffer, offsets: []const DeviceSize) void { assert(offsets.len >= buffers.len); - vkCmdBindVertexBuffers(commandBuffer, firstBinding, @intCast(u32, buffers.len), buffers.ptr, offsets.ptr); + vkCmdBindVertexBuffers(commandBuffer, firstBinding, @as(u32, @intCast(buffers.len)), buffers.ptr, offsets.ptr); } pub const CmdDraw = vkCmdDraw; @@ -6065,45 +6072,45 @@ pub const CmdDispatch = vkCmdDispatch; pub const CmdDispatchIndirect = vkCmdDispatchIndirect; pub inline fn CmdCopyBuffer(commandBuffer: CommandBuffer, srcBuffer: Buffer, dstBuffer: Buffer, regions: []const BufferCopy) void { - vkCmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, @intCast(u32, regions.len), regions.ptr); + vkCmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, @as(u32, @intCast(regions.len)), regions.ptr); } pub inline fn CmdCopyImage(commandBuffer: CommandBuffer, srcImage: Image, srcImageLayout: ImageLayout, dstImage: Image, dstImageLayout: ImageLayout, regions: []const ImageCopy) void { - vkCmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, @intCast(u32, regions.len), regions.ptr); + vkCmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, @as(u32, @intCast(regions.len)), regions.ptr); } pub inline fn CmdBlitImage(commandBuffer: CommandBuffer, srcImage: Image, srcImageLayout: ImageLayout, dstImage: Image, dstImageLayout: ImageLayout, regions: []const ImageBlit, filter: Filter) void { - vkCmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, @intCast(u32, regions.len), regions.ptr, filter); + vkCmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, @as(u32, @intCast(regions.len)), regions.ptr, filter); } pub inline fn CmdCopyBufferToImage(commandBuffer: CommandBuffer, srcBuffer: Buffer, dstImage: Image, dstImageLayout: ImageLayout, regions: []const BufferImageCopy) void { - vkCmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, @intCast(u32, regions.len), regions.ptr); + vkCmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, @as(u32, @intCast(regions.len)), regions.ptr); } pub inline fn CmdCopyImageToBuffer(commandBuffer: CommandBuffer, srcImage: Image, srcImageLayout: ImageLayout, dstBuffer: Buffer, regions: []const BufferImageCopy) void { - vkCmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, @intCast(u32, regions.len), regions.ptr); + vkCmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, @as(u32, @intCast(regions.len)), regions.ptr); } pub inline fn CmdUpdateBuffer(commandBuffer: CommandBuffer, dstBuffer: Buffer, dstOffset: DeviceSize, data: []const u8) void { - vkCmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, @intCast(DeviceSize, data.len), data.ptr); + vkCmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, @as(DeviceSize, @intCast(data.len)), data.ptr); } pub const CmdFillBuffer = vkCmdFillBuffer; pub inline fn CmdClearColorImage(commandBuffer: CommandBuffer, image: Image, imageLayout: ImageLayout, color: ClearColorValue, ranges: []const ImageSubresourceRange) void { - vkCmdClearColorImage(commandBuffer, image, imageLayout, &color, @intCast(u32, ranges.len), ranges.ptr); + vkCmdClearColorImage(commandBuffer, image, imageLayout, &color, @as(u32, @intCast(ranges.len)), ranges.ptr); } pub inline fn CmdClearDepthStencilImage(commandBuffer: CommandBuffer, image: Image, imageLayout: ImageLayout, depthStencil: ClearDepthStencilValue, ranges: []const ImageSubresourceRange) void { - vkCmdClearDepthStencilImage(commandBuffer, image, imageLayout, &depthStencil, @intCast(u32, ranges.len), ranges.ptr); + vkCmdClearDepthStencilImage(commandBuffer, image, imageLayout, &depthStencil, @as(u32, @intCast(ranges.len)), ranges.ptr); } pub inline fn CmdClearAttachments(commandBuffer: CommandBuffer, attachments: []const ClearAttachment, rects: []const ClearRect) void { - vkCmdClearAttachments(commandBuffer, @intCast(u32, attachments.len), attachments.ptr, @intCast(u32, rects.len), rects.ptr); + vkCmdClearAttachments(commandBuffer, @as(u32, @intCast(attachments.len)), attachments.ptr, @as(u32, @intCast(rects.len)), rects.ptr); } pub inline fn CmdResolveImage(commandBuffer: CommandBuffer, srcImage: Image, srcImageLayout: ImageLayout, dstImage: Image, dstImageLayout: ImageLayout, regions: []const ImageResolve) void { - vkCmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, @intCast(u32, regions.len), regions.ptr); + vkCmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, @as(u32, @intCast(regions.len)), regions.ptr); } pub inline fn CmdSetEvent(commandBuffer: CommandBuffer, event: Event, stageMask: PipelineStageFlags) void { @@ -6115,11 +6122,11 @@ pub inline fn CmdResetEvent(commandBuffer: CommandBuffer, event: Event, stageMas } pub inline fn CmdWaitEvents(commandBuffer: CommandBuffer, events: []const Event, srcStageMask: PipelineStageFlags, dstStageMask: PipelineStageFlags, memoryBarriers: []const MemoryBarrier, bufferMemoryBarriers: []const BufferMemoryBarrier, imageMemoryBarriers: []const ImageMemoryBarrier) void { - vkCmdWaitEvents(commandBuffer, @intCast(u32, events.len), events.ptr, srcStageMask.toInt(), dstStageMask.toInt(), @intCast(u32, memoryBarriers.len), memoryBarriers.ptr, @intCast(u32, bufferMemoryBarriers.len), bufferMemoryBarriers.ptr, @intCast(u32, imageMemoryBarriers.len), imageMemoryBarriers.ptr); + vkCmdWaitEvents(commandBuffer, @as(u32, @intCast(events.len)), events.ptr, srcStageMask.toInt(), dstStageMask.toInt(), @as(u32, @intCast(memoryBarriers.len)), memoryBarriers.ptr, @as(u32, @intCast(bufferMemoryBarriers.len)), bufferMemoryBarriers.ptr, @as(u32, @intCast(imageMemoryBarriers.len)), imageMemoryBarriers.ptr); } pub inline fn CmdPipelineBarrier(commandBuffer: CommandBuffer, srcStageMask: PipelineStageFlags, dstStageMask: PipelineStageFlags, dependencyFlags: DependencyFlags, memoryBarriers: []const MemoryBarrier, bufferMemoryBarriers: []const BufferMemoryBarrier, imageMemoryBarriers: []const ImageMemoryBarrier) void { - vkCmdPipelineBarrier(commandBuffer, srcStageMask.toInt(), dstStageMask.toInt(), dependencyFlags.toInt(), @intCast(u32, memoryBarriers.len), memoryBarriers.ptr, @intCast(u32, bufferMemoryBarriers.len), bufferMemoryBarriers.ptr, @intCast(u32, imageMemoryBarriers.len), imageMemoryBarriers.ptr); + vkCmdPipelineBarrier(commandBuffer, srcStageMask.toInt(), dstStageMask.toInt(), dependencyFlags.toInt(), @as(u32, @intCast(memoryBarriers.len)), memoryBarriers.ptr, @as(u32, @intCast(bufferMemoryBarriers.len)), bufferMemoryBarriers.ptr, @as(u32, @intCast(imageMemoryBarriers.len)), imageMemoryBarriers.ptr); } pub inline fn CmdBeginQuery(commandBuffer: CommandBuffer, queryPool: QueryPool, query: u32, flags: QueryControlFlags) void { @@ -6138,7 +6145,7 @@ pub inline fn CmdCopyQueryPoolResults(commandBuffer: CommandBuffer, queryPool: Q } pub inline fn CmdPushConstants(commandBuffer: CommandBuffer, layout: PipelineLayout, stageFlags: ShaderStageFlags, offset: u32, values: []const u8) void { - vkCmdPushConstants(commandBuffer, layout, stageFlags.toInt(), offset, @intCast(u32, values.len), values.ptr); + vkCmdPushConstants(commandBuffer, layout, stageFlags.toInt(), offset, @as(u32, @intCast(values.len)), values.ptr); } pub inline fn CmdBeginRenderPass(commandBuffer: CommandBuffer, renderPassBegin: RenderPassBeginInfo, contents: SubpassContents) void { @@ -6149,20 +6156,19 @@ pub const CmdNextSubpass = vkCmdNextSubpass; pub const CmdEndRenderPass = vkCmdEndRenderPass; pub inline fn CmdExecuteCommands(commandBuffer: CommandBuffer, commandBuffers: []const CommandBuffer) void { - vkCmdExecuteCommands(commandBuffer, @intCast(u32, commandBuffers.len), commandBuffers.ptr); + vkCmdExecuteCommands(commandBuffer, @as(u32, @intCast(commandBuffers.len)), commandBuffers.ptr); } - pub const VERSION_1_1 = 1; // Vulkan 1.1 version number -pub const API_VERSION_1_1 = MAKE_VERSION(1, 1, 0);// Patch version should always be set to 0 +pub const API_VERSION_1_1 = MAKE_VERSION(1, 1, 0); // Patch version should always be set to 0 pub const SamplerYcbcrConversion = enum(u64) { Null = 0, _ }; pub const DescriptorUpdateTemplate = enum(u64) { Null = 0, _ }; pub const MAX_DEVICE_GROUP_SIZE = 32; pub const LUID_SIZE = 8; -pub const QUEUE_FAMILY_EXTERNAL = (~@as(u32, 0)-1); +pub const QUEUE_FAMILY_EXTERNAL = (~@as(u32, 0) - 1); pub const PointClippingBehavior = enum(i32) { ALL_CLIP_PLANES = 0, @@ -7362,15 +7368,15 @@ pub extern fn vkGetDescriptorSetLayoutSupport( pub inline fn EnumerateInstanceVersion() error{VK_UNDOCUMENTED_ERROR}!u32 { var out_apiVersion: u32 = undefined; const result = vkEnumerateInstanceVersion(&out_apiVersion); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } return out_apiVersion; } -pub inline fn BindBufferMemory2(device: Device, bindInfos: []const BindBufferMemoryInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_OPAQUE_CAPTURE_ADDRESS,VK_UNDOCUMENTED_ERROR}!void { - const result = vkBindBufferMemory2(device, @intCast(u32, bindInfos.len), bindInfos.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn BindBufferMemory2(device: Device, bindInfos: []const BindBufferMemoryInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_UNDOCUMENTED_ERROR }!void { + const result = vkBindBufferMemory2(device, @as(u32, @intCast(bindInfos.len)), bindInfos.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7380,9 +7386,9 @@ pub inline fn BindBufferMemory2(device: Device, bindInfos: []const BindBufferMem } } -pub inline fn BindImageMemory2(device: Device, bindInfos: []const BindImageMemoryInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkBindImageMemory2(device, @intCast(u32, bindInfos.len), bindInfos.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn BindImageMemory2(device: Device, bindInfos: []const BindImageMemoryInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkBindImageMemory2(device, @as(u32, @intCast(bindInfos.len)), bindInfos.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7404,11 +7410,11 @@ pub const EnumeratePhysicalDeviceGroupsResult = struct { result: Result, physicalDeviceGroupProperties: []PhysicalDeviceGroupProperties, }; -pub inline fn EnumeratePhysicalDeviceGroups(instance: Instance, physicalDeviceGroupProperties: []PhysicalDeviceGroupProperties) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!EnumeratePhysicalDeviceGroupsResult { +pub inline fn EnumeratePhysicalDeviceGroups(instance: Instance, physicalDeviceGroupProperties: []PhysicalDeviceGroupProperties) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!EnumeratePhysicalDeviceGroupsResult { var returnValues: EnumeratePhysicalDeviceGroupsResult = undefined; - var physicalDeviceGroupCount: u32 = @intCast(u32, physicalDeviceGroupProperties.len); + var physicalDeviceGroupCount: u32 = @as(u32, @intCast(physicalDeviceGroupProperties.len)); const result = vkEnumeratePhysicalDeviceGroups(instance, &physicalDeviceGroupCount, physicalDeviceGroupProperties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7420,10 +7426,10 @@ pub inline fn EnumeratePhysicalDeviceGroups(instance: Instance, physicalDeviceGr returnValues.result = result; return returnValues; } -pub inline fn EnumeratePhysicalDeviceGroupsCount(instance: Instance) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumeratePhysicalDeviceGroupsCount(instance: Instance) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!u32 { var out_physicalDeviceGroupCount: u32 = undefined; const result = vkEnumeratePhysicalDeviceGroups(instance, &out_physicalDeviceGroupCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7448,7 +7454,7 @@ pub inline fn GetBufferMemoryRequirements2(device: Device, info: BufferMemoryReq pub inline fn GetImageSparseMemoryRequirements2(device: Device, info: ImageSparseMemoryRequirementsInfo2, sparseMemoryRequirements: []SparseImageMemoryRequirements2) []SparseImageMemoryRequirements2 { var out_sparseMemoryRequirements: []SparseImageMemoryRequirements2 = undefined; - var sparseMemoryRequirementCount: u32 = @intCast(u32, sparseMemoryRequirements.len); + var sparseMemoryRequirementCount: u32 = @as(u32, @intCast(sparseMemoryRequirements.len)); vkGetImageSparseMemoryRequirements2(device, &info, &sparseMemoryRequirementCount, sparseMemoryRequirements.ptr); out_sparseMemoryRequirements = sparseMemoryRequirements[0..sparseMemoryRequirementCount]; return out_sparseMemoryRequirements; @@ -7477,10 +7483,10 @@ pub inline fn GetPhysicalDeviceFormatProperties2(physicalDevice: PhysicalDevice, return out_formatProperties; } -pub inline fn GetPhysicalDeviceImageFormatProperties2(physicalDevice: PhysicalDevice, imageFormatInfo: PhysicalDeviceImageFormatInfo2) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_FORMAT_NOT_SUPPORTED,VK_UNDOCUMENTED_ERROR}!ImageFormatProperties2 { +pub inline fn GetPhysicalDeviceImageFormatProperties2(physicalDevice: PhysicalDevice, imageFormatInfo: PhysicalDeviceImageFormatInfo2) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_FORMAT_NOT_SUPPORTED, VK_UNDOCUMENTED_ERROR }!ImageFormatProperties2 { var out_imageFormatProperties: ImageFormatProperties2 = undefined; const result = vkGetPhysicalDeviceImageFormatProperties2(physicalDevice, &imageFormatInfo, &out_imageFormatProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7493,7 +7499,7 @@ pub inline fn GetPhysicalDeviceImageFormatProperties2(physicalDevice: PhysicalDe pub inline fn GetPhysicalDeviceQueueFamilyProperties2(physicalDevice: PhysicalDevice, queueFamilyProperties: []QueueFamilyProperties2) []QueueFamilyProperties2 { var out_queueFamilyProperties: []QueueFamilyProperties2 = undefined; - var queueFamilyPropertyCount: u32 = @intCast(u32, queueFamilyProperties.len); + var queueFamilyPropertyCount: u32 = @as(u32, @intCast(queueFamilyProperties.len)); vkGetPhysicalDeviceQueueFamilyProperties2(physicalDevice, &queueFamilyPropertyCount, queueFamilyProperties.ptr); out_queueFamilyProperties = queueFamilyProperties[0..queueFamilyPropertyCount]; return out_queueFamilyProperties; @@ -7512,7 +7518,7 @@ pub inline fn GetPhysicalDeviceMemoryProperties2(physicalDevice: PhysicalDevice) pub inline fn GetPhysicalDeviceSparseImageFormatProperties2(physicalDevice: PhysicalDevice, formatInfo: PhysicalDeviceSparseImageFormatInfo2, properties: []SparseImageFormatProperties2) []SparseImageFormatProperties2 { var out_properties: []SparseImageFormatProperties2 = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); vkGetPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &formatInfo, &propertyCount, properties.ptr); out_properties = properties[0..propertyCount]; return out_properties; @@ -7533,10 +7539,10 @@ pub inline fn GetDeviceQueue2(device: Device, queueInfo: DeviceQueueInfo2) Queue return out_queue; } -pub inline fn CreateSamplerYcbcrConversion(device: Device, createInfo: SamplerYcbcrConversionCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!SamplerYcbcrConversion { +pub inline fn CreateSamplerYcbcrConversion(device: Device, createInfo: SamplerYcbcrConversionCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!SamplerYcbcrConversion { var out_ycbcrConversion: SamplerYcbcrConversion = undefined; const result = vkCreateSamplerYcbcrConversion(device, &createInfo, pAllocator, &out_ycbcrConversion); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7548,10 +7554,10 @@ pub inline fn CreateSamplerYcbcrConversion(device: Device, createInfo: SamplerYc pub const DestroySamplerYcbcrConversion = vkDestroySamplerYcbcrConversion; -pub inline fn CreateDescriptorUpdateTemplate(device: Device, createInfo: DescriptorUpdateTemplateCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!DescriptorUpdateTemplate { +pub inline fn CreateDescriptorUpdateTemplate(device: Device, createInfo: DescriptorUpdateTemplateCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!DescriptorUpdateTemplate { var out_descriptorUpdateTemplate: DescriptorUpdateTemplate = undefined; const result = vkCreateDescriptorUpdateTemplate(device, &createInfo, pAllocator, &out_descriptorUpdateTemplate); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -7588,10 +7594,9 @@ pub inline fn GetDescriptorSetLayoutSupport(device: Device, createInfo: Descript return out_support; } - pub const VERSION_1_2 = 1; // Vulkan 1.2 version number -pub const API_VERSION_1_2 = MAKE_VERSION(1, 2, 0);// Patch version should always be set to 0 +pub const API_VERSION_1_2 = MAKE_VERSION(1, 2, 0); // Patch version should always be set to 0 pub const DeviceAddress = u64; @@ -7890,8 +7895,8 @@ pub const PhysicalDeviceVulkan12Properties = extern struct { sType: StructureType = .PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES, pNext: ?*anyopaque = null, driverID: DriverId, - driverName: [MAX_DRIVER_NAME_SIZE-1:0]u8, - driverInfo: [MAX_DRIVER_INFO_SIZE-1:0]u8, + driverName: [MAX_DRIVER_NAME_SIZE - 1:0]u8, + driverInfo: [MAX_DRIVER_INFO_SIZE - 1:0]u8, conformanceVersion: ConformanceVersion, denormBehaviorIndependence: ShaderFloatControlsIndependence, roundingModeIndependence: ShaderFloatControlsIndependence, @@ -8038,8 +8043,8 @@ pub const PhysicalDeviceDriverProperties = extern struct { sType: StructureType = .PHYSICAL_DEVICE_DRIVER_PROPERTIES, pNext: ?*anyopaque = null, driverID: DriverId, - driverName: [MAX_DRIVER_NAME_SIZE-1:0]u8, - driverInfo: [MAX_DRIVER_INFO_SIZE-1:0]u8, + driverName: [MAX_DRIVER_NAME_SIZE - 1:0]u8, + driverInfo: [MAX_DRIVER_INFO_SIZE - 1:0]u8, conformanceVersion: ConformanceVersion, }; @@ -8433,10 +8438,10 @@ pub extern fn vkGetDeviceMemoryOpaqueCaptureAddress( pub const CmdDrawIndirectCount = vkCmdDrawIndirectCount; pub const CmdDrawIndexedIndirectCount = vkCmdDrawIndexedIndirectCount; -pub inline fn CreateRenderPass2(device: Device, createInfo: RenderPassCreateInfo2, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!RenderPass { +pub inline fn CreateRenderPass2(device: Device, createInfo: RenderPassCreateInfo2, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!RenderPass { var out_renderPass: RenderPass = undefined; const result = vkCreateRenderPass2(device, &createInfo, pAllocator, &out_renderPass); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8460,10 +8465,10 @@ pub inline fn CmdEndRenderPass2(commandBuffer: CommandBuffer, subpassEndInfo: Su pub const ResetQueryPool = vkResetQueryPool; -pub inline fn GetSemaphoreCounterValue(device: Device, semaphore: Semaphore) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!u64 { +pub inline fn GetSemaphoreCounterValue(device: Device, semaphore: Semaphore) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!u64 { var out_value: u64 = undefined; const result = vkGetSemaphoreCounterValue(device, semaphore, &out_value); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8474,9 +8479,9 @@ pub inline fn GetSemaphoreCounterValue(device: Device, semaphore: Semaphore) err return out_value; } -pub inline fn WaitSemaphores(device: Device, waitInfo: SemaphoreWaitInfo, timeout: u64) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Result { +pub inline fn WaitSemaphores(device: Device, waitInfo: SemaphoreWaitInfo, timeout: u64) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Result { const result = vkWaitSemaphores(device, &waitInfo, timeout); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8487,9 +8492,9 @@ pub inline fn WaitSemaphores(device: Device, waitInfo: SemaphoreWaitInfo, timeou return result; } -pub inline fn SignalSemaphore(device: Device, signalInfo: SemaphoreSignalInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn SignalSemaphore(device: Device, signalInfo: SemaphoreSignalInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkSignalSemaphore(device, &signalInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8513,7 +8518,6 @@ pub inline fn GetDeviceMemoryOpaqueCaptureAddress(device: Device, info: DeviceMe return result; } - pub const KHR_surface = 1; pub const SurfaceKHR = enum(u64) { Null = 0, _ }; @@ -8681,10 +8685,10 @@ pub extern fn vkGetPhysicalDeviceSurfacePresentModesKHR( pub const DestroySurfaceKHR = vkDestroySurfaceKHR; -pub inline fn GetPhysicalDeviceSurfaceSupportKHR(physicalDevice: PhysicalDevice, queueFamilyIndex: u32, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!Bool32 { +pub inline fn GetPhysicalDeviceSurfaceSupportKHR(physicalDevice: PhysicalDevice, queueFamilyIndex: u32, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!Bool32 { var out_supported: Bool32 = undefined; const result = vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, &out_supported); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8695,10 +8699,10 @@ pub inline fn GetPhysicalDeviceSurfaceSupportKHR(physicalDevice: PhysicalDevice, return out_supported; } -pub inline fn GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!SurfaceCapabilitiesKHR { +pub inline fn GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!SurfaceCapabilitiesKHR { var out_surfaceCapabilities: SurfaceCapabilitiesKHR = undefined; const result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, &out_surfaceCapabilities); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8713,11 +8717,11 @@ pub const GetPhysicalDeviceSurfaceFormatsKHRResult = struct { result: Result, surfaceFormats: []SurfaceFormatKHR, }; -pub inline fn GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR, surfaceFormats: []SurfaceFormatKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceSurfaceFormatsKHRResult { +pub inline fn GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR, surfaceFormats: []SurfaceFormatKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceSurfaceFormatsKHRResult { var returnValues: GetPhysicalDeviceSurfaceFormatsKHRResult = undefined; - var surfaceFormatCount: u32 = @intCast(u32, surfaceFormats.len); + var surfaceFormatCount: u32 = @as(u32, @intCast(surfaceFormats.len)); const result = vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &surfaceFormatCount, surfaceFormats.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8729,10 +8733,10 @@ pub inline fn GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice: PhysicalDevice, returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceSurfaceFormatsCountKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceSurfaceFormatsCountKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!u32 { var out_surfaceFormatCount: u32 = undefined; const result = vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &out_surfaceFormatCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8747,11 +8751,11 @@ pub const GetPhysicalDeviceSurfacePresentModesKHRResult = struct { result: Result, presentModes: []PresentModeKHR, }; -pub inline fn GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR, presentModes: []PresentModeKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceSurfacePresentModesKHRResult { +pub inline fn GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR, presentModes: []PresentModeKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceSurfacePresentModesKHRResult { var returnValues: GetPhysicalDeviceSurfacePresentModesKHRResult = undefined; - var presentModeCount: u32 = @intCast(u32, presentModes.len); + var presentModeCount: u32 = @as(u32, @intCast(presentModes.len)); const result = vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &presentModeCount, presentModes.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8763,10 +8767,10 @@ pub inline fn GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice: PhysicalDe returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceSurfacePresentModesCountKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceSurfacePresentModesCountKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!u32 { var out_presentModeCount: u32 = undefined; const result = vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &out_presentModeCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -8777,7 +8781,6 @@ pub inline fn GetPhysicalDeviceSurfacePresentModesCountKHR(physicalDevice: Physi return out_presentModeCount; } - pub const KHR_swapchain = 1; pub const SwapchainKHR = enum(u64) { Null = 0, _ }; @@ -8992,10 +8995,10 @@ pub extern fn vkAcquireNextImage2KHR( pImageIndex: *u32, ) callconv(CallConv) Result; -pub inline fn CreateSwapchainKHR(device: Device, createInfo: SwapchainCreateInfoKHR, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_SURFACE_LOST_KHR,VK_NATIVE_WINDOW_IN_USE_KHR,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!SwapchainKHR { +pub inline fn CreateSwapchainKHR(device: Device, createInfo: SwapchainCreateInfoKHR, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_SURFACE_LOST_KHR, VK_NATIVE_WINDOW_IN_USE_KHR, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!SwapchainKHR { var out_swapchain: SwapchainKHR = undefined; const result = vkCreateSwapchainKHR(device, &createInfo, pAllocator, &out_swapchain); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9015,11 +9018,11 @@ pub const GetSwapchainImagesKHRResult = struct { result: Result, swapchainImages: []Image, }; -pub inline fn GetSwapchainImagesKHR(device: Device, swapchain: SwapchainKHR, swapchainImages: []Image) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetSwapchainImagesKHRResult { +pub inline fn GetSwapchainImagesKHR(device: Device, swapchain: SwapchainKHR, swapchainImages: []Image) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetSwapchainImagesKHRResult { var returnValues: GetSwapchainImagesKHRResult = undefined; - var swapchainImageCount: u32 = @intCast(u32, swapchainImages.len); + var swapchainImageCount: u32 = @as(u32, @intCast(swapchainImages.len)); const result = vkGetSwapchainImagesKHR(device, swapchain, &swapchainImageCount, swapchainImages.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9030,10 +9033,10 @@ pub inline fn GetSwapchainImagesKHR(device: Device, swapchain: SwapchainKHR, swa returnValues.result = result; return returnValues; } -pub inline fn GetSwapchainImagesCountKHR(device: Device, swapchain: SwapchainKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetSwapchainImagesCountKHR(device: Device, swapchain: SwapchainKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_swapchainImageCount: u32 = undefined; const result = vkGetSwapchainImagesKHR(device, swapchain, &out_swapchainImageCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9047,10 +9050,10 @@ pub const AcquireNextImageKHRResult = struct { result: Result, imageIndex: u32, }; -pub inline fn AcquireNextImageKHR(device: Device, swapchain: SwapchainKHR, timeout: u64, semaphore: Semaphore, fence: Fence) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_SURFACE_LOST_KHR,VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT,VK_UNDOCUMENTED_ERROR}!AcquireNextImageKHRResult { +pub inline fn AcquireNextImageKHR(device: Device, swapchain: SwapchainKHR, timeout: u64, semaphore: Semaphore, fence: Fence) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_SURFACE_LOST_KHR, VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT, VK_UNDOCUMENTED_ERROR }!AcquireNextImageKHRResult { var returnValues: AcquireNextImageKHRResult = undefined; const result = vkAcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, &returnValues.imageIndex); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9065,9 +9068,9 @@ pub inline fn AcquireNextImageKHR(device: Device, swapchain: SwapchainKHR, timeo return returnValues; } -pub inline fn QueuePresentKHR(queue: Queue, presentInfo: PresentInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_SURFACE_LOST_KHR,VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT,VK_UNDOCUMENTED_ERROR}!Result { +pub inline fn QueuePresentKHR(queue: Queue, presentInfo: PresentInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_SURFACE_LOST_KHR, VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT, VK_UNDOCUMENTED_ERROR }!Result { const result = vkQueuePresentKHR(queue, &presentInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9081,10 +9084,10 @@ pub inline fn QueuePresentKHR(queue: Queue, presentInfo: PresentInfoKHR) error{V return result; } -pub inline fn GetDeviceGroupPresentCapabilitiesKHR(device: Device) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!DeviceGroupPresentCapabilitiesKHR { +pub inline fn GetDeviceGroupPresentCapabilitiesKHR(device: Device) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!DeviceGroupPresentCapabilitiesKHR { var out_deviceGroupPresentCapabilities: DeviceGroupPresentCapabilitiesKHR = undefined; const result = vkGetDeviceGroupPresentCapabilitiesKHR(device, &out_deviceGroupPresentCapabilities); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9094,10 +9097,10 @@ pub inline fn GetDeviceGroupPresentCapabilitiesKHR(device: Device) error{VK_OUT_ return out_deviceGroupPresentCapabilities; } -pub inline fn GetDeviceGroupSurfacePresentModesKHR(device: Device, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!DeviceGroupPresentModeFlagsKHR { +pub inline fn GetDeviceGroupSurfacePresentModesKHR(device: Device, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!DeviceGroupPresentModeFlagsKHR { var out_modes: DeviceGroupPresentModeFlagsKHR align(4) = undefined; const result = vkGetDeviceGroupSurfacePresentModesKHR(device, surface, &out_modes); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9112,11 +9115,11 @@ pub const GetPhysicalDevicePresentRectanglesKHRResult = struct { result: Result, rects: []Rect2D, }; -pub inline fn GetPhysicalDevicePresentRectanglesKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR, rects: []Rect2D) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDevicePresentRectanglesKHRResult { +pub inline fn GetPhysicalDevicePresentRectanglesKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR, rects: []Rect2D) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDevicePresentRectanglesKHRResult { var returnValues: GetPhysicalDevicePresentRectanglesKHRResult = undefined; - var rectCount: u32 = @intCast(u32, rects.len); + var rectCount: u32 = @as(u32, @intCast(rects.len)); const result = vkGetPhysicalDevicePresentRectanglesKHR(physicalDevice, surface, &rectCount, rects.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9127,10 +9130,10 @@ pub inline fn GetPhysicalDevicePresentRectanglesKHR(physicalDevice: PhysicalDevi returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDevicePresentRectanglesCountKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDevicePresentRectanglesCountKHR(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_rectCount: u32 = undefined; const result = vkGetPhysicalDevicePresentRectanglesKHR(physicalDevice, surface, &out_rectCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9144,10 +9147,10 @@ pub const AcquireNextImage2KHRResult = struct { result: Result, imageIndex: u32, }; -pub inline fn AcquireNextImage2KHR(device: Device, acquireInfo: AcquireNextImageInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_SURFACE_LOST_KHR,VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT,VK_UNDOCUMENTED_ERROR}!AcquireNextImage2KHRResult { +pub inline fn AcquireNextImage2KHR(device: Device, acquireInfo: AcquireNextImageInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_SURFACE_LOST_KHR, VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT, VK_UNDOCUMENTED_ERROR }!AcquireNextImage2KHRResult { var returnValues: AcquireNextImage2KHRResult = undefined; const result = vkAcquireNextImage2KHR(device, &acquireInfo, &returnValues.imageIndex); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9162,7 +9165,6 @@ pub inline fn AcquireNextImage2KHR(device: Device, acquireInfo: AcquireNextImage return returnValues; } - pub const KHR_display = 1; pub const DisplayKHR = enum(u64) { Null = 0, _ }; pub const DisplayModeKHR = enum(u64) { Null = 0, _ }; @@ -9326,11 +9328,11 @@ pub const GetPhysicalDeviceDisplayPropertiesKHRResult = struct { result: Result, properties: []DisplayPropertiesKHR, }; -pub inline fn GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice: PhysicalDevice, properties: []DisplayPropertiesKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceDisplayPropertiesKHRResult { +pub inline fn GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice: PhysicalDevice, properties: []DisplayPropertiesKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceDisplayPropertiesKHRResult { var returnValues: GetPhysicalDeviceDisplayPropertiesKHRResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9341,10 +9343,10 @@ pub inline fn GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice: PhysicalDevi returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceDisplayPropertiesCountKHR(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceDisplayPropertiesCountKHR(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9358,11 +9360,11 @@ pub const GetPhysicalDeviceDisplayPlanePropertiesKHRResult = struct { result: Result, properties: []DisplayPlanePropertiesKHR, }; -pub inline fn GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice: PhysicalDevice, properties: []DisplayPlanePropertiesKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceDisplayPlanePropertiesKHRResult { +pub inline fn GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice: PhysicalDevice, properties: []DisplayPlanePropertiesKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceDisplayPlanePropertiesKHRResult { var returnValues: GetPhysicalDeviceDisplayPlanePropertiesKHRResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9373,10 +9375,10 @@ pub inline fn GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice: Physica returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceDisplayPlanePropertiesCountKHR(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceDisplayPlanePropertiesCountKHR(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9390,11 +9392,11 @@ pub const GetDisplayPlaneSupportedDisplaysKHRResult = struct { result: Result, displays: []DisplayKHR, }; -pub inline fn GetDisplayPlaneSupportedDisplaysKHR(physicalDevice: PhysicalDevice, planeIndex: u32, displays: []DisplayKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetDisplayPlaneSupportedDisplaysKHRResult { +pub inline fn GetDisplayPlaneSupportedDisplaysKHR(physicalDevice: PhysicalDevice, planeIndex: u32, displays: []DisplayKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetDisplayPlaneSupportedDisplaysKHRResult { var returnValues: GetDisplayPlaneSupportedDisplaysKHRResult = undefined; - var displayCount: u32 = @intCast(u32, displays.len); + var displayCount: u32 = @as(u32, @intCast(displays.len)); const result = vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, &displayCount, displays.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9405,10 +9407,10 @@ pub inline fn GetDisplayPlaneSupportedDisplaysKHR(physicalDevice: PhysicalDevice returnValues.result = result; return returnValues; } -pub inline fn GetDisplayPlaneSupportedDisplaysCountKHR(physicalDevice: PhysicalDevice, planeIndex: u32) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetDisplayPlaneSupportedDisplaysCountKHR(physicalDevice: PhysicalDevice, planeIndex: u32) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_displayCount: u32 = undefined; const result = vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, &out_displayCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9422,11 +9424,11 @@ pub const GetDisplayModePropertiesKHRResult = struct { result: Result, properties: []DisplayModePropertiesKHR, }; -pub inline fn GetDisplayModePropertiesKHR(physicalDevice: PhysicalDevice, display: DisplayKHR, properties: []DisplayModePropertiesKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetDisplayModePropertiesKHRResult { +pub inline fn GetDisplayModePropertiesKHR(physicalDevice: PhysicalDevice, display: DisplayKHR, properties: []DisplayModePropertiesKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetDisplayModePropertiesKHRResult { var returnValues: GetDisplayModePropertiesKHRResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetDisplayModePropertiesKHR(physicalDevice, display, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9437,10 +9439,10 @@ pub inline fn GetDisplayModePropertiesKHR(physicalDevice: PhysicalDevice, displa returnValues.result = result; return returnValues; } -pub inline fn GetDisplayModePropertiesCountKHR(physicalDevice: PhysicalDevice, display: DisplayKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetDisplayModePropertiesCountKHR(physicalDevice: PhysicalDevice, display: DisplayKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetDisplayModePropertiesKHR(physicalDevice, display, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9450,10 +9452,10 @@ pub inline fn GetDisplayModePropertiesCountKHR(physicalDevice: PhysicalDevice, d return out_propertyCount; } -pub inline fn CreateDisplayModeKHR(physicalDevice: PhysicalDevice, display: DisplayKHR, createInfo: DisplayModeCreateInfoKHR, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!DisplayModeKHR { +pub inline fn CreateDisplayModeKHR(physicalDevice: PhysicalDevice, display: DisplayKHR, createInfo: DisplayModeCreateInfoKHR, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!DisplayModeKHR { var out_mode: DisplayModeKHR = undefined; const result = vkCreateDisplayModeKHR(physicalDevice, display, &createInfo, pAllocator, &out_mode); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9464,10 +9466,10 @@ pub inline fn CreateDisplayModeKHR(physicalDevice: PhysicalDevice, display: Disp return out_mode; } -pub inline fn GetDisplayPlaneCapabilitiesKHR(physicalDevice: PhysicalDevice, mode: DisplayModeKHR, planeIndex: u32) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!DisplayPlaneCapabilitiesKHR { +pub inline fn GetDisplayPlaneCapabilitiesKHR(physicalDevice: PhysicalDevice, mode: DisplayModeKHR, planeIndex: u32) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!DisplayPlaneCapabilitiesKHR { var out_capabilities: DisplayPlaneCapabilitiesKHR = undefined; const result = vkGetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, &out_capabilities); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9477,10 +9479,10 @@ pub inline fn GetDisplayPlaneCapabilitiesKHR(physicalDevice: PhysicalDevice, mod return out_capabilities; } -pub inline fn CreateDisplayPlaneSurfaceKHR(instance: Instance, createInfo: DisplaySurfaceCreateInfoKHR, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!SurfaceKHR { +pub inline fn CreateDisplayPlaneSurfaceKHR(instance: Instance, createInfo: DisplaySurfaceCreateInfoKHR, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!SurfaceKHR { var out_surface: SurfaceKHR = undefined; const result = vkCreateDisplayPlaneSurfaceKHR(instance, &createInfo, pAllocator, &out_surface); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9490,7 +9492,6 @@ pub inline fn CreateDisplayPlaneSurfaceKHR(instance: Instance, createInfo: Displ return out_surface; } - pub const KHR_display_swapchain = 1; pub const KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION = 10; pub const KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_display_swapchain"; @@ -9511,10 +9512,10 @@ pub extern fn vkCreateSharedSwapchainsKHR( pSwapchains: [*]SwapchainKHR, ) callconv(CallConv) Result; -pub inline fn CreateSharedSwapchainsKHR(device: Device, createInfos: []const SwapchainCreateInfoKHR, pAllocator: ?*const AllocationCallbacks, swapchains: []SwapchainKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INCOMPATIBLE_DISPLAY_KHR,VK_DEVICE_LOST,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CreateSharedSwapchainsKHR(device: Device, createInfos: []const SwapchainCreateInfoKHR, pAllocator: ?*const AllocationCallbacks, swapchains: []SwapchainKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INCOMPATIBLE_DISPLAY_KHR, VK_DEVICE_LOST, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!void { assert(swapchains.len >= createInfos.len); - const result = vkCreateSharedSwapchainsKHR(device, @intCast(u32, createInfos.len), createInfos.ptr, pAllocator, swapchains.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkCreateSharedSwapchainsKHR(device, @as(u32, @intCast(createInfos.len)), createInfos.ptr, pAllocator, swapchains.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9526,12 +9527,10 @@ pub inline fn CreateSharedSwapchainsKHR(device: Device, createInfos: []const Swa } } - pub const KHR_sampler_mirror_clamp_to_edge = 1; pub const KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION = 3; pub const KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME = "VK_KHR_sampler_mirror_clamp_to_edge"; - pub const KHR_multiview = 1; pub const KHR_MULTIVIEW_SPEC_VERSION = 1; pub const KHR_MULTIVIEW_EXTENSION_NAME = "VK_KHR_multiview"; @@ -9540,7 +9539,6 @@ pub const RenderPassMultiviewCreateInfoKHR = RenderPassMultiviewCreateInfo; pub const PhysicalDeviceMultiviewFeaturesKHR = PhysicalDeviceMultiviewFeatures; pub const PhysicalDeviceMultiviewPropertiesKHR = PhysicalDeviceMultiviewProperties; - pub const KHR_get_physical_device_properties2 = 1; pub const KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION = 2; pub const KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME = "VK_KHR_get_physical_device_properties2"; @@ -9613,10 +9611,10 @@ pub inline fn GetPhysicalDeviceFormatProperties2KHR(physicalDevice: PhysicalDevi return out_formatProperties; } -pub inline fn GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice: PhysicalDevice, imageFormatInfo: PhysicalDeviceImageFormatInfo2) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_FORMAT_NOT_SUPPORTED,VK_UNDOCUMENTED_ERROR}!ImageFormatProperties2 { +pub inline fn GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice: PhysicalDevice, imageFormatInfo: PhysicalDeviceImageFormatInfo2) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_FORMAT_NOT_SUPPORTED, VK_UNDOCUMENTED_ERROR }!ImageFormatProperties2 { var out_imageFormatProperties: ImageFormatProperties2 = undefined; const result = vkGetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, &imageFormatInfo, &out_imageFormatProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9629,7 +9627,7 @@ pub inline fn GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice: Physica pub inline fn GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice: PhysicalDevice, queueFamilyProperties: []QueueFamilyProperties2) []QueueFamilyProperties2 { var out_queueFamilyProperties: []QueueFamilyProperties2 = undefined; - var queueFamilyPropertyCount: u32 = @intCast(u32, queueFamilyProperties.len); + var queueFamilyPropertyCount: u32 = @as(u32, @intCast(queueFamilyProperties.len)); vkGetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, &queueFamilyPropertyCount, queueFamilyProperties.ptr); out_queueFamilyProperties = queueFamilyProperties[0..queueFamilyPropertyCount]; return out_queueFamilyProperties; @@ -9648,7 +9646,7 @@ pub inline fn GetPhysicalDeviceMemoryProperties2KHR(physicalDevice: PhysicalDevi pub inline fn GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice: PhysicalDevice, formatInfo: PhysicalDeviceSparseImageFormatInfo2, properties: []SparseImageFormatProperties2) []SparseImageFormatProperties2 { var out_properties: []SparseImageFormatProperties2 = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); vkGetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, &formatInfo, &propertyCount, properties.ptr); out_properties = properties[0..propertyCount]; return out_properties; @@ -9659,7 +9657,6 @@ pub inline fn GetPhysicalDeviceSparseImageFormatProperties2CountKHR(physicalDevi return out_propertyCount; } - pub const KHR_device_group = 1; pub const KHR_DEVICE_GROUP_SPEC_VERSION = 4; pub const KHR_DEVICE_GROUP_EXTENSION_NAME = "VK_KHR_device_group"; @@ -9707,12 +9704,10 @@ pub inline fn GetDeviceGroupPeerMemoryFeaturesKHR(device: Device, heapIndex: u32 pub const CmdSetDeviceMaskKHR = vkCmdSetDeviceMaskKHR; pub const CmdDispatchBaseKHR = vkCmdDispatchBaseKHR; - pub const KHR_shader_draw_parameters = 1; pub const KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION = 1; pub const KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME = "VK_KHR_shader_draw_parameters"; - pub const KHR_maintenance1 = 1; pub const KHR_MAINTENANCE1_SPEC_VERSION = 2; pub const KHR_MAINTENANCE1_EXTENSION_NAME = "VK_KHR_maintenance1"; @@ -9729,7 +9724,6 @@ pub inline fn TrimCommandPoolKHR(device: Device, commandPool: CommandPool, flags vkTrimCommandPoolKHR(device, commandPool, flags.toInt()); } - pub const KHR_device_group_creation = 1; pub const KHR_DEVICE_GROUP_CREATION_SPEC_VERSION = 1; pub const KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME = "VK_KHR_device_group_creation"; @@ -9748,11 +9742,11 @@ pub const EnumeratePhysicalDeviceGroupsKHRResult = struct { result: Result, physicalDeviceGroupProperties: []PhysicalDeviceGroupProperties, }; -pub inline fn EnumeratePhysicalDeviceGroupsKHR(instance: Instance, physicalDeviceGroupProperties: []PhysicalDeviceGroupProperties) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!EnumeratePhysicalDeviceGroupsKHRResult { +pub inline fn EnumeratePhysicalDeviceGroupsKHR(instance: Instance, physicalDeviceGroupProperties: []PhysicalDeviceGroupProperties) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!EnumeratePhysicalDeviceGroupsKHRResult { var returnValues: EnumeratePhysicalDeviceGroupsKHRResult = undefined; - var physicalDeviceGroupCount: u32 = @intCast(u32, physicalDeviceGroupProperties.len); + var physicalDeviceGroupCount: u32 = @as(u32, @intCast(physicalDeviceGroupProperties.len)); const result = vkEnumeratePhysicalDeviceGroupsKHR(instance, &physicalDeviceGroupCount, physicalDeviceGroupProperties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9764,10 +9758,10 @@ pub inline fn EnumeratePhysicalDeviceGroupsKHR(instance: Instance, physicalDevic returnValues.result = result; return returnValues; } -pub inline fn EnumeratePhysicalDeviceGroupsCountKHR(instance: Instance) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumeratePhysicalDeviceGroupsCountKHR(instance: Instance) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!u32 { var out_physicalDeviceGroupCount: u32 = undefined; const result = vkEnumeratePhysicalDeviceGroupsKHR(instance, &out_physicalDeviceGroupCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -9778,7 +9772,6 @@ pub inline fn EnumeratePhysicalDeviceGroupsCountKHR(instance: Instance) error{VK return out_physicalDeviceGroupCount; } - pub const KHR_external_memory_capabilities = 1; pub const KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION = 1; pub const KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME = "VK_KHR_external_memory_capabilities"; @@ -9806,7 +9799,6 @@ pub inline fn GetPhysicalDeviceExternalBufferPropertiesKHR(physicalDevice: Physi return out_externalBufferProperties; } - pub const KHR_external_memory = 1; pub const KHR_EXTERNAL_MEMORY_SPEC_VERSION = 1; pub const KHR_EXTERNAL_MEMORY_EXTENSION_NAME = "VK_KHR_external_memory"; @@ -9816,7 +9808,6 @@ pub const ExternalMemoryImageCreateInfoKHR = ExternalMemoryImageCreateInfo; pub const ExternalMemoryBufferCreateInfoKHR = ExternalMemoryBufferCreateInfo; pub const ExportMemoryAllocateInfoKHR = ExportMemoryAllocateInfo; - pub const KHR_external_memory_fd = 1; pub const KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION = 1; pub const KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME = "VK_KHR_external_memory_fd"; @@ -9854,10 +9845,10 @@ pub extern fn vkGetMemoryFdPropertiesKHR( pMemoryFdProperties: *MemoryFdPropertiesKHR, ) callconv(CallConv) Result; -pub inline fn GetMemoryFdKHR(device: Device, getFdInfo: MemoryGetFdInfoKHR) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!c_int { +pub inline fn GetMemoryFdKHR(device: Device, getFdInfo: MemoryGetFdInfoKHR) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!c_int { var out_fd: c_int = undefined; const result = vkGetMemoryFdKHR(device, &getFdInfo, &out_fd); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -9867,10 +9858,10 @@ pub inline fn GetMemoryFdKHR(device: Device, getFdInfo: MemoryGetFdInfoKHR) erro return out_fd; } -pub inline fn GetMemoryFdPropertiesKHR(device: Device, handleType: ExternalMemoryHandleTypeFlags, fd: c_int) error{VK_INVALID_EXTERNAL_HANDLE,VK_UNDOCUMENTED_ERROR}!MemoryFdPropertiesKHR { +pub inline fn GetMemoryFdPropertiesKHR(device: Device, handleType: ExternalMemoryHandleTypeFlags, fd: c_int) error{ VK_INVALID_EXTERNAL_HANDLE, VK_UNDOCUMENTED_ERROR }!MemoryFdPropertiesKHR { var out_memoryFdProperties: MemoryFdPropertiesKHR = undefined; const result = vkGetMemoryFdPropertiesKHR(device, handleType.toInt(), fd, &out_memoryFdProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_INVALID_EXTERNAL_HANDLE => error.VK_INVALID_EXTERNAL_HANDLE, else => error.VK_UNDOCUMENTED_ERROR, @@ -9879,7 +9870,6 @@ pub inline fn GetMemoryFdPropertiesKHR(device: Device, handleType: ExternalMemor return out_memoryFdProperties; } - pub const KHR_external_semaphore_capabilities = 1; pub const KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION = 1; pub const KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME = "VK_KHR_external_semaphore_capabilities"; @@ -9902,7 +9892,6 @@ pub inline fn GetPhysicalDeviceExternalSemaphorePropertiesKHR(physicalDevice: Ph return out_externalSemaphoreProperties; } - pub const KHR_external_semaphore = 1; pub const KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION = 1; pub const KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME = "VK_KHR_external_semaphore"; @@ -9911,7 +9900,6 @@ pub const SemaphoreImportFlagsKHR = SemaphoreImportFlags; pub const ExportSemaphoreCreateInfoKHR = ExportSemaphoreCreateInfo; - pub const KHR_external_semaphore_fd = 1; pub const KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION = 1; pub const KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME = "VK_KHR_external_semaphore_fd"; @@ -9943,9 +9931,9 @@ pub extern fn vkGetSemaphoreFdKHR( pFd: *c_int, ) callconv(CallConv) Result; -pub inline fn ImportSemaphoreFdKHR(device: Device, importSemaphoreFdInfo: ImportSemaphoreFdInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_INVALID_EXTERNAL_HANDLE,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn ImportSemaphoreFdKHR(device: Device, importSemaphoreFdInfo: ImportSemaphoreFdInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_INVALID_EXTERNAL_HANDLE, VK_UNDOCUMENTED_ERROR }!void { const result = vkImportSemaphoreFdKHR(device, &importSemaphoreFdInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_INVALID_EXTERNAL_HANDLE => error.VK_INVALID_EXTERNAL_HANDLE, @@ -9954,10 +9942,10 @@ pub inline fn ImportSemaphoreFdKHR(device: Device, importSemaphoreFdInfo: Import } } -pub inline fn GetSemaphoreFdKHR(device: Device, getFdInfo: SemaphoreGetFdInfoKHR) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!c_int { +pub inline fn GetSemaphoreFdKHR(device: Device, getFdInfo: SemaphoreGetFdInfoKHR) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!c_int { var out_fd: c_int = undefined; const result = vkGetSemaphoreFdKHR(device, &getFdInfo, &out_fd); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -9967,7 +9955,6 @@ pub inline fn GetSemaphoreFdKHR(device: Device, getFdInfo: SemaphoreGetFdInfoKHR return out_fd; } - pub const KHR_push_descriptor = 1; pub const KHR_PUSH_DESCRIPTOR_SPEC_VERSION = 2; pub const KHR_PUSH_DESCRIPTOR_EXTENSION_NAME = "VK_KHR_push_descriptor"; @@ -9996,12 +9983,11 @@ pub extern fn vkCmdPushDescriptorSetWithTemplateKHR( ) callconv(CallConv) void; pub inline fn CmdPushDescriptorSetKHR(commandBuffer: CommandBuffer, pipelineBindPoint: PipelineBindPoint, layout: PipelineLayout, set: u32, descriptorWrites: []const WriteDescriptorSet) void { - vkCmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, @intCast(u32, descriptorWrites.len), descriptorWrites.ptr); + vkCmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, @as(u32, @intCast(descriptorWrites.len)), descriptorWrites.ptr); } pub const CmdPushDescriptorSetWithTemplateKHR = vkCmdPushDescriptorSetWithTemplateKHR; - pub const KHR_shader_float16_int8 = 1; pub const KHR_SHADER_FLOAT16_INT8_SPEC_VERSION = 1; pub const KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME = "VK_KHR_shader_float16_int8"; @@ -10009,14 +9995,12 @@ pub const KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME = "VK_KHR_shader_float16_int8"; pub const PhysicalDeviceShaderFloat16Int8FeaturesKHR = PhysicalDeviceShaderFloat16Int8Features; pub const PhysicalDeviceFloat16Int8FeaturesKHR = PhysicalDeviceShaderFloat16Int8Features; - pub const KHR_16bit_storage = 1; pub const KHR_16BIT_STORAGE_SPEC_VERSION = 1; pub const KHR_16BIT_STORAGE_EXTENSION_NAME = "VK_KHR_16bit_storage"; pub const PhysicalDevice16BitStorageFeaturesKHR = PhysicalDevice16BitStorageFeatures; - pub const KHR_incremental_present = 1; pub const KHR_INCREMENTAL_PRESENT_SPEC_VERSION = 1; pub const KHR_INCREMENTAL_PRESENT_EXTENSION_NAME = "VK_KHR_incremental_present"; @@ -10039,7 +10023,6 @@ pub const PresentRegionsKHR = extern struct { pRegions: ?[*]const PresentRegionKHR = null, }; - pub const KHR_descriptor_update_template = 1; pub const DescriptorUpdateTemplateKHR = DescriptorUpdateTemplate; @@ -10073,10 +10056,10 @@ pub extern fn vkUpdateDescriptorSetWithTemplateKHR( pData: ?*const anyopaque, ) callconv(CallConv) void; -pub inline fn CreateDescriptorUpdateTemplateKHR(device: Device, createInfo: DescriptorUpdateTemplateCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!DescriptorUpdateTemplate { +pub inline fn CreateDescriptorUpdateTemplateKHR(device: Device, createInfo: DescriptorUpdateTemplateCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!DescriptorUpdateTemplate { var out_descriptorUpdateTemplate: DescriptorUpdateTemplate = undefined; const result = vkCreateDescriptorUpdateTemplateKHR(device, &createInfo, pAllocator, &out_descriptorUpdateTemplate); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10089,7 +10072,6 @@ pub inline fn CreateDescriptorUpdateTemplateKHR(device: Device, createInfo: Desc pub const DestroyDescriptorUpdateTemplateKHR = vkDestroyDescriptorUpdateTemplateKHR; pub const UpdateDescriptorSetWithTemplateKHR = vkUpdateDescriptorSetWithTemplateKHR; - pub const KHR_imageless_framebuffer = 1; pub const KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION = 1; pub const KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME = "VK_KHR_imageless_framebuffer"; @@ -10099,7 +10081,6 @@ pub const FramebufferAttachmentsCreateInfoKHR = FramebufferAttachmentsCreateInfo pub const FramebufferAttachmentImageInfoKHR = FramebufferAttachmentImageInfo; pub const RenderPassAttachmentBeginInfoKHR = RenderPassAttachmentBeginInfo; - pub const KHR_create_renderpass2 = 1; pub const KHR_CREATE_RENDERPASS_2_SPEC_VERSION = 1; pub const KHR_CREATE_RENDERPASS_2_EXTENSION_NAME = "VK_KHR_create_renderpass2"; @@ -10136,10 +10117,10 @@ pub extern fn vkCmdEndRenderPass2KHR( pSubpassEndInfo: *const SubpassEndInfo, ) callconv(CallConv) void; -pub inline fn CreateRenderPass2KHR(device: Device, createInfo: RenderPassCreateInfo2, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!RenderPass { +pub inline fn CreateRenderPass2KHR(device: Device, createInfo: RenderPassCreateInfo2, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!RenderPass { var out_renderPass: RenderPass = undefined; const result = vkCreateRenderPass2KHR(device, &createInfo, pAllocator, &out_renderPass); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10161,7 +10142,6 @@ pub inline fn CmdEndRenderPass2KHR(commandBuffer: CommandBuffer, subpassEndInfo: vkCmdEndRenderPass2KHR(commandBuffer, &subpassEndInfo); } - pub const KHR_shared_presentable_image = 1; pub const KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION = 1; pub const KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME = "VK_KHR_shared_presentable_image"; @@ -10177,9 +10157,9 @@ pub extern fn vkGetSwapchainStatusKHR( swapchain: SwapchainKHR, ) callconv(CallConv) Result; -pub inline fn GetSwapchainStatusKHR(device: Device, swapchain: SwapchainKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_SURFACE_LOST_KHR,VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT,VK_UNDOCUMENTED_ERROR}!Result { +pub inline fn GetSwapchainStatusKHR(device: Device, swapchain: SwapchainKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_SURFACE_LOST_KHR, VK_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT, VK_UNDOCUMENTED_ERROR }!Result { const result = vkGetSwapchainStatusKHR(device, swapchain); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10193,7 +10173,6 @@ pub inline fn GetSwapchainStatusKHR(device: Device, swapchain: SwapchainKHR) err return result; } - pub const KHR_external_fence_capabilities = 1; pub const KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION = 1; pub const KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME = "VK_KHR_external_fence_capabilities"; @@ -10216,7 +10195,6 @@ pub inline fn GetPhysicalDeviceExternalFencePropertiesKHR(physicalDevice: Physic return out_externalFenceProperties; } - pub const KHR_external_fence = 1; pub const KHR_EXTERNAL_FENCE_SPEC_VERSION = 1; pub const KHR_EXTERNAL_FENCE_EXTENSION_NAME = "VK_KHR_external_fence"; @@ -10225,7 +10203,6 @@ pub const FenceImportFlagsKHR = FenceImportFlags; pub const ExportFenceCreateInfoKHR = ExportFenceCreateInfo; - pub const KHR_external_fence_fd = 1; pub const KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1; pub const KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"; @@ -10257,9 +10234,9 @@ pub extern fn vkGetFenceFdKHR( pFd: *c_int, ) callconv(CallConv) Result; -pub inline fn ImportFenceFdKHR(device: Device, importFenceFdInfo: ImportFenceFdInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_INVALID_EXTERNAL_HANDLE,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn ImportFenceFdKHR(device: Device, importFenceFdInfo: ImportFenceFdInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_INVALID_EXTERNAL_HANDLE, VK_UNDOCUMENTED_ERROR }!void { const result = vkImportFenceFdKHR(device, &importFenceFdInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_INVALID_EXTERNAL_HANDLE => error.VK_INVALID_EXTERNAL_HANDLE, @@ -10268,10 +10245,10 @@ pub inline fn ImportFenceFdKHR(device: Device, importFenceFdInfo: ImportFenceFdI } } -pub inline fn GetFenceFdKHR(device: Device, getFdInfo: FenceGetFdInfoKHR) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!c_int { +pub inline fn GetFenceFdKHR(device: Device, getFdInfo: FenceGetFdInfoKHR) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!c_int { var out_fd: c_int = undefined; const result = vkGetFenceFdKHR(device, &getFdInfo, &out_fd); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -10281,7 +10258,6 @@ pub inline fn GetFenceFdKHR(device: Device, getFdInfo: FenceGetFdInfoKHR) error{ return out_fd; } - pub const KHR_performance_query = 1; pub const KHR_PERFORMANCE_QUERY_SPEC_VERSION = 1; pub const KHR_PERFORMANCE_QUERY_EXTENSION_NAME = "VK_KHR_performance_query"; @@ -10423,9 +10399,9 @@ pub const PerformanceCounterDescriptionKHR = extern struct { sType: StructureType = .PERFORMANCE_COUNTER_DESCRIPTION_KHR, pNext: ?*const anyopaque = null, flags: PerformanceCounterDescriptionFlagsKHR align(4) = PerformanceCounterDescriptionFlagsKHR{}, - name: [MAX_DESCRIPTION_SIZE-1:0]u8, - category: [MAX_DESCRIPTION_SIZE-1:0]u8, - description: [MAX_DESCRIPTION_SIZE-1:0]u8, + name: [MAX_DESCRIPTION_SIZE - 1:0]u8, + category: [MAX_DESCRIPTION_SIZE - 1:0]u8, + description: [MAX_DESCRIPTION_SIZE - 1:0]u8, }; pub const QueryPoolPerformanceCreateInfoKHR = extern struct { @@ -10484,12 +10460,12 @@ pub const EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHRResult = counters: []PerformanceCounterKHR, counterDescriptions: []PerformanceCounterDescriptionKHR, }; -pub inline fn EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physicalDevice: PhysicalDevice, queueFamilyIndex: u32, counters: []PerformanceCounterKHR, counterDescriptions: []PerformanceCounterDescriptionKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHRResult { +pub inline fn EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physicalDevice: PhysicalDevice, queueFamilyIndex: u32, counters: []PerformanceCounterKHR, counterDescriptions: []PerformanceCounterDescriptionKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHRResult { var returnValues: EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHRResult = undefined; - var counterCount: u32 = @intCast(u32, counters.len); + var counterCount: u32 = @as(u32, @intCast(counters.len)); assert(counterDescriptions.len >= counters.len); const result = vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physicalDevice, queueFamilyIndex, &counterCount, counters.ptr, counterDescriptions.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10502,10 +10478,10 @@ pub inline fn EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(phys returnValues.result = result; return returnValues; } -pub inline fn EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersCountKHR(physicalDevice: PhysicalDevice, queueFamilyIndex: u32) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INITIALIZATION_FAILED,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersCountKHR(physicalDevice: PhysicalDevice, queueFamilyIndex: u32) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INITIALIZATION_FAILED, VK_UNDOCUMENTED_ERROR }!u32 { var out_counterCount: u32 = undefined; const result = vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physicalDevice, queueFamilyIndex, &out_counterCount, null, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10522,9 +10498,9 @@ pub inline fn GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(physicalDevi return out_numPasses; } -pub inline fn AcquireProfilingLockKHR(device: Device, info: AcquireProfilingLockInfoKHR) error{VK_TIMEOUT,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn AcquireProfilingLockKHR(device: Device, info: AcquireProfilingLockInfoKHR) error{ VK_TIMEOUT, VK_UNDOCUMENTED_ERROR }!void { const result = vkAcquireProfilingLockKHR(device, &info); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .TIMEOUT => error.VK_TIMEOUT, else => error.VK_UNDOCUMENTED_ERROR, @@ -10534,7 +10510,6 @@ pub inline fn AcquireProfilingLockKHR(device: Device, info: AcquireProfilingLock pub const ReleaseProfilingLockKHR = vkReleaseProfilingLockKHR; - pub const KHR_maintenance2 = 1; pub const KHR_MAINTENANCE2_SPEC_VERSION = 1; pub const KHR_MAINTENANCE2_EXTENSION_NAME = "VK_KHR_maintenance2"; @@ -10548,7 +10523,6 @@ pub const InputAttachmentAspectReferenceKHR = InputAttachmentAspectReference; pub const ImageViewUsageCreateInfoKHR = ImageViewUsageCreateInfo; pub const PipelineTessellationDomainOriginStateCreateInfoKHR = PipelineTessellationDomainOriginStateCreateInfo; - pub const KHR_get_surface_capabilities2 = 1; pub const KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION = 1; pub const KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME = "VK_KHR_get_surface_capabilities2"; @@ -10584,10 +10558,10 @@ pub extern fn vkGetPhysicalDeviceSurfaceFormats2KHR( pSurfaceFormats: ?[*]SurfaceFormat2KHR, ) callconv(CallConv) Result; -pub inline fn GetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice: PhysicalDevice, surfaceInfo: PhysicalDeviceSurfaceInfo2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!SurfaceCapabilities2KHR { +pub inline fn GetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice: PhysicalDevice, surfaceInfo: PhysicalDeviceSurfaceInfo2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!SurfaceCapabilities2KHR { var out_surfaceCapabilities: SurfaceCapabilities2KHR = undefined; const result = vkGetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice, &surfaceInfo, &out_surfaceCapabilities); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10602,11 +10576,11 @@ pub const GetPhysicalDeviceSurfaceFormats2KHRResult = struct { result: Result, surfaceFormats: []SurfaceFormat2KHR, }; -pub inline fn GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice: PhysicalDevice, surfaceInfo: PhysicalDeviceSurfaceInfo2KHR, surfaceFormats: []SurfaceFormat2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceSurfaceFormats2KHRResult { +pub inline fn GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice: PhysicalDevice, surfaceInfo: PhysicalDeviceSurfaceInfo2KHR, surfaceFormats: []SurfaceFormat2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceSurfaceFormats2KHRResult { var returnValues: GetPhysicalDeviceSurfaceFormats2KHRResult = undefined; - var surfaceFormatCount: u32 = @intCast(u32, surfaceFormats.len); + var surfaceFormatCount: u32 = @as(u32, @intCast(surfaceFormats.len)); const result = vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice, &surfaceInfo, &surfaceFormatCount, surfaceFormats.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10618,10 +10592,10 @@ pub inline fn GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice: PhysicalDevice returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceSurfaceFormats2CountKHR(physicalDevice: PhysicalDevice, surfaceInfo: PhysicalDeviceSurfaceInfo2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceSurfaceFormats2CountKHR(physicalDevice: PhysicalDevice, surfaceInfo: PhysicalDeviceSurfaceInfo2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!u32 { var out_surfaceFormatCount: u32 = undefined; const result = vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice, &surfaceInfo, &out_surfaceFormatCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10632,7 +10606,6 @@ pub inline fn GetPhysicalDeviceSurfaceFormats2CountKHR(physicalDevice: PhysicalD return out_surfaceFormatCount; } - pub const KHR_variable_pointers = 1; pub const KHR_VARIABLE_POINTERS_SPEC_VERSION = 1; pub const KHR_VARIABLE_POINTERS_EXTENSION_NAME = "VK_KHR_variable_pointers"; @@ -10640,7 +10613,6 @@ pub const KHR_VARIABLE_POINTERS_EXTENSION_NAME = "VK_KHR_variable_pointers"; pub const PhysicalDeviceVariablePointerFeaturesKHR = PhysicalDeviceVariablePointersFeatures; pub const PhysicalDeviceVariablePointersFeaturesKHR = PhysicalDeviceVariablePointersFeatures; - pub const KHR_get_display_properties2 = 1; pub const KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION = 1; pub const KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME = "VK_KHR_get_display_properties2"; @@ -10705,11 +10677,11 @@ pub const GetPhysicalDeviceDisplayProperties2KHRResult = struct { result: Result, properties: []DisplayProperties2KHR, }; -pub inline fn GetPhysicalDeviceDisplayProperties2KHR(physicalDevice: PhysicalDevice, properties: []DisplayProperties2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceDisplayProperties2KHRResult { +pub inline fn GetPhysicalDeviceDisplayProperties2KHR(physicalDevice: PhysicalDevice, properties: []DisplayProperties2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceDisplayProperties2KHRResult { var returnValues: GetPhysicalDeviceDisplayProperties2KHRResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetPhysicalDeviceDisplayProperties2KHR(physicalDevice, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10720,10 +10692,10 @@ pub inline fn GetPhysicalDeviceDisplayProperties2KHR(physicalDevice: PhysicalDev returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceDisplayProperties2CountKHR(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceDisplayProperties2CountKHR(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetPhysicalDeviceDisplayProperties2KHR(physicalDevice, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10737,11 +10709,11 @@ pub const GetPhysicalDeviceDisplayPlaneProperties2KHRResult = struct { result: Result, properties: []DisplayPlaneProperties2KHR, }; -pub inline fn GetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice: PhysicalDevice, properties: []DisplayPlaneProperties2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceDisplayPlaneProperties2KHRResult { +pub inline fn GetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice: PhysicalDevice, properties: []DisplayPlaneProperties2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceDisplayPlaneProperties2KHRResult { var returnValues: GetPhysicalDeviceDisplayPlaneProperties2KHRResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10752,10 +10724,10 @@ pub inline fn GetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice: Physic returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceDisplayPlaneProperties2CountKHR(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceDisplayPlaneProperties2CountKHR(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10769,11 +10741,11 @@ pub const GetDisplayModeProperties2KHRResult = struct { result: Result, properties: []DisplayModeProperties2KHR, }; -pub inline fn GetDisplayModeProperties2KHR(physicalDevice: PhysicalDevice, display: DisplayKHR, properties: []DisplayModeProperties2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetDisplayModeProperties2KHRResult { +pub inline fn GetDisplayModeProperties2KHR(physicalDevice: PhysicalDevice, display: DisplayKHR, properties: []DisplayModeProperties2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetDisplayModeProperties2KHRResult { var returnValues: GetDisplayModeProperties2KHRResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetDisplayModeProperties2KHR(physicalDevice, display, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10784,10 +10756,10 @@ pub inline fn GetDisplayModeProperties2KHR(physicalDevice: PhysicalDevice, displ returnValues.result = result; return returnValues; } -pub inline fn GetDisplayModeProperties2CountKHR(physicalDevice: PhysicalDevice, display: DisplayKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetDisplayModeProperties2CountKHR(physicalDevice: PhysicalDevice, display: DisplayKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetDisplayModeProperties2KHR(physicalDevice, display, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10797,10 +10769,10 @@ pub inline fn GetDisplayModeProperties2CountKHR(physicalDevice: PhysicalDevice, return out_propertyCount; } -pub inline fn GetDisplayPlaneCapabilities2KHR(physicalDevice: PhysicalDevice, displayPlaneInfo: DisplayPlaneInfo2KHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!DisplayPlaneCapabilities2KHR { +pub inline fn GetDisplayPlaneCapabilities2KHR(physicalDevice: PhysicalDevice, displayPlaneInfo: DisplayPlaneInfo2KHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!DisplayPlaneCapabilities2KHR { var out_capabilities: DisplayPlaneCapabilities2KHR = undefined; const result = vkGetDisplayPlaneCapabilities2KHR(physicalDevice, &displayPlaneInfo, &out_capabilities); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10810,7 +10782,6 @@ pub inline fn GetDisplayPlaneCapabilities2KHR(physicalDevice: PhysicalDevice, di return out_capabilities; } - pub const KHR_dedicated_allocation = 1; pub const KHR_DEDICATED_ALLOCATION_SPEC_VERSION = 3; pub const KHR_DEDICATED_ALLOCATION_EXTENSION_NAME = "VK_KHR_dedicated_allocation"; @@ -10818,17 +10789,14 @@ pub const KHR_DEDICATED_ALLOCATION_EXTENSION_NAME = "VK_KHR_dedicated_allocation pub const MemoryDedicatedRequirementsKHR = MemoryDedicatedRequirements; pub const MemoryDedicatedAllocateInfoKHR = MemoryDedicatedAllocateInfo; - pub const KHR_storage_buffer_storage_class = 1; pub const KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION = 1; pub const KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME = "VK_KHR_storage_buffer_storage_class"; - pub const KHR_relaxed_block_layout = 1; pub const KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION = 1; pub const KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME = "VK_KHR_relaxed_block_layout"; - pub const KHR_get_memory_requirements2 = 1; pub const KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION = 1; pub const KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME = "VK_KHR_get_memory_requirements2"; @@ -10871,7 +10839,7 @@ pub inline fn GetBufferMemoryRequirements2KHR(device: Device, info: BufferMemory pub inline fn GetImageSparseMemoryRequirements2KHR(device: Device, info: ImageSparseMemoryRequirementsInfo2, sparseMemoryRequirements: []SparseImageMemoryRequirements2) []SparseImageMemoryRequirements2 { var out_sparseMemoryRequirements: []SparseImageMemoryRequirements2 = undefined; - var sparseMemoryRequirementCount: u32 = @intCast(u32, sparseMemoryRequirements.len); + var sparseMemoryRequirementCount: u32 = @as(u32, @intCast(sparseMemoryRequirements.len)); vkGetImageSparseMemoryRequirements2KHR(device, &info, &sparseMemoryRequirementCount, sparseMemoryRequirements.ptr); out_sparseMemoryRequirements = sparseMemoryRequirements[0..sparseMemoryRequirementCount]; return out_sparseMemoryRequirements; @@ -10882,14 +10850,12 @@ pub inline fn GetImageSparseMemoryRequirements2CountKHR(device: Device, info: Im return out_sparseMemoryRequirementCount; } - pub const KHR_image_format_list = 1; pub const KHR_IMAGE_FORMAT_LIST_SPEC_VERSION = 1; pub const KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME = "VK_KHR_image_format_list"; pub const ImageFormatListCreateInfoKHR = ImageFormatListCreateInfo; - pub const KHR_sampler_ycbcr_conversion = 1; pub const SamplerYcbcrConversionKHR = SamplerYcbcrConversion; @@ -10920,10 +10886,10 @@ pub extern fn vkDestroySamplerYcbcrConversionKHR( pAllocator: ?*const AllocationCallbacks, ) callconv(CallConv) void; -pub inline fn CreateSamplerYcbcrConversionKHR(device: Device, createInfo: SamplerYcbcrConversionCreateInfo, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!SamplerYcbcrConversion { +pub inline fn CreateSamplerYcbcrConversionKHR(device: Device, createInfo: SamplerYcbcrConversionCreateInfo, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!SamplerYcbcrConversion { var out_ycbcrConversion: SamplerYcbcrConversion = undefined; const result = vkCreateSamplerYcbcrConversionKHR(device, &createInfo, pAllocator, &out_ycbcrConversion); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10935,7 +10901,6 @@ pub inline fn CreateSamplerYcbcrConversionKHR(device: Device, createInfo: Sample pub const DestroySamplerYcbcrConversionKHR = vkDestroySamplerYcbcrConversionKHR; - pub const KHR_bind_memory2 = 1; pub const KHR_BIND_MEMORY_2_SPEC_VERSION = 1; pub const KHR_BIND_MEMORY_2_EXTENSION_NAME = "VK_KHR_bind_memory2"; @@ -10955,9 +10920,9 @@ pub extern fn vkBindImageMemory2KHR( pBindInfos: [*]const BindImageMemoryInfo, ) callconv(CallConv) Result; -pub inline fn BindBufferMemory2KHR(device: Device, bindInfos: []const BindBufferMemoryInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_OPAQUE_CAPTURE_ADDRESS,VK_UNDOCUMENTED_ERROR}!void { - const result = vkBindBufferMemory2KHR(device, @intCast(u32, bindInfos.len), bindInfos.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn BindBufferMemory2KHR(device: Device, bindInfos: []const BindBufferMemoryInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_UNDOCUMENTED_ERROR }!void { + const result = vkBindBufferMemory2KHR(device, @as(u32, @intCast(bindInfos.len)), bindInfos.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10967,9 +10932,9 @@ pub inline fn BindBufferMemory2KHR(device: Device, bindInfos: []const BindBuffer } } -pub inline fn BindImageMemory2KHR(device: Device, bindInfos: []const BindImageMemoryInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkBindImageMemory2KHR(device, @intCast(u32, bindInfos.len), bindInfos.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn BindImageMemory2KHR(device: Device, bindInfos: []const BindImageMemoryInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkBindImageMemory2KHR(device, @as(u32, @intCast(bindInfos.len)), bindInfos.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -10978,7 +10943,6 @@ pub inline fn BindImageMemory2KHR(device: Device, bindInfos: []const BindImageMe } } - pub const KHR_maintenance3 = 1; pub const KHR_MAINTENANCE3_SPEC_VERSION = 1; pub const KHR_MAINTENANCE3_EXTENSION_NAME = "VK_KHR_maintenance3"; @@ -10998,7 +10962,6 @@ pub inline fn GetDescriptorSetLayoutSupportKHR(device: Device, createInfo: Descr return out_support; } - pub const KHR_draw_indirect_count = 1; pub const KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION = 1; pub const KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME = "VK_KHR_draw_indirect_count"; @@ -11026,28 +10989,24 @@ pub extern fn vkCmdDrawIndexedIndirectCountKHR( pub const CmdDrawIndirectCountKHR = vkCmdDrawIndirectCountKHR; pub const CmdDrawIndexedIndirectCountKHR = vkCmdDrawIndexedIndirectCountKHR; - pub const KHR_shader_subgroup_extended_types = 1; pub const KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION = 1; pub const KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME = "VK_KHR_shader_subgroup_extended_types"; pub const PhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR = PhysicalDeviceShaderSubgroupExtendedTypesFeatures; - pub const KHR_8bit_storage = 1; pub const KHR_8BIT_STORAGE_SPEC_VERSION = 1; pub const KHR_8BIT_STORAGE_EXTENSION_NAME = "VK_KHR_8bit_storage"; pub const PhysicalDevice8BitStorageFeaturesKHR = PhysicalDevice8BitStorageFeatures; - pub const KHR_shader_atomic_int64 = 1; pub const KHR_SHADER_ATOMIC_INT64_SPEC_VERSION = 1; pub const KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME = "VK_KHR_shader_atomic_int64"; pub const PhysicalDeviceShaderAtomicInt64FeaturesKHR = PhysicalDeviceShaderAtomicInt64Features; - pub const KHR_shader_clock = 1; pub const KHR_SHADER_CLOCK_SPEC_VERSION = 1; pub const KHR_SHADER_CLOCK_EXTENSION_NAME = "VK_KHR_shader_clock"; @@ -11059,7 +11018,6 @@ pub const PhysicalDeviceShaderClockFeaturesKHR = extern struct { shaderDeviceClock: Bool32, }; - pub const KHR_driver_properties = 1; pub const KHR_DRIVER_PROPERTIES_SPEC_VERSION = 1; pub const KHR_DRIVER_PROPERTIES_EXTENSION_NAME = "VK_KHR_driver_properties"; @@ -11071,7 +11029,6 @@ pub const DriverIdKHR = DriverId; pub const ConformanceVersionKHR = ConformanceVersion; pub const PhysicalDeviceDriverPropertiesKHR = PhysicalDeviceDriverProperties; - pub const KHR_shader_float_controls = 1; pub const KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION = 4; pub const KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME = "VK_KHR_shader_float_controls"; @@ -11080,7 +11037,6 @@ pub const ShaderFloatControlsIndependenceKHR = ShaderFloatControlsIndependence; pub const PhysicalDeviceFloatControlsPropertiesKHR = PhysicalDeviceFloatControlsProperties; - pub const KHR_depth_stencil_resolve = 1; pub const KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION = 1; pub const KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME = "VK_KHR_depth_stencil_resolve"; @@ -11090,12 +11046,10 @@ pub const ResolveModeFlagsKHR = ResolveModeFlags; pub const SubpassDescriptionDepthStencilResolveKHR = SubpassDescriptionDepthStencilResolve; pub const PhysicalDeviceDepthStencilResolvePropertiesKHR = PhysicalDeviceDepthStencilResolveProperties; - pub const KHR_swapchain_mutable_format = 1; pub const KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION = 1; pub const KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME = "VK_KHR_swapchain_mutable_format"; - pub const KHR_timeline_semaphore = 1; pub const KHR_TIMELINE_SEMAPHORE_SPEC_VERSION = 2; pub const KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME = "VK_KHR_timeline_semaphore"; @@ -11128,10 +11082,10 @@ pub extern fn vkSignalSemaphoreKHR( pSignalInfo: *const SemaphoreSignalInfo, ) callconv(CallConv) Result; -pub inline fn GetSemaphoreCounterValueKHR(device: Device, semaphore: Semaphore) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!u64 { +pub inline fn GetSemaphoreCounterValueKHR(device: Device, semaphore: Semaphore) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!u64 { var out_value: u64 = undefined; const result = vkGetSemaphoreCounterValueKHR(device, semaphore, &out_value); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11142,9 +11096,9 @@ pub inline fn GetSemaphoreCounterValueKHR(device: Device, semaphore: Semaphore) return out_value; } -pub inline fn WaitSemaphoresKHR(device: Device, waitInfo: SemaphoreWaitInfo, timeout: u64) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_DEVICE_LOST,VK_UNDOCUMENTED_ERROR}!Result { +pub inline fn WaitSemaphoresKHR(device: Device, waitInfo: SemaphoreWaitInfo, timeout: u64) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_DEVICE_LOST, VK_UNDOCUMENTED_ERROR }!Result { const result = vkWaitSemaphoresKHR(device, &waitInfo, timeout); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11155,9 +11109,9 @@ pub inline fn WaitSemaphoresKHR(device: Device, waitInfo: SemaphoreWaitInfo, tim return result; } -pub inline fn SignalSemaphoreKHR(device: Device, signalInfo: SemaphoreSignalInfo) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn SignalSemaphoreKHR(device: Device, signalInfo: SemaphoreSignalInfo) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkSignalSemaphoreKHR(device, &signalInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11166,19 +11120,16 @@ pub inline fn SignalSemaphoreKHR(device: Device, signalInfo: SemaphoreSignalInfo } } - pub const KHR_vulkan_memory_model = 1; pub const KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION = 3; pub const KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME = "VK_KHR_vulkan_memory_model"; pub const PhysicalDeviceVulkanMemoryModelFeaturesKHR = PhysicalDeviceVulkanMemoryModelFeatures; - pub const KHR_spirv_1_4 = 1; pub const KHR_SPIRV_1_4_SPEC_VERSION = 1; pub const KHR_SPIRV_1_4_EXTENSION_NAME = "VK_KHR_spirv_1_4"; - pub const KHR_surface_protected_capabilities = 1; pub const KHR_SURFACE_PROTECTED_CAPABILITIES_SPEC_VERSION = 1; pub const KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME = "VK_KHR_surface_protected_capabilities"; @@ -11189,7 +11140,6 @@ pub const SurfaceProtectedCapabilitiesKHR = extern struct { supportsProtected: Bool32, }; - pub const KHR_separate_depth_stencil_layouts = 1; pub const KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION = 1; pub const KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME = "VK_KHR_separate_depth_stencil_layouts"; @@ -11198,14 +11148,12 @@ pub const PhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR = PhysicalDeviceS pub const AttachmentReferenceStencilLayoutKHR = AttachmentReferenceStencilLayout; pub const AttachmentDescriptionStencilLayoutKHR = AttachmentDescriptionStencilLayout; - pub const KHR_uniform_buffer_standard_layout = 1; pub const KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION = 1; pub const KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME = "VK_KHR_uniform_buffer_standard_layout"; pub const PhysicalDeviceUniformBufferStandardLayoutFeaturesKHR = PhysicalDeviceUniformBufferStandardLayoutFeatures; - pub const KHR_buffer_device_address = 1; pub const KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION = 1; pub const KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME = "VK_KHR_buffer_device_address"; @@ -11246,7 +11194,6 @@ pub inline fn GetDeviceMemoryOpaqueCaptureAddressKHR(device: Device, info: Devic return result; } - pub const KHR_pipeline_executable_properties = 1; pub const KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION = 1; pub const KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME = "VK_KHR_pipeline_executable_properties"; @@ -11275,8 +11222,8 @@ pub const PipelineExecutablePropertiesKHR = extern struct { sType: StructureType = .PIPELINE_EXECUTABLE_PROPERTIES_KHR, pNext: ?*anyopaque = null, stages: ShaderStageFlags align(4), - name: [MAX_DESCRIPTION_SIZE-1:0]u8, - description: [MAX_DESCRIPTION_SIZE-1:0]u8, + name: [MAX_DESCRIPTION_SIZE - 1:0]u8, + description: [MAX_DESCRIPTION_SIZE - 1:0]u8, subgroupSize: u32, }; @@ -11297,8 +11244,8 @@ pub const PipelineExecutableStatisticValueKHR = extern union { pub const PipelineExecutableStatisticKHR = extern struct { sType: StructureType = .PIPELINE_EXECUTABLE_STATISTIC_KHR, pNext: ?*anyopaque = null, - name: [MAX_DESCRIPTION_SIZE-1:0]u8, - description: [MAX_DESCRIPTION_SIZE-1:0]u8, + name: [MAX_DESCRIPTION_SIZE - 1:0]u8, + description: [MAX_DESCRIPTION_SIZE - 1:0]u8, format: PipelineExecutableStatisticFormatKHR, value: PipelineExecutableStatisticValueKHR, }; @@ -11306,8 +11253,8 @@ pub const PipelineExecutableStatisticKHR = extern struct { pub const PipelineExecutableInternalRepresentationKHR = extern struct { sType: StructureType = .PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR, pNext: ?*anyopaque = null, - name: [MAX_DESCRIPTION_SIZE-1:0]u8, - description: [MAX_DESCRIPTION_SIZE-1:0]u8, + name: [MAX_DESCRIPTION_SIZE - 1:0]u8, + description: [MAX_DESCRIPTION_SIZE - 1:0]u8, isText: Bool32, dataSize: usize = 0, pData: ?*anyopaque = null, @@ -11338,11 +11285,11 @@ pub const GetPipelineExecutablePropertiesKHRResult = struct { result: Result, properties: []PipelineExecutablePropertiesKHR, }; -pub inline fn GetPipelineExecutablePropertiesKHR(device: Device, pipelineInfo: PipelineInfoKHR, properties: []PipelineExecutablePropertiesKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPipelineExecutablePropertiesKHRResult { +pub inline fn GetPipelineExecutablePropertiesKHR(device: Device, pipelineInfo: PipelineInfoKHR, properties: []PipelineExecutablePropertiesKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPipelineExecutablePropertiesKHRResult { var returnValues: GetPipelineExecutablePropertiesKHRResult = undefined; - var executableCount: u32 = @intCast(u32, properties.len); + var executableCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetPipelineExecutablePropertiesKHR(device, &pipelineInfo, &executableCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11353,10 +11300,10 @@ pub inline fn GetPipelineExecutablePropertiesKHR(device: Device, pipelineInfo: P returnValues.result = result; return returnValues; } -pub inline fn GetPipelineExecutablePropertiesCountKHR(device: Device, pipelineInfo: PipelineInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPipelineExecutablePropertiesCountKHR(device: Device, pipelineInfo: PipelineInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_executableCount: u32 = undefined; const result = vkGetPipelineExecutablePropertiesKHR(device, &pipelineInfo, &out_executableCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11370,11 +11317,11 @@ pub const GetPipelineExecutableStatisticsKHRResult = struct { result: Result, statistics: []PipelineExecutableStatisticKHR, }; -pub inline fn GetPipelineExecutableStatisticsKHR(device: Device, executableInfo: PipelineExecutableInfoKHR, statistics: []PipelineExecutableStatisticKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPipelineExecutableStatisticsKHRResult { +pub inline fn GetPipelineExecutableStatisticsKHR(device: Device, executableInfo: PipelineExecutableInfoKHR, statistics: []PipelineExecutableStatisticKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPipelineExecutableStatisticsKHRResult { var returnValues: GetPipelineExecutableStatisticsKHRResult = undefined; - var statisticCount: u32 = @intCast(u32, statistics.len); + var statisticCount: u32 = @as(u32, @intCast(statistics.len)); const result = vkGetPipelineExecutableStatisticsKHR(device, &executableInfo, &statisticCount, statistics.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11385,10 +11332,10 @@ pub inline fn GetPipelineExecutableStatisticsKHR(device: Device, executableInfo: returnValues.result = result; return returnValues; } -pub inline fn GetPipelineExecutableStatisticsCountKHR(device: Device, executableInfo: PipelineExecutableInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPipelineExecutableStatisticsCountKHR(device: Device, executableInfo: PipelineExecutableInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_statisticCount: u32 = undefined; const result = vkGetPipelineExecutableStatisticsKHR(device, &executableInfo, &out_statisticCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11402,11 +11349,11 @@ pub const GetPipelineExecutableInternalRepresentationsKHRResult = struct { result: Result, internalRepresentations: []PipelineExecutableInternalRepresentationKHR, }; -pub inline fn GetPipelineExecutableInternalRepresentationsKHR(device: Device, executableInfo: PipelineExecutableInfoKHR, internalRepresentations: []PipelineExecutableInternalRepresentationKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPipelineExecutableInternalRepresentationsKHRResult { +pub inline fn GetPipelineExecutableInternalRepresentationsKHR(device: Device, executableInfo: PipelineExecutableInfoKHR, internalRepresentations: []PipelineExecutableInternalRepresentationKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPipelineExecutableInternalRepresentationsKHRResult { var returnValues: GetPipelineExecutableInternalRepresentationsKHRResult = undefined; - var internalRepresentationCount: u32 = @intCast(u32, internalRepresentations.len); + var internalRepresentationCount: u32 = @as(u32, @intCast(internalRepresentations.len)); const result = vkGetPipelineExecutableInternalRepresentationsKHR(device, &executableInfo, &internalRepresentationCount, internalRepresentations.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11417,10 +11364,10 @@ pub inline fn GetPipelineExecutableInternalRepresentationsKHR(device: Device, ex returnValues.result = result; return returnValues; } -pub inline fn GetPipelineExecutableInternalRepresentationsCountKHR(device: Device, executableInfo: PipelineExecutableInfoKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPipelineExecutableInternalRepresentationsCountKHR(device: Device, executableInfo: PipelineExecutableInfoKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_internalRepresentationCount: u32 = undefined; const result = vkGetPipelineExecutableInternalRepresentationsKHR(device, &executableInfo, &out_internalRepresentationCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11430,7 +11377,6 @@ pub inline fn GetPipelineExecutableInternalRepresentationsCountKHR(device: Devic return out_internalRepresentationCount; } - pub const EXT_debug_report = 1; pub const DebugReportCallbackEXT = enum(u64) { Null = 0, _ }; @@ -11521,7 +11467,7 @@ pub const DebugReportFlagsEXT = packed struct { pub usingnamespace FlagsMixin(@This()); }; -pub const PFN_DebugReportCallbackEXT = fn ( +pub const PFN_DebugReportCallbackEXT = *const fn ( DebugReportFlagsEXT.IntType, DebugReportObjectTypeEXT, u64, @@ -11564,10 +11510,10 @@ pub extern fn vkDebugReportMessageEXT( pMessage: CString, ) callconv(CallConv) void; -pub inline fn CreateDebugReportCallbackEXT(instance: Instance, createInfo: DebugReportCallbackCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!DebugReportCallbackEXT { +pub inline fn CreateDebugReportCallbackEXT(instance: Instance, createInfo: DebugReportCallbackCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!DebugReportCallbackEXT { var out_callback: DebugReportCallbackEXT = undefined; const result = vkCreateDebugReportCallbackEXT(instance, &createInfo, pAllocator, &out_callback); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, else => error.VK_UNDOCUMENTED_ERROR, @@ -11582,22 +11528,18 @@ pub inline fn DebugReportMessageEXT(instance: Instance, flags: DebugReportFlagsE vkDebugReportMessageEXT(instance, flags.toInt(), objectType, object, location, messageCode, pLayerPrefix, pMessage); } - pub const NV_glsl_shader = 1; pub const NV_GLSL_SHADER_SPEC_VERSION = 1; pub const NV_GLSL_SHADER_EXTENSION_NAME = "VK_NV_glsl_shader"; - pub const EXT_depth_range_unrestricted = 1; pub const EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION = 1; pub const EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME = "VK_EXT_depth_range_unrestricted"; - pub const IMG_filter_cubic = 1; pub const IMG_FILTER_CUBIC_SPEC_VERSION = 1; pub const IMG_FILTER_CUBIC_EXTENSION_NAME = "VK_IMG_filter_cubic"; - pub const AMD_rasterization_order = 1; pub const AMD_RASTERIZATION_ORDER_SPEC_VERSION = 1; pub const AMD_RASTERIZATION_ORDER_EXTENSION_NAME = "VK_AMD_rasterization_order"; @@ -11614,17 +11556,14 @@ pub const PipelineRasterizationStateRasterizationOrderAMD = extern struct { rasterizationOrder: RasterizationOrderAMD, }; - pub const AMD_shader_trinary_minmax = 1; pub const AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION = 1; pub const AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME = "VK_AMD_shader_trinary_minmax"; - pub const AMD_shader_explicit_vertex_parameter = 1; pub const AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION = 1; pub const AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME = "VK_AMD_shader_explicit_vertex_parameter"; - pub const EXT_debug_marker = 1; pub const EXT_DEBUG_MARKER_SPEC_VERSION = 4; pub const EXT_DEBUG_MARKER_EXTENSION_NAME = "VK_EXT_debug_marker"; @@ -11676,9 +11615,9 @@ pub extern fn vkCmdDebugMarkerInsertEXT( pMarkerInfo: *const DebugMarkerMarkerInfoEXT, ) callconv(CallConv) void; -pub inline fn DebugMarkerSetObjectTagEXT(device: Device, tagInfo: DebugMarkerObjectTagInfoEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn DebugMarkerSetObjectTagEXT(device: Device, tagInfo: DebugMarkerObjectTagInfoEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkDebugMarkerSetObjectTagEXT(device, &tagInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11687,9 +11626,9 @@ pub inline fn DebugMarkerSetObjectTagEXT(device: Device, tagInfo: DebugMarkerObj } } -pub inline fn DebugMarkerSetObjectNameEXT(device: Device, nameInfo: DebugMarkerObjectNameInfoEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn DebugMarkerSetObjectNameEXT(device: Device, nameInfo: DebugMarkerObjectNameInfoEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkDebugMarkerSetObjectNameEXT(device, &nameInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -11708,12 +11647,10 @@ pub inline fn CmdDebugMarkerInsertEXT(commandBuffer: CommandBuffer, markerInfo: vkCmdDebugMarkerInsertEXT(commandBuffer, &markerInfo); } - pub const AMD_gcn_shader = 1; pub const AMD_GCN_SHADER_SPEC_VERSION = 1; pub const AMD_GCN_SHADER_EXTENSION_NAME = "VK_AMD_gcn_shader"; - pub const NV_dedicated_allocation = 1; pub const NV_DEDICATED_ALLOCATION_SPEC_VERSION = 1; pub const NV_DEDICATED_ALLOCATION_EXTENSION_NAME = "VK_NV_dedicated_allocation"; @@ -11737,7 +11674,6 @@ pub const DedicatedAllocationMemoryAllocateInfoNV = extern struct { buffer: Buffer = Buffer.Null, }; - pub const EXT_transform_feedback = 1; pub const EXT_TRANSFORM_FEEDBACK_SPEC_VERSION = 1; pub const EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME = "VK_EXT_transform_feedback"; @@ -11829,17 +11765,17 @@ pub extern fn vkCmdDrawIndirectByteCountEXT( pub inline fn CmdBindTransformFeedbackBuffersEXT(commandBuffer: CommandBuffer, firstBinding: u32, buffers: []const Buffer, offsets: []const DeviceSize, sizes: []const DeviceSize) void { assert(offsets.len >= buffers.len); assert(sizes.len >= buffers.len); - vkCmdBindTransformFeedbackBuffersEXT(commandBuffer, firstBinding, @intCast(u32, buffers.len), buffers.ptr, offsets.ptr, sizes.ptr); + vkCmdBindTransformFeedbackBuffersEXT(commandBuffer, firstBinding, @as(u32, @intCast(buffers.len)), buffers.ptr, offsets.ptr, sizes.ptr); } pub inline fn CmdBeginTransformFeedbackEXT(commandBuffer: CommandBuffer, firstCounterBuffer: u32, counterBuffers: []const Buffer, counterBufferOffsets: []const DeviceSize) void { assert(counterBufferOffsets.len >= counterBuffers.len); - vkCmdBeginTransformFeedbackEXT(commandBuffer, firstCounterBuffer, @intCast(u32, counterBuffers.len), counterBuffers.ptr, counterBufferOffsets.ptr); + vkCmdBeginTransformFeedbackEXT(commandBuffer, firstCounterBuffer, @as(u32, @intCast(counterBuffers.len)), counterBuffers.ptr, counterBufferOffsets.ptr); } pub inline fn CmdEndTransformFeedbackEXT(commandBuffer: CommandBuffer, firstCounterBuffer: u32, counterBuffers: []const Buffer, counterBufferOffsets: []const DeviceSize) void { assert(counterBufferOffsets.len >= counterBuffers.len); - vkCmdEndTransformFeedbackEXT(commandBuffer, firstCounterBuffer, @intCast(u32, counterBuffers.len), counterBuffers.ptr, counterBufferOffsets.ptr); + vkCmdEndTransformFeedbackEXT(commandBuffer, firstCounterBuffer, @as(u32, @intCast(counterBuffers.len)), counterBuffers.ptr, counterBufferOffsets.ptr); } pub inline fn CmdBeginQueryIndexedEXT(commandBuffer: CommandBuffer, queryPool: QueryPool, query: u32, flags: QueryControlFlags, index: u32) void { @@ -11849,7 +11785,6 @@ pub inline fn CmdBeginQueryIndexedEXT(commandBuffer: CommandBuffer, queryPool: Q pub const CmdEndQueryIndexedEXT = vkCmdEndQueryIndexedEXT; pub const CmdDrawIndirectByteCountEXT = vkCmdDrawIndirectByteCountEXT; - pub const NVX_image_view_handle = 1; pub const NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION = 1; pub const NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME = "VK_NVX_image_view_handle"; @@ -11872,7 +11807,6 @@ pub inline fn GetImageViewHandleNVX(device: Device, info: ImageViewHandleInfoNVX return result; } - pub const AMD_draw_indirect_count = 1; pub const AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION = 2; pub const AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME = "VK_AMD_draw_indirect_count"; @@ -11900,22 +11834,18 @@ pub extern fn vkCmdDrawIndexedIndirectCountAMD( pub const CmdDrawIndirectCountAMD = vkCmdDrawIndirectCountAMD; pub const CmdDrawIndexedIndirectCountAMD = vkCmdDrawIndexedIndirectCountAMD; - pub const AMD_negative_viewport_height = 1; pub const AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION = 1; pub const AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME = "VK_AMD_negative_viewport_height"; - pub const AMD_gpu_shader_half_float = 1; pub const AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION = 2; pub const AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME = "VK_AMD_gpu_shader_half_float"; - pub const AMD_shader_ballot = 1; pub const AMD_SHADER_BALLOT_SPEC_VERSION = 1; pub const AMD_SHADER_BALLOT_EXTENSION_NAME = "VK_AMD_shader_ballot"; - pub const AMD_texture_gather_bias_lod = 1; pub const AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION = 1; pub const AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME = "VK_AMD_texture_gather_bias_lod"; @@ -11926,7 +11856,6 @@ pub const TextureLODGatherFormatPropertiesAMD = extern struct { supportsTextureGatherLODBiasAMD: Bool32, }; - pub const AMD_shader_info = 1; pub const AMD_SHADER_INFO_SPEC_VERSION = 1; pub const AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info"; @@ -11969,11 +11898,11 @@ pub const GetShaderInfoAMDResult = struct { result: Result, info: []u8, }; -pub inline fn GetShaderInfoAMD(device: Device, pipeline: Pipeline, shaderStage: ShaderStageFlags, infoType: ShaderInfoTypeAMD, info: []u8) error{VK_FEATURE_NOT_PRESENT,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!GetShaderInfoAMDResult { +pub inline fn GetShaderInfoAMD(device: Device, pipeline: Pipeline, shaderStage: ShaderStageFlags, infoType: ShaderInfoTypeAMD, info: []u8) error{ VK_FEATURE_NOT_PRESENT, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!GetShaderInfoAMDResult { var returnValues: GetShaderInfoAMDResult = undefined; - var infoSize: usize = @intCast(usize, info.len); + var infoSize: usize = @as(usize, @intCast(info.len)); const result = vkGetShaderInfoAMD(device, pipeline, shaderStage.toInt(), infoType, &infoSize, info.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_FEATURE_NOT_PRESENT => error.VK_FEATURE_NOT_PRESENT, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -11984,10 +11913,10 @@ pub inline fn GetShaderInfoAMD(device: Device, pipeline: Pipeline, shaderStage: returnValues.result = result; return returnValues; } -pub inline fn GetShaderInfoCountAMD(device: Device, pipeline: Pipeline, shaderStage: ShaderStageFlags, infoType: ShaderInfoTypeAMD) error{VK_FEATURE_NOT_PRESENT,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!usize { +pub inline fn GetShaderInfoCountAMD(device: Device, pipeline: Pipeline, shaderStage: ShaderStageFlags, infoType: ShaderInfoTypeAMD) error{ VK_FEATURE_NOT_PRESENT, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!usize { var out_infoSize: usize = undefined; const result = vkGetShaderInfoAMD(device, pipeline, shaderStage.toInt(), infoType, &out_infoSize, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_FEATURE_NOT_PRESENT => error.VK_FEATURE_NOT_PRESENT, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -11997,12 +11926,10 @@ pub inline fn GetShaderInfoCountAMD(device: Device, pipeline: Pipeline, shaderSt return out_infoSize; } - pub const AMD_shader_image_load_store_lod = 1; pub const AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION = 1; pub const AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME = "VK_AMD_shader_image_load_store_lod"; - pub const NV_corner_sampled_image = 1; pub const NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION = 2; pub const NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME = "VK_NV_corner_sampled_image"; @@ -12013,12 +11940,10 @@ pub const PhysicalDeviceCornerSampledImageFeaturesNV = extern struct { cornerSampledImage: Bool32, }; - pub const IMG_format_pvrtc = 1; pub const IMG_FORMAT_PVRTC_SPEC_VERSION = 1; pub const IMG_FORMAT_PVRTC_EXTENSION_NAME = "VK_IMG_format_pvrtc"; - pub const NV_external_memory_capabilities = 1; pub const NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION = 1; pub const NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME = "VK_NV_external_memory_capabilities"; @@ -12115,10 +12040,10 @@ pub extern fn vkGetPhysicalDeviceExternalImageFormatPropertiesNV( pExternalImageFormatProperties: *ExternalImageFormatPropertiesNV, ) callconv(CallConv) Result; -pub inline fn GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice: PhysicalDevice, format: Format, inType: ImageType, tiling: ImageTiling, usage: ImageUsageFlags, flags: ImageCreateFlags, externalHandleType: ExternalMemoryHandleTypeFlagsNV) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_FORMAT_NOT_SUPPORTED,VK_UNDOCUMENTED_ERROR}!ExternalImageFormatPropertiesNV { +pub inline fn GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice: PhysicalDevice, format: Format, inType: ImageType, tiling: ImageTiling, usage: ImageUsageFlags, flags: ImageCreateFlags, externalHandleType: ExternalMemoryHandleTypeFlagsNV) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_FORMAT_NOT_SUPPORTED, VK_UNDOCUMENTED_ERROR }!ExternalImageFormatPropertiesNV { var out_externalImageFormatProperties: ExternalImageFormatPropertiesNV = undefined; const result = vkGetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, inType, tiling, usage.toInt(), flags.toInt(), externalHandleType.toInt(), &out_externalImageFormatProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -12129,7 +12054,6 @@ pub inline fn GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice: P return out_externalImageFormatProperties; } - pub const NV_external_memory = 1; pub const NV_EXTERNAL_MEMORY_SPEC_VERSION = 1; pub const NV_EXTERNAL_MEMORY_EXTENSION_NAME = "VK_NV_external_memory"; @@ -12146,7 +12070,6 @@ pub const ExportMemoryAllocateInfoNV = extern struct { handleTypes: ExternalMemoryHandleTypeFlagsNV align(4) = ExternalMemoryHandleTypeFlagsNV{}, }; - pub const EXT_validation_flags = 1; pub const EXT_VALIDATION_FLAGS_SPEC_VERSION = 2; pub const EXT_VALIDATION_FLAGS_EXTENSION_NAME = "VK_EXT_validation_flags"; @@ -12164,17 +12087,14 @@ pub const ValidationFlagsEXT = extern struct { pDisabledValidationChecks: [*]const ValidationCheckEXT, }; - pub const EXT_shader_subgroup_ballot = 1; pub const EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION = 1; pub const EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME = "VK_EXT_shader_subgroup_ballot"; - pub const EXT_shader_subgroup_vote = 1; pub const EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION = 1; pub const EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME = "VK_EXT_shader_subgroup_vote"; - pub const EXT_texture_compression_astc_hdr = 1; pub const EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION = 1; pub const EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME = "VK_EXT_texture_compression_astc_hdr"; @@ -12185,7 +12105,6 @@ pub const PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT = extern struct { textureCompressionASTC_HDR: Bool32, }; - pub const EXT_astc_decode_mode = 1; pub const EXT_ASTC_DECODE_MODE_SPEC_VERSION = 1; pub const EXT_ASTC_DECODE_MODE_EXTENSION_NAME = "VK_EXT_astc_decode_mode"; @@ -12202,7 +12121,6 @@ pub const PhysicalDeviceASTCDecodeFeaturesEXT = extern struct { decodeModeSharedExponent: Bool32, }; - pub const EXT_conditional_rendering = 1; pub const EXT_CONDITIONAL_RENDERING_SPEC_VERSION = 2; pub const EXT_CONDITIONAL_RENDERING_EXTENSION_NAME = "VK_EXT_conditional_rendering"; @@ -12278,7 +12196,6 @@ pub inline fn CmdBeginConditionalRenderingEXT(commandBuffer: CommandBuffer, cond pub const CmdEndConditionalRenderingEXT = vkCmdEndConditionalRenderingEXT; - pub const NVX_device_generated_commands = 1; pub const ObjectTableNVX = enum(u64) { Null = 0, _ }; pub const IndirectCommandsLayoutNVX = enum(u64) { Null = 0, _ }; @@ -12534,7 +12451,7 @@ pub extern fn vkRegisterObjectsNVX( device: Device, objectTable: ObjectTableNVX, objectCount: u32, - ppObjectTableEntries: [*]const*const ObjectTableEntryNVX, + ppObjectTableEntries: [*]const *const ObjectTableEntryNVX, pObjectIndices: [*]const u32, ) callconv(CallConv) Result; @@ -12560,10 +12477,10 @@ pub inline fn CmdReserveSpaceForCommandsNVX(commandBuffer: CommandBuffer, reserv vkCmdReserveSpaceForCommandsNVX(commandBuffer, &reserveSpaceInfo); } -pub inline fn CreateIndirectCommandsLayoutNVX(device: Device, createInfo: IndirectCommandsLayoutCreateInfoNVX, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!IndirectCommandsLayoutNVX { +pub inline fn CreateIndirectCommandsLayoutNVX(device: Device, createInfo: IndirectCommandsLayoutCreateInfoNVX, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!IndirectCommandsLayoutNVX { var out_indirectCommandsLayout: IndirectCommandsLayoutNVX = undefined; const result = vkCreateIndirectCommandsLayoutNVX(device, &createInfo, pAllocator, &out_indirectCommandsLayout); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -12575,10 +12492,10 @@ pub inline fn CreateIndirectCommandsLayoutNVX(device: Device, createInfo: Indire pub const DestroyIndirectCommandsLayoutNVX = vkDestroyIndirectCommandsLayoutNVX; -pub inline fn CreateObjectTableNVX(device: Device, createInfo: ObjectTableCreateInfoNVX, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!ObjectTableNVX { +pub inline fn CreateObjectTableNVX(device: Device, createInfo: ObjectTableCreateInfoNVX, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!ObjectTableNVX { var out_objectTable: ObjectTableNVX = undefined; const result = vkCreateObjectTableNVX(device, &createInfo, pAllocator, &out_objectTable); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -12590,10 +12507,10 @@ pub inline fn CreateObjectTableNVX(device: Device, createInfo: ObjectTableCreate pub const DestroyObjectTableNVX = vkDestroyObjectTableNVX; -pub inline fn RegisterObjectsNVX(device: Device, objectTable: ObjectTableNVX, pObjectTableEntries: []const*const ObjectTableEntryNVX, objectIndices: []const u32) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn RegisterObjectsNVX(device: Device, objectTable: ObjectTableNVX, pObjectTableEntries: []const *const ObjectTableEntryNVX, objectIndices: []const u32) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { assert(objectIndices.len >= pObjectTableEntries.len); - const result = vkRegisterObjectsNVX(device, objectTable, @intCast(u32, pObjectTableEntries.len), pObjectTableEntries.ptr, objectIndices.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkRegisterObjectsNVX(device, objectTable, @as(u32, @intCast(pObjectTableEntries.len)), pObjectTableEntries.ptr, objectIndices.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -12602,10 +12519,10 @@ pub inline fn RegisterObjectsNVX(device: Device, objectTable: ObjectTableNVX, pO } } -pub inline fn UnregisterObjectsNVX(device: Device, objectTable: ObjectTableNVX, objectEntryTypes: []const ObjectEntryTypeNVX, objectIndices: []const u32) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn UnregisterObjectsNVX(device: Device, objectTable: ObjectTableNVX, objectEntryTypes: []const ObjectEntryTypeNVX, objectIndices: []const u32) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { assert(objectIndices.len >= objectEntryTypes.len); - const result = vkUnregisterObjectsNVX(device, objectTable, @intCast(u32, objectEntryTypes.len), objectEntryTypes.ptr, objectIndices.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkUnregisterObjectsNVX(device, objectTable, @as(u32, @intCast(objectEntryTypes.len)), objectEntryTypes.ptr, objectIndices.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -12624,7 +12541,6 @@ pub inline fn GetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice: Ph return returnValues; } - pub const NV_clip_space_w_scaling = 1; pub const NV_CLIP_SPACE_W_SCALING_SPEC_VERSION = 1; pub const NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME = "VK_NV_clip_space_w_scaling"; @@ -12650,10 +12566,9 @@ pub extern fn vkCmdSetViewportWScalingNV( ) callconv(CallConv) void; pub inline fn CmdSetViewportWScalingNV(commandBuffer: CommandBuffer, firstViewport: u32, viewportWScalings: []const ViewportWScalingNV) void { - vkCmdSetViewportWScalingNV(commandBuffer, firstViewport, @intCast(u32, viewportWScalings.len), viewportWScalings.ptr); + vkCmdSetViewportWScalingNV(commandBuffer, firstViewport, @as(u32, @intCast(viewportWScalings.len)), viewportWScalings.ptr); } - pub const EXT_direct_mode_display = 1; pub const EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION = 1; pub const EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME = "VK_EXT_direct_mode_display"; @@ -12665,12 +12580,11 @@ pub extern fn vkReleaseDisplayEXT( pub inline fn ReleaseDisplayEXT(physicalDevice: PhysicalDevice, display: DisplayKHR) error{VK_UNDOCUMENTED_ERROR}!void { const result = vkReleaseDisplayEXT(physicalDevice, display); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } } - pub const EXT_display_surface_counter = 1; pub const EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION = 1; pub const EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME = "VK_EXT_display_surface_counter"; @@ -12734,10 +12648,10 @@ pub extern fn vkGetPhysicalDeviceSurfaceCapabilities2EXT( pSurfaceCapabilities: *SurfaceCapabilities2EXT, ) callconv(CallConv) Result; -pub inline fn GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!SurfaceCapabilities2EXT { +pub inline fn GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice: PhysicalDevice, surface: SurfaceKHR) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!SurfaceCapabilities2EXT { var out_surfaceCapabilities: SurfaceCapabilities2EXT = undefined; const result = vkGetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, &out_surfaceCapabilities); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -12748,7 +12662,6 @@ pub inline fn GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice: PhysicalD return out_surfaceCapabilities; } - pub const EXT_display_control = 1; pub const EXT_DISPLAY_CONTROL_SPEC_VERSION = 1; pub const EXT_DISPLAY_CONTROL_EXTENSION_NAME = "VK_EXT_display_control"; @@ -12824,7 +12737,7 @@ pub extern fn vkGetSwapchainCounterEXT( pub inline fn DisplayPowerControlEXT(device: Device, display: DisplayKHR, displayPowerInfo: DisplayPowerInfoEXT) error{VK_UNDOCUMENTED_ERROR}!void { const result = vkDisplayPowerControlEXT(device, display, &displayPowerInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } } @@ -12832,7 +12745,7 @@ pub inline fn DisplayPowerControlEXT(device: Device, display: DisplayKHR, displa pub inline fn RegisterDeviceEventEXT(device: Device, deviceEventInfo: DeviceEventInfoEXT, pAllocator: ?*const AllocationCallbacks) error{VK_UNDOCUMENTED_ERROR}!Fence { var out_fence: Fence = undefined; const result = vkRegisterDeviceEventEXT(device, &deviceEventInfo, pAllocator, &out_fence); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } return out_fence; @@ -12841,16 +12754,16 @@ pub inline fn RegisterDeviceEventEXT(device: Device, deviceEventInfo: DeviceEven pub inline fn RegisterDisplayEventEXT(device: Device, display: DisplayKHR, displayEventInfo: DisplayEventInfoEXT, pAllocator: ?*const AllocationCallbacks) error{VK_UNDOCUMENTED_ERROR}!Fence { var out_fence: Fence = undefined; const result = vkRegisterDisplayEventEXT(device, display, &displayEventInfo, pAllocator, &out_fence); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } return out_fence; } -pub inline fn GetSwapchainCounterEXT(device: Device, swapchain: SwapchainKHR, counter: SurfaceCounterFlagsEXT) error{VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_UNDOCUMENTED_ERROR}!u64 { +pub inline fn GetSwapchainCounterEXT(device: Device, swapchain: SwapchainKHR, counter: SurfaceCounterFlagsEXT) error{ VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_UNDOCUMENTED_ERROR }!u64 { var out_counterValue: u64 = undefined; const result = vkGetSwapchainCounterEXT(device, swapchain, counter.toInt(), &out_counterValue); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_DEVICE_LOST => error.VK_DEVICE_LOST, .ERROR_OUT_OF_DATE_KHR => error.VK_OUT_OF_DATE_KHR, @@ -12860,7 +12773,6 @@ pub inline fn GetSwapchainCounterEXT(device: Device, swapchain: SwapchainKHR, co return out_counterValue; } - pub const GOOGLE_display_timing = 1; pub const GOOGLE_DISPLAY_TIMING_SPEC_VERSION = 1; pub const GOOGLE_DISPLAY_TIMING_EXTENSION_NAME = "VK_GOOGLE_display_timing"; @@ -12902,10 +12814,10 @@ pub extern fn vkGetPastPresentationTimingGOOGLE( pPresentationTimings: ?[*]PastPresentationTimingGOOGLE, ) callconv(CallConv) Result; -pub inline fn GetRefreshCycleDurationGOOGLE(device: Device, swapchain: SwapchainKHR) error{VK_DEVICE_LOST,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!RefreshCycleDurationGOOGLE { +pub inline fn GetRefreshCycleDurationGOOGLE(device: Device, swapchain: SwapchainKHR) error{ VK_DEVICE_LOST, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!RefreshCycleDurationGOOGLE { var out_displayTimingProperties: RefreshCycleDurationGOOGLE = undefined; const result = vkGetRefreshCycleDurationGOOGLE(device, swapchain, &out_displayTimingProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_DEVICE_LOST => error.VK_DEVICE_LOST, .ERROR_SURFACE_LOST_KHR => error.VK_SURFACE_LOST_KHR, @@ -12919,11 +12831,11 @@ pub const GetPastPresentationTimingGOOGLEResult = struct { result: Result, presentationTimings: []PastPresentationTimingGOOGLE, }; -pub inline fn GetPastPresentationTimingGOOGLE(device: Device, swapchain: SwapchainKHR, presentationTimings: []PastPresentationTimingGOOGLE) error{VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!GetPastPresentationTimingGOOGLEResult { +pub inline fn GetPastPresentationTimingGOOGLE(device: Device, swapchain: SwapchainKHR, presentationTimings: []PastPresentationTimingGOOGLE) error{ VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!GetPastPresentationTimingGOOGLEResult { var returnValues: GetPastPresentationTimingGOOGLEResult = undefined; - var presentationTimingCount: u32 = @intCast(u32, presentationTimings.len); + var presentationTimingCount: u32 = @as(u32, @intCast(presentationTimings.len)); const result = vkGetPastPresentationTimingGOOGLE(device, swapchain, &presentationTimingCount, presentationTimings.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_DEVICE_LOST => error.VK_DEVICE_LOST, .ERROR_OUT_OF_DATE_KHR => error.VK_OUT_OF_DATE_KHR, @@ -12935,10 +12847,10 @@ pub inline fn GetPastPresentationTimingGOOGLE(device: Device, swapchain: Swapcha returnValues.result = result; return returnValues; } -pub inline fn GetPastPresentationTimingCountGOOGLE(device: Device, swapchain: SwapchainKHR) error{VK_DEVICE_LOST,VK_OUT_OF_DATE_KHR,VK_SURFACE_LOST_KHR,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPastPresentationTimingCountGOOGLE(device: Device, swapchain: SwapchainKHR) error{ VK_DEVICE_LOST, VK_OUT_OF_DATE_KHR, VK_SURFACE_LOST_KHR, VK_UNDOCUMENTED_ERROR }!u32 { var out_presentationTimingCount: u32 = undefined; const result = vkGetPastPresentationTimingGOOGLE(device, swapchain, &out_presentationTimingCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_DEVICE_LOST => error.VK_DEVICE_LOST, .ERROR_OUT_OF_DATE_KHR => error.VK_OUT_OF_DATE_KHR, @@ -12949,22 +12861,18 @@ pub inline fn GetPastPresentationTimingCountGOOGLE(device: Device, swapchain: Sw return out_presentationTimingCount; } - pub const NV_sample_mask_override_coverage = 1; pub const NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION = 1; pub const NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME = "VK_NV_sample_mask_override_coverage"; - pub const NV_geometry_shader_passthrough = 1; pub const NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION = 1; pub const NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME = "VK_NV_geometry_shader_passthrough"; - pub const NV_viewport_array2 = 1; pub const NV_VIEWPORT_ARRAY2_SPEC_VERSION = 1; pub const NV_VIEWPORT_ARRAY2_EXTENSION_NAME = "VK_NV_viewport_array2"; - pub const NVX_multiview_per_view_attributes = 1; pub const NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION = 1; pub const NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME = "VK_NVX_multiview_per_view_attributes"; @@ -12975,7 +12883,6 @@ pub const PhysicalDeviceMultiviewPerViewAttributesPropertiesNVX = extern struct perViewPositionAllComponents: Bool32, }; - pub const NV_viewport_swizzle = 1; pub const NV_VIEWPORT_SWIZZLE_SPEC_VERSION = 1; pub const NV_VIEWPORT_SWIZZLE_EXTENSION_NAME = "VK_NV_viewport_swizzle"; @@ -13012,7 +12919,6 @@ pub const PipelineViewportSwizzleStateCreateInfoNV = extern struct { pViewportSwizzles: [*]const ViewportSwizzleNV, }; - pub const EXT_discard_rectangles = 1; pub const EXT_DISCARD_RECTANGLES_SPEC_VERSION = 1; pub const EXT_DISCARD_RECTANGLES_EXTENSION_NAME = "VK_EXT_discard_rectangles"; @@ -13051,10 +12957,9 @@ pub extern fn vkCmdSetDiscardRectangleEXT( ) callconv(CallConv) void; pub inline fn CmdSetDiscardRectangleEXT(commandBuffer: CommandBuffer, firstDiscardRectangle: u32, discardRectangles: []const Rect2D) void { - vkCmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, @intCast(u32, discardRectangles.len), discardRectangles.ptr); + vkCmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, @as(u32, @intCast(discardRectangles.len)), discardRectangles.ptr); } - pub const EXT_conservative_rasterization = 1; pub const EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION = 1; pub const EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_conservative_rasterization"; @@ -13093,7 +12998,6 @@ pub const PipelineRasterizationConservativeStateCreateInfoEXT = extern struct { extraPrimitiveOverestimationSize: f32, }; - pub const EXT_depth_clip_enable = 1; pub const EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION = 1; pub const EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME = "VK_EXT_depth_clip_enable"; @@ -13116,12 +13020,10 @@ pub const PipelineRasterizationDepthClipStateCreateInfoEXT = extern struct { depthClipEnable: Bool32, }; - pub const EXT_swapchain_colorspace = 1; pub const EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION = 4; pub const EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME = "VK_EXT_swapchain_colorspace"; - pub const EXT_hdr_metadata = 1; pub const EXT_HDR_METADATA_SPEC_VERSION = 2; pub const EXT_HDR_METADATA_EXTENSION_NAME = "VK_EXT_hdr_metadata"; @@ -13153,20 +13055,17 @@ pub extern fn vkSetHdrMetadataEXT( pub inline fn SetHdrMetadataEXT(device: Device, swapchains: []const SwapchainKHR, metadata: []const HdrMetadataEXT) void { assert(metadata.len >= swapchains.len); - vkSetHdrMetadataEXT(device, @intCast(u32, swapchains.len), swapchains.ptr, metadata.ptr); + vkSetHdrMetadataEXT(device, @as(u32, @intCast(swapchains.len)), swapchains.ptr, metadata.ptr); } - pub const EXT_external_memory_dma_buf = 1; pub const EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION = 1; pub const EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME = "VK_EXT_external_memory_dma_buf"; - pub const EXT_queue_family_foreign = 1; pub const EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION = 1; pub const EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME = "VK_EXT_queue_family_foreign"; -pub const QUEUE_FAMILY_FOREIGN_EXT = (~@as(u32, 0)-2); - +pub const QUEUE_FAMILY_FOREIGN_EXT = (~@as(u32, 0) - 2); pub const EXT_debug_utils = 1; pub const DebugUtilsMessengerEXT = enum(u64) { Null = 0, _ }; @@ -13298,7 +13197,7 @@ pub const DebugUtilsMessengerCallbackDataEXT = extern struct { pObjects: [*]const DebugUtilsObjectNameInfoEXT = undefined, }; -pub const PFN_DebugUtilsMessengerCallbackEXT = fn ( +pub const PFN_DebugUtilsMessengerCallbackEXT = *const fn ( DebugUtilsMessageSeverityFlagsEXT.IntType, DebugUtilsMessageTypeFlagsEXT.IntType, ?[*]const DebugUtilsMessengerCallbackDataEXT, @@ -13369,9 +13268,9 @@ pub extern fn vkSubmitDebugUtilsMessageEXT( pCallbackData: *const DebugUtilsMessengerCallbackDataEXT, ) callconv(CallConv) void; -pub inline fn SetDebugUtilsObjectNameEXT(device: Device, nameInfo: DebugUtilsObjectNameInfoEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn SetDebugUtilsObjectNameEXT(device: Device, nameInfo: DebugUtilsObjectNameInfoEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkSetDebugUtilsObjectNameEXT(device, &nameInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -13380,9 +13279,9 @@ pub inline fn SetDebugUtilsObjectNameEXT(device: Device, nameInfo: DebugUtilsObj } } -pub inline fn SetDebugUtilsObjectTagEXT(device: Device, tagInfo: DebugUtilsObjectTagInfoEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn SetDebugUtilsObjectTagEXT(device: Device, tagInfo: DebugUtilsObjectTagInfoEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkSetDebugUtilsObjectTagEXT(device, &tagInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -13411,10 +13310,10 @@ pub inline fn CmdInsertDebugUtilsLabelEXT(commandBuffer: CommandBuffer, labelInf vkCmdInsertDebugUtilsLabelEXT(commandBuffer, &labelInfo); } -pub inline fn CreateDebugUtilsMessengerEXT(instance: Instance, createInfo: DebugUtilsMessengerCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!DebugUtilsMessengerEXT { +pub inline fn CreateDebugUtilsMessengerEXT(instance: Instance, createInfo: DebugUtilsMessengerCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!DebugUtilsMessengerEXT { var out_messenger: DebugUtilsMessengerEXT = undefined; const result = vkCreateDebugUtilsMessengerEXT(instance, &createInfo, pAllocator, &out_messenger); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, else => error.VK_UNDOCUMENTED_ERROR, @@ -13429,7 +13328,6 @@ pub inline fn SubmitDebugUtilsMessageEXT(instance: Instance, messageSeverity: De vkSubmitDebugUtilsMessageEXT(instance, messageSeverity.toInt(), messageTypes.toInt(), &callbackData); } - pub const EXT_sampler_filter_minmax = 1; pub const EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION = 2; pub const EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME = "VK_EXT_sampler_filter_minmax"; @@ -13439,22 +13337,18 @@ pub const SamplerReductionModeEXT = SamplerReductionMode; pub const SamplerReductionModeCreateInfoEXT = SamplerReductionModeCreateInfo; pub const PhysicalDeviceSamplerFilterMinmaxPropertiesEXT = PhysicalDeviceSamplerFilterMinmaxProperties; - pub const AMD_gpu_shader_int16 = 1; pub const AMD_GPU_SHADER_INT16_SPEC_VERSION = 2; pub const AMD_GPU_SHADER_INT16_EXTENSION_NAME = "VK_AMD_gpu_shader_int16"; - pub const AMD_mixed_attachment_samples = 1; pub const AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION = 1; pub const AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME = "VK_AMD_mixed_attachment_samples"; - pub const AMD_shader_fragment_mask = 1; pub const AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION = 1; pub const AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME = "VK_AMD_shader_fragment_mask"; - pub const EXT_inline_uniform_block = 1; pub const EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION = 1; pub const EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME = "VK_EXT_inline_uniform_block"; @@ -13489,12 +13383,10 @@ pub const DescriptorPoolInlineUniformBlockCreateInfoEXT = extern struct { maxInlineUniformBlockBindings: u32, }; - pub const EXT_shader_stencil_export = 1; pub const EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION = 1; pub const EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME = "VK_EXT_shader_stencil_export"; - pub const EXT_sample_locations = 1; pub const EXT_SAMPLE_LOCATIONS_SPEC_VERSION = 1; pub const EXT_SAMPLE_LOCATIONS_EXTENSION_NAME = "VK_EXT_sample_locations"; @@ -13576,7 +13468,6 @@ pub inline fn GetPhysicalDeviceMultisamplePropertiesEXT(physicalDevice: Physical return out_multisampleProperties; } - pub const EXT_blend_operation_advanced = 1; pub const EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION = 2; pub const EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME = "VK_EXT_blend_operation_advanced"; @@ -13613,7 +13504,6 @@ pub const PipelineColorBlendAdvancedStateCreateInfoEXT = extern struct { blendOverlap: BlendOverlapEXT, }; - pub const NV_fragment_coverage_to_color = 1; pub const NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION = 1; pub const NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME = "VK_NV_fragment_coverage_to_color"; @@ -13631,7 +13521,6 @@ pub const PipelineCoverageToColorStateCreateInfoNV = extern struct { coverageToColorLocation: u32 = 0, }; - pub const NV_framebuffer_mixed_samples = 1; pub const NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION = 1; pub const NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME = "VK_NV_framebuffer_mixed_samples"; @@ -13659,12 +13548,10 @@ pub const PipelineCoverageModulationStateCreateInfoNV = extern struct { pCoverageModulationTable: ?[*]const f32 = null, }; - pub const NV_fill_rectangle = 1; pub const NV_FILL_RECTANGLE_SPEC_VERSION = 1; pub const NV_FILL_RECTANGLE_EXTENSION_NAME = "VK_NV_fill_rectangle"; - pub const NV_shader_sm_builtins = 1; pub const NV_SHADER_SM_BUILTINS_SPEC_VERSION = 1; pub const NV_SHADER_SM_BUILTINS_EXTENSION_NAME = "VK_NV_shader_sm_builtins"; @@ -13682,12 +13569,10 @@ pub const PhysicalDeviceShaderSMBuiltinsFeaturesNV = extern struct { shaderSMBuiltins: Bool32, }; - pub const EXT_post_depth_coverage = 1; pub const EXT_POST_DEPTH_COVERAGE_SPEC_VERSION = 1; pub const EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME = "VK_EXT_post_depth_coverage"; - pub const EXT_image_drm_format_modifier = 1; pub const EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION = 1; pub const EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME = "VK_EXT_image_drm_format_modifier"; @@ -13744,13 +13629,12 @@ pub extern fn vkGetImageDrmFormatModifierPropertiesEXT( pub inline fn GetImageDrmFormatModifierPropertiesEXT(device: Device, image: Image) error{VK_UNDOCUMENTED_ERROR}!ImageDrmFormatModifierPropertiesEXT { var out_properties: ImageDrmFormatModifierPropertiesEXT = undefined; const result = vkGetImageDrmFormatModifierPropertiesEXT(device, image, &out_properties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } return out_properties; } - pub const EXT_validation_cache = 1; pub const ValidationCacheEXT = enum(u64) { Null = 0, _ }; @@ -13808,10 +13692,10 @@ pub extern fn vkGetValidationCacheDataEXT( pData: ?*anyopaque, ) callconv(CallConv) Result; -pub inline fn CreateValidationCacheEXT(device: Device, createInfo: ValidationCacheCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!ValidationCacheEXT { +pub inline fn CreateValidationCacheEXT(device: Device, createInfo: ValidationCacheCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!ValidationCacheEXT { var out_validationCache: ValidationCacheEXT = undefined; const result = vkCreateValidationCacheEXT(device, &createInfo, pAllocator, &out_validationCache); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, else => error.VK_UNDOCUMENTED_ERROR, @@ -13822,9 +13706,9 @@ pub inline fn CreateValidationCacheEXT(device: Device, createInfo: ValidationCac pub const DestroyValidationCacheEXT = vkDestroyValidationCacheEXT; -pub inline fn MergeValidationCachesEXT(device: Device, dstCache: ValidationCacheEXT, srcCaches: []const ValidationCacheEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkMergeValidationCachesEXT(device, dstCache, @intCast(u32, srcCaches.len), srcCaches.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn MergeValidationCachesEXT(device: Device, dstCache: ValidationCacheEXT, srcCaches: []const ValidationCacheEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkMergeValidationCachesEXT(device, dstCache, @as(u32, @intCast(srcCaches.len)), srcCaches.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -13837,11 +13721,11 @@ pub const GetValidationCacheDataEXTResult = struct { result: Result, data: []u8, }; -pub inline fn GetValidationCacheDataEXT(device: Device, validationCache: ValidationCacheEXT, data: []u8) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetValidationCacheDataEXTResult { +pub inline fn GetValidationCacheDataEXT(device: Device, validationCache: ValidationCacheEXT, data: []u8) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetValidationCacheDataEXTResult { var returnValues: GetValidationCacheDataEXTResult = undefined; - var dataSize: usize = @intCast(usize, data.len); + var dataSize: usize = @as(usize, @intCast(data.len)); const result = vkGetValidationCacheDataEXT(device, validationCache, &dataSize, data.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -13852,10 +13736,10 @@ pub inline fn GetValidationCacheDataEXT(device: Device, validationCache: Validat returnValues.result = result; return returnValues; } -pub inline fn GetValidationCacheDataCountEXT(device: Device, validationCache: ValidationCacheEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!usize { +pub inline fn GetValidationCacheDataCountEXT(device: Device, validationCache: ValidationCacheEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!usize { var out_dataSize: usize = undefined; const result = vkGetValidationCacheDataEXT(device, validationCache, &out_dataSize, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -13865,7 +13749,6 @@ pub inline fn GetValidationCacheDataCountEXT(device: Device, validationCache: Va return out_dataSize; } - pub const EXT_descriptor_indexing = 1; pub const EXT_DESCRIPTOR_INDEXING_SPEC_VERSION = 2; pub const EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME = "VK_EXT_descriptor_indexing"; @@ -13878,12 +13761,10 @@ pub const PhysicalDeviceDescriptorIndexingPropertiesEXT = PhysicalDeviceDescript pub const DescriptorSetVariableDescriptorCountAllocateInfoEXT = DescriptorSetVariableDescriptorCountAllocateInfo; pub const DescriptorSetVariableDescriptorCountLayoutSupportEXT = DescriptorSetVariableDescriptorCountLayoutSupport; - pub const EXT_shader_viewport_index_layer = 1; pub const EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION = 1; pub const EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME = "VK_EXT_shader_viewport_index_layer"; - pub const NV_shading_rate_image = 1; pub const NV_SHADING_RATE_IMAGE_SPEC_VERSION = 3; pub const NV_SHADING_RATE_IMAGE_EXTENSION_NAME = "VK_NV_shading_rate_image"; @@ -13984,14 +13865,13 @@ pub extern fn vkCmdSetCoarseSampleOrderNV( pub const CmdBindShadingRateImageNV = vkCmdBindShadingRateImageNV; pub inline fn CmdSetViewportShadingRatePaletteNV(commandBuffer: CommandBuffer, firstViewport: u32, shadingRatePalettes: []const ShadingRatePaletteNV) void { - vkCmdSetViewportShadingRatePaletteNV(commandBuffer, firstViewport, @intCast(u32, shadingRatePalettes.len), shadingRatePalettes.ptr); + vkCmdSetViewportShadingRatePaletteNV(commandBuffer, firstViewport, @as(u32, @intCast(shadingRatePalettes.len)), shadingRatePalettes.ptr); } pub inline fn CmdSetCoarseSampleOrderNV(commandBuffer: CommandBuffer, sampleOrderType: CoarseSampleOrderTypeNV, customSampleOrders: []const CoarseSampleOrderCustomNV) void { - vkCmdSetCoarseSampleOrderNV(commandBuffer, sampleOrderType, @intCast(u32, customSampleOrders.len), customSampleOrders.ptr); + vkCmdSetCoarseSampleOrderNV(commandBuffer, sampleOrderType, @as(u32, @intCast(customSampleOrders.len)), customSampleOrders.ptr); } - pub const NV_ray_tracing = 1; pub const AccelerationStructureNV = enum(u64) { Null = 0, _ }; @@ -14360,10 +14240,10 @@ pub extern fn vkCompileDeferredNV( shader: u32, ) callconv(CallConv) Result; -pub inline fn CreateAccelerationStructureNV(device: Device, createInfo: AccelerationStructureCreateInfoNV, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!AccelerationStructureNV { +pub inline fn CreateAccelerationStructureNV(device: Device, createInfo: AccelerationStructureCreateInfoNV, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!AccelerationStructureNV { var out_accelerationStructure: AccelerationStructureNV = undefined; const result = vkCreateAccelerationStructureNV(device, &createInfo, pAllocator, &out_accelerationStructure); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, else => error.VK_UNDOCUMENTED_ERROR, @@ -14380,9 +14260,9 @@ pub inline fn GetAccelerationStructureMemoryRequirementsNV(device: Device, info: return out_memoryRequirements; } -pub inline fn BindAccelerationStructureMemoryNV(device: Device, bindInfos: []const BindAccelerationStructureMemoryInfoNV) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkBindAccelerationStructureMemoryNV(device, @intCast(u32, bindInfos.len), bindInfos.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn BindAccelerationStructureMemoryNV(device: Device, bindInfos: []const BindAccelerationStructureMemoryInfoNV) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkBindAccelerationStructureMemoryNV(device, @as(u32, @intCast(bindInfos.len)), bindInfos.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14398,10 +14278,10 @@ pub inline fn CmdBuildAccelerationStructureNV(commandBuffer: CommandBuffer, info pub const CmdCopyAccelerationStructureNV = vkCmdCopyAccelerationStructureNV; pub const CmdTraceRaysNV = vkCmdTraceRaysNV; -pub inline fn CreateRayTracingPipelinesNV(device: Device, pipelineCache: PipelineCache, createInfos: []const RayTracingPipelineCreateInfoNV, pAllocator: ?*const AllocationCallbacks, pipelines: []Pipeline) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_INVALID_SHADER_NV,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CreateRayTracingPipelinesNV(device: Device, pipelineCache: PipelineCache, createInfos: []const RayTracingPipelineCreateInfoNV, pAllocator: ?*const AllocationCallbacks, pipelines: []Pipeline) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_INVALID_SHADER_NV, VK_UNDOCUMENTED_ERROR }!void { assert(pipelines.len >= createInfos.len); - const result = vkCreateRayTracingPipelinesNV(device, pipelineCache, @intCast(u32, createInfos.len), createInfos.ptr, pAllocator, pipelines.ptr); - if (@bitCast(c_int, result) < 0) { + const result = vkCreateRayTracingPipelinesNV(device, pipelineCache, @as(u32, @intCast(createInfos.len)), createInfos.ptr, pAllocator, pipelines.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14411,9 +14291,9 @@ pub inline fn CreateRayTracingPipelinesNV(device: Device, pipelineCache: Pipelin } } -pub inline fn GetRayTracingShaderGroupHandlesNV(device: Device, pipeline: Pipeline, firstGroup: u32, groupCount: u32, data: []u8) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkGetRayTracingShaderGroupHandlesNV(device, pipeline, firstGroup, groupCount, @intCast(usize, data.len), data.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn GetRayTracingShaderGroupHandlesNV(device: Device, pipeline: Pipeline, firstGroup: u32, groupCount: u32, data: []u8) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkGetRayTracingShaderGroupHandlesNV(device, pipeline, firstGroup, groupCount, @as(usize, @intCast(data.len)), data.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14422,9 +14302,9 @@ pub inline fn GetRayTracingShaderGroupHandlesNV(device: Device, pipeline: Pipeli } } -pub inline fn GetAccelerationStructureHandleNV(device: Device, accelerationStructure: AccelerationStructureNV, data: []u8) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { - const result = vkGetAccelerationStructureHandleNV(device, accelerationStructure, @intCast(usize, data.len), data.ptr); - if (@bitCast(c_int, result) < 0) { +pub inline fn GetAccelerationStructureHandleNV(device: Device, accelerationStructure: AccelerationStructureNV, data: []u8) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { + const result = vkGetAccelerationStructureHandleNV(device, accelerationStructure, @as(usize, @intCast(data.len)), data.ptr); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14434,12 +14314,12 @@ pub inline fn GetAccelerationStructureHandleNV(device: Device, accelerationStruc } pub inline fn CmdWriteAccelerationStructuresPropertiesNV(commandBuffer: CommandBuffer, accelerationStructures: []const AccelerationStructureNV, queryType: QueryType, queryPool: QueryPool, firstQuery: u32) void { - vkCmdWriteAccelerationStructuresPropertiesNV(commandBuffer, @intCast(u32, accelerationStructures.len), accelerationStructures.ptr, queryType, queryPool, firstQuery); + vkCmdWriteAccelerationStructuresPropertiesNV(commandBuffer, @as(u32, @intCast(accelerationStructures.len)), accelerationStructures.ptr, queryType, queryPool, firstQuery); } -pub inline fn CompileDeferredNV(device: Device, pipeline: Pipeline, shader: u32) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CompileDeferredNV(device: Device, pipeline: Pipeline, shader: u32) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkCompileDeferredNV(device, pipeline, shader); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14448,7 +14328,6 @@ pub inline fn CompileDeferredNV(device: Device, pipeline: Pipeline, shader: u32) } } - pub const NV_representative_fragment_test = 1; pub const NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION = 2; pub const NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME = "VK_NV_representative_fragment_test"; @@ -14465,7 +14344,6 @@ pub const PipelineRepresentativeFragmentTestStateCreateInfoNV = extern struct { representativeFragmentTestEnable: Bool32, }; - pub const EXT_filter_cubic = 1; pub const EXT_FILTER_CUBIC_SPEC_VERSION = 3; pub const EXT_FILTER_CUBIC_EXTENSION_NAME = "VK_EXT_filter_cubic"; @@ -14483,7 +14361,6 @@ pub const FilterCubicImageViewImageFormatPropertiesEXT = extern struct { filterCubicMinmax: Bool32, }; - pub const EXT_global_priority = 1; pub const EXT_GLOBAL_PRIORITY_SPEC_VERSION = 2; pub const EXT_GLOBAL_PRIORITY_EXTENSION_NAME = "VK_EXT_global_priority"; @@ -14502,7 +14379,6 @@ pub const DeviceQueueGlobalPriorityCreateInfoEXT = extern struct { globalPriority: QueueGlobalPriorityEXT, }; - pub const EXT_external_memory_host = 1; pub const EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION = 1; pub const EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME = "VK_EXT_external_memory_host"; @@ -14533,10 +14409,10 @@ pub extern fn vkGetMemoryHostPointerPropertiesEXT( pMemoryHostPointerProperties: *MemoryHostPointerPropertiesEXT, ) callconv(CallConv) Result; -pub inline fn GetMemoryHostPointerPropertiesEXT(device: Device, handleType: ExternalMemoryHandleTypeFlags, pHostPointer: ?*const anyopaque) error{VK_INVALID_EXTERNAL_HANDLE,VK_UNDOCUMENTED_ERROR}!MemoryHostPointerPropertiesEXT { +pub inline fn GetMemoryHostPointerPropertiesEXT(device: Device, handleType: ExternalMemoryHandleTypeFlags, pHostPointer: ?*const anyopaque) error{ VK_INVALID_EXTERNAL_HANDLE, VK_UNDOCUMENTED_ERROR }!MemoryHostPointerPropertiesEXT { var out_memoryHostPointerProperties: MemoryHostPointerPropertiesEXT = undefined; const result = vkGetMemoryHostPointerPropertiesEXT(device, handleType.toInt(), pHostPointer, &out_memoryHostPointerProperties); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_INVALID_EXTERNAL_HANDLE => error.VK_INVALID_EXTERNAL_HANDLE, else => error.VK_UNDOCUMENTED_ERROR, @@ -14545,7 +14421,6 @@ pub inline fn GetMemoryHostPointerPropertiesEXT(device: Device, handleType: Exte return out_memoryHostPointerProperties; } - pub const AMD_buffer_marker = 1; pub const AMD_BUFFER_MARKER_SPEC_VERSION = 1; pub const AMD_BUFFER_MARKER_EXTENSION_NAME = "VK_AMD_buffer_marker"; @@ -14562,7 +14437,6 @@ pub inline fn CmdWriteBufferMarkerAMD(commandBuffer: CommandBuffer, pipelineStag vkCmdWriteBufferMarkerAMD(commandBuffer, pipelineStage.toInt(), dstBuffer, dstOffset, marker); } - pub const AMD_pipeline_compiler_control = 1; pub const AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION = 1; pub const AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME = "VK_AMD_pipeline_compiler_control"; @@ -14610,7 +14484,6 @@ pub const PipelineCompilerControlCreateInfoAMD = extern struct { compilerControlFlags: PipelineCompilerControlFlagsAMD align(4) = PipelineCompilerControlFlagsAMD{}, }; - pub const EXT_calibrated_timestamps = 1; pub const EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION = 1; pub const EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME = "VK_EXT_calibrated_timestamps"; @@ -14647,11 +14520,11 @@ pub const GetPhysicalDeviceCalibrateableTimeDomainsEXTResult = struct { result: Result, timeDomains: []TimeDomainEXT, }; -pub inline fn GetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice: PhysicalDevice, timeDomains: []TimeDomainEXT) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceCalibrateableTimeDomainsEXTResult { +pub inline fn GetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice: PhysicalDevice, timeDomains: []TimeDomainEXT) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceCalibrateableTimeDomainsEXTResult { var returnValues: GetPhysicalDeviceCalibrateableTimeDomainsEXTResult = undefined; - var timeDomainCount: u32 = @intCast(u32, timeDomains.len); + var timeDomainCount: u32 = @as(u32, @intCast(timeDomains.len)); const result = vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice, &timeDomainCount, timeDomains.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14662,10 +14535,10 @@ pub inline fn GetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice: Physi returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceCalibrateableTimeDomainsCountEXT(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceCalibrateableTimeDomainsCountEXT(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_timeDomainCount: u32 = undefined; const result = vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice, &out_timeDomainCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14675,11 +14548,11 @@ pub inline fn GetPhysicalDeviceCalibrateableTimeDomainsCountEXT(physicalDevice: return out_timeDomainCount; } -pub inline fn GetCalibratedTimestampsEXT(device: Device, timestampInfos: []const CalibratedTimestampInfoEXT, timestamps: []u64) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u64 { +pub inline fn GetCalibratedTimestampsEXT(device: Device, timestampInfos: []const CalibratedTimestampInfoEXT, timestamps: []u64) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u64 { var out_maxDeviation: u64 = undefined; assert(timestamps.len >= timestampInfos.len); - const result = vkGetCalibratedTimestampsEXT(device, @intCast(u32, timestampInfos.len), timestampInfos.ptr, timestamps.ptr, &out_maxDeviation); - if (@bitCast(c_int, result) < 0) { + const result = vkGetCalibratedTimestampsEXT(device, @as(u32, @intCast(timestampInfos.len)), timestampInfos.ptr, timestamps.ptr, &out_maxDeviation); + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -14689,7 +14562,6 @@ pub inline fn GetCalibratedTimestampsEXT(device: Device, timestampInfos: []const return out_maxDeviation; } - pub const AMD_shader_core_properties = 1; pub const AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION = 2; pub const AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME = "VK_AMD_shader_core_properties"; @@ -14713,7 +14585,6 @@ pub const PhysicalDeviceShaderCorePropertiesAMD = extern struct { vgprAllocationGranularity: u32, }; - pub const AMD_memory_overallocation_behavior = 1; pub const AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION = 1; pub const AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME = "VK_AMD_memory_overallocation_behavior"; @@ -14731,7 +14602,6 @@ pub const DeviceMemoryOverallocationCreateInfoAMD = extern struct { overallocationBehavior: MemoryOverallocationBehaviorAMD, }; - pub const EXT_vertex_attribute_divisor = 1; pub const EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION = 3; pub const EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME = "VK_EXT_vertex_attribute_divisor"; @@ -14761,7 +14631,6 @@ pub const PhysicalDeviceVertexAttributeDivisorFeaturesEXT = extern struct { vertexAttributeInstanceRateZeroDivisor: Bool32, }; - pub const EXT_pipeline_creation_feedback = 1; pub const EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION = 1; pub const EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME = "VK_EXT_pipeline_creation_feedback"; @@ -14816,12 +14685,10 @@ pub const PipelineCreationFeedbackCreateInfoEXT = extern struct { pPipelineStageCreationFeedbacks: [*]PipelineCreationFeedbackEXT, }; - pub const NV_shader_subgroup_partitioned = 1; pub const NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION = 1; pub const NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME = "VK_NV_shader_subgroup_partitioned"; - pub const NV_compute_shader_derivatives = 1; pub const NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION = 1; pub const NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME = "VK_NV_compute_shader_derivatives"; @@ -14833,7 +14700,6 @@ pub const PhysicalDeviceComputeShaderDerivativesFeaturesNV = extern struct { computeDerivativeGroupLinear: Bool32, }; - pub const NV_mesh_shader = 1; pub const NV_MESH_SHADER_SPEC_VERSION = 1; pub const NV_MESH_SHADER_EXTENSION_NAME = "VK_NV_mesh_shader"; @@ -14896,7 +14762,6 @@ pub const CmdDrawMeshTasksNV = vkCmdDrawMeshTasksNV; pub const CmdDrawMeshTasksIndirectNV = vkCmdDrawMeshTasksIndirectNV; pub const CmdDrawMeshTasksIndirectCountNV = vkCmdDrawMeshTasksIndirectCountNV; - pub const NV_fragment_shader_barycentric = 1; pub const NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION = 1; pub const NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME = "VK_NV_fragment_shader_barycentric"; @@ -14907,7 +14772,6 @@ pub const PhysicalDeviceFragmentShaderBarycentricFeaturesNV = extern struct { fragmentShaderBarycentric: Bool32, }; - pub const NV_shader_image_footprint = 1; pub const NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION = 2; pub const NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME = "VK_NV_shader_image_footprint"; @@ -14918,7 +14782,6 @@ pub const PhysicalDeviceShaderImageFootprintFeaturesNV = extern struct { imageFootprint: Bool32, }; - pub const NV_scissor_exclusive = 1; pub const NV_SCISSOR_EXCLUSIVE_SPEC_VERSION = 1; pub const NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME = "VK_NV_scissor_exclusive"; @@ -14944,10 +14807,9 @@ pub extern fn vkCmdSetExclusiveScissorNV( ) callconv(CallConv) void; pub inline fn CmdSetExclusiveScissorNV(commandBuffer: CommandBuffer, firstExclusiveScissor: u32, exclusiveScissors: []const Rect2D) void { - vkCmdSetExclusiveScissorNV(commandBuffer, firstExclusiveScissor, @intCast(u32, exclusiveScissors.len), exclusiveScissors.ptr); + vkCmdSetExclusiveScissorNV(commandBuffer, firstExclusiveScissor, @as(u32, @intCast(exclusiveScissors.len)), exclusiveScissors.ptr); } - pub const NV_device_diagnostic_checkpoints = 1; pub const NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION = 2; pub const NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME = "VK_NV_device_diagnostic_checkpoints"; @@ -14980,7 +14842,7 @@ pub const CmdSetCheckpointNV = vkCmdSetCheckpointNV; pub inline fn GetQueueCheckpointDataNV(queue: Queue, checkpointData: []CheckpointDataNV) []CheckpointDataNV { var out_checkpointData: []CheckpointDataNV = undefined; - var checkpointDataCount: u32 = @intCast(u32, checkpointData.len); + var checkpointDataCount: u32 = @as(u32, @intCast(checkpointData.len)); vkGetQueueCheckpointDataNV(queue, &checkpointDataCount, checkpointData.ptr); out_checkpointData = checkpointData[0..checkpointDataCount]; return out_checkpointData; @@ -14991,7 +14853,6 @@ pub inline fn GetQueueCheckpointDataCountNV(queue: Queue) u32 { return out_checkpointDataCount; } - pub const INTEL_shader_integer_functions2 = 1; pub const INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION = 1; pub const INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME = "VK_INTEL_shader_integer_functions2"; @@ -15002,7 +14863,6 @@ pub const PhysicalDeviceShaderIntegerFunctions2FeaturesINTEL = extern struct { shaderIntegerFunctions2: Bool32, }; - pub const INTEL_performance_query = 1; pub const PerformanceConfigurationINTEL = enum(u64) { Null = 0, _ }; @@ -15135,9 +14995,9 @@ pub extern fn vkGetPerformanceParameterINTEL( pValue: *PerformanceValueINTEL, ) callconv(CallConv) Result; -pub inline fn InitializePerformanceApiINTEL(device: Device, initializeInfo: InitializePerformanceApiInfoINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn InitializePerformanceApiINTEL(device: Device, initializeInfo: InitializePerformanceApiInfoINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkInitializePerformanceApiINTEL(device, &initializeInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15148,9 +15008,9 @@ pub inline fn InitializePerformanceApiINTEL(device: Device, initializeInfo: Init pub const UninitializePerformanceApiINTEL = vkUninitializePerformanceApiINTEL; -pub inline fn CmdSetPerformanceMarkerINTEL(commandBuffer: CommandBuffer, markerInfo: PerformanceMarkerInfoINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CmdSetPerformanceMarkerINTEL(commandBuffer: CommandBuffer, markerInfo: PerformanceMarkerInfoINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkCmdSetPerformanceMarkerINTEL(commandBuffer, &markerInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15159,9 +15019,9 @@ pub inline fn CmdSetPerformanceMarkerINTEL(commandBuffer: CommandBuffer, markerI } } -pub inline fn CmdSetPerformanceStreamMarkerINTEL(commandBuffer: CommandBuffer, markerInfo: PerformanceStreamMarkerInfoINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CmdSetPerformanceStreamMarkerINTEL(commandBuffer: CommandBuffer, markerInfo: PerformanceStreamMarkerInfoINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkCmdSetPerformanceStreamMarkerINTEL(commandBuffer, &markerInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15170,9 +15030,9 @@ pub inline fn CmdSetPerformanceStreamMarkerINTEL(commandBuffer: CommandBuffer, m } } -pub inline fn CmdSetPerformanceOverrideINTEL(commandBuffer: CommandBuffer, overrideInfo: PerformanceOverrideInfoINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn CmdSetPerformanceOverrideINTEL(commandBuffer: CommandBuffer, overrideInfo: PerformanceOverrideInfoINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkCmdSetPerformanceOverrideINTEL(commandBuffer, &overrideInfo); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15181,10 +15041,10 @@ pub inline fn CmdSetPerformanceOverrideINTEL(commandBuffer: CommandBuffer, overr } } -pub inline fn AcquirePerformanceConfigurationINTEL(device: Device, acquireInfo: PerformanceConfigurationAcquireInfoINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!PerformanceConfigurationINTEL { +pub inline fn AcquirePerformanceConfigurationINTEL(device: Device, acquireInfo: PerformanceConfigurationAcquireInfoINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!PerformanceConfigurationINTEL { var out_configuration: PerformanceConfigurationINTEL = undefined; const result = vkAcquirePerformanceConfigurationINTEL(device, &acquireInfo, &out_configuration); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15194,9 +15054,9 @@ pub inline fn AcquirePerformanceConfigurationINTEL(device: Device, acquireInfo: return out_configuration; } -pub inline fn ReleasePerformanceConfigurationINTEL(device: Device, configuration: PerformanceConfigurationINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn ReleasePerformanceConfigurationINTEL(device: Device, configuration: PerformanceConfigurationINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkReleasePerformanceConfigurationINTEL(device, configuration); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15205,9 +15065,9 @@ pub inline fn ReleasePerformanceConfigurationINTEL(device: Device, configuration } } -pub inline fn QueueSetPerformanceConfigurationINTEL(queue: Queue, configuration: PerformanceConfigurationINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!void { +pub inline fn QueueSetPerformanceConfigurationINTEL(queue: Queue, configuration: PerformanceConfigurationINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!void { const result = vkQueueSetPerformanceConfigurationINTEL(queue, configuration); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15216,10 +15076,10 @@ pub inline fn QueueSetPerformanceConfigurationINTEL(queue: Queue, configuration: } } -pub inline fn GetPerformanceParameterINTEL(device: Device, parameter: PerformanceParameterTypeINTEL) error{VK_TOO_MANY_OBJECTS,VK_OUT_OF_HOST_MEMORY,VK_UNDOCUMENTED_ERROR}!PerformanceValueINTEL { +pub inline fn GetPerformanceParameterINTEL(device: Device, parameter: PerformanceParameterTypeINTEL) error{ VK_TOO_MANY_OBJECTS, VK_OUT_OF_HOST_MEMORY, VK_UNDOCUMENTED_ERROR }!PerformanceValueINTEL { var out_value: PerformanceValueINTEL = undefined; const result = vkGetPerformanceParameterINTEL(device, parameter, &out_value); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_TOO_MANY_OBJECTS => error.VK_TOO_MANY_OBJECTS, .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, @@ -15229,7 +15089,6 @@ pub inline fn GetPerformanceParameterINTEL(device: Device, parameter: Performanc return out_value; } - pub const EXT_pci_bus_info = 1; pub const EXT_PCI_BUS_INFO_SPEC_VERSION = 2; pub const EXT_PCI_BUS_INFO_EXTENSION_NAME = "VK_EXT_pci_bus_info"; @@ -15243,7 +15102,6 @@ pub const PhysicalDevicePCIBusInfoPropertiesEXT = extern struct { pciFunction: u32, }; - pub const AMD_display_native_hdr = 1; pub const AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION = 1; pub const AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME = "VK_AMD_display_native_hdr"; @@ -15268,7 +15126,6 @@ pub extern fn vkSetLocalDimmingAMD( pub const SetLocalDimmingAMD = vkSetLocalDimmingAMD; - pub const EXT_fragment_density_map = 1; pub const EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION = 1; pub const EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME = "VK_EXT_fragment_density_map"; @@ -15295,24 +15152,20 @@ pub const RenderPassFragmentDensityMapCreateInfoEXT = extern struct { fragmentDensityMapAttachment: AttachmentReference, }; - pub const EXT_scalar_block_layout = 1; pub const EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION = 1; pub const EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME = "VK_EXT_scalar_block_layout"; pub const PhysicalDeviceScalarBlockLayoutFeaturesEXT = PhysicalDeviceScalarBlockLayoutFeatures; - pub const GOOGLE_hlsl_functionality1 = 1; pub const GOOGLE_HLSL_FUNCTIONALITY1_SPEC_VERSION = 1; pub const GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME = "VK_GOOGLE_hlsl_functionality1"; - pub const GOOGLE_decorate_string = 1; pub const GOOGLE_DECORATE_STRING_SPEC_VERSION = 1; pub const GOOGLE_DECORATE_STRING_EXTENSION_NAME = "VK_GOOGLE_decorate_string"; - pub const EXT_subgroup_size_control = 1; pub const EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION = 2; pub const EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME = "VK_EXT_subgroup_size_control"; @@ -15339,7 +15192,6 @@ pub const PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT = extern struct { requiredSubgroupSize: u32, }; - pub const AMD_shader_core_properties2 = 1; pub const AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION = 1; pub const AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME = "VK_AMD_shader_core_properties2"; @@ -15388,7 +15240,6 @@ pub const PhysicalDeviceShaderCoreProperties2AMD = extern struct { activeComputeUnitCount: u32, }; - pub const AMD_device_coherent_memory = 1; pub const AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION = 1; pub const AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME = "VK_AMD_device_coherent_memory"; @@ -15399,7 +15250,6 @@ pub const PhysicalDeviceCoherentMemoryFeaturesAMD = extern struct { deviceCoherentMemory: Bool32, }; - pub const EXT_memory_budget = 1; pub const EXT_MEMORY_BUDGET_SPEC_VERSION = 1; pub const EXT_MEMORY_BUDGET_EXTENSION_NAME = "VK_EXT_memory_budget"; @@ -15411,7 +15261,6 @@ pub const PhysicalDeviceMemoryBudgetPropertiesEXT = extern struct { heapUsage: [MAX_MEMORY_HEAPS]DeviceSize, }; - pub const EXT_memory_priority = 1; pub const EXT_MEMORY_PRIORITY_SPEC_VERSION = 1; pub const EXT_MEMORY_PRIORITY_EXTENSION_NAME = "VK_EXT_memory_priority"; @@ -15428,7 +15277,6 @@ pub const MemoryPriorityAllocateInfoEXT = extern struct { priority: f32, }; - pub const NV_dedicated_allocation_image_aliasing = 1; pub const NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION = 1; pub const NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME = "VK_NV_dedicated_allocation_image_aliasing"; @@ -15439,7 +15287,6 @@ pub const PhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV = extern stru dedicatedAllocationImageAliasing: Bool32, }; - pub const EXT_buffer_device_address = 1; pub const EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION = 2; pub const EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME = "VK_EXT_buffer_device_address"; @@ -15471,7 +15318,6 @@ pub inline fn GetBufferDeviceAddressEXT(device: Device, info: BufferDeviceAddres return result; } - pub const EXT_tooling_info = 1; pub const EXT_TOOLING_INFO_SPEC_VERSION = 1; pub const EXT_TOOLING_INFO_EXTENSION_NAME = "VK_EXT_tooling_info"; @@ -15516,11 +15362,11 @@ pub const ToolPurposeFlagsEXT = packed struct { pub const PhysicalDeviceToolPropertiesEXT = extern struct { sType: StructureType = .PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT, pNext: ?*anyopaque = null, - name: [MAX_EXTENSION_NAME_SIZE-1:0]u8, - version: [MAX_EXTENSION_NAME_SIZE-1:0]u8, + name: [MAX_EXTENSION_NAME_SIZE - 1:0]u8, + version: [MAX_EXTENSION_NAME_SIZE - 1:0]u8, purposes: ToolPurposeFlagsEXT align(4), - description: [MAX_DESCRIPTION_SIZE-1:0]u8, - layer: [MAX_EXTENSION_NAME_SIZE-1:0]u8, + description: [MAX_DESCRIPTION_SIZE - 1:0]u8, + layer: [MAX_EXTENSION_NAME_SIZE - 1:0]u8, }; pub extern fn vkGetPhysicalDeviceToolPropertiesEXT( @@ -15535,9 +15381,9 @@ pub const GetPhysicalDeviceToolPropertiesEXTResult = struct { }; pub inline fn GetPhysicalDeviceToolPropertiesEXT(physicalDevice: PhysicalDevice, toolProperties: []PhysicalDeviceToolPropertiesEXT) error{VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceToolPropertiesEXTResult { var returnValues: GetPhysicalDeviceToolPropertiesEXTResult = undefined; - var toolCount: u32 = @intCast(u32, toolProperties.len); + var toolCount: u32 = @as(u32, @intCast(toolProperties.len)); const result = vkGetPhysicalDeviceToolPropertiesEXT(physicalDevice, &toolCount, toolProperties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } returnValues.toolProperties = toolProperties[0..toolCount]; @@ -15547,20 +15393,18 @@ pub inline fn GetPhysicalDeviceToolPropertiesEXT(physicalDevice: PhysicalDevice, pub inline fn GetPhysicalDeviceToolPropertiesCountEXT(physicalDevice: PhysicalDevice) error{VK_UNDOCUMENTED_ERROR}!u32 { var out_toolCount: u32 = undefined; const result = vkGetPhysicalDeviceToolPropertiesEXT(physicalDevice, &out_toolCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return error.VK_UNDOCUMENTED_ERROR; } return out_toolCount; } - pub const EXT_separate_stencil_usage = 1; pub const EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION = 1; pub const EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME = "VK_EXT_separate_stencil_usage"; pub const ImageStencilUsageCreateInfoEXT = ImageStencilUsageCreateInfo; - pub const EXT_validation_features = 1; pub const EXT_VALIDATION_FEATURES_SPEC_VERSION = 2; pub const EXT_VALIDATION_FEATURES_EXTENSION_NAME = "VK_EXT_validation_features"; @@ -15592,7 +15436,6 @@ pub const ValidationFeaturesEXT = extern struct { pDisabledValidationFeatures: [*]const ValidationFeatureDisableEXT = undefined, }; - pub const NV_cooperative_matrix = 1; pub const NV_COOPERATIVE_MATRIX_SPEC_VERSION = 1; pub const NV_COOPERATIVE_MATRIX_EXTENSION_NAME = "VK_NV_cooperative_matrix"; @@ -15656,11 +15499,11 @@ pub const GetPhysicalDeviceCooperativeMatrixPropertiesNVResult = struct { result: Result, properties: []CooperativeMatrixPropertiesNV, }; -pub inline fn GetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice: PhysicalDevice, properties: []CooperativeMatrixPropertiesNV) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceCooperativeMatrixPropertiesNVResult { +pub inline fn GetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice: PhysicalDevice, properties: []CooperativeMatrixPropertiesNV) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceCooperativeMatrixPropertiesNVResult { var returnValues: GetPhysicalDeviceCooperativeMatrixPropertiesNVResult = undefined; - var propertyCount: u32 = @intCast(u32, properties.len); + var propertyCount: u32 = @as(u32, @intCast(properties.len)); const result = vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice, &propertyCount, properties.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -15671,10 +15514,10 @@ pub inline fn GetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice: Phy returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceCooperativeMatrixPropertiesCountNV(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceCooperativeMatrixPropertiesCountNV(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_propertyCount: u32 = undefined; const result = vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice, &out_propertyCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -15684,7 +15527,6 @@ pub inline fn GetPhysicalDeviceCooperativeMatrixPropertiesCountNV(physicalDevice return out_propertyCount; } - pub const NV_coverage_reduction_mode = 1; pub const NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION = 1; pub const NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME = "VK_NV_coverage_reduction_mode"; @@ -15732,11 +15574,11 @@ pub const GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNVResult result: Result, combinations: []FramebufferMixedSamplesCombinationNV, }; -pub inline fn GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice: PhysicalDevice, combinations: []FramebufferMixedSamplesCombinationNV) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNVResult { +pub inline fn GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice: PhysicalDevice, combinations: []FramebufferMixedSamplesCombinationNV) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNVResult { var returnValues: GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNVResult = undefined; - var combinationCount: u32 = @intCast(u32, combinations.len); + var combinationCount: u32 = @as(u32, @intCast(combinations.len)); const result = vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice, &combinationCount, combinations.ptr); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -15747,10 +15589,10 @@ pub inline fn GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(ph returnValues.result = result; return returnValues; } -pub inline fn GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsCountNV(physicalDevice: PhysicalDevice) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!u32 { +pub inline fn GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsCountNV(physicalDevice: PhysicalDevice) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!u32 { var out_combinationCount: u32 = undefined; const result = vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice, &out_combinationCount, null); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -15760,7 +15602,6 @@ pub inline fn GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsCount return out_combinationCount; } - pub const EXT_fragment_shader_interlock = 1; pub const EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION = 1; pub const EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME = "VK_EXT_fragment_shader_interlock"; @@ -15773,7 +15614,6 @@ pub const PhysicalDeviceFragmentShaderInterlockFeaturesEXT = extern struct { fragmentShaderShadingRateInterlock: Bool32, }; - pub const EXT_ycbcr_image_arrays = 1; pub const EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION = 1; pub const EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME = "VK_EXT_ycbcr_image_arrays"; @@ -15784,7 +15624,6 @@ pub const PhysicalDeviceYcbcrImageArraysFeaturesEXT = extern struct { ycbcrImageArrays: Bool32, }; - pub const EXT_headless_surface = 1; pub const EXT_HEADLESS_SURFACE_SPEC_VERSION = 1; pub const EXT_HEADLESS_SURFACE_EXTENSION_NAME = "VK_EXT_headless_surface"; @@ -15807,10 +15646,10 @@ pub extern fn vkCreateHeadlessSurfaceEXT( pSurface: *SurfaceKHR, ) callconv(CallConv) Result; -pub inline fn CreateHeadlessSurfaceEXT(instance: Instance, createInfo: HeadlessSurfaceCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{VK_OUT_OF_HOST_MEMORY,VK_OUT_OF_DEVICE_MEMORY,VK_UNDOCUMENTED_ERROR}!SurfaceKHR { +pub inline fn CreateHeadlessSurfaceEXT(instance: Instance, createInfo: HeadlessSurfaceCreateInfoEXT, pAllocator: ?*const AllocationCallbacks) error{ VK_OUT_OF_HOST_MEMORY, VK_OUT_OF_DEVICE_MEMORY, VK_UNDOCUMENTED_ERROR }!SurfaceKHR { var out_surface: SurfaceKHR = undefined; const result = vkCreateHeadlessSurfaceEXT(instance, &createInfo, pAllocator, &out_surface); - if (@bitCast(c_int, result) < 0) { + if (@as(c_int, @intFromEnum(result)) < 0) { return switch (result) { .ERROR_OUT_OF_HOST_MEMORY => error.VK_OUT_OF_HOST_MEMORY, .ERROR_OUT_OF_DEVICE_MEMORY => error.VK_OUT_OF_DEVICE_MEMORY, @@ -15820,7 +15659,6 @@ pub inline fn CreateHeadlessSurfaceEXT(instance: Instance, createInfo: HeadlessS return out_surface; } - pub const EXT_line_rasterization = 1; pub const EXT_LINE_RASTERIZATION_SPEC_VERSION = 1; pub const EXT_LINE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_line_rasterization"; @@ -15867,7 +15705,6 @@ pub extern fn vkCmdSetLineStippleEXT( pub const CmdSetLineStippleEXT = vkCmdSetLineStippleEXT; - pub const EXT_host_query_reset = 1; pub const EXT_HOST_QUERY_RESET_SPEC_VERSION = 1; pub const EXT_HOST_QUERY_RESET_EXTENSION_NAME = "VK_EXT_host_query_reset"; @@ -15883,7 +15720,6 @@ pub extern fn vkResetQueryPoolEXT( pub const ResetQueryPoolEXT = vkResetQueryPoolEXT; - pub const EXT_index_type_uint8 = 1; pub const EXT_INDEX_TYPE_UINT8_SPEC_VERSION = 1; pub const EXT_INDEX_TYPE_UINT8_EXTENSION_NAME = "VK_EXT_index_type_uint8"; @@ -15894,7 +15730,6 @@ pub const PhysicalDeviceIndexTypeUint8FeaturesEXT = extern struct { indexTypeUint8: Bool32, }; - pub const EXT_shader_demote_to_helper_invocation = 1; pub const EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION = 1; pub const EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME = "VK_EXT_shader_demote_to_helper_invocation"; @@ -15905,7 +15740,6 @@ pub const PhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT = extern struc shaderDemoteToHelperInvocation: Bool32, }; - pub const EXT_texel_buffer_alignment = 1; pub const EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION = 1; pub const EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME = "VK_EXT_texel_buffer_alignment"; @@ -15925,8 +15759,6 @@ pub const PhysicalDeviceTexelBufferAlignmentPropertiesEXT = extern struct { uniformTexelBufferOffsetSingleTexelAlignment: Bool32, }; - pub const GOOGLE_user_type = 1; pub const GOOGLE_USER_TYPE_SPEC_VERSION = 1; pub const GOOGLE_USER_TYPE_EXTENSION_NAME = "VK_GOOGLE_user_type"; - diff --git a/src/autogui.zig b/src/autogui.zig index 66f4d1c..3c14185 100644 --- a/src/autogui.zig +++ b/src/autogui.zig @@ -42,7 +42,7 @@ pub fn drawStructUI(comptime DataType: type, dataPtr: *const DataType, arena: Al dataPtr.drawUI(context); } else { inline for (info.fields) |field| { - drawFieldUI(field.field_type, &@field(dataPtr, field.name), nullTerm(field.name), arena); + drawFieldUI(field.type, &@field(dataPtr, field.name), nullTerm(field.name), arena); } } }, @@ -82,9 +82,9 @@ pub fn drawFieldUI(comptime FieldType: type, fieldPtr: anytype, name: [:0]const ig.NextColumn(); ig.AlignTextToFramePadding(); if (info.signedness == .signed) { - ig.Text("%lld (%s)", @intCast(isize, fieldPtr.*), @typeName(FieldType)); + ig.Text("%lld (%s)", @as(isize, @intCast(fieldPtr.*)), @typeName(FieldType)); } else { - ig.Text("%llu (%s)", @intCast(usize, fieldPtr.*), @typeName(FieldType)); + ig.Text("%llu (%s)", @as(usize, @intCast(fieldPtr.*)), @typeName(FieldType)); } ig.NextColumn(); }, @@ -192,7 +192,7 @@ pub fn drawSliceFieldUI(comptime DataType: type, slice: []const DataType, name: if (@typeInfo(NextDisplayType) == .Struct and slice.len == 1) { drawStructUI(DataType, &slice[0], arena); } else { - for (slice) |*item, i| { + for (slice, 0..) |*item, i| { // TODO: Put null-terminated printing into const itemName: [:0]const u8 = if (allocPrintZ(arena, "[{}]", .{i})) |str| str else |_| ""; drawFieldUI(DataType, item, itemName, arena); diff --git a/src/engine.zig b/src/engine.zig index 92d55c5..77c698a 100644 --- a/src/engine.zig +++ b/src/engine.zig @@ -66,6 +66,6 @@ pub fn endFrame() void {} // ----------------------- Internal functions ------------------------- -fn glfw_error_callback(err: c_int, description: ?[*:0]const u8) callconv(.C) void { +fn glfw_error_callback(err: c_int, description: [*c]const u8) callconv(.C) void { std.debug.print("Glfw Error {}: {s}\n", .{ err, std.mem.span(description.?) }); } diff --git a/src/gltf_wrap.zig b/src/gltf_wrap.zig index 2eb308d..b9d9795 100644 --- a/src/gltf_wrap.zig +++ b/src/gltf_wrap.zig @@ -199,17 +199,17 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { data.scenes = try allocator.alloc(Scene, rawData.scenes_count); data.animations = try allocator.alloc(Animation, rawData.animations_count); - for (data.meshes) |*mesh, i| { + for (data.meshes, 0..) |*mesh, i| { const rawMesh = &rawData.meshes[i]; const primitives = try allocator.alloc(Primitive, rawMesh.primitives_count); - for (primitives) |*prim, j| { + for (primitives, 0..) |*prim, j| { const rawPrim = &rawMesh.primitives[j]; const attributes = try copyAttributes(data, rawData, rawPrim.attributes, rawPrim.attributes_count); const targets = try allocator.alloc(MorphTarget, rawPrim.targets_count); - for (targets) |*target, k| { + for (targets, 0..) |*target, k| { const rawTarget = &rawPrim.targets[k]; const targetAttributes = try copyAttributes(data, rawData, rawTarget.attributes, rawTarget.attributes_count); target.* = MorphTarget{ @@ -228,7 +228,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { } const names = try allocator.alloc([:0]const u8, rawMesh.target_names_count); - for (names) |*name, j| name.* = cstr(rawMesh.target_names[j]); + for (names, 0..) |*name, j| name.* = cstr(rawMesh.target_names[j]); mesh.* = Mesh{ .raw = rawMesh, @@ -239,7 +239,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.materials) |*material, i| { + for (data.materials, 0..) |*material, i| { const rawMat = &rawData.materials[i]; material.* = Material{ @@ -264,7 +264,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { } } - for (data.accessors) |*accessor, i| { + for (data.accessors, 0..) |*accessor, i| { const rawAcc = &rawData.accessors[i]; accessor.* = Accessor{ @@ -280,7 +280,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { } } - for (data.buffer_views) |*view, i| { + for (data.buffer_views, 0..) |*view, i| { const rawView = &rawData.buffer_views[i]; view.* = BufferView{ .raw = rawView, @@ -288,14 +288,14 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.buffers) |*buffer, i| { + for (data.buffers, 0..) |*buffer, i| { const rawBuf = &rawData.buffers[i]; buffer.* = Buffer{ .raw = rawBuf, }; } - for (data.images) |*image, i| { + for (data.images, 0..) |*image, i| { const rawImage = &rawData.images[i]; image.* = Image{ .raw = rawImage, @@ -304,7 +304,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.textures) |*tex, i| { + for (data.textures, 0..) |*tex, i| { const rawTex = &rawData.textures[i]; tex.* = Texture{ .raw = rawTex, @@ -314,15 +314,15 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.samplers) |*sampler, i| { + for (data.samplers, 0..) |*sampler, i| { sampler.* = Sampler{ .raw = &rawData.samplers[i] }; } - for (data.skins) |*skin, i| { + for (data.skins, 0..) |*skin, i| { const rawSkin = &rawData.skins[i]; const joints = try allocator.alloc(*Node, rawSkin.joints_count); - for (joints) |*joint, j| joint.* = fixNonnull(rawSkin.joints[j], rawData.nodes, data.nodes); + for (joints, 0..) |*joint, j| joint.* = fixNonnull(rawSkin.joints[j], rawData.nodes, data.nodes); skin.* = Skin{ .raw = rawSkin, @@ -333,7 +333,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.cameras) |*cam, i| { + for (data.cameras, 0..) |*cam, i| { const rawCam = &rawData.cameras[i]; cam.* = Camera{ .raw = rawCam, @@ -341,7 +341,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.lights) |*light, i| { + for (data.lights, 0..) |*light, i| { const rawLight = &rawData.lights[i]; light.* = Light{ .raw = rawLight, @@ -349,11 +349,11 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.nodes) |*node, i| { + for (data.nodes, 0..) |*node, i| { const rawNode = &rawData.nodes[i]; const children = try allocator.alloc(*Node, rawNode.children_count); - for (children) |*child, j| child.* = fixNonnull(rawNode.children[j], rawData.nodes, data.nodes); + for (children, 0..) |*child, j| child.* = fixNonnull(rawNode.children[j], rawData.nodes, data.nodes); node.* = Node{ .raw = rawNode, @@ -367,11 +367,11 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (data.scenes) |*scene, i| { + for (data.scenes, 0..) |*scene, i| { const rawScene = &rawData.scenes[i]; const nodes = try allocator.alloc(*Node, rawScene.nodes_count); - for (nodes) |*node, j| node.* = fixNonnull(rawScene.nodes[j], rawData.nodes, data.nodes); + for (nodes, 0..) |*node, j| node.* = fixNonnull(rawScene.nodes[j], rawData.nodes, data.nodes); scene.* = Scene{ .raw = rawScene, @@ -382,13 +382,13 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { data.scene = fixOptional(rawData.scene, rawData.scenes, data.scenes); - for (data.animations) |*anim, i| { + for (data.animations, 0..) |*anim, i| { const rawAnim = &rawData.animations[i]; const samplers = try allocator.alloc(AnimationSampler, rawAnim.samplers_count); const channels = try allocator.alloc(AnimationChannel, rawAnim.channels_count); - for (samplers) |*sampler, j| { + for (samplers, 0..) |*sampler, j| { const rawSampler = &rawAnim.samplers[j]; sampler.* = AnimationSampler{ .raw = rawSampler, @@ -397,7 +397,7 @@ pub fn wrap(rawData: *cgltf.Data, parentAllocator: std.mem.Allocator) !*Data { }; } - for (channels) |*channel, j| { + for (channels, 0..) |*channel, j| { const rawChannel = &rawAnim.channels[j]; channel.* = AnimationChannel{ .raw = rawChannel, @@ -425,7 +425,7 @@ fn cstr(dataOpt: ?[*:0]const u8) [:0]const u8 { fn copyAttributes(data: *Data, rawData: *cgltf.Data, rawAttributes: [*]cgltf.Attribute, rawCount: usize) ![]Attribute { const attributes = try data.allocator.allocator().alloc(Attribute, rawCount); - for (attributes) |*attr, i| { + for (attributes, 0..) |*attr, i| { const rawAttr = &rawAttributes[i]; attr.* = Attribute{ .raw = rawAttr, @@ -451,6 +451,6 @@ fn fixOptional(pointer: anytype, rawArray: anytype, wrapArray: anytype) ?*Child( } fn fixNonnull(pointer: anytype, rawArray: anytype, wrapArray: anytype) *Child(@TypeOf(wrapArray.ptr)) { - const diff = @divExact(@ptrToInt(pointer) - @ptrToInt(rawArray), @sizeOf(Child(@TypeOf(rawArray)))); + const diff = @divExact(@intFromPtr(pointer) - @intFromPtr(rawArray), @sizeOf(Child(@TypeOf(rawArray)))); return &wrapArray[diff]; } diff --git a/src/imgui_impl_glfw.zig b/src/imgui_impl_glfw.zig index dbf4e3b..aea3006 100644 --- a/src/imgui_impl_glfw.zig +++ b/src/imgui_impl_glfw.zig @@ -1,7 +1,7 @@ const std = @import("std"); const builtin = @import("builtin"); const imgui = @import("imgui"); -const glfw = @import("../include/glfw.zig"); +const glfw = @import("glfw"); const assert = std.debug.assert; const GLFW_HAS_WINDOW_TOPMOST = (glfw.GLFW_VERSION_MAJOR * 1000 + glfw.GLFW_VERSION_MINOR * 100 >= 3200); // 3.2+ GLFW_FLOATING @@ -16,7 +16,7 @@ const GLFW_HAS_GET_KEY_NAME = (glfw.GLFW_VERSION_MAJOR * 1000 + glfw.GLFW_VERSIO const IS_EMSCRIPTEN = false; // GLFW data -const GlfwClientApi = enum (u32) { +const GlfwClientApi = enum(u32) { Unknown, OpenGL, Vulkan, @@ -28,7 +28,7 @@ const Data = extern struct { ClientApi: GlfwClientApi = .Unknown, Time: f64 = 0, MouseWindow: ?*glfw.GLFWwindow = null, - MouseCursors: [imgui.MouseCursor.COUNT]?*glfw.GLFWcursor = [_]?*glfw.GLFWcursor{ null } ** imgui.MouseCursor.COUNT, + MouseCursors: [imgui.MouseCursor.COUNT]?*glfw.GLFWcursor = [_]?*glfw.GLFWcursor{null} ** imgui.MouseCursor.COUNT, LastValidMousePos: imgui.Vec2 = .{ .x = 0, .y = 0 }, InstalledCallbacks: bool = false, @@ -51,16 +51,21 @@ const Data = extern struct { // - Otherwise we may need to store a GLFWWindow* -> ImGuiContext* map and handle this in the backend, adding a little bit of extra complexity to it. // FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context. fn GetBackendData() ?*Data { - return if (imgui.GetCurrentContext() != null) @ptrCast(?*Data, @alignCast(@alignOf(Data), imgui.GetIO().BackendPlatformUserData)) else null; + if (imgui.GetCurrentContext() != null) { + const result: ?*Data = @ptrCast(@alignCast(imgui.GetIO().BackendPlatformUserData)); + return result; + } else { + return null; + } } // Functions fn GetClipboardText(user_data: ?*anyopaque) callconv(.C) ?[*:0]const u8 { - return glfw.glfwGetClipboardString(@ptrCast(?*glfw.GLFWwindow, user_data)); + return glfw.glfwGetClipboardString(@as(?*glfw.GLFWwindow, @ptrCast(user_data))); } fn SetClipboardText(user_data: ?*anyopaque, text: ?[*:0]const u8) callconv(.C) void { - glfw.glfwSetClipboardString(@ptrCast(?*glfw.GLFWwindow, user_data), text); + glfw.glfwSetClipboardString(@as(?*glfw.GLFWwindow, @ptrCast(user_data)), text); } fn KeyToImGuiKey(key: i32) imgui.Key { @@ -212,7 +217,7 @@ pub fn ScrollCallback(window: ?*glfw.GLFWwindow, xoffset: f64, yoffset: f64) cal bd.PrevUserCallbackScroll.?(window, xoffset, yoffset); const io = imgui.GetIO(); - io.AddMouseWheelEvent(@floatCast(f32, xoffset), @floatCast(f32, yoffset)); + io.AddMouseWheelEvent(@as(f32, @floatCast(xoffset)), @as(f32, @floatCast(yoffset))); } fn TranslateUntranslatedKey(raw_key: i32, scancode: i32) i32 { @@ -229,10 +234,15 @@ fn TranslateUntranslatedKey(raw_key: i32, scancode: i32) i32 { const char_names = "`-=[]\\,;\'./"; const char_keys = [_]u8{ glfw.GLFW_KEY_GRAVE_ACCENT, glfw.GLFW_KEY_MINUS, glfw.GLFW_KEY_EQUAL, glfw.GLFW_KEY_LEFT_BRACKET, glfw.GLFW_KEY_RIGHT_BRACKET, glfw.GLFW_KEY_BACKSLASH, glfw.GLFW_KEY_COMMA, glfw.GLFW_KEY_SEMICOLON, glfw.GLFW_KEY_APOSTROPHE, glfw.GLFW_KEY_PERIOD, glfw.GLFW_KEY_SLASH }; comptime assert(char_names.len == char_keys.len); - if (key_name[0] >= '0' and key_name[0] <= '9') { return glfw.GLFW_KEY_0 + (key_name[0] - '0'); } - else if (key_name[0] >= 'A' and key_name[0] <= 'Z') { return glfw.GLFW_KEY_A + (key_name[0] - 'A'); } - else if (key_name[0] >= 'a' and key_name[0] <= 'z') { return glfw.GLFW_KEY_A + (key_name[0] - 'a'); } - else if (std.mem.indexOfScalar(u8, char_names, key_name[0])) |idx| { return char_keys[idx]; } + if (key_name[0] >= '0' and key_name[0] <= '9') { + return glfw.GLFW_KEY_0 + (key_name[0] - '0'); + } else if (key_name[0] >= 'A' and key_name[0] <= 'Z') { + return glfw.GLFW_KEY_A + (key_name[0] - 'A'); + } else if (key_name[0] >= 'a' and key_name[0] <= 'z') { + return glfw.GLFW_KEY_A + (key_name[0] - 'a'); + } else if (std.mem.indexOfScalar(u8, char_names, key_name[0])) |idx| { + return char_keys[idx]; + } } } // if (action == GLFW_PRESS) std.debug.print("key {} scancode {} name '{s}'\n", .{ key, scancode, key_name }); @@ -277,8 +287,8 @@ pub fn CursorPosCallback(window: ?*glfw.GLFWwindow, x: f64, y: f64) callconv(.C) bd.PrevUserCallbackCursorPos.?(window, x, y); const io = imgui.GetIO(); - io.AddMousePosEvent(@floatCast(f32, x), @floatCast(f32, y)); - bd.LastValidMousePos = .{ .x = @floatCast(f32, x), .y = @floatCast(f32, y) }; + io.AddMousePosEvent(@as(f32, @floatCast(x)), @as(f32, @floatCast(y))); + bd.LastValidMousePos = .{ .x = @as(f32, @floatCast(x)), .y = @as(f32, @floatCast(y)) }; } // Workaround: X11 seems to send spurious Leave/Enter events which would make us lose our position, @@ -357,11 +367,12 @@ pub fn RestoreCallbacks(window: ?*glfw.GLFWwindow) void { } fn Init(window: ?*glfw.GLFWwindow, install_callbacks: bool, client_api: GlfwClientApi) bool { + std.debug.print("imgui: GLFW backend\n", .{}); const io = imgui.GetIO(); assert(io.BackendPlatformUserData == null); // Already initialized a platform backend! // Setup backend capabilities flags - const bd = @ptrCast(*Data, @alignCast(@alignOf(Data), imgui.MemAlloc(@sizeOf(Data)))); + const bd = @as(*Data, @ptrCast(@alignCast(imgui.MemAlloc(@sizeOf(Data))))); bd.* = .{ .Window = window, .Time = 0, @@ -370,8 +381,8 @@ fn Init(window: ?*glfw.GLFWwindow, install_callbacks: bool, client_api: GlfwClie io.BackendPlatformUserData = bd; io.BackendPlatformName = "imgui_impl_glfw"; - io.BackendFlags.HasMouseCursors = true; // We can honor GetMouseCursor() values (optional) - io.BackendFlags.HasSetMousePos = true; // We can honor io.WantSetMousePos requests (optional, rarely used) + io.BackendFlags.HasMouseCursors = true; // We can honor GetMouseCursor() values (optional) + io.BackendFlags.HasSetMousePos = true; // We can honor io.WantSetMousePos requests (optional, rarely used) io.SetClipboardTextFn = SetClipboardText; io.GetClipboardTextFn = GetClipboardText; @@ -387,21 +398,21 @@ fn Init(window: ?*glfw.GLFWwindow, install_callbacks: bool, client_api: GlfwClie // GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting. // Missing cursors will return NULL and our _UpdateMouseCursor() function will use the Arrow cursor instead.) const prev_error_callback = glfw.glfwSetErrorCallback(null); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.Arrow)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.TextInput)] = glfw.glfwCreateStandardCursor(glfw.GLFW_IBEAM_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNS)] = glfw.glfwCreateStandardCursor(glfw.GLFW_VRESIZE_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeEW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_HRESIZE_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.Hand)] = glfw.glfwCreateStandardCursor(glfw.GLFW_HAND_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.Arrow)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.TextInput)] = glfw.glfwCreateStandardCursor(glfw.GLFW_IBEAM_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeNS)] = glfw.glfwCreateStandardCursor(glfw.GLFW_VRESIZE_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeEW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_HRESIZE_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.Hand)] = glfw.glfwCreateStandardCursor(glfw.GLFW_HAND_CURSOR); if (GLFW_HAS_NEW_CURSORS) { - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeAll)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_ALL_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNESW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_NESW_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNWSE)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_NWSE_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.NotAllowed)] = glfw.glfwCreateStandardCursor(glfw.GLFW_NOT_ALLOWED_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeAll)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_ALL_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeNESW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_NESW_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeNWSE)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_NWSE_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.NotAllowed)] = glfw.glfwCreateStandardCursor(glfw.GLFW_NOT_ALLOWED_CURSOR); } else { - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeAll)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNESW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNWSE)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); - bd.MouseCursors[@enumToInt(imgui.MouseCursor.NotAllowed)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeAll)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeNESW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.ResizeNWSE)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); + bd.MouseCursors[@intFromEnum(imgui.MouseCursor.NotAllowed)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR); } _ = glfw.glfwSetErrorCallback(prev_error_callback); @@ -444,8 +455,7 @@ fn UpdateMouseData() void { const bd = GetBackendData().?; const io = imgui.GetIO(); - const is_app_focused = if (IS_EMSCRIPTEN) true - else (glfw.glfwGetWindowAttrib(bd.Window, glfw.GLFW_FOCUSED) != 0); + const is_app_focused = if (IS_EMSCRIPTEN) true else (glfw.glfwGetWindowAttrib(bd.Window, glfw.GLFW_FOCUSED) != 0); if (is_app_focused) { // (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user) if (io.WantSetMousePos) @@ -456,8 +466,8 @@ fn UpdateMouseData() void { var mouse_x: f64 = 0; var mouse_y: f64 = 0; glfw.glfwGetCursorPos(bd.Window, &mouse_x, &mouse_y); - io.AddMousePosEvent(@floatCast(f32, mouse_x), @floatCast(f32, mouse_y)); - bd.LastValidMousePos = .{ .x = @floatCast(f32, mouse_x), .y = @floatCast(f32, mouse_y) }; + io.AddMousePosEvent(@as(f32, @floatCast(mouse_x)), @as(f32, @floatCast(mouse_y))); + bd.LastValidMousePos = .{ .x = @as(f32, @floatCast(mouse_x)), .y = @as(f32, @floatCast(mouse_y)) }; } } } @@ -475,13 +485,15 @@ fn UpdateMouseCursor() void { } else { // Show OS mouse cursor // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here. - glfw.glfwSetCursor(bd.Window, bd.MouseCursors[@intCast(usize, @enumToInt(imgui_cursor))] orelse bd.MouseCursors[@intCast(usize, @enumToInt(imgui.MouseCursor.Arrow))]); + glfw.glfwSetCursor(bd.Window, bd.MouseCursors[@as(usize, @intCast(@intFromEnum(imgui_cursor)))] orelse bd.MouseCursors[@as(usize, @intCast(@intFromEnum(imgui.MouseCursor.Arrow)))]); glfw.glfwSetInputMode(bd.Window, glfw.GLFW_CURSOR, glfw.GLFW_CURSOR_NORMAL); } } // Update gamepad inputs -inline fn Saturate(v: f32) f32 { return if (v < 0) 0 else if (v > 1) 1 else v; } +inline fn Saturate(v: f32) f32 { + return if (v < 0) 0 else if (v > 1) 1 else v; +} fn UpdateGamepads() void { const io = imgui.GetIO(); @@ -491,30 +503,30 @@ fn UpdateGamepads() void { const InputKind = enum { Button, Analog }; const Mapping = struct { kind: InputKind, key: imgui.Key, btn: u32, low: f32 = 0, high: f32 = 0 }; const mappings = [_]Mapping{ - .{ .kind = .Button, .key = .GamepadStart, .btn = glfw.GLFW_GAMEPAD_BUTTON_START }, - .{ .kind = .Button, .key = .GamepadBack, .btn = glfw.GLFW_GAMEPAD_BUTTON_BACK }, - .{ .kind = .Button, .key = .GamepadFaceDown, .btn = glfw.GLFW_GAMEPAD_BUTTON_A }, // Xbox A, PS Cross - .{ .kind = .Button, .key = .GamepadFaceRight, .btn = glfw.GLFW_GAMEPAD_BUTTON_B }, // Xbox B, PS Circle - .{ .kind = .Button, .key = .GamepadFaceLeft, .btn = glfw.GLFW_GAMEPAD_BUTTON_X }, // Xbox X, PS Square - .{ .kind = .Button, .key = .GamepadFaceUp, .btn = glfw.GLFW_GAMEPAD_BUTTON_Y }, // Xbox Y, PS Triangle - .{ .kind = .Button, .key = .GamepadDpadLeft, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_LEFT }, - .{ .kind = .Button, .key = .GamepadDpadRight, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT }, - .{ .kind = .Button, .key = .GamepadDpadUp, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_UP }, - .{ .kind = .Button, .key = .GamepadDpadDown, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_DOWN }, - .{ .kind = .Button, .key = .GamepadL1, .btn = glfw.GLFW_GAMEPAD_BUTTON_LEFT_BUMPER }, - .{ .kind = .Button, .key = .GamepadR1, .btn = glfw.GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER }, - .{ .kind = .Analog, .key = .GamepadL2, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, .low = -0.75, .high = 1.0 }, - .{ .kind = .Analog, .key = .GamepadR2, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, .low = -0.75, .high = 1.0 }, - .{ .kind = .Button, .key = .GamepadL3, .btn = glfw.GLFW_GAMEPAD_BUTTON_LEFT_THUMB }, - .{ .kind = .Button, .key = .GamepadR3, .btn = glfw.GLFW_GAMEPAD_BUTTON_RIGHT_THUMB }, - .{ .kind = .Analog, .key = .GamepadLStickLeft, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_X, .low = -0.25, .high = -1.0 }, - .{ .kind = .Analog, .key = .GamepadLStickRight, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_X, .low = 0.25, .high = 1.0 }, - .{ .kind = .Analog, .key = .GamepadLStickUp, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_Y, .low = -0.25, .high = -1.0 }, - .{ .kind = .Analog, .key = .GamepadLStickDown, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_Y, .low = 0.25, .high = 1.0 }, - .{ .kind = .Analog, .key = .GamepadRStickLeft, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_X, .low = -0.25, .high = -1.0 }, - .{ .kind = .Analog, .key = .GamepadRStickRight, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_X, .low = 0.25, .high = 1.0 }, - .{ .kind = .Analog, .key = .GamepadRStickUp, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_Y, .low = -0.25, .high = -1.0 }, - .{ .kind = .Analog, .key = .GamepadRStickDown, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_Y, .low = 0.25, .high = 1.0 }, + .{ .kind = .Button, .key = .GamepadStart, .btn = glfw.GLFW_GAMEPAD_BUTTON_START }, + .{ .kind = .Button, .key = .GamepadBack, .btn = glfw.GLFW_GAMEPAD_BUTTON_BACK }, + .{ .kind = .Button, .key = .GamepadFaceDown, .btn = glfw.GLFW_GAMEPAD_BUTTON_A }, // Xbox A, PS Cross + .{ .kind = .Button, .key = .GamepadFaceRight, .btn = glfw.GLFW_GAMEPAD_BUTTON_B }, // Xbox B, PS Circle + .{ .kind = .Button, .key = .GamepadFaceLeft, .btn = glfw.GLFW_GAMEPAD_BUTTON_X }, // Xbox X, PS Square + .{ .kind = .Button, .key = .GamepadFaceUp, .btn = glfw.GLFW_GAMEPAD_BUTTON_Y }, // Xbox Y, PS Triangle + .{ .kind = .Button, .key = .GamepadDpadLeft, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_LEFT }, + .{ .kind = .Button, .key = .GamepadDpadRight, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT }, + .{ .kind = .Button, .key = .GamepadDpadUp, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_UP }, + .{ .kind = .Button, .key = .GamepadDpadDown, .btn = glfw.GLFW_GAMEPAD_BUTTON_DPAD_DOWN }, + .{ .kind = .Button, .key = .GamepadL1, .btn = glfw.GLFW_GAMEPAD_BUTTON_LEFT_BUMPER }, + .{ .kind = .Button, .key = .GamepadR1, .btn = glfw.GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER }, + .{ .kind = .Analog, .key = .GamepadL2, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, .low = -0.75, .high = 1.0 }, + .{ .kind = .Analog, .key = .GamepadR2, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, .low = -0.75, .high = 1.0 }, + .{ .kind = .Button, .key = .GamepadL3, .btn = glfw.GLFW_GAMEPAD_BUTTON_LEFT_THUMB }, + .{ .kind = .Button, .key = .GamepadR3, .btn = glfw.GLFW_GAMEPAD_BUTTON_RIGHT_THUMB }, + .{ .kind = .Analog, .key = .GamepadLStickLeft, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_X, .low = -0.25, .high = -1.0 }, + .{ .kind = .Analog, .key = .GamepadLStickRight, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_X, .low = 0.25, .high = 1.0 }, + .{ .kind = .Analog, .key = .GamepadLStickUp, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_Y, .low = -0.25, .high = -1.0 }, + .{ .kind = .Analog, .key = .GamepadLStickDown, .btn = glfw.GLFW_GAMEPAD_AXIS_LEFT_Y, .low = 0.25, .high = 1.0 }, + .{ .kind = .Analog, .key = .GamepadRStickLeft, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_X, .low = -0.25, .high = -1.0 }, + .{ .kind = .Analog, .key = .GamepadRStickRight, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_X, .low = 0.25, .high = 1.0 }, + .{ .kind = .Analog, .key = .GamepadRStickUp, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_Y, .low = -0.25, .high = -1.0 }, + .{ .kind = .Analog, .key = .GamepadRStickDown, .btn = glfw.GLFW_GAMEPAD_AXIS_RIGHT_Y, .low = 0.25, .high = 1.0 }, }; io.BackendFlags.HasGamepad = false; @@ -537,7 +549,7 @@ fn UpdateGamepads() void { const buttons = glfw.glfwGetJoystickButtons(glfw.GLFW_JOYSTICK_1, &buttons_count); if (axes_count == 0 or buttons_count == 0) return; - + inline for (mappings) |m| switch (m.kind) { .Button => io.AddKeyEvent(m.key, m.btn > buttons_count and buttons.?[m.btn] != 0), .Analog => { @@ -561,17 +573,17 @@ pub fn NewFrame() void { var display_h: c_int = 0; glfw.glfwGetWindowSize(bd.Window, &w, &h); glfw.glfwGetFramebufferSize(bd.Window, &display_w, &display_h); - io.DisplaySize = .{ .x = @intToFloat(f32, w), .y = @intToFloat(f32, h) }; + io.DisplaySize = .{ .x = @as(f32, @floatFromInt(w)), .y = @as(f32, @floatFromInt(h)) }; if (w > 0 and h > 0) { io.DisplayFramebufferScale = .{ - .x = @intToFloat(f32, display_w) / @intToFloat(f32, w), - .y = @intToFloat(f32, display_h) / @intToFloat(f32, h), + .x = @as(f32, @floatFromInt(display_w)) / @as(f32, @floatFromInt(w)), + .y = @as(f32, @floatFromInt(display_h)) / @as(f32, @floatFromInt(h)), }; } // Setup time step const current_time = glfw.glfwGetTime(); - io.DeltaTime = if (bd.Time > 0) @floatCast(f32, current_time - bd.Time) else (1.0 / 60.0); + io.DeltaTime = if (bd.Time > 0) @as(f32, @floatCast(current_time - bd.Time)) else (1.0 / 60.0); bd.Time = current_time; UpdateMouseData(); diff --git a/src/imgui_impl_vulkan.zig b/src/imgui_impl_vulkan.zig index 2374474..5df4725 100644 --- a/src/imgui_impl_vulkan.zig +++ b/src/imgui_impl_vulkan.zig @@ -46,7 +46,7 @@ const imgui = @import("imgui"); const std = @import("std"); -const vk = @import("../include/vk.zig"); +const vk = @import("vk"); const assert = std.debug.assert; const zig_allocator = std.heap.c_allocator; @@ -64,7 +64,7 @@ pub const InitInfo = struct { ImageCount: u32, // >= MinImageCount MSAASamples: vk.SampleCountFlags, // >= VK_SAMPLE_COUNT_1_BIT VkAllocator: ?*const vk.AllocationCallbacks, - CheckVkResultFn: ?fn (i32) callconv(.C) void = null, + CheckVkResultFn: ?*const fn (i32) callconv(.C) void = null, }; pub const Frame = struct { @@ -258,18 +258,20 @@ const __glsl_shader_frag_spv = [_]u32{ // It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts. // FIXME: multi-context support is not tested and probably dysfunctional in this backend. fn GetBackendData() ?*Data { - return if (imgui.GetCurrentContext() != null) - @ptrCast(?*Data, @alignCast(@alignOf(Data), imgui.GetIO().BackendRendererUserData)) - else null; + if (imgui.GetCurrentContext() != null) { + return @as(?*Data, @ptrCast(@alignCast(imgui.GetIO().BackendRendererUserData))); + } else { + return null; + } } pub fn MemoryType(properties: vk.MemoryPropertyFlags, type_bits: u32) ?u32 { const bd = GetBackendData().?; var v = &bd.VulkanInitInfo; var prop = vk.GetPhysicalDeviceMemoryProperties(v.PhysicalDevice); - for (prop.memoryTypes[0..prop.memoryTypeCount]) |memType, i| - if (memType.propertyFlags.hasAllSet(properties) and type_bits & (@as(u32, 1) << @intCast(u5, i)) != 0) - return @intCast(u32, i); + for (prop.memoryTypes[0..prop.memoryTypeCount], 0..) |memType, i| + if (memType.propertyFlags.hasAllSet(properties) and type_bits & (@as(u32, 1) << @as(u5, @intCast(i))) != 0) + return @as(u32, @intCast(i)); return null; // Unable to find memoryType } @@ -322,8 +324,8 @@ fn SetupRenderState(draw_data: *imgui.DrawData, pipeline: vk.Pipeline, command_b const viewport = vk.Viewport{ .x = 0, .y = 0, - .width = @intToFloat(f32, fb_width), - .height = @intToFloat(f32, fb_height), + .width = @as(f32, @floatFromInt(fb_width)), + .height = @as(f32, @floatFromInt(fb_height)), .minDepth = 0.0, .maxDepth = 1.0, }; @@ -349,8 +351,8 @@ fn SetupRenderState(draw_data: *imgui.DrawData, pipeline: vk.Pipeline, command_b // Render function pub fn RenderDrawData(draw_data: *imgui.DrawData, command_buffer: vk.CommandBuffer, opt_pipeline: vk.Pipeline) !void { // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) - const fb_width = @floatToInt(u32, draw_data.DisplaySize.x * draw_data.FramebufferScale.x); - const fb_height = @floatToInt(u32, draw_data.DisplaySize.y * draw_data.FramebufferScale.y); + const fb_width = @as(u32, @intFromFloat(draw_data.DisplaySize.x * draw_data.FramebufferScale.x)); + const fb_height = @as(u32, @intFromFloat(draw_data.DisplaySize.y * draw_data.FramebufferScale.y)); if (fb_width <= 0 or fb_height <= 0) return; @@ -368,13 +370,13 @@ pub fn RenderDrawData(draw_data: *imgui.DrawData, command_buffer: vk.CommandBuff } } assert(wrb.FrameRenderBuffers.len == v.ImageCount); - wrb.Index = (wrb.Index + 1) % @intCast(u32, wrb.FrameRenderBuffers.len); + wrb.Index = (wrb.Index + 1) % @as(u32, @intCast(wrb.FrameRenderBuffers.len)); const rb = &wrb.FrameRenderBuffers[wrb.Index]; if (draw_data.TotalVtxCount > 0) { // Create or resize the vertex/index buffers - var vertex_size = @intCast(usize, draw_data.TotalVtxCount) * @sizeOf(imgui.DrawVert); - var index_size = @intCast(usize, draw_data.TotalIdxCount) * @sizeOf(imgui.DrawIdx); + var vertex_size = @as(usize, @intCast(draw_data.TotalVtxCount)) * @sizeOf(imgui.DrawVert); + var index_size = @as(usize, @intCast(draw_data.TotalIdxCount)) * @sizeOf(imgui.DrawIdx); if (rb.VertexBuffer == .Null or rb.VertexBufferSize < vertex_size) try CreateOrResizeBuffer(&rb.VertexBuffer, &rb.VertexBufferMemory, &rb.VertexBufferSize, vertex_size, .{ .vertexBuffer = true }); if (rb.IndexBuffer == .Null or rb.IndexBufferSize < index_size) @@ -383,11 +385,11 @@ pub fn RenderDrawData(draw_data: *imgui.DrawData, command_buffer: vk.CommandBuff // Upload vertex/index data into a single contiguous GPU buffer var vtx_dst: [*]imgui.DrawVert = undefined; var idx_dst: [*]imgui.DrawIdx = undefined; - try vk.MapMemory(v.Device, rb.VertexBufferMemory, 0, vertex_size, .{}, @ptrCast(**anyopaque, &vtx_dst)); - try vk.MapMemory(v.Device, rb.IndexBufferMemory, 0, index_size, .{}, @ptrCast(**anyopaque, &idx_dst)); + try vk.MapMemory(v.Device, rb.VertexBufferMemory, 0, vertex_size, .{}, @as(**anyopaque, @ptrCast(&vtx_dst))); + try vk.MapMemory(v.Device, rb.IndexBufferMemory, 0, index_size, .{}, @as(**anyopaque, @ptrCast(&idx_dst))); var n: i32 = 0; while (n < draw_data.CmdListsCount) : (n += 1) { - const cmd_list = draw_data.CmdLists.?[@intCast(u32, n)]; + const cmd_list = draw_data.CmdLists.?[@as(u32, @intCast(n))]; std.mem.copy(imgui.DrawVert, vtx_dst[0..cmd_list.VtxBuffer.size()], cmd_list.VtxBuffer.items()); std.mem.copy(imgui.DrawIdx, idx_dst[0..cmd_list.IdxBuffer.size()], cmd_list.IdxBuffer.items()); vtx_dst += cmd_list.VtxBuffer.size(); @@ -424,7 +426,7 @@ pub fn RenderDrawData(draw_data: *imgui.DrawData, command_buffer: vk.CommandBuff var global_vtx_offset = @as(u32, 0); var global_idx_offset = @as(u32, 0); var n: usize = 0; - while (n < @intCast(usize, draw_data.CmdListsCount)) : (n += 1) { + while (n < @as(usize, @intCast(draw_data.CmdListsCount))) : (n += 1) { const cmd_list = draw_data.CmdLists.?[n]; for (cmd_list.CmdBuffer.items()) |*pcmd| { if (pcmd.UserCallback) |fnPtr| { @@ -447,8 +449,8 @@ pub fn RenderDrawData(draw_data: *imgui.DrawData, command_buffer: vk.CommandBuff }; // Clamp to viewport as vkCmdSetScissor() won't accept values that are off bounds - const fb_width_f = @intToFloat(f32, fb_width); - const fb_height_f = @intToFloat(f32, fb_height); + const fb_width_f = @as(f32, @floatFromInt(fb_width)); + const fb_height_f = @as(f32, @floatFromInt(fb_height)); if (clip_min.x < 0) clip_min.x = 0; if (clip_min.y < 0) clip_min.y = 0; if (clip_max.x > fb_width_f) clip_max.x = fb_width_f; @@ -459,27 +461,27 @@ pub fn RenderDrawData(draw_data: *imgui.DrawData, command_buffer: vk.CommandBuff // Apply scissor/clipping rectangle const scissor = vk.Rect2D{ .offset = vk.Offset2D{ - .x = @floatToInt(i32, clip_min.x), - .y = @floatToInt(i32, clip_min.y), + .x = @as(i32, @intFromFloat(clip_min.x)), + .y = @as(i32, @intFromFloat(clip_min.y)), }, .extent = vk.Extent2D{ - .width = @floatToInt(u32, clip_max.x - clip_min.x), - .height = @floatToInt(u32, clip_max.y - clip_min.y), + .width = @as(u32, @intFromFloat(clip_max.x - clip_min.x)), + .height = @as(u32, @intFromFloat(clip_max.y - clip_min.y)), }, }; vk.CmdSetScissor(command_buffer, 0, arrayPtr(&scissor)); - var desc_set = @intToEnum(vk.DescriptorSet, @ptrToInt(pcmd.TextureId)); + var desc_set = @as(vk.DescriptorSet, @enumFromInt(@intFromPtr(pcmd.TextureId))); if (@sizeOf(imgui.TextureID) < @sizeOf(u64)) { // We don't support texture switches if ImTextureID hasn't been redefined to be 64-bit. Do a flaky check that other textures haven't been used. - assert(@intToEnum(vk.DescriptorSet, @ptrToInt(pcmd.TextureId)) == bd.FontDescriptorSet); + assert(@as(vk.DescriptorSet, @enumFromInt(@intFromPtr(pcmd.TextureId))) == bd.FontDescriptorSet); desc_set = bd.FontDescriptorSet; } vk.CmdBindDescriptorSets(command_buffer, .GRAPHICS, bd.PipelineLayout, 0, arrayPtr(&desc_set), &[_]u32{}); // Draw - const idxStart = @intCast(u32, pcmd.IdxOffset + global_idx_offset); - const vtxStart = @intCast(i32, pcmd.VtxOffset + global_vtx_offset); + const idxStart = @as(u32, @intCast(pcmd.IdxOffset + global_idx_offset)); + const vtxStart = @as(i32, @intCast(pcmd.VtxOffset + global_vtx_offset)); vk.CmdDrawIndexed(command_buffer, pcmd.ElemCount, 1, idxStart, vtxStart, 0); } } @@ -510,7 +512,7 @@ pub fn CreateFontsTexture(command_buffer: vk.CommandBuffer) !void { var width: i32 = 0; var height: i32 = 0; io.Fonts.?.GetTexDataAsRGBA32(&pixels, &width, &height); - var upload_size = @intCast(usize, width * height * 4); + var upload_size = @as(usize, @intCast(width * height * 4)); // Create the Image: { @@ -518,8 +520,8 @@ pub fn CreateFontsTexture(command_buffer: vk.CommandBuffer) !void { .imageType = .T_2D, .format = .R8G8B8A8_UNORM, .extent = vk.Extent3D{ - .width = @intCast(u32, width), - .height = @intCast(u32, height), + .width = @as(u32, @intCast(width)), + .height = @as(u32, @intCast(height)), .depth = 1, }, .mipLevels = 1, @@ -589,7 +591,7 @@ pub fn CreateFontsTexture(command_buffer: vk.CommandBuffer) !void { // Upload to Buffer: { var map: [*]u8 = undefined; - try vk.MapMemory(v.Device, bd.UploadBufferMemory, 0, upload_size, .{}, @ptrCast(**anyopaque, &map)); + try vk.MapMemory(v.Device, bd.UploadBufferMemory, 0, upload_size, .{}, @as(**anyopaque, @ptrCast(&map))); std.mem.copy(u8, map[0..upload_size], pixels.?[0..upload_size]); var range = [_]vk.MappedMemoryRange{vk.MappedMemoryRange{ .memory = bd.UploadBufferMemory, @@ -631,7 +633,7 @@ pub fn CreateFontsTexture(command_buffer: vk.CommandBuffer) !void { .bufferRowLength = 0, .bufferImageHeight = 0, .imageOffset = vk.Offset3D{ .x = 0, .y = 0, .z = 0 }, - .imageExtent = vk.Extent3D{ .width = @intCast(u32, width), .height = @intCast(u32, height), .depth = 1 }, + .imageExtent = vk.Extent3D{ .width = @as(u32, @intCast(width)), .height = @as(u32, @intCast(height)), .depth = 1 }, }}; vk.CmdCopyBufferToImage(command_buffer, bd.UploadBuffer, bd.FontImage, .TRANSFER_DST_OPTIMAL, ®ion); @@ -655,7 +657,7 @@ pub fn CreateFontsTexture(command_buffer: vk.CommandBuffer) !void { } // Store our identifier - io.Fonts.?.SetTexID(@intToPtr(imgui.TextureID, @enumToInt(bd.FontDescriptorSet))); + io.Fonts.?.SetTexID(@as(imgui.TextureID, @ptrFromInt(@intFromEnum(bd.FontDescriptorSet)))); } fn CreateShaderModules(device: vk.Device, allocator: ?*const vk.AllocationCallbacks) !void { @@ -1008,6 +1010,7 @@ fn DestroyDeviceObjects() void { } pub fn Init(info: *InitInfo, render_pass: vk.RenderPass) !void { + std.debug.print("imgui: Vulkan backend\n", .{}); // Setup back-end capabilities flags const io = imgui.GetIO(); assert(io.BackendRendererUserData == null); // Already initialized a renderer backend! @@ -1015,7 +1018,7 @@ pub fn Init(info: *InitInfo, render_pass: vk.RenderPass) !void { assert(info.MinImageCount >= 2); assert(info.ImageCount >= info.MinImageCount); - const bd = @ptrCast(*Data, @alignCast(@alignOf(Data), imgui.MemAlloc(@sizeOf(Data)).?)); + const bd = @as(*Data, @ptrCast(@alignCast(imgui.MemAlloc(@sizeOf(Data)).?))); bd.* = .{ .VulkanInitInfo = info.*, .RenderPass = render_pass, @@ -1062,7 +1065,7 @@ pub fn AddTexture(sampler: vk.Sampler, image_view: vk.ImageView, image_layout: v const bd = GetBackendData().?; const v = &bd.VulkanInitInfo; - var descriptor_sets: [1]vk.DescriptorSet = .{ .Null }; + var descriptor_sets: [1]vk.DescriptorSet = .{.Null}; try vk.AllocateDescriptorSets(v.Device, .{ .descriptorPool = v.DescriptorPool, .descriptorSetCount = 1, @@ -1282,12 +1285,12 @@ fn CreateWindowSwapChain(physical_device: vk.PhysicalDevice, device: vk.Device, const imagesResult = try vk.GetSwapchainImagesKHR(device, wd.Swapchain, backbuffers[0..wd.ImageCount]); assert(imagesResult.result == .SUCCESS); - wd.ImageCount = @intCast(u32, imagesResult.swapchainImages.len); + wd.ImageCount = @as(u32, @intCast(imagesResult.swapchainImages.len)); assert(wd.Frames.len == 0); wd.Frames = try wd.Allocator.alloc(Frame, wd.ImageCount); wd.FrameSemaphores = try wd.Allocator.alloc(FrameSemaphores, wd.ImageCount); - for (wd.Frames) |*frame, i| frame.* = Frame{ .Backbuffer = imagesResult.swapchainImages[i] }; + for (wd.Frames, 0..) |*frame, i| frame.* = Frame{ .Backbuffer = imagesResult.swapchainImages[i] }; for (wd.FrameSemaphores) |*fs| fs.* = FrameSemaphores{}; } if (old_swapchain != .Null) @@ -1393,7 +1396,7 @@ pub fn DestroyWindow(instance: vk.Instance, device: vk.Device, wd: *Window, allo try vk.DeviceWaitIdle(device); // FIXME: We could wait on the Queue if we had the queue in wd. (otherwise VulkanH functions can't use globals) //vk.QueueWaitIdle(bd.Queue); - for (wd.Frames) |_, i| { + for (wd.Frames, 0..) |_, i| { DestroyFrame(device, &wd.Frames[i], allocator); DestroyFrameSemaphores(device, &wd.FrameSemaphores[i], allocator); } @@ -1465,5 +1468,5 @@ fn arrayPtrType(comptime ptrType: type) type { } fn arrayPtr(ptr: anytype) arrayPtrType(@TypeOf(ptr)) { - return @ptrCast(arrayPtrType(@TypeOf(ptr)), ptr); + return @as(arrayPtrType(@TypeOf(ptr)), @ptrCast(ptr)); } diff --git a/src/main.zig b/src/main.zig index b8e2fa6..29023e3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -80,7 +80,8 @@ fn uploadBuffers(data: *gltf.Data, frame: *engine.render.Frame) !void { for (data.buffers) |*buffer| { buffer.gpuBuffer = try engine.render.createGpuBuffer(buffer.raw.size, buffer.usageFlags); - const bufferData = @ptrCast([*]u8, buffer.raw.data.?)[0..buffer.raw.size]; + const castData: [*]u8 = @ptrCast(buffer.raw.data.?); + const bufferData = castData[0..buffer.raw.size]; try upload.setBufferData(&buffer.gpuBuffer.?, 0, bufferData); } diff --git a/src/render.zig b/src/render.zig index d2a002d..61f54c2 100644 --- a/src/render.zig +++ b/src/render.zig @@ -48,12 +48,14 @@ pub const MappedRange = struct { fn get(self: *Self, comptime T: type) []T { const count = self.data.len / @sizeOf(T); - return @intToPtr([*]T, @ptrToInt(self.data.ptr))[0..count]; + const temp: [*]T = @ptrFromInt(@intFromPtr(self.data.ptr)); + return temp[0..count]; } fn getPart(self: *Self, comptime T: type, byteOffset: usize, count: usize) []T { assert(byteOffset + count * @sizeOf(T) < self.data.len); - return @intToPtr([*]T, @ptrToInt(self.data.ptr) + byteOffset)[0..count]; + const temp: [*]T = @ptrFromInt(@intFromPtr(self.data.ptr) + byteOffset); + return temp[0..count]; } fn end(self: *Self) void { @@ -114,7 +116,8 @@ pub const Upload = struct { { var map = try stagingBuffer.beginMap(); defer map.end(); - @memcpy(map.data.ptr, data.ptr, data.len); + comptime assert(@sizeOf(@TypeOf(data.ptr[0])) == 1); + @memcpy(map.data.ptr, data.ptr[0..data.len]); try map.flush(); } self.copyBufferPart(stagingBuffer, 0, buffer, offset, data.len); diff --git a/src/render_vulkan.zig b/src/render_vulkan.zig index 56bcc53..faec133 100644 --- a/src/render_vulkan.zig +++ b/src/render_vulkan.zig @@ -76,13 +76,13 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { // Create Vulkan Instance { var create_info = vk.InstanceCreateInfo{ - .enabledExtensionCount = @intCast(u32, extensions.len), + .enabledExtensionCount = @as(u32, @intCast(extensions.len)), .ppEnabledExtensionNames = extensions.ptr, }; if (USE_VULKAN_DEBUG_REPORT) { const layers = [_][*:0]const u8{"VK_LAYER_KHRONOS_validation"}; - create_info.enabledLayerCount = @intCast(u32, layers.len); + create_info.enabledLayerCount = @as(u32, @intCast(layers.len)); create_info.ppEnabledLayerNames = &layers; // Enable debug report extension (we need additional storage, so we duplicate the user array to add our new extension to it) @@ -91,7 +91,7 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { std.mem.copy([*:0]const u8, extensions_ext[0..extensions.len], extensions); extensions_ext[extensions.len] = "VK_EXT_debug_report"; - create_info.enabledExtensionCount = @intCast(u32, extensions_ext.len); + create_info.enabledExtensionCount = @as(u32, @intCast(extensions_ext.len)); create_info.ppEnabledExtensionNames = extensions_ext.ptr; // Create Vulkan Instance @@ -106,7 +106,7 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { // Register debug callback if (USE_VULKAN_DEBUG_REPORT) { // Get the function pointer (required for any extensions) - var vkCreateDebugReportCallbackEXT = @ptrCast(?@TypeOf(vk.vkCreateDebugReportCallbackEXT), vk.GetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT")).?; + var vkCreateDebugReportCallbackEXT = @as(?@TypeOf(vk.vkCreateDebugReportCallbackEXT), @ptrCast(vk.GetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT"))).?; // Setup the debug report callback var debug_report_ci = vk.DebugReportCallbackCreateInfoEXT{ @@ -115,13 +115,13 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { .pUserData = null, }; var err = vkCreateDebugReportCallbackEXT(instance, &debug_report_ci, vkAllocator, &debugReport); - if (@enumToInt(err) < 0) { + if (@intFromEnum(err) < 0) { return error.CreateDebugCallbackFailed; } } errdefer if (USE_VULKAN_DEBUG_REPORT) { // Remove the debug report callback - const vkDestroyDebugReportCallbackEXT = @ptrCast(?@TypeOf(vk.vkDestroyDebugReportCallbackEXT), vk.GetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT")); + const vkDestroyDebugReportCallbackEXT = @as(?@TypeOf(vk.vkDestroyDebugReportCallbackEXT), @ptrCast(vk.GetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT"))); assert(vkDestroyDebugReportCallbackEXT != null); vkDestroyDebugReportCallbackEXT.?(instance, debugReport, vkAllocator); }; @@ -152,9 +152,9 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { var queues = try allocator.alloc(vk.QueueFamilyProperties, count); defer allocator.free(queues); _ = vk.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, queues); - for (queues) |queueProps, i| { + for (queues, 0..) |queueProps, i| { if (queueProps.queueFlags.graphics) { - break :SelectQueueFamily @intCast(u32, i); + break :SelectQueueFamily @as(u32, @intCast(i)); } } return error.FailedToFindGraphicsQueue; @@ -172,9 +172,9 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { }, }; var create_info = vk.DeviceCreateInfo{ - .queueCreateInfoCount = @intCast(u32, queue_info.len), + .queueCreateInfoCount = @as(u32, @intCast(queue_info.len)), .pQueueCreateInfos = &queue_info, - .enabledExtensionCount = @intCast(u32, device_extensions.len), + .enabledExtensionCount = @as(u32, @intCast(device_extensions.len)), .ppEnabledExtensionNames = &device_extensions, }; device = try vk.CreateDevice(physicalDevice, create_info, vkAllocator); @@ -200,8 +200,8 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { }; var pool_info = vk.DescriptorPoolCreateInfo{ .flags = .{ .freeDescriptorSet = true }, - .maxSets = 1000 * @intCast(u32, pool_sizes.len), - .poolSizeCount = @intCast(u32, pool_sizes.len), + .maxSets = 1000 * @as(u32, @intCast(pool_sizes.len)), + .poolSizeCount = @as(u32, @intCast(pool_sizes.len)), .pPoolSizes = &pool_sizes, }; descriptorPool = try vk.CreateDescriptorPool(device, pool_info, vkAllocator); @@ -210,7 +210,7 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { // Create Window Surface const err = glfw.glfwCreateWindowSurface(instance, window, vkAllocator, &surface); - if (@enumToInt(err) < 0) + if (@intFromEnum(err) < 0) return error.CouldntCreateSurface; // GLFW says this call is necessary to clean up, but it crashes the program // so leaving it commented out for now. If deinit/reinit is a thing we @@ -248,7 +248,7 @@ pub fn init(allocator: std.mem.Allocator, inWindow: *glfw.GLFWwindow) !void { // Create SwapChain, RenderPass, Framebuffer, etc. assert(g_MinImageCount >= 2); - try impl_vulkan.CreateOrResizeWindow(instance, physicalDevice, device, wd, queueFamily, vkAllocator, @intCast(u32, w), @intCast(u32, h), g_MinImageCount); + try impl_vulkan.CreateOrResizeWindow(instance, physicalDevice, device, wd, queueFamily, vkAllocator, @as(u32, @intCast(w)), @as(u32, @intCast(h)), g_MinImageCount); } errdefer impl_vulkan.DestroyWindow(instance, device, &g_MainWindowData, vkAllocator) catch {}; } @@ -265,7 +265,8 @@ pub fn deinit() void { if (USE_VULKAN_DEBUG_REPORT) { // Remove the debug report callback - const vkDestroyDebugReportCallbackEXT = @ptrCast(?@TypeOf(vk.vkDestroyDebugReportCallbackEXT), vk.GetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT")); + const vkDestroyDebugReportCallbackEXT: ?@TypeOf(vk.vkDestroyDebugReportCallbackEXT) = + @ptrCast(vk.GetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT")); assert(vkDestroyDebugReportCallbackEXT != null); vkDestroyDebugReportCallbackEXT.?(instance, debugReport, vkAllocator); } @@ -409,7 +410,7 @@ pub fn beginColorPass(frame: *RenderFrame, clearColor: imgui.Vec4) !RenderPass { .extent = vk.Extent2D{ .width = wd.Width, .height = wd.Height }, }, .clearValueCount = 1, - .pClearValues = @ptrCast([*]const vk.ClearValue, &clearColor), + .pClearValues = @as([*]const vk.ClearValue, @ptrCast(&clearColor)), }; vk.CmdBeginRenderPass(fd.CommandBuffer, info, .INLINE); } @@ -501,7 +502,7 @@ pub fn destroyBuffer(buffer: *Buffer) void { pub fn mapBuffer(buffer: *Buffer, offset: usize, length: usize) ![*]u8 { var result: [*]u8 = undefined; - try vk.MapMemory(device, buffer.memory, offset, length, .{}, @ptrCast(**anyopaque, &result)); + try vk.MapMemory(device, buffer.memory, offset, length, .{}, @as(**anyopaque, @ptrCast(&result))); return result; } @@ -516,7 +517,9 @@ pub fn flushMappedRange(buffer: *Buffer, mappedPtr: [*]u8, offset: usize, length } pub fn unmapBuffer(buffer: *Buffer, mappedPtr: [*]u8, offset: usize, length: usize) void { - _ = mappedPtr; _ = offset; _ = length; + _ = mappedPtr; + _ = offset; + _ = length; vk.UnmapMemory(device, buffer.memory); } @@ -604,8 +607,8 @@ fn checkDeviceExtensionSupport(allocator: std.mem.Allocator, inDevice: vk.Physic fn glfw_resize_callback(inWindow: ?*glfw.GLFWwindow, w: c_int, h: c_int) callconv(.C) void { _ = inWindow; g_SwapChainRebuild = true; - g_SwapChainResizeWidth = @intCast(u32, w); - g_SwapChainResizeHeight = @intCast(u32, h); + g_SwapChainResizeWidth = @as(u32, @intCast(w)); + g_SwapChainResizeHeight = @as(u32, @intCast(h)); } fn debug_report(flags: vk.DebugReportFlagsEXT.IntType, objectType: vk.DebugReportObjectTypeEXT, object: u64, location: usize, messageCode: i32, pLayerPrefix: ?[*:0]const u8, pMessage: ?[*:0]const u8, pUserData: ?*anyopaque) callconv(vk.CallConv) vk.Bool32 { @@ -646,11 +649,11 @@ fn ArrayPtrType(comptime ptrType: type) type { assert(info.Pointer.sentinel == null); // Create the new value type, [1]T - const arrayInfo = std.builtin.TypeInfo{ + const arrayInfo = std.builtin.Type{ .Array = .{ .len = 1, .child = info.Pointer.child, - .sentinel = @as(?info.Pointer.child, null), + .sentinel = @as(?*const anyopaque, null), }, }; @@ -659,7 +662,7 @@ fn ArrayPtrType(comptime ptrType: type) type { info.Pointer.child = singleArrayType; // also need to change the type of the sentinel // we checked that this is null above so no work needs to be done here. - info.Pointer.sentinel = @as(?singleArrayType, null); + info.Pointer.sentinel = @as(?*const anyopaque, null); return @Type(info); } } diff --git a/zig-imgui/imgui.zig b/zig-imgui/imgui.zig index 234a29d..4ec192b 100644 --- a/zig-imgui/imgui.zig +++ b/zig-imgui/imgui.zig @@ -8,7 +8,7 @@ const builtin = @import("builtin"); const assert = @import("std").debug.assert; const imgui = @This(); -pub const DrawCallback_ResetRenderState = @intToPtr(DrawCallback, ~@as(usize, 0)); +pub const DrawCallback_ResetRenderState: DrawCallback = @ptrFromInt(~@as(usize, 0)); pub const VERSION = "1.88"; pub fn CHECKVERSION() void { @@ -17,8 +17,8 @@ pub fn CHECKVERSION() void { } } -pub const FLT_MAX: f32 = @bitCast(f32, @as(u32, 0x7F7FFFFF)); -pub const FLT_MIN: f32 = @bitCast(f32, @as(u32, 0x00800000)); +pub const FLT_MAX: f32 = @as(f32, @bitCast(@as(u32, 0x7F7FFFFF))); +pub const FLT_MIN: f32 = @as(f32, @bitCast(@as(u32, 0x00800000))); pub const FlagsInt = u32; @@ -26,10 +26,10 @@ pub fn FlagsMixin(comptime FlagType: type) type { comptime assert(@sizeOf(FlagType) == 4); return struct { pub fn toInt(self: FlagType) FlagsInt { - return @bitCast(FlagsInt, self); + return @as(FlagsInt, @bitCast(self)); } pub fn fromInt(value: FlagsInt) FlagType { - return @bitCast(FlagType, value); + return @as(FlagType, @bitCast(value)); } pub fn with(a: FlagType, b: FlagType) FlagType { return fromInt(toInt(a) | toInt(b)); @@ -83,7 +83,7 @@ pub fn Vector(comptime T: type) type { // Constructors, destructor pub fn deinit(self: *@This()) void { - if (self.Data) |d| raw.igMemFree(@ptrCast(*anyopaque, d)); + if (self.Data) |d| raw.igMemFree(@as(*anyopaque, @ptrCast(d))); self.* = undefined; } @@ -91,7 +91,10 @@ pub fn Vector(comptime T: type) type { var cloned = @This(){}; if (self.Size != 0) { cloned.resize_undefined(self.Size); - @memcpy(@ptrCast([*]u8, cloned.Data.?), @ptrCast([*]const u8, self.Data.?), self.Size * @sizeOf(T)); + var dst = @as([*]u8, @ptrCast(cloned.Data.?)); + var src = @as([*]const u8, @ptrCast(self.Data.?)); + comptime assert(@sizeOf(@TypeOf(src[0])) == 1); + @memcpy(dst, src[0..(self.Size * @sizeOf(T))]); } return cloned; } @@ -100,22 +103,28 @@ pub fn Vector(comptime T: type) type { self.Size = 0; if (other.Size != 0) { self.resize_undefined(other.Size); - @memcpy(@ptrCast([*]u8, self.Data.?), @ptrCast([*]const u8, other.Data.?), other.Size * @sizeOf(T)); + const dst = @as([*]u8, @ptrCast(self.Data.?)); + const src = @as([*]const u8, @ptrCast(other.Data.?)); + comptime assert(@sizeOf(@TypeOf(src[0])) == 1); + @memcpy(dst, src[0..(other.Size * @sizeOf(T))]); } } pub fn from_slice(slice: []const T) @This() { var result = @This(){}; if (slice.len != 0) { - result.resize_undefined(@intCast(u32, slice.len)); - @memcpy(@ptrCast([*]u8, result.Data.?), @ptrCast([*]const u8, slice.ptr), slice.len * @sizeOf(T)); + result.resize_undefined(@as(u32, @intCast(slice.len))); + const dst = @as([*]u8, @ptrCast(result.Data.?)); + const src = @as([*]const u8, @ptrCast(slice.ptr)); + comptime assert(@sizeOf(@TypeOf(src[0])) == 1); + @memcpy(dst, src[0..(slice.len * @sizeOf(T))]); } return result; } /// Important: does not destruct anything pub fn clear(self: *@This()) void { - if (self.Data) |d| raw.igMemFree(@ptrCast(?*anyopaque, d)); + if (self.Data) |d| raw.igMemFree(@as(?*anyopaque, @ptrCast(d))); self.* = .{}; } @@ -141,7 +150,7 @@ pub fn Vector(comptime T: type) type { for (self.items()) |_ptr| { const ptr: *ValueT = _ptr; destruct(ValueT, ptr); - raw.igMemFree(@ptrCast(?*anyopaque, ptr)); + raw.igMemFree(@as(?*anyopaque, @ptrCast(ptr))); } } self.clear(); @@ -199,20 +208,23 @@ pub fn Vector(comptime T: type) type { } pub fn reserve(self: *@This(), new_capacity: u32) void { if (new_capacity <= self.Capacity) return; - const new_data = @ptrCast(?[*]T, @alignCast(@alignOf(T), raw.igMemAlloc(new_capacity * @sizeOf(T)))); + const new_data: ?[*]T = @ptrCast(raw.igMemAlloc(new_capacity * @sizeOf(T))); if (self.Data) |sd| { if (self.Size != 0) { - @memcpy(@ptrCast([*]u8, new_data.?), @ptrCast([*]const u8, sd), self.Size * @sizeOf(T)); + const dst = @as([*]u8, @ptrCast(new_data.?)); + const src = @as([*]const u8, @ptrCast(sd)); + comptime assert(@sizeOf(@TypeOf(src[0])) == 1); + @memcpy(dst, src[0..(self.Size * @sizeOf(T))]); } - raw.igMemFree(@ptrCast(*anyopaque, sd)); + raw.igMemFree(@as(*anyopaque, @ptrCast(sd))); } self.Data = new_data; self.Capacity = new_capacity; } pub fn reserve_discard(self: *@This(), new_capacity: u32) void { if (new_capacity <= self.Capacity) return; - if (self.Data) |sd| raw.igMemFree(@ptrCast(*anyopaque, sd)); - self.Data = @ptrCast(?[*]T, @alignCast(@alignOf(T), raw.igMemAlloc(new_capacity * @sizeOf(T)))); + if (self.Data) |sd| raw.igMemFree(@as(*anyopaque, @ptrCast(sd))); + self.Data = @as(?[*]T, @ptrCast(raw.igMemAlloc(new_capacity * @sizeOf(T)))); self.Capacity = new_capacity; } @@ -251,7 +263,10 @@ pub fn Vector(comptime T: type) type { var it = start; var end_it = end; const data = self.Data.?; - while (end_it < len) : ({ it += 1; end_it += 1; }) { + while (end_it < len) : ({ + it += 1; + end_it += 1; + }) { data[it] = data[end_it]; } } @@ -271,7 +286,7 @@ pub fn Vector(comptime T: type) type { if (index < self.Size) { var it = self.Size; while (it > index) : (it -= 1) { - data[it] = data[it-1]; + data[it] = data[it - 1]; } } data[index] = v; @@ -284,8 +299,8 @@ pub fn Vector(comptime T: type) type { return false; } pub fn find(self: @This(), v: T) ?u32 { - return for (self.items()) |*it, i| { - if (imgui.eql(T, v, it.*)) break @intCast(u32, i); + return for (self.items(), 0..) |*it, i| { + if (imgui.eql(T, v, it.*)) break @as(u32, @intCast(i)); } else null; } pub fn find_erase(self: *@This(), v: T) bool { @@ -318,7 +333,7 @@ pub fn Vector(comptime T: type) type { pub const Vec2 = extern struct { x: f32 = 0, y: f32 = 0, - + pub fn init(x: f32, y: f32) Vec4 { return .{ .x = x, .y = y }; } @@ -339,10 +354,7 @@ pub const Vec4 = extern struct { } pub fn eql(self: Vec4, other: Vec4) bool { - return self.x == other.x - and self.y == other.y - and self.z == other.z - and self.w == other.w; + return self.x == other.x and self.y == other.y and self.z == other.z and self.w == other.w; } }; @@ -359,18 +371,18 @@ pub const Color = extern struct { pub fn initRGBAUnorm(r: u8, g: u8, b: u8, a: u8) Color { const inv_255: f32 = 1.0 / 255.0; return initRGBA( - @intToFloat(f32, r) * inv_255, - @intToFloat(f32, g) * inv_255, - @intToFloat(f32, b) * inv_255, - @intToFloat(f32, a) * inv_255, + @as(f32, @floatFromInt(r)) * inv_255, + @as(f32, @floatFromInt(g)) * inv_255, + @as(f32, @floatFromInt(b)) * inv_255, + @as(f32, @floatFromInt(a)) * inv_255, ); } pub fn initRGBUnorm(r: u8, g: u8, b: u8) Color { const inv_255: f32 = 1.0 / 255.0; return initRGBA( - @intToFloat(f32, r) * inv_255, - @intToFloat(f32, g) * inv_255, - @intToFloat(f32, b) * inv_255, + @as(f32, @floatFromInt(r)) * inv_255, + @as(f32, @floatFromInt(g)) * inv_255, + @as(f32, @floatFromInt(b)) * inv_255, 1.0, ); } @@ -390,10 +402,10 @@ pub const Color = extern struct { /// Convert an integer 0xaabbggrr to a floating point color pub fn initABGRPacked(value: u32) Color { return initRGBAUnorm( - @truncate(u8, value >> 0), - @truncate(u8, value >> 8), - @truncate(u8, value >> 16), - @truncate(u8, value >> 24), + @as(u8, @truncate(value >> 0)), + @as(u8, @truncate(value >> 8)), + @as(u8, @truncate(value >> 16)), + @as(u8, @truncate(value >> 24)), ); } /// Convert from a floating point color to an integer 0xaabbggrr @@ -412,13 +424,13 @@ pub const Color = extern struct { pub const DrawListSharedData = opaque {}; pub const FontBuilderIO = opaque {}; pub const Context = opaque {}; -pub const DrawCallback = ?fn (parent_list: ?*const DrawList, cmd: ?*const DrawCmd) callconv(.C) void; +pub const DrawCallback = ?*const fn (parent_list: ?*const DrawList, cmd: ?*const DrawCmd) callconv(.C) void; pub const DrawIdx = u16; pub const ID = u32; -pub const InputTextCallback = ?fn (data: ?*InputTextCallbackData) callconv(.C) i32; -pub const MemAllocFunc = ?fn (sz: usize, user_data: ?*anyopaque) callconv(.C) ?*anyopaque; -pub const MemFreeFunc = ?fn (ptr: ?*anyopaque, user_data: ?*anyopaque) callconv(.C) void; -pub const SizeCallback = ?fn (data: ?*SizeCallbackData) callconv(.C) void; +pub const InputTextCallback = ?*const fn (data: ?*InputTextCallbackData) callconv(.C) i32; +pub const MemAllocFunc = ?*const fn (sz: usize, user_data: ?*anyopaque) callconv(.C) ?*anyopaque; +pub const MemFreeFunc = ?*const fn (ptr: ?*anyopaque, user_data: ?*anyopaque) callconv(.C) void; +pub const SizeCallback = ?*const fn (data: ?*SizeCallbackData) callconv(.C) void; pub const TextureID = ?*anyopaque; pub const Wchar = Wchar16; pub const Wchar16 = u16; @@ -460,13 +472,13 @@ pub const DrawFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const RoundCornersTop: @This() = .{ .RoundCornersTopLeft=true, .RoundCornersTopRight=true }; - pub const RoundCornersBottom: @This() = .{ .RoundCornersBottomLeft=true, .RoundCornersBottomRight=true }; - pub const RoundCornersLeft: @This() = .{ .RoundCornersTopLeft=true, .RoundCornersBottomLeft=true }; - pub const RoundCornersRight: @This() = .{ .RoundCornersTopRight=true, .RoundCornersBottomRight=true }; - pub const RoundCornersAll: @This() = .{ .RoundCornersTopLeft=true, .RoundCornersTopRight=true, .RoundCornersBottomLeft=true, .RoundCornersBottomRight=true }; - pub const RoundCornersDefault_: @This() = .{ .RoundCornersTopLeft=true, .RoundCornersTopRight=true, .RoundCornersBottomLeft=true, .RoundCornersBottomRight=true }; - pub const RoundCornersMask_: @This() = .{ .RoundCornersTopLeft=true, .RoundCornersTopRight=true, .RoundCornersBottomLeft=true, .RoundCornersBottomRight=true, .RoundCornersNone=true }; + pub const RoundCornersTop: @This() = .{ .RoundCornersTopLeft = true, .RoundCornersTopRight = true }; + pub const RoundCornersBottom: @This() = .{ .RoundCornersBottomLeft = true, .RoundCornersBottomRight = true }; + pub const RoundCornersLeft: @This() = .{ .RoundCornersTopLeft = true, .RoundCornersBottomLeft = true }; + pub const RoundCornersRight: @This() = .{ .RoundCornersTopRight = true, .RoundCornersBottomRight = true }; + pub const RoundCornersAll: @This() = .{ .RoundCornersTopLeft = true, .RoundCornersTopRight = true, .RoundCornersBottomLeft = true, .RoundCornersBottomRight = true }; + pub const RoundCornersDefault_: @This() = .{ .RoundCornersTopLeft = true, .RoundCornersTopRight = true, .RoundCornersBottomLeft = true, .RoundCornersBottomRight = true }; + pub const RoundCornersMask_: @This() = .{ .RoundCornersTopLeft = true, .RoundCornersTopRight = true, .RoundCornersBottomLeft = true, .RoundCornersBottomRight = true, .RoundCornersNone = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -627,8 +639,8 @@ pub const ButtonFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const MouseButtonMask_: @This() = .{ .MouseButtonLeft=true, .MouseButtonRight=true, .MouseButtonMiddle=true }; - pub const MouseButtonDefault_: @This() = .{ .MouseButtonLeft=true }; + pub const MouseButtonMask_: @This() = .{ .MouseButtonLeft = true, .MouseButtonRight = true, .MouseButtonMiddle = true }; + pub const MouseButtonDefault_: @This() = .{ .MouseButtonLeft = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -669,11 +681,11 @@ pub const ColorEditFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const DefaultOptions_: @This() = .{ .DisplayRGB=true, .Uint8=true, .PickerHueBar=true, .InputRGB=true }; - pub const DisplayMask_: @This() = .{ .DisplayRGB=true, .DisplayHSV=true, .DisplayHex=true }; - pub const DataTypeMask_: @This() = .{ .Uint8=true, .Float=true }; - pub const PickerMask_: @This() = .{ .PickerHueBar=true, .PickerHueWheel=true }; - pub const InputMask_: @This() = .{ .InputRGB=true, .InputHSV=true }; + pub const DefaultOptions_: @This() = .{ .DisplayRGB = true, .Uint8 = true, .PickerHueBar = true, .InputRGB = true }; + pub const DisplayMask_: @This() = .{ .DisplayRGB = true, .DisplayHSV = true, .DisplayHex = true }; + pub const DataTypeMask_: @This() = .{ .Uint8 = true, .Float = true }; + pub const PickerMask_: @This() = .{ .PickerHueBar = true, .PickerHueWheel = true }; + pub const InputMask_: @This() = .{ .InputRGB = true, .InputHSV = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -714,7 +726,7 @@ pub const ComboFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const HeightMask_: @This() = .{ .HeightSmall=true, .HeightRegular=true, .HeightLarge=true, .HeightLargest=true }; + pub const HeightMask_: @This() = .{ .HeightSmall = true, .HeightRegular = true, .HeightLarge = true, .HeightLargest = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -835,7 +847,7 @@ pub const DragDropFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const AcceptPeekOnly: @This() = .{ .AcceptBeforeDelivery=true, .AcceptNoDrawDefaultRect=true }; + pub const AcceptPeekOnly: @This() = .{ .AcceptBeforeDelivery = true, .AcceptNoDrawDefaultRect = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -876,7 +888,7 @@ pub const FocusedFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const RootAndChildWindows: @This() = .{ .ChildWindows=true, .RootWindow=true }; + pub const RootAndChildWindows: @This() = .{ .ChildWindows = true, .RootWindow = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -917,8 +929,8 @@ pub const HoveredFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const RectOnly: @This() = .{ .AllowWhenBlockedByPopup=true, .AllowWhenBlockedByActiveItem=true, .AllowWhenOverlapped=true }; - pub const RootAndChildWindows: @This() = .{ .ChildWindows=true, .RootWindow=true }; + pub const RectOnly: @This() = .{ .AllowWhenBlockedByPopup = true, .AllowWhenBlockedByActiveItem = true, .AllowWhenOverlapped = true }; + pub const RootAndChildWindows: @This() = .{ .ChildWindows = true, .RootWindow = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1040,9 +1052,9 @@ pub const PopupFlags = packed struct { pub const None: @This() = .{}; pub const MouseButtonLeft: @This() = .{}; - pub const MouseButtonMask_: @This() = .{ .MouseButtonRight=true, .MouseButtonMiddle=true, .__reserved_bit_02=true, .__reserved_bit_03=true, .__reserved_bit_04=true }; - pub const MouseButtonDefault_: @This() = .{ .MouseButtonRight=true }; - pub const AnyPopup: @This() = .{ .AnyPopupId=true, .AnyPopupLevel=true }; + pub const MouseButtonMask_: @This() = .{ .MouseButtonRight = true, .MouseButtonMiddle = true, .__reserved_bit_02 = true, .__reserved_bit_03 = true, .__reserved_bit_04 = true }; + pub const MouseButtonDefault_: @This() = .{ .MouseButtonRight = true }; + pub const AnyPopup: @This() = .{ .AnyPopupId = true, .AnyPopupLevel = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1123,7 +1135,7 @@ pub const SliderFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const InvalidMask_: @This() = .{ .__reserved_bit_00=true, .__reserved_bit_01=true, .__reserved_bit_02=true, .__reserved_bit_03=true, .__reserved_bit_28=true, .__reserved_bit_29=true, .__reserved_bit_30=true }; + pub const InvalidMask_: @This() = .{ .__reserved_bit_00 = true, .__reserved_bit_01 = true, .__reserved_bit_02 = true, .__reserved_bit_03 = true, .__reserved_bit_28 = true, .__reserved_bit_29 = true, .__reserved_bit_30 = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1164,8 +1176,8 @@ pub const TabBarFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const FittingPolicyMask_: @This() = .{ .FittingPolicyResizeDown=true, .FittingPolicyScroll=true }; - pub const FittingPolicyDefault_: @This() = .{ .FittingPolicyResizeDown=true }; + pub const FittingPolicyMask_: @This() = .{ .FittingPolicyResizeDown = true, .FittingPolicyScroll = true }; + pub const FittingPolicyDefault_: @This() = .{ .FittingPolicyResizeDown = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1246,9 +1258,9 @@ pub const TableColumnFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const WidthMask_: @This() = .{ .WidthStretch=true, .WidthFixed=true }; - pub const IndentMask_: @This() = .{ .IndentEnable=true, .IndentDisable=true }; - pub const StatusMask_: @This() = .{ .IsEnabled=true, .IsVisible=true, .IsSorted=true, .IsHovered=true }; + pub const WidthMask_: @This() = .{ .WidthStretch = true, .WidthFixed = true }; + pub const IndentMask_: @This() = .{ .IndentEnable = true, .IndentDisable = true }; + pub const StatusMask_: @This() = .{ .IsEnabled = true, .IsVisible = true, .IsSorted = true, .IsHovered = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1289,13 +1301,13 @@ pub const TableFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const BordersH: @This() = .{ .BordersInnerH=true, .BordersOuterH=true }; - pub const BordersV: @This() = .{ .BordersInnerV=true, .BordersOuterV=true }; - pub const BordersInner: @This() = .{ .BordersInnerH=true, .BordersInnerV=true }; - pub const BordersOuter: @This() = .{ .BordersOuterH=true, .BordersOuterV=true }; - pub const Borders: @This() = .{ .BordersInnerH=true, .BordersOuterH=true, .BordersInnerV=true, .BordersOuterV=true }; - pub const SizingStretchProp: @This() = .{ .SizingFixedFit=true, .SizingFixedSame=true }; - pub const SizingMask_: @This() = .{ .SizingFixedFit=true, .SizingFixedSame=true, .SizingStretchSame=true }; + pub const BordersH: @This() = .{ .BordersInnerH = true, .BordersOuterH = true }; + pub const BordersV: @This() = .{ .BordersInnerV = true, .BordersOuterV = true }; + pub const BordersInner: @This() = .{ .BordersInnerH = true, .BordersInnerV = true }; + pub const BordersOuter: @This() = .{ .BordersOuterH = true, .BordersOuterV = true }; + pub const Borders: @This() = .{ .BordersInnerH = true, .BordersOuterH = true, .BordersInnerV = true, .BordersOuterV = true }; + pub const SizingStretchProp: @This() = .{ .SizingFixedFit = true, .SizingFixedSame = true }; + pub const SizingMask_: @This() = .{ .SizingFixedFit = true, .SizingFixedSame = true, .SizingStretchSame = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1376,7 +1388,7 @@ pub const TreeNodeFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const CollapsingHeader: @This() = .{ .Framed=true, .NoTreePushOnOpen=true, .NoAutoOpenOnLog=true }; + pub const CollapsingHeader: @This() = .{ .Framed = true, .NoTreePushOnOpen = true, .NoAutoOpenOnLog = true }; pub usingnamespace FlagsMixin(@This()); }; @@ -1457,14 +1469,14 @@ pub const WindowFlags = packed struct { __reserved_bit_31: bool = false, pub const None: @This() = .{}; - pub const NoNav: @This() = .{ .NoNavInputs=true, .NoNavFocus=true }; - pub const NoDecoration: @This() = .{ .NoTitleBar=true, .NoResize=true, .NoScrollbar=true, .NoCollapse=true }; - pub const NoInputs: @This() = .{ .NoMouseInputs=true, .NoNavInputs=true, .NoNavFocus=true }; + pub const NoNav: @This() = .{ .NoNavInputs = true, .NoNavFocus = true }; + pub const NoDecoration: @This() = .{ .NoTitleBar = true, .NoResize = true, .NoScrollbar = true, .NoCollapse = true }; + pub const NoInputs: @This() = .{ .NoMouseInputs = true, .NoNavInputs = true, .NoNavFocus = true }; pub usingnamespace FlagsMixin(@This()); }; -pub const Col = enum (i32) { +pub const Col = enum(i32) { Text = 0, TextDisabled = 1, WindowBg = 2, @@ -1523,7 +1535,7 @@ pub const Col = enum (i32) { pub const COUNT = 53; }; -pub const DataType = enum (i32) { +pub const DataType = enum(i32) { S8 = 0, U8 = 1, S16 = 2, @@ -1539,7 +1551,7 @@ pub const DataType = enum (i32) { pub const COUNT = 10; }; -pub const Dir = enum (i32) { +pub const Dir = enum(i32) { None = -1, Left = 0, Right = 1, @@ -1550,7 +1562,7 @@ pub const Dir = enum (i32) { pub const COUNT = 4; }; -pub const Key = enum (i32) { +pub const Key = enum(i32) { None = 0, Tab = 512, LeftArrow = 513, @@ -1695,7 +1707,7 @@ pub const Key = enum (i32) { pub const KeysData_OFFSET = @This().NamedKey_BEGIN; }; -pub const MouseButton = enum (i32) { +pub const MouseButton = enum(i32) { Left = 0, Right = 1, Middle = 2, @@ -1704,7 +1716,7 @@ pub const MouseButton = enum (i32) { pub const COUNT = 5; }; -pub const MouseCursor = enum (i32) { +pub const MouseCursor = enum(i32) { None = -1, Arrow = 0, TextInput = 1, @@ -1720,7 +1732,7 @@ pub const MouseCursor = enum (i32) { pub const COUNT = 9; }; -pub const NavInput = enum (i32) { +pub const NavInput = enum(i32) { Activate = 0, Cancel = 1, Input = 2, @@ -1746,14 +1758,14 @@ pub const NavInput = enum (i32) { pub const COUNT = 20; }; -pub const SortDirection = enum (i32) { +pub const SortDirection = enum(i32) { None = 0, Ascending = 1, Descending = 2, _, }; -pub const StyleVar = enum (i32) { +pub const StyleVar = enum(i32) { Alpha = 0, DisabledAlpha = 1, WindowPadding = 2, @@ -1784,7 +1796,7 @@ pub const StyleVar = enum (i32) { pub const COUNT = 25; }; -pub const TableBgTarget = enum (i32) { +pub const TableBgTarget = enum(i32) { None = 0, RowBg0 = 1, RowBg1 = 2, @@ -1907,14 +1919,14 @@ pub const DrawList = extern struct { return raw.ImDrawList_AddImage(self, user_texture_id, &p_min, &p_max, &uv_min, &uv_max, col); } pub inline fn AddImage(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2) void { - return @This().AddImageExt(self, user_texture_id, p_min, p_max, .{.x=0,.y=0}, .{.x=1,.y=1}, 4294967295); + return @This().AddImageExt(self, user_texture_id, p_min, p_max, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, 4294967295); } pub inline fn AddImageQuadExt(self: *DrawList, user_texture_id: TextureID, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, uv1: Vec2, uv2: Vec2, uv3: Vec2, uv4: Vec2, col: u32) void { return raw.ImDrawList_AddImageQuad(self, user_texture_id, &p1, &p2, &p3, &p4, &uv1, &uv2, &uv3, &uv4, col); } pub inline fn AddImageQuad(self: *DrawList, user_texture_id: TextureID, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2) void { - return @This().AddImageQuadExt(self, user_texture_id, p1, p2, p3, p4, .{.x=0,.y=0}, .{.x=1,.y=0}, .{.x=1,.y=1}, .{.x=0,.y=1}, 4294967295); + return @This().AddImageQuadExt(self, user_texture_id, p1, p2, p3, p4, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 0 }, .{ .x = 1, .y = 1 }, .{ .x = 0, .y = 1 }, 4294967295); } pub inline fn AddImageRoundedExt(self: *DrawList, user_texture_id: TextureID, p_min: Vec2, p_max: Vec2, uv_min: Vec2, uv_max: Vec2, col: u32, rounding: f32, flags: DrawFlags) void { @@ -2215,7 +2227,7 @@ pub const Font = extern struct { Ascent: f32, Descent: f32, MetricsTotalSurface: i32, - Used4kPagesMap: [(0xFFFF+1)/4096/8]u8, + Used4kPagesMap: [(0xFFFF + 1) / 4096 / 8]u8, /// AddGlyph(self: *Font, src_cfg: ?*const FontConfig, c: Wchar, x0: f32, y0: f32, x1: f32, y1: f32, u0: f32, v0: f32, u1: f32, v1: f32, advance_x: f32) void pub const AddGlyph = raw.ImFont_AddGlyph; @@ -2303,7 +2315,7 @@ pub const FontAtlas = extern struct { Fonts: Vector(?*Font), CustomRects: Vector(FontAtlasCustomRect), ConfigData: Vector(FontConfig), - TexUvLines: [(63)+1]Vec4, + TexUvLines: [(63) + 1]Vec4, FontBuilderIO: ?*const FontBuilderIO, FontBuilderFlags: u32, PackIdMouseCursors: i32, @@ -2313,7 +2325,7 @@ pub const FontAtlas = extern struct { return raw.ImFontAtlas_AddCustomRectFontGlyph(self, font, id, width, height, advance_x, &offset); } pub inline fn AddCustomRectFontGlyph(self: *FontAtlas, font: ?*Font, id: Wchar, width: i32, height: i32, advance_x: f32) i32 { - return @This().AddCustomRectFontGlyphExt(self, font, id, width, height, advance_x, .{.x=0,.y=0}); + return @This().AddCustomRectFontGlyphExt(self, font, id, width, height, advance_x, .{ .x = 0, .y = 0 }); } /// AddCustomRectRegular(self: *FontAtlas, width: i32, height: i32) i32 @@ -2554,10 +2566,10 @@ pub const IO = extern struct { BackendPlatformUserData: ?*anyopaque, BackendRendererUserData: ?*anyopaque, BackendLanguageUserData: ?*anyopaque, - GetClipboardTextFn: ?fn (user_data: ?*anyopaque) callconv(.C) ?[*:0]const u8, - SetClipboardTextFn: ?fn (user_data: ?*anyopaque, text: ?[*:0]const u8) callconv(.C) void, + GetClipboardTextFn: ?*const fn (user_data: ?*anyopaque) callconv(.C) ?[*:0]const u8, + SetClipboardTextFn: ?*const fn (user_data: ?*anyopaque, text: ?[*:0]const u8) callconv(.C) void, ClipboardUserData: ?*anyopaque, - SetPlatformImeDataFn: ?fn (viewport: ?*Viewport, data: ?*PlatformImeData) callconv(.C) void, + SetPlatformImeDataFn: ?*const fn (viewport: ?*Viewport, data: ?*PlatformImeData) callconv(.C) void, _UnusedPadding: ?*anyopaque, WantCaptureMouse: bool, WantCaptureKeyboard: bool, @@ -2749,7 +2761,7 @@ pub const Payload = extern struct { SourceId: ID, SourceParentId: ID, DataFrameCount: i32, - DataType: [32+1]u8, + DataType: [32 + 1]u8, Preview: bool, Delivery: bool, @@ -3079,7 +3091,6 @@ pub const Viewport = extern struct { pub const deinit = raw.ImGuiViewport_destroy; }; - pub inline fn AcceptDragDropPayloadExt(kind: ?[*:0]const u8, flags: DragDropFlags) ?*const Payload { return raw.igAcceptDragDropPayload(kind, flags.toInt()); } @@ -3104,14 +3115,14 @@ pub inline fn BeginChild_StrExt(str_id: ?[*:0]const u8, size: Vec2, border: bool return raw.igBeginChild_Str(str_id, &size, border, flags.toInt()); } pub inline fn BeginChild_Str(str_id: ?[*:0]const u8) bool { - return @This().BeginChild_StrExt(str_id, .{.x=0,.y=0}, false, .{}); + return @This().BeginChild_StrExt(str_id, .{ .x = 0, .y = 0 }, false, .{}); } pub inline fn BeginChild_IDExt(id: ID, size: Vec2, border: bool, flags: WindowFlags) bool { return raw.igBeginChild_ID(id, &size, border, flags.toInt()); } pub inline fn BeginChild_ID(id: ID) bool { - return @This().BeginChild_IDExt(id, .{.x=0,.y=0}, false, .{}); + return @This().BeginChild_IDExt(id, .{ .x = 0, .y = 0 }, false, .{}); } pub inline fn BeginChildFrameExt(id: ID, size: Vec2, flags: WindowFlags) bool { @@ -3151,7 +3162,7 @@ pub inline fn BeginListBoxExt(label: ?[*:0]const u8, size: Vec2) bool { return raw.igBeginListBox(label, &size); } pub inline fn BeginListBox(label: ?[*:0]const u8) bool { - return @This().BeginListBoxExt(label, .{.x=0,.y=0}); + return @This().BeginListBoxExt(label, .{ .x = 0, .y = 0 }); } /// BeginMainMenuBar() bool @@ -3219,7 +3230,7 @@ pub inline fn BeginTableExt(str_id: ?[*:0]const u8, column: i32, flags: TableFla return raw.igBeginTable(str_id, column, flags.toInt(), &outer_size, inner_width); } pub inline fn BeginTable(str_id: ?[*:0]const u8, column: i32) bool { - return @This().BeginTableExt(str_id, column, .{}, .{.x=0.0,.y=0.0}, 0.0); + return @This().BeginTableExt(str_id, column, .{}, .{ .x = 0.0, .y = 0.0 }, 0.0); } /// BeginTooltip() void @@ -3235,7 +3246,7 @@ pub inline fn ButtonExt(label: ?[*:0]const u8, size: Vec2) bool { return raw.igButton(label, &size); } pub inline fn Button(label: ?[*:0]const u8) bool { - return @This().ButtonExt(label, .{.x=0,.y=0}); + return @This().ButtonExt(label, .{ .x = 0, .y = 0 }); } /// CalcItemWidth() f32 @@ -3280,7 +3291,7 @@ pub inline fn ColorButtonExt(desc_id: ?[*:0]const u8, col: Vec4, flags: ColorEdi return raw.igColorButton(desc_id, &col, flags.toInt(), &size); } pub inline fn ColorButton(desc_id: ?[*:0]const u8, col: Vec4) bool { - return @This().ColorButtonExt(desc_id, col, .{}, .{.x=0,.y=0}); + return @This().ColorButtonExt(desc_id, col, .{}, .{ .x = 0, .y = 0 }); } pub inline fn ColorConvertFloat4ToU32(in: Vec4) u32 { @@ -3320,7 +3331,7 @@ pub inline fn ColorPicker3(label: ?[*:0]const u8, col: *[3]f32) bool { return @This().ColorPicker3Ext(label, col, .{}); } -pub inline fn ColorPicker4Ext(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlags, ref_col: ?*const[4]f32) bool { +pub inline fn ColorPicker4Ext(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlags, ref_col: ?*const [4]f32) bool { return raw.igColorPicker4(label, col, flags.toInt(), ref_col); } pub inline fn ColorPicker4(label: ?[*:0]const u8, col: *[4]f32) bool { @@ -3335,7 +3346,7 @@ pub inline fn Columns() void { /// Combo_Str_arrExt(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32, popup_max_height_in_items: i32) bool pub const Combo_Str_arrExt = raw.igCombo_Str_arr; -pub inline fn Combo_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32) bool { +pub inline fn Combo_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32) bool { return @This().Combo_Str_arrExt(label, current_item, items, items_count, -1); } @@ -3345,9 +3356,9 @@ pub inline fn Combo_Str(label: ?[*:0]const u8, current_item: ?*i32, items_separa return @This().Combo_StrExt(label, current_item, items_separated_by_zeros, -1); } -/// Combo_FnBoolPtrExt(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, popup_max_height_in_items: i32) bool +/// Combo_FnBoolPtrExt(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?*const fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, popup_max_height_in_items: i32) bool pub const Combo_FnBoolPtrExt = raw.igCombo_FnBoolPtr; -pub inline fn Combo_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32) bool { +pub inline fn Combo_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?*const fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32) bool { return @This().Combo_FnBoolPtrExt(label, current_item, items_getter, data, items_count, -1); } @@ -3768,14 +3779,14 @@ pub inline fn ImageExt(user_texture_id: TextureID, size: Vec2, uv0: Vec2, uv1: V return raw.igImage(user_texture_id, &size, &uv0, &uv1, &tint_col, &border_col); } pub inline fn Image(user_texture_id: TextureID, size: Vec2) void { - return @This().ImageExt(user_texture_id, size, .{.x=0,.y=0}, .{.x=1,.y=1}, .{.x=1,.y=1,.z=1,.w=1}, .{.x=0,.y=0,.z=0,.w=0}); + return @This().ImageExt(user_texture_id, size, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, .{ .x = 1, .y = 1, .z = 1, .w = 1 }, .{ .x = 0, .y = 0, .z = 0, .w = 0 }); } pub inline fn ImageButtonExt(user_texture_id: TextureID, size: Vec2, uv0: Vec2, uv1: Vec2, frame_padding: i32, bg_col: Vec4, tint_col: Vec4) bool { return raw.igImageButton(user_texture_id, &size, &uv0, &uv1, frame_padding, &bg_col, &tint_col); } pub inline fn ImageButton(user_texture_id: TextureID, size: Vec2) bool { - return @This().ImageButtonExt(user_texture_id, size, .{.x=0,.y=0}, .{.x=1,.y=1}, -1, .{.x=0,.y=0,.z=0,.w=0}, .{.x=1,.y=1,.z=1,.w=1}); + return @This().ImageButtonExt(user_texture_id, size, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, -1, .{ .x = 0, .y = 0, .z = 0, .w = 0 }, .{ .x = 1, .y = 1, .z = 1, .w = 1 }); } /// IndentExt(indent_w: f32) void @@ -3872,7 +3883,7 @@ pub inline fn InputTextMultilineExt(label: ?[*:0]const u8, buf: ?[*]u8, buf_size return raw.igInputTextMultiline(label, buf, buf_size, &size, flags.toInt(), callback, user_data); } pub inline fn InputTextMultiline(label: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize) bool { - return @This().InputTextMultilineExt(label, buf, buf_size, .{.x=0,.y=0}, .{}, null, null); + return @This().InputTextMultilineExt(label, buf, buf_size, .{ .x = 0, .y = 0 }, .{}, null, null); } pub inline fn InputTextWithHintExt(label: ?[*:0]const u8, hint: ?[*:0]const u8, buf: ?[*]u8, buf_size: usize, flags: InputTextFlags, callback: InputTextCallback, user_data: ?*anyopaque) bool { @@ -4024,13 +4035,13 @@ pub const LabelText = raw.igLabelText; /// ListBox_Str_arrExt(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32, height_in_items: i32) bool pub const ListBox_Str_arrExt = raw.igListBox_Str_arr; -pub inline fn ListBox_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32) bool { +pub inline fn ListBox_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32) bool { return @This().ListBox_Str_arrExt(label, current_item, items, items_count, -1); } -/// ListBox_FnBoolPtrExt(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, height_in_items: i32) bool +/// ListBox_FnBoolPtrExt(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?*const fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, height_in_items: i32) bool pub const ListBox_FnBoolPtrExt = raw.igListBox_FnBoolPtr; -pub inline fn ListBox_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32) bool { +pub inline fn ListBox_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?*const fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32) bool { return @This().ListBox_FnBoolPtrExt(label, current_item, items_getter, data, items_count, -1); } @@ -4122,28 +4133,28 @@ pub inline fn PlotHistogram_FloatPtrExt(label: ?[*:0]const u8, values: *const f3 return raw.igPlotHistogram_FloatPtr(label, values, values_count, values_offset, overlay_text, scale_min, scale_max, &graph_size, stride); } pub inline fn PlotHistogram_FloatPtr(label: ?[*:0]const u8, values: *const f32, values_count: i32) void { - return @This().PlotHistogram_FloatPtrExt(label, values, values_count, 0, null, FLT_MAX, FLT_MAX, .{.x=0,.y=0}, @sizeOf(f32)); + return @This().PlotHistogram_FloatPtrExt(label, values, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 }, @sizeOf(f32)); } -pub inline fn PlotHistogram_FnFloatPtrExt(label: ?[*:0]const u8, values_getter: ?fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) void { +pub inline fn PlotHistogram_FnFloatPtrExt(label: ?[*:0]const u8, values_getter: ?*const fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) void { return raw.igPlotHistogram_FnFloatPtr(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, &graph_size); } -pub inline fn PlotHistogram_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32) void { - return @This().PlotHistogram_FnFloatPtrExt(label, values_getter, data, values_count, 0, null, FLT_MAX, FLT_MAX, .{.x=0,.y=0}); +pub inline fn PlotHistogram_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?*const fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32) void { + return @This().PlotHistogram_FnFloatPtrExt(label, values_getter, data, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 }); } pub inline fn PlotLines_FloatPtrExt(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2, stride: i32) void { return raw.igPlotLines_FloatPtr(label, values, values_count, values_offset, overlay_text, scale_min, scale_max, &graph_size, stride); } pub inline fn PlotLines_FloatPtr(label: ?[*:0]const u8, values: *const f32, values_count: i32) void { - return @This().PlotLines_FloatPtrExt(label, values, values_count, 0, null, FLT_MAX, FLT_MAX, .{.x=0,.y=0}, @sizeOf(f32)); + return @This().PlotLines_FloatPtrExt(label, values, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 }, @sizeOf(f32)); } -pub inline fn PlotLines_FnFloatPtrExt(label: ?[*:0]const u8, values_getter: ?fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) void { +pub inline fn PlotLines_FnFloatPtrExt(label: ?[*:0]const u8, values_getter: ?*const fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: Vec2) void { return raw.igPlotLines_FnFloatPtr(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, &graph_size); } -pub inline fn PlotLines_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32) void { - return @This().PlotLines_FnFloatPtrExt(label, values_getter, data, values_count, 0, null, FLT_MAX, FLT_MAX, .{.x=0,.y=0}); +pub inline fn PlotLines_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?*const fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32) void { + return @This().PlotLines_FnFloatPtrExt(label, values_getter, data, values_count, 0, null, FLT_MAX, FLT_MAX, .{ .x = 0, .y = 0 }); } /// PopAllowKeyboardFocus() void @@ -4183,7 +4194,7 @@ pub inline fn ProgressBarExt(fraction: f32, size_arg: Vec2, overlay: ?[*:0]const return raw.igProgressBar(fraction, &size_arg, overlay); } pub inline fn ProgressBar(fraction: f32) void { - return @This().ProgressBarExt(fraction, .{.x=-FLT_MIN,.y=0}, null); + return @This().ProgressBarExt(fraction, .{ .x = -FLT_MIN, .y = 0 }, null); } /// PushAllowKeyboardFocus(allow_keyboard_focus: bool) void @@ -4268,14 +4279,14 @@ pub inline fn Selectable_BoolExt(label: ?[*:0]const u8, selected: bool, flags: S return raw.igSelectable_Bool(label, selected, flags.toInt(), &size); } pub inline fn Selectable_Bool(label: ?[*:0]const u8) bool { - return @This().Selectable_BoolExt(label, false, .{}, .{.x=0,.y=0}); + return @This().Selectable_BoolExt(label, false, .{}, .{ .x = 0, .y = 0 }); } pub inline fn Selectable_BoolPtrExt(label: ?[*:0]const u8, p_selected: ?*bool, flags: SelectableFlags, size: Vec2) bool { return raw.igSelectable_BoolPtr(label, p_selected, flags.toInt(), &size); } pub inline fn Selectable_BoolPtr(label: ?[*:0]const u8, p_selected: ?*bool) bool { - return @This().Selectable_BoolPtrExt(label, p_selected, .{}, .{.x=0,.y=0}); + return @This().Selectable_BoolPtrExt(label, p_selected, .{}, .{ .x = 0, .y = 0 }); } /// Separator() void @@ -4376,7 +4387,7 @@ pub inline fn SetNextWindowPosExt(pos: Vec2, cond: CondFlags, pivot: Vec2) void return raw.igSetNextWindowPos(&pos, cond.toInt(), &pivot); } pub inline fn SetNextWindowPos(pos: Vec2) void { - return @This().SetNextWindowPosExt(pos, .{}, .{.x=0,.y=0}); + return @This().SetNextWindowPosExt(pos, .{}, .{ .x = 0, .y = 0 }); } pub inline fn SetNextWindowSizeExt(size: Vec2, cond: CondFlags) void { @@ -5085,11 +5096,11 @@ pub const raw = struct { pub extern fn igColorEdit3(label: ?[*:0]const u8, col: *[3]f32, flags: ColorEditFlagsInt) callconv(.C) bool; pub extern fn igColorEdit4(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlagsInt) callconv(.C) bool; pub extern fn igColorPicker3(label: ?[*:0]const u8, col: *[3]f32, flags: ColorEditFlagsInt) callconv(.C) bool; - pub extern fn igColorPicker4(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlagsInt, ref_col: ?*const[4]f32) callconv(.C) bool; + pub extern fn igColorPicker4(label: ?[*:0]const u8, col: *[4]f32, flags: ColorEditFlagsInt, ref_col: ?*const [4]f32) callconv(.C) bool; pub extern fn igColumns(count: i32, id: ?[*:0]const u8, border: bool) callconv(.C) void; - pub extern fn igCombo_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32, popup_max_height_in_items: i32) callconv(.C) bool; + pub extern fn igCombo_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32, popup_max_height_in_items: i32) callconv(.C) bool; pub extern fn igCombo_Str(label: ?[*:0]const u8, current_item: ?*i32, items_separated_by_zeros: ?[*]const u8, popup_max_height_in_items: i32) callconv(.C) bool; - pub extern fn igCombo_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, popup_max_height_in_items: i32) callconv(.C) bool; + pub extern fn igCombo_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?*const fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, popup_max_height_in_items: i32) callconv(.C) bool; pub extern fn igCreateContext(shared_font_atlas: ?*FontAtlas) callconv(.C) ?*Context; pub extern fn igDebugCheckVersionAndDataLayout(version_str: ?[*:0]const u8, sz_io: usize, sz_style: usize, sz_vec2: usize, sz_vec4: usize, sz_drawvert: usize, sz_drawidx: usize) callconv(.C) bool; pub extern fn igDebugTextEncoding(text: ?[*]const u8) callconv(.C) void; @@ -5239,8 +5250,8 @@ pub const raw = struct { pub extern fn igIsWindowFocused(flags: FocusedFlagsInt) callconv(.C) bool; pub extern fn igIsWindowHovered(flags: HoveredFlagsInt) callconv(.C) bool; pub extern fn igLabelText(label: ?[*:0]const u8, fmt: ?[*:0]const u8, ...) callconv(.C) void; - pub extern fn igListBox_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const[*:0]const u8, items_count: i32, height_in_items: i32) callconv(.C) bool; - pub extern fn igListBox_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, height_in_items: i32) callconv(.C) bool; + pub extern fn igListBox_Str_arr(label: ?[*:0]const u8, current_item: ?*i32, items: [*]const [*:0]const u8, items_count: i32, height_in_items: i32) callconv(.C) bool; + pub extern fn igListBox_FnBoolPtr(label: ?[*:0]const u8, current_item: ?*i32, items_getter: ?*const fn (data: ?*anyopaque, idx: i32, out_text: *?[*:0]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: i32, height_in_items: i32) callconv(.C) bool; pub extern fn igLoadIniSettingsFromDisk(ini_filename: ?[*:0]const u8) callconv(.C) void; pub extern fn igLoadIniSettingsFromMemory(ini_data: ?[*]const u8, ini_size: usize) callconv(.C) void; pub extern fn igLogButtons() callconv(.C) void; @@ -5260,9 +5271,9 @@ pub const raw = struct { pub extern fn igOpenPopup_ID(id: ID, popup_flags: PopupFlagsInt) callconv(.C) void; pub extern fn igOpenPopupOnItemClick(str_id: ?[*:0]const u8, popup_flags: PopupFlagsInt) callconv(.C) void; pub extern fn igPlotHistogram_FloatPtr(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: *const Vec2, stride: i32) callconv(.C) void; - pub extern fn igPlotHistogram_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: *const Vec2) callconv(.C) void; + pub extern fn igPlotHistogram_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?*const fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: *const Vec2) callconv(.C) void; pub extern fn igPlotLines_FloatPtr(label: ?[*:0]const u8, values: *const f32, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: *const Vec2, stride: i32) callconv(.C) void; - pub extern fn igPlotLines_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: *const Vec2) callconv(.C) void; + pub extern fn igPlotLines_FnFloatPtr(label: ?[*:0]const u8, values_getter: ?*const fn (data: ?*anyopaque, idx: i32) callconv(.C) f32, data: ?*anyopaque, values_count: i32, values_offset: i32, overlay_text: ?[*:0]const u8, scale_min: f32, scale_max: f32, graph_size: *const Vec2) callconv(.C) void; pub extern fn igPopAllowKeyboardFocus() callconv(.C) void; pub extern fn igPopButtonRepeat() callconv(.C) void; pub extern fn igPopClipRect() callconv(.C) void; diff --git a/zig-imgui/imgui_build.zig b/zig-imgui/imgui_build.zig index 6e1aacf..ef3207f 100644 --- a/zig-imgui/imgui_build.zig +++ b/zig-imgui/imgui_build.zig @@ -1,14 +1,15 @@ const std = @import("std"); // @src() is only allowed inside of a function, so we need this wrapper -fn srcFile() []const u8 { return @src().file; } +fn srcFile() []const u8 { + return @src().file; +} const sep = std.fs.path.sep_str; const zig_imgui_path = std.fs.path.dirname(srcFile()).?; -pub const pkg = std.build.Pkg{ - .name = "imgui", - .source = .{ .path = zig_imgui_path ++ sep ++ "imgui.zig" }, -}; +//pub const pkg = std.build.Module{ +// .source = .{ .path = zig_imgui_path ++ sep ++ "imgui.zig" }, +//}; pub fn link(exe: *std.build.LibExeObjStep, dear_imgui_path: []const u8) void { if (!std.mem.eql(u8, std.fs.path.basename(dear_imgui_path), "imgui")) { @@ -18,12 +19,14 @@ pub fn link(exe: *std.build.LibExeObjStep, dear_imgui_path: []const u8) void { const dir_containing_imgui = std.fs.path.dirname(dear_imgui_path) orelse "."; const imgui_cpp_file = zig_imgui_path ++ sep ++ "cimgui_unity.cpp"; - exe.addPackage(pkg); + exe.addAnonymousModule("imgui", .{ + .source_file = .{ .path = zig_imgui_path ++ sep ++ "imgui.zig" }, + }); exe.linkLibCpp(); - exe.addIncludePath(dir_containing_imgui); - exe.addCSourceFile(imgui_cpp_file, &[_][]const u8 { - "-fno-sanitize=undefined", - "-ffunction-sections", + exe.addIncludePath(.{ .path = dir_containing_imgui }); + exe.addCSourceFile(.{ + .file = .{ .path = imgui_cpp_file }, + .flags = &[_][]const u8{ "-fno-sanitize=undefined", "-ffunction-sections" }, }); } @@ -34,10 +37,14 @@ pub fn addTestStep( mode: std.builtin.Mode, target: std.zig.CrossTarget, ) void { - const test_exe = b.addTest(zig_imgui_path ++ std.fs.path.sep_str ++ "tests.zig"); - test_exe.setBuildMode(mode); - test_exe.setTarget(target); - + const test_exe = b.addTest(.{ + .target = target, + .optimize = mode, + .root_source_file = .{ + .path = zig_imgui_path ++ std.fs.path.sep_str ++ "tests.zig", + }, + }); + link(test_exe, dear_imgui_path); const test_step = b.step(step_name, "Run zig-imgui tests"); diff --git a/zig-imgui/tests.zig b/zig-imgui/tests.zig index e4082f2..32d256d 100644 --- a/zig-imgui/tests.zig +++ b/zig-imgui/tests.zig @@ -6,11 +6,11 @@ extern fn igGET_FLT_MAX() callconv(.C) f32; extern fn igGET_FLT_MIN() callconv(.C) f32; test "FLT_MAX" { - assert(@bitCast(u32, ig.FLT_MAX) == @bitCast(u32, igGET_FLT_MAX())); + assert(@as(u32, @bitCast(ig.FLT_MAX)) == @as(u32, @bitCast(igGET_FLT_MAX()))); } test "FLT_MIN" { - assert(@bitCast(u32, ig.FLT_MIN) == @bitCast(u32, igGET_FLT_MIN())); + assert(@as(u32, @bitCast(ig.FLT_MIN)) == @as(u32, @bitCast(igGET_FLT_MIN()))); } test "Check version" { @@ -47,8 +47,8 @@ test "Compile everything" { compileEverything(ig, skip_none); // Compile instantiations of Vector - const skip_value_type = &[_][]const u8{ "value_type" }; - const skip_clear_delete = skip_value_type ++ &[_][]const u8{ "clear_delete" }; + const skip_value_type = &[_][]const u8{"value_type"}; + const skip_clear_delete = skip_value_type ++ &[_][]const u8{"clear_delete"}; const skip_comparisons = skip_clear_delete ++ &[_][]const u8{ "contains", "find", "find_erase", "find_erase_unsorted", "eql" }; compileEverything(ig.Vector(ig.Vec2), skip_clear_delete); compileEverything(ig.Vector(*ig.Vec4), skip_value_type);