code
stringlengths
38
801k
repo_path
stringlengths
6
263
const wlr = @import("../wlroots.zig"); const wayland = @import("wayland"); const wl = wayland.server.wl; pub const DataDeviceManager = extern struct { global: *wl.Global, data_sources: wl.list.Head(wl.DataSource, null), server_destroy: wl.Listener(*wl.Server), events: extern struct { destroy: wl.Signal(*DataDeviceManager) }, data: usize, extern fn wlr_data_device_manager_create(server: *wl.Server) ?*DataDeviceManager; pub fn create(server: *wl.Server) !*DataDeviceManager { return wlr_data_device_manager_create(server) orelse error.OutOfMemory; } }; pub const DataOffer = extern struct { pub const Type = extern enum { selection, drag, }; resource: *wl.DataOffer, source: ?*DataSource, type: Type, /// wlr.Seat.selection_offers, wlr.Seat.drag_offers link: wl.list.Link, actions: u32, preferred_action: wl.DataDeviceManager.DndAction.Enum, in_ask: bool, source_destroy: wl.Listener(*DataSource), }; pub const DataSource = extern struct { pub const Impl = extern struct { send: fn (source: *DataSource, mime_type: [*:0]const u8, fd: i32) callconv(.C) void, accept: ?fn (source: *DataSource, serial: u32, mime_type: ?[*:0]const u8) callconv(.C) void, destroy: ?fn (source: *DataSource) callconv(.C) void, dnd_drop: ?fn (source: *DataSource) callconv(.C) void, dnd_finish: ?fn (source: *DataSource) callconv(.C) void, dnd_action: ?fn (source: *DataSource, wl.DataDeviceManager.DndAction.Enum) callconv(.C) void, }; impl: *const Impl, mime_types: wl.Array, actions: i32, accepted: bool, current_dnd_action: wl.DataDeviceManager.DndAction.Enum, compositor_action: u32, events: extern struct { destroy: wl.Signal(*DataSource), }, extern fn wlr_data_source_init(source: *DataSource, impl: *const Impl) void; pub const init = wlr_data_source_init; extern fn wlr_data_source_send(source: *DataSource, mime_type: [*:0]const u8, fd: i32) void; pub const send = wlr_data_source_send; extern fn wlr_data_source_accept(source: *DataSource, serial: u32, mime_type: ?[*:0]const u8) void; pub const accept = wlr_data_source_accept; extern fn wlr_data_source_destroy(source: *DataSource) void; pub const destroy = wlr_data_source_destroy; extern fn wlr_data_source_dnd_drop(source: *DataSource) void; pub const dndDrop = wlr_data_source_dnd_drop; extern fn wlr_data_source_dnd_finish(source: *DataSource) void; pub const dndFinish = wlr_data_source_dnd_finish; extern fn wlr_data_source_dnd_action(source: *DataSource, action: wl.DataDeviceManager.DndAction.Enum) void; pub const dndAction = wlr_data_source_dnd_action; }; pub const Drag = extern struct { pub const Icon = extern struct { drag: *Drag, surface: *wlr.Surface, mapped: bool, events: extern struct { map: wl.Signal(*Drag.Icon), unmap: wl.Signal(*Drag.Icon), destroy: wl.Signal(*Drag.Icon), }, surface_destroy: wl.Listener(*wlr.Surface), data: usize, }; pub const GrabType = extern enum { keyboard, keyboard_pointer, keyboard_touch, }; pub const event = struct { pub const Motion = extern struct { drag: *Drag, time: u32, sx: f64, sy: f64, }; pub const Drop = extern struct { drag: *Drag, time: u32, }; }; grab_type: GrabType, keyboard_grab: wlr.Seat.KeyboardGrab, pointer_grab: wlr.Seat.PointerGrab, touch_grab: wlr.Seat.TouchGrab, seat: *wlr.Seat, seat_client: *wlr.Seat.Client, focus_client: ?*wlr.Seat.Client, icon: ?*Drag.Icon, focus: ?*wlr.Surface, source: ?*DataSource, started: bool, dropped: bool, cancelling: bool, grab_touch_id: i32, touch_id: i32, events: extern struct { focus: wl.Signal(*Drag), motion: wl.Signal(*event.Motion), drop: wl.Signal(*event.Drop), destroy: wl.Signal(*Drag), }, source_destroy: wl.Listener(*DataSource), seat_client_destroy: wl.Listener(*wlr.Seat.Client), icon_destroy: wl.Listener(*Drag.Icon), data: usize, extern fn wlr_drag_create( seat_client: *wlr.Seat.Client, source: ?*DataSource, icon_surface: ?*wlr.Surface, ) ?*Drag; pub fn create( seat_client: *wlr.Seat.Client, source: ?*DataSource, icon_surface: ?*wlr.Surface, ) !*Drag { return wlr_drag_create(seat_client, source, icon_surface) orelse error.OutOfMemory; } };
src/types/data_device.zig
const std = @import("std"); const assert = std.debug.assert; usingnamespace @import("tigerbeetle.zig"); pub const Header = @import("vr.zig").Header; pub const Operation = @import("state_machine.zig").Operation; pub fn connect(port: u16) !std.os.fd_t { var addr = try std.net.Address.parseIp4("127.0.0.1", port); var connection = try std.net.tcpConnectToAddress(addr); return connection.handle; } // TODO We can share most of what follows with `src/benchmark.zig`: pub const cluster_id: u128 = 746649394563965214; // a5ca1ab1ebee11e pub const client_id: u128 = 123; pub var request_number: u32 = 0; var sent_ping = false; pub fn send(fd: std.os.fd_t, operation: Operation, batch: anytype, Results: anytype) !void { // This is required to greet the cluster and identify the connection as being from a client: if (!sent_ping) { sent_ping = true; var ping = Header{ .command = .ping, .cluster = cluster_id, .client = client_id, .view = 0, }; ping.set_checksum_body(&[0]u8{}); ping.set_checksum(); assert((try std.os.sendto(fd, std.mem.asBytes(&ping), 0, null, 0)) == @sizeOf(Header)); var pong: [@sizeOf(Header)]u8 = undefined; var pong_size: u64 = 0; while (pong_size < @sizeOf(Header)) { var pong_bytes = try std.os.recvfrom(fd, pong[pong_size..], 0, null, null); if (pong_bytes == 0) @panic("server closed the connection (while waiting for pong)"); pong_size += pong_bytes; } } request_number += 1; var body = std.mem.asBytes(batch[0..]); var request = Header{ .cluster = cluster_id, .client = client_id, .view = 0, .request = request_number, .command = .request, .operation = operation, .size = @intCast(u32, @sizeOf(Header) + body.len), }; request.set_checksum_body(body[0..]); request.set_checksum(); const header = std.mem.asBytes(&request); assert((try std.os.sendto(fd, header[0..], 0, null, 0)) == header.len); if (body.len > 0) { assert((try std.os.sendto(fd, body[0..], 0, null, 0)) == body.len); } var recv: [1024 * 1024]u8 = undefined; const recv_bytes = try std.os.recvfrom(fd, recv[0..], 0, null, null); assert(recv_bytes >= @sizeOf(Header)); var response = std.mem.bytesAsValue(Header, recv[0..@sizeOf(Header)]); // TODO Add jsonStringfy to vr.Header: //const stdout = std.io.getStdOut().writer(); //try response.jsonStringify(.{}, stdout); //try stdout.writeAll("\n"); std.debug.print("{}\n", .{response}); assert(response.valid_checksum()); assert(recv_bytes >= response.size); const response_body = recv[@sizeOf(Header)..response.size]; assert(response.valid_checksum_body(response_body)); for (std.mem.bytesAsSlice(Results, response_body)) |result| { // TODO //try result.jsonStringify(.{}, stdout); //try stdout.writeAll("\n"); std.debug.print("{}\n", .{result}); } }
src/demo.zig
//TODO: // Add list of files to specifically ignore, // even if found inside a watched directory. // Allow globbing for above blacklist. // Should we have a separate thread just for // reading inotify events, to ensure fewer get skipped? // Add vim flag // requires new files to be written to once before their events // are registered. // Used to prevent vim buffers from creating events // Add watch for each file added to a directory // and only watch for file creation/deletion in a directory // Maintain modified state for each file using "IN_MODIFY" inotify flag. // If a file received "IN_CLOSE_WRITE" but never had "IN_MODIFY", we may ignore the event. // Add user flag to kill previous process when we would want to run a new command // Instead of pidwait we would add NOSIGCHILD or something like that to fork. // Then on each new command, we would see if the last command's pid is running, // and kill it if so. // Could track stat.mtime of files to allow ignoring the closing of files opened with write if no changes were made // Add counter flag '%i'. When used in a command it becomes the number of previously ran commands. const std = @import("std"); const os = std.os; const dict = std.hash_map; const warn = std.debug.warn; const assert = std.debug.assert; const inotify_bridge = @import("inotify_bridge.zig"); const tracked_items_t = u32; const max_tracked_items = std.math.maxInt(tracked_items_t); const inotify_watch_flags = os.IN_CLOSE_WRITE; //| os.IN_DELETE_SELF; const filename_fill_flag = "%f"; comptime { if (!os.linux.is_the_target) { @compileError("Unsupported OS"); } } const EventType = enum { CloseWrite, Replaced, ReplacedRecently, ReplacedSimilar, Deleted, Unexpected, }; const FileReplaceHistory = struct { var last_time: os.timespec = os.timespec{ .tv_sec = 100, .tv_nsec = 100 }; var last_size: i64 = 0; const activation_cooldown_s: f64 = 1.0; const minimum_activation_cooldown_s: f64 = 0.5; }; const InputError = error{ TooManyTrackedFiles, NoArgumentsGiven, NoFilesFound, }; fn usage(err: InputError) void { warn("{}\n", err); warn("Usage: follow [files and/or directories] [argument(s) sent to /bin/sh]\n\n"); warn("/bin/sh will be called with user supplied arguments when a followed file:\n"); warn("* is closed after having been opened with write permissions.\n"); warn(" Example: echo text > followed_filename\nor, saving a file in most programs.\n"); warn("* is replaced by another file.\n"); warn(" Example: mv anyfile followed_filename, or vim saving a file using a swap file.\n"); } pub fn main() !void { const dallocator = std.heap.direct_allocator; var arena = std.heap.ArenaAllocator.init(dallocator); defer arena.deinit(); const allocator = &arena.allocator; const argv: [][]u8 = try concat_args(allocator); const file_count: tracked_items_t = enumerate_files(argv) catch |err| { return usage(err); }; const files = argv[0..file_count]; const user_commands = argv[file_count..]; var inotify = inotify_bridge.inotify.init(allocator) catch |err| return warn("Failed to initialize inotify instance: {}\n", err); defer inotify.deinit(); for (files) |filename| { inotify.add_watch(filename, inotify_watch_flags) catch |err| return warn("{} while trying to follow '{}'\n", err, filename); } const fill_flag_indexes_opt: ?[]usize = try locate_needle_indexes( dallocator, filename_fill_flag[0..], user_commands, ); defer if (fill_flag_indexes_opt) |ff_indexes| dallocator.free(ff_indexes); var execve_command = [_][]const u8{ "/bin/sh", "-c", "echo this should be replaced", }; const envmap = try std.process.getEnvMap(allocator); var full_event: *inotify_bridge.expanded_inotify_event = undefined; if (fill_flag_indexes_opt) |fill_flag_indexes| { var filepath: []u8 = undefined; while (true) { full_event = inotify.next_event(); const event_type: EventType = discover_event_type(full_event, &inotify); _ = if (full_event.event.name == null) switch (event_type) { .Replaced, .ReplacedRecently, .ReplacedSimilar => rewatch_replaced_file(full_event, &inotify), else => null, }; if (!valid_event(event_type)) { continue; } if (full_event.event.name) |filename| { filepath = try std.fs.path.joinPosix(dallocator, [_][]const u8{ full_event.watched_name, filename }); var n: usize = filepath.len; filepath = try dallocator.realloc(filepath, filepath.len + 2); filepath[n + 1] = '"'; // final index of newly allocated memory while (n > 0) : (n -= 1) filepath[n] = filepath[n - 1]; filepath[0] = '"'; } else { filepath = full_event.watched_name; } defer if (full_event.event.name != null) dallocator.free(filepath); for (fill_flag_indexes) |index| { user_commands[index] = filepath; } const argv_commands = try std.mem.join(dallocator, " ", user_commands); defer dallocator.free(argv_commands); execve_command[2] = argv_commands; run_command(dallocator, &execve_command, &envmap) catch |err| { warn("Encountered '{}' while forking before running command '{}'\n", err, argv_commands); continue; }; } } else { const argv_commands = try std.mem.join(allocator, " ", user_commands); execve_command[2] = argv_commands; while (true) { full_event = inotify.next_event(); const event_type: EventType = discover_event_type(full_event, &inotify); _ = if (full_event.event.name == null) switch (event_type) { .Replaced, .ReplacedRecently, .ReplacedSimilar => rewatch_replaced_file(full_event, &inotify), else => null, }; if (!valid_event(event_type)) { continue; } run_command(dallocator, &execve_command, &envmap) catch |err| { warn("Encountered '{}' while forking before running command '{}'\n", err, argv_commands); continue; }; } } } fn valid_event(event_type: EventType) bool { switch (event_type) { .Unexpected, .Deleted, .ReplacedRecently, .ReplacedSimilar => return false, .CloseWrite, .Replaced => return true, } } fn run_command(allocator: *std.mem.Allocator, command: [][]const u8, envmap: *const std.BufMap) !void { const pid = try os.fork(); if (pid == 0) { const err = os.execve(allocator, command, envmap); for (command) |cmd| warn("Error running '{}'\n", cmd); warn("Error : '{}'\n", err); } else { const status = os.waitpid(pid, 0); if (status != 0) warn("child process exited with status: {}\n", status); } } fn discover_event_type( full_event: *inotify_bridge.expanded_inotify_event, inotify: *inotify_bridge.inotify, ) EventType { const event = full_event.event; const close_write = event.mask & os.linux.IN_CLOSE_WRITE != 0; const unwatched = event.mask & os.linux.IN_IGNORED != 0; const deleted = event.mask & os.linux.IN_DELETE_SELF != 0; const any_deleted = (deleted or unwatched); if (any_deleted) { var stat: os.Stat = undefined; var file_exists: bool = undefined; if (event.name) |filename| { // file indirectly watched via watched dir file_exists = (os.system.stat(filename.ptr, &stat) == 0); } else { file_exists = (os.system.stat(full_event.watched_name.ptr, &stat) == 0); } defer FileReplaceHistory.last_time = stat.mtim; defer FileReplaceHistory.last_size = stat.size; const curtime = total_time_sec(stat.mtim); const oldtime = total_time_sec(FileReplaceHistory.last_time); const delta = curtime - oldtime; const recently_replaced: bool = delta < FileReplaceHistory.activation_cooldown_s; const too_recently_replaced: bool = delta < FileReplaceHistory.minimum_activation_cooldown_s; if (recently_replaced and FileReplaceHistory.last_size == stat.size) { return EventType.ReplacedSimilar; } if (too_recently_replaced) { return EventType.ReplacedRecently; } if (file_exists) { return EventType.Replaced; } return EventType.Deleted; } if (close_write) return EventType.CloseWrite; return EventType.Unexpected; } fn total_time_sec(timestruct: os.timespec) f64 { const sec: f64 = @intToFloat(f64, timestruct.tv_sec); const nsec: f64 = @intToFloat(f64, timestruct.tv_nsec); const nsec_reduced: f64 = @divFloor(nsec, std.time.us_per_s) * 0.001; const totaltime: f64 = sec + nsec_reduced; return totaltime; } test "total time float accuracy" { var current_time: os.timespec = os.timespec{ .tv_sec = 123456789, .tv_nsec = 223456789 }; var last_time: os.timespec = os.timespec{ .tv_sec = 123456789, .tv_nsec = 123456789 }; assert(current_time.tv_sec >= last_time.tv_sec); var delta = total_time_sec(current_time) - total_time_sec(last_time); warn(" delta: {.}\n", delta); assert(delta < 1.0); assert(delta >= 0.1); current_time.tv_nsec = 923456789; last_time.tv_nsec = 123456789; delta = total_time_sec(current_time) - total_time_sec(last_time); assert(delta < 1.0); assert(delta > 0.79); current_time = os.timespec{ .tv_sec = 123456789, .tv_nsec = 223456789 }; last_time = os.timespec{ .tv_sec = 123456788, .tv_nsec = 123456789 }; delta = total_time_sec(current_time) - total_time_sec(last_time); assert(delta > 1.0); assert(delta < 1.2); current_time = os.timespec{ .tv_sec = 123456789, .tv_nsec = 123456789 }; last_time = os.timespec{ .tv_sec = 123456788, .tv_nsec = 923456789 }; delta = total_time_sec(current_time) - total_time_sec(last_time); assert(delta < 0.3); assert(delta > 0.1); } fn rewatch_replaced_file( full_event: *inotify_bridge.expanded_inotify_event, inotify: *inotify_bridge.inotify, ) void { // Intended to be used when a watched file is replaced. The original is deleted and therefore no longer watched // by inotify. So we must re-watch it. We first remove the old entry from our hashmap, just to be safe. // We probably shouldn't manually reach into the hashmap ourselves, and simply leave it to the inotify_bridge. // This would be cleaner and allow us to change the storage backend of inotify_bridge more easily. // Is inotify only sending deleted or unwatched, or is it sending both // and we're only receiving/processing one? // Could that be a race condition? If we receive both a deleted and unwatched // for a single file swap, we could end up calling "user_command" twice by accident. // TODO: Decide if we return true on the existence of any file, or only if a file is "trackable"? // is this a race condition? If a file is being replaced by, for example, a .swp file // Could this code be called in the middle, after deletion and before movement of .swp? _ = inotify.hashmap.remove(full_event.event.wd); if (full_event.event.name == null and trackable_file(full_event.watched_name)) { inotify.add_watch(full_event.watched_name, inotify_watch_flags) catch return; } } fn enumerate_files(argv: [][]u8) InputError!tracked_items_t { for (argv) |filename, index| { if (trackable_file(filename)) { continue; } if (index >= max_tracked_items) { warn("Max trackable files: {}\n", @intCast(tracked_items_t, max_tracked_items)); return error.TooManyTrackedFiles; } if (index == 0) { return error.NoFilesFound; } return @intCast(tracked_items_t, index); } else { return error.NoArgumentsGiven; } } fn trackable_file(filename: []u8) bool { var stat: os.Stat = undefined; const failure = (os.system.stat(filename.ptr, &stat) != 0); if (failure) { return false; } return os.system.S_ISREG(stat.mode) or os.system.S_ISDIR(stat.mode); } fn concat_args(allocator: *std.mem.Allocator) ![][]u8 { const arg_count = os.argv.len; const list_of_strings = try allocator.alloc([]u8, arg_count - 1); for (os.argv[1..arg_count]) |i, n| { list_of_strings[n] = std.mem.toSlice(u8, i); } return list_of_strings; } fn locate_needle_indexes(allocator: *std.mem.Allocator, needle: []const u8, haystack: [][]u8) !?[]usize { var needle_indexes: []usize = undefined; needle_indexes = try allocator.alloc(usize, haystack.len); for (needle_indexes) |*i| i.* = 0; var outer_index: usize = 0; for (haystack) |cmd, index| { if (std.mem.eql(u8, cmd, needle)) { needle_indexes[outer_index] = index; outer_index += 1; } } // no needles in haystack if (outer_index == 0) { allocator.free(needle_indexes); return null; } var index_count: usize = 1; for (needle_indexes[1..]) |i| { if (i == 0) break; index_count += 1; } needle_indexes = allocator.shrink(needle_indexes, index_count); return needle_indexes; } fn filewrite(filename: []const u8) !void { const file = try std.fs.File.openWrite(filename); defer file.close(); try file.write(""); }
follow.zig
const std = @import("std"); const expect = std.testing.expect; const Allocator = std.mem.Allocator; const Error = Allocator.Error; const RED: bool = true; const BLACK: bool = false; fn Node(comptime T: type) type { return struct { value: T, parent: ?*Node(T) = null, left: ?*Node(T) = null, right: ?*Node(T) = null, color: bool, }; } /// References: https://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf fn Tree(comptime T: type) type { return struct { root: ?*Node(T) = null, pub fn search(self: *Tree(T), value: T) ?*Node(T) { var node = self.root; while (node) |x| { if (value < x.value) { node = x.left; } else if (value > x.value) { node = x.right; } else { return x; } } return null; } pub fn insert(self: *Tree(T), value: T, allocator: *Allocator) !void { self.root = try insertNode(self.root, value, allocator); self.root.?.color = BLACK; } fn isRed(h: ?*Node(T)) bool { if (h) |v| { return v.color == RED; } return false; } fn flipColors(h: *Node(T)) void { h.color = !h.color; h.left.?.color = !h.left.?.color; h.right.?.color = !h.right.?.color; } fn rotateLeft(h: *Node(T)) *Node(T) { var x = h.right; h.right = x.?.left; x.?.left = h; x.?.color = h.color; h.color = RED; return x.?; } fn rotateRight(h: *Node(T)) *Node(T) { var x = h.left; h.left = x.?.right; x.?.right = h; x.?.color = h.color; h.color = RED; return x.?; } fn insertNode(node: ?*Node(T), value: T, allocator: *Allocator) Error!*Node(T) { if (node != null) { var h = node.?; if (isRed(h.left) and isRed(h.right)) { flipColors(h); } if (value == h.value) { h.value = value; } else if (value < h.value) { h.left = try insertNode(h.left, value, allocator); } else { h.right = try insertNode(h.right, value, allocator); } if (isRed(h.right) and !isRed(h.left)) { h = rotateLeft(h); } if (isRed(h.left) and isRed(h.left.?.left)) { h = rotateRight(h); } return h; } else { var new_node = try allocator.create(Node(T)); new_node.value = value; new_node.parent = null; new_node.left = null; new_node.right = null; new_node.color = RED; return new_node; } } }; } pub fn main() !void {} test "search empty tree" { var tree = Tree(i32){}; var result = tree.search(3); try expect(result == null); } test "search an existing element" { var tree = Tree(i32){}; var arena_allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena_allocator.deinit(); const allocator = &arena_allocator.allocator; try tree.insert(3, allocator); var result = tree.search(3); try expect(result.?.value == 3); try expect(result.?.color == BLACK); } test "search non-existent element" { var tree = Tree(i32){}; var arena_allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena_allocator.deinit(); const allocator = &arena_allocator.allocator; try tree.insert(3, allocator); var result = tree.search(4); try expect(result == null); } test "search for an element with multiple nodes" { var tree = Tree(i32){}; const values = [_]i32{ 15, 18, 17, 6, 7, 20, 3, 13, 2, 4, 9 }; var arena_allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena_allocator.deinit(); const allocator = &arena_allocator.allocator; for (values) |v| { try tree.insert(v, allocator); } var result = tree.search(4); try expect(result.?.value == 4); }
search_trees/llrb.zig
const std = @import("std"); const Self = @This(); const MyError = error { ElfTooSmall, CompressedInstruction, InvalidInstruction }; // imports are structs, so this whole file is a struct // integer registers iregs: [32]u64, // program counter pc: u64, // memory is a flat blob mem: std.ArrayList(u8), // instruction cycle pub fn mainloop(self: *Self) anyerror!void { // set the stack pointer (sp = x2) to the end of memory, since it grows downwards // https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf self.iregs[2] = self.mem.capacity; while (self.pc < self.mem.capacity) { // https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMAFDQC/riscv-spec-20191213.pdf // each cycle be sure to zero out the zero register to make sure its hardwired 0 self.iregs[0] = 0; // fetch the current instruction or die if it's not possible to fetch anymore // this is a u32 because screw compressed instructions for now const inst = self.fetch(); self.pc += 4; // we dont do compressed instructions here yet if (inst & 0b11 != 0b11) { std.log.warn("We dont do compressed instructions here...", .{}); return MyError.CompressedInstruction; } try self.execute(inst); } } // get the current instruction fn fetch(self: *Self) u32 { // little endian moment const i = self.pc; const ram = self.mem.items; return (@intCast(u32, ram[i + 3]) << 24) | (@intCast(u32, ram[i + 2]) << 16) | (@intCast(u32, ram[i + 1]) << 8) | ram[i]; } // execute a given instruction fn execute(self: *Self, inst: u32) !void { const opcode = @truncate(u7, inst); std.debug.print("0b{b}\n", .{opcode}); switch (opcode) { 0b0010011 => { std.debug.print("addi instruction detected\n", .{}); }, 0b0110011 => { std.debug.print("add instruction detected\n", .{}); }, else => { std.debug.print("unknown instruction detected\n", .{}); } } } // load the blob straight to the beginning of the memory and instantiate the CPU pub fn fromFlatBlob(blob: []const u8, alloc: *std.mem.Allocator) !Self { // zeroed registers and pc var cpu = Self { .iregs = std.mem.zeroes([32]u64), .pc = 0, .mem = std.ArrayList(u8).init(alloc) }; // reserve 64M of memory try cpu.mem.resize(64 * 1024 * 1024); // fill the beginning with the blob starting at address 0 try cpu.mem.replaceRange(0, blob.len, blob); return cpu; } // load an ELF binary and actually map it properly to memory pub fn fromElfBlob(blob: []const u8, alloc: *std.mem.Allocator) !Self { // make sure the slice can actually fit an ELF header if(blob.len < @sizeOf(std.elf.Elf64_Ehdr)) { return MyError.ElfTooSmall; } // get a FixedBufferStream var bufstream = std.io.fixedBufferStream(blob); // get an ELF header object var ehdr = try std.elf.Header.read(&bufstream); // zeroed registers, set PC to the entry point var cpu = Self { .iregs = std.mem.zeroes([32]u64), .pc = ehdr.entry, .mem = std.ArrayList(u8).init(alloc) }; // get a program header iterator var it = ehdr.program_header_iterator(&bufstream); // reserve 64M of memory try cpu.mem.resize(64 * 1024 * 1024); // load all the sections into memory! while(it.next() catch unreachable) |phdr| { if(phdr.p_type == std.elf.PT_LOAD) { std.debug.print("load {} bytes at 0x{x} from offset {}\n", .{phdr.p_filesz, phdr.p_vaddr, phdr.p_offset}); try cpu.mem.replaceRange(phdr.p_vaddr, phdr.p_filesz, blob[phdr.p_offset..(phdr.p_offset+phdr.p_filesz)]); } } return cpu; }
src/Cpu.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const GitError = error{ /// Generic error GenericError, /// Requested object could not be found NotFound, /// Object exists preventing operation Exists, /// More than one object matches Ambiguous, /// Output buffer too short to hold data BufferTooShort, /// A special error that is never generated by libgit2 code. You can return it from a callback (e.g to stop an iteration) /// to know that it was generated by the callback and not by libgit2. User, /// Operation not allowed on bare repository BareRepo, /// HEAD refers to branch with no commits UnbornBranch, /// Merge in progress prevented operation Unmerged, /// Reference was not fast-forwardable NonFastForwardable, /// Name/ref spec was not in a valid format InvalidSpec, /// Checkout conflicts prevented operation Conflict, /// Lock file prevented operation Locked, /// Reference value does not match expected Modifed, /// Authentication error Auth, /// Server certificate is invalid Certificate, /// Patch/merge has already been applied Applied, /// The requested peel operation is not possible Peel, /// Unexpected EOF EndOfFile, /// Invalid operation or input Invalid, /// Uncommitted changes in index prevented operation Uncommited, /// The operation is not valid for a directory Directory, /// A merge conflict exists and cannot continue MergeConflict, /// A user-configured callback refused to act Passthrough, /// Signals end of iteration with iterator IterOver, /// Internal only Retry, /// Hashsum mismatch in object Mismatch, /// Unsaved changes in the index would be overwritten IndexDirty, /// Patch application failed ApplyFail, }; /// Transform a `GitError` into the matching `libgit2` error code pub fn errorToCInt(err: GitError) c_int { return switch (err) { git.GitError.GenericError => c.GIT_ERROR, git.GitError.NotFound => c.GIT_ENOTFOUND, git.GitError.Exists => c.GIT_EEXISTS, git.GitError.Ambiguous => c.GIT_EAMBIGUOUS, git.GitError.BufferTooShort => c.GIT_EBUFS, git.GitError.User => c.GIT_EUSER, git.GitError.BareRepo => c.GIT_EBAREREPO, git.GitError.UnbornBranch => c.GIT_EUNBORNBRANCH, git.GitError.Unmerged => c.GIT_EUNMERGED, git.GitError.NonFastForwardable => c.GIT_ENONFASTFORWARD, git.GitError.InvalidSpec => c.GIT_EINVALIDSPEC, git.GitError.Conflict => c.GIT_ECONFLICT, git.GitError.Locked => c.GIT_ELOCKED, git.GitError.Modifed => c.GIT_EMODIFIED, git.GitError.Auth => c.GIT_EAUTH, git.GitError.Certificate => c.GIT_ECERTIFICATE, git.GitError.Applied => c.GIT_EAPPLIED, git.GitError.Peel => c.GIT_EPEEL, git.GitError.EndOfFile => c.GIT_EEOF, git.GitError.Invalid => c.GIT_EINVALID, git.GitError.Uncommited => c.GIT_EUNCOMMITTED, git.GitError.Directory => c.GIT_EDIRECTORY, git.GitError.MergeConflict => c.GIT_EMERGECONFLICT, git.GitError.Passthrough => c.GIT_PASSTHROUGH, git.GitError.IterOver => c.GIT_ITEROVER, git.GitError.Retry => c.GIT_RETRY, git.GitError.Mismatch => c.GIT_EMISMATCH, git.GitError.IndexDirty => c.GIT_EINDEXDIRTY, git.GitError.ApplyFail => c.GIT_EAPPLYFAIL, }; } pub const DetailedError = extern struct { raw_message: [*:0]const u8, class: ErrorClass, pub const ErrorClass = enum(c_int) { none = 0, no_memory, os, invalid, reference, zlib, repository, config, regex, odb, index, object, net, tag, tree, indexer, ssl, submodule, thread, stash, checkout, fetchhead, merge, ssh, filter, revert, callback, cherrypick, describe, rebase, filesystem, patch, worktree, sha1, http, internal, }; pub fn message(self: DetailedError) [:0]const u8 { return std.mem.sliceTo(self.raw_message, 0); } test { try std.testing.expectEqual(@sizeOf(c.git_error), @sizeOf(DetailedError)); try std.testing.expectEqual(@bitSizeOf(c.git_error), @bitSizeOf(DetailedError)); } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); }
src/errors.zig
const std = @import("std"); const ArrayList = std.ArrayList; const parseFloat = std.fmt.parseFloat; const log = @import("./log.zig").log; const render = @import("./render.zig"); const Canvas = render.Canvas; const Pixel = render.Pixel; const math_utils = @import("./math_utils.zig"); const Point = math_utils.Point; const star_math = @import("./star_math.zig"); const Star = star_math.Star; const Constellation = star_math.Constellation; const SkyCoord = star_math.SkyCoord; const Coord = star_math.Coord; const ObserverPosition = star_math.ObserverPosition; const GreatCircle = star_math.GreatCircle; const allocator = std.heap.page_allocator; var canvas: Canvas = undefined; var stars: []Star = undefined; var waypoints: []Coord = undefined; const num_waypoints = 150; var constellations: []Constellation = undefined; var result_data: []u8 = undefined; const ExternCanvasSettings = packed struct { width: u32, height: u32, background_radius: f32, zoom_factor: f32, drag_speed: f32, draw_north_up: u8, draw_constellation_grid: u8, draw_asterisms: u8, zodiac_only: u8, fn getCanvasSettings(self: ExternCanvasSettings) Canvas.Settings { return Canvas.Settings{ .width = self.width, .height = self.height, .background_radius = self.background_radius, .zoom_factor = self.zoom_factor, .drag_speed = self.drag_speed, .draw_north_up = self.draw_north_up == 1, .draw_constellation_grid = self.draw_constellation_grid == 1, .draw_asterisms = self.draw_asterisms == 1, .zodiac_only = self.zodiac_only == 1, }; } }; pub export fn allocateStars(num_stars: u32) [*]Star { stars = allocator.alloc(Star, @intCast(usize, num_stars)) catch unreachable; waypoints = allocator.alloc(Coord, num_waypoints) catch unreachable; return stars.ptr; } pub export fn initializeCanvas(settings: *ExternCanvasSettings) void { canvas = Canvas.init(allocator, settings.getCanvasSettings()) catch { const num_pixels = canvas.settings.width * canvas.settings.height; log(.Error, "Ran out of memory during canvas intialization (needed {} kB for {} pixels)", .{(num_pixels * @sizeOf(Pixel)) / 1000, num_pixels}); unreachable; }; } // Format: // num_constellations | num_boundary_coords | num_asterism_coords | ...constellations | ...constellation_boundaries | ...constellation asterisms // constellations size = num_constellations * { f32 f32 u8 } // constellation_boundaries size = num_boundary_coords * { f32 f32 } // constellation_asterisms size = num_asterism_coords * { f32 f32 } pub export fn initializeConstellations(data: [*]u8) void { const ConstellationInfo = packed struct { num_boundaries: u32, num_asterisms: u32, is_zodiac: u8, }; const num_constellations = std.mem.bytesToValue(u32, data[0..4]); const num_boundaries = std.mem.bytesToValue(u32, data[4..8]); const num_asterisms = std.mem.bytesToValue(u32, data[8..12]); const constellation_end_index = @intCast(usize, 12 + num_constellations * @sizeOf(ConstellationInfo)); const boundary_end_index = @intCast(usize, constellation_end_index + num_boundaries * @sizeOf(SkyCoord)); const asterism_end_index = @intCast(usize, boundary_end_index + num_asterisms * @sizeOf(SkyCoord)); const constellation_data = @ptrCast([*]ConstellationInfo, data[12..constellation_end_index])[0..num_constellations]; const boundary_data = @ptrCast([*]SkyCoord, data[constellation_end_index..boundary_end_index])[0..num_boundaries]; const asterism_data = @ptrCast([*]SkyCoord, data[boundary_end_index..asterism_end_index])[0..num_asterisms]; constellations = allocator.alloc(Constellation, num_constellations) catch { log(.Error, "Error while allocating constellations: tried to allocate {} constellations\n", .{num_constellations}); unreachable; }; var c_bound_start: usize = 0; var c_ast_start: usize = 0; for (constellations) |*c, c_index| { c.* = Constellation{ .is_zodiac = constellation_data[c_index].is_zodiac != 0, .boundaries = boundary_data[c_bound_start..c_bound_start + constellation_data[c_index].num_boundaries], .asterism = asterism_data[c_ast_start..c_ast_start + constellation_data[c_index].num_asterisms], }; c_bound_start += constellation_data[c_index].num_boundaries; c_ast_start += constellation_data[c_index].num_asterisms; } } pub export fn updateCanvasSettings(settings: *ExternCanvasSettings) void { canvas.settings = settings.getCanvasSettings(); } pub export fn getImageData(size_in_bytes: *u32) [*]Pixel { size_in_bytes.* = @intCast(u32, canvas.data.len * @sizeOf(Pixel)); return canvas.data.ptr; } pub export fn resetImageData() void { for (canvas.data) |*p| { p.* = Pixel{}; } } pub export fn projectStars(observer_latitude: f32, observer_longitude: f32, observer_timestamp: i64) void { const pos = ObserverPosition{ .latitude = observer_latitude, .longitude = observer_longitude, .timestamp = observer_timestamp }; for (stars) |star| { star_math.projectStar(&canvas, star, pos); } } pub export fn projectConstellationGrids(observer_latitude: f32, observer_longitude: f32, observer_timestamp: i64) void { const pos = ObserverPosition{ .latitude = observer_latitude, .longitude = observer_longitude, .timestamp = observer_timestamp }; if (canvas.settings.draw_constellation_grid or canvas.settings.draw_asterisms) { for (constellations) |constellation| { if (canvas.settings.zodiac_only and !constellation.is_zodiac) continue; if (canvas.settings.draw_constellation_grid) { star_math.projectConstellationGrid(&canvas, constellation, Pixel.rgba(255, 245, 194, 155), 1, pos); } if (canvas.settings.draw_asterisms) { star_math.projectConstellationAsterism(&canvas, constellation, Pixel.rgba(255, 245, 194, 155), 1, pos); } } } } pub export fn getConstellationAtPoint(x: f32, y: f32, observer_latitude: f32, observer_longitude: f32, observer_timestamp: i64) isize { const point = Point{ .x = x, .y = y }; const pos = ObserverPosition{ .latitude = observer_latitude, .longitude = observer_longitude, .timestamp = observer_timestamp }; const index = star_math.getConstellationAtPoint(&canvas, point, constellations, pos); if (index) |i| { if (canvas.settings.draw_constellation_grid) { star_math.projectConstellationGrid(&canvas, constellations[i], Pixel.rgb(255, 255, 255), 2, pos); } if (canvas.settings.draw_asterisms) { star_math.projectConstellationAsterism(&canvas, constellations[i], Pixel.rgb(255, 255, 255), 2, pos); } return @intCast(isize, i); } else return -1; } pub export fn initializeResultData() [*]u8 { result_data = allocator.alloc(u8, 8) catch unreachable; return result_data.ptr; } pub export fn dragAndMove(drag_start_x: f32, drag_start_y: f32, drag_end_x: f32, drag_end_y: f32) void { const coord = star_math.dragAndMove(drag_start_x, drag_start_y, drag_end_x, drag_end_y, canvas.settings.drag_speed); setResult(coord.latitude, coord.longitude); } pub export fn findWaypoints(start_lat: f32, start_long: f32, end_lat: f32, end_long: f32) [*]Coord { const start = Coord{ .latitude = start_lat, .longitude = start_long }; const end = Coord{ .latitude = end_lat, .longitude = end_long }; const great_circle = GreatCircle(num_waypoints).init(start, end); std.mem.copy(Coord, waypoints, great_circle.waypoints[0..]); return waypoints.ptr; } pub export fn getCoordForSkyCoord(right_ascension: f32, declination: f32, observer_timestamp: i64) void { const sky_coord = SkyCoord{ .right_ascension = right_ascension, .declination = declination }; const coord = sky_coord.getCoord(observer_timestamp); setResult(coord.latitude, coord.longitude); } pub export fn getSkyCoordForCanvasPoint(x: f32, y: f32, observer_latitude: f32, observer_longitude: f32, observer_timestamp: i64) void { const point = Point{ .x = x, .y = y }; const pos = ObserverPosition{ .latitude = observer_latitude, .longitude = observer_longitude, .timestamp = observer_timestamp }; const sky_coord = canvas.pointToCoord(point, pos) orelse SkyCoord{}; setResult(sky_coord.right_ascension, sky_coord.declination); } pub export fn getCoordForCanvasPoint(x: f32, y: f32, observer_latitude: f32, observer_longitude: f32, observer_timestamp: i64) void { const point = Point{ .x = x, .y = y }; const pos = ObserverPosition{ .latitude = observer_latitude, .longitude = observer_longitude, .timestamp = observer_timestamp }; const sky_coord = canvas.pointToCoord(point, pos) orelse SkyCoord{}; setResult(sky_coord.right_ascension, sky_coord.declination); } pub export fn getConstellationCentroid(constellation_index: usize) void { const centroid = if (constellation_index > constellations.len) SkyCoord{} else constellations[constellation_index].centroid(); setResult(centroid.right_ascension, centroid.declination); } fn setResult(a: f32, b: f32) void { std.mem.copy(u8, @ptrCast([*]u8, result_data)[0..4], std.mem.toBytes(a)[0..]); std.mem.copy(u8, @ptrCast([*]u8, result_data)[4..8], std.mem.toBytes(b)[0..]); } pub export fn _wasm_alloc(byte_len: u32) ?[*]u8 { const buffer = allocator.alloc(u8, byte_len) catch return null; return buffer.ptr; } pub export fn _wasm_free(items: [*]u8, byte_len: u32) void { const bounded_items = items[0..byte_len]; allocator.free(bounded_items); }
night-math/src/wasm_interface.zig
const std = @import("std"); const Wwise = @import("wwise.zig").Wwise; const ImGui = @import("imgui.zig").ImGui; const zigwin32 = @import("zigwin32"); const win32 = zigwin32.everything; const d3d = zigwin32.graphics.direct3d; const d3d11 = zigwin32.graphics.direct3d11; const dxgi = zigwin32.graphics.dxgi; const NullDemo = @import("demos/demo_interface.zig").NullDemo; const L = std.unicode.utf8ToUtf16LeStringLiteral; const DemoData = struct { displayName: [:0]const u8, instanceType: type, }; const AllDemos = [_]DemoData{ .{ .displayName = "Localization Demo", .instanceType = @import("demos/localization_demo.zig").LocalizationDemo, }, .{ .displayName = "RTPC Demo (Car Engine)", .instanceType = @import("demos/rtpc_car_engine_demo.zig").RtpcCarEngineDemo, }, .{ .displayName = "Footsteps Demo", .instanceType = @import("demos/footsteps_demo.zig").FootstepsDemo, }, .{ .displayName = "Subtitle Demo", .instanceType = @import("demos/subtitle_demo.zig").SubtitleDemo, }, }; const DxContext = struct { device: ?*d3d11.ID3D11Device = null, deviceContext: ?*d3d11.ID3D11DeviceContext = null, swapChain: ?*dxgi.IDXGISwapChain = null, mainRenderTargetView: ?*d3d11.ID3D11RenderTargetView = null, }; var dxContext: DxContext = undefined; fn createDeviceD3D(hWnd: ?win32.HWND) bool { var sd = std.mem.zeroes(dxgi.DXGI_SWAP_CHAIN_DESC); sd.BufferCount = 2; sd.BufferDesc.Width = 0; sd.BufferDesc.Height = 0; sd.BufferDesc.Format = .R8G8B8A8_UNORM; sd.BufferDesc.RefreshRate.Numerator = 60; sd.BufferDesc.RefreshRate.Denominator = 1; sd.Flags = @enumToInt(dxgi.DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH); sd.BufferUsage = dxgi.DXGI_USAGE_RENDER_TARGET_OUTPUT; sd.OutputWindow = hWnd; sd.SampleDesc.Count = 1; sd.SampleDesc.Quality = 0; sd.Windowed = @boolToInt(true); sd.SwapEffect = .DISCARD; var featureLevel: d3d.D3D_FEATURE_LEVEL = undefined; const featureLevelArray = &[_]d3d.D3D_FEATURE_LEVEL{ .@"11_0", .@"10_0", }; if (d3d11.D3D11CreateDeviceAndSwapChain(null, .HARDWARE, null, d3d11.D3D11_CREATE_DEVICE_FLAG.initFlags(.{}), featureLevelArray, 2, d3d11.D3D11_SDK_VERSION, &sd, &dxContext.swapChain, &dxContext.device, &featureLevel, &dxContext.deviceContext) != win32.S_OK) return false; createRenderTarget(); return true; } fn createRenderTarget() void { var pBackBuffer: ?*d3d11.ID3D11Texture2D = null; if (dxContext.swapChain) |swapChain| { _ = swapChain.IDXGISwapChain_GetBuffer(0, d3d11.IID_ID3D11Texture2D, @ptrCast(?*?*c_void, &pBackBuffer)); } if (dxContext.device) |device| { _ = device.ID3D11Device_CreateRenderTargetView(@ptrCast(?*d3d11.ID3D11Resource, pBackBuffer), null, @ptrCast(?*?*d3d11.ID3D11RenderTargetView, &dxContext.mainRenderTargetView)); } if (pBackBuffer) |backBuffer| { _ = backBuffer.IUnknown_Release(); } } fn cleanupDeviceD3D() void { cleanupRenderTarget(); if (dxContext.swapChain) |swapChain| { _ = swapChain.IUnknown_Release(); } if (dxContext.deviceContext) |deviceContext| { _ = deviceContext.IUnknown_Release(); } if (dxContext.device) |device| { _ = device.IUnknown_Release(); } } fn cleanupRenderTarget() void { if (dxContext.mainRenderTargetView) |mainRenderTargetView| { _ = mainRenderTargetView.IUnknown_Release(); dxContext.mainRenderTargetView = null; } } pub fn main() !void { const winClass: win32.WNDCLASSEXW = .{ .cbSize = @sizeOf(win32.WNDCLASSEXW), .style = win32.CS_CLASSDC, .lpfnWndProc = WndProc, .cbClsExtra = 0, .cbWndExtra = 0, .hInstance = win32.GetModuleHandleW(null), .hIcon = null, .hCursor = null, .hbrBackground = null, .lpszMenuName = null, .lpszClassName = L("WwiseDemo"), .hIconSm = null, }; _ = win32.RegisterClassExW(&winClass); defer _ = win32.UnregisterClassW(winClass.lpszClassName, winClass.hInstance); const hwnd = win32.CreateWindowExW(win32.WINDOW_EX_STYLE.initFlags(.{}), winClass.lpszClassName, L("Zig Wwise Demo"), win32.WS_OVERLAPPEDWINDOW, 100, 100, 1200, 800, null, null, winClass.hInstance, null); if (hwnd == null) { std.log.warn("Error creating Win32 Window = 0x{x}\n", .{@enumToInt(win32.GetLastError())}); return error.InvalidWin32Window; } defer _ = win32.DestroyWindow(hwnd); const dxResult = createDeviceD3D(hwnd); defer cleanupDeviceD3D(); if (!dxResult) { return error.D3DInitError; } _ = win32.ShowWindow(hwnd, win32.SW_SHOWDEFAULT); _ = win32.UpdateWindow(hwnd); Wwise.init() catch |err| { switch (err) { error.MemoryManagerFailed => { @panic("AK Memory Manager failed to initialized!"); }, error.StreamManagerFailed => { @panic("AK Stream Manager failed to initialized!"); }, error.LowLevelIOFailed => { @panic("Low Level I/O failed to initialize!"); }, error.SoundEngineFailed => { @panic("Could not initialize the Sound Engine!"); }, error.CommunicationFailed => { @panic("Could not initiliaze Wwise Communication!"); }, } }; defer Wwise.deinit(); std.log.info("Wwise initialized successfully!\n", .{}); const currentDir = try std.fs.path.resolve(std.heap.c_allocator, &[_][]const u8{"."}); defer std.heap.c_allocator.free(currentDir); const soundBanksPath = try std.fs.path.join(std.heap.c_allocator, &[_][]const u8{ currentDir, "WwiseProject\\GeneratedSoundBanks\\Windows" }); defer std.heap.c_allocator.free(soundBanksPath); try Wwise.setIOHookBasePath(soundBanksPath); const loadBankID = try Wwise.loadBankByString("Init.bnk"); defer { _ = Wwise.unloadBankByID(loadBankID); } try Wwise.registerGameObj(1, "Listener"); defer Wwise.unregisterGameObj(1); Wwise.setDefaultListeners(&[_]u64{1}); // Setup Dear ImGui context const imGuiContext = ImGui.igCreateContext(null); defer ImGui.igDestroyContext(imGuiContext); const io = ImGui.igGetIO(); _ = ImGui.ImFontAtlas_AddFontFromFileTTF(io[0].Fonts, "data/SourceSansPro-Semibold.ttf", 28.0, null, null); // Setup Dear ImGui style ImGui.igStyleColorsDark(null); // Setup platform/renderer bindings ImGui.igImplWin32_Init(hwnd); defer ImGui.igImplWin32_Shutdown(); ImGui.igImplDX11_Init(@ptrCast(?*ImGui.struct_ID3D11Device, dxContext.device), @ptrCast(?*ImGui.struct_ID3D11DeviceContext, dxContext.deviceContext)); defer ImGui.igImplDX11_Shutdown(); const clearColor = ImGui.ImVec4{ .x = 0.0, .y = 0.0, .z = 0.0, .w = 1.00, }; var defaultInstance = try std.heap.c_allocator.create(NullDemo); var currentDemo = defaultInstance.getInterface(); try currentDemo.init(std.heap.c_allocator); defer currentDemo.deinit(); var msg: win32.MSG = std.mem.zeroes(win32.MSG); while (msg.message != win32.WM_QUIT) { if (win32.PeekMessageW(&msg, null, 0, 0, win32.PM_REMOVE) != 0) { _ = win32.TranslateMessage(&msg); _ = win32.DispatchMessageW(&msg); continue; } ImGui.igImplDX11_NewFrame(); ImGui.igImplWin32_NewFrame(); ImGui.igNewFrame(); var isOpen: bool = true; _ = ImGui.igBegin("Zig Wwise", &isOpen, ImGui.ImGuiWindowFlags_AlwaysAutoResize); inline for (AllDemos) |demoData| { if (ImGui.igButton(demoData.displayName, .{ .x = 0, .y = 0 })) { currentDemo.deinit(); var newDemoInstance = try std.heap.c_allocator.create(demoData.instanceType); currentDemo = newDemoInstance.getInterface(); try currentDemo.init(std.heap.c_allocator); currentDemo.show(); } } ImGui.igEnd(); if (currentDemo.isVisible()) { try currentDemo.onUI(); } ImGui.igRender(); if (dxContext.deviceContext) |deviceContext| { _ = deviceContext.ID3D11DeviceContext_OMSetRenderTargets(1, @ptrCast(?[*]?*d3d11.ID3D11RenderTargetView, &dxContext.mainRenderTargetView), null); _ = deviceContext.ID3D11DeviceContext_ClearRenderTargetView(dxContext.mainRenderTargetView, @ptrCast(*const f32, &clearColor)); } ImGui.igImplDX11_RenderDrawData(ImGui.igGetDrawData()); if (dxContext.swapChain) |swapChain| { _ = swapChain.IDXGISwapChain_Present(1, 0); } Wwise.renderAudio(); } } pub fn WndProc(hWnd: win32.HWND, msg: u32, wParam: win32.WPARAM, lParam: win32.LPARAM) callconv(.C) win32.LRESULT { if (ImGui.igImplWin32_WndProcHandler(hWnd, msg, wParam, lParam) != 0) { return 1; } switch (msg) { win32.WM_SIZE => { if (wParam != win32.SIZE_MINIMIZED) { if (dxContext.swapChain) |swapChain| { cleanupRenderTarget(); _ = swapChain.IDXGISwapChain_ResizeBuffers(0, @intCast(u32, lParam) & 0xFFFF, (@intCast(u32, lParam) >> 16) & 0xFFFF, .UNKNOWN, 0); createRenderTarget(); } } return 0; }, win32.WM_SYSCOMMAND => { if ((wParam & 0xfff0) == win32.SC_KEYMENU) { return 0; } }, win32.WM_DESTROY => { _ = win32.PostQuitMessage(0); return 0; }, else => {}, } return win32.DefWindowProcW(hWnd, msg, wParam, lParam); } pub export fn WinMain(hInstance: ?win32.HINSTANCE, hPrevInstance: ?win32.HINSTANCE, lpCmdLine: ?std.os.windows.LPWSTR, nShowCmd: i32) i32 { _ = hInstance; _ = hPrevInstance; _ = lpCmdLine; _ = nShowCmd; main() catch unreachable; return 0; }
src/main.zig
const std = @import("std"); const Type = @import("Value.zig").Type; const Allocator = std.mem.Allocator; //! This file contains Luf's typed intermediate representation //! This pass is used by codegen to construct other output such as WASM, //! Luf bytecode, ASM or other possible future outputs. /// General instruction struct. Contains the type (tag) of the instruction, /// and also the source code position, which can be used for debug symbols. /// `Inst` is used as a child pointer to the actual Instruction set. pub const Inst = struct { /// The type of instruction tag: Tag, /// The position of the instruction within the source code pos: usize, /// Luf type that corresponts to the instructions ty: Type, /// The kind of instruction pub const Tag = enum { add, assign, int, string, sub, mul, div, eql, nql, eql_lt, eql_gt, lt, gt, assign_add, assign_sub, assign_mul, assign_div, func, func_arg, call, @"for", @"while", @"switch", condition, @"break", @"continue", @"enum", range, list, map, decl, ident, primitive, @"return", negate, import, mod, @"and", @"or", bitwise_xor, bitwise_or, bitwise_and, bitwise_not, shift_left, shift_right, not, block, comment, store, pair, load, type_def, branch, expr, slice, /// Returns the type of that belongs to a `Tag` /// Can be used to cast to the correct Type from a `Tag`. pub fn IrType(self: Tag) type { return switch (self) { .negate, .@"return", .bitwise_not, .not, .expr, => Single, .add, .sub, .mul, .div, .eql, .nql, .eql_lt, .eql_gt, .lt, .gt, .@"while", .range, .mod, .@"and", .@"or", .bitwise_xor, .bitwise_or, .bitwise_and, .shift_left, .shift_right, .assign_add, .assign_sub, .assign_mul, .assign_div, .pair, .load, .branch, .assign, => Double, .store, .slice => Triple, .condition => Condition, .primitive => Primitive, .func => Function, .func_arg => FuncArg, .call => Call, .@"for" => Loop, .@"switch" => Switch, .@"break", .@"continue" => NoOp, .list, .map => DataStructure, .decl => Decl, .int => Int, .string, .import, .comment => String, .block => Block, .@"enum" => Enum, .ident => Ident, .type_def => TypeDef, }; } }; /// Casts `Inst` into the type that corresponds to `tag` /// returns null if tag does not match. pub fn castTag(self: *Inst, comptime tag: Tag) ?*tag.IrType() { if (self.tag != tag) return null; return @fieldParentPtr(tag.IrType(), "base", self); } /// Casts `Inst` into `T` /// Caller must ensure tags are matching, if unsure /// use castTag() pub fn as(self: *Inst, comptime T: type) *T { return @fieldParentPtr(T, "base", self); } /// Declaration which contains the name, position, scope and value pub const Decl = struct { base: Inst, name: []const u8, is_pub: bool = false, is_mut: bool = false, scope: Scope, /// position within the global or local scope index: u32, value: *Inst, pub const Scope = enum { global, local }; }; pub const Int = struct { base: Inst, value: u64, }; pub const String = struct { base: Inst, value: []const u8, }; pub const DataStructure = struct { base: Inst, elements: []*Inst, }; pub const Block = struct { base: Inst, instructions: []*Inst, }; pub const Function = struct { base: Inst, body: *Inst, args: []*Inst, ret_type: *Inst, locals: []*Inst, }; pub const FuncArg = struct { base: Inst, name: []const u8, }; pub const Call = struct { base: Inst, args: []*Inst, func: *Inst, }; pub const Loop = struct { base: Inst, it: *Inst, block: *Inst, capture: *Inst, index: ?*Inst, }; pub const NoOp = struct { base: Inst, }; pub const Enum = struct { base: Inst, value: []*Inst, }; pub const Ident = struct { base: Inst, index: u32, scope: Scope, name: []const u8, pub const Scope = enum { global, local }; }; pub const TypeDef = struct { base: Inst, }; pub const Switch = struct { base: Inst, capture: *Inst, branches: []*Inst, }; pub const Primitive = struct { base: Inst, prim_type: PrimType, pub const PrimType = enum { @"void", @"true", @"false", nil, }; }; pub const Single = struct { base: Inst, rhs: *Inst, }; pub const Double = struct { base: Inst, lhs: *Inst, rhs: *Inst, }; pub const Triple = struct { base: Inst, lhs: *Inst, index: *Inst, rhs: *Inst, }; pub const Condition = struct { base: Inst, cond: *Inst, then_block: *Inst, else_block: ?*Inst, }; }; pub const Instructions = std.ArrayListUnmanaged(*Inst); /// Final compilation unit. Contains a list of all IR instructions pub const CompileUnit = struct { /// the final instructions list instructions: []const *Inst, /// The allocator used to create the instructions gpa: *Allocator, /// state used to free all instructions at once state: std.heap.ArenaAllocator.State, /// Frees memory of generated instructions pub fn deinit(self: *CompileUnit) void { self.state.promote(self.gpa).deinit(); self.gpa.free(self.instructions); self.* = undefined; } }; /// Module contains helper functions to generate IR pub const Module = struct { /// Allocator to create new instructions gpa: *Allocator, pub const Error = error{OutOfMemory}; /// Creates a new `Int` instruction pub fn emitInt(self: *Module, pos: usize, value: u64) Error!*Inst { const inst = try self.gpa.create(Inst.Int); inst.* = .{ .base = .{ .tag = .int, .pos = pos, .ty = .integer, }, .value = value, }; return &inst.base; } /// Creates a new `String` instruction. This duplicates the string value /// and takes ownership of its memory. Caller must therefore free the original's /// string's memory by themselves pub fn emitString(self: *Module, comptime tag: Inst.Tag, pos: usize, value: []const u8) Error!*Inst { const inst = try self.gpa.create(Inst.String); inst.* = .{ .base = .{ .tag = tag, .pos = pos, .ty = switch (tag) { .string, .comment => .string, .import => .module, else => @compileError("Unsupported type"), }, }, .value = try self.gpa.dupe(u8, value), }; return &inst.base; } /// Creates a new `Block` instruction for the given inner instructions pub fn emitBlock(self: *Module, pos: usize, instructions: []*Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Block); inst.* = .{ .base = .{ .tag = .block, .pos = pos, .ty = ._void, }, .instructions = try self.gpa.dupe(*Inst, instructions), }; return &inst.base; } /// Creates a new `Primitive` with the given `value` pub fn emitPrimitive(self: *Module, pos: usize, value: Inst.Primitive.PrimType) Error!*Inst { const inst = try self.gpa.create(Inst.Primitive); inst.* = .{ .base = .{ .tag = .primitive, .pos = pos, .ty = switch (value) { .@"true", .@"false" => .boolean, .@"void" => ._void, .nil => .nil, }, }, .prim_type = value, }; return &inst.base; } /// Constructs a new `Declaration` instruction pub fn emitDecl( self: *Module, pos: usize, name: []const u8, index: u32, scope: Inst.Decl.Scope, is_pub: bool, is_mut: bool, value: *Inst, ) Error!*Inst { const inst = try self.gpa.create(Inst.Decl); inst.* = .{ .base = .{ .tag = .decl, .pos = pos, .ty = value.ty, }, .scope = scope, .name = try self.gpa.dupe(u8, name), .is_mut = is_mut, .is_pub = is_pub, .index = index, .value = value, }; return &inst.base; } /// Creates a new `List` instruction with `Type` `scalar_type` pub fn emitList(self: *Module, tag: Inst.Tag, pos: usize, elements: []*Inst) Error!*Inst { const inst = try self.gpa.create(Inst.DataStructure); inst.* = .{ .base = .{ .tag = tag, .pos = pos, .ty = .list, }, .elements = try self.gpa.dupe(*Inst, elements), }; return &inst.base; } /// Creates a new `Function` instruction pub fn emitFunc( self: *Module, pos: usize, body: *Inst, locals: []*Inst, args: []*Inst, ret_type: *Inst, ) Error!*Inst { const inst = try self.gpa.create(Inst.Function); inst.* = .{ .base = .{ .tag = .func, .pos = pos, .ty = .function, }, .body = body, .locals = locals, .args = args, .ret_type = ret_type, }; return &inst.base; } /// Creates a `FuncArg` instruction pub fn emitFuncArg(self: *Module, pos: usize, ty: Type, name: []const u8) Error!*Inst { const inst = try self.gpa.create(Inst.FuncArg); inst.* = .{ .base = .{ .tag = .func_arg, .pos = pos, .ty = ty, }, .name = try self.gpa.dupe(u8, name), }; return &inst.base; } /// Creates a loop instruction pub fn emitFor( self: *Module, pos: usize, iterator: *Inst, block: *Inst, capture: *Inst, index: ?*Inst, ) Error!*Inst { const inst = try self.gpa.create(Inst.Loop); inst.* = .{ .base = .{ .tag = .@"for", .pos = pos, .ty = ._void, }, .it = iterator, .block = block, .capture = capture, .index = index, }; return &inst.base; } /// Creates a `NoOp` instruction, used for control flow such as continue and break pub fn emitNoOp(self: *Module, pos: usize, tag: Inst.Tag) Error!*Inst { const inst = try self.gpa.create(Inst.NoOp); inst.* = .{ .base = .{ .tag = tag, .pos = pos, .ty = ._void, }, }; return &inst.base; } /// Constructs a new `Enum` instruction pub fn emitEnum(self: *Module, pos: usize, nodes: []*Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Enum); inst.* = .{ .base = .{ .tag = .@"enum", .pos = pos, .ty = ._enum, }, .value = try self.gpa.dupe(*Inst, nodes), }; return &inst.base; } /// Creates a `Switch` instruction pub fn emitSwitch(self: *Module, pos: usize, capture: *Inst, branches: []*Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Switch); inst.* = .{ .base = .{ .tag = .@"switch", .pos = pos, .ty = ._void, }, .capture = capture, .branches = try self.gpa.dupe(*Inst, branches), }; return &inst.base; } /// Emits a `Single` instruction, that contains the tag and a rhs `Inst` /// Used for unary operations such as a negate or 'return x' pub fn emitSingle(self: *Module, pos: usize, tag: Inst.Tag, rhs: *Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Single); inst.* = .{ .base = .{ .tag = tag, .pos = pos, .ty = rhs.ty, }, .rhs = rhs, }; return &inst.base; } /// Emits a `Double` instruction, that contains the `Tag`, lhs and rhs `Inst` /// Used to set a lhs value, or retrieve a value from a list or map pub fn emitDouble(self: *Module, pos: usize, tag: Inst.Tag, lhs: *Inst, rhs: *Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Double); inst.* = .{ .base = .{ .tag = tag, .pos = pos, .ty = lhs.ty, }, .lhs = lhs, .rhs = rhs, }; return &inst.base; } /// Emits a `Triple` instruction, that contains the `Tag`, lhs, index and a rhs `Inst` /// Used for setting the value of an element inside a list or map pub fn emitTriple( self: *Module, pos: usize, tag: Inst.Tag, lhs: *Inst, index: *Inst, rhs: *Inst, ) Error!*Inst { const inst = try self.gpa.create(Inst.Triple); inst.* = .{ .base = .{ .tag = tag, .pos = pos, .ty = rhs.ty, }, .lhs = lhs, .index = index, .rhs = rhs, }; return &inst.base; } /// Emits a `Condition` instruction, used for if expressions pub fn emitCond(self: *Module, pos: usize, cond: *Inst, then_block: *Inst, else_block: ?*Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Condition); inst.* = .{ .base = .{ .tag = .condition, .pos = pos, .ty = ._void, }, .cond = cond, .then_block = then_block, .else_block = else_block, }; return &inst.base; } /// Emits a `Call` instruction which calls a function pub fn emitCall(self: *Module, ty: Type, pos: usize, func: *Inst, args: []*Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Call); inst.* = .{ .base = .{ .tag = .call, .pos = pos, .ty = ty, }, .args = try self.gpa.dupe(*Inst, args), .func = func, }; return &inst.base; } /// Emits an identifier that contains the scope that it was defined in and its index pub fn emitIdent( self: *Module, ty: Type, pos: usize, name: []const u8, scope: Inst.Ident.Scope, index: u32, ) Error!*Inst { const inst = try self.gpa.create(Inst.Ident); inst.* = .{ .base = .{ .tag = .ident, .pos = pos, .ty = ty, }, .name = try self.gpa.dupe(u8, name), .index = index, .scope = scope, }; return &inst.base; } /// Emits a type definition pub fn emitType(self: *Module, ty: Type, pos: usize) Error!*Inst { const inst = try self.gpa.create(Inst.TypeDef); inst.* = .{ .base = .{ .tag = .type_def, .pos = pos, .ty = ty, }, }; return &inst.base; } /// Emits a slice instruction pub fn emitSlice(self: *Module, pos: usize, left: *Inst, start: *Inst, end: *Inst) Error!*Inst { const inst = try self.gpa.create(Inst.Triple); inst.* = .{ .base = .{ .tag = .slice, .pos = pos, .ty = .list, }, .lhs = left, .index = start, .rhs = end, }; return &inst.base; } };
src/ir.zig
const std = @import("std"); const mach = @import("mach"); const gpu = @import("gpu"); const App = @This(); pipeline: gpu.RenderPipeline, queue: gpu.Queue, pub fn init(app: *App, engine: *mach.Engine) !void { const vs_module = engine.device.createShaderModule(&.{ .label = "my vertex shader", .code = .{ .wgsl = @embedFile("vert.wgsl") }, }); const fs_module = engine.device.createShaderModule(&.{ .label = "my fragment shader", .code = .{ .wgsl = @embedFile("frag.wgsl") }, }); // Fragment state const blend = gpu.BlendState{ .color = .{ .operation = .add, .src_factor = .one, .dst_factor = .zero, }, .alpha = .{ .operation = .add, .src_factor = .one, .dst_factor = .zero, }, }; const color_target = gpu.ColorTargetState{ .format = engine.swap_chain_format, .blend = &blend, .write_mask = gpu.ColorWriteMask.all, }; const fragment = gpu.FragmentState{ .module = fs_module, .entry_point = "main", .targets = &.{color_target}, .constants = null, }; const pipeline_descriptor = gpu.RenderPipeline.Descriptor{ .fragment = &fragment, .layout = null, .depth_stencil = null, .vertex = .{ .module = vs_module, .entry_point = "main", .buffers = null, }, .multisample = .{ .count = 1, .mask = 0xFFFFFFFF, .alpha_to_coverage_enabled = false, }, .primitive = .{ .front_face = .ccw, .cull_mode = .none, .topology = .triangle_list, .strip_index_format = .none, }, }; app.pipeline = engine.device.createRenderPipeline(&pipeline_descriptor); app.queue = engine.device.getQueue(); vs_module.release(); fs_module.release(); } pub fn deinit(_: *App, _: *mach.Engine) void {} pub fn update(app: *App, engine: *mach.Engine) !void { const back_buffer_view = engine.swap_chain.?.getCurrentTextureView(); const color_attachment = gpu.RenderPassColorAttachment{ .view = back_buffer_view, .resolve_target = null, .clear_value = std.mem.zeroes(gpu.Color), .load_op = .clear, .store_op = .store, }; const encoder = engine.device.createCommandEncoder(null); const render_pass_info = gpu.RenderPassEncoder.Descriptor{ .color_attachments = &.{color_attachment}, .depth_stencil_attachment = null, }; const pass = encoder.beginRenderPass(&render_pass_info); pass.setPipeline(app.pipeline); pass.draw(3, 1, 0, 0); pass.end(); pass.release(); var command = encoder.finish(null); encoder.release(); app.queue.submit(&.{command}); command.release(); engine.swap_chain.?.present(); back_buffer_view.release(); }
examples/triangle/main.zig
pub const ptrdiff_t = c_long; pub const wchar_t = c_int; pub const max_align_t = extern struct { __clang_max_align_nonce1: c_longlong, __clang_max_align_nonce2: c_longdouble, }; pub const __u_char = u8; pub const __u_short = c_ushort; pub const __u_int = c_uint; pub const __u_long = c_ulong; pub const __int8_t = i8; pub const __uint8_t = u8; pub const __int16_t = c_short; pub const __uint16_t = c_ushort; pub const __int32_t = c_int; pub const __uint32_t = c_uint; pub const __int64_t = c_long; pub const __uint64_t = c_ulong; pub const __quad_t = c_long; pub const __u_quad_t = c_ulong; pub const __intmax_t = c_long; pub const __uintmax_t = c_ulong; pub const __dev_t = c_ulong; pub const __uid_t = c_uint; pub const __gid_t = c_uint; pub const __ino_t = c_ulong; pub const __ino64_t = c_ulong; pub const __mode_t = c_uint; pub const __nlink_t = c_ulong; pub const __off_t = c_long; pub const __off64_t = c_long; pub const __pid_t = c_int; pub const __fsid_t = extern struct { __val: [2]c_int, }; pub const __clock_t = c_long; pub const __rlim_t = c_ulong; pub const __rlim64_t = c_ulong; pub const __id_t = c_uint; pub const __time_t = c_long; pub const __useconds_t = c_uint; pub const __suseconds_t = c_long; pub const __daddr_t = c_int; pub const __key_t = c_int; pub const __clockid_t = c_int; pub const __timer_t = ?*c_void; pub const __blksize_t = c_long; pub const __blkcnt_t = c_long; pub const __blkcnt64_t = c_long; pub const __fsblkcnt_t = c_ulong; pub const __fsblkcnt64_t = c_ulong; pub const __fsfilcnt_t = c_ulong; pub const __fsfilcnt64_t = c_ulong; pub const __fsword_t = c_long; pub const __ssize_t = c_long; pub const __syscall_slong_t = c_long; pub const __syscall_ulong_t = c_ulong; pub const __loff_t = __off64_t; pub const __caddr_t = ?[*]u8; pub const __intptr_t = c_long; pub const __socklen_t = c_uint; pub const __sig_atomic_t = c_int; pub const int_least8_t = i8; pub const int_least16_t = c_short; pub const int_least32_t = c_int; pub const int_least64_t = c_long; pub const uint_least8_t = u8; pub const uint_least16_t = c_ushort; pub const uint_least32_t = c_uint; pub const uint_least64_t = c_ulong; pub const int_fast8_t = i8; pub const int_fast16_t = c_long; pub const int_fast32_t = c_long; pub const int_fast64_t = c_long; pub const uint_fast8_t = u8; pub const uint_fast16_t = c_ulong; pub const uint_fast32_t = c_ulong; pub const uint_fast64_t = c_ulong; pub const intmax_t = __intmax_t; pub const uintmax_t = __uintmax_t; pub const VkFlags = u32; pub const VkBool32 = u32; pub const VkDeviceSize = u64; pub const VkSampleMask = u32; pub const struct_VkInstance_T = opaque {}; pub const VkInstance = ?*struct_VkInstance_T; pub const struct_VkPhysicalDevice_T = opaque {}; pub const VkPhysicalDevice = ?*struct_VkPhysicalDevice_T; pub const struct_VkDevice_T = opaque {}; pub const VkDevice = ?*struct_VkDevice_T; pub const struct_VkQueue_T = opaque {}; pub const VkQueue = ?*struct_VkQueue_T; pub const struct_VkSemaphore_T = opaque {}; pub const VkSemaphore = ?*struct_VkSemaphore_T; pub const struct_VkCommandBuffer_T = opaque {}; pub const VkCommandBuffer = ?*struct_VkCommandBuffer_T; pub const struct_VkFence_T = opaque {}; pub const VkFence = ?*struct_VkFence_T; pub const struct_VkDeviceMemory_T = opaque {}; pub const VkDeviceMemory = ?*struct_VkDeviceMemory_T; pub const struct_VkBuffer_T = opaque {}; pub const VkBuffer = ?*struct_VkBuffer_T; pub const struct_VkImage_T = opaque {}; pub const VkImage = ?*struct_VkImage_T; pub const struct_VkEvent_T = opaque {}; pub const VkEvent = ?*struct_VkEvent_T; pub const struct_VkQueryPool_T = opaque {}; pub const VkQueryPool = ?*struct_VkQueryPool_T; pub const struct_VkBufferView_T = opaque {}; pub const VkBufferView = ?*struct_VkBufferView_T; pub const struct_VkImageView_T = opaque {}; pub const VkImageView = ?*struct_VkImageView_T; pub const struct_VkShaderModule_T = opaque {}; pub const VkShaderModule = ?*struct_VkShaderModule_T; pub const struct_VkPipelineCache_T = opaque {}; pub const VkPipelineCache = ?*struct_VkPipelineCache_T; pub const struct_VkPipelineLayout_T = opaque {}; pub const VkPipelineLayout = ?*struct_VkPipelineLayout_T; pub const struct_VkRenderPass_T = opaque {}; pub const VkRenderPass = ?*struct_VkRenderPass_T; pub const struct_VkPipeline_T = opaque {}; pub const VkPipeline = ?*struct_VkPipeline_T; pub const struct_VkDescriptorSetLayout_T = opaque {}; pub const VkDescriptorSetLayout = ?*struct_VkDescriptorSetLayout_T; pub const struct_VkSampler_T = opaque {}; pub const VkSampler = ?*struct_VkSampler_T; pub const struct_VkDescriptorPool_T = opaque {}; pub const VkDescriptorPool = ?*struct_VkDescriptorPool_T; pub const struct_VkDescriptorSet_T = opaque {}; pub const VkDescriptorSet = ?*struct_VkDescriptorSet_T; pub const struct_VkFramebuffer_T = opaque {}; pub const VkFramebuffer = ?*struct_VkFramebuffer_T; pub const struct_VkCommandPool_T = opaque {}; pub const VkCommandPool = ?*struct_VkCommandPool_T; pub const VK_PIPELINE_CACHE_HEADER_VERSION_ONE = enum_VkPipelineCacheHeaderVersion.VK_PIPELINE_CACHE_HEADER_VERSION_ONE; pub const VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = enum_VkPipelineCacheHeaderVersion.VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE; pub const VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = enum_VkPipelineCacheHeaderVersion.VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE; pub const VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = enum_VkPipelineCacheHeaderVersion.VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE; pub const VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = enum_VkPipelineCacheHeaderVersion.VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM; pub const enum_VkPipelineCacheHeaderVersion = extern enum { VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = 1, VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = 1, VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = 1, VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 2147483647, }; pub const VkPipelineCacheHeaderVersion = enum_VkPipelineCacheHeaderVersion; pub const VK_SUCCESS = enum_VkResult.VK_SUCCESS; pub const VK_NOT_READY = enum_VkResult.VK_NOT_READY; pub const VK_TIMEOUT = enum_VkResult.VK_TIMEOUT; pub const VK_EVENT_SET = enum_VkResult.VK_EVENT_SET; pub const VK_EVENT_RESET = enum_VkResult.VK_EVENT_RESET; pub const VK_INCOMPLETE = enum_VkResult.VK_INCOMPLETE; pub const VK_ERROR_OUT_OF_HOST_MEMORY = enum_VkResult.VK_ERROR_OUT_OF_HOST_MEMORY; pub const VK_ERROR_OUT_OF_DEVICE_MEMORY = enum_VkResult.VK_ERROR_OUT_OF_DEVICE_MEMORY; pub const VK_ERROR_INITIALIZATION_FAILED = enum_VkResult.VK_ERROR_INITIALIZATION_FAILED; pub const VK_ERROR_DEVICE_LOST = enum_VkResult.VK_ERROR_DEVICE_LOST; pub const VK_ERROR_MEMORY_MAP_FAILED = enum_VkResult.VK_ERROR_MEMORY_MAP_FAILED; pub const VK_ERROR_LAYER_NOT_PRESENT = enum_VkResult.VK_ERROR_LAYER_NOT_PRESENT; pub const VK_ERROR_EXTENSION_NOT_PRESENT = enum_VkResult.VK_ERROR_EXTENSION_NOT_PRESENT; pub const VK_ERROR_FEATURE_NOT_PRESENT = enum_VkResult.VK_ERROR_FEATURE_NOT_PRESENT; pub const VK_ERROR_INCOMPATIBLE_DRIVER = enum_VkResult.VK_ERROR_INCOMPATIBLE_DRIVER; pub const VK_ERROR_TOO_MANY_OBJECTS = enum_VkResult.VK_ERROR_TOO_MANY_OBJECTS; pub const VK_ERROR_FORMAT_NOT_SUPPORTED = enum_VkResult.VK_ERROR_FORMAT_NOT_SUPPORTED; pub const VK_ERROR_FRAGMENTED_POOL = enum_VkResult.VK_ERROR_FRAGMENTED_POOL; pub const VK_ERROR_OUT_OF_POOL_MEMORY = enum_VkResult.VK_ERROR_OUT_OF_POOL_MEMORY; pub const VK_ERROR_INVALID_EXTERNAL_HANDLE = enum_VkResult.VK_ERROR_INVALID_EXTERNAL_HANDLE; pub const VK_ERROR_SURFACE_LOST_KHR = enum_VkResult.VK_ERROR_SURFACE_LOST_KHR; pub const VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = enum_VkResult.VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; pub const VK_SUBOPTIMAL_KHR = enum_VkResult.VK_SUBOPTIMAL_KHR; pub const VK_ERROR_OUT_OF_DATE_KHR = enum_VkResult.VK_ERROR_OUT_OF_DATE_KHR; pub const VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = enum_VkResult.VK_ERROR_INCOMPATIBLE_DISPLAY_KHR; pub const VK_ERROR_VALIDATION_FAILED_EXT = enum_VkResult.VK_ERROR_VALIDATION_FAILED_EXT; pub const VK_ERROR_INVALID_SHADER_NV = enum_VkResult.VK_ERROR_INVALID_SHADER_NV; pub const VK_ERROR_FRAGMENTATION_EXT = enum_VkResult.VK_ERROR_FRAGMENTATION_EXT; pub const VK_ERROR_NOT_PERMITTED_EXT = enum_VkResult.VK_ERROR_NOT_PERMITTED_EXT; pub const VK_ERROR_OUT_OF_POOL_MEMORY_KHR = enum_VkResult.VK_ERROR_OUT_OF_POOL_MEMORY_KHR; pub const VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = enum_VkResult.VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR; pub const VK_RESULT_BEGIN_RANGE = enum_VkResult.VK_RESULT_BEGIN_RANGE; pub const VK_RESULT_END_RANGE = enum_VkResult.VK_RESULT_END_RANGE; pub const VK_RESULT_RANGE_SIZE = enum_VkResult.VK_RESULT_RANGE_SIZE; pub const VK_RESULT_MAX_ENUM = enum_VkResult.VK_RESULT_MAX_ENUM; pub const enum_VkResult = extern enum { VK_SUCCESS = 0, VK_NOT_READY = 1, VK_TIMEOUT = 2, VK_EVENT_SET = 3, VK_EVENT_RESET = 4, VK_INCOMPLETE = 5, VK_ERROR_OUT_OF_HOST_MEMORY = -1, VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, VK_ERROR_INITIALIZATION_FAILED = -3, VK_ERROR_DEVICE_LOST = -4, VK_ERROR_MEMORY_MAP_FAILED = -5, VK_ERROR_LAYER_NOT_PRESENT = -6, VK_ERROR_EXTENSION_NOT_PRESENT = -7, VK_ERROR_FEATURE_NOT_PRESENT = -8, VK_ERROR_INCOMPATIBLE_DRIVER = -9, VK_ERROR_TOO_MANY_OBJECTS = -10, VK_ERROR_FORMAT_NOT_SUPPORTED = -11, VK_ERROR_FRAGMENTED_POOL = -12, VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000, VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003, VK_ERROR_SURFACE_LOST_KHR = -1000000000, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, VK_SUBOPTIMAL_KHR = 1000001003, VK_ERROR_OUT_OF_DATE_KHR = -1000001004, VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_ERROR_INVALID_SHADER_NV = -1000012000, VK_ERROR_FRAGMENTATION_EXT = -1000161000, VK_ERROR_NOT_PERMITTED_EXT = -1000174001, VK_RESULT_MAX_ENUM = 0x7FFFFFFF, }; pub const VkResult = enum_VkResult; pub const VK_STRUCTURE_TYPE_APPLICATION_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_APPLICATION_INFO; pub const VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_SUBMIT_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_SUBMIT_INFO; pub const VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; pub const VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = enum_VkStructureType.VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE; pub const VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_SPARSE_INFO; pub const VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_EVENT_CREATE_INFO; pub const VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO; pub const VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; pub const VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; pub const VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; pub const VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pub const VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; pub const VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = enum_VkStructureType.VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; pub const VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = enum_VkStructureType.VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; pub const VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; pub const VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; pub const VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; pub const VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; pub const VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO; pub const VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; pub const VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; pub const VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = enum_VkStructureType.VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; pub const VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; pub const VK_STRUCTURE_TYPE_MEMORY_BARRIER = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_BARRIER; pub const VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; pub const VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES; pub const VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS; pub const VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO; pub const VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO; pub const VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2; pub const VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2; pub const VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2; pub const VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2; pub const VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; pub const VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2; pub const VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2; pub const VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2; pub const VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES; pub const VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO; pub const VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES; pub const VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES; pub const VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2 = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2; pub const VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO; pub const VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO; pub const VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES; pub const VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO; pub const VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO; pub const VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; pub const VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO; pub const VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO; pub const VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES; pub const VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO; pub const VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES; pub const VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR; pub const VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR; pub const VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR; pub const VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD; pub const VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT; pub const VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT; pub const VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; pub const VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV; pub const VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = enum_VkStructureType.VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD; pub const VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV; pub const VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV; pub const VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV; pub const VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV; pub const VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT; pub const VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = enum_VkStructureType.VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN; pub const VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; pub const VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR; pub const VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR; pub const VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR; pub const VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR; pub const VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX; pub const VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX; pub const VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX; pub const VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX; pub const VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX; pub const VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX; pub const VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT; pub const VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT; pub const VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT; pub const VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT; pub const VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = enum_VkStructureType.VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX; pub const VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_HDR_METADATA_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_HDR_METADATA_EXT; pub const VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR; pub const VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR; pub const VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR; pub const VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR; pub const VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR; pub const VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = enum_VkStructureType.VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; pub const VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = enum_VkStructureType.VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; pub const VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; pub const VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT; pub const VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; pub const VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT; pub const VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID = enum_VkStructureType.VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID; pub const VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID = enum_VkStructureType.VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID; pub const VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID = enum_VkStructureType.VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID; pub const VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID; pub const VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID; pub const VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT; pub const VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV; pub const VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT; pub const VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT; pub const VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; pub const VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT; pub const VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR; pub const VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR; pub const VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR; pub const VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR; pub const VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR; pub const VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR; pub const VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR; pub const VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR; pub const VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR; pub const VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR; pub const VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR; pub const VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = enum_VkStructureType.VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR; pub const VK_STRUCTURE_TYPE_BEGIN_RANGE = enum_VkStructureType.VK_STRUCTURE_TYPE_BEGIN_RANGE; pub const VK_STRUCTURE_TYPE_END_RANGE = enum_VkStructureType.VK_STRUCTURE_TYPE_END_RANGE; pub const VK_STRUCTURE_TYPE_RANGE_SIZE = enum_VkStructureType.VK_STRUCTURE_TYPE_RANGE_SIZE; pub const VK_STRUCTURE_TYPE_MAX_ENUM = enum_VkStructureType.VK_STRUCTURE_TYPE_MAX_ENUM; pub const enum_VkStructureType = extern enum { VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO = 1000157001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES = 1000083000, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS = 1000127000, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO = 1000127001, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO = 1000060000, VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO = 1000060003, VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO = 1000060004, VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO = 1000060005, VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO = 1000060006, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO = 1000060013, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO = 1000060014, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES = 1000070000, VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO = 1000070001, VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2 = 1000146000, VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2 = 1000146001, VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2 = 1000146002, VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 = 1000146003, VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2 = 1000146004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 = 1000059000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 = 1000059001, VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2 = 1000059002, VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2 = 1000059003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2 = 1000059004, VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2 = 1000059005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2 = 1000059006, VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2 = 1000059007, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2 = 1000059008, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES = 1000117000, VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO = 1000117001, VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO = 1000117002, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO = 1000117003, VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO = 1000053000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES = 1000053001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES = 1000053002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = 1000120000, VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO = 1000145000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES = 1000145001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES = 1000145002, VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2 = 1000145003, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO = 1000156000, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO = 1000156001, VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO = 1000156002, VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO = 1000156003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES = 1000156004, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES = 1000156005, VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO = 1000085000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO = 1000071000, VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES = 1000071001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO = 1000071002, VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES = 1000071003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES = 1000071004, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO = 1000072000, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO = 1000072001, VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO = 1000072002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO = 1000112000, VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES = 1000112001, VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO = 1000113000, VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO = 1000077000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO = 1000076000, VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES = 1000076001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES = 1000168000, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = 1000168001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = 1000063000, VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007, VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR = 1000060008, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR = 1000060009, VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR = 1000060010, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = 1000060011, VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = 1000060012, VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000, VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001, VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000, VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001, VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000, VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001, VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002, VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003, VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004, VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003, VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT = 1000101000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT = 1000101001, VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR = 1000121000, VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR = 1000121001, VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR = 1000121002, VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR = 1000121003, VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR = 1000121004, VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = 1000128000, VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT = 1000128001, VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT = 1000128002, VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT = 1000128003, VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT = 1000128004, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID = 1000129000, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID = 1000129001, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID = 1000129002, VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129003, VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129004, VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID = 1000129005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000, VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = 1000130001, VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT = 1000143003, VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT = 1000143004, VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR = 1000147000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160000, VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160001, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT = 1000161000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT = 1000161001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT = 1000161002, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = 1000161003, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = 1000161004, VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000, VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001, //VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR = 1000053000, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR = 1000053001, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR = 1000053002, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001, //VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002, //VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004, //VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006, //VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008, //VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR = 1000060000, //VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR = 1000060003, //VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR = 1000060004, //VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR = 1000060005, //VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR = 1000060006, //VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR = 1000060013, //VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR = 1000060014, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR = 1000070000, //VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR = 1000070001, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000, //VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002, //VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004, //VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = 1000072000, //VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = 1000072001, //VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = 1000072002, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000, //VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001, //VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = 1000077000, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000, //VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = 1000085000, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000, //VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001, //VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = 1000113000, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR = 1000117000, //VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR = 1000117001, //VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = 1000117002, //VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = 1000117003, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000, //VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000, //VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001, //VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146000, //VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146001, //VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146002, //VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = 1000146003, //VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = 1000146004, //VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR = 1000156000, //VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR = 1000156001, //VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR = 1000156002, //VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR = 1000156003, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR = 1000156004, //VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = 1000156005, //VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = 1000157000, //VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = 1000157001, //VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = 1000168000, //VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = 1000168001, //VK_STRUCTURE_TYPE_BEGIN_RANGE = 0, //VK_STRUCTURE_TYPE_END_RANGE = 48, //VK_STRUCTURE_TYPE_RANGE_SIZE = 49, //VK_STRUCTURE_TYPE_MAX_ENUM = 2147483647, }; pub const VkStructureType = enum_VkStructureType; pub const VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_COMMAND; pub const VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_OBJECT; pub const VK_SYSTEM_ALLOCATION_SCOPE_CACHE = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_CACHE; pub const VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_DEVICE; pub const VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE; pub const VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE; pub const VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE; pub const VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE; pub const VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = enum_VkSystemAllocationScope.VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM; pub const enum_VkSystemAllocationScope = extern enum { VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, //VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = 0, //VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = 4, VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = 5, VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 2147483647, }; pub const VkSystemAllocationScope = enum_VkSystemAllocationScope; pub const VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = enum_VkInternalAllocationType.VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE; pub const VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = enum_VkInternalAllocationType.VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE; pub const VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = enum_VkInternalAllocationType.VK_INTERNAL_ALLOCATION_TYPE_END_RANGE; pub const VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = enum_VkInternalAllocationType.VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE; pub const VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = enum_VkInternalAllocationType.VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM; pub const enum_VkInternalAllocationType = extern enum { VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, //VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = 0, //VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = 0, VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = 1, VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 2147483647, }; pub const VkInternalAllocationType = enum_VkInternalAllocationType; pub const VK_FORMAT_UNDEFINED = enum_VkFormat.VK_FORMAT_UNDEFINED; pub const VK_FORMAT_R4G4_UNORM_PACK8 = enum_VkFormat.VK_FORMAT_R4G4_UNORM_PACK8; pub const VK_FORMAT_R4G4B4A4_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_R4G4B4A4_UNORM_PACK16; pub const VK_FORMAT_B4G4R4A4_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_B4G4R4A4_UNORM_PACK16; pub const VK_FORMAT_R5G6B5_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_R5G6B5_UNORM_PACK16; pub const VK_FORMAT_B5G6R5_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_B5G6R5_UNORM_PACK16; pub const VK_FORMAT_R5G5B5A1_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_R5G5B5A1_UNORM_PACK16; pub const VK_FORMAT_B5G5R5A1_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_B5G5R5A1_UNORM_PACK16; pub const VK_FORMAT_A1R5G5B5_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_A1R5G5B5_UNORM_PACK16; pub const VK_FORMAT_R8_UNORM = enum_VkFormat.VK_FORMAT_R8_UNORM; pub const VK_FORMAT_R8_SNORM = enum_VkFormat.VK_FORMAT_R8_SNORM; pub const VK_FORMAT_R8_USCALED = enum_VkFormat.VK_FORMAT_R8_USCALED; pub const VK_FORMAT_R8_SSCALED = enum_VkFormat.VK_FORMAT_R8_SSCALED; pub const VK_FORMAT_R8_UINT = enum_VkFormat.VK_FORMAT_R8_UINT; pub const VK_FORMAT_R8_SINT = enum_VkFormat.VK_FORMAT_R8_SINT; pub const VK_FORMAT_R8_SRGB = enum_VkFormat.VK_FORMAT_R8_SRGB; pub const VK_FORMAT_R8G8_UNORM = enum_VkFormat.VK_FORMAT_R8G8_UNORM; pub const VK_FORMAT_R8G8_SNORM = enum_VkFormat.VK_FORMAT_R8G8_SNORM; pub const VK_FORMAT_R8G8_USCALED = enum_VkFormat.VK_FORMAT_R8G8_USCALED; pub const VK_FORMAT_R8G8_SSCALED = enum_VkFormat.VK_FORMAT_R8G8_SSCALED; pub const VK_FORMAT_R8G8_UINT = enum_VkFormat.VK_FORMAT_R8G8_UINT; pub const VK_FORMAT_R8G8_SINT = enum_VkFormat.VK_FORMAT_R8G8_SINT; pub const VK_FORMAT_R8G8_SRGB = enum_VkFormat.VK_FORMAT_R8G8_SRGB; pub const VK_FORMAT_R8G8B8_UNORM = enum_VkFormat.VK_FORMAT_R8G8B8_UNORM; pub const VK_FORMAT_R8G8B8_SNORM = enum_VkFormat.VK_FORMAT_R8G8B8_SNORM; pub const VK_FORMAT_R8G8B8_USCALED = enum_VkFormat.VK_FORMAT_R8G8B8_USCALED; pub const VK_FORMAT_R8G8B8_SSCALED = enum_VkFormat.VK_FORMAT_R8G8B8_SSCALED; pub const VK_FORMAT_R8G8B8_UINT = enum_VkFormat.VK_FORMAT_R8G8B8_UINT; pub const VK_FORMAT_R8G8B8_SINT = enum_VkFormat.VK_FORMAT_R8G8B8_SINT; pub const VK_FORMAT_R8G8B8_SRGB = enum_VkFormat.VK_FORMAT_R8G8B8_SRGB; pub const VK_FORMAT_B8G8R8_UNORM = enum_VkFormat.VK_FORMAT_B8G8R8_UNORM; pub const VK_FORMAT_B8G8R8_SNORM = enum_VkFormat.VK_FORMAT_B8G8R8_SNORM; pub const VK_FORMAT_B8G8R8_USCALED = enum_VkFormat.VK_FORMAT_B8G8R8_USCALED; pub const VK_FORMAT_B8G8R8_SSCALED = enum_VkFormat.VK_FORMAT_B8G8R8_SSCALED; pub const VK_FORMAT_B8G8R8_UINT = enum_VkFormat.VK_FORMAT_B8G8R8_UINT; pub const VK_FORMAT_B8G8R8_SINT = enum_VkFormat.VK_FORMAT_B8G8R8_SINT; pub const VK_FORMAT_B8G8R8_SRGB = enum_VkFormat.VK_FORMAT_B8G8R8_SRGB; pub const VK_FORMAT_R8G8B8A8_UNORM = enum_VkFormat.VK_FORMAT_R8G8B8A8_UNORM; pub const VK_FORMAT_R8G8B8A8_SNORM = enum_VkFormat.VK_FORMAT_R8G8B8A8_SNORM; pub const VK_FORMAT_R8G8B8A8_USCALED = enum_VkFormat.VK_FORMAT_R8G8B8A8_USCALED; pub const VK_FORMAT_R8G8B8A8_SSCALED = enum_VkFormat.VK_FORMAT_R8G8B8A8_SSCALED; pub const VK_FORMAT_R8G8B8A8_UINT = enum_VkFormat.VK_FORMAT_R8G8B8A8_UINT; pub const VK_FORMAT_R8G8B8A8_SINT = enum_VkFormat.VK_FORMAT_R8G8B8A8_SINT; pub const VK_FORMAT_R8G8B8A8_SRGB = enum_VkFormat.VK_FORMAT_R8G8B8A8_SRGB; pub const VK_FORMAT_B8G8R8A8_UNORM = enum_VkFormat.VK_FORMAT_B8G8R8A8_UNORM; pub const VK_FORMAT_B8G8R8A8_SNORM = enum_VkFormat.VK_FORMAT_B8G8R8A8_SNORM; pub const VK_FORMAT_B8G8R8A8_USCALED = enum_VkFormat.VK_FORMAT_B8G8R8A8_USCALED; pub const VK_FORMAT_B8G8R8A8_SSCALED = enum_VkFormat.VK_FORMAT_B8G8R8A8_SSCALED; pub const VK_FORMAT_B8G8R8A8_UINT = enum_VkFormat.VK_FORMAT_B8G8R8A8_UINT; pub const VK_FORMAT_B8G8R8A8_SINT = enum_VkFormat.VK_FORMAT_B8G8R8A8_SINT; pub const VK_FORMAT_B8G8R8A8_SRGB = enum_VkFormat.VK_FORMAT_B8G8R8A8_SRGB; pub const VK_FORMAT_A8B8G8R8_UNORM_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_UNORM_PACK32; pub const VK_FORMAT_A8B8G8R8_SNORM_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_SNORM_PACK32; pub const VK_FORMAT_A8B8G8R8_USCALED_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_USCALED_PACK32; pub const VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_SSCALED_PACK32; pub const VK_FORMAT_A8B8G8R8_UINT_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_UINT_PACK32; pub const VK_FORMAT_A8B8G8R8_SINT_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_SINT_PACK32; pub const VK_FORMAT_A8B8G8R8_SRGB_PACK32 = enum_VkFormat.VK_FORMAT_A8B8G8R8_SRGB_PACK32; pub const VK_FORMAT_A2R10G10B10_UNORM_PACK32 = enum_VkFormat.VK_FORMAT_A2R10G10B10_UNORM_PACK32; pub const VK_FORMAT_A2R10G10B10_SNORM_PACK32 = enum_VkFormat.VK_FORMAT_A2R10G10B10_SNORM_PACK32; pub const VK_FORMAT_A2R10G10B10_USCALED_PACK32 = enum_VkFormat.VK_FORMAT_A2R10G10B10_USCALED_PACK32; pub const VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = enum_VkFormat.VK_FORMAT_A2R10G10B10_SSCALED_PACK32; pub const VK_FORMAT_A2R10G10B10_UINT_PACK32 = enum_VkFormat.VK_FORMAT_A2R10G10B10_UINT_PACK32; pub const VK_FORMAT_A2R10G10B10_SINT_PACK32 = enum_VkFormat.VK_FORMAT_A2R10G10B10_SINT_PACK32; pub const VK_FORMAT_A2B10G10R10_UNORM_PACK32 = enum_VkFormat.VK_FORMAT_A2B10G10R10_UNORM_PACK32; pub const VK_FORMAT_A2B10G10R10_SNORM_PACK32 = enum_VkFormat.VK_FORMAT_A2B10G10R10_SNORM_PACK32; pub const VK_FORMAT_A2B10G10R10_USCALED_PACK32 = enum_VkFormat.VK_FORMAT_A2B10G10R10_USCALED_PACK32; pub const VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = enum_VkFormat.VK_FORMAT_A2B10G10R10_SSCALED_PACK32; pub const VK_FORMAT_A2B10G10R10_UINT_PACK32 = enum_VkFormat.VK_FORMAT_A2B10G10R10_UINT_PACK32; pub const VK_FORMAT_A2B10G10R10_SINT_PACK32 = enum_VkFormat.VK_FORMAT_A2B10G10R10_SINT_PACK32; pub const VK_FORMAT_R16_UNORM = enum_VkFormat.VK_FORMAT_R16_UNORM; pub const VK_FORMAT_R16_SNORM = enum_VkFormat.VK_FORMAT_R16_SNORM; pub const VK_FORMAT_R16_USCALED = enum_VkFormat.VK_FORMAT_R16_USCALED; pub const VK_FORMAT_R16_SSCALED = enum_VkFormat.VK_FORMAT_R16_SSCALED; pub const VK_FORMAT_R16_UINT = enum_VkFormat.VK_FORMAT_R16_UINT; pub const VK_FORMAT_R16_SINT = enum_VkFormat.VK_FORMAT_R16_SINT; pub const VK_FORMAT_R16_SFLOAT = enum_VkFormat.VK_FORMAT_R16_SFLOAT; pub const VK_FORMAT_R16G16_UNORM = enum_VkFormat.VK_FORMAT_R16G16_UNORM; pub const VK_FORMAT_R16G16_SNORM = enum_VkFormat.VK_FORMAT_R16G16_SNORM; pub const VK_FORMAT_R16G16_USCALED = enum_VkFormat.VK_FORMAT_R16G16_USCALED; pub const VK_FORMAT_R16G16_SSCALED = enum_VkFormat.VK_FORMAT_R16G16_SSCALED; pub const VK_FORMAT_R16G16_UINT = enum_VkFormat.VK_FORMAT_R16G16_UINT; pub const VK_FORMAT_R16G16_SINT = enum_VkFormat.VK_FORMAT_R16G16_SINT; pub const VK_FORMAT_R16G16_SFLOAT = enum_VkFormat.VK_FORMAT_R16G16_SFLOAT; pub const VK_FORMAT_R16G16B16_UNORM = enum_VkFormat.VK_FORMAT_R16G16B16_UNORM; pub const VK_FORMAT_R16G16B16_SNORM = enum_VkFormat.VK_FORMAT_R16G16B16_SNORM; pub const VK_FORMAT_R16G16B16_USCALED = enum_VkFormat.VK_FORMAT_R16G16B16_USCALED; pub const VK_FORMAT_R16G16B16_SSCALED = enum_VkFormat.VK_FORMAT_R16G16B16_SSCALED; pub const VK_FORMAT_R16G16B16_UINT = enum_VkFormat.VK_FORMAT_R16G16B16_UINT; pub const VK_FORMAT_R16G16B16_SINT = enum_VkFormat.VK_FORMAT_R16G16B16_SINT; pub const VK_FORMAT_R16G16B16_SFLOAT = enum_VkFormat.VK_FORMAT_R16G16B16_SFLOAT; pub const VK_FORMAT_R16G16B16A16_UNORM = enum_VkFormat.VK_FORMAT_R16G16B16A16_UNORM; pub const VK_FORMAT_R16G16B16A16_SNORM = enum_VkFormat.VK_FORMAT_R16G16B16A16_SNORM; pub const VK_FORMAT_R16G16B16A16_USCALED = enum_VkFormat.VK_FORMAT_R16G16B16A16_USCALED; pub const VK_FORMAT_R16G16B16A16_SSCALED = enum_VkFormat.VK_FORMAT_R16G16B16A16_SSCALED; pub const VK_FORMAT_R16G16B16A16_UINT = enum_VkFormat.VK_FORMAT_R16G16B16A16_UINT; pub const VK_FORMAT_R16G16B16A16_SINT = enum_VkFormat.VK_FORMAT_R16G16B16A16_SINT; pub const VK_FORMAT_R16G16B16A16_SFLOAT = enum_VkFormat.VK_FORMAT_R16G16B16A16_SFLOAT; pub const VK_FORMAT_R32_UINT = enum_VkFormat.VK_FORMAT_R32_UINT; pub const VK_FORMAT_R32_SINT = enum_VkFormat.VK_FORMAT_R32_SINT; pub const VK_FORMAT_R32_SFLOAT = enum_VkFormat.VK_FORMAT_R32_SFLOAT; pub const VK_FORMAT_R32G32_UINT = enum_VkFormat.VK_FORMAT_R32G32_UINT; pub const VK_FORMAT_R32G32_SINT = enum_VkFormat.VK_FORMAT_R32G32_SINT; pub const VK_FORMAT_R32G32_SFLOAT = enum_VkFormat.VK_FORMAT_R32G32_SFLOAT; pub const VK_FORMAT_R32G32B32_UINT = enum_VkFormat.VK_FORMAT_R32G32B32_UINT; pub const VK_FORMAT_R32G32B32_SINT = enum_VkFormat.VK_FORMAT_R32G32B32_SINT; pub const VK_FORMAT_R32G32B32_SFLOAT = enum_VkFormat.VK_FORMAT_R32G32B32_SFLOAT; pub const VK_FORMAT_R32G32B32A32_UINT = enum_VkFormat.VK_FORMAT_R32G32B32A32_UINT; pub const VK_FORMAT_R32G32B32A32_SINT = enum_VkFormat.VK_FORMAT_R32G32B32A32_SINT; pub const VK_FORMAT_R32G32B32A32_SFLOAT = enum_VkFormat.VK_FORMAT_R32G32B32A32_SFLOAT; pub const VK_FORMAT_R64_UINT = enum_VkFormat.VK_FORMAT_R64_UINT; pub const VK_FORMAT_R64_SINT = enum_VkFormat.VK_FORMAT_R64_SINT; pub const VK_FORMAT_R64_SFLOAT = enum_VkFormat.VK_FORMAT_R64_SFLOAT; pub const VK_FORMAT_R64G64_UINT = enum_VkFormat.VK_FORMAT_R64G64_UINT; pub const VK_FORMAT_R64G64_SINT = enum_VkFormat.VK_FORMAT_R64G64_SINT; pub const VK_FORMAT_R64G64_SFLOAT = enum_VkFormat.VK_FORMAT_R64G64_SFLOAT; pub const VK_FORMAT_R64G64B64_UINT = enum_VkFormat.VK_FORMAT_R64G64B64_UINT; pub const VK_FORMAT_R64G64B64_SINT = enum_VkFormat.VK_FORMAT_R64G64B64_SINT; pub const VK_FORMAT_R64G64B64_SFLOAT = enum_VkFormat.VK_FORMAT_R64G64B64_SFLOAT; pub const VK_FORMAT_R64G64B64A64_UINT = enum_VkFormat.VK_FORMAT_R64G64B64A64_UINT; pub const VK_FORMAT_R64G64B64A64_SINT = enum_VkFormat.VK_FORMAT_R64G64B64A64_SINT; pub const VK_FORMAT_R64G64B64A64_SFLOAT = enum_VkFormat.VK_FORMAT_R64G64B64A64_SFLOAT; pub const VK_FORMAT_B10G11R11_UFLOAT_PACK32 = enum_VkFormat.VK_FORMAT_B10G11R11_UFLOAT_PACK32; pub const VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = enum_VkFormat.VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; pub const VK_FORMAT_D16_UNORM = enum_VkFormat.VK_FORMAT_D16_UNORM; pub const VK_FORMAT_X8_D24_UNORM_PACK32 = enum_VkFormat.VK_FORMAT_X8_D24_UNORM_PACK32; pub const VK_FORMAT_D32_SFLOAT = enum_VkFormat.VK_FORMAT_D32_SFLOAT; pub const VK_FORMAT_S8_UINT = enum_VkFormat.VK_FORMAT_S8_UINT; pub const VK_FORMAT_D16_UNORM_S8_UINT = enum_VkFormat.VK_FORMAT_D16_UNORM_S8_UINT; pub const VK_FORMAT_D24_UNORM_S8_UINT = enum_VkFormat.VK_FORMAT_D24_UNORM_S8_UINT; pub const VK_FORMAT_D32_SFLOAT_S8_UINT = enum_VkFormat.VK_FORMAT_D32_SFLOAT_S8_UINT; pub const VK_FORMAT_BC1_RGB_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC1_RGB_UNORM_BLOCK; pub const VK_FORMAT_BC1_RGB_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_BC1_RGB_SRGB_BLOCK; pub const VK_FORMAT_BC1_RGBA_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC1_RGBA_UNORM_BLOCK; pub const VK_FORMAT_BC1_RGBA_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_BC1_RGBA_SRGB_BLOCK; pub const VK_FORMAT_BC2_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC2_UNORM_BLOCK; pub const VK_FORMAT_BC2_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_BC2_SRGB_BLOCK; pub const VK_FORMAT_BC3_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC3_UNORM_BLOCK; pub const VK_FORMAT_BC3_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_BC3_SRGB_BLOCK; pub const VK_FORMAT_BC4_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC4_UNORM_BLOCK; pub const VK_FORMAT_BC4_SNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC4_SNORM_BLOCK; pub const VK_FORMAT_BC5_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC5_UNORM_BLOCK; pub const VK_FORMAT_BC5_SNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC5_SNORM_BLOCK; pub const VK_FORMAT_BC6H_UFLOAT_BLOCK = enum_VkFormat.VK_FORMAT_BC6H_UFLOAT_BLOCK; pub const VK_FORMAT_BC6H_SFLOAT_BLOCK = enum_VkFormat.VK_FORMAT_BC6H_SFLOAT_BLOCK; pub const VK_FORMAT_BC7_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_BC7_UNORM_BLOCK; pub const VK_FORMAT_BC7_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_BC7_SRGB_BLOCK; pub const VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; pub const VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; pub const VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; pub const VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; pub const VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; pub const VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; pub const VK_FORMAT_EAC_R11_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_EAC_R11_UNORM_BLOCK; pub const VK_FORMAT_EAC_R11_SNORM_BLOCK = enum_VkFormat.VK_FORMAT_EAC_R11_SNORM_BLOCK; pub const VK_FORMAT_EAC_R11G11_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_EAC_R11G11_UNORM_BLOCK; pub const VK_FORMAT_EAC_R11G11_SNORM_BLOCK = enum_VkFormat.VK_FORMAT_EAC_R11G11_SNORM_BLOCK; pub const VK_FORMAT_ASTC_4x4_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_4x4_UNORM_BLOCK; pub const VK_FORMAT_ASTC_4x4_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_4x4_SRGB_BLOCK; pub const VK_FORMAT_ASTC_5x4_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_5x4_UNORM_BLOCK; pub const VK_FORMAT_ASTC_5x4_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_5x4_SRGB_BLOCK; pub const VK_FORMAT_ASTC_5x5_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_5x5_UNORM_BLOCK; pub const VK_FORMAT_ASTC_5x5_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_5x5_SRGB_BLOCK; pub const VK_FORMAT_ASTC_6x5_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_6x5_UNORM_BLOCK; pub const VK_FORMAT_ASTC_6x5_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_6x5_SRGB_BLOCK; pub const VK_FORMAT_ASTC_6x6_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_6x6_UNORM_BLOCK; pub const VK_FORMAT_ASTC_6x6_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_6x6_SRGB_BLOCK; pub const VK_FORMAT_ASTC_8x5_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_8x5_UNORM_BLOCK; pub const VK_FORMAT_ASTC_8x5_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_8x5_SRGB_BLOCK; pub const VK_FORMAT_ASTC_8x6_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_8x6_UNORM_BLOCK; pub const VK_FORMAT_ASTC_8x6_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_8x6_SRGB_BLOCK; pub const VK_FORMAT_ASTC_8x8_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_8x8_UNORM_BLOCK; pub const VK_FORMAT_ASTC_8x8_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_8x8_SRGB_BLOCK; pub const VK_FORMAT_ASTC_10x5_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x5_UNORM_BLOCK; pub const VK_FORMAT_ASTC_10x5_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x5_SRGB_BLOCK; pub const VK_FORMAT_ASTC_10x6_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x6_UNORM_BLOCK; pub const VK_FORMAT_ASTC_10x6_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x6_SRGB_BLOCK; pub const VK_FORMAT_ASTC_10x8_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x8_UNORM_BLOCK; pub const VK_FORMAT_ASTC_10x8_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x8_SRGB_BLOCK; pub const VK_FORMAT_ASTC_10x10_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x10_UNORM_BLOCK; pub const VK_FORMAT_ASTC_10x10_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_10x10_SRGB_BLOCK; pub const VK_FORMAT_ASTC_12x10_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_12x10_UNORM_BLOCK; pub const VK_FORMAT_ASTC_12x10_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_12x10_SRGB_BLOCK; pub const VK_FORMAT_ASTC_12x12_UNORM_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_12x12_UNORM_BLOCK; pub const VK_FORMAT_ASTC_12x12_SRGB_BLOCK = enum_VkFormat.VK_FORMAT_ASTC_12x12_SRGB_BLOCK; pub const VK_FORMAT_G8B8G8R8_422_UNORM = enum_VkFormat.VK_FORMAT_G8B8G8R8_422_UNORM; pub const VK_FORMAT_B8G8R8G8_422_UNORM = enum_VkFormat.VK_FORMAT_B8G8R8G8_422_UNORM; pub const VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = enum_VkFormat.VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM; pub const VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = enum_VkFormat.VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; pub const VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = enum_VkFormat.VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM; pub const VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = enum_VkFormat.VK_FORMAT_G8_B8R8_2PLANE_422_UNORM; pub const VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = enum_VkFormat.VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM; pub const VK_FORMAT_R10X6_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_R10X6_UNORM_PACK16; pub const VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = enum_VkFormat.VK_FORMAT_R10X6G10X6_UNORM_2PACK16; pub const VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = enum_VkFormat.VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16; pub const VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = enum_VkFormat.VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16; pub const VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = enum_VkFormat.VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16; pub const VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16; pub const VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16; pub const VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16; pub const VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16; pub const VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16; pub const VK_FORMAT_R12X4_UNORM_PACK16 = enum_VkFormat.VK_FORMAT_R12X4_UNORM_PACK16; pub const VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = enum_VkFormat.VK_FORMAT_R12X4G12X4_UNORM_2PACK16; pub const VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = enum_VkFormat.VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16; pub const VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = enum_VkFormat.VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16; pub const VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = enum_VkFormat.VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16; pub const VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16; pub const VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16; pub const VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16; pub const VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16; pub const VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = enum_VkFormat.VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16; pub const VK_FORMAT_G16B16G16R16_422_UNORM = enum_VkFormat.VK_FORMAT_G16B16G16R16_422_UNORM; pub const VK_FORMAT_B16G16R16G16_422_UNORM = enum_VkFormat.VK_FORMAT_B16G16R16G16_422_UNORM; pub const VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM = enum_VkFormat.VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM; pub const VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = enum_VkFormat.VK_FORMAT_G16_B16R16_2PLANE_420_UNORM; pub const VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = enum_VkFormat.VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM; pub const VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = enum_VkFormat.VK_FORMAT_G16_B16R16_2PLANE_422_UNORM; pub const VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = enum_VkFormat.VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM; pub const VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG; pub const VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG; pub const VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG; pub const VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG; pub const VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG; pub const VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG; pub const VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG; pub const VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = enum_VkFormat.VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG; pub const VK_FORMAT_G8B8G8R8_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_G8B8G8R8_422_UNORM_KHR; pub const VK_FORMAT_B8G8R8G8_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_B8G8R8G8_422_UNORM_KHR; pub const VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = enum_VkFormat.VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR; pub const VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR = enum_VkFormat.VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR; pub const VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR; pub const VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR; pub const VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR = enum_VkFormat.VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR; pub const VK_FORMAT_R10X6_UNORM_PACK16_KHR = enum_VkFormat.VK_FORMAT_R10X6_UNORM_PACK16_KHR; pub const VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR = enum_VkFormat.VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR; pub const VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR = enum_VkFormat.VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR; pub const VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR = enum_VkFormat.VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR; pub const VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR = enum_VkFormat.VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR; pub const VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR; pub const VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR; pub const VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR; pub const VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR; pub const VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR; pub const VK_FORMAT_R12X4_UNORM_PACK16_KHR = enum_VkFormat.VK_FORMAT_R12X4_UNORM_PACK16_KHR; pub const VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR = enum_VkFormat.VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR; pub const VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR = enum_VkFormat.VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR; pub const VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR = enum_VkFormat.VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR; pub const VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR = enum_VkFormat.VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR; pub const VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR; pub const VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR; pub const VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR; pub const VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR; pub const VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR = enum_VkFormat.VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR; pub const VK_FORMAT_G16B16G16R16_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_G16B16G16R16_422_UNORM_KHR; pub const VK_FORMAT_B16G16R16G16_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_B16G16R16G16_422_UNORM_KHR; pub const VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR = enum_VkFormat.VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR; pub const VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = enum_VkFormat.VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR; pub const VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR; pub const VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = enum_VkFormat.VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR; pub const VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = enum_VkFormat.VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR; pub const VK_FORMAT_BEGIN_RANGE = enum_VkFormat.VK_FORMAT_BEGIN_RANGE; pub const VK_FORMAT_END_RANGE = enum_VkFormat.VK_FORMAT_END_RANGE; pub const VK_FORMAT_RANGE_SIZE = enum_VkFormat.VK_FORMAT_RANGE_SIZE; pub const VK_FORMAT_MAX_ENUM = enum_VkFormat.VK_FORMAT_MAX_ENUM; pub const enum_VkFormat = extern enum { VK_FORMAT_UNDEFINED = 0, VK_FORMAT_R4G4_UNORM_PACK8 = 1, VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, VK_FORMAT_R8_UNORM = 9, VK_FORMAT_R8_SNORM = 10, VK_FORMAT_R8_USCALED = 11, VK_FORMAT_R8_SSCALED = 12, VK_FORMAT_R8_UINT = 13, VK_FORMAT_R8_SINT = 14, VK_FORMAT_R8_SRGB = 15, VK_FORMAT_R8G8_UNORM = 16, VK_FORMAT_R8G8_SNORM = 17, VK_FORMAT_R8G8_USCALED = 18, VK_FORMAT_R8G8_SSCALED = 19, VK_FORMAT_R8G8_UINT = 20, VK_FORMAT_R8G8_SINT = 21, VK_FORMAT_R8G8_SRGB = 22, VK_FORMAT_R8G8B8_UNORM = 23, VK_FORMAT_R8G8B8_SNORM = 24, VK_FORMAT_R8G8B8_USCALED = 25, VK_FORMAT_R8G8B8_SSCALED = 26, VK_FORMAT_R8G8B8_UINT = 27, VK_FORMAT_R8G8B8_SINT = 28, VK_FORMAT_R8G8B8_SRGB = 29, VK_FORMAT_B8G8R8_UNORM = 30, VK_FORMAT_B8G8R8_SNORM = 31, VK_FORMAT_B8G8R8_USCALED = 32, VK_FORMAT_B8G8R8_SSCALED = 33, VK_FORMAT_B8G8R8_UINT = 34, VK_FORMAT_B8G8R8_SINT = 35, VK_FORMAT_B8G8R8_SRGB = 36, VK_FORMAT_R8G8B8A8_UNORM = 37, VK_FORMAT_R8G8B8A8_SNORM = 38, VK_FORMAT_R8G8B8A8_USCALED = 39, VK_FORMAT_R8G8B8A8_SSCALED = 40, VK_FORMAT_R8G8B8A8_UINT = 41, VK_FORMAT_R8G8B8A8_SINT = 42, VK_FORMAT_R8G8B8A8_SRGB = 43, VK_FORMAT_B8G8R8A8_UNORM = 44, VK_FORMAT_B8G8R8A8_SNORM = 45, VK_FORMAT_B8G8R8A8_USCALED = 46, VK_FORMAT_B8G8R8A8_SSCALED = 47, VK_FORMAT_B8G8R8A8_UINT = 48, VK_FORMAT_B8G8R8A8_SINT = 49, VK_FORMAT_B8G8R8A8_SRGB = 50, VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, VK_FORMAT_R16_UNORM = 70, VK_FORMAT_R16_SNORM = 71, VK_FORMAT_R16_USCALED = 72, VK_FORMAT_R16_SSCALED = 73, VK_FORMAT_R16_UINT = 74, VK_FORMAT_R16_SINT = 75, VK_FORMAT_R16_SFLOAT = 76, VK_FORMAT_R16G16_UNORM = 77, VK_FORMAT_R16G16_SNORM = 78, VK_FORMAT_R16G16_USCALED = 79, VK_FORMAT_R16G16_SSCALED = 80, VK_FORMAT_R16G16_UINT = 81, VK_FORMAT_R16G16_SINT = 82, VK_FORMAT_R16G16_SFLOAT = 83, VK_FORMAT_R16G16B16_UNORM = 84, VK_FORMAT_R16G16B16_SNORM = 85, VK_FORMAT_R16G16B16_USCALED = 86, VK_FORMAT_R16G16B16_SSCALED = 87, VK_FORMAT_R16G16B16_UINT = 88, VK_FORMAT_R16G16B16_SINT = 89, VK_FORMAT_R16G16B16_SFLOAT = 90, VK_FORMAT_R16G16B16A16_UNORM = 91, VK_FORMAT_R16G16B16A16_SNORM = 92, VK_FORMAT_R16G16B16A16_USCALED = 93, VK_FORMAT_R16G16B16A16_SSCALED = 94, VK_FORMAT_R16G16B16A16_UINT = 95, VK_FORMAT_R16G16B16A16_SINT = 96, VK_FORMAT_R16G16B16A16_SFLOAT = 97, VK_FORMAT_R32_UINT = 98, VK_FORMAT_R32_SINT = 99, VK_FORMAT_R32_SFLOAT = 100, VK_FORMAT_R32G32_UINT = 101, VK_FORMAT_R32G32_SINT = 102, VK_FORMAT_R32G32_SFLOAT = 103, VK_FORMAT_R32G32B32_UINT = 104, VK_FORMAT_R32G32B32_SINT = 105, VK_FORMAT_R32G32B32_SFLOAT = 106, VK_FORMAT_R32G32B32A32_UINT = 107, VK_FORMAT_R32G32B32A32_SINT = 108, VK_FORMAT_R32G32B32A32_SFLOAT = 109, VK_FORMAT_R64_UINT = 110, VK_FORMAT_R64_SINT = 111, VK_FORMAT_R64_SFLOAT = 112, VK_FORMAT_R64G64_UINT = 113, VK_FORMAT_R64G64_SINT = 114, VK_FORMAT_R64G64_SFLOAT = 115, VK_FORMAT_R64G64B64_UINT = 116, VK_FORMAT_R64G64B64_SINT = 117, VK_FORMAT_R64G64B64_SFLOAT = 118, VK_FORMAT_R64G64B64A64_UINT = 119, VK_FORMAT_R64G64B64A64_SINT = 120, VK_FORMAT_R64G64B64A64_SFLOAT = 121, VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, VK_FORMAT_D16_UNORM = 124, VK_FORMAT_X8_D24_UNORM_PACK32 = 125, VK_FORMAT_D32_SFLOAT = 126, VK_FORMAT_S8_UINT = 127, VK_FORMAT_D16_UNORM_S8_UINT = 128, VK_FORMAT_D24_UNORM_S8_UINT = 129, VK_FORMAT_D32_SFLOAT_S8_UINT = 130, VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, VK_FORMAT_BC2_UNORM_BLOCK = 135, VK_FORMAT_BC2_SRGB_BLOCK = 136, VK_FORMAT_BC3_UNORM_BLOCK = 137, VK_FORMAT_BC3_SRGB_BLOCK = 138, VK_FORMAT_BC4_UNORM_BLOCK = 139, VK_FORMAT_BC4_SNORM_BLOCK = 140, VK_FORMAT_BC5_UNORM_BLOCK = 141, VK_FORMAT_BC5_SNORM_BLOCK = 142, VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, VK_FORMAT_BC7_UNORM_BLOCK = 145, VK_FORMAT_BC7_SRGB_BLOCK = 146, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, VK_FORMAT_G8B8G8R8_422_UNORM = 1000156000, VK_FORMAT_B8G8R8G8_422_UNORM = 1000156001, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = 1000156002, VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = 1000156003, VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = 1000156004, VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = 1000156005, VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = 1000156006, VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007, VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008, VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009, VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010, VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = 1000156012, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = 1000156013, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = 1000156014, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = 1000156015, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = 1000156016, VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017, VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018, VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019, VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020, VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = 1000156022, VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = 1000156023, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = 1000156024, VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = 1000156025, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = 1000156026, VK_FORMAT_G16B16G16R16_422_UNORM = 1000156027, VK_FORMAT_B16G16R16G16_422_UNORM = 1000156028, VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM = 1000156029, VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030, VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031, VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032, VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033, VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, VK_FORMAT_RANGE_SIZE = 185, VK_FORMAT_MAX_ENUM = 2147483647, }; pub const VkFormat = enum_VkFormat; pub const VK_IMAGE_TYPE_1D = enum_VkImageType.VK_IMAGE_TYPE_1D; pub const VK_IMAGE_TYPE_2D = enum_VkImageType.VK_IMAGE_TYPE_2D; pub const VK_IMAGE_TYPE_3D = enum_VkImageType.VK_IMAGE_TYPE_3D; pub const VK_IMAGE_TYPE_BEGIN_RANGE = enum_VkImageType.VK_IMAGE_TYPE_BEGIN_RANGE; pub const VK_IMAGE_TYPE_END_RANGE = enum_VkImageType.VK_IMAGE_TYPE_END_RANGE; pub const VK_IMAGE_TYPE_RANGE_SIZE = enum_VkImageType.VK_IMAGE_TYPE_RANGE_SIZE; pub const VK_IMAGE_TYPE_MAX_ENUM = enum_VkImageType.VK_IMAGE_TYPE_MAX_ENUM; pub const enum_VkImageType = extern enum { VK_IMAGE_TYPE_1D = 0, VK_IMAGE_TYPE_2D = 1, VK_IMAGE_TYPE_3D = 2, VK_IMAGE_TYPE_BEGIN_RANGE = 0, VK_IMAGE_TYPE_END_RANGE = 2, VK_IMAGE_TYPE_RANGE_SIZE = 3, VK_IMAGE_TYPE_MAX_ENUM = 2147483647, }; pub const VkImageType = enum_VkImageType; pub const VK_IMAGE_TILING_OPTIMAL = enum_VkImageTiling.VK_IMAGE_TILING_OPTIMAL; pub const VK_IMAGE_TILING_LINEAR = enum_VkImageTiling.VK_IMAGE_TILING_LINEAR; pub const VK_IMAGE_TILING_BEGIN_RANGE = enum_VkImageTiling.VK_IMAGE_TILING_BEGIN_RANGE; pub const VK_IMAGE_TILING_END_RANGE = enum_VkImageTiling.VK_IMAGE_TILING_END_RANGE; pub const VK_IMAGE_TILING_RANGE_SIZE = enum_VkImageTiling.VK_IMAGE_TILING_RANGE_SIZE; pub const VK_IMAGE_TILING_MAX_ENUM = enum_VkImageTiling.VK_IMAGE_TILING_MAX_ENUM; pub const enum_VkImageTiling = extern enum { VK_IMAGE_TILING_OPTIMAL = 0, VK_IMAGE_TILING_LINEAR = 1, VK_IMAGE_TILING_BEGIN_RANGE = 0, VK_IMAGE_TILING_END_RANGE = 1, VK_IMAGE_TILING_RANGE_SIZE = 2, VK_IMAGE_TILING_MAX_ENUM = 2147483647, }; pub const VkImageTiling = enum_VkImageTiling; pub const VK_PHYSICAL_DEVICE_TYPE_OTHER = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_OTHER; pub const VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; pub const VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; pub const VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU; pub const VK_PHYSICAL_DEVICE_TYPE_CPU = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_CPU; pub const VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE; pub const VK_PHYSICAL_DEVICE_TYPE_END_RANGE = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_END_RANGE; pub const VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE; pub const VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = enum_VkPhysicalDeviceType.VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM; pub const enum_VkPhysicalDeviceType = extern enum { VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, VK_PHYSICAL_DEVICE_TYPE_CPU = 4, VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = 0, VK_PHYSICAL_DEVICE_TYPE_END_RANGE = 4, VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = 5, VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 2147483647, }; pub const VkPhysicalDeviceType = enum_VkPhysicalDeviceType; pub const VK_QUERY_TYPE_OCCLUSION = enum_VkQueryType.VK_QUERY_TYPE_OCCLUSION; pub const VK_QUERY_TYPE_PIPELINE_STATISTICS = enum_VkQueryType.VK_QUERY_TYPE_PIPELINE_STATISTICS; pub const VK_QUERY_TYPE_TIMESTAMP = enum_VkQueryType.VK_QUERY_TYPE_TIMESTAMP; pub const VK_QUERY_TYPE_BEGIN_RANGE = enum_VkQueryType.VK_QUERY_TYPE_BEGIN_RANGE; pub const VK_QUERY_TYPE_END_RANGE = enum_VkQueryType.VK_QUERY_TYPE_END_RANGE; pub const VK_QUERY_TYPE_RANGE_SIZE = enum_VkQueryType.VK_QUERY_TYPE_RANGE_SIZE; pub const VK_QUERY_TYPE_MAX_ENUM = enum_VkQueryType.VK_QUERY_TYPE_MAX_ENUM; pub const enum_VkQueryType = extern enum { VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, VK_QUERY_TYPE_TIMESTAMP = 2, VK_QUERY_TYPE_BEGIN_RANGE = 0, VK_QUERY_TYPE_END_RANGE = 2, VK_QUERY_TYPE_RANGE_SIZE = 3, VK_QUERY_TYPE_MAX_ENUM = 2147483647, }; pub const VkQueryType = enum_VkQueryType; pub const VK_SHARING_MODE_EXCLUSIVE = enum_VkSharingMode.VK_SHARING_MODE_EXCLUSIVE; pub const VK_SHARING_MODE_CONCURRENT = enum_VkSharingMode.VK_SHARING_MODE_CONCURRENT; pub const VK_SHARING_MODE_BEGIN_RANGE = enum_VkSharingMode.VK_SHARING_MODE_BEGIN_RANGE; pub const VK_SHARING_MODE_END_RANGE = enum_VkSharingMode.VK_SHARING_MODE_END_RANGE; pub const VK_SHARING_MODE_RANGE_SIZE = enum_VkSharingMode.VK_SHARING_MODE_RANGE_SIZE; pub const VK_SHARING_MODE_MAX_ENUM = enum_VkSharingMode.VK_SHARING_MODE_MAX_ENUM; pub const enum_VkSharingMode = extern enum { VK_SHARING_MODE_EXCLUSIVE = 0, VK_SHARING_MODE_CONCURRENT = 1, VK_SHARING_MODE_RANGE_SIZE = 2, VK_SHARING_MODE_MAX_ENUM = 2147483647, }; pub const VkSharingMode = enum_VkSharingMode; pub const VK_IMAGE_LAYOUT_UNDEFINED = enum_VkImageLayout.VK_IMAGE_LAYOUT_UNDEFINED; pub const VK_IMAGE_LAYOUT_GENERAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_GENERAL; pub const VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; pub const VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; pub const VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL; pub const VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; pub const VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; pub const VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; pub const VK_IMAGE_LAYOUT_PREINITIALIZED = enum_VkImageLayout.VK_IMAGE_LAYOUT_PREINITIALIZED; pub const VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL; pub const VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = enum_VkImageLayout.VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL; pub const VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = enum_VkImageLayout.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; pub const VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = enum_VkImageLayout.VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR; pub const VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = enum_VkImageLayout.VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR; pub const VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = enum_VkImageLayout.VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR; pub const VK_IMAGE_LAYOUT_BEGIN_RANGE = enum_VkImageLayout.VK_IMAGE_LAYOUT_BEGIN_RANGE; pub const VK_IMAGE_LAYOUT_END_RANGE = enum_VkImageLayout.VK_IMAGE_LAYOUT_END_RANGE; pub const VK_IMAGE_LAYOUT_RANGE_SIZE = enum_VkImageLayout.VK_IMAGE_LAYOUT_RANGE_SIZE; pub const VK_IMAGE_LAYOUT_MAX_ENUM = enum_VkImageLayout.VK_IMAGE_LAYOUT_MAX_ENUM; pub const enum_VkImageLayout = extern enum { VK_IMAGE_LAYOUT_UNDEFINED = 0, VK_IMAGE_LAYOUT_GENERAL = 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, VK_IMAGE_LAYOUT_PREINITIALIZED = 8, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = 1000117000, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, VK_IMAGE_LAYOUT_RANGE_SIZE = 9, VK_IMAGE_LAYOUT_MAX_ENUM = 2147483647, }; pub const VkImageLayout = enum_VkImageLayout; pub const VK_IMAGE_VIEW_TYPE_1D = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_1D; pub const VK_IMAGE_VIEW_TYPE_2D = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_2D; pub const VK_IMAGE_VIEW_TYPE_3D = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_3D; pub const VK_IMAGE_VIEW_TYPE_CUBE = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_CUBE; pub const VK_IMAGE_VIEW_TYPE_1D_ARRAY = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_1D_ARRAY; pub const VK_IMAGE_VIEW_TYPE_2D_ARRAY = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_2D_ARRAY; pub const VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_CUBE_ARRAY; pub const VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_BEGIN_RANGE; pub const VK_IMAGE_VIEW_TYPE_END_RANGE = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_END_RANGE; pub const VK_IMAGE_VIEW_TYPE_RANGE_SIZE = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_RANGE_SIZE; pub const VK_IMAGE_VIEW_TYPE_MAX_ENUM = enum_VkImageViewType.VK_IMAGE_VIEW_TYPE_MAX_ENUM; pub const enum_VkImageViewType = extern enum { VK_IMAGE_VIEW_TYPE_1D = 0, VK_IMAGE_VIEW_TYPE_2D = 1, VK_IMAGE_VIEW_TYPE_3D = 2, VK_IMAGE_VIEW_TYPE_CUBE = 3, VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, VK_IMAGE_VIEW_TYPE_RANGE_SIZE = 7, VK_IMAGE_VIEW_TYPE_MAX_ENUM = 2147483647, }; pub const VkImageViewType = enum_VkImageViewType; pub const VK_COMPONENT_SWIZZLE_IDENTITY = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_IDENTITY; pub const VK_COMPONENT_SWIZZLE_ZERO = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_ZERO; pub const VK_COMPONENT_SWIZZLE_ONE = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_ONE; pub const VK_COMPONENT_SWIZZLE_R = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_R; pub const VK_COMPONENT_SWIZZLE_G = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_G; pub const VK_COMPONENT_SWIZZLE_B = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_B; pub const VK_COMPONENT_SWIZZLE_A = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_A; pub const VK_COMPONENT_SWIZZLE_BEGIN_RANGE = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_BEGIN_RANGE; pub const VK_COMPONENT_SWIZZLE_END_RANGE = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_END_RANGE; pub const VK_COMPONENT_SWIZZLE_RANGE_SIZE = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_RANGE_SIZE; pub const VK_COMPONENT_SWIZZLE_MAX_ENUM = enum_VkComponentSwizzle.VK_COMPONENT_SWIZZLE_MAX_ENUM; pub const enum_VkComponentSwizzle = extern enum { VK_COMPONENT_SWIZZLE_IDENTITY = 0, VK_COMPONENT_SWIZZLE_ZERO = 1, VK_COMPONENT_SWIZZLE_ONE = 2, VK_COMPONENT_SWIZZLE_R = 3, VK_COMPONENT_SWIZZLE_G = 4, VK_COMPONENT_SWIZZLE_B = 5, VK_COMPONENT_SWIZZLE_A = 6, VK_COMPONENT_SWIZZLE_RANGE_SIZE = 7, VK_COMPONENT_SWIZZLE_MAX_ENUM = 2147483647, }; pub const VkComponentSwizzle = enum_VkComponentSwizzle; pub const VK_VERTEX_INPUT_RATE_VERTEX = enum_VkVertexInputRate.VK_VERTEX_INPUT_RATE_VERTEX; pub const VK_VERTEX_INPUT_RATE_INSTANCE = enum_VkVertexInputRate.VK_VERTEX_INPUT_RATE_INSTANCE; pub const VK_VERTEX_INPUT_RATE_BEGIN_RANGE = enum_VkVertexInputRate.VK_VERTEX_INPUT_RATE_BEGIN_RANGE; pub const VK_VERTEX_INPUT_RATE_END_RANGE = enum_VkVertexInputRate.VK_VERTEX_INPUT_RATE_END_RANGE; pub const VK_VERTEX_INPUT_RATE_RANGE_SIZE = enum_VkVertexInputRate.VK_VERTEX_INPUT_RATE_RANGE_SIZE; pub const VK_VERTEX_INPUT_RATE_MAX_ENUM = enum_VkVertexInputRate.VK_VERTEX_INPUT_RATE_MAX_ENUM; pub const enum_VkVertexInputRate = extern enum { VK_VERTEX_INPUT_RATE_VERTEX = 0, VK_VERTEX_INPUT_RATE_INSTANCE = 1, VK_VERTEX_INPUT_RATE_RANGE_SIZE = 2, VK_VERTEX_INPUT_RATE_MAX_ENUM = 2147483647, }; pub const VkVertexInputRate = enum_VkVertexInputRate; pub const VK_PRIMITIVE_TOPOLOGY_POINT_LIST = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_POINT_LIST; pub const VK_PRIMITIVE_TOPOLOGY_LINE_LIST = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_LINE_LIST; pub const VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; pub const VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; pub const VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; pub const VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN; pub const VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY; pub const VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY; pub const VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY; pub const VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY; pub const VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; pub const VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE; pub const VK_PRIMITIVE_TOPOLOGY_END_RANGE = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_END_RANGE; pub const VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE; pub const VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = enum_VkPrimitiveTopology.VK_PRIMITIVE_TOPOLOGY_MAX_ENUM; pub const enum_VkPrimitiveTopology = extern enum { VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = 11, VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 2147483647, }; pub const VkPrimitiveTopology = enum_VkPrimitiveTopology; pub const VK_POLYGON_MODE_FILL = enum_VkPolygonMode.VK_POLYGON_MODE_FILL; pub const VK_POLYGON_MODE_LINE = enum_VkPolygonMode.VK_POLYGON_MODE_LINE; pub const VK_POLYGON_MODE_POINT = enum_VkPolygonMode.VK_POLYGON_MODE_POINT; pub const VK_POLYGON_MODE_FILL_RECTANGLE_NV = enum_VkPolygonMode.VK_POLYGON_MODE_FILL_RECTANGLE_NV; pub const VK_POLYGON_MODE_BEGIN_RANGE = enum_VkPolygonMode.VK_POLYGON_MODE_BEGIN_RANGE; pub const VK_POLYGON_MODE_END_RANGE = enum_VkPolygonMode.VK_POLYGON_MODE_END_RANGE; pub const VK_POLYGON_MODE_RANGE_SIZE = enum_VkPolygonMode.VK_POLYGON_MODE_RANGE_SIZE; pub const VK_POLYGON_MODE_MAX_ENUM = enum_VkPolygonMode.VK_POLYGON_MODE_MAX_ENUM; pub const enum_VkPolygonMode = extern enum { VK_POLYGON_MODE_FILL = 0, VK_POLYGON_MODE_LINE = 1, VK_POLYGON_MODE_POINT = 2, VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, VK_POLYGON_MODE_RANGE_SIZE = 3, VK_POLYGON_MODE_MAX_ENUM = 2147483647, }; pub const VkPolygonMode = enum_VkPolygonMode; pub const VK_FRONT_FACE_COUNTER_CLOCKWISE = enum_VkFrontFace.VK_FRONT_FACE_COUNTER_CLOCKWISE; pub const VK_FRONT_FACE_CLOCKWISE = enum_VkFrontFace.VK_FRONT_FACE_CLOCKWISE; pub const VK_FRONT_FACE_BEGIN_RANGE = enum_VkFrontFace.VK_FRONT_FACE_BEGIN_RANGE; pub const VK_FRONT_FACE_END_RANGE = enum_VkFrontFace.VK_FRONT_FACE_END_RANGE; pub const VK_FRONT_FACE_RANGE_SIZE = enum_VkFrontFace.VK_FRONT_FACE_RANGE_SIZE; pub const VK_FRONT_FACE_MAX_ENUM = enum_VkFrontFace.VK_FRONT_FACE_MAX_ENUM; pub const enum_VkFrontFace = extern enum { VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, VK_FRONT_FACE_CLOCKWISE = 1, VK_FRONT_FACE_RANGE_SIZE = 2, VK_FRONT_FACE_MAX_ENUM = 2147483647, }; pub const VkFrontFace = enum_VkFrontFace; pub const VK_COMPARE_OP_NEVER = enum_VkCompareOp.VK_COMPARE_OP_NEVER; pub const VK_COMPARE_OP_LESS = enum_VkCompareOp.VK_COMPARE_OP_LESS; pub const VK_COMPARE_OP_EQUAL = enum_VkCompareOp.VK_COMPARE_OP_EQUAL; pub const VK_COMPARE_OP_LESS_OR_EQUAL = enum_VkCompareOp.VK_COMPARE_OP_LESS_OR_EQUAL; pub const VK_COMPARE_OP_GREATER = enum_VkCompareOp.VK_COMPARE_OP_GREATER; pub const VK_COMPARE_OP_NOT_EQUAL = enum_VkCompareOp.VK_COMPARE_OP_NOT_EQUAL; pub const VK_COMPARE_OP_GREATER_OR_EQUAL = enum_VkCompareOp.VK_COMPARE_OP_GREATER_OR_EQUAL; pub const VK_COMPARE_OP_ALWAYS = enum_VkCompareOp.VK_COMPARE_OP_ALWAYS; pub const VK_COMPARE_OP_BEGIN_RANGE = enum_VkCompareOp.VK_COMPARE_OP_BEGIN_RANGE; pub const VK_COMPARE_OP_END_RANGE = enum_VkCompareOp.VK_COMPARE_OP_END_RANGE; pub const VK_COMPARE_OP_RANGE_SIZE = enum_VkCompareOp.VK_COMPARE_OP_RANGE_SIZE; pub const VK_COMPARE_OP_MAX_ENUM = enum_VkCompareOp.VK_COMPARE_OP_MAX_ENUM; pub const enum_VkCompareOp = extern enum { VK_COMPARE_OP_NEVER = 0, VK_COMPARE_OP_LESS = 1, VK_COMPARE_OP_EQUAL = 2, VK_COMPARE_OP_LESS_OR_EQUAL = 3, VK_COMPARE_OP_GREATER = 4, VK_COMPARE_OP_NOT_EQUAL = 5, VK_COMPARE_OP_GREATER_OR_EQUAL = 6, VK_COMPARE_OP_ALWAYS = 7, VK_COMPARE_OP_RANGE_SIZE = 8, VK_COMPARE_OP_MAX_ENUM = 2147483647, }; pub const VkCompareOp = enum_VkCompareOp; pub const VK_STENCIL_OP_KEEP = enum_VkStencilOp.VK_STENCIL_OP_KEEP; pub const VK_STENCIL_OP_ZERO = enum_VkStencilOp.VK_STENCIL_OP_ZERO; pub const VK_STENCIL_OP_REPLACE = enum_VkStencilOp.VK_STENCIL_OP_REPLACE; pub const VK_STENCIL_OP_INCREMENT_AND_CLAMP = enum_VkStencilOp.VK_STENCIL_OP_INCREMENT_AND_CLAMP; pub const VK_STENCIL_OP_DECREMENT_AND_CLAMP = enum_VkStencilOp.VK_STENCIL_OP_DECREMENT_AND_CLAMP; pub const VK_STENCIL_OP_INVERT = enum_VkStencilOp.VK_STENCIL_OP_INVERT; pub const VK_STENCIL_OP_INCREMENT_AND_WRAP = enum_VkStencilOp.VK_STENCIL_OP_INCREMENT_AND_WRAP; pub const VK_STENCIL_OP_DECREMENT_AND_WRAP = enum_VkStencilOp.VK_STENCIL_OP_DECREMENT_AND_WRAP; pub const VK_STENCIL_OP_BEGIN_RANGE = enum_VkStencilOp.VK_STENCIL_OP_BEGIN_RANGE; pub const VK_STENCIL_OP_END_RANGE = enum_VkStencilOp.VK_STENCIL_OP_END_RANGE; pub const VK_STENCIL_OP_RANGE_SIZE = enum_VkStencilOp.VK_STENCIL_OP_RANGE_SIZE; pub const VK_STENCIL_OP_MAX_ENUM = enum_VkStencilOp.VK_STENCIL_OP_MAX_ENUM; pub const enum_VkStencilOp = extern enum { VK_STENCIL_OP_KEEP = 0, VK_STENCIL_OP_ZERO = 1, VK_STENCIL_OP_REPLACE = 2, VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, VK_STENCIL_OP_INVERT = 5, VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, VK_STENCIL_OP_RANGE_SIZE = 8, VK_STENCIL_OP_MAX_ENUM = 2147483647, }; pub const VkStencilOp = enum_VkStencilOp; pub const VK_LOGIC_OP_CLEAR = enum_VkLogicOp.VK_LOGIC_OP_CLEAR; pub const VK_LOGIC_OP_AND = enum_VkLogicOp.VK_LOGIC_OP_AND; pub const VK_LOGIC_OP_AND_REVERSE = enum_VkLogicOp.VK_LOGIC_OP_AND_REVERSE; pub const VK_LOGIC_OP_COPY = enum_VkLogicOp.VK_LOGIC_OP_COPY; pub const VK_LOGIC_OP_AND_INVERTED = enum_VkLogicOp.VK_LOGIC_OP_AND_INVERTED; pub const VK_LOGIC_OP_NO_OP = enum_VkLogicOp.VK_LOGIC_OP_NO_OP; pub const VK_LOGIC_OP_XOR = enum_VkLogicOp.VK_LOGIC_OP_XOR; pub const VK_LOGIC_OP_OR = enum_VkLogicOp.VK_LOGIC_OP_OR; pub const VK_LOGIC_OP_NOR = enum_VkLogicOp.VK_LOGIC_OP_NOR; pub const VK_LOGIC_OP_EQUIVALENT = enum_VkLogicOp.VK_LOGIC_OP_EQUIVALENT; pub const VK_LOGIC_OP_INVERT = enum_VkLogicOp.VK_LOGIC_OP_INVERT; pub const VK_LOGIC_OP_OR_REVERSE = enum_VkLogicOp.VK_LOGIC_OP_OR_REVERSE; pub const VK_LOGIC_OP_COPY_INVERTED = enum_VkLogicOp.VK_LOGIC_OP_COPY_INVERTED; pub const VK_LOGIC_OP_OR_INVERTED = enum_VkLogicOp.VK_LOGIC_OP_OR_INVERTED; pub const VK_LOGIC_OP_NAND = enum_VkLogicOp.VK_LOGIC_OP_NAND; pub const VK_LOGIC_OP_SET = enum_VkLogicOp.VK_LOGIC_OP_SET; pub const VK_LOGIC_OP_BEGIN_RANGE = enum_VkLogicOp.VK_LOGIC_OP_BEGIN_RANGE; pub const VK_LOGIC_OP_END_RANGE = enum_VkLogicOp.VK_LOGIC_OP_END_RANGE; pub const VK_LOGIC_OP_RANGE_SIZE = enum_VkLogicOp.VK_LOGIC_OP_RANGE_SIZE; pub const VK_LOGIC_OP_MAX_ENUM = enum_VkLogicOp.VK_LOGIC_OP_MAX_ENUM; pub const enum_VkLogicOp = extern enum { VK_LOGIC_OP_CLEAR = 0, VK_LOGIC_OP_AND = 1, VK_LOGIC_OP_AND_REVERSE = 2, VK_LOGIC_OP_COPY = 3, VK_LOGIC_OP_AND_INVERTED = 4, VK_LOGIC_OP_NO_OP = 5, VK_LOGIC_OP_XOR = 6, VK_LOGIC_OP_OR = 7, VK_LOGIC_OP_NOR = 8, VK_LOGIC_OP_EQUIVALENT = 9, VK_LOGIC_OP_INVERT = 10, VK_LOGIC_OP_OR_REVERSE = 11, VK_LOGIC_OP_COPY_INVERTED = 12, VK_LOGIC_OP_OR_INVERTED = 13, VK_LOGIC_OP_NAND = 14, VK_LOGIC_OP_SET = 15, VK_LOGIC_OP_RANGE_SIZE = 16, VK_LOGIC_OP_MAX_ENUM = 2147483647, }; pub const VkLogicOp = enum_VkLogicOp; pub const VK_BLEND_FACTOR_ZERO = enum_VkBlendFactor.VK_BLEND_FACTOR_ZERO; pub const VK_BLEND_FACTOR_ONE = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE; pub const VK_BLEND_FACTOR_SRC_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_SRC_COLOR; pub const VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR; pub const VK_BLEND_FACTOR_DST_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_DST_COLOR; pub const VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR; pub const VK_BLEND_FACTOR_SRC_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_SRC_ALPHA; pub const VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; pub const VK_BLEND_FACTOR_DST_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_DST_ALPHA; pub const VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA; pub const VK_BLEND_FACTOR_CONSTANT_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_CONSTANT_COLOR; pub const VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR; pub const VK_BLEND_FACTOR_CONSTANT_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_CONSTANT_ALPHA; pub const VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA; pub const VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = enum_VkBlendFactor.VK_BLEND_FACTOR_SRC_ALPHA_SATURATE; pub const VK_BLEND_FACTOR_SRC1_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_SRC1_COLOR; pub const VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR; pub const VK_BLEND_FACTOR_SRC1_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_SRC1_ALPHA; pub const VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = enum_VkBlendFactor.VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA; pub const VK_BLEND_FACTOR_BEGIN_RANGE = enum_VkBlendFactor.VK_BLEND_FACTOR_BEGIN_RANGE; pub const VK_BLEND_FACTOR_END_RANGE = enum_VkBlendFactor.VK_BLEND_FACTOR_END_RANGE; pub const VK_BLEND_FACTOR_RANGE_SIZE = enum_VkBlendFactor.VK_BLEND_FACTOR_RANGE_SIZE; pub const VK_BLEND_FACTOR_MAX_ENUM = enum_VkBlendFactor.VK_BLEND_FACTOR_MAX_ENUM; pub const enum_VkBlendFactor = extern enum { VK_BLEND_FACTOR_ZERO = 0, VK_BLEND_FACTOR_ONE = 1, VK_BLEND_FACTOR_SRC_COLOR = 2, VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, VK_BLEND_FACTOR_DST_COLOR = 4, VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, VK_BLEND_FACTOR_SRC_ALPHA = 6, VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, VK_BLEND_FACTOR_DST_ALPHA = 8, VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, VK_BLEND_FACTOR_CONSTANT_COLOR = 10, VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, VK_BLEND_FACTOR_SRC1_COLOR = 15, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, VK_BLEND_FACTOR_SRC1_ALPHA = 17, VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, VK_BLEND_FACTOR_RANGE_SIZE = 19, VK_BLEND_FACTOR_MAX_ENUM = 2147483647, }; pub const VkBlendFactor = enum_VkBlendFactor; pub const VK_BLEND_OP_ADD = enum_VkBlendOp.VK_BLEND_OP_ADD; pub const VK_BLEND_OP_SUBTRACT = enum_VkBlendOp.VK_BLEND_OP_SUBTRACT; pub const VK_BLEND_OP_REVERSE_SUBTRACT = enum_VkBlendOp.VK_BLEND_OP_REVERSE_SUBTRACT; pub const VK_BLEND_OP_MIN = enum_VkBlendOp.VK_BLEND_OP_MIN; pub const VK_BLEND_OP_MAX = enum_VkBlendOp.VK_BLEND_OP_MAX; pub const VK_BLEND_OP_ZERO_EXT = enum_VkBlendOp.VK_BLEND_OP_ZERO_EXT; pub const VK_BLEND_OP_SRC_EXT = enum_VkBlendOp.VK_BLEND_OP_SRC_EXT; pub const VK_BLEND_OP_DST_EXT = enum_VkBlendOp.VK_BLEND_OP_DST_EXT; pub const VK_BLEND_OP_SRC_OVER_EXT = enum_VkBlendOp.VK_BLEND_OP_SRC_OVER_EXT; pub const VK_BLEND_OP_DST_OVER_EXT = enum_VkBlendOp.VK_BLEND_OP_DST_OVER_EXT; pub const VK_BLEND_OP_SRC_IN_EXT = enum_VkBlendOp.VK_BLEND_OP_SRC_IN_EXT; pub const VK_BLEND_OP_DST_IN_EXT = enum_VkBlendOp.VK_BLEND_OP_DST_IN_EXT; pub const VK_BLEND_OP_SRC_OUT_EXT = enum_VkBlendOp.VK_BLEND_OP_SRC_OUT_EXT; pub const VK_BLEND_OP_DST_OUT_EXT = enum_VkBlendOp.VK_BLEND_OP_DST_OUT_EXT; pub const VK_BLEND_OP_SRC_ATOP_EXT = enum_VkBlendOp.VK_BLEND_OP_SRC_ATOP_EXT; pub const VK_BLEND_OP_DST_ATOP_EXT = enum_VkBlendOp.VK_BLEND_OP_DST_ATOP_EXT; pub const VK_BLEND_OP_XOR_EXT = enum_VkBlendOp.VK_BLEND_OP_XOR_EXT; pub const VK_BLEND_OP_MULTIPLY_EXT = enum_VkBlendOp.VK_BLEND_OP_MULTIPLY_EXT; pub const VK_BLEND_OP_SCREEN_EXT = enum_VkBlendOp.VK_BLEND_OP_SCREEN_EXT; pub const VK_BLEND_OP_OVERLAY_EXT = enum_VkBlendOp.VK_BLEND_OP_OVERLAY_EXT; pub const VK_BLEND_OP_DARKEN_EXT = enum_VkBlendOp.VK_BLEND_OP_DARKEN_EXT; pub const VK_BLEND_OP_LIGHTEN_EXT = enum_VkBlendOp.VK_BLEND_OP_LIGHTEN_EXT; pub const VK_BLEND_OP_COLORDODGE_EXT = enum_VkBlendOp.VK_BLEND_OP_COLORDODGE_EXT; pub const VK_BLEND_OP_COLORBURN_EXT = enum_VkBlendOp.VK_BLEND_OP_COLORBURN_EXT; pub const VK_BLEND_OP_HARDLIGHT_EXT = enum_VkBlendOp.VK_BLEND_OP_HARDLIGHT_EXT; pub const VK_BLEND_OP_SOFTLIGHT_EXT = enum_VkBlendOp.VK_BLEND_OP_SOFTLIGHT_EXT; pub const VK_BLEND_OP_DIFFERENCE_EXT = enum_VkBlendOp.VK_BLEND_OP_DIFFERENCE_EXT; pub const VK_BLEND_OP_EXCLUSION_EXT = enum_VkBlendOp.VK_BLEND_OP_EXCLUSION_EXT; pub const VK_BLEND_OP_INVERT_EXT = enum_VkBlendOp.VK_BLEND_OP_INVERT_EXT; pub const VK_BLEND_OP_INVERT_RGB_EXT = enum_VkBlendOp.VK_BLEND_OP_INVERT_RGB_EXT; pub const VK_BLEND_OP_LINEARDODGE_EXT = enum_VkBlendOp.VK_BLEND_OP_LINEARDODGE_EXT; pub const VK_BLEND_OP_LINEARBURN_EXT = enum_VkBlendOp.VK_BLEND_OP_LINEARBURN_EXT; pub const VK_BLEND_OP_VIVIDLIGHT_EXT = enum_VkBlendOp.VK_BLEND_OP_VIVIDLIGHT_EXT; pub const VK_BLEND_OP_LINEARLIGHT_EXT = enum_VkBlendOp.VK_BLEND_OP_LINEARLIGHT_EXT; pub const VK_BLEND_OP_PINLIGHT_EXT = enum_VkBlendOp.VK_BLEND_OP_PINLIGHT_EXT; pub const VK_BLEND_OP_HARDMIX_EXT = enum_VkBlendOp.VK_BLEND_OP_HARDMIX_EXT; pub const VK_BLEND_OP_HSL_HUE_EXT = enum_VkBlendOp.VK_BLEND_OP_HSL_HUE_EXT; pub const VK_BLEND_OP_HSL_SATURATION_EXT = enum_VkBlendOp.VK_BLEND_OP_HSL_SATURATION_EXT; pub const VK_BLEND_OP_HSL_COLOR_EXT = enum_VkBlendOp.VK_BLEND_OP_HSL_COLOR_EXT; pub const VK_BLEND_OP_HSL_LUMINOSITY_EXT = enum_VkBlendOp.VK_BLEND_OP_HSL_LUMINOSITY_EXT; pub const VK_BLEND_OP_PLUS_EXT = enum_VkBlendOp.VK_BLEND_OP_PLUS_EXT; pub const VK_BLEND_OP_PLUS_CLAMPED_EXT = enum_VkBlendOp.VK_BLEND_OP_PLUS_CLAMPED_EXT; pub const VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = enum_VkBlendOp.VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT; pub const VK_BLEND_OP_PLUS_DARKER_EXT = enum_VkBlendOp.VK_BLEND_OP_PLUS_DARKER_EXT; pub const VK_BLEND_OP_MINUS_EXT = enum_VkBlendOp.VK_BLEND_OP_MINUS_EXT; pub const VK_BLEND_OP_MINUS_CLAMPED_EXT = enum_VkBlendOp.VK_BLEND_OP_MINUS_CLAMPED_EXT; pub const VK_BLEND_OP_CONTRAST_EXT = enum_VkBlendOp.VK_BLEND_OP_CONTRAST_EXT; pub const VK_BLEND_OP_INVERT_OVG_EXT = enum_VkBlendOp.VK_BLEND_OP_INVERT_OVG_EXT; pub const VK_BLEND_OP_RED_EXT = enum_VkBlendOp.VK_BLEND_OP_RED_EXT; pub const VK_BLEND_OP_GREEN_EXT = enum_VkBlendOp.VK_BLEND_OP_GREEN_EXT; pub const VK_BLEND_OP_BLUE_EXT = enum_VkBlendOp.VK_BLEND_OP_BLUE_EXT; pub const VK_BLEND_OP_BEGIN_RANGE = enum_VkBlendOp.VK_BLEND_OP_BEGIN_RANGE; pub const VK_BLEND_OP_END_RANGE = enum_VkBlendOp.VK_BLEND_OP_END_RANGE; pub const VK_BLEND_OP_RANGE_SIZE = enum_VkBlendOp.VK_BLEND_OP_RANGE_SIZE; pub const VK_BLEND_OP_MAX_ENUM = enum_VkBlendOp.VK_BLEND_OP_MAX_ENUM; pub const enum_VkBlendOp = extern enum { VK_BLEND_OP_ADD = 0, VK_BLEND_OP_SUBTRACT = 1, VK_BLEND_OP_REVERSE_SUBTRACT = 2, VK_BLEND_OP_MIN = 3, VK_BLEND_OP_MAX = 4, VK_BLEND_OP_ZERO_EXT = 1000148000, VK_BLEND_OP_SRC_EXT = 1000148001, VK_BLEND_OP_DST_EXT = 1000148002, VK_BLEND_OP_SRC_OVER_EXT = 1000148003, VK_BLEND_OP_DST_OVER_EXT = 1000148004, VK_BLEND_OP_SRC_IN_EXT = 1000148005, VK_BLEND_OP_DST_IN_EXT = 1000148006, VK_BLEND_OP_SRC_OUT_EXT = 1000148007, VK_BLEND_OP_DST_OUT_EXT = 1000148008, VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, VK_BLEND_OP_DST_ATOP_EXT = 1000148010, VK_BLEND_OP_XOR_EXT = 1000148011, VK_BLEND_OP_MULTIPLY_EXT = 1000148012, VK_BLEND_OP_SCREEN_EXT = 1000148013, VK_BLEND_OP_OVERLAY_EXT = 1000148014, VK_BLEND_OP_DARKEN_EXT = 1000148015, VK_BLEND_OP_LIGHTEN_EXT = 1000148016, VK_BLEND_OP_COLORDODGE_EXT = 1000148017, VK_BLEND_OP_COLORBURN_EXT = 1000148018, VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, VK_BLEND_OP_EXCLUSION_EXT = 1000148022, VK_BLEND_OP_INVERT_EXT = 1000148023, VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, VK_BLEND_OP_LINEARBURN_EXT = 1000148026, VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, VK_BLEND_OP_PINLIGHT_EXT = 1000148029, VK_BLEND_OP_HARDMIX_EXT = 1000148030, VK_BLEND_OP_HSL_HUE_EXT = 1000148031, VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, VK_BLEND_OP_PLUS_EXT = 1000148035, VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, VK_BLEND_OP_MINUS_EXT = 1000148039, VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, VK_BLEND_OP_CONTRAST_EXT = 1000148041, VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, VK_BLEND_OP_RED_EXT = 1000148043, VK_BLEND_OP_GREEN_EXT = 1000148044, VK_BLEND_OP_BLUE_EXT = 1000148045, VK_BLEND_OP_RANGE_SIZE = 5, VK_BLEND_OP_MAX_ENUM = 2147483647, }; pub const VkBlendOp = enum_VkBlendOp; pub const VK_DYNAMIC_STATE_VIEWPORT = enum_VkDynamicState.VK_DYNAMIC_STATE_VIEWPORT; pub const VK_DYNAMIC_STATE_SCISSOR = enum_VkDynamicState.VK_DYNAMIC_STATE_SCISSOR; pub const VK_DYNAMIC_STATE_LINE_WIDTH = enum_VkDynamicState.VK_DYNAMIC_STATE_LINE_WIDTH; pub const VK_DYNAMIC_STATE_DEPTH_BIAS = enum_VkDynamicState.VK_DYNAMIC_STATE_DEPTH_BIAS; pub const VK_DYNAMIC_STATE_BLEND_CONSTANTS = enum_VkDynamicState.VK_DYNAMIC_STATE_BLEND_CONSTANTS; pub const VK_DYNAMIC_STATE_DEPTH_BOUNDS = enum_VkDynamicState.VK_DYNAMIC_STATE_DEPTH_BOUNDS; pub const VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = enum_VkDynamicState.VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK; pub const VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = enum_VkDynamicState.VK_DYNAMIC_STATE_STENCIL_WRITE_MASK; pub const VK_DYNAMIC_STATE_STENCIL_REFERENCE = enum_VkDynamicState.VK_DYNAMIC_STATE_STENCIL_REFERENCE; pub const VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = enum_VkDynamicState.VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV; pub const VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = enum_VkDynamicState.VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT; pub const VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = enum_VkDynamicState.VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT; pub const VK_DYNAMIC_STATE_BEGIN_RANGE = enum_VkDynamicState.VK_DYNAMIC_STATE_BEGIN_RANGE; pub const VK_DYNAMIC_STATE_END_RANGE = enum_VkDynamicState.VK_DYNAMIC_STATE_END_RANGE; pub const VK_DYNAMIC_STATE_RANGE_SIZE = enum_VkDynamicState.VK_DYNAMIC_STATE_RANGE_SIZE; pub const VK_DYNAMIC_STATE_MAX_ENUM = enum_VkDynamicState.VK_DYNAMIC_STATE_MAX_ENUM; pub const enum_VkDynamicState = extern enum { VK_DYNAMIC_STATE_VIEWPORT = 0, VK_DYNAMIC_STATE_SCISSOR = 1, VK_DYNAMIC_STATE_LINE_WIDTH = 2, VK_DYNAMIC_STATE_DEPTH_BIAS = 3, VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, VK_DYNAMIC_STATE_RANGE_SIZE = 9, VK_DYNAMIC_STATE_MAX_ENUM = 2147483647, }; pub const VkDynamicState = enum_VkDynamicState; pub const VK_FILTER_NEAREST = enum_VkFilter.VK_FILTER_NEAREST; pub const VK_FILTER_LINEAR = enum_VkFilter.VK_FILTER_LINEAR; pub const VK_FILTER_CUBIC_IMG = enum_VkFilter.VK_FILTER_CUBIC_IMG; pub const VK_FILTER_BEGIN_RANGE = enum_VkFilter.VK_FILTER_BEGIN_RANGE; pub const VK_FILTER_END_RANGE = enum_VkFilter.VK_FILTER_END_RANGE; pub const VK_FILTER_RANGE_SIZE = enum_VkFilter.VK_FILTER_RANGE_SIZE; pub const VK_FILTER_MAX_ENUM = enum_VkFilter.VK_FILTER_MAX_ENUM; pub const enum_VkFilter = extern enum { VK_FILTER_NEAREST = 0, VK_FILTER_LINEAR = 1, VK_FILTER_CUBIC_IMG = 1000015000, VK_FILTER_BEGIN_RANGE = 0, VK_FILTER_END_RANGE = 1, VK_FILTER_RANGE_SIZE = 2, VK_FILTER_MAX_ENUM = 2147483647, }; pub const VkFilter = enum_VkFilter; pub const VK_SAMPLER_MIPMAP_MODE_NEAREST = enum_VkSamplerMipmapMode.VK_SAMPLER_MIPMAP_MODE_NEAREST; pub const VK_SAMPLER_MIPMAP_MODE_LINEAR = enum_VkSamplerMipmapMode.VK_SAMPLER_MIPMAP_MODE_LINEAR; pub const VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = enum_VkSamplerMipmapMode.VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE; pub const VK_SAMPLER_MIPMAP_MODE_END_RANGE = enum_VkSamplerMipmapMode.VK_SAMPLER_MIPMAP_MODE_END_RANGE; pub const VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = enum_VkSamplerMipmapMode.VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE; pub const VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = enum_VkSamplerMipmapMode.VK_SAMPLER_MIPMAP_MODE_MAX_ENUM; pub const enum_VkSamplerMipmapMode = extern enum { VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = 0, VK_SAMPLER_MIPMAP_MODE_END_RANGE = 1, VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = 2, VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 2147483647, }; pub const VkSamplerMipmapMode = enum_VkSamplerMipmapMode; pub const VK_SAMPLER_ADDRESS_MODE_REPEAT = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_REPEAT; pub const VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT; pub const VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; pub const VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; pub const VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; pub const VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE; pub const VK_SAMPLER_ADDRESS_MODE_END_RANGE = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_END_RANGE; pub const VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE; pub const VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = enum_VkSamplerAddressMode.VK_SAMPLER_ADDRESS_MODE_MAX_ENUM; pub const enum_VkSamplerAddressMode = extern enum { VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = 0, VK_SAMPLER_ADDRESS_MODE_END_RANGE = 3, VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = 4, VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 2147483647, }; pub const VkSamplerAddressMode = enum_VkSamplerAddressMode; pub const VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = enum_VkBorderColor.VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; pub const VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = enum_VkBorderColor.VK_BORDER_COLOR_INT_TRANSPARENT_BLACK; pub const VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = enum_VkBorderColor.VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK; pub const VK_BORDER_COLOR_INT_OPAQUE_BLACK = enum_VkBorderColor.VK_BORDER_COLOR_INT_OPAQUE_BLACK; pub const VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = enum_VkBorderColor.VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE; pub const VK_BORDER_COLOR_INT_OPAQUE_WHITE = enum_VkBorderColor.VK_BORDER_COLOR_INT_OPAQUE_WHITE; pub const VK_BORDER_COLOR_BEGIN_RANGE = enum_VkBorderColor.VK_BORDER_COLOR_BEGIN_RANGE; pub const VK_BORDER_COLOR_END_RANGE = enum_VkBorderColor.VK_BORDER_COLOR_END_RANGE; pub const VK_BORDER_COLOR_RANGE_SIZE = enum_VkBorderColor.VK_BORDER_COLOR_RANGE_SIZE; pub const VK_BORDER_COLOR_MAX_ENUM = enum_VkBorderColor.VK_BORDER_COLOR_MAX_ENUM; pub const enum_VkBorderColor = extern enum { VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, VK_BORDER_COLOR_BEGIN_RANGE = 0, VK_BORDER_COLOR_END_RANGE = 5, VK_BORDER_COLOR_RANGE_SIZE = 6, VK_BORDER_COLOR_MAX_ENUM = 2147483647, }; pub const VkBorderColor = enum_VkBorderColor; pub const VK_DESCRIPTOR_TYPE_SAMPLER = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_SAMPLER; pub const VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; pub const VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; pub const VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; pub const VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; pub const VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; pub const VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; pub const VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; pub const VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; pub const VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; pub const VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT; pub const VK_DESCRIPTOR_TYPE_BEGIN_RANGE = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_BEGIN_RANGE; pub const VK_DESCRIPTOR_TYPE_END_RANGE = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_END_RANGE; pub const VK_DESCRIPTOR_TYPE_RANGE_SIZE = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_RANGE_SIZE; pub const VK_DESCRIPTOR_TYPE_MAX_ENUM = enum_VkDescriptorType.VK_DESCRIPTOR_TYPE_MAX_ENUM; pub const enum_VkDescriptorType = extern enum { VK_DESCRIPTOR_TYPE_SAMPLER = 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, VK_DESCRIPTOR_TYPE_BEGIN_RANGE = 0, VK_DESCRIPTOR_TYPE_END_RANGE = 10, VK_DESCRIPTOR_TYPE_RANGE_SIZE = 11, VK_DESCRIPTOR_TYPE_MAX_ENUM = 2147483647, }; pub const VkDescriptorType = enum_VkDescriptorType; pub const VK_ATTACHMENT_LOAD_OP_LOAD = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_LOAD; pub const VK_ATTACHMENT_LOAD_OP_CLEAR = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_CLEAR; pub const VK_ATTACHMENT_LOAD_OP_DONT_CARE = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_DONT_CARE; pub const VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE; pub const VK_ATTACHMENT_LOAD_OP_END_RANGE = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_END_RANGE; pub const VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_RANGE_SIZE; pub const VK_ATTACHMENT_LOAD_OP_MAX_ENUM = enum_VkAttachmentLoadOp.VK_ATTACHMENT_LOAD_OP_MAX_ENUM; pub const enum_VkAttachmentLoadOp = extern enum { VK_ATTACHMENT_LOAD_OP_LOAD = 0, VK_ATTACHMENT_LOAD_OP_CLEAR = 1, VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = 3, VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 2147483647, }; pub const VkAttachmentLoadOp = enum_VkAttachmentLoadOp; pub const VK_ATTACHMENT_STORE_OP_STORE = enum_VkAttachmentStoreOp.VK_ATTACHMENT_STORE_OP_STORE; pub const VK_ATTACHMENT_STORE_OP_DONT_CARE = enum_VkAttachmentStoreOp.VK_ATTACHMENT_STORE_OP_DONT_CARE; pub const VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = enum_VkAttachmentStoreOp.VK_ATTACHMENT_STORE_OP_BEGIN_RANGE; pub const VK_ATTACHMENT_STORE_OP_END_RANGE = enum_VkAttachmentStoreOp.VK_ATTACHMENT_STORE_OP_END_RANGE; pub const VK_ATTACHMENT_STORE_OP_RANGE_SIZE = enum_VkAttachmentStoreOp.VK_ATTACHMENT_STORE_OP_RANGE_SIZE; pub const VK_ATTACHMENT_STORE_OP_MAX_ENUM = enum_VkAttachmentStoreOp.VK_ATTACHMENT_STORE_OP_MAX_ENUM; pub const enum_VkAttachmentStoreOp = extern enum { VK_ATTACHMENT_STORE_OP_STORE = 0, VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, VK_ATTACHMENT_STORE_OP_RANGE_SIZE = 2, VK_ATTACHMENT_STORE_OP_MAX_ENUM = 2147483647, }; pub const VkAttachmentStoreOp = enum_VkAttachmentStoreOp; pub const VK_PIPELINE_BIND_POINT_GRAPHICS = enum_VkPipelineBindPoint.VK_PIPELINE_BIND_POINT_GRAPHICS; pub const VK_PIPELINE_BIND_POINT_COMPUTE = enum_VkPipelineBindPoint.VK_PIPELINE_BIND_POINT_COMPUTE; pub const VK_PIPELINE_BIND_POINT_BEGIN_RANGE = enum_VkPipelineBindPoint.VK_PIPELINE_BIND_POINT_BEGIN_RANGE; pub const VK_PIPELINE_BIND_POINT_END_RANGE = enum_VkPipelineBindPoint.VK_PIPELINE_BIND_POINT_END_RANGE; pub const VK_PIPELINE_BIND_POINT_RANGE_SIZE = enum_VkPipelineBindPoint.VK_PIPELINE_BIND_POINT_RANGE_SIZE; pub const VK_PIPELINE_BIND_POINT_MAX_ENUM = enum_VkPipelineBindPoint.VK_PIPELINE_BIND_POINT_MAX_ENUM; pub const enum_VkPipelineBindPoint = extern enum { VK_PIPELINE_BIND_POINT_GRAPHICS = 0, VK_PIPELINE_BIND_POINT_COMPUTE = 1, VK_PIPELINE_BIND_POINT_RANGE_SIZE = 2, VK_PIPELINE_BIND_POINT_MAX_ENUM = 2147483647, }; pub const VkPipelineBindPoint = enum_VkPipelineBindPoint; pub const VK_COMMAND_BUFFER_LEVEL_PRIMARY = enum_VkCommandBufferLevel.VK_COMMAND_BUFFER_LEVEL_PRIMARY; pub const VK_COMMAND_BUFFER_LEVEL_SECONDARY = enum_VkCommandBufferLevel.VK_COMMAND_BUFFER_LEVEL_SECONDARY; pub const VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = enum_VkCommandBufferLevel.VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE; pub const VK_COMMAND_BUFFER_LEVEL_END_RANGE = enum_VkCommandBufferLevel.VK_COMMAND_BUFFER_LEVEL_END_RANGE; pub const VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = enum_VkCommandBufferLevel.VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE; pub const VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = enum_VkCommandBufferLevel.VK_COMMAND_BUFFER_LEVEL_MAX_ENUM; pub const enum_VkCommandBufferLevel = extern enum { VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = 2, VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 2147483647, }; pub const VkCommandBufferLevel = enum_VkCommandBufferLevel; pub const VK_INDEX_TYPE_UINT16 = enum_VkIndexType.VK_INDEX_TYPE_UINT16; pub const VK_INDEX_TYPE_UINT32 = enum_VkIndexType.VK_INDEX_TYPE_UINT32; pub const VK_INDEX_TYPE_BEGIN_RANGE = enum_VkIndexType.VK_INDEX_TYPE_BEGIN_RANGE; pub const VK_INDEX_TYPE_END_RANGE = enum_VkIndexType.VK_INDEX_TYPE_END_RANGE; pub const VK_INDEX_TYPE_RANGE_SIZE = enum_VkIndexType.VK_INDEX_TYPE_RANGE_SIZE; pub const VK_INDEX_TYPE_MAX_ENUM = enum_VkIndexType.VK_INDEX_TYPE_MAX_ENUM; pub const enum_VkIndexType = extern enum { VK_INDEX_TYPE_UINT16 = 0, VK_INDEX_TYPE_UINT32 = 1, VK_INDEX_TYPE_BEGIN_RANGE = 0, VK_INDEX_TYPE_END_RANGE = 1, VK_INDEX_TYPE_RANGE_SIZE = 2, VK_INDEX_TYPE_MAX_ENUM = 2147483647, }; pub const VkIndexType = enum_VkIndexType; pub const VK_SUBPASS_CONTENTS_INLINE = enum_VkSubpassContents.VK_SUBPASS_CONTENTS_INLINE; pub const VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = enum_VkSubpassContents.VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS; pub const VK_SUBPASS_CONTENTS_BEGIN_RANGE = enum_VkSubpassContents.VK_SUBPASS_CONTENTS_BEGIN_RANGE; pub const VK_SUBPASS_CONTENTS_END_RANGE = enum_VkSubpassContents.VK_SUBPASS_CONTENTS_END_RANGE; pub const VK_SUBPASS_CONTENTS_RANGE_SIZE = enum_VkSubpassContents.VK_SUBPASS_CONTENTS_RANGE_SIZE; pub const VK_SUBPASS_CONTENTS_MAX_ENUM = enum_VkSubpassContents.VK_SUBPASS_CONTENTS_MAX_ENUM; pub const enum_VkSubpassContents = extern enum { VK_SUBPASS_CONTENTS_INLINE = 0, VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, VK_SUBPASS_CONTENTS_RANGE_SIZE = 2, VK_SUBPASS_CONTENTS_MAX_ENUM = 2147483647, }; pub const VkSubpassContents = enum_VkSubpassContents; pub const VK_OBJECT_TYPE_UNKNOWN = enum_VkObjectType.VK_OBJECT_TYPE_UNKNOWN; pub const VK_OBJECT_TYPE_INSTANCE = enum_VkObjectType.VK_OBJECT_TYPE_INSTANCE; pub const VK_OBJECT_TYPE_PHYSICAL_DEVICE = enum_VkObjectType.VK_OBJECT_TYPE_PHYSICAL_DEVICE; pub const VK_OBJECT_TYPE_DEVICE = enum_VkObjectType.VK_OBJECT_TYPE_DEVICE; pub const VK_OBJECT_TYPE_QUEUE = enum_VkObjectType.VK_OBJECT_TYPE_QUEUE; pub const VK_OBJECT_TYPE_SEMAPHORE = enum_VkObjectType.VK_OBJECT_TYPE_SEMAPHORE; pub const VK_OBJECT_TYPE_COMMAND_BUFFER = enum_VkObjectType.VK_OBJECT_TYPE_COMMAND_BUFFER; pub const VK_OBJECT_TYPE_FENCE = enum_VkObjectType.VK_OBJECT_TYPE_FENCE; pub const VK_OBJECT_TYPE_DEVICE_MEMORY = enum_VkObjectType.VK_OBJECT_TYPE_DEVICE_MEMORY; pub const VK_OBJECT_TYPE_BUFFER = enum_VkObjectType.VK_OBJECT_TYPE_BUFFER; pub const VK_OBJECT_TYPE_IMAGE = enum_VkObjectType.VK_OBJECT_TYPE_IMAGE; pub const VK_OBJECT_TYPE_EVENT = enum_VkObjectType.VK_OBJECT_TYPE_EVENT; pub const VK_OBJECT_TYPE_QUERY_POOL = enum_VkObjectType.VK_OBJECT_TYPE_QUERY_POOL; pub const VK_OBJECT_TYPE_BUFFER_VIEW = enum_VkObjectType.VK_OBJECT_TYPE_BUFFER_VIEW; pub const VK_OBJECT_TYPE_IMAGE_VIEW = enum_VkObjectType.VK_OBJECT_TYPE_IMAGE_VIEW; pub const VK_OBJECT_TYPE_SHADER_MODULE = enum_VkObjectType.VK_OBJECT_TYPE_SHADER_MODULE; pub const VK_OBJECT_TYPE_PIPELINE_CACHE = enum_VkObjectType.VK_OBJECT_TYPE_PIPELINE_CACHE; pub const VK_OBJECT_TYPE_PIPELINE_LAYOUT = enum_VkObjectType.VK_OBJECT_TYPE_PIPELINE_LAYOUT; pub const VK_OBJECT_TYPE_RENDER_PASS = enum_VkObjectType.VK_OBJECT_TYPE_RENDER_PASS; pub const VK_OBJECT_TYPE_PIPELINE = enum_VkObjectType.VK_OBJECT_TYPE_PIPELINE; pub const VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = enum_VkObjectType.VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; pub const VK_OBJECT_TYPE_SAMPLER = enum_VkObjectType.VK_OBJECT_TYPE_SAMPLER; pub const VK_OBJECT_TYPE_DESCRIPTOR_POOL = enum_VkObjectType.VK_OBJECT_TYPE_DESCRIPTOR_POOL; pub const VK_OBJECT_TYPE_DESCRIPTOR_SET = enum_VkObjectType.VK_OBJECT_TYPE_DESCRIPTOR_SET; pub const VK_OBJECT_TYPE_FRAMEBUFFER = enum_VkObjectType.VK_OBJECT_TYPE_FRAMEBUFFER; pub const VK_OBJECT_TYPE_COMMAND_POOL = enum_VkObjectType.VK_OBJECT_TYPE_COMMAND_POOL; pub const VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = enum_VkObjectType.VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION; pub const VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = enum_VkObjectType.VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE; pub const VK_OBJECT_TYPE_SURFACE_KHR = enum_VkObjectType.VK_OBJECT_TYPE_SURFACE_KHR; pub const VK_OBJECT_TYPE_SWAPCHAIN_KHR = enum_VkObjectType.VK_OBJECT_TYPE_SWAPCHAIN_KHR; pub const VK_OBJECT_TYPE_DISPLAY_KHR = enum_VkObjectType.VK_OBJECT_TYPE_DISPLAY_KHR; pub const VK_OBJECT_TYPE_DISPLAY_MODE_KHR = enum_VkObjectType.VK_OBJECT_TYPE_DISPLAY_MODE_KHR; pub const VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = enum_VkObjectType.VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT; pub const VK_OBJECT_TYPE_OBJECT_TABLE_NVX = enum_VkObjectType.VK_OBJECT_TYPE_OBJECT_TABLE_NVX; pub const VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = enum_VkObjectType.VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX; pub const VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = enum_VkObjectType.VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT; pub const VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = enum_VkObjectType.VK_OBJECT_TYPE_VALIDATION_CACHE_EXT; pub const VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = enum_VkObjectType.VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR; pub const VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = enum_VkObjectType.VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR; pub const VK_OBJECT_TYPE_BEGIN_RANGE = enum_VkObjectType.VK_OBJECT_TYPE_BEGIN_RANGE; pub const VK_OBJECT_TYPE_END_RANGE = enum_VkObjectType.VK_OBJECT_TYPE_END_RANGE; pub const VK_OBJECT_TYPE_RANGE_SIZE = enum_VkObjectType.VK_OBJECT_TYPE_RANGE_SIZE; pub const VK_OBJECT_TYPE_MAX_ENUM = enum_VkObjectType.VK_OBJECT_TYPE_MAX_ENUM; pub const enum_VkObjectType = extern enum { VK_OBJECT_TYPE_UNKNOWN = 0, VK_OBJECT_TYPE_INSTANCE = 1, VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, VK_OBJECT_TYPE_DEVICE = 3, VK_OBJECT_TYPE_QUEUE = 4, VK_OBJECT_TYPE_SEMAPHORE = 5, VK_OBJECT_TYPE_COMMAND_BUFFER = 6, VK_OBJECT_TYPE_FENCE = 7, VK_OBJECT_TYPE_DEVICE_MEMORY = 8, VK_OBJECT_TYPE_BUFFER = 9, VK_OBJECT_TYPE_IMAGE = 10, VK_OBJECT_TYPE_EVENT = 11, VK_OBJECT_TYPE_QUERY_POOL = 12, VK_OBJECT_TYPE_BUFFER_VIEW = 13, VK_OBJECT_TYPE_IMAGE_VIEW = 14, VK_OBJECT_TYPE_SHADER_MODULE = 15, VK_OBJECT_TYPE_PIPELINE_CACHE = 16, VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, VK_OBJECT_TYPE_RENDER_PASS = 18, VK_OBJECT_TYPE_PIPELINE = 19, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, VK_OBJECT_TYPE_SAMPLER = 21, VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, VK_OBJECT_TYPE_FRAMEBUFFER = 24, VK_OBJECT_TYPE_COMMAND_POOL = 25, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = 1000156000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = 1000085000, VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000, VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = 1000156000, VK_OBJECT_TYPE_BEGIN_RANGE = 0, VK_OBJECT_TYPE_END_RANGE = 25, VK_OBJECT_TYPE_RANGE_SIZE = 26, VK_OBJECT_TYPE_MAX_ENUM = 2147483647, }; pub const VkObjectType = enum_VkObjectType; pub const VkInstanceCreateFlags = VkFlags; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; pub const VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; pub const VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT; pub const VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT; pub const VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT; pub const VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT; pub const VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT; pub const VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; pub const VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; pub const VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; pub const VK_FORMAT_FEATURE_BLIT_SRC_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_BLIT_SRC_BIT; pub const VK_FORMAT_FEATURE_BLIT_DST_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_BLIT_DST_BIT; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; pub const VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_TRANSFER_SRC_BIT; pub const VK_FORMAT_FEATURE_TRANSFER_DST_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_TRANSFER_DST_BIT; pub const VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT; pub const VK_FORMAT_FEATURE_DISJOINT_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_DISJOINT_BIT; pub const VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT; pub const VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR; pub const VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR; pub const VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR; pub const VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR; pub const VK_FORMAT_FEATURE_DISJOINT_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_DISJOINT_BIT_KHR; pub const VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR; pub const VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = enum_VkFormatFeatureFlagBits.VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM; pub const enum_VkFormatFeatureFlagBits = extern enum { VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 1, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 2, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 4, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 8, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 16, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 32, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 64, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 128, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 256, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 512, VK_FORMAT_FEATURE_BLIT_SRC_BIT = 1024, VK_FORMAT_FEATURE_BLIT_DST_BIT = 2048, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 4096, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = 16384, VK_FORMAT_FEATURE_TRANSFER_DST_BIT = 32768, VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT = 131072, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 262144, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 524288, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 1048576, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 2097152, VK_FORMAT_FEATURE_DISJOINT_BIT = 4194304, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 8388608, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 8192, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 65536, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 16384, VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 32768, VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = 131072, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = 262144, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = 524288, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = 1048576, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = 2097152, VK_FORMAT_FEATURE_DISJOINT_BIT_KHR = 4194304, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR = 8388608, VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkFormatFeatureFlagBits = enum_VkFormatFeatureFlagBits; pub const VkFormatFeatureFlags = VkFlags; pub const VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 1; pub const VK_IMAGE_USAGE_TRANSFER_DST_BIT = 2; pub const VK_IMAGE_USAGE_SAMPLED_BIT = 4; pub const VK_IMAGE_USAGE_STORAGE_BIT = 8; pub const VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 16; pub const VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 32; pub const VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 64; pub const VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 128; pub const enum_VkImageUsageFlagBits = c_int; pub const VkImageUsageFlagBits = enum_VkImageUsageFlagBits; pub const VkImageUsageFlags = VkFlags; pub const VK_IMAGE_CREATE_SPARSE_BINDING_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_SPARSE_BINDING_BIT; pub const VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT; pub const VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_SPARSE_ALIASED_BIT; pub const VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; pub const VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; pub const VK_IMAGE_CREATE_ALIAS_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_ALIAS_BIT; pub const VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT; pub const VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; pub const VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT; pub const VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_EXTENDED_USAGE_BIT; pub const VK_IMAGE_CREATE_PROTECTED_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_PROTECTED_BIT; pub const VK_IMAGE_CREATE_DISJOINT_BIT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_DISJOINT_BIT; pub const VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT; pub const VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR; pub const VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR; pub const VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR; pub const VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR; pub const VK_IMAGE_CREATE_DISJOINT_BIT_KHR = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_DISJOINT_BIT_KHR; pub const VK_IMAGE_CREATE_ALIAS_BIT_KHR = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_ALIAS_BIT_KHR; pub const VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = enum_VkImageCreateFlagBits.VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkImageCreateFlagBits = extern enum { VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 1, VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 2, VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 4, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 8, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 16, VK_IMAGE_CREATE_ALIAS_BIT = 1024, VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT = 64, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT = 32, VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = 128, VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = 256, VK_IMAGE_CREATE_PROTECTED_BIT = 2048, VK_IMAGE_CREATE_DISJOINT_BIT = 512, VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 4096, VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 64, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 32, VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = 128, VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR = 256, VK_IMAGE_CREATE_DISJOINT_BIT_KHR = 512, VK_IMAGE_CREATE_ALIAS_BIT_KHR = 1024, VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkImageCreateFlagBits = enum_VkImageCreateFlagBits; pub const VkImageCreateFlags = VkFlags; pub const VK_SAMPLE_COUNT_1_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_1_BIT; pub const VK_SAMPLE_COUNT_2_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_2_BIT; pub const VK_SAMPLE_COUNT_4_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_4_BIT; pub const VK_SAMPLE_COUNT_8_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_8_BIT; pub const VK_SAMPLE_COUNT_16_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_16_BIT; pub const VK_SAMPLE_COUNT_32_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_32_BIT; pub const VK_SAMPLE_COUNT_64_BIT = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_64_BIT; pub const VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = enum_VkSampleCountFlagBits.VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM; pub const enum_VkSampleCountFlagBits = extern enum { VK_SAMPLE_COUNT_1_BIT = 1, VK_SAMPLE_COUNT_2_BIT = 2, VK_SAMPLE_COUNT_4_BIT = 4, VK_SAMPLE_COUNT_8_BIT = 8, VK_SAMPLE_COUNT_16_BIT = 16, VK_SAMPLE_COUNT_32_BIT = 32, VK_SAMPLE_COUNT_64_BIT = 64, VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkSampleCountFlagBits = enum_VkSampleCountFlagBits; pub const VkSampleCountFlags = VkFlags; pub const VK_QUEUE_GRAPHICS_BIT = 1; pub const VK_QUEUE_COMPUTE_BIT = 2; pub const VK_QUEUE_TRANSFER_BIT = 4; pub const VK_QUEUE_SPARSE_BINDING_BIT = 8; pub const VK_QUEUE_PROTECTED_BIT = 16; pub const enum_VkQueueFlagBits = c_int; pub const VkQueueFlagBits = enum_VkQueueFlagBits; pub const VkQueueFlags = VkFlags; pub const VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; pub const VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; pub const VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; pub const VK_MEMORY_PROPERTY_HOST_CACHED_BIT = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_HOST_CACHED_BIT; pub const VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT; pub const VK_MEMORY_PROPERTY_PROTECTED_BIT = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_PROTECTED_BIT; pub const VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = enum_VkMemoryPropertyFlagBits.VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM; pub const enum_VkMemoryPropertyFlagBits = extern enum { VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 1, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 2, VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 4, VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 8, VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 16, VK_MEMORY_PROPERTY_PROTECTED_BIT = 32, VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkMemoryPropertyFlagBits = enum_VkMemoryPropertyFlagBits; pub const VkMemoryPropertyFlags = VkFlags; pub const VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = enum_VkMemoryHeapFlagBits.VK_MEMORY_HEAP_DEVICE_LOCAL_BIT; pub const VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = enum_VkMemoryHeapFlagBits.VK_MEMORY_HEAP_MULTI_INSTANCE_BIT; pub const VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR = enum_VkMemoryHeapFlagBits.VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR; pub const VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = enum_VkMemoryHeapFlagBits.VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM; pub const enum_VkMemoryHeapFlagBits = extern enum { VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 1, VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 2, VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR = 2, VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkMemoryHeapFlagBits = enum_VkMemoryHeapFlagBits; pub const VkMemoryHeapFlags = VkFlags; pub const VkDeviceCreateFlags = VkFlags; pub const VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = enum_VkDeviceQueueCreateFlagBits.VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT; pub const VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = enum_VkDeviceQueueCreateFlagBits.VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkDeviceQueueCreateFlagBits = extern enum { VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 1, VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkDeviceQueueCreateFlagBits = enum_VkDeviceQueueCreateFlagBits; pub const VkDeviceQueueCreateFlags = VkFlags; pub const VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 1; pub const VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 2; pub const VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 4; pub const VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 8; pub const VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 16; pub const VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 32; pub const VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 64; pub const VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 128; pub const VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 256; pub const VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 512; pub const VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 1024; pub const VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 2048; pub const VK_PIPELINE_STAGE_TRANSFER_BIT = 4096; pub const VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 8192; pub const VK_PIPELINE_STAGE_HOST_BIT = 16384; pub const VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 32768; pub const VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 65536; pub const VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX = 131072; pub const enum_VkPipelineStageFlagBits = c_int; pub const VkPipelineStageFlagBits = enum_VkPipelineStageFlagBits; pub const VkPipelineStageFlags = VkFlags; pub const VkMemoryMapFlags = VkFlags; pub const VK_IMAGE_ASPECT_COLOR_BIT = 1; pub const VK_IMAGE_ASPECT_DEPTH_BIT = 2; pub const VK_IMAGE_ASPECT_STENCIL_BIT = 4; pub const VK_IMAGE_ASPECT_METADATA_BIT = 8; pub const VK_IMAGE_ASPECT_PLANE_0_BIT = 16; pub const VK_IMAGE_ASPECT_PLANE_1_BIT = 32; pub const VK_IMAGE_ASPECT_PLANE_2_BIT = 64; pub const VK_IMAGE_ASPECT_PLANE_0_BIT_KHR = enum_VkImageAspectFlagBits.VK_IMAGE_ASPECT_PLANE_0_BIT_KHR; pub const VK_IMAGE_ASPECT_PLANE_1_BIT_KHR = enum_VkImageAspectFlagBits.VK_IMAGE_ASPECT_PLANE_1_BIT_KHR; pub const VK_IMAGE_ASPECT_PLANE_2_BIT_KHR = enum_VkImageAspectFlagBits.VK_IMAGE_ASPECT_PLANE_2_BIT_KHR; pub const VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = enum_VkImageAspectFlagBits.VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM; pub const enum_VkImageAspectFlagBits = c_int; pub const VkImageAspectFlagBits = enum_VkImageAspectFlagBits; pub const VkImageAspectFlags = VkFlags; pub const VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = enum_VkSparseImageFormatFlagBits.VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT; pub const VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = enum_VkSparseImageFormatFlagBits.VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT; pub const VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = enum_VkSparseImageFormatFlagBits.VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT; pub const VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = enum_VkSparseImageFormatFlagBits.VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM; pub const enum_VkSparseImageFormatFlagBits = extern enum { VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 1, VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 2, VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 4, VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkSparseImageFormatFlagBits = enum_VkSparseImageFormatFlagBits; pub const VkSparseImageFormatFlags = VkFlags; pub const VK_SPARSE_MEMORY_BIND_METADATA_BIT = enum_VkSparseMemoryBindFlagBits.VK_SPARSE_MEMORY_BIND_METADATA_BIT; pub const VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = enum_VkSparseMemoryBindFlagBits.VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM; pub const enum_VkSparseMemoryBindFlagBits = extern enum { VK_SPARSE_MEMORY_BIND_METADATA_BIT = 1, VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkSparseMemoryBindFlagBits = enum_VkSparseMemoryBindFlagBits; pub const VkSparseMemoryBindFlags = VkFlags; pub const VK_FENCE_CREATE_SIGNALED_BIT = 1; pub const enum_VkFenceCreateFlagBits = c_int; pub const VkFenceCreateFlagBits = enum_VkFenceCreateFlagBits; pub const VkFenceCreateFlags = VkFlags; pub const VkSemaphoreCreateFlags = VkFlags; pub const VkEventCreateFlags = VkFlags; pub const VkQueryPoolCreateFlags = VkFlags; pub const VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT; pub const VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = enum_VkQueryPipelineStatisticFlagBits.VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM; pub const enum_VkQueryPipelineStatisticFlagBits = extern enum { VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 1, VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 2, VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 4, VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 8, VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 16, VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 32, VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 64, VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 128, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 256, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 512, VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 1024, VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkQueryPipelineStatisticFlagBits = enum_VkQueryPipelineStatisticFlagBits; pub const VkQueryPipelineStatisticFlags = VkFlags; pub const VK_QUERY_RESULT_64_BIT = enum_VkQueryResultFlagBits.VK_QUERY_RESULT_64_BIT; pub const VK_QUERY_RESULT_WAIT_BIT = enum_VkQueryResultFlagBits.VK_QUERY_RESULT_WAIT_BIT; pub const VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = enum_VkQueryResultFlagBits.VK_QUERY_RESULT_WITH_AVAILABILITY_BIT; pub const VK_QUERY_RESULT_PARTIAL_BIT = enum_VkQueryResultFlagBits.VK_QUERY_RESULT_PARTIAL_BIT; pub const VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = enum_VkQueryResultFlagBits.VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM; pub const enum_VkQueryResultFlagBits = extern enum { VK_QUERY_RESULT_64_BIT = 1, VK_QUERY_RESULT_WAIT_BIT = 2, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 4, VK_QUERY_RESULT_PARTIAL_BIT = 8, VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkQueryResultFlagBits = enum_VkQueryResultFlagBits; pub const VkQueryResultFlags = VkFlags; pub const VK_BUFFER_CREATE_SPARSE_BINDING_BIT = enum_VkBufferCreateFlagBits.VK_BUFFER_CREATE_SPARSE_BINDING_BIT; pub const VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = enum_VkBufferCreateFlagBits.VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT; pub const VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = enum_VkBufferCreateFlagBits.VK_BUFFER_CREATE_SPARSE_ALIASED_BIT; pub const VK_BUFFER_CREATE_PROTECTED_BIT = enum_VkBufferCreateFlagBits.VK_BUFFER_CREATE_PROTECTED_BIT; pub const VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = enum_VkBufferCreateFlagBits.VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkBufferCreateFlagBits = extern enum { VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 1, VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 2, VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 4, VK_BUFFER_CREATE_PROTECTED_BIT = 8, VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkBufferCreateFlagBits = enum_VkBufferCreateFlagBits; pub const VkBufferCreateFlags = VkFlags; pub const VK_BUFFER_USAGE_TRANSFER_SRC_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_TRANSFER_SRC_BIT; pub const VK_BUFFER_USAGE_TRANSFER_DST_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_TRANSFER_DST_BIT; pub const VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT; pub const VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT; pub const VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; pub const VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; pub const VK_BUFFER_USAGE_INDEX_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_INDEX_BUFFER_BIT; pub const VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; pub const VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; pub const VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = enum_VkBufferUsageFlagBits.VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM; pub const enum_VkBufferUsageFlagBits = extern enum { VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 1, VK_BUFFER_USAGE_TRANSFER_DST_BIT = 2, VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 4, VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 8, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 16, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 32, VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 64, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 128, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 256, VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkBufferUsageFlagBits = enum_VkBufferUsageFlagBits; pub const VkBufferUsageFlags = VkFlags; pub const VkBufferViewCreateFlags = VkFlags; pub const VkImageViewCreateFlags = VkFlags; pub const VkShaderModuleCreateFlags = VkFlags; pub const VkPipelineCacheCreateFlags = VkFlags; pub const VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT; pub const VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT; pub const VK_PIPELINE_CREATE_DERIVATIVE_BIT = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_DERIVATIVE_BIT; pub const VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT; pub const VK_PIPELINE_CREATE_DISPATCH_BASE = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_DISPATCH_BASE; pub const VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR; pub const VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_DISPATCH_BASE_KHR; pub const VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = enum_VkPipelineCreateFlagBits.VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkPipelineCreateFlagBits = extern enum { VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 1, VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 2, VK_PIPELINE_CREATE_DERIVATIVE_BIT = 4, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 8, VK_PIPELINE_CREATE_DISPATCH_BASE = 16, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = 8, VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = 16, VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkPipelineCreateFlagBits = enum_VkPipelineCreateFlagBits; pub const VkPipelineCreateFlags = VkFlags; pub const VkPipelineShaderStageCreateFlags = VkFlags; pub const VK_SHADER_STAGE_VERTEX_BIT = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_VERTEX_BIT; pub const VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; pub const VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; pub const VK_SHADER_STAGE_GEOMETRY_BIT = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_GEOMETRY_BIT; pub const VK_SHADER_STAGE_FRAGMENT_BIT = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_FRAGMENT_BIT; pub const VK_SHADER_STAGE_COMPUTE_BIT = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_COMPUTE_BIT; pub const VK_SHADER_STAGE_ALL_GRAPHICS = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_ALL_GRAPHICS; pub const VK_SHADER_STAGE_ALL = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_ALL; pub const VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = enum_VkShaderStageFlagBits.VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM; pub const enum_VkShaderStageFlagBits = extern enum { VK_SHADER_STAGE_VERTEX_BIT = 1, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 2, VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 4, VK_SHADER_STAGE_GEOMETRY_BIT = 8, VK_SHADER_STAGE_FRAGMENT_BIT = 16, VK_SHADER_STAGE_COMPUTE_BIT = 32, VK_SHADER_STAGE_ALL_GRAPHICS = 31, VK_SHADER_STAGE_ALL = 2147483647, }; pub const VkShaderStageFlagBits = enum_VkShaderStageFlagBits; pub const VkPipelineVertexInputStateCreateFlags = VkFlags; pub const VkPipelineInputAssemblyStateCreateFlags = VkFlags; pub const VkPipelineTessellationStateCreateFlags = VkFlags; pub const VkPipelineViewportStateCreateFlags = VkFlags; pub const VkPipelineRasterizationStateCreateFlags = VkFlags; pub const VK_CULL_MODE_NONE = enum_VkCullModeFlagBits.VK_CULL_MODE_NONE; pub const VK_CULL_MODE_FRONT_BIT = enum_VkCullModeFlagBits.VK_CULL_MODE_FRONT_BIT; pub const VK_CULL_MODE_BACK_BIT = enum_VkCullModeFlagBits.VK_CULL_MODE_BACK_BIT; pub const VK_CULL_MODE_FRONT_AND_BACK = enum_VkCullModeFlagBits.VK_CULL_MODE_FRONT_AND_BACK; pub const VK_CULL_MODE_FLAG_BITS_MAX_ENUM = enum_VkCullModeFlagBits.VK_CULL_MODE_FLAG_BITS_MAX_ENUM; pub const enum_VkCullModeFlagBits = extern enum { VK_CULL_MODE_NONE = 0, VK_CULL_MODE_FRONT_BIT = 1, VK_CULL_MODE_BACK_BIT = 2, VK_CULL_MODE_FRONT_AND_BACK = 3, VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkCullModeFlagBits = enum_VkCullModeFlagBits; pub const VkCullModeFlags = VkFlags; pub const VkPipelineMultisampleStateCreateFlags = VkFlags; pub const VkPipelineDepthStencilStateCreateFlags = VkFlags; pub const VkPipelineColorBlendStateCreateFlags = VkFlags; pub const VK_COLOR_COMPONENT_R_BIT = 1; pub const VK_COLOR_COMPONENT_G_BIT = 2; pub const VK_COLOR_COMPONENT_B_BIT = 4; pub const VK_COLOR_COMPONENT_A_BIT = 8; pub const VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = enum_VkColorComponentFlagBits.VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM; pub const enum_VkColorComponentFlagBits = c_int; pub const VkColorComponentFlagBits = enum_VkColorComponentFlagBits; pub const VkColorComponentFlags = VkFlags; pub const VkPipelineDynamicStateCreateFlags = VkFlags; pub const VkPipelineLayoutCreateFlags = VkFlags; pub const VkShaderStageFlags = VkFlags; pub const VkSamplerCreateFlags = VkFlags; pub const VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = enum_VkDescriptorSetLayoutCreateFlagBits.VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR; pub const VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = enum_VkDescriptorSetLayoutCreateFlagBits.VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT; pub const VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = enum_VkDescriptorSetLayoutCreateFlagBits.VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkDescriptorSetLayoutCreateFlagBits = extern enum { VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 1, VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = 2, VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkDescriptorSetLayoutCreateFlagBits = enum_VkDescriptorSetLayoutCreateFlagBits; pub const VkDescriptorSetLayoutCreateFlags = VkFlags; pub const VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = enum_VkDescriptorPoolCreateFlagBits.VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT; pub const VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = enum_VkDescriptorPoolCreateFlagBits.VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT; pub const VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = enum_VkDescriptorPoolCreateFlagBits.VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkDescriptorPoolCreateFlagBits = extern enum { VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 1, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = 2, VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkDescriptorPoolCreateFlagBits = enum_VkDescriptorPoolCreateFlagBits; pub const VkDescriptorPoolCreateFlags = VkFlags; pub const VkDescriptorPoolResetFlags = VkFlags; pub const VkFramebufferCreateFlags = VkFlags; pub const VkRenderPassCreateFlags = VkFlags; pub const VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = enum_VkAttachmentDescriptionFlagBits.VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT; pub const VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = enum_VkAttachmentDescriptionFlagBits.VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM; pub const enum_VkAttachmentDescriptionFlagBits = extern enum { VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 1, VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkAttachmentDescriptionFlagBits = enum_VkAttachmentDescriptionFlagBits; pub const VkAttachmentDescriptionFlags = VkFlags; pub const VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = enum_VkSubpassDescriptionFlagBits.VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX; pub const VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = enum_VkSubpassDescriptionFlagBits.VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX; pub const VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = enum_VkSubpassDescriptionFlagBits.VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM; pub const enum_VkSubpassDescriptionFlagBits = extern enum { VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = 1, VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = 2, VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkSubpassDescriptionFlagBits = enum_VkSubpassDescriptionFlagBits; pub const VkSubpassDescriptionFlags = VkFlags; pub const VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 1; pub const VK_ACCESS_INDEX_READ_BIT = 2; pub const VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 4; pub const VK_ACCESS_UNIFORM_READ_BIT = 8; pub const VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 16; pub const VK_ACCESS_SHADER_READ_BIT = 32; pub const VK_ACCESS_SHADER_WRITE_BIT = 64; pub const VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 128; pub const VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 256; pub const VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 512; pub const VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 1024; pub const VK_ACCESS_TRANSFER_READ_BIT = 2048; pub const VK_ACCESS_TRANSFER_WRITE_BIT = 4096; pub const VK_ACCESS_HOST_READ_BIT = 8192; pub const VK_ACCESS_HOST_WRITE_BIT = 16384; pub const VK_ACCESS_MEMORY_READ_BIT = 32768; pub const VK_ACCESS_MEMORY_WRITE_BIT = 65536; pub const VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 131072; pub const VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 262144; pub const VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 524288; pub const enum_VkAccessFlagBits = c_int; pub const VkAccessFlagBits = enum_VkAccessFlagBits; pub const VkAccessFlags = VkFlags; pub const VK_DEPENDENCY_BY_REGION_BIT = enum_VkDependencyFlagBits.VK_DEPENDENCY_BY_REGION_BIT; pub const VK_DEPENDENCY_DEVICE_GROUP_BIT = enum_VkDependencyFlagBits.VK_DEPENDENCY_DEVICE_GROUP_BIT; pub const VK_DEPENDENCY_VIEW_LOCAL_BIT = enum_VkDependencyFlagBits.VK_DEPENDENCY_VIEW_LOCAL_BIT; pub const VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR = enum_VkDependencyFlagBits.VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR; pub const VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR = enum_VkDependencyFlagBits.VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR; pub const VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = enum_VkDependencyFlagBits.VK_DEPENDENCY_FLAG_BITS_MAX_ENUM; pub const enum_VkDependencyFlagBits = extern enum { VK_DEPENDENCY_BY_REGION_BIT = 1, VK_DEPENDENCY_DEVICE_GROUP_BIT = 4, VK_DEPENDENCY_VIEW_LOCAL_BIT = 2, VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR = 2, VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR = 4, VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkDependencyFlagBits = enum_VkDependencyFlagBits; pub const VkDependencyFlags = VkFlags; pub const VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = enum_VkCommandPoolCreateFlagBits.VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; pub const VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = enum_VkCommandPoolCreateFlagBits.VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; pub const VK_COMMAND_POOL_CREATE_PROTECTED_BIT = enum_VkCommandPoolCreateFlagBits.VK_COMMAND_POOL_CREATE_PROTECTED_BIT; pub const VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = enum_VkCommandPoolCreateFlagBits.VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM; pub const enum_VkCommandPoolCreateFlagBits = extern enum { VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 1, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 2, VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 4, VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkCommandPoolCreateFlagBits = enum_VkCommandPoolCreateFlagBits; pub const VkCommandPoolCreateFlags = VkFlags; pub const VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = enum_VkCommandPoolResetFlagBits.VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT; pub const VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = enum_VkCommandPoolResetFlagBits.VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM; pub const enum_VkCommandPoolResetFlagBits = extern enum { VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 1, VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkCommandPoolResetFlagBits = enum_VkCommandPoolResetFlagBits; pub const VkCommandPoolResetFlags = VkFlags; pub const VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 1; pub const VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 2; pub const VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 4; pub const enum_VkCommandBufferUsageFlagBits = c_int; pub const VkCommandBufferUsageFlagBits = enum_VkCommandBufferUsageFlagBits; pub const VkCommandBufferUsageFlags = VkFlags; pub const VK_QUERY_CONTROL_PRECISE_BIT = enum_VkQueryControlFlagBits.VK_QUERY_CONTROL_PRECISE_BIT; pub const VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = enum_VkQueryControlFlagBits.VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM; pub const enum_VkQueryControlFlagBits = extern enum { VK_QUERY_CONTROL_PRECISE_BIT = 1, VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkQueryControlFlagBits = enum_VkQueryControlFlagBits; pub const VkQueryControlFlags = VkFlags; pub const VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = enum_VkCommandBufferResetFlagBits.VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT; pub const VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = enum_VkCommandBufferResetFlagBits.VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM; pub const enum_VkCommandBufferResetFlagBits = extern enum { VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 1, VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkCommandBufferResetFlagBits = enum_VkCommandBufferResetFlagBits; pub const VkCommandBufferResetFlags = VkFlags; pub const VK_STENCIL_FACE_FRONT_BIT = enum_VkStencilFaceFlagBits.VK_STENCIL_FACE_FRONT_BIT; pub const VK_STENCIL_FACE_BACK_BIT = enum_VkStencilFaceFlagBits.VK_STENCIL_FACE_BACK_BIT; pub const VK_STENCIL_FRONT_AND_BACK = enum_VkStencilFaceFlagBits.VK_STENCIL_FRONT_AND_BACK; pub const VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = enum_VkStencilFaceFlagBits.VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM; pub const enum_VkStencilFaceFlagBits = extern enum { VK_STENCIL_FACE_FRONT_BIT = 1, VK_STENCIL_FACE_BACK_BIT = 2, VK_STENCIL_FRONT_AND_BACK = 3, VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkStencilFaceFlagBits = enum_VkStencilFaceFlagBits; pub const VkStencilFaceFlags = VkFlags; pub const struct_VkApplicationInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, pApplicationName: ?[*]const u8, applicationVersion: u32, pEngineName: ?[*]const u8, engineVersion: u32, apiVersion: u32, }; pub const VkApplicationInfo = struct_VkApplicationInfo; pub const struct_VkInstanceCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkInstanceCreateFlags, pApplicationInfo: *const VkApplicationInfo, enabledLayerCount: u32, ppEnabledLayerNames: ?[*]const (?[*]const u8), enabledExtensionCount: u32, ppEnabledExtensionNames: ?[*]const (?[*]const u8), }; pub const VkInstanceCreateInfo = struct_VkInstanceCreateInfo; pub const PFN_vkAllocationFunction = ?fn (?*c_void, usize, usize, VkSystemAllocationScope) callconv(.C) ?*c_void; pub const PFN_vkReallocationFunction = ?fn (?*c_void, ?*c_void, usize, usize, VkSystemAllocationScope) callconv(.C) ?*c_void; pub const PFN_vkFreeFunction = ?fn (?*c_void, ?*c_void) callconv(.C) void; pub const PFN_vkInternalAllocationNotification = ?fn (?*c_void, usize, VkInternalAllocationType, VkSystemAllocationScope) callconv(.C) void; pub const PFN_vkInternalFreeNotification = ?fn (?*c_void, usize, VkInternalAllocationType, VkSystemAllocationScope) callconv(.C) void; pub const struct_VkAllocationCallbacks = extern struct { pUserData: ?*c_void, pfnAllocation: PFN_vkAllocationFunction, pfnReallocation: PFN_vkReallocationFunction, pfnFree: PFN_vkFreeFunction, pfnInternalAllocation: PFN_vkInternalAllocationNotification, pfnInternalFree: PFN_vkInternalFreeNotification, }; pub const VkAllocationCallbacks = struct_VkAllocationCallbacks; pub const struct_VkPhysicalDeviceFeatures = extern struct { robustBufferAccess: VkBool32, fullDrawIndexUint32: VkBool32, imageCubeArray: VkBool32, independentBlend: VkBool32, geometryShader: VkBool32, tessellationShader: VkBool32, sampleRateShading: VkBool32, dualSrcBlend: VkBool32, logicOp: VkBool32, multiDrawIndirect: VkBool32, drawIndirectFirstInstance: VkBool32, depthClamp: VkBool32, depthBiasClamp: VkBool32, fillModeNonSolid: VkBool32, depthBounds: VkBool32, wideLines: VkBool32, largePoints: VkBool32, alphaToOne: VkBool32, multiViewport: VkBool32, samplerAnisotropy: VkBool32, textureCompressionETC2: VkBool32, textureCompressionASTC_LDR: VkBool32, textureCompressionBC: VkBool32, occlusionQueryPrecise: VkBool32, pipelineStatisticsQuery: VkBool32, vertexPipelineStoresAndAtomics: VkBool32, fragmentStoresAndAtomics: VkBool32, shaderTessellationAndGeometryPointSize: VkBool32, shaderImageGatherExtended: VkBool32, shaderStorageImageExtendedFormats: VkBool32, shaderStorageImageMultisample: VkBool32, shaderStorageImageReadWithoutFormat: VkBool32, shaderStorageImageWriteWithoutFormat: VkBool32, shaderUniformBufferArrayDynamicIndexing: VkBool32, shaderSampledImageArrayDynamicIndexing: VkBool32, shaderStorageBufferArrayDynamicIndexing: VkBool32, shaderStorageImageArrayDynamicIndexing: VkBool32, shaderClipDistance: VkBool32, shaderCullDistance: VkBool32, shaderFloat64: VkBool32, shaderInt64: VkBool32, shaderInt16: VkBool32, shaderResourceResidency: VkBool32, shaderResourceMinLod: VkBool32, sparseBinding: VkBool32, sparseResidencyBuffer: VkBool32, sparseResidencyImage2D: VkBool32, sparseResidencyImage3D: VkBool32, sparseResidency2Samples: VkBool32, sparseResidency4Samples: VkBool32, sparseResidency8Samples: VkBool32, sparseResidency16Samples: VkBool32, sparseResidencyAliased: VkBool32, variableMultisampleRate: VkBool32, inheritedQueries: VkBool32, }; pub const VkPhysicalDeviceFeatures = struct_VkPhysicalDeviceFeatures; pub const struct_VkFormatProperties = extern struct { linearTilingFeatures: VkFormatFeatureFlags, optimalTilingFeatures: VkFormatFeatureFlags, bufferFeatures: VkFormatFeatureFlags, }; pub const VkFormatProperties = struct_VkFormatProperties; pub const struct_VkExtent3D = extern struct { width: u32, height: u32, depth: u32, }; pub const VkExtent3D = struct_VkExtent3D; pub const struct_VkImageFormatProperties = extern struct { maxExtent: VkExtent3D, maxMipLevels: u32, maxArrayLayers: u32, sampleCounts: VkSampleCountFlags, maxResourceSize: VkDeviceSize, }; pub const VkImageFormatProperties = struct_VkImageFormatProperties; pub const struct_VkPhysicalDeviceLimits = extern struct { maxImageDimension1D: u32, maxImageDimension2D: u32, maxImageDimension3D: u32, maxImageDimensionCube: u32, maxImageArrayLayers: u32, maxTexelBufferElements: u32, maxUniformBufferRange: u32, maxStorageBufferRange: u32, maxPushConstantsSize: u32, maxMemoryAllocationCount: u32, maxSamplerAllocationCount: u32, bufferImageGranularity: VkDeviceSize, sparseAddressSpaceSize: VkDeviceSize, maxBoundDescriptorSets: u32, maxPerStageDescriptorSamplers: u32, maxPerStageDescriptorUniformBuffers: u32, maxPerStageDescriptorStorageBuffers: u32, maxPerStageDescriptorSampledImages: u32, maxPerStageDescriptorStorageImages: u32, maxPerStageDescriptorInputAttachments: u32, maxPerStageResources: u32, maxDescriptorSetSamplers: u32, maxDescriptorSetUniformBuffers: u32, maxDescriptorSetUniformBuffersDynamic: u32, maxDescriptorSetStorageBuffers: u32, maxDescriptorSetStorageBuffersDynamic: u32, maxDescriptorSetSampledImages: u32, maxDescriptorSetStorageImages: u32, maxDescriptorSetInputAttachments: u32, maxVertexInputAttributes: u32, maxVertexInputBindings: u32, maxVertexInputAttributeOffset: u32, maxVertexInputBindingStride: u32, maxVertexOutputComponents: u32, maxTessellationGenerationLevel: u32, maxTessellationPatchSize: u32, maxTessellationControlPerVertexInputComponents: u32, maxTessellationControlPerVertexOutputComponents: u32, maxTessellationControlPerPatchOutputComponents: u32, maxTessellationControlTotalOutputComponents: u32, maxTessellationEvaluationInputComponents: u32, maxTessellationEvaluationOutputComponents: u32, maxGeometryShaderInvocations: u32, maxGeometryInputComponents: u32, maxGeometryOutputComponents: u32, maxGeometryOutputVertices: u32, maxGeometryTotalOutputComponents: u32, maxFragmentInputComponents: u32, maxFragmentOutputAttachments: u32, maxFragmentDualSrcAttachments: u32, maxFragmentCombinedOutputResources: u32, maxComputeSharedMemorySize: u32, maxComputeWorkGroupCount: [3]u32, maxComputeWorkGroupInvocations: u32, maxComputeWorkGroupSize: [3]u32, subPixelPrecisionBits: u32, subTexelPrecisionBits: u32, mipmapPrecisionBits: u32, maxDrawIndexedIndexValue: u32, maxDrawIndirectCount: u32, maxSamplerLodBias: f32, maxSamplerAnisotropy: f32, maxViewports: u32, maxViewportDimensions: [2]u32, viewportBoundsRange: [2]f32, viewportSubPixelBits: u32, minMemoryMapAlignment: usize, minTexelBufferOffsetAlignment: VkDeviceSize, minUniformBufferOffsetAlignment: VkDeviceSize, minStorageBufferOffsetAlignment: VkDeviceSize, minTexelOffset: i32, maxTexelOffset: u32, minTexelGatherOffset: i32, maxTexelGatherOffset: u32, minInterpolationOffset: f32, maxInterpolationOffset: f32, subPixelInterpolationOffsetBits: u32, maxFramebufferWidth: u32, maxFramebufferHeight: u32, maxFramebufferLayers: u32, framebufferColorSampleCounts: VkSampleCountFlags, framebufferDepthSampleCounts: VkSampleCountFlags, framebufferStencilSampleCounts: VkSampleCountFlags, framebufferNoAttachmentsSampleCounts: VkSampleCountFlags, maxColorAttachments: u32, sampledImageColorSampleCounts: VkSampleCountFlags, sampledImageIntegerSampleCounts: VkSampleCountFlags, sampledImageDepthSampleCounts: VkSampleCountFlags, sampledImageStencilSampleCounts: VkSampleCountFlags, storageImageSampleCounts: VkSampleCountFlags, maxSampleMaskWords: u32, timestampComputeAndGraphics: VkBool32, timestampPeriod: f32, maxClipDistances: u32, maxCullDistances: u32, maxCombinedClipAndCullDistances: u32, discreteQueuePriorities: u32, pointSizeRange: [2]f32, lineWidthRange: [2]f32, pointSizeGranularity: f32, lineWidthGranularity: f32, strictLines: VkBool32, standardSampleLocations: VkBool32, optimalBufferCopyOffsetAlignment: VkDeviceSize, optimalBufferCopyRowPitchAlignment: VkDeviceSize, nonCoherentAtomSize: VkDeviceSize, }; pub const VkPhysicalDeviceLimits = struct_VkPhysicalDeviceLimits; pub const struct_VkPhysicalDeviceSparseProperties = extern struct { residencyStandard2DBlockShape: VkBool32, residencyStandard2DMultisampleBlockShape: VkBool32, residencyStandard3DBlockShape: VkBool32, residencyAlignedMipSize: VkBool32, residencyNonResidentStrict: VkBool32, }; pub const VkPhysicalDeviceSparseProperties = struct_VkPhysicalDeviceSparseProperties; pub const struct_VkPhysicalDeviceProperties = extern struct { apiVersion: u32, driverVersion: u32, vendorID: u32, deviceID: u32, deviceType: VkPhysicalDeviceType, deviceName: [256]u8, pipelineCacheUUID: [16]u8, limits: VkPhysicalDeviceLimits, sparseProperties: VkPhysicalDeviceSparseProperties, }; pub const VkPhysicalDeviceProperties = struct_VkPhysicalDeviceProperties; pub const struct_VkQueueFamilyProperties = extern struct { queueFlags: VkQueueFlags, queueCount: u32, timestampValidBits: u32, minImageTransferGranularity: VkExtent3D, }; pub const VkQueueFamilyProperties = struct_VkQueueFamilyProperties; pub const struct_VkMemoryType = extern struct { propertyFlags: VkMemoryPropertyFlags, heapIndex: u32, }; pub const VkMemoryType = struct_VkMemoryType; pub const struct_VkMemoryHeap = extern struct { size: VkDeviceSize, flags: VkMemoryHeapFlags, }; pub const VkMemoryHeap = struct_VkMemoryHeap; pub const struct_VkPhysicalDeviceMemoryProperties = extern struct { memoryTypeCount: u32, memoryTypes: [32]VkMemoryType, memoryHeapCount: u32, memoryHeaps: [16]VkMemoryHeap, }; pub const VkPhysicalDeviceMemoryProperties = struct_VkPhysicalDeviceMemoryProperties; pub const PFN_vkVoidFunction = ?fn () callconv(.C) void; pub const struct_VkDeviceQueueCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDeviceQueueCreateFlags, queueFamilyIndex: u32, queueCount: u32, pQueuePriorities: *const f32, }; pub const VkDeviceQueueCreateInfo = struct_VkDeviceQueueCreateInfo; pub const struct_VkDeviceCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDeviceCreateFlags, queueCreateInfoCount: u32, pQueueCreateInfos: ?[*]const VkDeviceQueueCreateInfo, enabledLayerCount: u32, ppEnabledLayerNames: ?[*]const (?[*]const u8), enabledExtensionCount: u32, ppEnabledExtensionNames: ?[*]const (?[*]const u8), pEnabledFeatures: *const VkPhysicalDeviceFeatures, }; pub const VkDeviceCreateInfo = struct_VkDeviceCreateInfo; pub const struct_VkExtensionProperties = extern struct { extensionName: [256]u8, specVersion: u32, }; pub const VkExtensionProperties = struct_VkExtensionProperties; pub const struct_VkLayerProperties = extern struct { layerName: [256]u8, specVersion: u32, implementationVersion: u32, description: [256]u8, }; pub const VkLayerProperties = struct_VkLayerProperties; pub const struct_VkSubmitInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, waitSemaphoreCount: u32, pWaitSemaphores: ?[*]const VkSemaphore, pWaitDstStageMask: ?[*]const VkPipelineStageFlags, commandBufferCount: u32, pCommandBuffers: ?[*]const VkCommandBuffer, signalSemaphoreCount: u32, pSignalSemaphores: ?[*]const VkSemaphore, }; pub const VkSubmitInfo = struct_VkSubmitInfo; pub const struct_VkMemoryAllocateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, allocationSize: VkDeviceSize, memoryTypeIndex: u32, }; pub const VkMemoryAllocateInfo = struct_VkMemoryAllocateInfo; pub const struct_VkMappedMemoryRange = extern struct { sType: VkStructureType, pNext: ?*const c_void, memory: VkDeviceMemory, offset: VkDeviceSize, size: VkDeviceSize, }; pub const VkMappedMemoryRange = struct_VkMappedMemoryRange; pub const struct_VkMemoryRequirements = extern struct { size: VkDeviceSize, alignment: VkDeviceSize, memoryTypeBits: u32, }; pub const VkMemoryRequirements = struct_VkMemoryRequirements; pub const struct_VkSparseImageFormatProperties = extern struct { aspectMask: VkImageAspectFlags, imageGranularity: VkExtent3D, flags: VkSparseImageFormatFlags, }; pub const VkSparseImageFormatProperties = struct_VkSparseImageFormatProperties; pub const struct_VkSparseImageMemoryRequirements = extern struct { formatProperties: VkSparseImageFormatProperties, imageMipTailFirstLod: u32, imageMipTailSize: VkDeviceSize, imageMipTailOffset: VkDeviceSize, imageMipTailStride: VkDeviceSize, }; pub const VkSparseImageMemoryRequirements = struct_VkSparseImageMemoryRequirements; pub const struct_VkSparseMemoryBind = extern struct { resourceOffset: VkDeviceSize, size: VkDeviceSize, memory: VkDeviceMemory, memoryOffset: VkDeviceSize, flags: VkSparseMemoryBindFlags, }; pub const VkSparseMemoryBind = struct_VkSparseMemoryBind; pub const struct_VkSparseBufferMemoryBindInfo = extern struct { buffer: VkBuffer, bindCount: u32, pBinds: ?[*]const VkSparseMemoryBind, }; pub const VkSparseBufferMemoryBindInfo = struct_VkSparseBufferMemoryBindInfo; pub const struct_VkSparseImageOpaqueMemoryBindInfo = extern struct { image: VkImage, bindCount: u32, pBinds: ?[*]const VkSparseMemoryBind, }; pub const VkSparseImageOpaqueMemoryBindInfo = struct_VkSparseImageOpaqueMemoryBindInfo; pub const struct_VkImageSubresource = extern struct { aspectMask: VkImageAspectFlags, mipLevel: u32, arrayLayer: u32, }; pub const VkImageSubresource = struct_VkImageSubresource; pub const struct_VkOffset3D = extern struct { x: i32, y: i32, z: i32, }; pub const VkOffset3D = struct_VkOffset3D; pub const struct_VkSparseImageMemoryBind = extern struct { subresource: VkImageSubresource, offset: VkOffset3D, extent: VkExtent3D, memory: VkDeviceMemory, memoryOffset: VkDeviceSize, flags: VkSparseMemoryBindFlags, }; pub const VkSparseImageMemoryBind = struct_VkSparseImageMemoryBind; pub const struct_VkSparseImageMemoryBindInfo = extern struct { image: VkImage, bindCount: u32, pBinds: ?[*]const VkSparseImageMemoryBind, }; pub const VkSparseImageMemoryBindInfo = struct_VkSparseImageMemoryBindInfo; pub const struct_VkBindSparseInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, waitSemaphoreCount: u32, pWaitSemaphores: ?[*]const VkSemaphore, bufferBindCount: u32, pBufferBinds: ?[*]const VkSparseBufferMemoryBindInfo, imageOpaqueBindCount: u32, pImageOpaqueBinds: ?[*]const VkSparseImageOpaqueMemoryBindInfo, imageBindCount: u32, pImageBinds: ?[*]const VkSparseImageMemoryBindInfo, signalSemaphoreCount: u32, pSignalSemaphores: ?[*]const VkSemaphore, }; pub const VkBindSparseInfo = struct_VkBindSparseInfo; pub const struct_VkFenceCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkFenceCreateFlags, }; pub const VkFenceCreateInfo = struct_VkFenceCreateInfo; pub const struct_VkSemaphoreCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkSemaphoreCreateFlags, }; pub const VkSemaphoreCreateInfo = struct_VkSemaphoreCreateInfo; pub const struct_VkEventCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkEventCreateFlags, }; pub const VkEventCreateInfo = struct_VkEventCreateInfo; pub const struct_VkQueryPoolCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkQueryPoolCreateFlags, queryType: VkQueryType, queryCount: u32, pipelineStatistics: VkQueryPipelineStatisticFlags, }; pub const VkQueryPoolCreateInfo = struct_VkQueryPoolCreateInfo; pub const struct_VkBufferCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkBufferCreateFlags, size: VkDeviceSize, usage: VkBufferUsageFlags, sharingMode: VkSharingMode, queueFamilyIndexCount: u32, pQueueFamilyIndices: ?[*]const u32, }; pub const VkBufferCreateInfo = struct_VkBufferCreateInfo; pub const struct_VkBufferViewCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkBufferViewCreateFlags, buffer: VkBuffer, format: VkFormat, offset: VkDeviceSize, range: VkDeviceSize, }; pub const VkBufferViewCreateInfo = struct_VkBufferViewCreateInfo; pub const struct_VkImageCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkImageCreateFlags, imageType: VkImageType, format: VkFormat, extent: VkExtent3D, mipLevels: u32, arrayLayers: u32, samples: VkSampleCountFlagBits, tiling: VkImageTiling, usage: VkImageUsageFlags, sharingMode: VkSharingMode, queueFamilyIndexCount: u32, pQueueFamilyIndices: ?[*]const u32, initialLayout: VkImageLayout, }; pub const VkImageCreateInfo = struct_VkImageCreateInfo; pub const struct_VkSubresourceLayout = extern struct { offset: VkDeviceSize, size: VkDeviceSize, rowPitch: VkDeviceSize, arrayPitch: VkDeviceSize, depthPitch: VkDeviceSize, }; pub const VkSubresourceLayout = struct_VkSubresourceLayout; pub const struct_VkComponentMapping = extern struct { r: VkComponentSwizzle, g: VkComponentSwizzle, b: VkComponentSwizzle, a: VkComponentSwizzle, }; pub const VkComponentMapping = struct_VkComponentMapping; pub const struct_VkImageSubresourceRange = extern struct { aspectMask: VkImageAspectFlags, baseMipLevel: u32, levelCount: u32, baseArrayLayer: u32, layerCount: u32, }; pub const VkImageSubresourceRange = struct_VkImageSubresourceRange; pub const struct_VkImageViewCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkImageViewCreateFlags, image: VkImage, viewType: VkImageViewType, format: VkFormat, components: VkComponentMapping, subresourceRange: VkImageSubresourceRange, }; pub const VkImageViewCreateInfo = struct_VkImageViewCreateInfo; pub const struct_VkShaderModuleCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkShaderModuleCreateFlags, codeSize: usize, pCode: ?[*]const u32, }; pub const VkShaderModuleCreateInfo = struct_VkShaderModuleCreateInfo; pub const struct_VkPipelineCacheCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineCacheCreateFlags, initialDataSize: usize, pInitialData: ?*const c_void, }; pub const VkPipelineCacheCreateInfo = struct_VkPipelineCacheCreateInfo; pub const struct_VkSpecializationMapEntry = extern struct { constantID: u32, offset: u32, size: usize, }; pub const VkSpecializationMapEntry = struct_VkSpecializationMapEntry; pub const struct_VkSpecializationInfo = extern struct { mapEntryCount: u32, pMapEntries: ?[*]const VkSpecializationMapEntry, dataSize: usize, pData: ?*const c_void, }; pub const VkSpecializationInfo = struct_VkSpecializationInfo; pub const struct_VkPipelineShaderStageCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineShaderStageCreateFlags, stage: VkShaderStageFlagBits, module: VkShaderModule, pName: ?[*]const u8, pSpecializationInfo: ?[*]const VkSpecializationInfo, }; pub const VkPipelineShaderStageCreateInfo = struct_VkPipelineShaderStageCreateInfo; pub const struct_VkVertexInputBindingDescription = extern struct { binding: u32, stride: u32, inputRate: VkVertexInputRate, }; pub const VkVertexInputBindingDescription = struct_VkVertexInputBindingDescription; pub const struct_VkVertexInputAttributeDescription = extern struct { location: u32, binding: u32, format: VkFormat, offset: u32, }; pub const VkVertexInputAttributeDescription = struct_VkVertexInputAttributeDescription; pub const struct_VkPipelineVertexInputStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineVertexInputStateCreateFlags, vertexBindingDescriptionCount: u32, pVertexBindingDescriptions: ?[*]const VkVertexInputBindingDescription, vertexAttributeDescriptionCount: u32, pVertexAttributeDescriptions: ?[*]const VkVertexInputAttributeDescription, }; pub const VkPipelineVertexInputStateCreateInfo = struct_VkPipelineVertexInputStateCreateInfo; pub const struct_VkPipelineInputAssemblyStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineInputAssemblyStateCreateFlags, topology: VkPrimitiveTopology, primitiveRestartEnable: VkBool32, }; pub const VkPipelineInputAssemblyStateCreateInfo = struct_VkPipelineInputAssemblyStateCreateInfo; pub const struct_VkPipelineTessellationStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineTessellationStateCreateFlags, patchControlPoints: u32, }; pub const VkPipelineTessellationStateCreateInfo = struct_VkPipelineTessellationStateCreateInfo; pub const struct_VkViewport = extern struct { x: f32, y: f32, width: f32, height: f32, minDepth: f32, maxDepth: f32, }; pub const VkViewport = struct_VkViewport; pub const struct_VkOffset2D = extern struct { x: i32, y: i32, }; pub const VkOffset2D = struct_VkOffset2D; pub const struct_VkExtent2D = extern struct { width: u32, height: u32, }; pub const VkExtent2D = struct_VkExtent2D; pub const struct_VkRect2D = extern struct { offset: VkOffset2D, extent: VkExtent2D, }; pub const VkRect2D = struct_VkRect2D; pub const struct_VkPipelineViewportStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineViewportStateCreateFlags, viewportCount: u32, pViewports: ?[*]const VkViewport, scissorCount: u32, pScissors: ?[*]const VkRect2D, }; pub const VkPipelineViewportStateCreateInfo = struct_VkPipelineViewportStateCreateInfo; pub const struct_VkPipelineRasterizationStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineRasterizationStateCreateFlags, depthClampEnable: VkBool32, rasterizerDiscardEnable: VkBool32, polygonMode: VkPolygonMode, cullMode: VkCullModeFlags, frontFace: VkFrontFace, depthBiasEnable: VkBool32, depthBiasConstantFactor: f32, depthBiasClamp: f32, depthBiasSlopeFactor: f32, lineWidth: f32, }; pub const VkPipelineRasterizationStateCreateInfo = struct_VkPipelineRasterizationStateCreateInfo; pub const struct_VkPipelineMultisampleStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineMultisampleStateCreateFlags, rasterizationSamples: VkSampleCountFlagBits, sampleShadingEnable: VkBool32, minSampleShading: f32, pSampleMask: ?[*]const VkSampleMask, alphaToCoverageEnable: VkBool32, alphaToOneEnable: VkBool32, }; pub const VkPipelineMultisampleStateCreateInfo = struct_VkPipelineMultisampleStateCreateInfo; pub const struct_VkStencilOpState = extern struct { failOp: VkStencilOp, passOp: VkStencilOp, depthFailOp: VkStencilOp, compareOp: VkCompareOp, compareMask: u32, writeMask: u32, reference: u32, }; pub const VkStencilOpState = struct_VkStencilOpState; pub const struct_VkPipelineDepthStencilStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineDepthStencilStateCreateFlags, depthTestEnable: VkBool32, depthWriteEnable: VkBool32, depthCompareOp: VkCompareOp, depthBoundsTestEnable: VkBool32, stencilTestEnable: VkBool32, front: VkStencilOpState, back: VkStencilOpState, minDepthBounds: f32, maxDepthBounds: f32, }; pub const VkPipelineDepthStencilStateCreateInfo = struct_VkPipelineDepthStencilStateCreateInfo; pub const struct_VkPipelineColorBlendAttachmentState = extern struct { blendEnable: VkBool32, srcColorBlendFactor: VkBlendFactor, dstColorBlendFactor: VkBlendFactor, colorBlendOp: VkBlendOp, srcAlphaBlendFactor: VkBlendFactor, dstAlphaBlendFactor: VkBlendFactor, alphaBlendOp: VkBlendOp, colorWriteMask: VkColorComponentFlags, }; pub const VkPipelineColorBlendAttachmentState = struct_VkPipelineColorBlendAttachmentState; pub const struct_VkPipelineColorBlendStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineColorBlendStateCreateFlags, logicOpEnable: VkBool32, logicOp: VkLogicOp, attachmentCount: u32, pAttachments: *const VkPipelineColorBlendAttachmentState, blendConstants: [4]f32, }; pub const VkPipelineColorBlendStateCreateInfo = struct_VkPipelineColorBlendStateCreateInfo; pub const struct_VkPipelineDynamicStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineDynamicStateCreateFlags, dynamicStateCount: u32, pDynamicStates: ?[*]const VkDynamicState, }; pub const VkPipelineDynamicStateCreateInfo = struct_VkPipelineDynamicStateCreateInfo; pub const struct_VkGraphicsPipelineCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineCreateFlags, stageCount: u32, pStages: ?[*]const VkPipelineShaderStageCreateInfo, pVertexInputState: *const VkPipelineVertexInputStateCreateInfo, pInputAssemblyState: *const VkPipelineInputAssemblyStateCreateInfo, pTessellationState: ?[*]const VkPipelineTessellationStateCreateInfo, pViewportState: *const VkPipelineViewportStateCreateInfo, pRasterizationState: *const VkPipelineRasterizationStateCreateInfo, pMultisampleState: *const VkPipelineMultisampleStateCreateInfo, pDepthStencilState: ?*const VkPipelineDepthStencilStateCreateInfo, pColorBlendState: *const VkPipelineColorBlendStateCreateInfo, pDynamicState: ?*const VkPipelineDynamicStateCreateInfo, layout: VkPipelineLayout, renderPass: VkRenderPass, subpass: u32, basePipelineHandle: VkPipeline, basePipelineIndex: i32, }; pub const VkGraphicsPipelineCreateInfo = struct_VkGraphicsPipelineCreateInfo; pub const struct_VkComputePipelineCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineCreateFlags, stage: VkPipelineShaderStageCreateInfo, layout: VkPipelineLayout, basePipelineHandle: VkPipeline, basePipelineIndex: i32, }; pub const VkComputePipelineCreateInfo = struct_VkComputePipelineCreateInfo; pub const struct_VkPushConstantRange = extern struct { stageFlags: VkShaderStageFlags, offset: u32, size: u32, }; pub const VkPushConstantRange = struct_VkPushConstantRange; pub const struct_VkPipelineLayoutCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineLayoutCreateFlags, setLayoutCount: u32, pSetLayouts: ?[*]const VkDescriptorSetLayout, pushConstantRangeCount: u32, pPushConstantRanges: ?[*]const VkPushConstantRange, }; pub const VkPipelineLayoutCreateInfo = struct_VkPipelineLayoutCreateInfo; pub const struct_VkSamplerCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkSamplerCreateFlags, magFilter: VkFilter, minFilter: VkFilter, mipmapMode: VkSamplerMipmapMode, addressModeU: VkSamplerAddressMode, addressModeV: VkSamplerAddressMode, addressModeW: VkSamplerAddressMode, mipLodBias: f32, anisotropyEnable: VkBool32, maxAnisotropy: f32, compareEnable: VkBool32, compareOp: VkCompareOp, minLod: f32, maxLod: f32, borderColor: VkBorderColor, unnormalizedCoordinates: VkBool32, }; pub const VkSamplerCreateInfo = struct_VkSamplerCreateInfo; pub const struct_VkDescriptorSetLayoutBinding = extern struct { binding: u32, descriptorType: VkDescriptorType, descriptorCount: u32, stageFlags: VkShaderStageFlags, pImmutableSamplers: ?[*]const VkSampler, }; pub const VkDescriptorSetLayoutBinding = struct_VkDescriptorSetLayoutBinding; pub const struct_VkDescriptorSetLayoutCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDescriptorSetLayoutCreateFlags, bindingCount: u32, pBindings: ?[*]const VkDescriptorSetLayoutBinding, }; pub const VkDescriptorSetLayoutCreateInfo = struct_VkDescriptorSetLayoutCreateInfo; pub const struct_VkDescriptorPoolSize = extern struct { type: VkDescriptorType, descriptorCount: u32, }; pub const VkDescriptorPoolSize = struct_VkDescriptorPoolSize; pub const struct_VkDescriptorPoolCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDescriptorPoolCreateFlags, maxSets: u32, poolSizeCount: u32, pPoolSizes: ?[*]const VkDescriptorPoolSize, }; pub const VkDescriptorPoolCreateInfo = struct_VkDescriptorPoolCreateInfo; pub const struct_VkDescriptorSetAllocateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, descriptorPool: VkDescriptorPool, descriptorSetCount: u32, pSetLayouts: ?[*]const VkDescriptorSetLayout, }; pub const VkDescriptorSetAllocateInfo = struct_VkDescriptorSetAllocateInfo; pub const struct_VkDescriptorImageInfo = extern struct { sampler: VkSampler, imageView: VkImageView, imageLayout: VkImageLayout, }; pub const VkDescriptorImageInfo = struct_VkDescriptorImageInfo; pub const struct_VkDescriptorBufferInfo = extern struct { buffer: VkBuffer, offset: VkDeviceSize, range: VkDeviceSize, }; pub const VkDescriptorBufferInfo = struct_VkDescriptorBufferInfo; pub const struct_VkWriteDescriptorSet = extern struct { sType: VkStructureType, pNext: ?*const c_void, dstSet: VkDescriptorSet, dstBinding: u32, dstArrayElement: u32, descriptorCount: u32, descriptorType: VkDescriptorType, pImageInfo: ?[*]const VkDescriptorImageInfo, pBufferInfo: ?[*]const VkDescriptorBufferInfo, pTexelBufferView: ?[*]const VkBufferView, }; pub const VkWriteDescriptorSet = struct_VkWriteDescriptorSet; pub const struct_VkCopyDescriptorSet = extern struct { sType: VkStructureType, pNext: ?*const c_void, srcSet: VkDescriptorSet, srcBinding: u32, srcArrayElement: u32, dstSet: VkDescriptorSet, dstBinding: u32, dstArrayElement: u32, descriptorCount: u32, }; pub const VkCopyDescriptorSet = struct_VkCopyDescriptorSet; pub const struct_VkFramebufferCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkFramebufferCreateFlags, renderPass: VkRenderPass, attachmentCount: u32, pAttachments: ?[*]const VkImageView, width: u32, height: u32, layers: u32, }; pub const VkFramebufferCreateInfo = struct_VkFramebufferCreateInfo; pub const struct_VkAttachmentDescription = extern struct { flags: VkAttachmentDescriptionFlags, format: VkFormat, samples: VkSampleCountFlagBits, loadOp: VkAttachmentLoadOp, storeOp: VkAttachmentStoreOp, stencilLoadOp: VkAttachmentLoadOp, stencilStoreOp: VkAttachmentStoreOp, initialLayout: VkImageLayout, finalLayout: VkImageLayout, }; pub const VkAttachmentDescription = struct_VkAttachmentDescription; pub const struct_VkAttachmentReference = extern struct { attachment: u32, layout: VkImageLayout, }; pub const VkAttachmentReference = struct_VkAttachmentReference; pub const struct_VkSubpassDescription = extern struct { flags: VkSubpassDescriptionFlags, pipelineBindPoint: VkPipelineBindPoint, inputAttachmentCount: u32, pInputAttachments: ?[*]const VkAttachmentReference, colorAttachmentCount: u32, pColorAttachments: ?[*]const VkAttachmentReference, pResolveAttachments: ?[*]const VkAttachmentReference, pDepthStencilAttachment: ?[*]const VkAttachmentReference, preserveAttachmentCount: u32, pPreserveAttachments: ?[*]const u32, }; pub const VkSubpassDescription = struct_VkSubpassDescription; pub const struct_VkSubpassDependency = extern struct { srcSubpass: u32, dstSubpass: u32, srcStageMask: VkPipelineStageFlags, dstStageMask: VkPipelineStageFlags, srcAccessMask: VkAccessFlags, dstAccessMask: VkAccessFlags, dependencyFlags: VkDependencyFlags, }; pub const VkSubpassDependency = struct_VkSubpassDependency; pub const struct_VkRenderPassCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkRenderPassCreateFlags, attachmentCount: u32, pAttachments: ?[*]const VkAttachmentDescription, subpassCount: u32, pSubpasses: ?[*]const VkSubpassDescription, dependencyCount: u32, pDependencies: ?[*]const VkSubpassDependency, }; pub const VkRenderPassCreateInfo = struct_VkRenderPassCreateInfo; pub const struct_VkCommandPoolCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkCommandPoolCreateFlags, queueFamilyIndex: u32, }; pub const VkCommandPoolCreateInfo = struct_VkCommandPoolCreateInfo; pub const struct_VkCommandBufferAllocateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, commandPool: VkCommandPool, level: VkCommandBufferLevel, commandBufferCount: u32, }; pub const VkCommandBufferAllocateInfo = struct_VkCommandBufferAllocateInfo; pub const struct_VkCommandBufferInheritanceInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, renderPass: VkRenderPass, subpass: u32, framebuffer: VkFramebuffer, occlusionQueryEnable: VkBool32, queryFlags: VkQueryControlFlags, pipelineStatistics: VkQueryPipelineStatisticFlags, }; pub const VkCommandBufferInheritanceInfo = struct_VkCommandBufferInheritanceInfo; pub const struct_VkCommandBufferBeginInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkCommandBufferUsageFlags, pInheritanceInfo: ?[*]const VkCommandBufferInheritanceInfo, }; pub const VkCommandBufferBeginInfo = struct_VkCommandBufferBeginInfo; pub const struct_VkBufferCopy = extern struct { srcOffset: VkDeviceSize, dstOffset: VkDeviceSize, size: VkDeviceSize, }; pub const VkBufferCopy = struct_VkBufferCopy; pub const struct_VkImageSubresourceLayers = extern struct { aspectMask: VkImageAspectFlags, mipLevel: u32, baseArrayLayer: u32, layerCount: u32, }; pub const VkImageSubresourceLayers = struct_VkImageSubresourceLayers; pub const struct_VkImageCopy = extern struct { srcSubresource: VkImageSubresourceLayers, srcOffset: VkOffset3D, dstSubresource: VkImageSubresourceLayers, dstOffset: VkOffset3D, extent: VkExtent3D, }; pub const VkImageCopy = struct_VkImageCopy; pub const struct_VkImageBlit = extern struct { srcSubresource: VkImageSubresourceLayers, srcOffsets: [2]VkOffset3D, dstSubresource: VkImageSubresourceLayers, dstOffsets: [2]VkOffset3D, }; pub const VkImageBlit = struct_VkImageBlit; pub const struct_VkBufferImageCopy = extern struct { bufferOffset: VkDeviceSize, bufferRowLength: u32, bufferImageHeight: u32, imageSubresource: VkImageSubresourceLayers, imageOffset: VkOffset3D, imageExtent: VkExtent3D, }; pub const VkBufferImageCopy = struct_VkBufferImageCopy; pub const union_VkClearColorValue = extern union { float32: [4]f32, int32: [4]i32, uint32: [4]u32, }; pub const VkClearColorValue = union_VkClearColorValue; pub const struct_VkClearDepthStencilValue = extern struct { depth: f32, stencil: u32, }; pub const VkClearDepthStencilValue = struct_VkClearDepthStencilValue; pub const union_VkClearValue = extern union { color: VkClearColorValue, depthStencil: VkClearDepthStencilValue, }; pub const VkClearValue = union_VkClearValue; pub const struct_VkClearAttachment = extern struct { aspectMask: VkImageAspectFlags, colorAttachment: u32, clearValue: VkClearValue, }; pub const VkClearAttachment = struct_VkClearAttachment; pub const struct_VkClearRect = extern struct { rect: VkRect2D, baseArrayLayer: u32, layerCount: u32, }; pub const VkClearRect = struct_VkClearRect; pub const struct_VkImageResolve = extern struct { srcSubresource: VkImageSubresourceLayers, srcOffset: VkOffset3D, dstSubresource: VkImageSubresourceLayers, dstOffset: VkOffset3D, extent: VkExtent3D, }; pub const VkImageResolve = struct_VkImageResolve; pub const struct_VkMemoryBarrier = extern struct { sType: VkStructureType, pNext: ?*const c_void, srcAccessMask: VkAccessFlags, dstAccessMask: VkAccessFlags, }; pub const VkMemoryBarrier = struct_VkMemoryBarrier; pub const struct_VkBufferMemoryBarrier = extern struct { sType: VkStructureType, pNext: ?*const c_void, srcAccessMask: VkAccessFlags, dstAccessMask: VkAccessFlags, srcQueueFamilyIndex: u32, dstQueueFamilyIndex: u32, buffer: VkBuffer, offset: VkDeviceSize, size: VkDeviceSize, }; pub const VkBufferMemoryBarrier = struct_VkBufferMemoryBarrier; pub const struct_VkImageMemoryBarrier = extern struct { sType: VkStructureType, pNext: ?*const c_void, srcAccessMask: VkAccessFlags, dstAccessMask: VkAccessFlags, oldLayout: VkImageLayout, newLayout: VkImageLayout, srcQueueFamilyIndex: u32, dstQueueFamilyIndex: u32, image: VkImage, subresourceRange: VkImageSubresourceRange, }; pub const VkImageMemoryBarrier = struct_VkImageMemoryBarrier; pub const struct_VkRenderPassBeginInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, renderPass: VkRenderPass, framebuffer: VkFramebuffer, renderArea: VkRect2D, clearValueCount: u32, pClearValues: ?[*]const VkClearValue, }; pub const VkRenderPassBeginInfo = struct_VkRenderPassBeginInfo; pub const struct_VkDispatchIndirectCommand = extern struct { x: u32, y: u32, z: u32, }; pub const VkDispatchIndirectCommand = struct_VkDispatchIndirectCommand; pub const struct_VkDrawIndexedIndirectCommand = extern struct { indexCount: u32, instanceCount: u32, firstIndex: u32, vertexOffset: i32, firstInstance: u32, }; pub const VkDrawIndexedIndirectCommand = struct_VkDrawIndexedIndirectCommand; pub const struct_VkDrawIndirectCommand = extern struct { vertexCount: u32, instanceCount: u32, firstVertex: u32, firstInstance: u32, }; pub const VkDrawIndirectCommand = struct_VkDrawIndirectCommand; pub const struct_VkBaseOutStructure = extern struct { sType: VkStructureType, pNext: ?[*]struct_VkBaseOutStructure, }; pub const VkBaseOutStructure = struct_VkBaseOutStructure; pub const struct_VkBaseInStructure = extern struct { sType: VkStructureType, pNext: ?[*]const struct_VkBaseInStructure, }; pub const VkBaseInStructure = struct_VkBaseInStructure; pub const PFN_vkCreateInstance = ?fn (?[*]const VkInstanceCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkInstance) callconv(.C) VkResult; pub const PFN_vkDestroyInstance = ?fn (VkInstance, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkEnumeratePhysicalDevices = ?fn (VkInstance, ?[*]u32, ?[*]VkPhysicalDevice) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceFeatures = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceFeatures) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceFormatProperties = ?fn (VkPhysicalDevice, VkFormat, ?[*]VkFormatProperties) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceImageFormatProperties = ?fn (VkPhysicalDevice, VkFormat, VkImageType, VkImageTiling, VkImageUsageFlags, VkImageCreateFlags, ?[*]VkImageFormatProperties) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceProperties = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceProperties) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceQueueFamilyProperties = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkQueueFamilyProperties) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceMemoryProperties = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceMemoryProperties) callconv(.C) void; pub const PFN_vkGetInstanceProcAddr = ?fn (VkInstance, ?[*]const u8) callconv(.C) PFN_vkVoidFunction; pub const PFN_vkGetDeviceProcAddr = ?fn (VkDevice, ?[*]const u8) callconv(.C) PFN_vkVoidFunction; pub const PFN_vkCreateDevice = ?fn (VkPhysicalDevice, ?[*]const VkDeviceCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkDevice) callconv(.C) VkResult; pub const PFN_vkDestroyDevice = ?fn (VkDevice, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkEnumerateInstanceExtensionProperties = ?fn (?[*]const u8, ?[*]u32, ?[*]VkExtensionProperties) callconv(.C) VkResult; pub const PFN_vkEnumerateDeviceExtensionProperties = ?fn (VkPhysicalDevice, ?[*]const u8, ?[*]u32, ?[*]VkExtensionProperties) callconv(.C) VkResult; pub const PFN_vkEnumerateInstanceLayerProperties = ?fn (?[*]u32, ?[*]VkLayerProperties) callconv(.C) VkResult; pub const PFN_vkEnumerateDeviceLayerProperties = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkLayerProperties) callconv(.C) VkResult; pub const PFN_vkGetDeviceQueue = ?fn (VkDevice, u32, u32, ?[*]VkQueue) callconv(.C) void; pub const PFN_vkQueueSubmit = ?fn (VkQueue, u32, ?[*]const VkSubmitInfo, VkFence) callconv(.C) VkResult; pub const PFN_vkQueueWaitIdle = ?fn (VkQueue) callconv(.C) VkResult; pub const PFN_vkDeviceWaitIdle = ?fn (VkDevice) callconv(.C) VkResult; pub const PFN_vkAllocateMemory = ?fn (VkDevice, ?[*]const VkMemoryAllocateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkDeviceMemory) callconv(.C) VkResult; pub const PFN_vkFreeMemory = ?fn (VkDevice, VkDeviceMemory, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkMapMemory = ?fn (VkDevice, VkDeviceMemory, VkDeviceSize, VkDeviceSize, VkMemoryMapFlags, ?[*](?*c_void)) callconv(.C) VkResult; pub const PFN_vkUnmapMemory = ?fn (VkDevice, VkDeviceMemory) callconv(.C) void; pub const PFN_vkFlushMappedMemoryRanges = ?fn (VkDevice, u32, ?[*]const VkMappedMemoryRange) callconv(.C) VkResult; pub const PFN_vkInvalidateMappedMemoryRanges = ?fn (VkDevice, u32, ?[*]const VkMappedMemoryRange) callconv(.C) VkResult; pub const PFN_vkGetDeviceMemoryCommitment = ?fn (VkDevice, VkDeviceMemory, ?[*]VkDeviceSize) callconv(.C) void; pub const PFN_vkBindBufferMemory = ?fn (VkDevice, VkBuffer, VkDeviceMemory, VkDeviceSize) callconv(.C) VkResult; pub const PFN_vkBindImageMemory = ?fn (VkDevice, VkImage, VkDeviceMemory, VkDeviceSize) callconv(.C) VkResult; pub const PFN_vkGetBufferMemoryRequirements = ?fn (VkDevice, VkBuffer, ?[*]VkMemoryRequirements) callconv(.C) void; pub const PFN_vkGetImageMemoryRequirements = ?fn (VkDevice, VkImage, ?[*]VkMemoryRequirements) callconv(.C) void; pub const PFN_vkGetImageSparseMemoryRequirements = ?fn (VkDevice, VkImage, ?[*]u32, ?[*]VkSparseImageMemoryRequirements) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceSparseImageFormatProperties = ?fn (VkPhysicalDevice, VkFormat, VkImageType, VkSampleCountFlagBits, VkImageUsageFlags, VkImageTiling, ?[*]u32, ?[*]VkSparseImageFormatProperties) callconv(.C) void; pub const PFN_vkQueueBindSparse = ?fn (VkQueue, u32, ?[*]const VkBindSparseInfo, VkFence) callconv(.C) VkResult; pub const PFN_vkCreateFence = ?fn (VkDevice, ?[*]const VkFenceCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkFence) callconv(.C) VkResult; pub const PFN_vkDestroyFence = ?fn (VkDevice, VkFence, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkResetFences = ?fn (VkDevice, u32, ?[*]const VkFence) callconv(.C) VkResult; pub const PFN_vkGetFenceStatus = ?fn (VkDevice, VkFence) callconv(.C) VkResult; pub const PFN_vkWaitForFences = ?fn (VkDevice, u32, ?[*]const VkFence, VkBool32, u64) callconv(.C) VkResult; pub const PFN_vkCreateSemaphore = ?fn (VkDevice, ?[*]const VkSemaphoreCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkSemaphore) callconv(.C) VkResult; pub const PFN_vkDestroySemaphore = ?fn (VkDevice, VkSemaphore, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateEvent = ?fn (VkDevice, ?[*]const VkEventCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkEvent) callconv(.C) VkResult; pub const PFN_vkDestroyEvent = ?fn (VkDevice, VkEvent, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetEventStatus = ?fn (VkDevice, VkEvent) callconv(.C) VkResult; pub const PFN_vkSetEvent = ?fn (VkDevice, VkEvent) callconv(.C) VkResult; pub const PFN_vkResetEvent = ?fn (VkDevice, VkEvent) callconv(.C) VkResult; pub const PFN_vkCreateQueryPool = ?fn (VkDevice, ?[*]const VkQueryPoolCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkQueryPool) callconv(.C) VkResult; pub const PFN_vkDestroyQueryPool = ?fn (VkDevice, VkQueryPool, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetQueryPoolResults = ?fn (VkDevice, VkQueryPool, u32, u32, usize, ?*c_void, VkDeviceSize, VkQueryResultFlags) callconv(.C) VkResult; pub const PFN_vkCreateBuffer = ?fn (VkDevice, ?[*]const VkBufferCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkBuffer) callconv(.C) VkResult; pub const PFN_vkDestroyBuffer = ?fn (VkDevice, VkBuffer, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateBufferView = ?fn (VkDevice, ?[*]const VkBufferViewCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkBufferView) callconv(.C) VkResult; pub const PFN_vkDestroyBufferView = ?fn (VkDevice, VkBufferView, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateImage = ?fn (VkDevice, ?[*]const VkImageCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkImage) callconv(.C) VkResult; pub const PFN_vkDestroyImage = ?fn (VkDevice, VkImage, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetImageSubresourceLayout = ?fn (VkDevice, VkImage, ?[*]const VkImageSubresource, ?[*]VkSubresourceLayout) callconv(.C) void; pub const PFN_vkCreateImageView = ?fn (VkDevice, ?[*]const VkImageViewCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkImageView) callconv(.C) VkResult; pub const PFN_vkDestroyImageView = ?fn (VkDevice, VkImageView, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateShaderModule = ?fn (VkDevice, ?[*]const VkShaderModuleCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkShaderModule) callconv(.C) VkResult; pub const PFN_vkDestroyShaderModule = ?fn (VkDevice, VkShaderModule, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreatePipelineCache = ?fn (VkDevice, ?[*]const VkPipelineCacheCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkPipelineCache) callconv(.C) VkResult; pub const PFN_vkDestroyPipelineCache = ?fn (VkDevice, VkPipelineCache, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetPipelineCacheData = ?fn (VkDevice, VkPipelineCache, ?[*]usize, ?*c_void) callconv(.C) VkResult; pub const PFN_vkMergePipelineCaches = ?fn (VkDevice, VkPipelineCache, u32, ?[*]const VkPipelineCache) callconv(.C) VkResult; pub const PFN_vkCreateGraphicsPipelines = ?fn (VkDevice, VkPipelineCache, u32, ?[*]const VkGraphicsPipelineCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkPipeline) callconv(.C) VkResult; pub const PFN_vkCreateComputePipelines = ?fn (VkDevice, VkPipelineCache, u32, ?[*]const VkComputePipelineCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkPipeline) callconv(.C) VkResult; pub const PFN_vkDestroyPipeline = ?fn (VkDevice, VkPipeline, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreatePipelineLayout = ?fn (VkDevice, ?[*]const VkPipelineLayoutCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkPipelineLayout) callconv(.C) VkResult; pub const PFN_vkDestroyPipelineLayout = ?fn (VkDevice, VkPipelineLayout, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateSampler = ?fn (VkDevice, ?[*]const VkSamplerCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkSampler) callconv(.C) VkResult; pub const PFN_vkDestroySampler = ?fn (VkDevice, VkSampler, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateDescriptorSetLayout = ?fn (VkDevice, ?[*]const VkDescriptorSetLayoutCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkDescriptorSetLayout) callconv(.C) VkResult; pub const PFN_vkDestroyDescriptorSetLayout = ?fn (VkDevice, VkDescriptorSetLayout, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateDescriptorPool = ?fn (VkDevice, ?[*]const VkDescriptorPoolCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkDescriptorPool) callconv(.C) VkResult; pub const PFN_vkDestroyDescriptorPool = ?fn (VkDevice, VkDescriptorPool, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkResetDescriptorPool = ?fn (VkDevice, VkDescriptorPool, VkDescriptorPoolResetFlags) callconv(.C) VkResult; pub const PFN_vkAllocateDescriptorSets = ?fn (VkDevice, ?[*]const VkDescriptorSetAllocateInfo, ?[*]VkDescriptorSet) callconv(.C) VkResult; pub const PFN_vkFreeDescriptorSets = ?fn (VkDevice, VkDescriptorPool, u32, ?[*]const VkDescriptorSet) callconv(.C) VkResult; pub const PFN_vkUpdateDescriptorSets = ?fn (VkDevice, u32, ?[*]const VkWriteDescriptorSet, u32, ?[*]const VkCopyDescriptorSet) callconv(.C) void; pub const PFN_vkCreateFramebuffer = ?fn (VkDevice, ?[*]const VkFramebufferCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkFramebuffer) callconv(.C) VkResult; pub const PFN_vkDestroyFramebuffer = ?fn (VkDevice, VkFramebuffer, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateRenderPass = ?fn (VkDevice, ?[*]const VkRenderPassCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkRenderPass) callconv(.C) VkResult; pub const PFN_vkDestroyRenderPass = ?fn (VkDevice, VkRenderPass, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetRenderAreaGranularity = ?fn (VkDevice, VkRenderPass, ?[*]VkExtent2D) callconv(.C) void; pub const PFN_vkCreateCommandPool = ?fn (VkDevice, ?[*]const VkCommandPoolCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkCommandPool) callconv(.C) VkResult; pub const PFN_vkDestroyCommandPool = ?fn (VkDevice, VkCommandPool, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkResetCommandPool = ?fn (VkDevice, VkCommandPool, VkCommandPoolResetFlags) callconv(.C) VkResult; pub const PFN_vkAllocateCommandBuffers = ?fn (VkDevice, ?[*]const VkCommandBufferAllocateInfo, ?[*]VkCommandBuffer) callconv(.C) VkResult; pub const PFN_vkFreeCommandBuffers = ?fn (VkDevice, VkCommandPool, u32, ?[*]const VkCommandBuffer) callconv(.C) void; pub const PFN_vkBeginCommandBuffer = ?fn (VkCommandBuffer, ?[*]const VkCommandBufferBeginInfo) callconv(.C) VkResult; pub const PFN_vkEndCommandBuffer = ?fn (VkCommandBuffer) callconv(.C) VkResult; pub const PFN_vkResetCommandBuffer = ?fn (VkCommandBuffer, VkCommandBufferResetFlags) callconv(.C) VkResult; pub const PFN_vkCmdBindPipeline = ?fn (VkCommandBuffer, VkPipelineBindPoint, VkPipeline) callconv(.C) void; pub const PFN_vkCmdSetViewport = ?fn (VkCommandBuffer, u32, u32, ?[*]const VkViewport) callconv(.C) void; pub const PFN_vkCmdSetScissor = ?fn (VkCommandBuffer, u32, u32, ?[*]const VkRect2D) callconv(.C) void; pub const PFN_vkCmdSetLineWidth = ?fn (VkCommandBuffer, f32) callconv(.C) void; pub const PFN_vkCmdSetDepthBias = ?fn (VkCommandBuffer, f32, f32, f32) callconv(.C) void; pub const PFN_vkCmdSetBlendConstants = ?fn (VkCommandBuffer, ?[*]const f32) callconv(.C) void; pub const PFN_vkCmdSetDepthBounds = ?fn (VkCommandBuffer, f32, f32) callconv(.C) void; pub const PFN_vkCmdSetStencilCompareMask = ?fn (VkCommandBuffer, VkStencilFaceFlags, u32) callconv(.C) void; pub const PFN_vkCmdSetStencilWriteMask = ?fn (VkCommandBuffer, VkStencilFaceFlags, u32) callconv(.C) void; pub const PFN_vkCmdSetStencilReference = ?fn (VkCommandBuffer, VkStencilFaceFlags, u32) callconv(.C) void; pub const PFN_vkCmdBindDescriptorSets = ?fn (VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, u32, u32, ?[*]const VkDescriptorSet, u32, ?[*]const u32) callconv(.C) void; pub const PFN_vkCmdBindIndexBuffer = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkIndexType) callconv(.C) void; pub const PFN_vkCmdBindVertexBuffers = ?fn (VkCommandBuffer, u32, u32, ?[*]const VkBuffer, ?[*]const VkDeviceSize) callconv(.C) void; pub const PFN_vkCmdDraw = ?fn (VkCommandBuffer, u32, u32, u32, u32) callconv(.C) void; pub const PFN_vkCmdDrawIndexed = ?fn (VkCommandBuffer, u32, u32, u32, i32, u32) callconv(.C) void; pub const PFN_vkCmdDrawIndirect = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, u32, u32) callconv(.C) void; pub const PFN_vkCmdDrawIndexedIndirect = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, u32, u32) callconv(.C) void; pub const PFN_vkCmdDispatch = ?fn (VkCommandBuffer, u32, u32, u32) callconv(.C) void; pub const PFN_vkCmdDispatchIndirect = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize) callconv(.C) void; pub const PFN_vkCmdCopyBuffer = ?fn (VkCommandBuffer, VkBuffer, VkBuffer, u32, ?[*]const VkBufferCopy) callconv(.C) void; pub const PFN_vkCmdCopyImage = ?fn (VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, u32, ?[*]const VkImageCopy) callconv(.C) void; pub const PFN_vkCmdBlitImage = ?fn (VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, u32, ?[*]const VkImageBlit, VkFilter) callconv(.C) void; pub const PFN_vkCmdCopyBufferToImage = ?fn (VkCommandBuffer, VkBuffer, VkImage, VkImageLayout, u32, ?[*]const VkBufferImageCopy) callconv(.C) void; pub const PFN_vkCmdCopyImageToBuffer = ?fn (VkCommandBuffer, VkImage, VkImageLayout, VkBuffer, u32, ?[*]const VkBufferImageCopy) callconv(.C) void; pub const PFN_vkCmdUpdateBuffer = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, ?*const c_void) callconv(.C) void; pub const PFN_vkCmdFillBuffer = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, u32) callconv(.C) void; pub const PFN_vkCmdClearColorImage = ?fn (VkCommandBuffer, VkImage, VkImageLayout, ?[*]const VkClearColorValue, u32, ?[*]const VkImageSubresourceRange) callconv(.C) void; pub const PFN_vkCmdClearDepthStencilImage = ?fn (VkCommandBuffer, VkImage, VkImageLayout, ?[*]const VkClearDepthStencilValue, u32, ?[*]const VkImageSubresourceRange) callconv(.C) void; pub const PFN_vkCmdClearAttachments = ?fn (VkCommandBuffer, u32, ?[*]const VkClearAttachment, u32, ?[*]const VkClearRect) callconv(.C) void; pub const PFN_vkCmdResolveImage = ?fn (VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, u32, ?[*]const VkImageResolve) callconv(.C) void; pub const PFN_vkCmdSetEvent = ?fn (VkCommandBuffer, VkEvent, VkPipelineStageFlags) callconv(.C) void; pub const PFN_vkCmdResetEvent = ?fn (VkCommandBuffer, VkEvent, VkPipelineStageFlags) callconv(.C) void; pub const PFN_vkCmdWaitEvents = ?fn (VkCommandBuffer, u32, ?[*]const VkEvent, VkPipelineStageFlags, VkPipelineStageFlags, u32, ?[*]const VkMemoryBarrier, u32, ?[*]const VkBufferMemoryBarrier, u32, ?[*]const VkImageMemoryBarrier) callconv(.C) void; pub const PFN_vkCmdPipelineBarrier = ?fn (VkCommandBuffer, VkPipelineStageFlags, VkPipelineStageFlags, VkDependencyFlags, u32, ?[*]const VkMemoryBarrier, u32, ?[*]const VkBufferMemoryBarrier, u32, ?[*]const VkImageMemoryBarrier) callconv(.C) void; pub const PFN_vkCmdBeginQuery = ?fn (VkCommandBuffer, VkQueryPool, u32, VkQueryControlFlags) callconv(.C) void; pub const PFN_vkCmdEndQuery = ?fn (VkCommandBuffer, VkQueryPool, u32) callconv(.C) void; pub const PFN_vkCmdResetQueryPool = ?fn (VkCommandBuffer, VkQueryPool, u32, u32) callconv(.C) void; pub const PFN_vkCmdWriteTimestamp = ?fn (VkCommandBuffer, VkPipelineStageFlagBits, VkQueryPool, u32) callconv(.C) void; pub const PFN_vkCmdCopyQueryPoolResults = ?fn (VkCommandBuffer, VkQueryPool, u32, u32, VkBuffer, VkDeviceSize, VkDeviceSize, VkQueryResultFlags) callconv(.C) void; pub const PFN_vkCmdPushConstants = ?fn (VkCommandBuffer, VkPipelineLayout, VkShaderStageFlags, u32, u32, ?*const c_void) callconv(.C) void; pub const PFN_vkCmdBeginRenderPass = ?fn (VkCommandBuffer, ?[*]const VkRenderPassBeginInfo, VkSubpassContents) callconv(.C) void; pub const PFN_vkCmdNextSubpass = ?fn (VkCommandBuffer, VkSubpassContents) callconv(.C) void; pub const PFN_vkCmdEndRenderPass = ?fn (VkCommandBuffer) callconv(.C) void; pub const PFN_vkCmdExecuteCommands = ?fn (VkCommandBuffer, u32, ?[*]const VkCommandBuffer) callconv(.C) void; pub extern fn vkCreateInstance( pCreateInfo: *const VkInstanceCreateInfo, pAllocator: ?*const VkAllocationCallbacks, pInstance: *VkInstance, ) VkResult; pub extern fn vkDestroyInstance(instance: VkInstance, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkEnumeratePhysicalDevices(instance: VkInstance, pPhysicalDeviceCount: *u32, pPhysicalDevices: ?[*]VkPhysicalDevice) VkResult; pub extern fn vkGetPhysicalDeviceFeatures(physicalDevice: VkPhysicalDevice, pFeatures: ?[*]VkPhysicalDeviceFeatures) void; pub extern fn vkGetPhysicalDeviceFormatProperties(physicalDevice: VkPhysicalDevice, format: VkFormat, pFormatProperties: ?[*]VkFormatProperties) void; pub extern fn vkGetPhysicalDeviceImageFormatProperties(physicalDevice: VkPhysicalDevice, format: VkFormat, type_0: VkImageType, tiling: VkImageTiling, usage: VkImageUsageFlags, flags: VkImageCreateFlags, pImageFormatProperties: ?[*]VkImageFormatProperties) VkResult; pub extern fn vkGetPhysicalDeviceProperties(physicalDevice: VkPhysicalDevice, pProperties: ?[*]VkPhysicalDeviceProperties) void; pub extern fn vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice: VkPhysicalDevice, pQueueFamilyPropertyCount: *u32, pQueueFamilyProperties: ?[*]VkQueueFamilyProperties) void; pub extern fn vkGetPhysicalDeviceMemoryProperties(physicalDevice: VkPhysicalDevice, pMemoryProperties: ?[*]VkPhysicalDeviceMemoryProperties) void; pub extern fn vkGetInstanceProcAddr(instance: VkInstance, pName: ?[*]const u8) PFN_vkVoidFunction; pub extern fn vkGetDeviceProcAddr(device: VkDevice, pName: ?[*]const u8) PFN_vkVoidFunction; pub extern fn vkCreateDevice(physicalDevice: VkPhysicalDevice, pCreateInfo: *const VkDeviceCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pDevice: *VkDevice) VkResult; pub extern fn vkDestroyDevice(device: VkDevice, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkEnumerateInstanceExtensionProperties(pLayerName: ?[*]const u8, pPropertyCount: ?[*]u32, pProperties: ?[*]VkExtensionProperties) VkResult; pub extern fn vkEnumerateDeviceExtensionProperties( physicalDevice: VkPhysicalDevice, pLayerName: ?[*]const u8, pPropertyCount: *u32, pProperties: ?[*]VkExtensionProperties, ) VkResult; pub extern fn vkEnumerateInstanceLayerProperties(pPropertyCount: *u32, pProperties: ?[*]VkLayerProperties) VkResult; pub extern fn vkEnumerateDeviceLayerProperties(physicalDevice: VkPhysicalDevice, pPropertyCount: ?[*]u32, pProperties: ?[*]VkLayerProperties) VkResult; pub extern fn vkGetDeviceQueue(device: VkDevice, queueFamilyIndex: u32, queueIndex: u32, pQueue: *VkQueue) void; pub extern fn vkQueueSubmit(queue: VkQueue, submitCount: u32, pSubmits: [*]const VkSubmitInfo, fence: VkFence) VkResult; pub extern fn vkQueueWaitIdle(queue: VkQueue) VkResult; pub extern fn vkDeviceWaitIdle(device: VkDevice) VkResult; pub extern fn vkAllocateMemory(device: VkDevice, pAllocateInfo: ?[*]const VkMemoryAllocateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pMemory: ?[*]VkDeviceMemory) VkResult; pub extern fn vkFreeMemory(device: VkDevice, memory: VkDeviceMemory, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkMapMemory(device: VkDevice, memory: VkDeviceMemory, offset: VkDeviceSize, size: VkDeviceSize, flags: VkMemoryMapFlags, ppData: ?[*](?*c_void)) VkResult; pub extern fn vkUnmapMemory(device: VkDevice, memory: VkDeviceMemory) void; pub extern fn vkFlushMappedMemoryRanges(device: VkDevice, memoryRangeCount: u32, pMemoryRanges: ?[*]const VkMappedMemoryRange) VkResult; pub extern fn vkInvalidateMappedMemoryRanges(device: VkDevice, memoryRangeCount: u32, pMemoryRanges: ?[*]const VkMappedMemoryRange) VkResult; pub extern fn vkGetDeviceMemoryCommitment(device: VkDevice, memory: VkDeviceMemory, pCommittedMemoryInBytes: ?[*]VkDeviceSize) void; pub extern fn vkBindBufferMemory(device: VkDevice, buffer: VkBuffer, memory: VkDeviceMemory, memoryOffset: VkDeviceSize) VkResult; pub extern fn vkBindImageMemory(device: VkDevice, image: VkImage, memory: VkDeviceMemory, memoryOffset: VkDeviceSize) VkResult; pub extern fn vkGetBufferMemoryRequirements(device: VkDevice, buffer: VkBuffer, pMemoryRequirements: ?[*]VkMemoryRequirements) void; pub extern fn vkGetImageMemoryRequirements(device: VkDevice, image: VkImage, pMemoryRequirements: ?[*]VkMemoryRequirements) void; pub extern fn vkGetImageSparseMemoryRequirements(device: VkDevice, image: VkImage, pSparseMemoryRequirementCount: ?[*]u32, pSparseMemoryRequirements: ?[*]VkSparseImageMemoryRequirements) void; pub extern fn vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice: VkPhysicalDevice, format: VkFormat, type_0: VkImageType, samples: VkSampleCountFlagBits, usage: VkImageUsageFlags, tiling: VkImageTiling, pPropertyCount: ?[*]u32, pProperties: ?[*]VkSparseImageFormatProperties) void; pub extern fn vkQueueBindSparse(queue: VkQueue, bindInfoCount: u32, pBindInfo: ?[*]const VkBindSparseInfo, fence: VkFence) VkResult; pub extern fn vkCreateFence(device: VkDevice, pCreateInfo: *const VkFenceCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pFence: *VkFence) VkResult; pub extern fn vkDestroyFence(device: VkDevice, fence: VkFence, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkResetFences(device: VkDevice, fenceCount: u32, pFences: [*]const VkFence) VkResult; pub extern fn vkGetFenceStatus(device: VkDevice, fence: VkFence) VkResult; pub extern fn vkWaitForFences(device: VkDevice, fenceCount: u32, pFences: [*]const VkFence, waitAll: VkBool32, timeout: u64) VkResult; pub extern fn vkCreateSemaphore(device: VkDevice, pCreateInfo: *const VkSemaphoreCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pSemaphore: *VkSemaphore) VkResult; pub extern fn vkDestroySemaphore(device: VkDevice, semaphore: VkSemaphore, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateEvent(device: VkDevice, pCreateInfo: ?[*]const VkEventCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pEvent: ?[*]VkEvent) VkResult; pub extern fn vkDestroyEvent(device: VkDevice, event: VkEvent, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetEventStatus(device: VkDevice, event: VkEvent) VkResult; pub extern fn vkSetEvent(device: VkDevice, event: VkEvent) VkResult; pub extern fn vkResetEvent(device: VkDevice, event: VkEvent) VkResult; pub extern fn vkCreateQueryPool(device: VkDevice, pCreateInfo: ?[*]const VkQueryPoolCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pQueryPool: ?[*]VkQueryPool) VkResult; pub extern fn vkDestroyQueryPool(device: VkDevice, queryPool: VkQueryPool, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetQueryPoolResults(device: VkDevice, queryPool: VkQueryPool, firstQuery: u32, queryCount: u32, dataSize: usize, pData: ?*c_void, stride: VkDeviceSize, flags: VkQueryResultFlags) VkResult; pub extern fn vkCreateBuffer(device: VkDevice, pCreateInfo: ?[*]const VkBufferCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pBuffer: ?[*]VkBuffer) VkResult; pub extern fn vkDestroyBuffer(device: VkDevice, buffer: VkBuffer, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateBufferView(device: VkDevice, pCreateInfo: ?[*]const VkBufferViewCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pView: ?[*]VkBufferView) VkResult; pub extern fn vkDestroyBufferView(device: VkDevice, bufferView: VkBufferView, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateImage(device: VkDevice, pCreateInfo: ?[*]const VkImageCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pImage: ?[*]VkImage) VkResult; pub extern fn vkDestroyImage(device: VkDevice, image: VkImage, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetImageSubresourceLayout(device: VkDevice, image: VkImage, pSubresource: ?[*]const VkImageSubresource, pLayout: ?[*]VkSubresourceLayout) void; pub extern fn vkCreateImageView(device: VkDevice, pCreateInfo: *const VkImageViewCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pView: *VkImageView) VkResult; pub extern fn vkDestroyImageView(device: VkDevice, imageView: VkImageView, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateShaderModule(device: VkDevice, pCreateInfo: *const VkShaderModuleCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pShaderModule: *VkShaderModule) VkResult; pub extern fn vkDestroyShaderModule(device: VkDevice, shaderModule: VkShaderModule, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreatePipelineCache(device: VkDevice, pCreateInfo: ?[*]const VkPipelineCacheCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pPipelineCache: ?[*]VkPipelineCache) VkResult; pub extern fn vkDestroyPipelineCache(device: VkDevice, pipelineCache: VkPipelineCache, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetPipelineCacheData(device: VkDevice, pipelineCache: VkPipelineCache, pDataSize: ?[*]usize, pData: ?*c_void) VkResult; pub extern fn vkMergePipelineCaches(device: VkDevice, dstCache: VkPipelineCache, srcCacheCount: u32, pSrcCaches: ?[*]const VkPipelineCache) VkResult; pub extern fn vkCreateGraphicsPipelines(device: VkDevice, pipelineCache: VkPipelineCache, createInfoCount: u32, pCreateInfos: ?[*]const VkGraphicsPipelineCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pPipelines: [*]VkPipeline) VkResult; pub extern fn vkCreateComputePipelines(device: VkDevice, pipelineCache: VkPipelineCache, createInfoCount: u32, pCreateInfos: ?[*]const VkComputePipelineCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pPipelines: ?[*]VkPipeline) VkResult; pub extern fn vkDestroyPipeline(device: VkDevice, pipeline: VkPipeline, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreatePipelineLayout(device: VkDevice, pCreateInfo: *const VkPipelineLayoutCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pPipelineLayout: *VkPipelineLayout) VkResult; pub extern fn vkDestroyPipelineLayout(device: VkDevice, pipelineLayout: VkPipelineLayout, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateSampler(device: VkDevice, pCreateInfo: ?[*]const VkSamplerCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pSampler: ?[*]VkSampler) VkResult; pub extern fn vkDestroySampler(device: VkDevice, sampler: VkSampler, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateDescriptorSetLayout(device: VkDevice, pCreateInfo: ?[*]const VkDescriptorSetLayoutCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pSetLayout: ?[*]VkDescriptorSetLayout) VkResult; pub extern fn vkDestroyDescriptorSetLayout(device: VkDevice, descriptorSetLayout: VkDescriptorSetLayout, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateDescriptorPool(device: VkDevice, pCreateInfo: ?[*]const VkDescriptorPoolCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pDescriptorPool: ?[*]VkDescriptorPool) VkResult; pub extern fn vkDestroyDescriptorPool(device: VkDevice, descriptorPool: VkDescriptorPool, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkResetDescriptorPool(device: VkDevice, descriptorPool: VkDescriptorPool, flags: VkDescriptorPoolResetFlags) VkResult; pub extern fn vkAllocateDescriptorSets(device: VkDevice, pAllocateInfo: ?[*]const VkDescriptorSetAllocateInfo, pDescriptorSets: ?[*]VkDescriptorSet) VkResult; pub extern fn vkFreeDescriptorSets(device: VkDevice, descriptorPool: VkDescriptorPool, descriptorSetCount: u32, pDescriptorSets: ?[*]const VkDescriptorSet) VkResult; pub extern fn vkUpdateDescriptorSets(device: VkDevice, descriptorWriteCount: u32, pDescriptorWrites: ?[*]const VkWriteDescriptorSet, descriptorCopyCount: u32, pDescriptorCopies: ?[*]const VkCopyDescriptorSet) void; pub extern fn vkCreateFramebuffer(device: VkDevice, pCreateInfo: *const VkFramebufferCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pFramebuffer: *VkFramebuffer) VkResult; pub extern fn vkDestroyFramebuffer(device: VkDevice, framebuffer: VkFramebuffer, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateRenderPass(device: VkDevice, pCreateInfo: *const VkRenderPassCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pRenderPass: *VkRenderPass) VkResult; pub extern fn vkDestroyRenderPass(device: VkDevice, renderPass: VkRenderPass, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetRenderAreaGranularity(device: VkDevice, renderPass: VkRenderPass, pGranularity: ?[*]VkExtent2D) void; pub extern fn vkCreateCommandPool(device: VkDevice, pCreateInfo: *const VkCommandPoolCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pCommandPool: *VkCommandPool) VkResult; pub extern fn vkDestroyCommandPool(device: VkDevice, commandPool: VkCommandPool, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkResetCommandPool(device: VkDevice, commandPool: VkCommandPool, flags: VkCommandPoolResetFlags) VkResult; pub extern fn vkAllocateCommandBuffers(device: VkDevice, pAllocateInfo: *const VkCommandBufferAllocateInfo, pCommandBuffers: ?[*]VkCommandBuffer) VkResult; pub extern fn vkFreeCommandBuffers(device: VkDevice, commandPool: VkCommandPool, commandBufferCount: u32, pCommandBuffers: ?[*]const VkCommandBuffer) void; pub extern fn vkBeginCommandBuffer(commandBuffer: VkCommandBuffer, pBeginInfo: *const VkCommandBufferBeginInfo) VkResult; pub extern fn vkEndCommandBuffer(commandBuffer: VkCommandBuffer) VkResult; pub extern fn vkResetCommandBuffer(commandBuffer: VkCommandBuffer, flags: VkCommandBufferResetFlags) VkResult; pub extern fn vkCmdBindPipeline(commandBuffer: VkCommandBuffer, pipelineBindPoint: VkPipelineBindPoint, pipeline: VkPipeline) void; pub extern fn vkCmdSetViewport(commandBuffer: VkCommandBuffer, firstViewport: u32, viewportCount: u32, pViewports: ?[*]const VkViewport) void; pub extern fn vkCmdSetScissor(commandBuffer: VkCommandBuffer, firstScissor: u32, scissorCount: u32, pScissors: ?[*]const VkRect2D) void; pub extern fn vkCmdSetLineWidth(commandBuffer: VkCommandBuffer, lineWidth: f32) void; pub extern fn vkCmdSetDepthBias(commandBuffer: VkCommandBuffer, depthBiasConstantFactor: f32, depthBiasClamp: f32, depthBiasSlopeFactor: f32) void; pub extern fn vkCmdSetBlendConstants(commandBuffer: VkCommandBuffer, blendConstants: ?[*]const f32) void; pub extern fn vkCmdSetDepthBounds(commandBuffer: VkCommandBuffer, minDepthBounds: f32, maxDepthBounds: f32) void; pub extern fn vkCmdSetStencilCompareMask(commandBuffer: VkCommandBuffer, faceMask: VkStencilFaceFlags, compareMask: u32) void; pub extern fn vkCmdSetStencilWriteMask(commandBuffer: VkCommandBuffer, faceMask: VkStencilFaceFlags, writeMask: u32) void; pub extern fn vkCmdSetStencilReference(commandBuffer: VkCommandBuffer, faceMask: VkStencilFaceFlags, reference: u32) void; pub extern fn vkCmdBindDescriptorSets(commandBuffer: VkCommandBuffer, pipelineBindPoint: VkPipelineBindPoint, layout: VkPipelineLayout, firstSet: u32, descriptorSetCount: u32, pDescriptorSets: ?[*]const VkDescriptorSet, dynamicOffsetCount: u32, pDynamicOffsets: ?[*]const u32) void; pub extern fn vkCmdBindIndexBuffer(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, indexType: VkIndexType) void; pub extern fn vkCmdBindVertexBuffers(commandBuffer: VkCommandBuffer, firstBinding: u32, bindingCount: u32, pBuffers: ?[*]const VkBuffer, pOffsets: ?[*]const VkDeviceSize) void; pub extern fn vkCmdDraw(commandBuffer: VkCommandBuffer, vertexCount: u32, instanceCount: u32, firstVertex: u32, firstInstance: u32) void; pub extern fn vkCmdDrawIndexed(commandBuffer: VkCommandBuffer, indexCount: u32, instanceCount: u32, firstIndex: u32, vertexOffset: i32, firstInstance: u32) void; pub extern fn vkCmdDrawIndirect(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, drawCount: u32, stride: u32) void; pub extern fn vkCmdDrawIndexedIndirect(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, drawCount: u32, stride: u32) void; pub extern fn vkCmdDispatch(commandBuffer: VkCommandBuffer, groupCountX: u32, groupCountY: u32, groupCountZ: u32) void; pub extern fn vkCmdDispatchIndirect(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize) void; pub extern fn vkCmdCopyBuffer(commandBuffer: VkCommandBuffer, srcBuffer: VkBuffer, dstBuffer: VkBuffer, regionCount: u32, pRegions: ?[*]const VkBufferCopy) void; pub extern fn vkCmdCopyImage(commandBuffer: VkCommandBuffer, srcImage: VkImage, srcImageLayout: VkImageLayout, dstImage: VkImage, dstImageLayout: VkImageLayout, regionCount: u32, pRegions: ?[*]const VkImageCopy) void; pub extern fn vkCmdBlitImage(commandBuffer: VkCommandBuffer, srcImage: VkImage, srcImageLayout: VkImageLayout, dstImage: VkImage, dstImageLayout: VkImageLayout, regionCount: u32, pRegions: ?[*]const VkImageBlit, filter: VkFilter) void; pub extern fn vkCmdCopyBufferToImage(commandBuffer: VkCommandBuffer, srcBuffer: VkBuffer, dstImage: VkImage, dstImageLayout: VkImageLayout, regionCount: u32, pRegions: ?[*]const VkBufferImageCopy) void; pub extern fn vkCmdCopyImageToBuffer(commandBuffer: VkCommandBuffer, srcImage: VkImage, srcImageLayout: VkImageLayout, dstBuffer: VkBuffer, regionCount: u32, pRegions: ?[*]const VkBufferImageCopy) void; pub extern fn vkCmdUpdateBuffer(commandBuffer: VkCommandBuffer, dstBuffer: VkBuffer, dstOffset: VkDeviceSize, dataSize: VkDeviceSize, pData: ?*const c_void) void; pub extern fn vkCmdFillBuffer(commandBuffer: VkCommandBuffer, dstBuffer: VkBuffer, dstOffset: VkDeviceSize, size: VkDeviceSize, data: u32) void; pub extern fn vkCmdClearColorImage(commandBuffer: VkCommandBuffer, image: VkImage, imageLayout: VkImageLayout, pColor: ?[*]const VkClearColorValue, rangeCount: u32, pRanges: ?[*]const VkImageSubresourceRange) void; pub extern fn vkCmdClearDepthStencilImage(commandBuffer: VkCommandBuffer, image: VkImage, imageLayout: VkImageLayout, pDepthStencil: ?[*]const VkClearDepthStencilValue, rangeCount: u32, pRanges: ?[*]const VkImageSubresourceRange) void; pub extern fn vkCmdClearAttachments(commandBuffer: VkCommandBuffer, attachmentCount: u32, pAttachments: ?[*]const VkClearAttachment, rectCount: u32, pRects: ?[*]const VkClearRect) void; pub extern fn vkCmdResolveImage(commandBuffer: VkCommandBuffer, srcImage: VkImage, srcImageLayout: VkImageLayout, dstImage: VkImage, dstImageLayout: VkImageLayout, regionCount: u32, pRegions: ?[*]const VkImageResolve) void; pub extern fn vkCmdSetEvent(commandBuffer: VkCommandBuffer, event: VkEvent, stageMask: VkPipelineStageFlags) void; pub extern fn vkCmdResetEvent(commandBuffer: VkCommandBuffer, event: VkEvent, stageMask: VkPipelineStageFlags) void; pub extern fn vkCmdWaitEvents(commandBuffer: VkCommandBuffer, eventCount: u32, pEvents: ?[*]const VkEvent, srcStageMask: VkPipelineStageFlags, dstStageMask: VkPipelineStageFlags, memoryBarrierCount: u32, pMemoryBarriers: ?[*]const VkMemoryBarrier, bufferMemoryBarrierCount: u32, pBufferMemoryBarriers: ?[*]const VkBufferMemoryBarrier, imageMemoryBarrierCount: u32, pImageMemoryBarriers: ?[*]const VkImageMemoryBarrier) void; pub extern fn vkCmdPipelineBarrier(commandBuffer: VkCommandBuffer, srcStageMask: VkPipelineStageFlags, dstStageMask: VkPipelineStageFlags, dependencyFlags: VkDependencyFlags, memoryBarrierCount: u32, pMemoryBarriers: ?[*]const VkMemoryBarrier, bufferMemoryBarrierCount: u32, pBufferMemoryBarriers: ?[*]const VkBufferMemoryBarrier, imageMemoryBarrierCount: u32, pImageMemoryBarriers: ?[*]const VkImageMemoryBarrier) void; pub extern fn vkCmdBeginQuery(commandBuffer: VkCommandBuffer, queryPool: VkQueryPool, query: u32, flags: VkQueryControlFlags) void; pub extern fn vkCmdEndQuery(commandBuffer: VkCommandBuffer, queryPool: VkQueryPool, query: u32) void; pub extern fn vkCmdResetQueryPool(commandBuffer: VkCommandBuffer, queryPool: VkQueryPool, firstQuery: u32, queryCount: u32) void; pub extern fn vkCmdWriteTimestamp(commandBuffer: VkCommandBuffer, pipelineStage: VkPipelineStageFlagBits, queryPool: VkQueryPool, query: u32) void; pub extern fn vkCmdCopyQueryPoolResults(commandBuffer: VkCommandBuffer, queryPool: VkQueryPool, firstQuery: u32, queryCount: u32, dstBuffer: VkBuffer, dstOffset: VkDeviceSize, stride: VkDeviceSize, flags: VkQueryResultFlags) void; pub extern fn vkCmdPushConstants(commandBuffer: VkCommandBuffer, layout: VkPipelineLayout, stageFlags: VkShaderStageFlags, offset: u32, size: u32, pValues: ?*const c_void) void; pub extern fn vkCmdBeginRenderPass(commandBuffer: VkCommandBuffer, pRenderPassBegin: *const VkRenderPassBeginInfo, contents: VkSubpassContents) void; pub extern fn vkCmdNextSubpass(commandBuffer: VkCommandBuffer, contents: VkSubpassContents) void; pub extern fn vkCmdEndRenderPass(commandBuffer: VkCommandBuffer) void; pub extern fn vkCmdExecuteCommands(commandBuffer: VkCommandBuffer, commandBufferCount: u32, pCommandBuffers: ?[*]const VkCommandBuffer) void; pub const struct_VkSamplerYcbcrConversion_T = opaque {}; pub const VkSamplerYcbcrConversion = ?*struct_VkSamplerYcbcrConversion_T; pub const struct_VkDescriptorUpdateTemplate_T = opaque {}; pub const VkDescriptorUpdateTemplate = ?*struct_VkDescriptorUpdateTemplate_T; pub const VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES; pub const VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY; pub const VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR; pub const VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR; pub const VK_POINT_CLIPPING_BEHAVIOR_BEGIN_RANGE = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_BEGIN_RANGE; pub const VK_POINT_CLIPPING_BEHAVIOR_END_RANGE = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_END_RANGE; pub const VK_POINT_CLIPPING_BEHAVIOR_RANGE_SIZE = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_RANGE_SIZE; pub const VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = enum_VkPointClippingBehavior.VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM; pub const enum_VkPointClippingBehavior = extern enum { VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0, VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1, VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = 0, VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = 1, VK_POINT_CLIPPING_BEHAVIOR_BEGIN_RANGE = 0, VK_POINT_CLIPPING_BEHAVIOR_END_RANGE = 1, VK_POINT_CLIPPING_BEHAVIOR_RANGE_SIZE = 2, VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = 2147483647, }; pub const VkPointClippingBehavior = enum_VkPointClippingBehavior; pub const VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT; pub const VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT; pub const VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR; pub const VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR; pub const VK_TESSELLATION_DOMAIN_ORIGIN_BEGIN_RANGE = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_BEGIN_RANGE; pub const VK_TESSELLATION_DOMAIN_ORIGIN_END_RANGE = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_END_RANGE; pub const VK_TESSELLATION_DOMAIN_ORIGIN_RANGE_SIZE = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_RANGE_SIZE; pub const VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = enum_VkTessellationDomainOrigin.VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM; pub const enum_VkTessellationDomainOrigin = extern enum { VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = 0, VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1, VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR = 0, VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR = 1, VK_TESSELLATION_DOMAIN_ORIGIN_BEGIN_RANGE = 0, VK_TESSELLATION_DOMAIN_ORIGIN_END_RANGE = 1, VK_TESSELLATION_DOMAIN_ORIGIN_RANGE_SIZE = 2, VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = 2147483647, }; pub const VkTessellationDomainOrigin = enum_VkTessellationDomainOrigin; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_BEGIN_RANGE = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_BEGIN_RANGE; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_END_RANGE = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_END_RANGE; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_RANGE_SIZE = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_RANGE_SIZE; pub const VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = enum_VkSamplerYcbcrModelConversion.VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM; pub const enum_VkSamplerYcbcrModelConversion = extern enum { VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = 1, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = 2, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = 3, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4, VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR = 0, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR = 1, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR = 2, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR = 3, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR = 4, VK_SAMPLER_YCBCR_MODEL_CONVERSION_BEGIN_RANGE = 0, VK_SAMPLER_YCBCR_MODEL_CONVERSION_END_RANGE = 4, VK_SAMPLER_YCBCR_MODEL_CONVERSION_RANGE_SIZE = 5, VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = 2147483647, }; pub const VkSamplerYcbcrModelConversion = enum_VkSamplerYcbcrModelConversion; pub const VK_SAMPLER_YCBCR_RANGE_ITU_FULL = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_ITU_FULL; pub const VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_ITU_NARROW; pub const VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR; pub const VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR; pub const VK_SAMPLER_YCBCR_RANGE_BEGIN_RANGE = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_BEGIN_RANGE; pub const VK_SAMPLER_YCBCR_RANGE_END_RANGE = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_END_RANGE; pub const VK_SAMPLER_YCBCR_RANGE_RANGE_SIZE = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_RANGE_SIZE; pub const VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = enum_VkSamplerYcbcrRange.VK_SAMPLER_YCBCR_RANGE_MAX_ENUM; pub const enum_VkSamplerYcbcrRange = extern enum { VK_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1, VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR = 0, VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR = 1, VK_SAMPLER_YCBCR_RANGE_BEGIN_RANGE = 0, VK_SAMPLER_YCBCR_RANGE_END_RANGE = 1, VK_SAMPLER_YCBCR_RANGE_RANGE_SIZE = 2, VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = 2147483647, }; pub const VkSamplerYcbcrRange = enum_VkSamplerYcbcrRange; pub const VK_CHROMA_LOCATION_COSITED_EVEN = enum_VkChromaLocation.VK_CHROMA_LOCATION_COSITED_EVEN; pub const VK_CHROMA_LOCATION_MIDPOINT = enum_VkChromaLocation.VK_CHROMA_LOCATION_MIDPOINT; pub const VK_CHROMA_LOCATION_COSITED_EVEN_KHR = enum_VkChromaLocation.VK_CHROMA_LOCATION_COSITED_EVEN_KHR; pub const VK_CHROMA_LOCATION_MIDPOINT_KHR = enum_VkChromaLocation.VK_CHROMA_LOCATION_MIDPOINT_KHR; pub const VK_CHROMA_LOCATION_BEGIN_RANGE = enum_VkChromaLocation.VK_CHROMA_LOCATION_BEGIN_RANGE; pub const VK_CHROMA_LOCATION_END_RANGE = enum_VkChromaLocation.VK_CHROMA_LOCATION_END_RANGE; pub const VK_CHROMA_LOCATION_RANGE_SIZE = enum_VkChromaLocation.VK_CHROMA_LOCATION_RANGE_SIZE; pub const VK_CHROMA_LOCATION_MAX_ENUM = enum_VkChromaLocation.VK_CHROMA_LOCATION_MAX_ENUM; pub const enum_VkChromaLocation = extern enum { VK_CHROMA_LOCATION_COSITED_EVEN = 0, VK_CHROMA_LOCATION_MIDPOINT = 1, VK_CHROMA_LOCATION_COSITED_EVEN_KHR = 0, VK_CHROMA_LOCATION_MIDPOINT_KHR = 1, VK_CHROMA_LOCATION_BEGIN_RANGE = 0, VK_CHROMA_LOCATION_END_RANGE = 1, VK_CHROMA_LOCATION_RANGE_SIZE = 2, VK_CHROMA_LOCATION_MAX_ENUM = 2147483647, }; pub const VkChromaLocation = enum_VkChromaLocation; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE; pub const VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = enum_VkDescriptorUpdateTemplateType.VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM; pub const enum_VkDescriptorUpdateTemplateType = extern enum { VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = 0, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE = 0, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE = 0, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE = 1, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = 2147483647, }; pub const VkDescriptorUpdateTemplateType = enum_VkDescriptorUpdateTemplateType; pub const VK_SUBGROUP_FEATURE_BASIC_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_BASIC_BIT; pub const VK_SUBGROUP_FEATURE_VOTE_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_VOTE_BIT; pub const VK_SUBGROUP_FEATURE_ARITHMETIC_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_ARITHMETIC_BIT; pub const VK_SUBGROUP_FEATURE_BALLOT_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_BALLOT_BIT; pub const VK_SUBGROUP_FEATURE_SHUFFLE_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_SHUFFLE_BIT; pub const VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT; pub const VK_SUBGROUP_FEATURE_CLUSTERED_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_CLUSTERED_BIT; pub const VK_SUBGROUP_FEATURE_QUAD_BIT = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_QUAD_BIT; pub const VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV; pub const VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = enum_VkSubgroupFeatureFlagBits.VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM; pub const enum_VkSubgroupFeatureFlagBits = extern enum { VK_SUBGROUP_FEATURE_BASIC_BIT = 1, VK_SUBGROUP_FEATURE_VOTE_BIT = 2, VK_SUBGROUP_FEATURE_ARITHMETIC_BIT = 4, VK_SUBGROUP_FEATURE_BALLOT_BIT = 8, VK_SUBGROUP_FEATURE_SHUFFLE_BIT = 16, VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = 32, VK_SUBGROUP_FEATURE_CLUSTERED_BIT = 64, VK_SUBGROUP_FEATURE_QUAD_BIT = 128, VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV = 256, VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkSubgroupFeatureFlagBits = enum_VkSubgroupFeatureFlagBits; pub const VkSubgroupFeatureFlags = VkFlags; pub const VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT; pub const VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_COPY_DST_BIT; pub const VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT; pub const VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT; pub const VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR; pub const VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR; pub const VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR; pub const VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR; pub const VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = enum_VkPeerMemoryFeatureFlagBits.VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM; pub const enum_VkPeerMemoryFeatureFlagBits = extern enum { VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = 1, VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = 2, VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = 4, VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 8, VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR = 1, VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR = 2, VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR = 4, VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR = 8, VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkPeerMemoryFeatureFlagBits = enum_VkPeerMemoryFeatureFlagBits; pub const VkPeerMemoryFeatureFlags = VkFlags; pub const VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = enum_VkMemoryAllocateFlagBits.VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT; pub const VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR = enum_VkMemoryAllocateFlagBits.VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR; pub const VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = enum_VkMemoryAllocateFlagBits.VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM; pub const enum_VkMemoryAllocateFlagBits = extern enum { VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 1, VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR = 1, VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkMemoryAllocateFlagBits = enum_VkMemoryAllocateFlagBits; pub const VkMemoryAllocateFlags = VkFlags; pub const VkCommandPoolTrimFlags = VkFlags; pub const VkDescriptorUpdateTemplateCreateFlags = VkFlags; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = enum_VkExternalMemoryHandleTypeFlagBits.VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM; pub const enum_VkExternalMemoryHandleTypeFlagBits = extern enum { VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = 8, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = 16, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = 32, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 64, VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT = 512, VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID = 1024, VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = 128, VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 256, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 1, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 2, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 4, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = 8, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 16, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 32, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 64, VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkExternalMemoryHandleTypeFlagBits = enum_VkExternalMemoryHandleTypeFlagBits; pub const VkExternalMemoryHandleTypeFlags = VkFlags; pub const VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT; pub const VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; pub const VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT; pub const VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR; pub const VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR; pub const VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR; pub const VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = enum_VkExternalMemoryFeatureFlagBits.VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM; pub const enum_VkExternalMemoryFeatureFlagBits = extern enum { VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = 1, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = 2, VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 4, VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = 1, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = 2, VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = 4, VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkExternalMemoryFeatureFlagBits = enum_VkExternalMemoryFeatureFlagBits; pub const VkExternalMemoryFeatureFlags = VkFlags; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR; pub const VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = enum_VkExternalFenceHandleTypeFlagBits.VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM; pub const enum_VkExternalFenceHandleTypeFlagBits = extern enum { VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 8, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 1, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 2, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 4, VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 8, VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkExternalFenceHandleTypeFlagBits = enum_VkExternalFenceHandleTypeFlagBits; pub const VkExternalFenceHandleTypeFlags = VkFlags; pub const VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = enum_VkExternalFenceFeatureFlagBits.VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT; pub const VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = enum_VkExternalFenceFeatureFlagBits.VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT; pub const VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = enum_VkExternalFenceFeatureFlagBits.VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR; pub const VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = enum_VkExternalFenceFeatureFlagBits.VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR; pub const VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = enum_VkExternalFenceFeatureFlagBits.VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM; pub const enum_VkExternalFenceFeatureFlagBits = extern enum { VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = 1, VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 2, VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = 1, VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = 2, VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkExternalFenceFeatureFlagBits = enum_VkExternalFenceFeatureFlagBits; pub const VkExternalFenceFeatureFlags = VkFlags; pub const VK_FENCE_IMPORT_TEMPORARY_BIT = enum_VkFenceImportFlagBits.VK_FENCE_IMPORT_TEMPORARY_BIT; pub const VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = enum_VkFenceImportFlagBits.VK_FENCE_IMPORT_TEMPORARY_BIT_KHR; pub const VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = enum_VkFenceImportFlagBits.VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM; pub const enum_VkFenceImportFlagBits = extern enum { VK_FENCE_IMPORT_TEMPORARY_BIT = 1, VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 1, VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkFenceImportFlagBits = enum_VkFenceImportFlagBits; pub const VkFenceImportFlags = VkFlags; pub const VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = enum_VkSemaphoreImportFlagBits.VK_SEMAPHORE_IMPORT_TEMPORARY_BIT; pub const VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = enum_VkSemaphoreImportFlagBits.VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR; pub const VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = enum_VkSemaphoreImportFlagBits.VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM; pub const enum_VkSemaphoreImportFlagBits = extern enum { VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 1, VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = 1, VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkSemaphoreImportFlagBits = enum_VkSemaphoreImportFlagBits; pub const VkSemaphoreImportFlags = VkFlags; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = enum_VkExternalSemaphoreHandleTypeFlagBits.VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM; pub const enum_VkExternalSemaphoreHandleTypeFlagBits = extern enum { VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = 8, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 16, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 1, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 2, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 4, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 8, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 16, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkExternalSemaphoreHandleTypeFlagBits = enum_VkExternalSemaphoreHandleTypeFlagBits; pub const VkExternalSemaphoreHandleTypeFlags = VkFlags; pub const VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = enum_VkExternalSemaphoreFeatureFlagBits.VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT; pub const VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = enum_VkExternalSemaphoreFeatureFlagBits.VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT; pub const VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = enum_VkExternalSemaphoreFeatureFlagBits.VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = enum_VkExternalSemaphoreFeatureFlagBits.VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR; pub const VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = enum_VkExternalSemaphoreFeatureFlagBits.VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM; pub const enum_VkExternalSemaphoreFeatureFlagBits = extern enum { VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = 1, VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 2, VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = 1, VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = 2, VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = 2147483647, }; pub const VkExternalSemaphoreFeatureFlagBits = enum_VkExternalSemaphoreFeatureFlagBits; pub const VkExternalSemaphoreFeatureFlags = VkFlags; pub const struct_VkPhysicalDeviceSubgroupProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, subgroupSize: u32, supportedStages: VkShaderStageFlags, supportedOperations: VkSubgroupFeatureFlags, quadOperationsInAllStages: VkBool32, }; pub const VkPhysicalDeviceSubgroupProperties = struct_VkPhysicalDeviceSubgroupProperties; pub const struct_VkBindBufferMemoryInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, buffer: VkBuffer, memory: VkDeviceMemory, memoryOffset: VkDeviceSize, }; pub const VkBindBufferMemoryInfo = struct_VkBindBufferMemoryInfo; pub const struct_VkBindImageMemoryInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, image: VkImage, memory: VkDeviceMemory, memoryOffset: VkDeviceSize, }; pub const VkBindImageMemoryInfo = struct_VkBindImageMemoryInfo; pub const struct_VkPhysicalDevice16BitStorageFeatures = extern struct { sType: VkStructureType, pNext: ?*c_void, storageBuffer16BitAccess: VkBool32, uniformAndStorageBuffer16BitAccess: VkBool32, storagePushConstant16: VkBool32, storageInputOutput16: VkBool32, }; pub const VkPhysicalDevice16BitStorageFeatures = struct_VkPhysicalDevice16BitStorageFeatures; pub const struct_VkMemoryDedicatedRequirements = extern struct { sType: VkStructureType, pNext: ?*c_void, prefersDedicatedAllocation: VkBool32, requiresDedicatedAllocation: VkBool32, }; pub const VkMemoryDedicatedRequirements = struct_VkMemoryDedicatedRequirements; pub const struct_VkMemoryDedicatedAllocateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, image: VkImage, buffer: VkBuffer, }; pub const VkMemoryDedicatedAllocateInfo = struct_VkMemoryDedicatedAllocateInfo; pub const struct_VkMemoryAllocateFlagsInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkMemoryAllocateFlags, deviceMask: u32, }; pub const VkMemoryAllocateFlagsInfo = struct_VkMemoryAllocateFlagsInfo; pub const struct_VkDeviceGroupRenderPassBeginInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, deviceMask: u32, deviceRenderAreaCount: u32, pDeviceRenderAreas: ?[*]const VkRect2D, }; pub const VkDeviceGroupRenderPassBeginInfo = struct_VkDeviceGroupRenderPassBeginInfo; pub const struct_VkDeviceGroupCommandBufferBeginInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, deviceMask: u32, }; pub const VkDeviceGroupCommandBufferBeginInfo = struct_VkDeviceGroupCommandBufferBeginInfo; pub const struct_VkDeviceGroupSubmitInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, waitSemaphoreCount: u32, pWaitSemaphoreDeviceIndices: ?[*]const u32, commandBufferCount: u32, pCommandBufferDeviceMasks: ?[*]const u32, signalSemaphoreCount: u32, pSignalSemaphoreDeviceIndices: ?[*]const u32, }; pub const VkDeviceGroupSubmitInfo = struct_VkDeviceGroupSubmitInfo; pub const struct_VkDeviceGroupBindSparseInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, resourceDeviceIndex: u32, memoryDeviceIndex: u32, }; pub const VkDeviceGroupBindSparseInfo = struct_VkDeviceGroupBindSparseInfo; pub const struct_VkBindBufferMemoryDeviceGroupInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, deviceIndexCount: u32, pDeviceIndices: ?[*]const u32, }; pub const VkBindBufferMemoryDeviceGroupInfo = struct_VkBindBufferMemoryDeviceGroupInfo; pub const struct_VkBindImageMemoryDeviceGroupInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, deviceIndexCount: u32, pDeviceIndices: ?[*]const u32, splitInstanceBindRegionCount: u32, pSplitInstanceBindRegions: ?[*]const VkRect2D, }; pub const VkBindImageMemoryDeviceGroupInfo = struct_VkBindImageMemoryDeviceGroupInfo; pub const struct_VkPhysicalDeviceGroupProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, physicalDeviceCount: u32, physicalDevices: [32]VkPhysicalDevice, subsetAllocation: VkBool32, }; pub const VkPhysicalDeviceGroupProperties = struct_VkPhysicalDeviceGroupProperties; pub const struct_VkDeviceGroupDeviceCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, physicalDeviceCount: u32, pPhysicalDevices: ?[*]const VkPhysicalDevice, }; pub const VkDeviceGroupDeviceCreateInfo = struct_VkDeviceGroupDeviceCreateInfo; pub const struct_VkBufferMemoryRequirementsInfo2 = extern struct { sType: VkStructureType, pNext: ?*const c_void, buffer: VkBuffer, }; pub const VkBufferMemoryRequirementsInfo2 = struct_VkBufferMemoryRequirementsInfo2; pub const struct_VkImageMemoryRequirementsInfo2 = extern struct { sType: VkStructureType, pNext: ?*const c_void, image: VkImage, }; pub const VkImageMemoryRequirementsInfo2 = struct_VkImageMemoryRequirementsInfo2; pub const struct_VkImageSparseMemoryRequirementsInfo2 = extern struct { sType: VkStructureType, pNext: ?*const c_void, image: VkImage, }; pub const VkImageSparseMemoryRequirementsInfo2 = struct_VkImageSparseMemoryRequirementsInfo2; pub const struct_VkMemoryRequirements2 = extern struct { sType: VkStructureType, pNext: ?*c_void, memoryRequirements: VkMemoryRequirements, }; pub const VkMemoryRequirements2 = struct_VkMemoryRequirements2; pub const struct_VkSparseImageMemoryRequirements2 = extern struct { sType: VkStructureType, pNext: ?*c_void, memoryRequirements: VkSparseImageMemoryRequirements, }; pub const VkSparseImageMemoryRequirements2 = struct_VkSparseImageMemoryRequirements2; pub const struct_VkPhysicalDeviceFeatures2 = extern struct { sType: VkStructureType, pNext: ?*c_void, features: VkPhysicalDeviceFeatures, }; pub const VkPhysicalDeviceFeatures2 = struct_VkPhysicalDeviceFeatures2; pub const struct_VkPhysicalDeviceProperties2 = extern struct { sType: VkStructureType, pNext: ?*c_void, properties: VkPhysicalDeviceProperties, }; pub const VkPhysicalDeviceProperties2 = struct_VkPhysicalDeviceProperties2; pub const struct_VkFormatProperties2 = extern struct { sType: VkStructureType, pNext: ?*c_void, formatProperties: VkFormatProperties, }; pub const VkFormatProperties2 = struct_VkFormatProperties2; pub const struct_VkImageFormatProperties2 = extern struct { sType: VkStructureType, pNext: ?*c_void, imageFormatProperties: VkImageFormatProperties, }; pub const VkImageFormatProperties2 = struct_VkImageFormatProperties2; pub const struct_VkPhysicalDeviceImageFormatInfo2 = extern struct { sType: VkStructureType, pNext: ?*const c_void, format: VkFormat, type: VkImageType, tiling: VkImageTiling, usage: VkImageUsageFlags, flags: VkImageCreateFlags, }; pub const VkPhysicalDeviceImageFormatInfo2 = struct_VkPhysicalDeviceImageFormatInfo2; pub const struct_VkQueueFamilyProperties2 = extern struct { sType: VkStructureType, pNext: ?*c_void, queueFamilyProperties: VkQueueFamilyProperties, }; pub const VkQueueFamilyProperties2 = struct_VkQueueFamilyProperties2; pub const struct_VkPhysicalDeviceMemoryProperties2 = extern struct { sType: VkStructureType, pNext: ?*c_void, memoryProperties: VkPhysicalDeviceMemoryProperties, }; pub const VkPhysicalDeviceMemoryProperties2 = struct_VkPhysicalDeviceMemoryProperties2; pub const struct_VkSparseImageFormatProperties2 = extern struct { sType: VkStructureType, pNext: ?*c_void, properties: VkSparseImageFormatProperties, }; pub const VkSparseImageFormatProperties2 = struct_VkSparseImageFormatProperties2; pub const struct_VkPhysicalDeviceSparseImageFormatInfo2 = extern struct { sType: VkStructureType, pNext: ?*const c_void, format: VkFormat, type: VkImageType, samples: VkSampleCountFlagBits, usage: VkImageUsageFlags, tiling: VkImageTiling, }; pub const VkPhysicalDeviceSparseImageFormatInfo2 = struct_VkPhysicalDeviceSparseImageFormatInfo2; pub const struct_VkPhysicalDevicePointClippingProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, pointClippingBehavior: VkPointClippingBehavior, }; pub const VkPhysicalDevicePointClippingProperties = struct_VkPhysicalDevicePointClippingProperties; pub const struct_VkInputAttachmentAspectReference = extern struct { subpass: u32, inputAttachmentIndex: u32, aspectMask: VkImageAspectFlags, }; pub const VkInputAttachmentAspectReference = struct_VkInputAttachmentAspectReference; pub const struct_VkRenderPassInputAttachmentAspectCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, aspectReferenceCount: u32, pAspectReferences: ?[*]const VkInputAttachmentAspectReference, }; pub const VkRenderPassInputAttachmentAspectCreateInfo = struct_VkRenderPassInputAttachmentAspectCreateInfo; pub const struct_VkImageViewUsageCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, usage: VkImageUsageFlags, }; pub const VkImageViewUsageCreateInfo = struct_VkImageViewUsageCreateInfo; pub const struct_VkPipelineTessellationDomainOriginStateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, domainOrigin: VkTessellationDomainOrigin, }; pub const VkPipelineTessellationDomainOriginStateCreateInfo = struct_VkPipelineTessellationDomainOriginStateCreateInfo; pub const struct_VkRenderPassMultiviewCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, subpassCount: u32, pViewMasks: ?[*]const u32, dependencyCount: u32, pViewOffsets: ?[*]const i32, correlationMaskCount: u32, pCorrelationMasks: ?[*]const u32, }; pub const VkRenderPassMultiviewCreateInfo = struct_VkRenderPassMultiviewCreateInfo; pub const struct_VkPhysicalDeviceMultiviewFeatures = extern struct { sType: VkStructureType, pNext: ?*c_void, multiview: VkBool32, multiviewGeometryShader: VkBool32, multiviewTessellationShader: VkBool32, }; pub const VkPhysicalDeviceMultiviewFeatures = struct_VkPhysicalDeviceMultiviewFeatures; pub const struct_VkPhysicalDeviceMultiviewProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, maxMultiviewViewCount: u32, maxMultiviewInstanceIndex: u32, }; pub const VkPhysicalDeviceMultiviewProperties = struct_VkPhysicalDeviceMultiviewProperties; pub const struct_VkPhysicalDeviceVariablePointerFeatures = extern struct { sType: VkStructureType, pNext: ?*c_void, variablePointersStorageBuffer: VkBool32, variablePointers: VkBool32, }; pub const VkPhysicalDeviceVariablePointerFeatures = struct_VkPhysicalDeviceVariablePointerFeatures; pub const struct_VkPhysicalDeviceProtectedMemoryFeatures = extern struct { sType: VkStructureType, pNext: ?*c_void, protectedMemory: VkBool32, }; pub const VkPhysicalDeviceProtectedMemoryFeatures = struct_VkPhysicalDeviceProtectedMemoryFeatures; pub const struct_VkPhysicalDeviceProtectedMemoryProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, protectedNoFault: VkBool32, }; pub const VkPhysicalDeviceProtectedMemoryProperties = struct_VkPhysicalDeviceProtectedMemoryProperties; pub const struct_VkDeviceQueueInfo2 = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDeviceQueueCreateFlags, queueFamilyIndex: u32, queueIndex: u32, }; pub const VkDeviceQueueInfo2 = struct_VkDeviceQueueInfo2; pub const struct_VkProtectedSubmitInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, protectedSubmit: VkBool32, }; pub const VkProtectedSubmitInfo = struct_VkProtectedSubmitInfo; pub const struct_VkSamplerYcbcrConversionCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, format: VkFormat, ycbcrModel: VkSamplerYcbcrModelConversion, ycbcrRange: VkSamplerYcbcrRange, components: VkComponentMapping, xChromaOffset: VkChromaLocation, yChromaOffset: VkChromaLocation, chromaFilter: VkFilter, forceExplicitReconstruction: VkBool32, }; pub const VkSamplerYcbcrConversionCreateInfo = struct_VkSamplerYcbcrConversionCreateInfo; pub const struct_VkSamplerYcbcrConversionInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, conversion: VkSamplerYcbcrConversion, }; pub const VkSamplerYcbcrConversionInfo = struct_VkSamplerYcbcrConversionInfo; pub const struct_VkBindImagePlaneMemoryInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, planeAspect: VkImageAspectFlagBits, }; pub const VkBindImagePlaneMemoryInfo = struct_VkBindImagePlaneMemoryInfo; pub const struct_VkImagePlaneMemoryRequirementsInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, planeAspect: VkImageAspectFlagBits, }; pub const VkImagePlaneMemoryRequirementsInfo = struct_VkImagePlaneMemoryRequirementsInfo; pub const struct_VkPhysicalDeviceSamplerYcbcrConversionFeatures = extern struct { sType: VkStructureType, pNext: ?*c_void, samplerYcbcrConversion: VkBool32, }; pub const VkPhysicalDeviceSamplerYcbcrConversionFeatures = struct_VkPhysicalDeviceSamplerYcbcrConversionFeatures; pub const struct_VkSamplerYcbcrConversionImageFormatProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, combinedImageSamplerDescriptorCount: u32, }; pub const VkSamplerYcbcrConversionImageFormatProperties = struct_VkSamplerYcbcrConversionImageFormatProperties; pub const struct_VkDescriptorUpdateTemplateEntry = extern struct { dstBinding: u32, dstArrayElement: u32, descriptorCount: u32, descriptorType: VkDescriptorType, offset: usize, stride: usize, }; pub const VkDescriptorUpdateTemplateEntry = struct_VkDescriptorUpdateTemplateEntry; pub const struct_VkDescriptorUpdateTemplateCreateInfo = extern struct { sType: VkStructureType, pNext: ?*c_void, flags: VkDescriptorUpdateTemplateCreateFlags, descriptorUpdateEntryCount: u32, pDescriptorUpdateEntries: ?[*]const VkDescriptorUpdateTemplateEntry, templateType: VkDescriptorUpdateTemplateType, descriptorSetLayout: VkDescriptorSetLayout, pipelineBindPoint: VkPipelineBindPoint, pipelineLayout: VkPipelineLayout, set: u32, }; pub const VkDescriptorUpdateTemplateCreateInfo = struct_VkDescriptorUpdateTemplateCreateInfo; pub const struct_VkExternalMemoryProperties = extern struct { externalMemoryFeatures: VkExternalMemoryFeatureFlags, exportFromImportedHandleTypes: VkExternalMemoryHandleTypeFlags, compatibleHandleTypes: VkExternalMemoryHandleTypeFlags, }; pub const VkExternalMemoryProperties = struct_VkExternalMemoryProperties; pub const struct_VkPhysicalDeviceExternalImageFormatInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleType: VkExternalMemoryHandleTypeFlagBits, }; pub const VkPhysicalDeviceExternalImageFormatInfo = struct_VkPhysicalDeviceExternalImageFormatInfo; pub const struct_VkExternalImageFormatProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, externalMemoryProperties: VkExternalMemoryProperties, }; pub const VkExternalImageFormatProperties = struct_VkExternalImageFormatProperties; pub const struct_VkPhysicalDeviceExternalBufferInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkBufferCreateFlags, usage: VkBufferUsageFlags, handleType: VkExternalMemoryHandleTypeFlagBits, }; pub const VkPhysicalDeviceExternalBufferInfo = struct_VkPhysicalDeviceExternalBufferInfo; pub const struct_VkExternalBufferProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, externalMemoryProperties: VkExternalMemoryProperties, }; pub const VkExternalBufferProperties = struct_VkExternalBufferProperties; pub const struct_VkPhysicalDeviceIDProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, deviceUUID: [16]u8, driverUUID: [16]u8, deviceLUID: [8]u8, deviceNodeMask: u32, deviceLUIDValid: VkBool32, }; pub const VkPhysicalDeviceIDProperties = struct_VkPhysicalDeviceIDProperties; pub const struct_VkExternalMemoryImageCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalMemoryHandleTypeFlags, }; pub const VkExternalMemoryImageCreateInfo = struct_VkExternalMemoryImageCreateInfo; pub const struct_VkExternalMemoryBufferCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalMemoryHandleTypeFlags, }; pub const VkExternalMemoryBufferCreateInfo = struct_VkExternalMemoryBufferCreateInfo; pub const struct_VkExportMemoryAllocateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalMemoryHandleTypeFlags, }; pub const VkExportMemoryAllocateInfo = struct_VkExportMemoryAllocateInfo; pub const struct_VkPhysicalDeviceExternalFenceInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleType: VkExternalFenceHandleTypeFlagBits, }; pub const VkPhysicalDeviceExternalFenceInfo = struct_VkPhysicalDeviceExternalFenceInfo; pub const struct_VkExternalFenceProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, exportFromImportedHandleTypes: VkExternalFenceHandleTypeFlags, compatibleHandleTypes: VkExternalFenceHandleTypeFlags, externalFenceFeatures: VkExternalFenceFeatureFlags, }; pub const VkExternalFenceProperties = struct_VkExternalFenceProperties; pub const struct_VkExportFenceCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalFenceHandleTypeFlags, }; pub const VkExportFenceCreateInfo = struct_VkExportFenceCreateInfo; pub const struct_VkExportSemaphoreCreateInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalSemaphoreHandleTypeFlags, }; pub const VkExportSemaphoreCreateInfo = struct_VkExportSemaphoreCreateInfo; pub const struct_VkPhysicalDeviceExternalSemaphoreInfo = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleType: VkExternalSemaphoreHandleTypeFlagBits, }; pub const VkPhysicalDeviceExternalSemaphoreInfo = struct_VkPhysicalDeviceExternalSemaphoreInfo; pub const struct_VkExternalSemaphoreProperties = extern struct { sType: VkStructureType, pNext: ?*c_void, exportFromImportedHandleTypes: VkExternalSemaphoreHandleTypeFlags, compatibleHandleTypes: VkExternalSemaphoreHandleTypeFlags, externalSemaphoreFeatures: VkExternalSemaphoreFeatureFlags, }; pub const VkExternalSemaphoreProperties = struct_VkExternalSemaphoreProperties; pub const struct_VkPhysicalDeviceMaintenance3Properties = extern struct { sType: VkStructureType, pNext: ?*c_void, maxPerSetDescriptors: u32, maxMemoryAllocationSize: VkDeviceSize, }; pub const VkPhysicalDeviceMaintenance3Properties = struct_VkPhysicalDeviceMaintenance3Properties; pub const struct_VkDescriptorSetLayoutSupport = extern struct { sType: VkStructureType, pNext: ?*c_void, supported: VkBool32, }; pub const VkDescriptorSetLayoutSupport = struct_VkDescriptorSetLayoutSupport; pub const struct_VkPhysicalDeviceShaderDrawParameterFeatures = extern struct { sType: VkStructureType, pNext: ?*c_void, shaderDrawParameters: VkBool32, }; pub const VkPhysicalDeviceShaderDrawParameterFeatures = struct_VkPhysicalDeviceShaderDrawParameterFeatures; pub const PFN_vkEnumerateInstanceVersion = ?fn (?[*]u32) callconv(.C) VkResult; pub const PFN_vkBindBufferMemory2 = ?fn (VkDevice, u32, ?[*]const VkBindBufferMemoryInfo) callconv(.C) VkResult; pub const PFN_vkBindImageMemory2 = ?fn (VkDevice, u32, ?[*]const VkBindImageMemoryInfo) callconv(.C) VkResult; pub const PFN_vkGetDeviceGroupPeerMemoryFeatures = ?fn (VkDevice, u32, u32, u32, ?[*]VkPeerMemoryFeatureFlags) callconv(.C) void; pub const PFN_vkCmdSetDeviceMask = ?fn (VkCommandBuffer, u32) callconv(.C) void; pub const PFN_vkCmdDispatchBase = ?fn (VkCommandBuffer, u32, u32, u32, u32, u32, u32) callconv(.C) void; pub const PFN_vkEnumeratePhysicalDeviceGroups = ?fn (VkInstance, ?[*]u32, ?[*]VkPhysicalDeviceGroupProperties) callconv(.C) VkResult; pub const PFN_vkGetImageMemoryRequirements2 = ?fn (VkDevice, ?[*]const VkImageMemoryRequirementsInfo2, ?[*]VkMemoryRequirements2) callconv(.C) void; pub const PFN_vkGetBufferMemoryRequirements2 = ?fn (VkDevice, ?[*]const VkBufferMemoryRequirementsInfo2, ?[*]VkMemoryRequirements2) callconv(.C) void; pub const PFN_vkGetImageSparseMemoryRequirements2 = ?fn (VkDevice, ?[*]const VkImageSparseMemoryRequirementsInfo2, ?[*]u32, ?[*]VkSparseImageMemoryRequirements2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceFeatures2 = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceFeatures2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceProperties2 = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceFormatProperties2 = ?fn (VkPhysicalDevice, VkFormat, ?[*]VkFormatProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceImageFormatProperties2 = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceImageFormatInfo2, ?[*]VkImageFormatProperties2) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceQueueFamilyProperties2 = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkQueueFamilyProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceMemoryProperties2 = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceMemoryProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceSparseImageFormatInfo2, ?[*]u32, ?[*]VkSparseImageFormatProperties2) callconv(.C) void; pub const PFN_vkTrimCommandPool = ?fn (VkDevice, VkCommandPool, VkCommandPoolTrimFlags) callconv(.C) void; pub const PFN_vkGetDeviceQueue2 = ?fn (VkDevice, ?[*]const VkDeviceQueueInfo2, ?[*]VkQueue) callconv(.C) void; pub const PFN_vkCreateSamplerYcbcrConversion = ?fn (VkDevice, ?[*]const VkSamplerYcbcrConversionCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkSamplerYcbcrConversion) callconv(.C) VkResult; pub const PFN_vkDestroySamplerYcbcrConversion = ?fn (VkDevice, VkSamplerYcbcrConversion, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateDescriptorUpdateTemplate = ?fn (VkDevice, ?[*]const VkDescriptorUpdateTemplateCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkDescriptorUpdateTemplate) callconv(.C) VkResult; pub const PFN_vkDestroyDescriptorUpdateTemplate = ?fn (VkDevice, VkDescriptorUpdateTemplate, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkUpdateDescriptorSetWithTemplate = ?fn (VkDevice, VkDescriptorSet, VkDescriptorUpdateTemplate, ?*const c_void) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceExternalBufferProperties = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceExternalBufferInfo, ?[*]VkExternalBufferProperties) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceExternalFenceProperties = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceExternalFenceInfo, ?[*]VkExternalFenceProperties) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceExternalSemaphoreProperties = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceExternalSemaphoreInfo, ?[*]VkExternalSemaphoreProperties) callconv(.C) void; pub const PFN_vkGetDescriptorSetLayoutSupport = ?fn (VkDevice, ?[*]const VkDescriptorSetLayoutCreateInfo, ?[*]VkDescriptorSetLayoutSupport) callconv(.C) void; pub extern fn vkEnumerateInstanceVersion(pApiVersion: ?[*]u32) VkResult; pub extern fn vkBindBufferMemory2(device: VkDevice, bindInfoCount: u32, pBindInfos: ?[*]const VkBindBufferMemoryInfo) VkResult; pub extern fn vkBindImageMemory2(device: VkDevice, bindInfoCount: u32, pBindInfos: ?[*]const VkBindImageMemoryInfo) VkResult; pub extern fn vkGetDeviceGroupPeerMemoryFeatures(device: VkDevice, heapIndex: u32, localDeviceIndex: u32, remoteDeviceIndex: u32, pPeerMemoryFeatures: ?[*]VkPeerMemoryFeatureFlags) void; pub extern fn vkCmdSetDeviceMask(commandBuffer: VkCommandBuffer, deviceMask: u32) void; pub extern fn vkCmdDispatchBase(commandBuffer: VkCommandBuffer, baseGroupX: u32, baseGroupY: u32, baseGroupZ: u32, groupCountX: u32, groupCountY: u32, groupCountZ: u32) void; pub extern fn vkEnumeratePhysicalDeviceGroups(instance: VkInstance, pPhysicalDeviceGroupCount: ?[*]u32, pPhysicalDeviceGroupProperties: ?[*]VkPhysicalDeviceGroupProperties) VkResult; pub extern fn vkGetImageMemoryRequirements2(device: VkDevice, pInfo: ?[*]const VkImageMemoryRequirementsInfo2, pMemoryRequirements: ?[*]VkMemoryRequirements2) void; pub extern fn vkGetBufferMemoryRequirements2(device: VkDevice, pInfo: ?[*]const VkBufferMemoryRequirementsInfo2, pMemoryRequirements: ?[*]VkMemoryRequirements2) void; pub extern fn vkGetImageSparseMemoryRequirements2(device: VkDevice, pInfo: ?[*]const VkImageSparseMemoryRequirementsInfo2, pSparseMemoryRequirementCount: ?[*]u32, pSparseMemoryRequirements: ?[*]VkSparseImageMemoryRequirements2) void; pub extern fn vkGetPhysicalDeviceFeatures2(physicalDevice: VkPhysicalDevice, pFeatures: ?[*]VkPhysicalDeviceFeatures2) void; pub extern fn vkGetPhysicalDeviceProperties2(physicalDevice: VkPhysicalDevice, pProperties: ?[*]VkPhysicalDeviceProperties2) void; pub extern fn vkGetPhysicalDeviceFormatProperties2(physicalDevice: VkPhysicalDevice, format: VkFormat, pFormatProperties: ?[*]VkFormatProperties2) void; pub extern fn vkGetPhysicalDeviceImageFormatProperties2(physicalDevice: VkPhysicalDevice, pImageFormatInfo: ?[*]const VkPhysicalDeviceImageFormatInfo2, pImageFormatProperties: ?[*]VkImageFormatProperties2) VkResult; pub extern fn vkGetPhysicalDeviceQueueFamilyProperties2(physicalDevice: VkPhysicalDevice, pQueueFamilyPropertyCount: ?[*]u32, pQueueFamilyProperties: ?[*]VkQueueFamilyProperties2) void; pub extern fn vkGetPhysicalDeviceMemoryProperties2(physicalDevice: VkPhysicalDevice, pMemoryProperties: ?[*]VkPhysicalDeviceMemoryProperties2) void; pub extern fn vkGetPhysicalDeviceSparseImageFormatProperties2(physicalDevice: VkPhysicalDevice, pFormatInfo: ?[*]const VkPhysicalDeviceSparseImageFormatInfo2, pPropertyCount: ?[*]u32, pProperties: ?[*]VkSparseImageFormatProperties2) void; pub extern fn vkTrimCommandPool(device: VkDevice, commandPool: VkCommandPool, flags: VkCommandPoolTrimFlags) void; pub extern fn vkGetDeviceQueue2(device: VkDevice, pQueueInfo: ?[*]const VkDeviceQueueInfo2, pQueue: ?[*]VkQueue) void; pub extern fn vkCreateSamplerYcbcrConversion(device: VkDevice, pCreateInfo: ?[*]const VkSamplerYcbcrConversionCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pYcbcrConversion: ?[*]VkSamplerYcbcrConversion) VkResult; pub extern fn vkDestroySamplerYcbcrConversion(device: VkDevice, ycbcrConversion: VkSamplerYcbcrConversion, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateDescriptorUpdateTemplate(device: VkDevice, pCreateInfo: ?[*]const VkDescriptorUpdateTemplateCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pDescriptorUpdateTemplate: ?[*]VkDescriptorUpdateTemplate) VkResult; pub extern fn vkDestroyDescriptorUpdateTemplate(device: VkDevice, descriptorUpdateTemplate: VkDescriptorUpdateTemplate, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkUpdateDescriptorSetWithTemplate(device: VkDevice, descriptorSet: VkDescriptorSet, descriptorUpdateTemplate: VkDescriptorUpdateTemplate, pData: ?*const c_void) void; pub extern fn vkGetPhysicalDeviceExternalBufferProperties(physicalDevice: VkPhysicalDevice, pExternalBufferInfo: ?[*]const VkPhysicalDeviceExternalBufferInfo, pExternalBufferProperties: ?[*]VkExternalBufferProperties) void; pub extern fn vkGetPhysicalDeviceExternalFenceProperties(physicalDevice: VkPhysicalDevice, pExternalFenceInfo: ?[*]const VkPhysicalDeviceExternalFenceInfo, pExternalFenceProperties: ?[*]VkExternalFenceProperties) void; pub extern fn vkGetPhysicalDeviceExternalSemaphoreProperties(physicalDevice: VkPhysicalDevice, pExternalSemaphoreInfo: ?[*]const VkPhysicalDeviceExternalSemaphoreInfo, pExternalSemaphoreProperties: ?[*]VkExternalSemaphoreProperties) void; pub extern fn vkGetDescriptorSetLayoutSupport(device: VkDevice, pCreateInfo: ?[*]const VkDescriptorSetLayoutCreateInfo, pSupport: ?[*]VkDescriptorSetLayoutSupport) void; pub const struct_VkSurfaceKHR_T = opaque {}; pub const VkSurfaceKHR = *struct_VkSurfaceKHR_T; pub const VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = enum_VkColorSpaceKHR.VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; pub const VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT; pub const VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT; pub const VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_DCI_P3_LINEAR_EXT; pub const VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT; pub const VK_COLOR_SPACE_BT709_LINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_BT709_LINEAR_EXT; pub const VK_COLOR_SPACE_BT709_NONLINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_BT709_NONLINEAR_EXT; pub const VK_COLOR_SPACE_BT2020_LINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_BT2020_LINEAR_EXT; pub const VK_COLOR_SPACE_HDR10_ST2084_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_HDR10_ST2084_EXT; pub const VK_COLOR_SPACE_DOLBYVISION_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_DOLBYVISION_EXT; pub const VK_COLOR_SPACE_HDR10_HLG_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_HDR10_HLG_EXT; pub const VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT; pub const VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT; pub const VK_COLOR_SPACE_PASS_THROUGH_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_PASS_THROUGH_EXT; pub const VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = enum_VkColorSpaceKHR.VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT; pub const VK_COLOR_SPACE_BEGIN_RANGE_KHR = enum_VkColorSpaceKHR.VK_COLOR_SPACE_BEGIN_RANGE_KHR; pub const VK_COLOR_SPACE_END_RANGE_KHR = enum_VkColorSpaceKHR.VK_COLOR_SPACE_END_RANGE_KHR; pub const VK_COLOR_SPACE_RANGE_SIZE_KHR = enum_VkColorSpaceKHR.VK_COLOR_SPACE_RANGE_SIZE_KHR; pub const VK_COLOR_SPACE_MAX_ENUM_KHR = enum_VkColorSpaceKHR.VK_COLOR_SPACE_MAX_ENUM_KHR; pub const enum_VkColorSpaceKHR = extern enum { VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104003, VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, VK_COLOR_SPACE_RANGE_SIZE_KHR = 1, VK_COLOR_SPACE_MAX_ENUM_KHR = 2147483647, }; pub const VkColorSpaceKHR = enum_VkColorSpaceKHR; pub const VK_PRESENT_MODE_IMMEDIATE_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_IMMEDIATE_KHR; pub const VK_PRESENT_MODE_MAILBOX_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_MAILBOX_KHR; pub const VK_PRESENT_MODE_FIFO_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_FIFO_KHR; pub const VK_PRESENT_MODE_FIFO_RELAXED_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_FIFO_RELAXED_KHR; pub const VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR; pub const VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR; pub const VK_PRESENT_MODE_BEGIN_RANGE_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_BEGIN_RANGE_KHR; pub const VK_PRESENT_MODE_END_RANGE_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_END_RANGE_KHR; pub const VK_PRESENT_MODE_RANGE_SIZE_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_RANGE_SIZE_KHR; pub const VK_PRESENT_MODE_MAX_ENUM_KHR = enum_VkPresentModeKHR.VK_PRESENT_MODE_MAX_ENUM_KHR; pub const enum_VkPresentModeKHR = extern enum { VK_PRESENT_MODE_IMMEDIATE_KHR = 0, VK_PRESENT_MODE_MAILBOX_KHR = 1, VK_PRESENT_MODE_FIFO_KHR = 2, VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, VK_PRESENT_MODE_RANGE_SIZE_KHR = 4, VK_PRESENT_MODE_MAX_ENUM_KHR = 2147483647, }; pub const VkPresentModeKHR = enum_VkPresentModeKHR; pub const VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; pub const VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR; pub const VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR; pub const VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR; pub const VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR; pub const VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR; pub const VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR; pub const VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR; pub const VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR; pub const VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = enum_VkSurfaceTransformFlagBitsKHR.VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR; pub const enum_VkSurfaceTransformFlagBitsKHR = extern enum { VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 1, VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 2, VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 4, VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 8, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 16, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 32, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 64, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 128, VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 256, VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 2147483647, }; pub const VkSurfaceTransformFlagBitsKHR = enum_VkSurfaceTransformFlagBitsKHR; pub const VkSurfaceTransformFlagsKHR = VkFlags; pub const VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = enum_VkCompositeAlphaFlagBitsKHR.VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; pub const VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = enum_VkCompositeAlphaFlagBitsKHR.VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR; pub const VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = enum_VkCompositeAlphaFlagBitsKHR.VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR; pub const VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = enum_VkCompositeAlphaFlagBitsKHR.VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR; pub const VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = enum_VkCompositeAlphaFlagBitsKHR.VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR; pub const enum_VkCompositeAlphaFlagBitsKHR = extern enum { VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 1, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 2, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 4, VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 8, VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 2147483647, }; pub const VkCompositeAlphaFlagBitsKHR = enum_VkCompositeAlphaFlagBitsKHR; pub const VkCompositeAlphaFlagsKHR = VkFlags; pub const struct_VkSurfaceCapabilitiesKHR = extern struct { minImageCount: u32, maxImageCount: u32, currentExtent: VkExtent2D, minImageExtent: VkExtent2D, maxImageExtent: VkExtent2D, maxImageArrayLayers: u32, supportedTransforms: VkSurfaceTransformFlagsKHR, currentTransform: VkSurfaceTransformFlagBitsKHR, supportedCompositeAlpha: VkCompositeAlphaFlagsKHR, supportedUsageFlags: VkImageUsageFlags, }; pub const VkSurfaceCapabilitiesKHR = struct_VkSurfaceCapabilitiesKHR; pub const struct_VkSurfaceFormatKHR = extern struct { format: VkFormat, colorSpace: VkColorSpaceKHR, }; pub const VkSurfaceFormatKHR = struct_VkSurfaceFormatKHR; pub const PFN_vkDestroySurfaceKHR = ?fn (VkInstance, VkSurfaceKHR, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceSurfaceSupportKHR = ?fn (VkPhysicalDevice, u32, VkSurfaceKHR, ?[*]VkBool32) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = ?fn (VkPhysicalDevice, VkSurfaceKHR, ?[*]VkSurfaceCapabilitiesKHR) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceSurfaceFormatsKHR = ?fn (VkPhysicalDevice, VkSurfaceKHR, ?[*]u32, ?[*]VkSurfaceFormatKHR) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceSurfacePresentModesKHR = ?fn (VkPhysicalDevice, VkSurfaceKHR, ?[*]u32, ?[*]VkPresentModeKHR) callconv(.C) VkResult; pub extern fn vkDestroySurfaceKHR(instance: VkInstance, surface: VkSurfaceKHR, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice: VkPhysicalDevice, queueFamilyIndex: u32, surface: VkSurfaceKHR, pSupported: *VkBool32) VkResult; pub extern fn vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice: VkPhysicalDevice, surface: VkSurfaceKHR, pSurfaceCapabilities: *VkSurfaceCapabilitiesKHR) VkResult; pub extern fn vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice: VkPhysicalDevice, surface: VkSurfaceKHR, pSurfaceFormatCount: *u32, pSurfaceFormats: ?[*]VkSurfaceFormatKHR) VkResult; pub extern fn vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice: VkPhysicalDevice, surface: VkSurfaceKHR, pPresentModeCount: *u32, pPresentModes: ?[*]VkPresentModeKHR) VkResult; pub const struct_VkSwapchainKHR_T = opaque {}; pub const VkSwapchainKHR = ?*struct_VkSwapchainKHR_T; pub const VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = enum_VkSwapchainCreateFlagBitsKHR.VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR; pub const VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = enum_VkSwapchainCreateFlagBitsKHR.VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR; pub const VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = enum_VkSwapchainCreateFlagBitsKHR.VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR; pub const enum_VkSwapchainCreateFlagBitsKHR = extern enum { VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 1, VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 2, VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 2147483647, }; pub const VkSwapchainCreateFlagBitsKHR = enum_VkSwapchainCreateFlagBitsKHR; pub const VkSwapchainCreateFlagsKHR = VkFlags; pub const VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = enum_VkDeviceGroupPresentModeFlagBitsKHR.VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; pub const VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = enum_VkDeviceGroupPresentModeFlagBitsKHR.VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR; pub const VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = enum_VkDeviceGroupPresentModeFlagBitsKHR.VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR; pub const VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = enum_VkDeviceGroupPresentModeFlagBitsKHR.VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR; pub const VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR = enum_VkDeviceGroupPresentModeFlagBitsKHR.VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR; pub const enum_VkDeviceGroupPresentModeFlagBitsKHR = extern enum { VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = 1, VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = 2, VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = 4, VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 8, VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR = 2147483647, }; pub const VkDeviceGroupPresentModeFlagBitsKHR = enum_VkDeviceGroupPresentModeFlagBitsKHR; pub const VkDeviceGroupPresentModeFlagsKHR = VkFlags; pub const struct_VkSwapchainCreateInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkSwapchainCreateFlagsKHR, surface: VkSurfaceKHR, minImageCount: u32, imageFormat: VkFormat, imageColorSpace: VkColorSpaceKHR, imageExtent: VkExtent2D, imageArrayLayers: u32, imageUsage: VkImageUsageFlags, imageSharingMode: VkSharingMode, queueFamilyIndexCount: u32, pQueueFamilyIndices: ?[*]const u32, preTransform: VkSurfaceTransformFlagBitsKHR, compositeAlpha: VkCompositeAlphaFlagBitsKHR, presentMode: VkPresentModeKHR, clipped: VkBool32, oldSwapchain: VkSwapchainKHR, }; pub const VkSwapchainCreateInfoKHR = struct_VkSwapchainCreateInfoKHR; pub const struct_VkPresentInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, waitSemaphoreCount: u32, pWaitSemaphores: ?[*]const VkSemaphore, swapchainCount: u32, pSwapchains: [*]const VkSwapchainKHR, pImageIndices: [*]const u32, pResults: ?[*]VkResult, }; pub const VkPresentInfoKHR = struct_VkPresentInfoKHR; pub const struct_VkImageSwapchainCreateInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, swapchain: VkSwapchainKHR, }; pub const VkImageSwapchainCreateInfoKHR = struct_VkImageSwapchainCreateInfoKHR; pub const struct_VkBindImageMemorySwapchainInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, swapchain: VkSwapchainKHR, imageIndex: u32, }; pub const VkBindImageMemorySwapchainInfoKHR = struct_VkBindImageMemorySwapchainInfoKHR; pub const struct_VkAcquireNextImageInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, swapchain: VkSwapchainKHR, timeout: u64, semaphore: VkSemaphore, fence: VkFence, deviceMask: u32, }; pub const VkAcquireNextImageInfoKHR = struct_VkAcquireNextImageInfoKHR; pub const struct_VkDeviceGroupPresentCapabilitiesKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, presentMask: [32]u32, modes: VkDeviceGroupPresentModeFlagsKHR, }; pub const VkDeviceGroupPresentCapabilitiesKHR = struct_VkDeviceGroupPresentCapabilitiesKHR; pub const struct_VkDeviceGroupPresentInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, swapchainCount: u32, pDeviceMasks: ?[*]const u32, mode: VkDeviceGroupPresentModeFlagBitsKHR, }; pub const VkDeviceGroupPresentInfoKHR = struct_VkDeviceGroupPresentInfoKHR; pub const struct_VkDeviceGroupSwapchainCreateInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, modes: VkDeviceGroupPresentModeFlagsKHR, }; pub const VkDeviceGroupSwapchainCreateInfoKHR = struct_VkDeviceGroupSwapchainCreateInfoKHR; pub const PFN_vkCreateSwapchainKHR = ?fn (VkDevice, ?[*]const VkSwapchainCreateInfoKHR, ?[*]const VkAllocationCallbacks, ?[*]VkSwapchainKHR) callconv(.C) VkResult; pub const PFN_vkDestroySwapchainKHR = ?fn (VkDevice, VkSwapchainKHR, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkGetSwapchainImagesKHR = ?fn (VkDevice, VkSwapchainKHR, ?[*]u32, ?[*]VkImage) callconv(.C) VkResult; pub const PFN_vkAcquireNextImageKHR = ?fn (VkDevice, VkSwapchainKHR, u64, VkSemaphore, VkFence, ?[*]u32) callconv(.C) VkResult; pub const PFN_vkQueuePresentKHR = ?fn (VkQueue, ?[*]const VkPresentInfoKHR) callconv(.C) VkResult; pub const PFN_vkGetDeviceGroupPresentCapabilitiesKHR = ?fn (VkDevice, ?[*]VkDeviceGroupPresentCapabilitiesKHR) callconv(.C) VkResult; pub const PFN_vkGetDeviceGroupSurfacePresentModesKHR = ?fn (VkDevice, VkSurfaceKHR, ?[*]VkDeviceGroupPresentModeFlagsKHR) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDevicePresentRectanglesKHR = ?fn (VkPhysicalDevice, VkSurfaceKHR, ?[*]u32, ?[*]VkRect2D) callconv(.C) VkResult; pub const PFN_vkAcquireNextImage2KHR = ?fn (VkDevice, ?[*]const VkAcquireNextImageInfoKHR, ?[*]u32) callconv(.C) VkResult; pub extern fn vkCreateSwapchainKHR(device: VkDevice, pCreateInfo: *const VkSwapchainCreateInfoKHR, pAllocator: ?[*]const VkAllocationCallbacks, pSwapchain: *VkSwapchainKHR) VkResult; pub extern fn vkDestroySwapchainKHR(device: VkDevice, swapchain: VkSwapchainKHR, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkGetSwapchainImagesKHR(device: VkDevice, swapchain: VkSwapchainKHR, pSwapchainImageCount: *u32, pSwapchainImages: ?[*]VkImage) VkResult; pub extern fn vkAcquireNextImageKHR(device: VkDevice, swapchain: VkSwapchainKHR, timeout: u64, semaphore: VkSemaphore, fence: VkFence, pImageIndex: *u32) VkResult; pub extern fn vkQueuePresentKHR(queue: VkQueue, pPresentInfo: *const VkPresentInfoKHR) VkResult; pub extern fn vkGetDeviceGroupPresentCapabilitiesKHR(device: VkDevice, pDeviceGroupPresentCapabilities: ?[*]VkDeviceGroupPresentCapabilitiesKHR) VkResult; pub extern fn vkGetDeviceGroupSurfacePresentModesKHR(device: VkDevice, surface: VkSurfaceKHR, pModes: ?[*]VkDeviceGroupPresentModeFlagsKHR) VkResult; pub extern fn vkGetPhysicalDevicePresentRectanglesKHR(physicalDevice: VkPhysicalDevice, surface: VkSurfaceKHR, pRectCount: ?[*]u32, pRects: ?[*]VkRect2D) VkResult; pub extern fn vkAcquireNextImage2KHR(device: VkDevice, pAcquireInfo: ?[*]const VkAcquireNextImageInfoKHR, pImageIndex: ?[*]u32) VkResult; pub const struct_VkDisplayKHR_T = opaque {}; pub const VkDisplayKHR = ?*struct_VkDisplayKHR_T; pub const struct_VkDisplayModeKHR_T = opaque {}; pub const VkDisplayModeKHR = ?*struct_VkDisplayModeKHR_T; pub const VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = enum_VkDisplayPlaneAlphaFlagBitsKHR.VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR; pub const VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = enum_VkDisplayPlaneAlphaFlagBitsKHR.VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR; pub const VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = enum_VkDisplayPlaneAlphaFlagBitsKHR.VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR; pub const VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = enum_VkDisplayPlaneAlphaFlagBitsKHR.VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR; pub const VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = enum_VkDisplayPlaneAlphaFlagBitsKHR.VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR; pub const enum_VkDisplayPlaneAlphaFlagBitsKHR = extern enum { VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 1, VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 2, VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 4, VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 8, VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 2147483647, }; pub const VkDisplayPlaneAlphaFlagBitsKHR = enum_VkDisplayPlaneAlphaFlagBitsKHR; pub const VkDisplayPlaneAlphaFlagsKHR = VkFlags; pub const VkDisplayModeCreateFlagsKHR = VkFlags; pub const VkDisplaySurfaceCreateFlagsKHR = VkFlags; pub const struct_VkDisplayPropertiesKHR = extern struct { display: VkDisplayKHR, displayName: ?[*]const u8, physicalDimensions: VkExtent2D, physicalResolution: VkExtent2D, supportedTransforms: VkSurfaceTransformFlagsKHR, planeReorderPossible: VkBool32, persistentContent: VkBool32, }; pub const VkDisplayPropertiesKHR = struct_VkDisplayPropertiesKHR; pub const struct_VkDisplayModeParametersKHR = extern struct { visibleRegion: VkExtent2D, refreshRate: u32, }; pub const VkDisplayModeParametersKHR = struct_VkDisplayModeParametersKHR; pub const struct_VkDisplayModePropertiesKHR = extern struct { displayMode: VkDisplayModeKHR, parameters: VkDisplayModeParametersKHR, }; pub const VkDisplayModePropertiesKHR = struct_VkDisplayModePropertiesKHR; pub const struct_VkDisplayModeCreateInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDisplayModeCreateFlagsKHR, parameters: VkDisplayModeParametersKHR, }; pub const VkDisplayModeCreateInfoKHR = struct_VkDisplayModeCreateInfoKHR; pub const struct_VkDisplayPlaneCapabilitiesKHR = extern struct { supportedAlpha: VkDisplayPlaneAlphaFlagsKHR, minSrcPosition: VkOffset2D, maxSrcPosition: VkOffset2D, minSrcExtent: VkExtent2D, maxSrcExtent: VkExtent2D, minDstPosition: VkOffset2D, maxDstPosition: VkOffset2D, minDstExtent: VkExtent2D, maxDstExtent: VkExtent2D, }; pub const VkDisplayPlaneCapabilitiesKHR = struct_VkDisplayPlaneCapabilitiesKHR; pub const struct_VkDisplayPlanePropertiesKHR = extern struct { currentDisplay: VkDisplayKHR, currentStackIndex: u32, }; pub const VkDisplayPlanePropertiesKHR = struct_VkDisplayPlanePropertiesKHR; pub const struct_VkDisplaySurfaceCreateInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDisplaySurfaceCreateFlagsKHR, displayMode: VkDisplayModeKHR, planeIndex: u32, planeStackIndex: u32, transform: VkSurfaceTransformFlagBitsKHR, globalAlpha: f32, alphaMode: VkDisplayPlaneAlphaFlagBitsKHR, imageExtent: VkExtent2D, }; pub const VkDisplaySurfaceCreateInfoKHR = struct_VkDisplaySurfaceCreateInfoKHR; pub const PFN_vkGetPhysicalDeviceDisplayPropertiesKHR = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkDisplayPropertiesKHR) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkDisplayPlanePropertiesKHR) callconv(.C) VkResult; pub const PFN_vkGetDisplayPlaneSupportedDisplaysKHR = ?fn (VkPhysicalDevice, u32, ?[*]u32, ?[*]VkDisplayKHR) callconv(.C) VkResult; pub const PFN_vkGetDisplayModePropertiesKHR = ?fn (VkPhysicalDevice, VkDisplayKHR, ?[*]u32, ?[*]VkDisplayModePropertiesKHR) callconv(.C) VkResult; pub const PFN_vkCreateDisplayModeKHR = ?fn (VkPhysicalDevice, VkDisplayKHR, ?[*]const VkDisplayModeCreateInfoKHR, ?[*]const VkAllocationCallbacks, ?[*]VkDisplayModeKHR) callconv(.C) VkResult; pub const PFN_vkGetDisplayPlaneCapabilitiesKHR = ?fn (VkPhysicalDevice, VkDisplayModeKHR, u32, ?[*]VkDisplayPlaneCapabilitiesKHR) callconv(.C) VkResult; pub const PFN_vkCreateDisplayPlaneSurfaceKHR = ?fn (VkInstance, ?[*]const VkDisplaySurfaceCreateInfoKHR, ?[*]const VkAllocationCallbacks, ?[*]VkSurfaceKHR) callconv(.C) VkResult; pub extern fn vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice: VkPhysicalDevice, pPropertyCount: ?[*]u32, pProperties: ?[*]VkDisplayPropertiesKHR) VkResult; pub extern fn vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice: VkPhysicalDevice, pPropertyCount: ?[*]u32, pProperties: ?[*]VkDisplayPlanePropertiesKHR) VkResult; pub extern fn vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice: VkPhysicalDevice, planeIndex: u32, pDisplayCount: ?[*]u32, pDisplays: ?[*]VkDisplayKHR) VkResult; pub extern fn vkGetDisplayModePropertiesKHR(physicalDevice: VkPhysicalDevice, display: VkDisplayKHR, pPropertyCount: ?[*]u32, pProperties: ?[*]VkDisplayModePropertiesKHR) VkResult; pub extern fn vkCreateDisplayModeKHR(physicalDevice: VkPhysicalDevice, display: VkDisplayKHR, pCreateInfo: ?[*]const VkDisplayModeCreateInfoKHR, pAllocator: ?[*]const VkAllocationCallbacks, pMode: ?[*]VkDisplayModeKHR) VkResult; pub extern fn vkGetDisplayPlaneCapabilitiesKHR(physicalDevice: VkPhysicalDevice, mode: VkDisplayModeKHR, planeIndex: u32, pCapabilities: ?[*]VkDisplayPlaneCapabilitiesKHR) VkResult; pub extern fn vkCreateDisplayPlaneSurfaceKHR(instance: VkInstance, pCreateInfo: ?[*]const VkDisplaySurfaceCreateInfoKHR, pAllocator: ?[*]const VkAllocationCallbacks, pSurface: ?[*]VkSurfaceKHR) VkResult; pub const struct_VkDisplayPresentInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, srcRect: VkRect2D, dstRect: VkRect2D, persistent: VkBool32, }; pub const VkDisplayPresentInfoKHR = struct_VkDisplayPresentInfoKHR; pub const PFN_vkCreateSharedSwapchainsKHR = ?fn (VkDevice, u32, ?[*]const VkSwapchainCreateInfoKHR, ?[*]const VkAllocationCallbacks, ?[*]VkSwapchainKHR) callconv(.C) VkResult; pub extern fn vkCreateSharedSwapchainsKHR(device: VkDevice, swapchainCount: u32, pCreateInfos: ?[*]const VkSwapchainCreateInfoKHR, pAllocator: ?[*]const VkAllocationCallbacks, pSwapchains: ?[*]VkSwapchainKHR) VkResult; pub const VkRenderPassMultiviewCreateInfoKHR = VkRenderPassMultiviewCreateInfo; pub const VkPhysicalDeviceMultiviewFeaturesKHR = VkPhysicalDeviceMultiviewFeatures; pub const VkPhysicalDeviceMultiviewPropertiesKHR = VkPhysicalDeviceMultiviewProperties; pub const VkPhysicalDeviceFeatures2KHR = VkPhysicalDeviceFeatures2; pub const VkPhysicalDeviceProperties2KHR = VkPhysicalDeviceProperties2; pub const VkFormatProperties2KHR = VkFormatProperties2; pub const VkImageFormatProperties2KHR = VkImageFormatProperties2; pub const VkPhysicalDeviceImageFormatInfo2KHR = VkPhysicalDeviceImageFormatInfo2; pub const VkQueueFamilyProperties2KHR = VkQueueFamilyProperties2; pub const VkPhysicalDeviceMemoryProperties2KHR = VkPhysicalDeviceMemoryProperties2; pub const VkSparseImageFormatProperties2KHR = VkSparseImageFormatProperties2; pub const VkPhysicalDeviceSparseImageFormatInfo2KHR = VkPhysicalDeviceSparseImageFormatInfo2; pub const PFN_vkGetPhysicalDeviceFeatures2KHR = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceFeatures2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceProperties2KHR = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceFormatProperties2KHR = ?fn (VkPhysicalDevice, VkFormat, ?[*]VkFormatProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceImageFormatProperties2KHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceImageFormatInfo2, ?[*]VkImageFormatProperties2) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkQueueFamilyProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceMemoryProperties2KHR = ?fn (VkPhysicalDevice, ?[*]VkPhysicalDeviceMemoryProperties2) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceSparseImageFormatInfo2, ?[*]u32, ?[*]VkSparseImageFormatProperties2) callconv(.C) void; pub extern fn vkGetPhysicalDeviceFeatures2KHR(physicalDevice: VkPhysicalDevice, pFeatures: ?[*]VkPhysicalDeviceFeatures2) void; pub extern fn vkGetPhysicalDeviceProperties2KHR(physicalDevice: VkPhysicalDevice, pProperties: ?[*]VkPhysicalDeviceProperties2) void; pub extern fn vkGetPhysicalDeviceFormatProperties2KHR(physicalDevice: VkPhysicalDevice, format: VkFormat, pFormatProperties: ?[*]VkFormatProperties2) void; pub extern fn vkGetPhysicalDeviceImageFormatProperties2KHR(physicalDevice: VkPhysicalDevice, pImageFormatInfo: ?[*]const VkPhysicalDeviceImageFormatInfo2, pImageFormatProperties: ?[*]VkImageFormatProperties2) VkResult; pub extern fn vkGetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice: VkPhysicalDevice, pQueueFamilyPropertyCount: ?[*]u32, pQueueFamilyProperties: ?[*]VkQueueFamilyProperties2) void; pub extern fn vkGetPhysicalDeviceMemoryProperties2KHR(physicalDevice: VkPhysicalDevice, pMemoryProperties: ?[*]VkPhysicalDeviceMemoryProperties2) void; pub extern fn vkGetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice: VkPhysicalDevice, pFormatInfo: ?[*]const VkPhysicalDeviceSparseImageFormatInfo2, pPropertyCount: ?[*]u32, pProperties: ?[*]VkSparseImageFormatProperties2) void; pub const VkPeerMemoryFeatureFlagsKHR = VkPeerMemoryFeatureFlags; pub const VkPeerMemoryFeatureFlagBitsKHR = VkPeerMemoryFeatureFlagBits; pub const VkMemoryAllocateFlagsKHR = VkMemoryAllocateFlags; pub const VkMemoryAllocateFlagBitsKHR = VkMemoryAllocateFlagBits; pub const VkMemoryAllocateFlagsInfoKHR = VkMemoryAllocateFlagsInfo; pub const VkDeviceGroupRenderPassBeginInfoKHR = VkDeviceGroupRenderPassBeginInfo; pub const VkDeviceGroupCommandBufferBeginInfoKHR = VkDeviceGroupCommandBufferBeginInfo; pub const VkDeviceGroupSubmitInfoKHR = VkDeviceGroupSubmitInfo; pub const VkDeviceGroupBindSparseInfoKHR = VkDeviceGroupBindSparseInfo; pub const VkBindBufferMemoryDeviceGroupInfoKHR = VkBindBufferMemoryDeviceGroupInfo; pub const VkBindImageMemoryDeviceGroupInfoKHR = VkBindImageMemoryDeviceGroupInfo; pub const PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR = ?fn (VkDevice, u32, u32, u32, ?[*]VkPeerMemoryFeatureFlags) callconv(.C) void; pub const PFN_vkCmdSetDeviceMaskKHR = ?fn (VkCommandBuffer, u32) callconv(.C) void; pub const PFN_vkCmdDispatchBaseKHR = ?fn (VkCommandBuffer, u32, u32, u32, u32, u32, u32) callconv(.C) void; pub extern fn vkGetDeviceGroupPeerMemoryFeaturesKHR(device: VkDevice, heapIndex: u32, localDeviceIndex: u32, remoteDeviceIndex: u32, pPeerMemoryFeatures: ?[*]VkPeerMemoryFeatureFlags) void; pub extern fn vkCmdSetDeviceMaskKHR(commandBuffer: VkCommandBuffer, deviceMask: u32) void; pub extern fn vkCmdDispatchBaseKHR(commandBuffer: VkCommandBuffer, baseGroupX: u32, baseGroupY: u32, baseGroupZ: u32, groupCountX: u32, groupCountY: u32, groupCountZ: u32) void; pub const VkCommandPoolTrimFlagsKHR = VkCommandPoolTrimFlags; pub const PFN_vkTrimCommandPoolKHR = ?fn (VkDevice, VkCommandPool, VkCommandPoolTrimFlags) callconv(.C) void; pub extern fn vkTrimCommandPoolKHR(device: VkDevice, commandPool: VkCommandPool, flags: VkCommandPoolTrimFlags) void; pub const VkPhysicalDeviceGroupPropertiesKHR = VkPhysicalDeviceGroupProperties; pub const VkDeviceGroupDeviceCreateInfoKHR = VkDeviceGroupDeviceCreateInfo; pub const PFN_vkEnumeratePhysicalDeviceGroupsKHR = ?fn (VkInstance, ?[*]u32, ?[*]VkPhysicalDeviceGroupProperties) callconv(.C) VkResult; pub extern fn vkEnumeratePhysicalDeviceGroupsKHR(instance: VkInstance, pPhysicalDeviceGroupCount: ?[*]u32, pPhysicalDeviceGroupProperties: ?[*]VkPhysicalDeviceGroupProperties) VkResult; pub const VkExternalMemoryHandleTypeFlagsKHR = VkExternalMemoryHandleTypeFlags; pub const VkExternalMemoryHandleTypeFlagBitsKHR = VkExternalMemoryHandleTypeFlagBits; pub const VkExternalMemoryFeatureFlagsKHR = VkExternalMemoryFeatureFlags; pub const VkExternalMemoryFeatureFlagBitsKHR = VkExternalMemoryFeatureFlagBits; pub const VkExternalMemoryPropertiesKHR = VkExternalMemoryProperties; pub const VkPhysicalDeviceExternalImageFormatInfoKHR = VkPhysicalDeviceExternalImageFormatInfo; pub const VkExternalImageFormatPropertiesKHR = VkExternalImageFormatProperties; pub const VkPhysicalDeviceExternalBufferInfoKHR = VkPhysicalDeviceExternalBufferInfo; pub const VkExternalBufferPropertiesKHR = VkExternalBufferProperties; pub const VkPhysicalDeviceIDPropertiesKHR = VkPhysicalDeviceIDProperties; pub const PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceExternalBufferInfo, ?[*]VkExternalBufferProperties) callconv(.C) void; pub extern fn vkGetPhysicalDeviceExternalBufferPropertiesKHR(physicalDevice: VkPhysicalDevice, pExternalBufferInfo: ?[*]const VkPhysicalDeviceExternalBufferInfo, pExternalBufferProperties: ?[*]VkExternalBufferProperties) void; pub const VkExternalMemoryImageCreateInfoKHR = VkExternalMemoryImageCreateInfo; pub const VkExternalMemoryBufferCreateInfoKHR = VkExternalMemoryBufferCreateInfo; pub const VkExportMemoryAllocateInfoKHR = VkExportMemoryAllocateInfo; pub const struct_VkImportMemoryFdInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleType: VkExternalMemoryHandleTypeFlagBits, fd: c_int, }; pub const VkImportMemoryFdInfoKHR = struct_VkImportMemoryFdInfoKHR; pub const struct_VkMemoryFdPropertiesKHR = extern struct { sType: VkStructureType, pNext: ?*c_void, memoryTypeBits: u32, }; pub const VkMemoryFdPropertiesKHR = struct_VkMemoryFdPropertiesKHR; pub const struct_VkMemoryGetFdInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, memory: VkDeviceMemory, handleType: VkExternalMemoryHandleTypeFlagBits, }; pub const VkMemoryGetFdInfoKHR = struct_VkMemoryGetFdInfoKHR; pub const PFN_vkGetMemoryFdKHR = ?fn (VkDevice, ?[*]const VkMemoryGetFdInfoKHR, ?[*]c_int) callconv(.C) VkResult; pub const PFN_vkGetMemoryFdPropertiesKHR = ?fn (VkDevice, VkExternalMemoryHandleTypeFlagBits, c_int, ?[*]VkMemoryFdPropertiesKHR) callconv(.C) VkResult; pub extern fn vkGetMemoryFdKHR(device: VkDevice, pGetFdInfo: ?[*]const VkMemoryGetFdInfoKHR, pFd: ?[*]c_int) VkResult; pub extern fn vkGetMemoryFdPropertiesKHR(device: VkDevice, handleType: VkExternalMemoryHandleTypeFlagBits, fd: c_int, pMemoryFdProperties: ?[*]VkMemoryFdPropertiesKHR) VkResult; pub const VkExternalSemaphoreHandleTypeFlagsKHR = VkExternalSemaphoreHandleTypeFlags; pub const VkExternalSemaphoreHandleTypeFlagBitsKHR = VkExternalSemaphoreHandleTypeFlagBits; pub const VkExternalSemaphoreFeatureFlagsKHR = VkExternalSemaphoreFeatureFlags; pub const VkExternalSemaphoreFeatureFlagBitsKHR = VkExternalSemaphoreFeatureFlagBits; pub const VkPhysicalDeviceExternalSemaphoreInfoKHR = VkPhysicalDeviceExternalSemaphoreInfo; pub const VkExternalSemaphorePropertiesKHR = VkExternalSemaphoreProperties; pub const PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceExternalSemaphoreInfo, ?[*]VkExternalSemaphoreProperties) callconv(.C) void; pub extern fn vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(physicalDevice: VkPhysicalDevice, pExternalSemaphoreInfo: ?[*]const VkPhysicalDeviceExternalSemaphoreInfo, pExternalSemaphoreProperties: ?[*]VkExternalSemaphoreProperties) void; pub const VkSemaphoreImportFlagsKHR = VkSemaphoreImportFlags; pub const VkSemaphoreImportFlagBitsKHR = VkSemaphoreImportFlagBits; pub const VkExportSemaphoreCreateInfoKHR = VkExportSemaphoreCreateInfo; pub const struct_VkImportSemaphoreFdInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, semaphore: VkSemaphore, flags: VkSemaphoreImportFlags, handleType: VkExternalSemaphoreHandleTypeFlagBits, fd: c_int, }; pub const VkImportSemaphoreFdInfoKHR = struct_VkImportSemaphoreFdInfoKHR; pub const struct_VkSemaphoreGetFdInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, semaphore: VkSemaphore, handleType: VkExternalSemaphoreHandleTypeFlagBits, }; pub const VkSemaphoreGetFdInfoKHR = struct_VkSemaphoreGetFdInfoKHR; pub const PFN_vkImportSemaphoreFdKHR = ?fn (VkDevice, ?[*]const VkImportSemaphoreFdInfoKHR) callconv(.C) VkResult; pub const PFN_vkGetSemaphoreFdKHR = ?fn (VkDevice, ?[*]const VkSemaphoreGetFdInfoKHR, ?[*]c_int) callconv(.C) VkResult; pub extern fn vkImportSemaphoreFdKHR(device: VkDevice, pImportSemaphoreFdInfo: ?[*]const VkImportSemaphoreFdInfoKHR) VkResult; pub extern fn vkGetSemaphoreFdKHR(device: VkDevice, pGetFdInfo: ?[*]const VkSemaphoreGetFdInfoKHR, pFd: ?[*]c_int) VkResult; pub const struct_VkPhysicalDevicePushDescriptorPropertiesKHR = extern struct { sType: VkStructureType, pNext: ?*c_void, maxPushDescriptors: u32, }; pub const VkPhysicalDevicePushDescriptorPropertiesKHR = struct_VkPhysicalDevicePushDescriptorPropertiesKHR; pub const PFN_vkCmdPushDescriptorSetKHR = ?fn (VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, u32, u32, ?[*]const VkWriteDescriptorSet) callconv(.C) void; pub const PFN_vkCmdPushDescriptorSetWithTemplateKHR = ?fn (VkCommandBuffer, VkDescriptorUpdateTemplate, VkPipelineLayout, u32, ?*const c_void) callconv(.C) void; pub extern fn vkCmdPushDescriptorSetKHR(commandBuffer: VkCommandBuffer, pipelineBindPoint: VkPipelineBindPoint, layout: VkPipelineLayout, set: u32, descriptorWriteCount: u32, pDescriptorWrites: ?[*]const VkWriteDescriptorSet) void; pub extern fn vkCmdPushDescriptorSetWithTemplateKHR(commandBuffer: VkCommandBuffer, descriptorUpdateTemplate: VkDescriptorUpdateTemplate, layout: VkPipelineLayout, set: u32, pData: ?*const c_void) void; pub const VkPhysicalDevice16BitStorageFeaturesKHR = VkPhysicalDevice16BitStorageFeatures; pub const struct_VkRectLayerKHR = extern struct { offset: VkOffset2D, extent: VkExtent2D, layer: u32, }; pub const VkRectLayerKHR = struct_VkRectLayerKHR; pub const struct_VkPresentRegionKHR = extern struct { rectangleCount: u32, pRectangles: ?[*]const VkRectLayerKHR, }; pub const VkPresentRegionKHR = struct_VkPresentRegionKHR; pub const struct_VkPresentRegionsKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, swapchainCount: u32, pRegions: ?[*]const VkPresentRegionKHR, }; pub const VkPresentRegionsKHR = struct_VkPresentRegionsKHR; pub const VkDescriptorUpdateTemplateKHR = VkDescriptorUpdateTemplate; pub const VkDescriptorUpdateTemplateTypeKHR = VkDescriptorUpdateTemplateType; pub const VkDescriptorUpdateTemplateCreateFlagsKHR = VkDescriptorUpdateTemplateCreateFlags; pub const VkDescriptorUpdateTemplateEntryKHR = VkDescriptorUpdateTemplateEntry; pub const VkDescriptorUpdateTemplateCreateInfoKHR = VkDescriptorUpdateTemplateCreateInfo; pub const PFN_vkCreateDescriptorUpdateTemplateKHR = ?fn (VkDevice, ?[*]const VkDescriptorUpdateTemplateCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkDescriptorUpdateTemplate) callconv(.C) VkResult; pub const PFN_vkDestroyDescriptorUpdateTemplateKHR = ?fn (VkDevice, VkDescriptorUpdateTemplate, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkUpdateDescriptorSetWithTemplateKHR = ?fn (VkDevice, VkDescriptorSet, VkDescriptorUpdateTemplate, ?*const c_void) callconv(.C) void; pub extern fn vkCreateDescriptorUpdateTemplateKHR(device: VkDevice, pCreateInfo: ?[*]const VkDescriptorUpdateTemplateCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pDescriptorUpdateTemplate: ?[*]VkDescriptorUpdateTemplate) VkResult; pub extern fn vkDestroyDescriptorUpdateTemplateKHR(device: VkDevice, descriptorUpdateTemplate: VkDescriptorUpdateTemplate, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkUpdateDescriptorSetWithTemplateKHR(device: VkDevice, descriptorSet: VkDescriptorSet, descriptorUpdateTemplate: VkDescriptorUpdateTemplate, pData: ?*const c_void) void; pub const struct_VkSharedPresentSurfaceCapabilitiesKHR = extern struct { sType: VkStructureType, pNext: ?*c_void, sharedPresentSupportedUsageFlags: VkImageUsageFlags, }; pub const VkSharedPresentSurfaceCapabilitiesKHR = struct_VkSharedPresentSurfaceCapabilitiesKHR; pub const PFN_vkGetSwapchainStatusKHR = ?fn (VkDevice, VkSwapchainKHR) callconv(.C) VkResult; pub extern fn vkGetSwapchainStatusKHR(device: VkDevice, swapchain: VkSwapchainKHR) VkResult; pub const VkExternalFenceHandleTypeFlagsKHR = VkExternalFenceHandleTypeFlags; pub const VkExternalFenceHandleTypeFlagBitsKHR = VkExternalFenceHandleTypeFlagBits; pub const VkExternalFenceFeatureFlagsKHR = VkExternalFenceFeatureFlags; pub const VkExternalFenceFeatureFlagBitsKHR = VkExternalFenceFeatureFlagBits; pub const VkPhysicalDeviceExternalFenceInfoKHR = VkPhysicalDeviceExternalFenceInfo; pub const VkExternalFencePropertiesKHR = VkExternalFenceProperties; pub const PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceExternalFenceInfo, ?[*]VkExternalFenceProperties) callconv(.C) void; pub extern fn vkGetPhysicalDeviceExternalFencePropertiesKHR(physicalDevice: VkPhysicalDevice, pExternalFenceInfo: ?[*]const VkPhysicalDeviceExternalFenceInfo, pExternalFenceProperties: ?[*]VkExternalFenceProperties) void; pub const VkFenceImportFlagsKHR = VkFenceImportFlags; pub const VkFenceImportFlagBitsKHR = VkFenceImportFlagBits; pub const VkExportFenceCreateInfoKHR = VkExportFenceCreateInfo; pub const struct_VkImportFenceFdInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, fence: VkFence, flags: VkFenceImportFlags, handleType: VkExternalFenceHandleTypeFlagBits, fd: c_int, }; pub const VkImportFenceFdInfoKHR = struct_VkImportFenceFdInfoKHR; pub const struct_VkFenceGetFdInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, fence: VkFence, handleType: VkExternalFenceHandleTypeFlagBits, }; pub const VkFenceGetFdInfoKHR = struct_VkFenceGetFdInfoKHR; pub const PFN_vkImportFenceFdKHR = ?fn (VkDevice, ?[*]const VkImportFenceFdInfoKHR) callconv(.C) VkResult; pub const PFN_vkGetFenceFdKHR = ?fn (VkDevice, ?[*]const VkFenceGetFdInfoKHR, ?[*]c_int) callconv(.C) VkResult; pub extern fn vkImportFenceFdKHR(device: VkDevice, pImportFenceFdInfo: ?[*]const VkImportFenceFdInfoKHR) VkResult; pub extern fn vkGetFenceFdKHR(device: VkDevice, pGetFdInfo: ?[*]const VkFenceGetFdInfoKHR, pFd: ?[*]c_int) VkResult; pub const VkPointClippingBehaviorKHR = VkPointClippingBehavior; pub const VkTessellationDomainOriginKHR = VkTessellationDomainOrigin; pub const VkPhysicalDevicePointClippingPropertiesKHR = VkPhysicalDevicePointClippingProperties; pub const VkRenderPassInputAttachmentAspectCreateInfoKHR = VkRenderPassInputAttachmentAspectCreateInfo; pub const VkInputAttachmentAspectReferenceKHR = VkInputAttachmentAspectReference; pub const VkImageViewUsageCreateInfoKHR = VkImageViewUsageCreateInfo; pub const VkPipelineTessellationDomainOriginStateCreateInfoKHR = VkPipelineTessellationDomainOriginStateCreateInfo; pub const struct_VkPhysicalDeviceSurfaceInfo2KHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, surface: VkSurfaceKHR, }; pub const VkPhysicalDeviceSurfaceInfo2KHR = struct_VkPhysicalDeviceSurfaceInfo2KHR; pub const struct_VkSurfaceCapabilities2KHR = extern struct { sType: VkStructureType, pNext: ?*c_void, surfaceCapabilities: VkSurfaceCapabilitiesKHR, }; pub const VkSurfaceCapabilities2KHR = struct_VkSurfaceCapabilities2KHR; pub const struct_VkSurfaceFormat2KHR = extern struct { sType: VkStructureType, pNext: ?*c_void, surfaceFormat: VkSurfaceFormatKHR, }; pub const VkSurfaceFormat2KHR = struct_VkSurfaceFormat2KHR; pub const PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceSurfaceInfo2KHR, ?[*]VkSurfaceCapabilities2KHR) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceSurfaceFormats2KHR = ?fn (VkPhysicalDevice, ?[*]const VkPhysicalDeviceSurfaceInfo2KHR, ?[*]u32, ?[*]VkSurfaceFormat2KHR) callconv(.C) VkResult; pub extern fn vkGetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice: VkPhysicalDevice, pSurfaceInfo: ?[*]const VkPhysicalDeviceSurfaceInfo2KHR, pSurfaceCapabilities: ?[*]VkSurfaceCapabilities2KHR) VkResult; pub extern fn vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice: VkPhysicalDevice, pSurfaceInfo: ?[*]const VkPhysicalDeviceSurfaceInfo2KHR, pSurfaceFormatCount: ?[*]u32, pSurfaceFormats: ?[*]VkSurfaceFormat2KHR) VkResult; pub const VkPhysicalDeviceVariablePointerFeaturesKHR = VkPhysicalDeviceVariablePointerFeatures; pub const struct_VkDisplayProperties2KHR = extern struct { sType: VkStructureType, pNext: ?*c_void, displayProperties: VkDisplayPropertiesKHR, }; pub const VkDisplayProperties2KHR = struct_VkDisplayProperties2KHR; pub const struct_VkDisplayPlaneProperties2KHR = extern struct { sType: VkStructureType, pNext: ?*c_void, displayPlaneProperties: VkDisplayPlanePropertiesKHR, }; pub const VkDisplayPlaneProperties2KHR = struct_VkDisplayPlaneProperties2KHR; pub const struct_VkDisplayModeProperties2KHR = extern struct { sType: VkStructureType, pNext: ?*c_void, displayModeProperties: VkDisplayModePropertiesKHR, }; pub const VkDisplayModeProperties2KHR = struct_VkDisplayModeProperties2KHR; pub const struct_VkDisplayPlaneInfo2KHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, mode: VkDisplayModeKHR, planeIndex: u32, }; pub const VkDisplayPlaneInfo2KHR = struct_VkDisplayPlaneInfo2KHR; pub const struct_VkDisplayPlaneCapabilities2KHR = extern struct { sType: VkStructureType, pNext: ?*c_void, capabilities: VkDisplayPlaneCapabilitiesKHR, }; pub const VkDisplayPlaneCapabilities2KHR = struct_VkDisplayPlaneCapabilities2KHR; pub const PFN_vkGetPhysicalDeviceDisplayProperties2KHR = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkDisplayProperties2KHR) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR = ?fn (VkPhysicalDevice, ?[*]u32, ?[*]VkDisplayPlaneProperties2KHR) callconv(.C) VkResult; pub const PFN_vkGetDisplayModeProperties2KHR = ?fn (VkPhysicalDevice, VkDisplayKHR, ?[*]u32, ?[*]VkDisplayModeProperties2KHR) callconv(.C) VkResult; pub const PFN_vkGetDisplayPlaneCapabilities2KHR = ?fn (VkPhysicalDevice, ?[*]const VkDisplayPlaneInfo2KHR, ?[*]VkDisplayPlaneCapabilities2KHR) callconv(.C) VkResult; pub extern fn vkGetPhysicalDeviceDisplayProperties2KHR(physicalDevice: VkPhysicalDevice, pPropertyCount: ?[*]u32, pProperties: ?[*]VkDisplayProperties2KHR) VkResult; pub extern fn vkGetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice: VkPhysicalDevice, pPropertyCount: ?[*]u32, pProperties: ?[*]VkDisplayPlaneProperties2KHR) VkResult; pub extern fn vkGetDisplayModeProperties2KHR(physicalDevice: VkPhysicalDevice, display: VkDisplayKHR, pPropertyCount: ?[*]u32, pProperties: ?[*]VkDisplayModeProperties2KHR) VkResult; pub extern fn vkGetDisplayPlaneCapabilities2KHR(physicalDevice: VkPhysicalDevice, pDisplayPlaneInfo: ?[*]const VkDisplayPlaneInfo2KHR, pCapabilities: ?[*]VkDisplayPlaneCapabilities2KHR) VkResult; pub const VkMemoryDedicatedRequirementsKHR = VkMemoryDedicatedRequirements; pub const VkMemoryDedicatedAllocateInfoKHR = VkMemoryDedicatedAllocateInfo; pub const VkBufferMemoryRequirementsInfo2KHR = VkBufferMemoryRequirementsInfo2; pub const VkImageMemoryRequirementsInfo2KHR = VkImageMemoryRequirementsInfo2; pub const VkImageSparseMemoryRequirementsInfo2KHR = VkImageSparseMemoryRequirementsInfo2; pub const VkMemoryRequirements2KHR = VkMemoryRequirements2; pub const VkSparseImageMemoryRequirements2KHR = VkSparseImageMemoryRequirements2; pub const PFN_vkGetImageMemoryRequirements2KHR = ?fn (VkDevice, ?[*]const VkImageMemoryRequirementsInfo2, ?[*]VkMemoryRequirements2) callconv(.C) void; pub const PFN_vkGetBufferMemoryRequirements2KHR = ?fn (VkDevice, ?[*]const VkBufferMemoryRequirementsInfo2, ?[*]VkMemoryRequirements2) callconv(.C) void; pub const PFN_vkGetImageSparseMemoryRequirements2KHR = ?fn (VkDevice, ?[*]const VkImageSparseMemoryRequirementsInfo2, ?[*]u32, ?[*]VkSparseImageMemoryRequirements2) callconv(.C) void; pub extern fn vkGetImageMemoryRequirements2KHR(device: VkDevice, pInfo: ?[*]const VkImageMemoryRequirementsInfo2, pMemoryRequirements: ?[*]VkMemoryRequirements2) void; pub extern fn vkGetBufferMemoryRequirements2KHR(device: VkDevice, pInfo: ?[*]const VkBufferMemoryRequirementsInfo2, pMemoryRequirements: ?[*]VkMemoryRequirements2) void; pub extern fn vkGetImageSparseMemoryRequirements2KHR(device: VkDevice, pInfo: ?[*]const VkImageSparseMemoryRequirementsInfo2, pSparseMemoryRequirementCount: ?[*]u32, pSparseMemoryRequirements: ?[*]VkSparseImageMemoryRequirements2) void; pub const struct_VkImageFormatListCreateInfoKHR = extern struct { sType: VkStructureType, pNext: ?*const c_void, viewFormatCount: u32, pViewFormats: ?[*]const VkFormat, }; pub const VkImageFormatListCreateInfoKHR = struct_VkImageFormatListCreateInfoKHR; pub const VkSamplerYcbcrConversionKHR = VkSamplerYcbcrConversion; pub const VkSamplerYcbcrModelConversionKHR = VkSamplerYcbcrModelConversion; pub const VkSamplerYcbcrRangeKHR = VkSamplerYcbcrRange; pub const VkChromaLocationKHR = VkChromaLocation; pub const VkSamplerYcbcrConversionCreateInfoKHR = VkSamplerYcbcrConversionCreateInfo; pub const VkSamplerYcbcrConversionInfoKHR = VkSamplerYcbcrConversionInfo; pub const VkBindImagePlaneMemoryInfoKHR = VkBindImagePlaneMemoryInfo; pub const VkImagePlaneMemoryRequirementsInfoKHR = VkImagePlaneMemoryRequirementsInfo; pub const VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR = VkPhysicalDeviceSamplerYcbcrConversionFeatures; pub const VkSamplerYcbcrConversionImageFormatPropertiesKHR = VkSamplerYcbcrConversionImageFormatProperties; pub const PFN_vkCreateSamplerYcbcrConversionKHR = ?fn (VkDevice, ?[*]const VkSamplerYcbcrConversionCreateInfo, ?[*]const VkAllocationCallbacks, ?[*]VkSamplerYcbcrConversion) callconv(.C) VkResult; pub const PFN_vkDestroySamplerYcbcrConversionKHR = ?fn (VkDevice, VkSamplerYcbcrConversion, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub extern fn vkCreateSamplerYcbcrConversionKHR(device: VkDevice, pCreateInfo: ?[*]const VkSamplerYcbcrConversionCreateInfo, pAllocator: ?[*]const VkAllocationCallbacks, pYcbcrConversion: ?[*]VkSamplerYcbcrConversion) VkResult; pub extern fn vkDestroySamplerYcbcrConversionKHR(device: VkDevice, ycbcrConversion: VkSamplerYcbcrConversion, pAllocator: ?[*]const VkAllocationCallbacks) void; pub const VkBindBufferMemoryInfoKHR = VkBindBufferMemoryInfo; pub const VkBindImageMemoryInfoKHR = VkBindImageMemoryInfo; pub const PFN_vkBindBufferMemory2KHR = ?fn (VkDevice, u32, ?[*]const VkBindBufferMemoryInfo) callconv(.C) VkResult; pub const PFN_vkBindImageMemory2KHR = ?fn (VkDevice, u32, ?[*]const VkBindImageMemoryInfo) callconv(.C) VkResult; pub extern fn vkBindBufferMemory2KHR(device: VkDevice, bindInfoCount: u32, pBindInfos: ?[*]const VkBindBufferMemoryInfo) VkResult; pub extern fn vkBindImageMemory2KHR(device: VkDevice, bindInfoCount: u32, pBindInfos: ?[*]const VkBindImageMemoryInfo) VkResult; pub const VkPhysicalDeviceMaintenance3PropertiesKHR = VkPhysicalDeviceMaintenance3Properties; pub const VkDescriptorSetLayoutSupportKHR = VkDescriptorSetLayoutSupport; pub const PFN_vkGetDescriptorSetLayoutSupportKHR = ?fn (VkDevice, ?[*]const VkDescriptorSetLayoutCreateInfo, ?[*]VkDescriptorSetLayoutSupport) callconv(.C) void; pub extern fn vkGetDescriptorSetLayoutSupportKHR(device: VkDevice, pCreateInfo: ?[*]const VkDescriptorSetLayoutCreateInfo, pSupport: ?[*]VkDescriptorSetLayoutSupport) void; pub const PFN_vkCmdDrawIndirectCountKHR = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, u32, u32) callconv(.C) void; pub const PFN_vkCmdDrawIndexedIndirectCountKHR = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, u32, u32) callconv(.C) void; pub extern fn vkCmdDrawIndirectCountKHR(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, countBuffer: VkBuffer, countBufferOffset: VkDeviceSize, maxDrawCount: u32, stride: u32) void; pub extern fn vkCmdDrawIndexedIndirectCountKHR(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, countBuffer: VkBuffer, countBufferOffset: VkDeviceSize, maxDrawCount: u32, stride: u32) void; pub const struct_VkDebugReportCallbackEXT_T = opaque {}; pub const VkDebugReportCallbackEXT = ?*struct_VkDebugReportCallbackEXT_T; pub const VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT; pub const VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = enum_VkDebugReportObjectTypeEXT.VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT; pub const enum_VkDebugReportObjectTypeEXT = extern enum { VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31, VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000, VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = 34, VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 2147483647, }; pub const VkDebugReportObjectTypeEXT = enum_VkDebugReportObjectTypeEXT; pub const VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 1; pub const VK_DEBUG_REPORT_WARNING_BIT_EXT = 2; pub const VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 4; pub const VK_DEBUG_REPORT_ERROR_BIT_EXT = 8; pub const VK_DEBUG_REPORT_DEBUG_BIT_EXT = 16; pub const enum_VkDebugReportFlagBitsEXT = c_int; pub const VkDebugReportFlagBitsEXT = enum_VkDebugReportFlagBitsEXT; pub const VkDebugReportFlagsEXT = VkFlags; pub const PFN_vkDebugReportCallbackEXT = fn ( VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, u64, usize, i32, [*:0]const u8, [*:0]const u8, ?*c_void, ) callconv(.C) VkBool32; pub const struct_VkDebugReportCallbackCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDebugReportFlagsEXT, pfnCallback: PFN_vkDebugReportCallbackEXT, pUserData: ?*c_void, }; pub const VkDebugReportCallbackCreateInfoEXT = struct_VkDebugReportCallbackCreateInfoEXT; pub const PFN_vkCreateDebugReportCallbackEXT = ?fn (VkInstance, ?*const VkDebugReportCallbackCreateInfoEXT, ?*const VkAllocationCallbacks, ?*VkDebugReportCallbackEXT) callconv(.C) VkResult; pub const PFN_vkDestroyDebugReportCallbackEXT = ?fn (VkInstance, VkDebugReportCallbackEXT, ?*const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkDebugReportMessageEXT = ?fn (VkInstance, VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, u64, usize, i32, ?[*]const u8, ?[*]const u8) callconv(.C) void; pub extern fn vkCreateDebugReportCallbackEXT(instance: VkInstance, pCreateInfo: ?[*]const VkDebugReportCallbackCreateInfoEXT, pAllocator: ?[*]const VkAllocationCallbacks, pCallback: ?[*]VkDebugReportCallbackEXT) VkResult; pub extern fn vkDestroyDebugReportCallbackEXT(instance: VkInstance, callback: VkDebugReportCallbackEXT, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkDebugReportMessageEXT(instance: VkInstance, flags: VkDebugReportFlagsEXT, objectType: VkDebugReportObjectTypeEXT, object: u64, location: usize, messageCode: i32, pLayerPrefix: ?[*]const u8, pMessage: ?[*]const u8) void; pub const VK_RASTERIZATION_ORDER_STRICT_AMD = enum_VkRasterizationOrderAMD.VK_RASTERIZATION_ORDER_STRICT_AMD; pub const VK_RASTERIZATION_ORDER_RELAXED_AMD = enum_VkRasterizationOrderAMD.VK_RASTERIZATION_ORDER_RELAXED_AMD; pub const VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = enum_VkRasterizationOrderAMD.VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD; pub const VK_RASTERIZATION_ORDER_END_RANGE_AMD = enum_VkRasterizationOrderAMD.VK_RASTERIZATION_ORDER_END_RANGE_AMD; pub const VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = enum_VkRasterizationOrderAMD.VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD; pub const VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = enum_VkRasterizationOrderAMD.VK_RASTERIZATION_ORDER_MAX_ENUM_AMD; pub const enum_VkRasterizationOrderAMD = extern enum { VK_RASTERIZATION_ORDER_STRICT_AMD = 0, VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = 0, VK_RASTERIZATION_ORDER_END_RANGE_AMD = 1, VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = 2, VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 2147483647, }; pub const VkRasterizationOrderAMD = enum_VkRasterizationOrderAMD; pub const struct_VkPipelineRasterizationStateRasterizationOrderAMD = extern struct { sType: VkStructureType, pNext: ?*const c_void, rasterizationOrder: VkRasterizationOrderAMD, }; pub const VkPipelineRasterizationStateRasterizationOrderAMD = struct_VkPipelineRasterizationStateRasterizationOrderAMD; pub const struct_VkDebugMarkerObjectNameInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectType: VkDebugReportObjectTypeEXT, object: u64, pObjectName: ?[*]const u8, }; pub const VkDebugMarkerObjectNameInfoEXT = struct_VkDebugMarkerObjectNameInfoEXT; pub const struct_VkDebugMarkerObjectTagInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectType: VkDebugReportObjectTypeEXT, object: u64, tagName: u64, tagSize: usize, pTag: ?*const c_void, }; pub const VkDebugMarkerObjectTagInfoEXT = struct_VkDebugMarkerObjectTagInfoEXT; pub const struct_VkDebugMarkerMarkerInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, pMarkerName: ?[*]const u8, color: [4]f32, }; pub const VkDebugMarkerMarkerInfoEXT = struct_VkDebugMarkerMarkerInfoEXT; pub const PFN_vkDebugMarkerSetObjectTagEXT = ?fn (VkDevice, ?[*]const VkDebugMarkerObjectTagInfoEXT) callconv(.C) VkResult; pub const PFN_vkDebugMarkerSetObjectNameEXT = ?fn (VkDevice, ?[*]const VkDebugMarkerObjectNameInfoEXT) callconv(.C) VkResult; pub const PFN_vkCmdDebugMarkerBeginEXT = ?fn (VkCommandBuffer, ?[*]const VkDebugMarkerMarkerInfoEXT) callconv(.C) void; pub const PFN_vkCmdDebugMarkerEndEXT = ?fn (VkCommandBuffer) callconv(.C) void; pub const PFN_vkCmdDebugMarkerInsertEXT = ?fn (VkCommandBuffer, ?[*]const VkDebugMarkerMarkerInfoEXT) callconv(.C) void; pub extern fn vkDebugMarkerSetObjectTagEXT(device: VkDevice, pTagInfo: ?[*]const VkDebugMarkerObjectTagInfoEXT) VkResult; pub extern fn vkDebugMarkerSetObjectNameEXT(device: VkDevice, pNameInfo: ?[*]const VkDebugMarkerObjectNameInfoEXT) VkResult; pub extern fn vkCmdDebugMarkerBeginEXT(commandBuffer: VkCommandBuffer, pMarkerInfo: ?[*]const VkDebugMarkerMarkerInfoEXT) void; pub extern fn vkCmdDebugMarkerEndEXT(commandBuffer: VkCommandBuffer) void; pub extern fn vkCmdDebugMarkerInsertEXT(commandBuffer: VkCommandBuffer, pMarkerInfo: ?[*]const VkDebugMarkerMarkerInfoEXT) void; pub const struct_VkDedicatedAllocationImageCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, dedicatedAllocation: VkBool32, }; pub const VkDedicatedAllocationImageCreateInfoNV = struct_VkDedicatedAllocationImageCreateInfoNV; pub const struct_VkDedicatedAllocationBufferCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, dedicatedAllocation: VkBool32, }; pub const VkDedicatedAllocationBufferCreateInfoNV = struct_VkDedicatedAllocationBufferCreateInfoNV; pub const struct_VkDedicatedAllocationMemoryAllocateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, image: VkImage, buffer: VkBuffer, }; pub const VkDedicatedAllocationMemoryAllocateInfoNV = struct_VkDedicatedAllocationMemoryAllocateInfoNV; pub const PFN_vkCmdDrawIndirectCountAMD = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, u32, u32) callconv(.C) void; pub const PFN_vkCmdDrawIndexedIndirectCountAMD = ?fn (VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, u32, u32) callconv(.C) void; pub extern fn vkCmdDrawIndirectCountAMD(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, countBuffer: VkBuffer, countBufferOffset: VkDeviceSize, maxDrawCount: u32, stride: u32) void; pub extern fn vkCmdDrawIndexedIndirectCountAMD(commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, countBuffer: VkBuffer, countBufferOffset: VkDeviceSize, maxDrawCount: u32, stride: u32) void; pub const struct_VkTextureLODGatherFormatPropertiesAMD = extern struct { sType: VkStructureType, pNext: ?*c_void, supportsTextureGatherLODBiasAMD: VkBool32, }; pub const VkTextureLODGatherFormatPropertiesAMD = struct_VkTextureLODGatherFormatPropertiesAMD; pub const VK_SHADER_INFO_TYPE_STATISTICS_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_STATISTICS_AMD; pub const VK_SHADER_INFO_TYPE_BINARY_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_BINARY_AMD; pub const VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD; pub const VK_SHADER_INFO_TYPE_BEGIN_RANGE_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_BEGIN_RANGE_AMD; pub const VK_SHADER_INFO_TYPE_END_RANGE_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_END_RANGE_AMD; pub const VK_SHADER_INFO_TYPE_RANGE_SIZE_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_RANGE_SIZE_AMD; pub const VK_SHADER_INFO_TYPE_MAX_ENUM_AMD = enum_VkShaderInfoTypeAMD.VK_SHADER_INFO_TYPE_MAX_ENUM_AMD; pub const enum_VkShaderInfoTypeAMD = extern enum { VK_SHADER_INFO_TYPE_STATISTICS_AMD = 0, VK_SHADER_INFO_TYPE_BINARY_AMD = 1, VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD = 2, VK_SHADER_INFO_TYPE_BEGIN_RANGE_AMD = 0, VK_SHADER_INFO_TYPE_END_RANGE_AMD = 2, VK_SHADER_INFO_TYPE_RANGE_SIZE_AMD = 3, VK_SHADER_INFO_TYPE_MAX_ENUM_AMD = 2147483647, }; pub const VkShaderInfoTypeAMD = enum_VkShaderInfoTypeAMD; pub const struct_VkShaderResourceUsageAMD = extern struct { numUsedVgprs: u32, numUsedSgprs: u32, ldsSizePerLocalWorkGroup: u32, ldsUsageSizeInBytes: usize, scratchMemUsageInBytes: usize, }; pub const VkShaderResourceUsageAMD = struct_VkShaderResourceUsageAMD; pub const struct_VkShaderStatisticsInfoAMD = extern struct { shaderStageMask: VkShaderStageFlags, resourceUsage: VkShaderResourceUsageAMD, numPhysicalVgprs: u32, numPhysicalSgprs: u32, numAvailableVgprs: u32, numAvailableSgprs: u32, computeWorkGroupSize: [3]u32, }; pub const VkShaderStatisticsInfoAMD = struct_VkShaderStatisticsInfoAMD; pub const PFN_vkGetShaderInfoAMD = ?fn (VkDevice, VkPipeline, VkShaderStageFlagBits, VkShaderInfoTypeAMD, ?[*]usize, ?*c_void) callconv(.C) VkResult; pub extern fn vkGetShaderInfoAMD(device: VkDevice, pipeline: VkPipeline, shaderStage: VkShaderStageFlagBits, infoType: VkShaderInfoTypeAMD, pInfoSize: ?[*]usize, pInfo: ?*c_void) VkResult; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = enum_VkExternalMemoryHandleTypeFlagBitsNV.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = enum_VkExternalMemoryHandleTypeFlagBitsNV.VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = enum_VkExternalMemoryHandleTypeFlagBitsNV.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = enum_VkExternalMemoryHandleTypeFlagBitsNV.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV; pub const VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = enum_VkExternalMemoryHandleTypeFlagBitsNV.VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV; pub const enum_VkExternalMemoryHandleTypeFlagBitsNV = extern enum { VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 1, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 2, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 4, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 8, VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 2147483647, }; pub const VkExternalMemoryHandleTypeFlagBitsNV = enum_VkExternalMemoryHandleTypeFlagBitsNV; pub const VkExternalMemoryHandleTypeFlagsNV = VkFlags; pub const VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = enum_VkExternalMemoryFeatureFlagBitsNV.VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV; pub const VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = enum_VkExternalMemoryFeatureFlagBitsNV.VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV; pub const VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = enum_VkExternalMemoryFeatureFlagBitsNV.VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV; pub const VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = enum_VkExternalMemoryFeatureFlagBitsNV.VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV; pub const enum_VkExternalMemoryFeatureFlagBitsNV = extern enum { VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 1, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 2, VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 4, VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 2147483647, }; pub const VkExternalMemoryFeatureFlagBitsNV = enum_VkExternalMemoryFeatureFlagBitsNV; pub const VkExternalMemoryFeatureFlagsNV = VkFlags; pub const struct_VkExternalImageFormatPropertiesNV = extern struct { imageFormatProperties: VkImageFormatProperties, externalMemoryFeatures: VkExternalMemoryFeatureFlagsNV, exportFromImportedHandleTypes: VkExternalMemoryHandleTypeFlagsNV, compatibleHandleTypes: VkExternalMemoryHandleTypeFlagsNV, }; pub const VkExternalImageFormatPropertiesNV = struct_VkExternalImageFormatPropertiesNV; pub const PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV = ?fn (VkPhysicalDevice, VkFormat, VkImageType, VkImageTiling, VkImageUsageFlags, VkImageCreateFlags, VkExternalMemoryHandleTypeFlagsNV, ?[*]VkExternalImageFormatPropertiesNV) callconv(.C) VkResult; pub extern fn vkGetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice: VkPhysicalDevice, format: VkFormat, type_0: VkImageType, tiling: VkImageTiling, usage: VkImageUsageFlags, flags: VkImageCreateFlags, externalHandleType: VkExternalMemoryHandleTypeFlagsNV, pExternalImageFormatProperties: ?[*]VkExternalImageFormatPropertiesNV) VkResult; pub const struct_VkExternalMemoryImageCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalMemoryHandleTypeFlagsNV, }; pub const VkExternalMemoryImageCreateInfoNV = struct_VkExternalMemoryImageCreateInfoNV; pub const struct_VkExportMemoryAllocateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleTypes: VkExternalMemoryHandleTypeFlagsNV, }; pub const VkExportMemoryAllocateInfoNV = struct_VkExportMemoryAllocateInfoNV; pub const VK_VALIDATION_CHECK_ALL_EXT = enum_VkValidationCheckEXT.VK_VALIDATION_CHECK_ALL_EXT; pub const VK_VALIDATION_CHECK_SHADERS_EXT = enum_VkValidationCheckEXT.VK_VALIDATION_CHECK_SHADERS_EXT; pub const VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = enum_VkValidationCheckEXT.VK_VALIDATION_CHECK_BEGIN_RANGE_EXT; pub const VK_VALIDATION_CHECK_END_RANGE_EXT = enum_VkValidationCheckEXT.VK_VALIDATION_CHECK_END_RANGE_EXT; pub const VK_VALIDATION_CHECK_RANGE_SIZE_EXT = enum_VkValidationCheckEXT.VK_VALIDATION_CHECK_RANGE_SIZE_EXT; pub const VK_VALIDATION_CHECK_MAX_ENUM_EXT = enum_VkValidationCheckEXT.VK_VALIDATION_CHECK_MAX_ENUM_EXT; pub const enum_VkValidationCheckEXT = extern enum { VK_VALIDATION_CHECK_ALL_EXT = 0, VK_VALIDATION_CHECK_SHADERS_EXT = 1, VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = 0, VK_VALIDATION_CHECK_END_RANGE_EXT = 1, VK_VALIDATION_CHECK_RANGE_SIZE_EXT = 2, VK_VALIDATION_CHECK_MAX_ENUM_EXT = 2147483647, }; pub const VkValidationCheckEXT = enum_VkValidationCheckEXT; pub const struct_VkValidationFlagsEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, disabledValidationCheckCount: u32, pDisabledValidationChecks: ?[*]VkValidationCheckEXT, }; pub const VkValidationFlagsEXT = struct_VkValidationFlagsEXT; pub const struct_VkObjectTableNVX_T = opaque {}; pub const VkObjectTableNVX = ?*struct_VkObjectTableNVX_T; pub const struct_VkIndirectCommandsLayoutNVX_T = opaque {}; pub const VkIndirectCommandsLayoutNVX = ?*struct_VkIndirectCommandsLayoutNVX_T; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX; pub const VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = enum_VkIndirectCommandsTokenTypeNVX.VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX; pub const enum_VkIndirectCommandsTokenTypeNVX = extern enum { VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = 0, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = 1, VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = 2, VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = 3, VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = 4, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = 5, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = 6, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = 7, VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = 0, VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = 7, VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = 8, VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = 2147483647, }; pub const VkIndirectCommandsTokenTypeNVX = enum_VkIndirectCommandsTokenTypeNVX; pub const VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX; pub const VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX; pub const VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX; pub const VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX; pub const VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX; pub const VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX; pub const VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX; pub const VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX; pub const VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = enum_VkObjectEntryTypeNVX.VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX; pub const enum_VkObjectEntryTypeNVX = extern enum { VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = 0, VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = 1, VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = 2, VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = 3, VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = 4, VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = 0, VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = 4, VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = 5, VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = 2147483647, }; pub const VkObjectEntryTypeNVX = enum_VkObjectEntryTypeNVX; pub const VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = enum_VkIndirectCommandsLayoutUsageFlagBitsNVX.VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX; pub const VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = enum_VkIndirectCommandsLayoutUsageFlagBitsNVX.VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX; pub const VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = enum_VkIndirectCommandsLayoutUsageFlagBitsNVX.VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX; pub const VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = enum_VkIndirectCommandsLayoutUsageFlagBitsNVX.VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX; pub const VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX = enum_VkIndirectCommandsLayoutUsageFlagBitsNVX.VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX; pub const enum_VkIndirectCommandsLayoutUsageFlagBitsNVX = extern enum { VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 1, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 2, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 4, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 8, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX = 2147483647, }; pub const VkIndirectCommandsLayoutUsageFlagBitsNVX = enum_VkIndirectCommandsLayoutUsageFlagBitsNVX; pub const VkIndirectCommandsLayoutUsageFlagsNVX = VkFlags; pub const VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = enum_VkObjectEntryUsageFlagBitsNVX.VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX; pub const VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = enum_VkObjectEntryUsageFlagBitsNVX.VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX; pub const VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX = enum_VkObjectEntryUsageFlagBitsNVX.VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX; pub const enum_VkObjectEntryUsageFlagBitsNVX = extern enum { VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 1, VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 2, VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX = 2147483647, }; pub const VkObjectEntryUsageFlagBitsNVX = enum_VkObjectEntryUsageFlagBitsNVX; pub const VkObjectEntryUsageFlagsNVX = VkFlags; pub const struct_VkDeviceGeneratedCommandsFeaturesNVX = extern struct { sType: VkStructureType, pNext: ?*const c_void, computeBindingPointSupport: VkBool32, }; pub const VkDeviceGeneratedCommandsFeaturesNVX = struct_VkDeviceGeneratedCommandsFeaturesNVX; pub const struct_VkDeviceGeneratedCommandsLimitsNVX = extern struct { sType: VkStructureType, pNext: ?*const c_void, maxIndirectCommandsLayoutTokenCount: u32, maxObjectEntryCounts: u32, minSequenceCountBufferOffsetAlignment: u32, minSequenceIndexBufferOffsetAlignment: u32, minCommandsTokenBufferOffsetAlignment: u32, }; pub const VkDeviceGeneratedCommandsLimitsNVX = struct_VkDeviceGeneratedCommandsLimitsNVX; pub const struct_VkIndirectCommandsTokenNVX = extern struct { tokenType: VkIndirectCommandsTokenTypeNVX, buffer: VkBuffer, offset: VkDeviceSize, }; pub const VkIndirectCommandsTokenNVX = struct_VkIndirectCommandsTokenNVX; pub const struct_VkIndirectCommandsLayoutTokenNVX = extern struct { tokenType: VkIndirectCommandsTokenTypeNVX, bindingUnit: u32, dynamicCount: u32, divisor: u32, }; pub const VkIndirectCommandsLayoutTokenNVX = struct_VkIndirectCommandsLayoutTokenNVX; pub const struct_VkIndirectCommandsLayoutCreateInfoNVX = extern struct { sType: VkStructureType, pNext: ?*const c_void, pipelineBindPoint: VkPipelineBindPoint, flags: VkIndirectCommandsLayoutUsageFlagsNVX, tokenCount: u32, pTokens: ?[*]const VkIndirectCommandsLayoutTokenNVX, }; pub const VkIndirectCommandsLayoutCreateInfoNVX = struct_VkIndirectCommandsLayoutCreateInfoNVX; pub const struct_VkCmdProcessCommandsInfoNVX = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectTable: VkObjectTableNVX, indirectCommandsLayout: VkIndirectCommandsLayoutNVX, indirectCommandsTokenCount: u32, pIndirectCommandsTokens: ?[*]const VkIndirectCommandsTokenNVX, maxSequencesCount: u32, targetCommandBuffer: VkCommandBuffer, sequencesCountBuffer: VkBuffer, sequencesCountOffset: VkDeviceSize, sequencesIndexBuffer: VkBuffer, sequencesIndexOffset: VkDeviceSize, }; pub const VkCmdProcessCommandsInfoNVX = struct_VkCmdProcessCommandsInfoNVX; pub const struct_VkCmdReserveSpaceForCommandsInfoNVX = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectTable: VkObjectTableNVX, indirectCommandsLayout: VkIndirectCommandsLayoutNVX, maxSequencesCount: u32, }; pub const VkCmdReserveSpaceForCommandsInfoNVX = struct_VkCmdReserveSpaceForCommandsInfoNVX; pub const struct_VkObjectTableCreateInfoNVX = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectCount: u32, pObjectEntryTypes: ?[*]const VkObjectEntryTypeNVX, pObjectEntryCounts: ?[*]const u32, pObjectEntryUsageFlags: ?[*]const VkObjectEntryUsageFlagsNVX, maxUniformBuffersPerDescriptor: u32, maxStorageBuffersPerDescriptor: u32, maxStorageImagesPerDescriptor: u32, maxSampledImagesPerDescriptor: u32, maxPipelineLayouts: u32, }; pub const VkObjectTableCreateInfoNVX = struct_VkObjectTableCreateInfoNVX; pub const struct_VkObjectTableEntryNVX = extern struct { type: VkObjectEntryTypeNVX, flags: VkObjectEntryUsageFlagsNVX, }; pub const VkObjectTableEntryNVX = struct_VkObjectTableEntryNVX; pub const struct_VkObjectTablePipelineEntryNVX = extern struct { type: VkObjectEntryTypeNVX, flags: VkObjectEntryUsageFlagsNVX, pipeline: VkPipeline, }; pub const VkObjectTablePipelineEntryNVX = struct_VkObjectTablePipelineEntryNVX; pub const struct_VkObjectTableDescriptorSetEntryNVX = extern struct { type: VkObjectEntryTypeNVX, flags: VkObjectEntryUsageFlagsNVX, pipelineLayout: VkPipelineLayout, descriptorSet: VkDescriptorSet, }; pub const VkObjectTableDescriptorSetEntryNVX = struct_VkObjectTableDescriptorSetEntryNVX; pub const struct_VkObjectTableVertexBufferEntryNVX = extern struct { type: VkObjectEntryTypeNVX, flags: VkObjectEntryUsageFlagsNVX, buffer: VkBuffer, }; pub const VkObjectTableVertexBufferEntryNVX = struct_VkObjectTableVertexBufferEntryNVX; pub const struct_VkObjectTableIndexBufferEntryNVX = extern struct { type: VkObjectEntryTypeNVX, flags: VkObjectEntryUsageFlagsNVX, buffer: VkBuffer, indexType: VkIndexType, }; pub const VkObjectTableIndexBufferEntryNVX = struct_VkObjectTableIndexBufferEntryNVX; pub const struct_VkObjectTablePushConstantEntryNVX = extern struct { type: VkObjectEntryTypeNVX, flags: VkObjectEntryUsageFlagsNVX, pipelineLayout: VkPipelineLayout, stageFlags: VkShaderStageFlags, }; pub const VkObjectTablePushConstantEntryNVX = struct_VkObjectTablePushConstantEntryNVX; pub const PFN_vkCmdProcessCommandsNVX = ?fn (VkCommandBuffer, ?[*]const VkCmdProcessCommandsInfoNVX) callconv(.C) void; pub const PFN_vkCmdReserveSpaceForCommandsNVX = ?fn (VkCommandBuffer, ?[*]const VkCmdReserveSpaceForCommandsInfoNVX) callconv(.C) void; pub const PFN_vkCreateIndirectCommandsLayoutNVX = ?fn (VkDevice, ?[*]const VkIndirectCommandsLayoutCreateInfoNVX, ?[*]const VkAllocationCallbacks, ?[*]VkIndirectCommandsLayoutNVX) callconv(.C) VkResult; pub const PFN_vkDestroyIndirectCommandsLayoutNVX = ?fn (VkDevice, VkIndirectCommandsLayoutNVX, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkCreateObjectTableNVX = ?fn (VkDevice, ?[*]const VkObjectTableCreateInfoNVX, ?[*]const VkAllocationCallbacks, ?[*]VkObjectTableNVX) callconv(.C) VkResult; pub const PFN_vkDestroyObjectTableNVX = ?fn (VkDevice, VkObjectTableNVX, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkRegisterObjectsNVX = ?fn (VkDevice, VkObjectTableNVX, u32, ?[*]const (?[*]const VkObjectTableEntryNVX), ?[*]const u32) callconv(.C) VkResult; pub const PFN_vkUnregisterObjectsNVX = ?fn (VkDevice, VkObjectTableNVX, u32, ?[*]const VkObjectEntryTypeNVX, ?[*]const u32) callconv(.C) VkResult; pub const PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX = ?fn (VkPhysicalDevice, ?[*]VkDeviceGeneratedCommandsFeaturesNVX, ?[*]VkDeviceGeneratedCommandsLimitsNVX) callconv(.C) void; pub extern fn vkCmdProcessCommandsNVX(commandBuffer: VkCommandBuffer, pProcessCommandsInfo: ?[*]const VkCmdProcessCommandsInfoNVX) void; pub extern fn vkCmdReserveSpaceForCommandsNVX(commandBuffer: VkCommandBuffer, pReserveSpaceInfo: ?[*]const VkCmdReserveSpaceForCommandsInfoNVX) void; pub extern fn vkCreateIndirectCommandsLayoutNVX(device: VkDevice, pCreateInfo: ?[*]const VkIndirectCommandsLayoutCreateInfoNVX, pAllocator: ?[*]const VkAllocationCallbacks, pIndirectCommandsLayout: ?[*]VkIndirectCommandsLayoutNVX) VkResult; pub extern fn vkDestroyIndirectCommandsLayoutNVX(device: VkDevice, indirectCommandsLayout: VkIndirectCommandsLayoutNVX, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkCreateObjectTableNVX(device: VkDevice, pCreateInfo: ?[*]const VkObjectTableCreateInfoNVX, pAllocator: ?[*]const VkAllocationCallbacks, pObjectTable: ?[*]VkObjectTableNVX) VkResult; pub extern fn vkDestroyObjectTableNVX(device: VkDevice, objectTable: VkObjectTableNVX, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkRegisterObjectsNVX(device: VkDevice, objectTable: VkObjectTableNVX, objectCount: u32, ppObjectTableEntries: ?[*]const (?[*]const VkObjectTableEntryNVX), pObjectIndices: ?[*]const u32) VkResult; pub extern fn vkUnregisterObjectsNVX(device: VkDevice, objectTable: VkObjectTableNVX, objectCount: u32, pObjectEntryTypes: ?[*]const VkObjectEntryTypeNVX, pObjectIndices: ?[*]const u32) VkResult; pub extern fn vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice: VkPhysicalDevice, pFeatures: ?[*]VkDeviceGeneratedCommandsFeaturesNVX, pLimits: ?[*]VkDeviceGeneratedCommandsLimitsNVX) void; pub const struct_VkViewportWScalingNV = extern struct { xcoeff: f32, ycoeff: f32, }; pub const VkViewportWScalingNV = struct_VkViewportWScalingNV; pub const struct_VkPipelineViewportWScalingStateCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, viewportWScalingEnable: VkBool32, viewportCount: u32, pViewportWScalings: ?[*]const VkViewportWScalingNV, }; pub const VkPipelineViewportWScalingStateCreateInfoNV = struct_VkPipelineViewportWScalingStateCreateInfoNV; pub const PFN_vkCmdSetViewportWScalingNV = ?fn (VkCommandBuffer, u32, u32, ?[*]const VkViewportWScalingNV) callconv(.C) void; pub extern fn vkCmdSetViewportWScalingNV(commandBuffer: VkCommandBuffer, firstViewport: u32, viewportCount: u32, pViewportWScalings: ?[*]const VkViewportWScalingNV) void; pub const PFN_vkReleaseDisplayEXT = ?fn (VkPhysicalDevice, VkDisplayKHR) callconv(.C) VkResult; pub extern fn vkReleaseDisplayEXT(physicalDevice: VkPhysicalDevice, display: VkDisplayKHR) VkResult; pub const VK_SURFACE_COUNTER_VBLANK_EXT = enum_VkSurfaceCounterFlagBitsEXT.VK_SURFACE_COUNTER_VBLANK_EXT; pub const VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = enum_VkSurfaceCounterFlagBitsEXT.VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT; pub const enum_VkSurfaceCounterFlagBitsEXT = extern enum { VK_SURFACE_COUNTER_VBLANK_EXT = 1, VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = 2147483647, }; pub const VkSurfaceCounterFlagBitsEXT = enum_VkSurfaceCounterFlagBitsEXT; pub const VkSurfaceCounterFlagsEXT = VkFlags; pub const struct_VkSurfaceCapabilities2EXT = extern struct { sType: VkStructureType, pNext: ?*c_void, minImageCount: u32, maxImageCount: u32, currentExtent: VkExtent2D, minImageExtent: VkExtent2D, maxImageExtent: VkExtent2D, maxImageArrayLayers: u32, supportedTransforms: VkSurfaceTransformFlagsKHR, currentTransform: VkSurfaceTransformFlagBitsKHR, supportedCompositeAlpha: VkCompositeAlphaFlagsKHR, supportedUsageFlags: VkImageUsageFlags, supportedSurfaceCounters: VkSurfaceCounterFlagsEXT, }; pub const VkSurfaceCapabilities2EXT = struct_VkSurfaceCapabilities2EXT; pub const PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT = ?fn (VkPhysicalDevice, VkSurfaceKHR, ?[*]VkSurfaceCapabilities2EXT) callconv(.C) VkResult; pub extern fn vkGetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice: VkPhysicalDevice, surface: VkSurfaceKHR, pSurfaceCapabilities: ?[*]VkSurfaceCapabilities2EXT) VkResult; pub const VK_DISPLAY_POWER_STATE_OFF_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_OFF_EXT; pub const VK_DISPLAY_POWER_STATE_SUSPEND_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_SUSPEND_EXT; pub const VK_DISPLAY_POWER_STATE_ON_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_ON_EXT; pub const VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT; pub const VK_DISPLAY_POWER_STATE_END_RANGE_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_END_RANGE_EXT; pub const VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT; pub const VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = enum_VkDisplayPowerStateEXT.VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT; pub const enum_VkDisplayPowerStateEXT = extern enum { VK_DISPLAY_POWER_STATE_OFF_EXT = 0, VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1, VK_DISPLAY_POWER_STATE_ON_EXT = 2, VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT = 0, VK_DISPLAY_POWER_STATE_END_RANGE_EXT = 2, VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT = 3, VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = 2147483647, }; pub const VkDisplayPowerStateEXT = enum_VkDisplayPowerStateEXT; pub const VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = enum_VkDeviceEventTypeEXT.VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT; pub const VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT = enum_VkDeviceEventTypeEXT.VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT; pub const VK_DEVICE_EVENT_TYPE_END_RANGE_EXT = enum_VkDeviceEventTypeEXT.VK_DEVICE_EVENT_TYPE_END_RANGE_EXT; pub const VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT = enum_VkDeviceEventTypeEXT.VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT; pub const VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = enum_VkDeviceEventTypeEXT.VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT; pub const enum_VkDeviceEventTypeEXT = extern enum { VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0, VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT = 0, VK_DEVICE_EVENT_TYPE_END_RANGE_EXT = 0, VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT = 1, VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = 2147483647, }; pub const VkDeviceEventTypeEXT = enum_VkDeviceEventTypeEXT; pub const VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = enum_VkDisplayEventTypeEXT.VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT; pub const VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT = enum_VkDisplayEventTypeEXT.VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT; pub const VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT = enum_VkDisplayEventTypeEXT.VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT; pub const VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT = enum_VkDisplayEventTypeEXT.VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT; pub const VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = enum_VkDisplayEventTypeEXT.VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT; pub const enum_VkDisplayEventTypeEXT = extern enum { VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0, VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT = 0, VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT = 0, VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT = 1, VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = 2147483647, }; pub const VkDisplayEventTypeEXT = enum_VkDisplayEventTypeEXT; pub const struct_VkDisplayPowerInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, powerState: VkDisplayPowerStateEXT, }; pub const VkDisplayPowerInfoEXT = struct_VkDisplayPowerInfoEXT; pub const struct_VkDeviceEventInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, deviceEvent: VkDeviceEventTypeEXT, }; pub const VkDeviceEventInfoEXT = struct_VkDeviceEventInfoEXT; pub const struct_VkDisplayEventInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, displayEvent: VkDisplayEventTypeEXT, }; pub const VkDisplayEventInfoEXT = struct_VkDisplayEventInfoEXT; pub const struct_VkSwapchainCounterCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, surfaceCounters: VkSurfaceCounterFlagsEXT, }; pub const VkSwapchainCounterCreateInfoEXT = struct_VkSwapchainCounterCreateInfoEXT; pub const PFN_vkDisplayPowerControlEXT = ?fn (VkDevice, VkDisplayKHR, ?[*]const VkDisplayPowerInfoEXT) callconv(.C) VkResult; pub const PFN_vkRegisterDeviceEventEXT = ?fn (VkDevice, ?[*]const VkDeviceEventInfoEXT, ?[*]const VkAllocationCallbacks, ?[*]VkFence) callconv(.C) VkResult; pub const PFN_vkRegisterDisplayEventEXT = ?fn (VkDevice, VkDisplayKHR, ?[*]const VkDisplayEventInfoEXT, ?[*]const VkAllocationCallbacks, ?[*]VkFence) callconv(.C) VkResult; pub const PFN_vkGetSwapchainCounterEXT = ?fn (VkDevice, VkSwapchainKHR, VkSurfaceCounterFlagBitsEXT, ?[*]u64) callconv(.C) VkResult; pub extern fn vkDisplayPowerControlEXT(device: VkDevice, display: VkDisplayKHR, pDisplayPowerInfo: ?[*]const VkDisplayPowerInfoEXT) VkResult; pub extern fn vkRegisterDeviceEventEXT(device: VkDevice, pDeviceEventInfo: ?[*]const VkDeviceEventInfoEXT, pAllocator: ?[*]const VkAllocationCallbacks, pFence: ?[*]VkFence) VkResult; pub extern fn vkRegisterDisplayEventEXT(device: VkDevice, display: VkDisplayKHR, pDisplayEventInfo: ?[*]const VkDisplayEventInfoEXT, pAllocator: ?[*]const VkAllocationCallbacks, pFence: ?[*]VkFence) VkResult; pub extern fn vkGetSwapchainCounterEXT(device: VkDevice, swapchain: VkSwapchainKHR, counter: VkSurfaceCounterFlagBitsEXT, pCounterValue: ?[*]u64) VkResult; pub const struct_VkRefreshCycleDurationGOOGLE = extern struct { refreshDuration: u64, }; pub const VkRefreshCycleDurationGOOGLE = struct_VkRefreshCycleDurationGOOGLE; pub const struct_VkPastPresentationTimingGOOGLE = extern struct { presentID: u32, desiredPresentTime: u64, actualPresentTime: u64, earliestPresentTime: u64, presentMargin: u64, }; pub const VkPastPresentationTimingGOOGLE = struct_VkPastPresentationTimingGOOGLE; pub const struct_VkPresentTimeGOOGLE = extern struct { presentID: u32, desiredPresentTime: u64, }; pub const VkPresentTimeGOOGLE = struct_VkPresentTimeGOOGLE; pub const struct_VkPresentTimesInfoGOOGLE = extern struct { sType: VkStructureType, pNext: ?*const c_void, swapchainCount: u32, pTimes: ?[*]const VkPresentTimeGOOGLE, }; pub const VkPresentTimesInfoGOOGLE = struct_VkPresentTimesInfoGOOGLE; pub const PFN_vkGetRefreshCycleDurationGOOGLE = ?fn (VkDevice, VkSwapchainKHR, ?[*]VkRefreshCycleDurationGOOGLE) callconv(.C) VkResult; pub const PFN_vkGetPastPresentationTimingGOOGLE = ?fn (VkDevice, VkSwapchainKHR, ?[*]u32, ?[*]VkPastPresentationTimingGOOGLE) callconv(.C) VkResult; pub extern fn vkGetRefreshCycleDurationGOOGLE(device: VkDevice, swapchain: VkSwapchainKHR, pDisplayTimingProperties: ?[*]VkRefreshCycleDurationGOOGLE) VkResult; pub extern fn vkGetPastPresentationTimingGOOGLE(device: VkDevice, swapchain: VkSwapchainKHR, pPresentationTimingCount: ?[*]u32, pPresentationTimings: ?[*]VkPastPresentationTimingGOOGLE) VkResult; pub const struct_VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX = extern struct { sType: VkStructureType, pNext: ?*c_void, perViewPositionAllComponents: VkBool32, }; pub const VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX = struct_VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV; pub const VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = enum_VkViewportCoordinateSwizzleNV.VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV; pub const enum_VkViewportCoordinateSwizzleNV = extern enum { VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV = 0, VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV = 7, VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV = 8, VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = 2147483647, }; pub const VkViewportCoordinateSwizzleNV = enum_VkViewportCoordinateSwizzleNV; pub const VkPipelineViewportSwizzleStateCreateFlagsNV = VkFlags; pub const struct_VkViewportSwizzleNV = extern struct { x: VkViewportCoordinateSwizzleNV, y: VkViewportCoordinateSwizzleNV, z: VkViewportCoordinateSwizzleNV, w: VkViewportCoordinateSwizzleNV, }; pub const VkViewportSwizzleNV = struct_VkViewportSwizzleNV; pub const struct_VkPipelineViewportSwizzleStateCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineViewportSwizzleStateCreateFlagsNV, viewportCount: u32, pViewportSwizzles: ?[*]const VkViewportSwizzleNV, }; pub const VkPipelineViewportSwizzleStateCreateInfoNV = struct_VkPipelineViewportSwizzleStateCreateInfoNV; pub const VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = enum_VkDiscardRectangleModeEXT.VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT; pub const VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = enum_VkDiscardRectangleModeEXT.VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT; pub const VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = enum_VkDiscardRectangleModeEXT.VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT; pub const VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = enum_VkDiscardRectangleModeEXT.VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT; pub const VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = enum_VkDiscardRectangleModeEXT.VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT; pub const VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = enum_VkDiscardRectangleModeEXT.VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT; pub const enum_VkDiscardRectangleModeEXT = extern enum { VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = 0, VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = 1, VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = 2, VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 2147483647, }; pub const VkDiscardRectangleModeEXT = enum_VkDiscardRectangleModeEXT; pub const VkPipelineDiscardRectangleStateCreateFlagsEXT = VkFlags; pub const struct_VkPhysicalDeviceDiscardRectanglePropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, maxDiscardRectangles: u32, }; pub const VkPhysicalDeviceDiscardRectanglePropertiesEXT = struct_VkPhysicalDeviceDiscardRectanglePropertiesEXT; pub const struct_VkPipelineDiscardRectangleStateCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineDiscardRectangleStateCreateFlagsEXT, discardRectangleMode: VkDiscardRectangleModeEXT, discardRectangleCount: u32, pDiscardRectangles: ?[*]const VkRect2D, }; pub const VkPipelineDiscardRectangleStateCreateInfoEXT = struct_VkPipelineDiscardRectangleStateCreateInfoEXT; pub const PFN_vkCmdSetDiscardRectangleEXT = ?fn (VkCommandBuffer, u32, u32, ?[*]const VkRect2D) callconv(.C) void; pub extern fn vkCmdSetDiscardRectangleEXT(commandBuffer: VkCommandBuffer, firstDiscardRectangle: u32, discardRectangleCount: u32, pDiscardRectangles: ?[*]const VkRect2D) void; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_BEGIN_RANGE_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_BEGIN_RANGE_EXT; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_END_RANGE_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_END_RANGE_EXT; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_RANGE_SIZE_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_RANGE_SIZE_EXT; pub const VK_CONSERVATIVE_RASTERIZATION_MODE_MAX_ENUM_EXT = enum_VkConservativeRasterizationModeEXT.VK_CONSERVATIVE_RASTERIZATION_MODE_MAX_ENUM_EXT; pub const enum_VkConservativeRasterizationModeEXT = extern enum { VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = 0, VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = 1, VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = 2, VK_CONSERVATIVE_RASTERIZATION_MODE_BEGIN_RANGE_EXT = 0, VK_CONSERVATIVE_RASTERIZATION_MODE_END_RANGE_EXT = 2, VK_CONSERVATIVE_RASTERIZATION_MODE_RANGE_SIZE_EXT = 3, VK_CONSERVATIVE_RASTERIZATION_MODE_MAX_ENUM_EXT = 2147483647, }; pub const VkConservativeRasterizationModeEXT = enum_VkConservativeRasterizationModeEXT; pub const VkPipelineRasterizationConservativeStateCreateFlagsEXT = VkFlags; pub const struct_VkPhysicalDeviceConservativeRasterizationPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, primitiveOverestimationSize: f32, maxExtraPrimitiveOverestimationSize: f32, extraPrimitiveOverestimationSizeGranularity: f32, primitiveUnderestimation: VkBool32, conservativePointAndLineRasterization: VkBool32, degenerateTrianglesRasterized: VkBool32, degenerateLinesRasterized: VkBool32, fullyCoveredFragmentShaderInputVariable: VkBool32, conservativeRasterizationPostDepthCoverage: VkBool32, }; pub const VkPhysicalDeviceConservativeRasterizationPropertiesEXT = struct_VkPhysicalDeviceConservativeRasterizationPropertiesEXT; pub const struct_VkPipelineRasterizationConservativeStateCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineRasterizationConservativeStateCreateFlagsEXT, conservativeRasterizationMode: VkConservativeRasterizationModeEXT, extraPrimitiveOverestimationSize: f32, }; pub const VkPipelineRasterizationConservativeStateCreateInfoEXT = struct_VkPipelineRasterizationConservativeStateCreateInfoEXT; pub const struct_VkXYColorEXT = extern struct { x: f32, y: f32, }; pub const VkXYColorEXT = struct_VkXYColorEXT; pub const struct_VkHdrMetadataEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, displayPrimaryRed: VkXYColorEXT, displayPrimaryGreen: VkXYColorEXT, displayPrimaryBlue: VkXYColorEXT, whitePoint: VkXYColorEXT, maxLuminance: f32, minLuminance: f32, maxContentLightLevel: f32, maxFrameAverageLightLevel: f32, }; pub const VkHdrMetadataEXT = struct_VkHdrMetadataEXT; pub const PFN_vkSetHdrMetadataEXT = ?fn (VkDevice, u32, ?[*]const VkSwapchainKHR, ?[*]const VkHdrMetadataEXT) callconv(.C) void; pub extern fn vkSetHdrMetadataEXT(device: VkDevice, swapchainCount: u32, pSwapchains: ?[*]const VkSwapchainKHR, pMetadata: ?[*]const VkHdrMetadataEXT) void; pub const struct_VkDebugUtilsMessengerEXT_T = opaque {}; pub const VkDebugUtilsMessengerEXT = ?*struct_VkDebugUtilsMessengerEXT_T; pub const VkDebugUtilsMessengerCallbackDataFlagsEXT = VkFlags; pub const VkDebugUtilsMessengerCreateFlagsEXT = VkFlags; pub const VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT = enum_VkDebugUtilsMessageSeverityFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT = enum_VkDebugUtilsMessageSeverityFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT = enum_VkDebugUtilsMessageSeverityFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT = enum_VkDebugUtilsMessageSeverityFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT = enum_VkDebugUtilsMessageSeverityFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT; pub const enum_VkDebugUtilsMessageSeverityFlagBitsEXT = extern enum { VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT = 1, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT = 16, VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT = 256, VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT = 4096, VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT = 2147483647, }; pub const VkDebugUtilsMessageSeverityFlagBitsEXT = enum_VkDebugUtilsMessageSeverityFlagBitsEXT; pub const VkDebugUtilsMessageSeverityFlagsEXT = VkFlags; pub const VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = enum_VkDebugUtilsMessageTypeFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = enum_VkDebugUtilsMessageTypeFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = enum_VkDebugUtilsMessageTypeFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; pub const VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_MAX_ENUM_EXT = enum_VkDebugUtilsMessageTypeFlagBitsEXT.VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_MAX_ENUM_EXT; pub const enum_VkDebugUtilsMessageTypeFlagBitsEXT = extern enum { VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = 1, VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = 2, VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = 4, VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_MAX_ENUM_EXT = 2147483647, }; pub const VkDebugUtilsMessageTypeFlagBitsEXT = enum_VkDebugUtilsMessageTypeFlagBitsEXT; pub const VkDebugUtilsMessageTypeFlagsEXT = VkFlags; pub const struct_VkDebugUtilsObjectNameInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectType: VkObjectType, objectHandle: u64, pObjectName: ?[*]const u8, }; pub const VkDebugUtilsObjectNameInfoEXT = struct_VkDebugUtilsObjectNameInfoEXT; pub const struct_VkDebugUtilsObjectTagInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, objectType: VkObjectType, objectHandle: u64, tagName: u64, tagSize: usize, pTag: ?*const c_void, }; pub const VkDebugUtilsObjectTagInfoEXT = struct_VkDebugUtilsObjectTagInfoEXT; pub const struct_VkDebugUtilsLabelEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, pLabelName: ?[*]const u8, color: [4]f32, }; pub const VkDebugUtilsLabelEXT = struct_VkDebugUtilsLabelEXT; pub const struct_VkDebugUtilsMessengerCallbackDataEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDebugUtilsMessengerCallbackDataFlagsEXT, pMessageIdName: ?[*]const u8, messageIdNumber: i32, pMessage: ?[*]const u8, queueLabelCount: u32, pQueueLabels: ?[*]VkDebugUtilsLabelEXT, cmdBufLabelCount: u32, pCmdBufLabels: ?[*]VkDebugUtilsLabelEXT, objectCount: u32, pObjects: ?[*]VkDebugUtilsObjectNameInfoEXT, }; pub const VkDebugUtilsMessengerCallbackDataEXT = struct_VkDebugUtilsMessengerCallbackDataEXT; pub const PFN_vkDebugUtilsMessengerCallbackEXT = ?fn (VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, ?[*]const VkDebugUtilsMessengerCallbackDataEXT, ?*c_void) callconv(.C) VkBool32; pub const struct_VkDebugUtilsMessengerCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkDebugUtilsMessengerCreateFlagsEXT, messageSeverity: VkDebugUtilsMessageSeverityFlagsEXT, messageType: VkDebugUtilsMessageTypeFlagsEXT, pfnUserCallback: PFN_vkDebugUtilsMessengerCallbackEXT, pUserData: ?*c_void, }; pub const VkDebugUtilsMessengerCreateInfoEXT = struct_VkDebugUtilsMessengerCreateInfoEXT; pub const PFN_vkSetDebugUtilsObjectNameEXT = ?fn (VkDevice, ?[*]const VkDebugUtilsObjectNameInfoEXT) callconv(.C) VkResult; pub const PFN_vkSetDebugUtilsObjectTagEXT = ?fn (VkDevice, ?[*]const VkDebugUtilsObjectTagInfoEXT) callconv(.C) VkResult; pub const PFN_vkQueueBeginDebugUtilsLabelEXT = ?fn (VkQueue, ?[*]const VkDebugUtilsLabelEXT) callconv(.C) void; pub const PFN_vkQueueEndDebugUtilsLabelEXT = ?fn (VkQueue) callconv(.C) void; pub const PFN_vkQueueInsertDebugUtilsLabelEXT = ?fn (VkQueue, ?[*]const VkDebugUtilsLabelEXT) callconv(.C) void; pub const PFN_vkCmdBeginDebugUtilsLabelEXT = ?fn (VkCommandBuffer, ?[*]const VkDebugUtilsLabelEXT) callconv(.C) void; pub const PFN_vkCmdEndDebugUtilsLabelEXT = ?fn (VkCommandBuffer) callconv(.C) void; pub const PFN_vkCmdInsertDebugUtilsLabelEXT = ?fn (VkCommandBuffer, ?[*]const VkDebugUtilsLabelEXT) callconv(.C) void; pub const PFN_vkCreateDebugUtilsMessengerEXT = ?fn (VkInstance, ?[*]const VkDebugUtilsMessengerCreateInfoEXT, ?[*]const VkAllocationCallbacks, ?[*]VkDebugUtilsMessengerEXT) callconv(.C) VkResult; pub const PFN_vkDestroyDebugUtilsMessengerEXT = ?fn (VkInstance, VkDebugUtilsMessengerEXT, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkSubmitDebugUtilsMessageEXT = ?fn (VkInstance, VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, ?[*]const VkDebugUtilsMessengerCallbackDataEXT) callconv(.C) void; pub extern fn vkSetDebugUtilsObjectNameEXT(device: VkDevice, pNameInfo: ?[*]const VkDebugUtilsObjectNameInfoEXT) VkResult; pub extern fn vkSetDebugUtilsObjectTagEXT(device: VkDevice, pTagInfo: ?[*]const VkDebugUtilsObjectTagInfoEXT) VkResult; pub extern fn vkQueueBeginDebugUtilsLabelEXT(queue: VkQueue, pLabelInfo: ?[*]const VkDebugUtilsLabelEXT) void; pub extern fn vkQueueEndDebugUtilsLabelEXT(queue: VkQueue) void; pub extern fn vkQueueInsertDebugUtilsLabelEXT(queue: VkQueue, pLabelInfo: ?[*]const VkDebugUtilsLabelEXT) void; pub extern fn vkCmdBeginDebugUtilsLabelEXT(commandBuffer: VkCommandBuffer, pLabelInfo: ?[*]const VkDebugUtilsLabelEXT) void; pub extern fn vkCmdEndDebugUtilsLabelEXT(commandBuffer: VkCommandBuffer) void; pub extern fn vkCmdInsertDebugUtilsLabelEXT(commandBuffer: VkCommandBuffer, pLabelInfo: ?[*]const VkDebugUtilsLabelEXT) void; pub extern fn vkCreateDebugUtilsMessengerEXT(instance: VkInstance, pCreateInfo: ?[*]const VkDebugUtilsMessengerCreateInfoEXT, pAllocator: ?[*]const VkAllocationCallbacks, pMessenger: ?[*]VkDebugUtilsMessengerEXT) VkResult; pub extern fn vkDestroyDebugUtilsMessengerEXT(instance: VkInstance, messenger: VkDebugUtilsMessengerEXT, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkSubmitDebugUtilsMessageEXT(instance: VkInstance, messageSeverity: VkDebugUtilsMessageSeverityFlagBitsEXT, messageTypes: VkDebugUtilsMessageTypeFlagsEXT, pCallbackData: ?[*]const VkDebugUtilsMessengerCallbackDataEXT) void; pub const VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT; pub const VK_SAMPLER_REDUCTION_MODE_MIN_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_MIN_EXT; pub const VK_SAMPLER_REDUCTION_MODE_MAX_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_MAX_EXT; pub const VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT; pub const VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT; pub const VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT; pub const VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = enum_VkSamplerReductionModeEXT.VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT; pub const enum_VkSamplerReductionModeEXT = extern enum { VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = 0, VK_SAMPLER_REDUCTION_MODE_MIN_EXT = 1, VK_SAMPLER_REDUCTION_MODE_MAX_EXT = 2, VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = 0, VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = 2, VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = 3, VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = 2147483647, }; pub const VkSamplerReductionModeEXT = enum_VkSamplerReductionModeEXT; pub const struct_VkSamplerReductionModeCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, reductionMode: VkSamplerReductionModeEXT, }; pub const VkSamplerReductionModeCreateInfoEXT = struct_VkSamplerReductionModeCreateInfoEXT; pub const struct_VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, filterMinmaxSingleComponentFormats: VkBool32, filterMinmaxImageComponentMapping: VkBool32, }; pub const VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT = struct_VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; pub const struct_VkSampleLocationEXT = extern struct { x: f32, y: f32, }; pub const VkSampleLocationEXT = struct_VkSampleLocationEXT; pub const struct_VkSampleLocationsInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, sampleLocationsPerPixel: VkSampleCountFlagBits, sampleLocationGridSize: VkExtent2D, sampleLocationsCount: u32, pSampleLocations: ?[*]const VkSampleLocationEXT, }; pub const VkSampleLocationsInfoEXT = struct_VkSampleLocationsInfoEXT; pub const struct_VkAttachmentSampleLocationsEXT = extern struct { attachmentIndex: u32, sampleLocationsInfo: VkSampleLocationsInfoEXT, }; pub const VkAttachmentSampleLocationsEXT = struct_VkAttachmentSampleLocationsEXT; pub const struct_VkSubpassSampleLocationsEXT = extern struct { subpassIndex: u32, sampleLocationsInfo: VkSampleLocationsInfoEXT, }; pub const VkSubpassSampleLocationsEXT = struct_VkSubpassSampleLocationsEXT; pub const struct_VkRenderPassSampleLocationsBeginInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, attachmentInitialSampleLocationsCount: u32, pAttachmentInitialSampleLocations: ?[*]const VkAttachmentSampleLocationsEXT, postSubpassSampleLocationsCount: u32, pPostSubpassSampleLocations: ?[*]const VkSubpassSampleLocationsEXT, }; pub const VkRenderPassSampleLocationsBeginInfoEXT = struct_VkRenderPassSampleLocationsBeginInfoEXT; pub const struct_VkPipelineSampleLocationsStateCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, sampleLocationsEnable: VkBool32, sampleLocationsInfo: VkSampleLocationsInfoEXT, }; pub const VkPipelineSampleLocationsStateCreateInfoEXT = struct_VkPipelineSampleLocationsStateCreateInfoEXT; pub const struct_VkPhysicalDeviceSampleLocationsPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, sampleLocationSampleCounts: VkSampleCountFlags, maxSampleLocationGridSize: VkExtent2D, sampleLocationCoordinateRange: [2]f32, sampleLocationSubPixelBits: u32, variableSampleLocations: VkBool32, }; pub const VkPhysicalDeviceSampleLocationsPropertiesEXT = struct_VkPhysicalDeviceSampleLocationsPropertiesEXT; pub const struct_VkMultisamplePropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, maxSampleLocationGridSize: VkExtent2D, }; pub const VkMultisamplePropertiesEXT = struct_VkMultisamplePropertiesEXT; pub const PFN_vkCmdSetSampleLocationsEXT = ?fn (VkCommandBuffer, ?[*]const VkSampleLocationsInfoEXT) callconv(.C) void; pub const PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT = ?fn (VkPhysicalDevice, VkSampleCountFlagBits, ?[*]VkMultisamplePropertiesEXT) callconv(.C) void; pub extern fn vkCmdSetSampleLocationsEXT(commandBuffer: VkCommandBuffer, pSampleLocationsInfo: ?[*]const VkSampleLocationsInfoEXT) void; pub extern fn vkGetPhysicalDeviceMultisamplePropertiesEXT(physicalDevice: VkPhysicalDevice, samples: VkSampleCountFlagBits, pMultisampleProperties: ?[*]VkMultisamplePropertiesEXT) void; pub const VK_BLEND_OVERLAP_UNCORRELATED_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_UNCORRELATED_EXT; pub const VK_BLEND_OVERLAP_DISJOINT_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_DISJOINT_EXT; pub const VK_BLEND_OVERLAP_CONJOINT_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_CONJOINT_EXT; pub const VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_BEGIN_RANGE_EXT; pub const VK_BLEND_OVERLAP_END_RANGE_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_END_RANGE_EXT; pub const VK_BLEND_OVERLAP_RANGE_SIZE_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_RANGE_SIZE_EXT; pub const VK_BLEND_OVERLAP_MAX_ENUM_EXT = enum_VkBlendOverlapEXT.VK_BLEND_OVERLAP_MAX_ENUM_EXT; pub const enum_VkBlendOverlapEXT = extern enum { VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, VK_BLEND_OVERLAP_DISJOINT_EXT = 1, VK_BLEND_OVERLAP_CONJOINT_EXT = 2, VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = 0, VK_BLEND_OVERLAP_END_RANGE_EXT = 2, VK_BLEND_OVERLAP_RANGE_SIZE_EXT = 3, VK_BLEND_OVERLAP_MAX_ENUM_EXT = 2147483647, }; pub const VkBlendOverlapEXT = enum_VkBlendOverlapEXT; pub const struct_VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, advancedBlendCoherentOperations: VkBool32, }; pub const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT = struct_VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; pub const struct_VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, advancedBlendMaxColorAttachments: u32, advancedBlendIndependentBlend: VkBool32, advancedBlendNonPremultipliedSrcColor: VkBool32, advancedBlendNonPremultipliedDstColor: VkBool32, advancedBlendCorrelatedOverlap: VkBool32, advancedBlendAllOperations: VkBool32, }; pub const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT = struct_VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; pub const struct_VkPipelineColorBlendAdvancedStateCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, srcPremultiplied: VkBool32, dstPremultiplied: VkBool32, blendOverlap: VkBlendOverlapEXT, }; pub const VkPipelineColorBlendAdvancedStateCreateInfoEXT = struct_VkPipelineColorBlendAdvancedStateCreateInfoEXT; pub const VkPipelineCoverageToColorStateCreateFlagsNV = VkFlags; pub const struct_VkPipelineCoverageToColorStateCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineCoverageToColorStateCreateFlagsNV, coverageToColorEnable: VkBool32, coverageToColorLocation: u32, }; pub const VkPipelineCoverageToColorStateCreateInfoNV = struct_VkPipelineCoverageToColorStateCreateInfoNV; pub const VK_COVERAGE_MODULATION_MODE_NONE_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_NONE_NV; pub const VK_COVERAGE_MODULATION_MODE_RGB_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_RGB_NV; pub const VK_COVERAGE_MODULATION_MODE_ALPHA_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_ALPHA_NV; pub const VK_COVERAGE_MODULATION_MODE_RGBA_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_RGBA_NV; pub const VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV; pub const VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_END_RANGE_NV; pub const VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV; pub const VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = enum_VkCoverageModulationModeNV.VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV; pub const enum_VkCoverageModulationModeNV = extern enum { VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = 0, VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = 3, VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = 4, VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 2147483647, }; pub const VkCoverageModulationModeNV = enum_VkCoverageModulationModeNV; pub const VkPipelineCoverageModulationStateCreateFlagsNV = VkFlags; pub const struct_VkPipelineCoverageModulationStateCreateInfoNV = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkPipelineCoverageModulationStateCreateFlagsNV, coverageModulationMode: VkCoverageModulationModeNV, coverageModulationTableEnable: VkBool32, coverageModulationTableCount: u32, pCoverageModulationTable: ?[*]const f32, }; pub const VkPipelineCoverageModulationStateCreateInfoNV = struct_VkPipelineCoverageModulationStateCreateInfoNV; pub const struct_VkValidationCacheEXT_T = opaque {}; pub const VkValidationCacheEXT = ?*struct_VkValidationCacheEXT_T; pub const VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = enum_VkValidationCacheHeaderVersionEXT.VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT; pub const VK_VALIDATION_CACHE_HEADER_VERSION_BEGIN_RANGE_EXT = enum_VkValidationCacheHeaderVersionEXT.VK_VALIDATION_CACHE_HEADER_VERSION_BEGIN_RANGE_EXT; pub const VK_VALIDATION_CACHE_HEADER_VERSION_END_RANGE_EXT = enum_VkValidationCacheHeaderVersionEXT.VK_VALIDATION_CACHE_HEADER_VERSION_END_RANGE_EXT; pub const VK_VALIDATION_CACHE_HEADER_VERSION_RANGE_SIZE_EXT = enum_VkValidationCacheHeaderVersionEXT.VK_VALIDATION_CACHE_HEADER_VERSION_RANGE_SIZE_EXT; pub const VK_VALIDATION_CACHE_HEADER_VERSION_MAX_ENUM_EXT = enum_VkValidationCacheHeaderVersionEXT.VK_VALIDATION_CACHE_HEADER_VERSION_MAX_ENUM_EXT; pub const enum_VkValidationCacheHeaderVersionEXT = extern enum { VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = 1, VK_VALIDATION_CACHE_HEADER_VERSION_BEGIN_RANGE_EXT = 1, VK_VALIDATION_CACHE_HEADER_VERSION_END_RANGE_EXT = 1, VK_VALIDATION_CACHE_HEADER_VERSION_RANGE_SIZE_EXT = 1, VK_VALIDATION_CACHE_HEADER_VERSION_MAX_ENUM_EXT = 2147483647, }; pub const VkValidationCacheHeaderVersionEXT = enum_VkValidationCacheHeaderVersionEXT; pub const VkValidationCacheCreateFlagsEXT = VkFlags; pub const struct_VkValidationCacheCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, flags: VkValidationCacheCreateFlagsEXT, initialDataSize: usize, pInitialData: ?*const c_void, }; pub const VkValidationCacheCreateInfoEXT = struct_VkValidationCacheCreateInfoEXT; pub const struct_VkShaderModuleValidationCacheCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, validationCache: VkValidationCacheEXT, }; pub const VkShaderModuleValidationCacheCreateInfoEXT = struct_VkShaderModuleValidationCacheCreateInfoEXT; pub const PFN_vkCreateValidationCacheEXT = ?fn (VkDevice, ?[*]const VkValidationCacheCreateInfoEXT, ?[*]const VkAllocationCallbacks, ?[*]VkValidationCacheEXT) callconv(.C) VkResult; pub const PFN_vkDestroyValidationCacheEXT = ?fn (VkDevice, VkValidationCacheEXT, ?[*]const VkAllocationCallbacks) callconv(.C) void; pub const PFN_vkMergeValidationCachesEXT = ?fn (VkDevice, VkValidationCacheEXT, u32, ?[*]const VkValidationCacheEXT) callconv(.C) VkResult; pub const PFN_vkGetValidationCacheDataEXT = ?fn (VkDevice, VkValidationCacheEXT, ?[*]usize, ?*c_void) callconv(.C) VkResult; pub extern fn vkCreateValidationCacheEXT(device: VkDevice, pCreateInfo: ?[*]const VkValidationCacheCreateInfoEXT, pAllocator: ?[*]const VkAllocationCallbacks, pValidationCache: ?[*]VkValidationCacheEXT) VkResult; pub extern fn vkDestroyValidationCacheEXT(device: VkDevice, validationCache: VkValidationCacheEXT, pAllocator: ?[*]const VkAllocationCallbacks) void; pub extern fn vkMergeValidationCachesEXT(device: VkDevice, dstCache: VkValidationCacheEXT, srcCacheCount: u32, pSrcCaches: ?[*]const VkValidationCacheEXT) VkResult; pub extern fn vkGetValidationCacheDataEXT(device: VkDevice, validationCache: VkValidationCacheEXT, pDataSize: ?[*]usize, pData: ?*c_void) VkResult; pub const VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT = enum_VkDescriptorBindingFlagBitsEXT.VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT; pub const VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT = enum_VkDescriptorBindingFlagBitsEXT.VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT; pub const VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT = enum_VkDescriptorBindingFlagBitsEXT.VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT; pub const VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT = enum_VkDescriptorBindingFlagBitsEXT.VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT; pub const VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM_EXT = enum_VkDescriptorBindingFlagBitsEXT.VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM_EXT; pub const enum_VkDescriptorBindingFlagBitsEXT = extern enum { VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT = 1, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT = 2, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT = 4, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT = 8, VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM_EXT = 2147483647, }; pub const VkDescriptorBindingFlagBitsEXT = enum_VkDescriptorBindingFlagBitsEXT; pub const VkDescriptorBindingFlagsEXT = VkFlags; pub const struct_VkDescriptorSetLayoutBindingFlagsCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, bindingCount: u32, pBindingFlags: ?[*]const VkDescriptorBindingFlagsEXT, }; pub const VkDescriptorSetLayoutBindingFlagsCreateInfoEXT = struct_VkDescriptorSetLayoutBindingFlagsCreateInfoEXT; pub const struct_VkPhysicalDeviceDescriptorIndexingFeaturesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, shaderInputAttachmentArrayDynamicIndexing: VkBool32, shaderUniformTexelBufferArrayDynamicIndexing: VkBool32, shaderStorageTexelBufferArrayDynamicIndexing: VkBool32, shaderUniformBufferArrayNonUniformIndexing: VkBool32, shaderSampledImageArrayNonUniformIndexing: VkBool32, shaderStorageBufferArrayNonUniformIndexing: VkBool32, shaderStorageImageArrayNonUniformIndexing: VkBool32, shaderInputAttachmentArrayNonUniformIndexing: VkBool32, shaderUniformTexelBufferArrayNonUniformIndexing: VkBool32, shaderStorageTexelBufferArrayNonUniformIndexing: VkBool32, descriptorBindingUniformBufferUpdateAfterBind: VkBool32, descriptorBindingSampledImageUpdateAfterBind: VkBool32, descriptorBindingStorageImageUpdateAfterBind: VkBool32, descriptorBindingStorageBufferUpdateAfterBind: VkBool32, descriptorBindingUniformTexelBufferUpdateAfterBind: VkBool32, descriptorBindingStorageTexelBufferUpdateAfterBind: VkBool32, descriptorBindingUpdateUnusedWhilePending: VkBool32, descriptorBindingPartiallyBound: VkBool32, descriptorBindingVariableDescriptorCount: VkBool32, runtimeDescriptorArray: VkBool32, }; pub const VkPhysicalDeviceDescriptorIndexingFeaturesEXT = struct_VkPhysicalDeviceDescriptorIndexingFeaturesEXT; pub const struct_VkPhysicalDeviceDescriptorIndexingPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, maxUpdateAfterBindDescriptorsInAllPools: u32, shaderUniformBufferArrayNonUniformIndexingNative: VkBool32, shaderSampledImageArrayNonUniformIndexingNative: VkBool32, shaderStorageBufferArrayNonUniformIndexingNative: VkBool32, shaderStorageImageArrayNonUniformIndexingNative: VkBool32, shaderInputAttachmentArrayNonUniformIndexingNative: VkBool32, robustBufferAccessUpdateAfterBind: VkBool32, quadDivergentImplicitLod: VkBool32, maxPerStageDescriptorUpdateAfterBindSamplers: u32, maxPerStageDescriptorUpdateAfterBindUniformBuffers: u32, maxPerStageDescriptorUpdateAfterBindStorageBuffers: u32, maxPerStageDescriptorUpdateAfterBindSampledImages: u32, maxPerStageDescriptorUpdateAfterBindStorageImages: u32, maxPerStageDescriptorUpdateAfterBindInputAttachments: u32, maxPerStageUpdateAfterBindResources: u32, maxDescriptorSetUpdateAfterBindSamplers: u32, maxDescriptorSetUpdateAfterBindUniformBuffers: u32, maxDescriptorSetUpdateAfterBindUniformBuffersDynamic: u32, maxDescriptorSetUpdateAfterBindStorageBuffers: u32, maxDescriptorSetUpdateAfterBindStorageBuffersDynamic: u32, maxDescriptorSetUpdateAfterBindSampledImages: u32, maxDescriptorSetUpdateAfterBindStorageImages: u32, maxDescriptorSetUpdateAfterBindInputAttachments: u32, }; pub const VkPhysicalDeviceDescriptorIndexingPropertiesEXT = struct_VkPhysicalDeviceDescriptorIndexingPropertiesEXT; pub const struct_VkDescriptorSetVariableDescriptorCountAllocateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, descriptorSetCount: u32, pDescriptorCounts: ?[*]const u32, }; pub const VkDescriptorSetVariableDescriptorCountAllocateInfoEXT = struct_VkDescriptorSetVariableDescriptorCountAllocateInfoEXT; pub const struct_VkDescriptorSetVariableDescriptorCountLayoutSupportEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, maxVariableDescriptorCount: u32, }; pub const VkDescriptorSetVariableDescriptorCountLayoutSupportEXT = struct_VkDescriptorSetVariableDescriptorCountLayoutSupportEXT; pub const VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_BEGIN_RANGE_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_BEGIN_RANGE_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_END_RANGE_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_END_RANGE_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_RANGE_SIZE_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_RANGE_SIZE_EXT; pub const VK_QUEUE_GLOBAL_PRIORITY_MAX_ENUM_EXT = enum_VkQueueGlobalPriorityEXT.VK_QUEUE_GLOBAL_PRIORITY_MAX_ENUM_EXT; pub const enum_VkQueueGlobalPriorityEXT = extern enum { VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = 128, VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT = 256, VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT = 512, VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT = 1024, VK_QUEUE_GLOBAL_PRIORITY_BEGIN_RANGE_EXT = 128, VK_QUEUE_GLOBAL_PRIORITY_END_RANGE_EXT = 1024, VK_QUEUE_GLOBAL_PRIORITY_RANGE_SIZE_EXT = 897, VK_QUEUE_GLOBAL_PRIORITY_MAX_ENUM_EXT = 2147483647, }; pub const VkQueueGlobalPriorityEXT = enum_VkQueueGlobalPriorityEXT; pub const struct_VkDeviceQueueGlobalPriorityCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, globalPriority: VkQueueGlobalPriorityEXT, }; pub const VkDeviceQueueGlobalPriorityCreateInfoEXT = struct_VkDeviceQueueGlobalPriorityCreateInfoEXT; pub const struct_VkImportMemoryHostPointerInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, handleType: VkExternalMemoryHandleTypeFlagBits, pHostPointer: ?*c_void, }; pub const VkImportMemoryHostPointerInfoEXT = struct_VkImportMemoryHostPointerInfoEXT; pub const struct_VkMemoryHostPointerPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, memoryTypeBits: u32, }; pub const VkMemoryHostPointerPropertiesEXT = struct_VkMemoryHostPointerPropertiesEXT; pub const struct_VkPhysicalDeviceExternalMemoryHostPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, minImportedHostPointerAlignment: VkDeviceSize, }; pub const VkPhysicalDeviceExternalMemoryHostPropertiesEXT = struct_VkPhysicalDeviceExternalMemoryHostPropertiesEXT; pub const PFN_vkGetMemoryHostPointerPropertiesEXT = ?fn (VkDevice, VkExternalMemoryHandleTypeFlagBits, ?*const c_void, ?[*]VkMemoryHostPointerPropertiesEXT) callconv(.C) VkResult; pub extern fn vkGetMemoryHostPointerPropertiesEXT(device: VkDevice, handleType: VkExternalMemoryHandleTypeFlagBits, pHostPointer: ?*const c_void, pMemoryHostPointerProperties: ?[*]VkMemoryHostPointerPropertiesEXT) VkResult; pub const PFN_vkCmdWriteBufferMarkerAMD = ?fn (VkCommandBuffer, VkPipelineStageFlagBits, VkBuffer, VkDeviceSize, u32) callconv(.C) void; pub extern fn vkCmdWriteBufferMarkerAMD(commandBuffer: VkCommandBuffer, pipelineStage: VkPipelineStageFlagBits, dstBuffer: VkBuffer, dstOffset: VkDeviceSize, marker: u32) void; pub const struct_VkPhysicalDeviceShaderCorePropertiesAMD = extern struct { sType: VkStructureType, pNext: ?*c_void, shaderEngineCount: u32, shaderArraysPerEngineCount: u32, computeUnitsPerShaderArray: u32, simdPerComputeUnit: u32, wavefrontsPerSimd: u32, wavefrontSize: u32, sgprsPerSimd: u32, minSgprAllocation: u32, maxSgprAllocation: u32, sgprAllocationGranularity: u32, vgprsPerSimd: u32, minVgprAllocation: u32, maxVgprAllocation: u32, vgprAllocationGranularity: u32, }; pub const VkPhysicalDeviceShaderCorePropertiesAMD = struct_VkPhysicalDeviceShaderCorePropertiesAMD; pub const struct_VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT = extern struct { sType: VkStructureType, pNext: ?*c_void, maxVertexAttribDivisor: u32, }; pub const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT = struct_VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT; pub const struct_VkVertexInputBindingDivisorDescriptionEXT = extern struct { binding: u32, divisor: u32, }; pub const VkVertexInputBindingDivisorDescriptionEXT = struct_VkVertexInputBindingDivisorDescriptionEXT; pub const struct_VkPipelineVertexInputDivisorStateCreateInfoEXT = extern struct { sType: VkStructureType, pNext: ?*const c_void, vertexBindingDivisorCount: u32, pVertexBindingDivisors: ?[*]const VkVertexInputBindingDivisorDescriptionEXT, }; pub const VkPipelineVertexInputDivisorStateCreateInfoEXT = struct_VkPipelineVertexInputDivisorStateCreateInfoEXT; pub const GLFWglproc = ?fn () callconv(.C) void; pub const GLFWvkproc = ?fn () callconv(.C) void; pub const struct_GLFWmonitor = opaque {}; pub const GLFWmonitor = struct_GLFWmonitor; pub const struct_GLFWwindow = opaque {}; pub const GLFWwindow = struct_GLFWwindow; pub const struct_GLFWcursor = opaque {}; pub const GLFWcursor = struct_GLFWcursor; pub const GLFWerrorfun = ?fn (c_int, ?[*]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, ?[*](?[*]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 struct_GLFWvidmode = extern struct { width: c_int, height: c_int, redBits: c_int, greenBits: c_int, blueBits: c_int, refreshRate: c_int, }; pub const GLFWvidmode = struct_GLFWvidmode; pub const struct_GLFWgammaramp = extern struct { red: ?[*]c_ushort, green: ?[*]c_ushort, blue: ?[*]c_ushort, size: c_uint, }; pub const GLFWgammaramp = struct_GLFWgammaramp; pub const struct_GLFWimage = extern struct { width: c_int, height: c_int, pixels: ?[*]u8, }; pub const GLFWimage = struct_GLFWimage; pub extern fn glfwInit() c_int; pub extern fn glfwTerminate() void; pub extern fn glfwGetVersion(major: ?[*]c_int, minor: ?[*]c_int, rev: ?[*]c_int) void; pub extern fn glfwGetVersionString() ?[*]const u8; pub extern fn glfwSetErrorCallback(cbfun: GLFWerrorfun) GLFWerrorfun; pub extern fn glfwGetMonitors(count: ?[*]c_int) ?[*](?*GLFWmonitor); pub extern fn glfwGetPrimaryMonitor() ?*GLFWmonitor; pub extern fn glfwGetMonitorPos(monitor: ?*GLFWmonitor, xpos: ?[*]c_int, ypos: ?[*]c_int) void; pub extern fn glfwGetMonitorPhysicalSize(monitor: ?*GLFWmonitor, widthMM: ?[*]c_int, heightMM: ?[*]c_int) void; pub extern fn glfwGetMonitorName(monitor: ?*GLFWmonitor) ?[*]const u8; pub extern fn glfwSetMonitorCallback(cbfun: GLFWmonitorfun) GLFWmonitorfun; pub extern fn glfwGetVideoModes(monitor: ?*GLFWmonitor, count: ?[*]c_int) ?[*]const GLFWvidmode; pub extern fn glfwGetVideoMode(monitor: ?*GLFWmonitor) ?[*]const GLFWvidmode; pub extern fn glfwSetGamma(monitor: ?*GLFWmonitor, gamma: f32) void; pub extern fn glfwGetGammaRamp(monitor: ?*GLFWmonitor) ?[*]const GLFWgammaramp; pub extern fn glfwSetGammaRamp(monitor: ?*GLFWmonitor, ramp: ?[*]const GLFWgammaramp) void; pub extern fn glfwDefaultWindowHints() void; pub extern fn glfwWindowHint(hint: c_int, value: c_int) void; pub extern fn glfwCreateWindow(width: c_int, height: c_int, title: ?[*]const u8, monitor: ?*GLFWmonitor, share: ?*GLFWwindow) ?*GLFWwindow; pub extern fn glfwDestroyWindow(window: ?*GLFWwindow) void; pub extern fn glfwWindowShouldClose(window: ?*GLFWwindow) c_int; pub extern fn glfwSetWindowShouldClose(window: ?*GLFWwindow, value: c_int) void; pub extern fn glfwSetWindowTitle(window: ?*GLFWwindow, title: ?[*]const u8) void; pub extern fn glfwSetWindowIcon(window: ?*GLFWwindow, count: c_int, images: ?[*]const GLFWimage) void; pub extern fn glfwGetWindowPos(window: ?*GLFWwindow, xpos: ?[*]c_int, ypos: ?[*]c_int) void; pub extern fn glfwSetWindowPos(window: ?*GLFWwindow, xpos: c_int, ypos: c_int) void; pub extern fn glfwGetWindowSize(window: ?*GLFWwindow, width: ?[*]c_int, height: ?[*]c_int) void; pub extern fn glfwSetWindowSizeLimits(window: ?*GLFWwindow, minwidth: c_int, minheight: c_int, maxwidth: c_int, maxheight: c_int) void; pub extern fn glfwSetWindowAspectRatio(window: ?*GLFWwindow, numer: c_int, denom: c_int) void; pub extern fn glfwSetWindowSize(window: ?*GLFWwindow, width: c_int, height: c_int) void; pub extern fn glfwGetFramebufferSize(window: ?*GLFWwindow, width: ?[*]c_int, height: ?[*]c_int) void; pub extern fn glfwGetWindowFrameSize(window: ?*GLFWwindow, left: ?[*]c_int, top: ?[*]c_int, right: ?[*]c_int, bottom: ?[*]c_int) void; pub extern fn glfwIconifyWindow(window: ?*GLFWwindow) void; pub extern fn glfwRestoreWindow(window: ?*GLFWwindow) void; pub extern fn glfwMaximizeWindow(window: ?*GLFWwindow) void; pub extern fn glfwShowWindow(window: ?*GLFWwindow) void; pub extern fn glfwHideWindow(window: ?*GLFWwindow) void; pub extern fn glfwFocusWindow(window: ?*GLFWwindow) void; pub extern fn glfwGetWindowMonitor(window: ?*GLFWwindow) ?*GLFWmonitor; pub extern fn glfwSetWindowMonitor(window: ?*GLFWwindow, monitor: ?*GLFWmonitor, xpos: c_int, ypos: c_int, width: c_int, height: c_int, refreshRate: c_int) void; pub extern fn glfwGetWindowAttrib(window: ?*GLFWwindow, attrib: c_int) c_int; pub extern fn glfwSetWindowUserPointer(window: ?*GLFWwindow, pointer: ?*c_void) void; pub extern fn glfwGetWindowUserPointer(window: ?*GLFWwindow) ?*c_void; pub extern fn glfwSetWindowPosCallback(window: ?*GLFWwindow, cbfun: GLFWwindowposfun) GLFWwindowposfun; pub extern fn glfwSetWindowSizeCallback(window: ?*GLFWwindow, cbfun: GLFWwindowsizefun) GLFWwindowsizefun; pub extern fn glfwSetWindowCloseCallback(window: ?*GLFWwindow, cbfun: GLFWwindowclosefun) GLFWwindowclosefun; pub extern fn glfwSetWindowRefreshCallback(window: ?*GLFWwindow, cbfun: GLFWwindowrefreshfun) GLFWwindowrefreshfun; pub extern fn glfwSetWindowFocusCallback(window: ?*GLFWwindow, cbfun: GLFWwindowfocusfun) GLFWwindowfocusfun; pub extern fn glfwSetWindowIconifyCallback(window: ?*GLFWwindow, cbfun: GLFWwindowiconifyfun) GLFWwindowiconifyfun; pub extern fn glfwSetFramebufferSizeCallback(window: ?*GLFWwindow, cbfun: GLFWframebuffersizefun) GLFWframebuffersizefun; pub extern fn glfwPollEvents() void; pub extern fn glfwWaitEvents() void; pub extern fn glfwWaitEventsTimeout(timeout: f64) void; pub extern fn glfwPostEmptyEvent() void; pub extern fn glfwGetInputMode(window: ?*GLFWwindow, mode: c_int) c_int; pub extern fn glfwSetInputMode(window: ?*GLFWwindow, mode: c_int, value: c_int) void; pub extern fn glfwGetKeyName(key: c_int, scancode: c_int) ?[*]const u8; pub extern fn glfwGetKey(window: ?*GLFWwindow, key: c_int) c_int; pub extern fn glfwGetMouseButton(window: ?*GLFWwindow, button: c_int) c_int; pub extern fn glfwGetCursorPos(window: ?*GLFWwindow, xpos: ?[*]f64, ypos: ?[*]f64) void; pub extern fn glfwSetCursorPos(window: ?*GLFWwindow, xpos: f64, ypos: f64) void; pub extern fn glfwCreateCursor(image: ?[*]const GLFWimage, xhot: c_int, yhot: c_int) ?*GLFWcursor; pub extern fn glfwCreateStandardCursor(shape: c_int) ?*GLFWcursor; pub extern fn glfwDestroyCursor(cursor: ?*GLFWcursor) void; pub extern fn glfwSetCursor(window: ?*GLFWwindow, cursor: ?*GLFWcursor) void; pub extern fn glfwSetKeyCallback(window: ?*GLFWwindow, cbfun: GLFWkeyfun) GLFWkeyfun; pub extern fn glfwSetCharCallback(window: ?*GLFWwindow, cbfun: GLFWcharfun) GLFWcharfun; pub extern fn glfwSetCharModsCallback(window: ?*GLFWwindow, cbfun: GLFWcharmodsfun) GLFWcharmodsfun; pub extern fn glfwSetMouseButtonCallback(window: ?*GLFWwindow, cbfun: GLFWmousebuttonfun) GLFWmousebuttonfun; pub extern fn glfwSetCursorPosCallback(window: ?*GLFWwindow, cbfun: GLFWcursorposfun) GLFWcursorposfun; pub extern fn glfwSetCursorEnterCallback(window: ?*GLFWwindow, cbfun: GLFWcursorenterfun) GLFWcursorenterfun; pub extern fn glfwSetScrollCallback(window: ?*GLFWwindow, cbfun: GLFWscrollfun) GLFWscrollfun; pub extern fn glfwSetDropCallback(window: ?*GLFWwindow, cbfun: GLFWdropfun) GLFWdropfun; pub extern fn glfwJoystickPresent(joy: c_int) c_int; pub extern fn glfwGetJoystickAxes(joy: c_int, count: ?[*]c_int) ?[*]const f32; pub extern fn glfwGetJoystickButtons(joy: c_int, count: ?[*]c_int) ?[*]const u8; pub extern fn glfwGetJoystickName(joy: c_int) ?[*]const u8; pub extern fn glfwSetJoystickCallback(cbfun: GLFWjoystickfun) GLFWjoystickfun; pub extern fn glfwSetClipboardString(window: ?*GLFWwindow, string: ?[*]const u8) void; pub extern fn glfwGetClipboardString(window: ?*GLFWwindow) ?[*]const u8; pub extern fn glfwGetTime() f64; pub extern fn glfwSetTime(time: f64) void; pub extern fn glfwGetTimerValue() u64; pub extern fn glfwGetTimerFrequency() u64; pub extern fn glfwMakeContextCurrent(window: ?*GLFWwindow) void; pub extern fn glfwGetCurrentContext() ?*GLFWwindow; pub extern fn glfwSwapBuffers(window: ?*GLFWwindow) void; pub extern fn glfwSwapInterval(interval: c_int) void; pub extern fn glfwExtensionSupported(extension: ?[*]const u8) c_int; pub extern fn glfwGetProcAddress(procname: ?[*]const u8) GLFWglproc; pub extern fn glfwVulkanSupported() c_int; pub extern fn glfwGetRequiredInstanceExtensions(count: *u32) [*]const [*]const u8; pub extern fn glfwGetInstanceProcAddress(instance: VkInstance, procname: ?[*]const u8) GLFWvkproc; pub extern fn glfwGetPhysicalDevicePresentationSupport(instance: VkInstance, device: VkPhysicalDevice, queuefamily: u32) c_int; pub extern fn glfwCreateWindowSurface(instance: VkInstance, window: *GLFWwindow, allocator: ?*const VkAllocationCallbacks, surface: *VkSurfaceKHR) VkResult; pub const VK_API_VERSION_1_0 = VK_MAKE_VERSION(1, 0, 0); pub fn VK_MAKE_VERSION(major: u32, minor: u32, patch: u32) u32 { return ((major << @as(u5, 22)) | (minor << @as(u5, 12))) | patch; } pub const __BIGGEST_ALIGNMENT__ = 16; pub const VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME = "VK_KHR_external_fence"; pub const GLFW_KEY_X = 88; pub const __INT64_FMTd__ = "ld"; pub const __STDC_VERSION__ = c_long(201112); pub const VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION = 1; pub const VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT; pub const VK_EXT_debug_utils = 1; pub const __INT_LEAST8_FMTi__ = "hhi"; pub const VK_KHR_display = 1; pub const VK_EXT_DEBUG_UTILS_EXTENSION_NAME = "VK_EXT_debug_utils"; pub const VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME = "VK_KHR_image_format_list"; pub const VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME = "VK_NV_shader_subgroup_partitioned"; pub const VK_EXT_post_depth_coverage = 1; pub const __GCC_ATOMIC_LLONG_LOCK_FREE = 2; pub const VK_MAX_DEVICE_GROUP_SIZE_KHR = VK_MAX_DEVICE_GROUP_SIZE; pub const __clang_version__ = "6.0.0 (tags/RELEASE_600/final)"; pub const __UINT_LEAST8_FMTo__ = "hho"; pub const GLFW_KEY_LEFT_ALT = 342; pub const __INTMAX_FMTd__ = "ld"; pub const VK_EXT_validation_cache = 1; pub const GLFW_KEY_ESCAPE = 256; pub const __CLANG_ATOMIC_CHAR_LOCK_FREE = 2; pub const GLFW_KEY_F17 = 306; pub const __INT_LEAST16_FMTi__ = "hi"; pub const UINTMAX_MAX = if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Pointer) @ptrCast(__UINT64_C, 18446744073709551615) else if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Int) @intToPtr(__UINT64_C, 18446744073709551615) else __UINT64_C(18446744073709551615); pub const VK_EXT_external_memory_dma_buf = 1; pub const INT_LEAST64_MAX = if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Pointer) @ptrCast(__INT64_C, 9223372036854775807) else if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Int) @intToPtr(__INT64_C, 9223372036854775807) else __INT64_C(9223372036854775807); pub const VK_KHR_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_swapchain"; pub const GLFW_KEY_RIGHT_SHIFT = 344; pub const WINT_MIN = if (@typeId(@typeOf(u)) == @import("builtin").TypeId.Pointer) @ptrCast(0, u) else if (@typeId(@typeOf(u)) == @import("builtin").TypeId.Int) @intToPtr(0, u) else 0(u); pub const GLFW_KEY_F21 = 310; pub const __MMX__ = 1; pub const GLFW_JOYSTICK_11 = 10; pub const VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION = 1; pub const VK_KHR_get_memory_requirements2 = 1; pub const VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION = 1; pub const INTPTR_MAX = c_long(9223372036854775807); pub const GLFW_KEY_LEFT_CONTROL = 341; pub const GLFW_MOUSE_BUTTON_5 = 4; pub const GLFW_KEY_RIGHT = 262; pub const VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION = 1; pub const VK_EXT_shader_stencil_export = 1; pub const __INO_T_TYPE = __SYSCALL_ULONG_TYPE; pub const VK_NV_sample_mask_override_coverage = 1; pub const VK_AMD_buffer_marker = 1; pub const VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_display_swapchain"; pub const GLFW_AUX_BUFFERS = 135179; pub const __FSBLKCNT_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __ptr_t = [*]void; pub const GLFW_KEY_R = 82; pub const __WCHAR_WIDTH__ = 32; pub const VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION = 1; pub const GLFW_KEY_RIGHT_BRACKET = 93; pub const GLFW_FORMAT_UNAVAILABLE = 65545; pub const __USE_MISC = 1; pub const VK_EXT_hdr_metadata = 1; pub const __PTRDIFF_FMTd__ = "ld"; pub const GLFW_KEY_F24 = 313; pub const __FLT_EVAL_METHOD__ = 0; pub const GLFW_JOYSTICK_14 = 13; pub const __SSE_MATH__ = 1; pub const GLFW_MOUSE_BUTTON_2 = 1; pub const GLFW_KEY_CAPS_LOCK = 280; pub const __UINT_FAST8_FMTo__ = "hho"; pub const VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION = 1; pub const __UINT_LEAST64_MAX__ = c_ulong(18446744073709551615); pub const GLFW_KEY_KP_MULTIPLY = 332; pub const GLFW_OPENGL_FORWARD_COMPAT = 139270; pub const GLFW_ALPHA_BITS = 135172; pub const __UINT_LEAST64_FMTx__ = "lx"; pub const __INT8_MAX__ = 127; pub const VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION = 1; pub const __NLINK_T_TYPE = __SYSCALL_ULONG_TYPE; pub const GLFW_KEY_LEFT_SHIFT = 340; pub const __DBL_DECIMAL_DIG__ = 17; pub const GLFW_KEY_MINUS = 45; pub const VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION = 1; pub const GLFW_KEY_KP_3 = 323; pub const GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16; pub const VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION = 1; pub const GLFW_NO_CURRENT_CONTEXT = 65538; pub const VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME = "VK_KHR_relaxed_block_layout"; pub const __CONSTANT_CFSTRINGS__ = 1; pub const _SYS_CDEFS_H = 1; pub const VK_EXT_DEBUG_REPORT_SPEC_VERSION = 9; pub const _ATFILE_SOURCE = 1; pub const __RLIM_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __LDBL_MAX_EXP__ = 16384; pub const __USE_POSIX199309 = 1; pub const __NO_MATH_INLINES = 1; pub const __WCHAR_TYPE__ = int; pub const __LONG_MAX__ = c_long(9223372036854775807); pub const __WCHAR_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-__WCHAR_MAX, -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-__WCHAR_MAX, -1) else (-__WCHAR_MAX)(-1); pub const GLFW_KEY_KP_6 = 326; pub const GLFW_DEPTH_BITS = 135173; pub const __PTRDIFF_WIDTH__ = 64; pub const __INT_FAST16_FMTi__ = "hi"; pub const __LDBL_DENORM_MIN__ = 0.000000; pub const GLFW_CONTEXT_RELEASE_BEHAVIOR = 139273; pub const GLFW_AUTO_ICONIFY = 131078; pub const GLFW_JOYSTICK_3 = 2; pub const VK_EXT_shader_subgroup_ballot = 1; pub const __INT64_C_SUFFIX__ = L; pub const __FSFILCNT_T_TYPE = __SYSCALL_ULONG_TYPE; pub const VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION = 1; pub const GLFW_RELEASE_BEHAVIOR_NONE = 217090; pub const GLFW_SAMPLES = 135181; pub const __SSIZE_T_TYPE = __SWORD_TYPE; pub const __SIZEOF_PTRDIFF_T__ = 8; pub const GLFW_KEY_9 = 57; pub const VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME = "VK_GOOGLE_display_timing"; pub const __SIG_ATOMIC_MAX__ = 2147483647; pub const GLFW_JOYSTICK_4 = 3; pub const __USE_ATFILE = 1; pub const __UINT64_MAX__ = c_ulong(18446744073709551615); pub const VK_MAX_EXTENSION_NAME_SIZE = 256; pub const GLFW_KEY_UP = 265; pub const GLFW_KEY_KP_DIVIDE = 331; pub const __FLT_DECIMAL_DIG__ = 9; pub const __DBL_DIG__ = 15; pub const __ATOMIC_ACQUIRE = 2; pub const VK_AMD_mixed_attachment_samples = 1; pub const __FLT16_HAS_DENORM__ = 1; pub const GLFW_KEY_F5 = 294; pub const GLFW_OPENGL_ES_API = 196610; pub const __UINT_FAST16_FMTu__ = "hu"; pub const __INTPTR_FMTi__ = "li"; pub const VK_KHR_shared_presentable_image = 1; pub const _BITS_WCHAR_H = 1; pub const __UINT_FAST8_FMTX__ = "hhX"; pub const VK_NV_FILL_RECTANGLE_EXTENSION_NAME = "VK_NV_fill_rectangle"; pub const VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION = 1; pub const VK_EXT_validation_flags = 1; pub const __UINT8_FMTo__ = "hho"; pub const UINT_LEAST64_MAX = if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Pointer) @ptrCast(__UINT64_C, 18446744073709551615) else if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Int) @intToPtr(__UINT64_C, 18446744073709551615) else __UINT64_C(18446744073709551615); pub const __UINT_LEAST16_FMTx__ = "hx"; pub const __UINT_FAST16_FMTX__ = "hX"; pub const __VERSION__ = "4.2.1 Compatible Clang 6.0.0 (tags/RELEASE_600/final)"; pub const __UINT_FAST32_FMTx__ = "x"; pub const VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION = 1; pub const __UINT_FAST8_FMTu__ = "hhu"; pub const GLFW_KEY_3 = 51; pub const __UINT_LEAST64_FMTo__ = "lo"; pub const VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME = "VK_KHR_external_memory"; pub const __UINT_LEAST8_MAX__ = 255; pub const GLFW_BLUE_BITS = 135171; pub const VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION = 3; pub const UINT8_MAX = 255; pub const GLFW_HAND_CURSOR = 221188; pub const GLFW_KEY_SEMICOLON = 59; pub const __GLIBC_USE_DEPRECATED_GETS = 0; pub const VK_IMG_FILTER_CUBIC_EXTENSION_NAME = "VK_IMG_filter_cubi"; pub const __UINT16_MAX__ = 65535; pub const __CLOCK_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __x86_64 = 1; pub const VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME = "VK_EXT_sample_locations"; pub const GLFW_KEY_COMMA = 44; pub const VK_IMG_FORMAT_PVRTC_EXTENSION_NAME = "VK_IMG_format_pvrt"; pub const VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME = "VK_EXT_conservative_rasterization"; pub const __SIZEOF_WINT_T__ = 4; pub const GLFW_KEY_6 = 54; pub const VK_AMD_draw_indirect_count = 1; pub const GLFW_MOD_SHIFT = 1; pub const VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION = 1; pub const __UINTMAX_FMTo__ = "lo"; pub const __UINT_LEAST8_FMTX__ = "hhX"; pub const VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION = 1; pub const __WINT_UNSIGNED__ = 1; pub const SIG_ATOMIC_MAX = 2147483647; pub const VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION = 1; pub const VK_KHR_SURFACE_EXTENSION_NAME = "VK_KHR_surface"; pub const GLFW_KEY_H = 72; pub const PTRDIFF_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-c_long(9223372036854775807), -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-c_long(9223372036854775807), -1) else (-c_long(9223372036854775807))(-1); pub const __POINTER_WIDTH__ = 64; pub const __PTRDIFF_MAX__ = c_long(9223372036854775807); pub const __FLT16_DIG__ = 3; pub const __SIZEOF_LONG__ = 8; pub const __TIME_T_TYPE = __SYSCALL_SLONG_TYPE; pub const VK_NV_fragment_coverage_to_color = 1; pub const GLFW_NO_ROBUSTNESS = 0; pub const VK_LOD_CLAMP_NONE = 1000.000000; pub const __NO_INLINE__ = 1; pub const GLFW_KEY_O = 79; pub const VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION = 1; pub const __INT_FAST32_MAX__ = 2147483647; pub const GLFW_EGL_CONTEXT_API = 221186; pub const __UINTMAX_FMTu__ = "lu"; pub const VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"; pub const INT_FAST8_MAX = 127; pub const __FLT_RADIX__ = 2; pub const VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME = "VK_KHR_variable_pointers"; pub const __GLIBC_MINOR__ = 27; pub const _STDINT_H = 1; pub const VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME = "VK_EXT_global_priority"; pub const VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION = 1; pub const GLFW_KEY_SLASH = 47; pub const GLFW_KEY_B = 66; pub const VK_KHR_external_fence = 1; pub const VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME = "VK_NV_clip_space_w_scaling"; pub const VK_EXT_debug_marker = 1; pub const VK_KHR_maintenance2 = 1; pub const __PRAGMA_REDEFINE_EXTNAME = 1; pub const __FLT16_DECIMAL_DIG__ = 5; pub const __CPU_MASK_TYPE = __SYSCALL_ULONG_TYPE; pub const VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME = "VK_NV_framebuffer_mixed_samples"; pub const VK_EXT_depth_range_unrestricted = 1; pub const __UINTMAX_WIDTH__ = 64; pub const VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1; pub const __INT64_FMTi__ = "li"; pub const VK_GOOGLE_display_timing = 1; pub const __UINT_FAST64_FMTu__ = "lu"; pub const GLFW_KEY_Y = 89; pub const GLFW_KEY_F19 = 308; pub const INT_LEAST16_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-32767, -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-32767, -1) else (-32767)(-1); pub const VK_EXT_global_priority = 1; pub const VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME = "VK_AMD_shader_trinary_minmax"; pub const __INT_FAST16_TYPE__ = short; pub const VK_SUBPASS_EXTERNAL = ~@as(c_uint, 0); pub const __DBL_MAX_10_EXP__ = 308; pub const __LDBL_MIN__ = 0.000000; pub const __CLANG_ATOMIC_LLONG_LOCK_FREE = 2; pub const __FSFILCNT64_T_TYPE = __UQUAD_TYPE; pub const VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME = "VK_EXT_discard_rectangles"; pub const VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME = "VK_EXT_post_depth_coverage"; pub const GLFW_STEREO = 135180; pub const __GID_T_TYPE = __U32_TYPE; pub const GLFW_KEY_F16 = 305; pub const GLFW_KEY_ENTER = 257; pub const _DEFAULT_SOURCE = 1; pub const VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION = 1; pub const __FD_SETSIZE = 1024; pub const __LDBL_DECIMAL_DIG__ = 21; pub const VK_AMD_shader_explicit_vertex_parameter = 1; pub const GLFW_IBEAM_CURSOR = 221186; pub const __UINT_LEAST64_FMTX__ = "lX"; pub const __clang_minor__ = 0; pub const GLFW_JOYSTICK_12 = 11; pub const VK_KHR_EXTERNAL_FENCE_SPEC_VERSION = 1; pub const GLFW_MOUSE_BUTTON_4 = 3; pub const VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION = 1; pub const GLFW_ARROW_CURSOR = 221185; pub const INTMAX_MAX = if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Pointer) @ptrCast(__INT64_C, 9223372036854775807) else if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Int) @intToPtr(__INT64_C, 9223372036854775807) else __INT64_C(9223372036854775807); pub const __SIZEOF_FLOAT128__ = 16; pub const VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION = 1; pub const VK_EXT_debug_report = 1; pub const GLFW_LOSE_CONTEXT_ON_RESET = 200706; pub const GLFW_NOT_INITIALIZED = 65537; pub const __CLOCKID_T_TYPE = __S32_TYPE; pub const __UINT_FAST64_FMTo__ = "lo"; pub const INT_FAST16_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-c_long(9223372036854775807), -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-c_long(9223372036854775807), -1) else (-c_long(9223372036854775807))(-1); pub const GLFW_KEY_S = 83; pub const __DBL_MAX__ = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878; pub const GLFW_KEY_F13 = 302; pub const GLFW_OUT_OF_MEMORY = 65541; pub const __UINT64_FMTx__ = "lx"; pub const GLFW_KEY_F25 = 314; pub const VK_KHR_shader_draw_parameters = 1; pub const GLFW_JOYSTICK_15 = 14; pub const VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME = "VK_EXT_blend_operation_advanced"; pub const GLFW_MOUSE_BUTTON_1 = 0; pub const VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME = "VK_AMD_shader_core_properties"; pub const __SLONG32_TYPE = int; pub const _DEBUG = 1; pub const VK_KHR_SURFACE_SPEC_VERSION = 25; pub const INT32_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-2147483647, -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-2147483647, -1) else (-2147483647)(-1); pub const GLFW_KEY_UNKNOWN = -1; pub const __restrict_arr = __restrict; pub const GLFW_KEY_V = 86; pub const __RLIM_T_MATCHES_RLIM64_T = 1; pub const __UINT8_FMTX__ = "hhX"; pub const VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME = "VK_NV_dedicated_allocation"; pub const UINT_FAST8_MAX = 255; pub const __UINTPTR_WIDTH__ = 64; pub const GLFW_KEY_KP_0 = 320; pub const VK_AMD_shader_image_load_store_lod = 1; pub const VK_EXT_VALIDATION_CACHE_SPEC_VERSION = 1; pub const GLFW_JOYSTICK_9 = 8; pub const VK_MAX_MEMORY_HEAPS = 16; pub const __k8 = 1; pub const __DADDR_T_TYPE = __S32_TYPE; pub const __UINT8_FMTx__ = "hhx"; pub const VK_KHR_BIND_MEMORY_2_EXTENSION_NAME = "VK_KHR_bind_memory2"; pub const __INTMAX_C_SUFFIX__ = L; pub const VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME = "VK_KHR_shared_presentable_image"; pub const __ORDER_LITTLE_ENDIAN__ = 1234; pub const GLFW_KEY_KP_7 = 327; pub const VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME = "VK_AMD_shader_image_load_store_lod"; pub const __INT16_FMTd__ = "hd"; pub const __SUSECONDS_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1; pub const GLFW_JOYSTICK_2 = 1; pub const VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION = 1; pub const VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION = 1; pub const __INTMAX_WIDTH__ = 64; pub const __INO64_T_TYPE = __UQUAD_TYPE; pub const __CLANG_ATOMIC_BOOL_LOCK_FREE = 2; pub const GLFW_CONTEXT_NO_ERROR = 139274; pub const VK_AMD_SHADER_BALLOT_SPEC_VERSION = 1; pub const __USE_POSIX = 1; pub const VK_NV_viewport_swizzle = 1; pub const VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; pub const __SIZE_FMTo__ = "lo"; pub const VK_NV_glsl_shader = 1; pub const GLFW_DOUBLEBUFFER = 135184; pub const __INT_FAST8_FMTi__ = "hhi"; pub const __UINT_LEAST32_FMTo__ = "o"; pub const GLFW_JOYSTICK_7 = 6; pub const __UINT_FAST16_FMTx__ = "hx"; pub const __FLT_MIN_EXP__ = -125; pub const __UINT_LEAST64_FMTu__ = "lu"; pub const VK_AMD_GCN_SHADER_SPEC_VERSION = 1; pub const VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION = 1; pub const __GCC_ATOMIC_LONG_LOCK_FREE = 2; pub const GLFW_STICKY_MOUSE_BUTTONS = 208899; pub const __INT_FAST64_FMTd__ = "ld"; pub const INT_LEAST8_MIN = -128; pub const VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME = "VK_EXT_depth_range_unrestricted"; pub const __STDC_NO_THREADS__ = 1; pub const VK_NV_geometry_shader_passthrough = 1; pub const VK_EXT_external_memory_host = 1; pub const VK_KHR_get_display_properties2 = 1; pub const __CLANG_ATOMIC_LONG_LOCK_FREE = 2; pub const VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION = 1; pub const __GXX_ABI_VERSION = 1002; pub const GLFW_KEY_F6 = 295; pub const INTPTR_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-c_long(9223372036854775807), -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-c_long(9223372036854775807), -1) else (-c_long(9223372036854775807))(-1); pub const __FLT_MANT_DIG__ = 24; pub const GLFW_VERSION_UNAVAILABLE = 65543; pub const __UINT_FAST64_FMTx__ = "lx"; pub const __STDC__ = 1; pub const GLFW_GREEN_BITS = 135170; pub const __INTPTR_FMTd__ = "ld"; pub const __GNUC_PATCHLEVEL__ = 1; pub const __SIZE_WIDTH__ = 64; pub const __UINT_LEAST8_FMTx__ = "hhx"; pub const __INT_LEAST64_FMTi__ = "li"; pub const GLFW_NATIVE_CONTEXT_API = 221185; pub const __INT_FAST16_MAX__ = 32767; pub const GLFW_KEY_0 = 48; pub const GLFW_MOD_SUPER = 8; pub const GLFW_KEY_F1 = 290; pub const VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION = 1; pub const __CLANG_ATOMIC_CHAR16_T_LOCK_FREE = 2; pub const VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION = 1; pub const GLFW_KEY_LAST = GLFW_KEY_MENU; pub const __INT_MAX__ = 2147483647; pub const __BLKSIZE_T_TYPE = __SYSCALL_SLONG_TYPE; pub const VK_EXT_HDR_METADATA_SPEC_VERSION = 1; pub const GLFW_KEY_DOWN = 264; pub const __DBL_DENORM_MIN__ = 0.000000; pub const __clang_major__ = 6; pub const __FLT16_MANT_DIG__ = 11; pub const GLFW_ANY_RELEASE_BEHAVIOR = 0; pub const VK_TRUE = 1; pub const GLFW_ACCUM_BLUE_BITS = 135177; pub const VK_AMD_BUFFER_MARKER_SPEC_VERSION = 1; pub const VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME = "VK_KHR_incremental_present"; pub const UINTPTR_MAX = c_ulong(18446744073709551615); pub const GLFW_KEY_7 = 55; pub const VK_AMD_gpu_shader_int16 = 1; pub const __FLT_DENORM_MIN__ = 0.000000; pub const __UINT_LEAST16_MAX__ = 65535; pub const SIG_ATOMIC_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-2147483647, -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-2147483647, -1) else (-2147483647)(-1); pub const __LDBL_HAS_DENORM__ = 1; pub const __LDBL_HAS_QUIET_NAN__ = 1; pub const VK_QUEUE_FAMILY_IGNORED = if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Pointer) @ptrCast(~0, U) else if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Int) @intToPtr(~0, U) else (~0)(U); pub const GLFW_KEY_I = 73; pub const GLFW_OPENGL_ANY_PROFILE = 0; pub const __UINT_FAST8_MAX__ = 255; pub const __DBL_MIN_10_EXP__ = -307; pub const __GLIBC_USE_LIB_EXT2 = 0; pub const __UINT8_FMTu__ = "hhu"; pub const __OFF_T_MATCHES_OFF64_T = 1; pub const __RLIM64_T_TYPE = __UQUAD_TYPE; pub const VK_NV_FILL_RECTANGLE_SPEC_VERSION = 1; pub const VK_EXT_queue_family_foreign = 1; pub const __UINT16_FMTu__ = "hu"; pub const GLFW_KEY_BACKSPACE = 259; pub const VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME = "VK_KHR_shader_draw_parameters"; pub const __SIZE_FMTu__ = "lu"; pub const VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION = 1; pub const __UINT_FAST32_FMTu__ = "u"; pub const __LDBL_MIN_EXP__ = -16381; pub const SIZE_MAX = c_ulong(18446744073709551615); pub const GLFW_KEY_L = 76; pub const __clang_patchlevel__ = 0; pub const GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3; pub const VK_EXT_DISPLAY_CONTROL_SPEC_VERSION = 1; pub const GLFW_NO_API = 0; pub const VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME = "VK_NVX_multiview_per_view_attributes"; pub const VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME = "VK_NVX_device_generated_commands"; pub const VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION = 1; pub const VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME = "VK_NV_fragment_coverage_to_color"; pub const __FXSR__ = 1; pub const VK_KHR_MAINTENANCE3_SPEC_VERSION = 1; pub const GLFW_KEY_C = 67; pub const __UINT32_FMTx__ = "x"; pub const GLFW_CONTEXT_REVISION = 139268; pub const __UINT32_FMTu__ = "u"; pub const VK_KHR_maintenance3 = 1; pub const GLFW_KEY_PAGE_UP = 266; pub const __SIZE_MAX__ = c_ulong(18446744073709551615); pub const VK_AMD_texture_gather_bias_lod = 1; pub const GLFW_RED_BITS = 135169; pub const __USE_ISOC11 = 1; pub const GLFW_KEY_PERIOD = 46; pub const GLFW_KEY_F = 70; pub const GLFW_KEY_F18 = 307; pub const VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME = "VK_AMD_texture_gather_bias_lod"; pub const __tune_k8__ = 1; pub const UINT32_MAX = c_uint(4294967295); pub const __x86_64__ = 1; pub const __WORDSIZE_TIME64_COMPAT32 = 1; pub const __UINT64_C_SUFFIX__ = UL; pub const __UINTMAX_FMTx__ = "lx"; pub const __INT_LEAST16_MAX__ = 32767; pub const VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME = "VK_EXT_display_control"; pub const __UINT32_FMTo__ = "o"; pub const GLFW_KEY_MENU = 348; pub const VK_KHR_bind_memory2 = 1; pub const UINT64_MAX = if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Pointer) @ptrCast(__UINT64_C, 18446744073709551615) else if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Int) @intToPtr(__UINT64_C, 18446744073709551615) else __UINT64_C(18446744073709551615); pub const GLFW_KEY_F15 = 304; pub const __INT_LEAST16_TYPE__ = short; pub const VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION = 1; pub const VULKAN_H_ = 1; pub const GLFW_JOYSTICK_13 = 12; pub const __ORDER_BIG_ENDIAN__ = 4321; pub const __LDBL_MIN_10_EXP__ = -4931; pub const VK_KHR_SWAPCHAIN_SPEC_VERSION = 70; pub const GLFW_KEY_KP_SUBTRACT = 333; pub const __SIZEOF_INT__ = 4; pub const VK_QUEUE_FAMILY_EXTERNAL_KHR = VK_QUEUE_FAMILY_EXTERNAL; pub const __USE_POSIX_IMPLICITLY = 1; pub const INT8_MIN = -128; pub const GLFW_KEY_P = 80; pub const GLFW_KEY_F12 = 301; pub const WCHAR_MAX = __WCHAR_MAX; pub const GLFW_KEY_F22 = 311; pub const __amd64 = 1; pub const GLFW_JOYSTICK_16 = 15; pub const __OBJC_BOOL_IS_BOOL = 0; pub const __LDBL_MAX_10_EXP__ = 4932; pub const __SIZEOF_INT128__ = 16; pub const __glibc_c99_flexarr_available = 1; pub const __linux = 1; pub const GLFW_KEY_W = 87; pub const WCHAR_MIN = __WCHAR_MIN; pub const GLFW_KEY_KP_1 = 321; pub const GLFW_INVALID_VALUE = 65540; pub const __clang__ = 1; pub const INT_FAST16_MAX = c_long(9223372036854775807); pub const GLFW_CONTEXT_CREATION_API = 139275; pub const VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION = 1; pub const GLFW_JOYSTICK_8 = 7; pub const VK_ATTACHMENT_UNUSED = if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Pointer) @ptrCast(~0, U) else if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Int) @intToPtr(~0, U) else (~0)(U); pub const VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME = "VK_EXT_shader_subgroup_vote"; pub const VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME = "VK_KHR_sampler_ycbcr_conversion"; pub const __LDBL_DIG__ = 18; pub const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2; pub const __UINT64_FMTo__ = "lo"; pub const __INT_FAST32_FMTd__ = "d"; pub const __ATOMIC_ACQ_REL = 4; pub const VK_NV_external_memory_capabilities = 1; pub const VK_NV_fill_rectangle = 1; pub const GLFW_DECORATED = 131077; pub const VK_KHR_swapchain = 1; pub const GLFW_KEY_KP_4 = 324; pub const GLFW_CROSSHAIR_CURSOR = 221187; pub const VK_REMAINING_MIP_LEVELS = if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Pointer) @ptrCast(~0, U) else if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Int) @intToPtr(~0, U) else (~0)(U); pub const VK_MAX_DESCRIPTION_SIZE = 256; pub const __OPENCL_MEMORY_SCOPE_SUB_GROUP = 4; pub const VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME = "VK_KHR_device_group_creation"; pub const VK_AMD_GPU_SHADER_INT16_SPEC_VERSION = 1; pub const __GLIBC__ = 2; pub const UINT_FAST64_MAX = if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Pointer) @ptrCast(__UINT64_C, 18446744073709551615) else if (@typeId(@typeOf(18446744073709551615)) == @import("builtin").TypeId.Int) @intToPtr(__UINT64_C, 18446744073709551615) else __UINT64_C(18446744073709551615); pub const __WORDSIZE = 64; pub const VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION = 2; pub const __INT64_MAX__ = c_long(9223372036854775807); pub const __INT_LEAST64_MAX__ = c_long(9223372036854775807); pub const GLFW_CURSOR = 208897; pub const __OPENCL_MEMORY_SCOPE_WORK_ITEM = 0; pub const VK_KHR_relaxed_block_layout = 1; pub const GLFW_JOYSTICK_6 = 5; pub const __FLT_HAS_DENORM__ = 1; pub const VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION = 2; pub const __DECIMAL_DIG__ = __LDBL_DECIMAL_DIG__; pub const __SYSCALL_SLONG_TYPE = __SLONGWORD_TYPE; pub const __DEV_T_TYPE = __UQUAD_TYPE; pub const GLFW_CONNECTED = 262145; pub const __INT32_FMTi__ = "i"; pub const __DBL_HAS_INFINITY__ = 1; pub const VK_AMD_shader_core_properties = 1; pub const VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION = 2; pub const __FINITE_MATH_ONLY__ = 0; pub const VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME = "VK_KHR_external_memory_fd"; pub const VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME = "VK_KHR_external_memory_capabilities"; pub const GLFW_MAXIMIZED = 131080; pub const VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME = "VK_NV_external_memory_capabilities"; pub const VK_KHR_DISPLAY_SPEC_VERSION = 21; pub const GLFW_KEY_F7 = 296; pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1; pub const _STDC_PREDEF_H = 1; pub const GLFW_ACCUM_RED_BITS = 135175; pub const __FLT16_MAX_EXP__ = 15; pub const VK_FALSE = 0; pub const VK_AMD_shader_info = 1; pub const __SIZEOF_FLOAT__ = 4; pub const INT_FAST64_MAX = if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Pointer) @ptrCast(__INT64_C, 9223372036854775807) else if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Int) @intToPtr(__INT64_C, 9223372036854775807) else __INT64_C(9223372036854775807); pub const GLFW_CURSOR_NORMAL = 212993; pub const VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION = 1; pub const VK_IMG_FORMAT_PVRTC_SPEC_VERSION = 1; pub const __INT_LEAST32_FMTi__ = "i"; pub const __LDBL_EPSILON__ = 0.000000; pub const __INT_LEAST32_FMTd__ = "d"; pub const __STDC_UTF_32__ = 1; pub const __SIG_ATOMIC_WIDTH__ = 32; pub const VK_KHR_descriptor_update_template = 1; pub const GLFW_CONTEXT_VERSION_MINOR = 139267; pub const __UINT_FAST64_FMTX__ = "lX"; pub const VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME = "VK_EXT_vertex_attribute_divisor"; pub const GLFW_KEY_1 = 49; pub const GLFW_KEY_F2 = 291; pub const __SIZEOF_DOUBLE__ = 8; pub const GLFW_FOCUSED = 131073; pub const __GCC_ATOMIC_SHORT_LOCK_FREE = 2; pub const VK_KHR_external_memory = 1; pub const VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION = 1; pub const __SIZE_FMTX__ = "lX"; pub const __ID_T_TYPE = __U32_TYPE; pub const VK_IMG_format_pvrtc = 1; pub const GLFW_KEY_4 = 52; pub const _BITS_TYPES_H = 1; pub const GLFW_KEY_APOSTROPHE = 39; pub const GLFW_OPENGL_COMPAT_PROFILE = 204802; pub const __STDC_IEC_559_COMPLEX__ = 1; pub const __FSBLKCNT64_T_TYPE = __UQUAD_TYPE; pub const __DBL_MIN_EXP__ = -1021; pub const __USECONDS_T_TYPE = __U32_TYPE; pub const VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION = 1; pub const VK_KHR_image_format_list = 1; pub const __PID_T_TYPE = __S32_TYPE; pub const VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION = 2; pub const VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME = "VK_EXT_queue_family_foreign"; pub const VK_NVX_device_generated_commands = 1; pub const __DBL_HAS_DENORM__ = 1; pub const __FLOAT128__ = 1; pub const __HAVE_GENERIC_SELECTION = 1; pub const __FLT16_HAS_QUIET_NAN__ = 1; pub const VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION = 1; pub const __ATOMIC_RELAXED = 0; pub const __SIZEOF_SHORT__ = 2; pub const VK_KHR_device_group = 1; pub const __UINT_FAST16_MAX__ = 65535; pub const __UINT16_FMTX__ = "hX"; pub const GLFW_KEY_WORLD_2 = 162; pub const VK_NV_framebuffer_mixed_samples = 1; pub const __CLANG_ATOMIC_SHORT_LOCK_FREE = 2; pub const VK_EXT_VALIDATION_CACHE_EXTENSION_NAME = "VK_EXT_validation_cache"; pub const __MODE_T_TYPE = __U32_TYPE; pub const GLFW_KEY_M = 77; pub const PTRDIFF_MAX = c_long(9223372036854775807); pub const GLFW_DONT_CARE = -1; pub const __WINT_MAX__ = c_uint(4294967295); pub const __STDC_ISO_10646__ = c_long(201706); pub const VK_EXT_HDR_METADATA_EXTENSION_NAME = "VK_EXT_hdr_metadata"; pub const GLFW_STENCIL_BITS = 135174; pub const __BLKCNT64_T_TYPE = __SQUAD_TYPE; pub const GLFW_VERSION_MINOR = 2; pub const VK_KHR_external_fence_capabilities = 1; pub const VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION = 3; pub const __STDC_HOSTED__ = 1; pub const VK_KHR_VARIABLE_POINTERS_SPEC_VERSION = 1; pub const VK_EXT_shader_subgroup_vote = 1; pub const VK_NV_GLSL_SHADER_EXTENSION_NAME = "VK_NV_glsl_shader"; pub const GLFW_DISCONNECTED = 262146; pub const __INT_LEAST32_TYPE__ = int; pub const GLFW_KEY_EQUAL = 61; pub const __SCHAR_MAX__ = 127; pub const __USE_POSIX2 = 1; pub const GLFW_CONTEXT_VERSION_MAJOR = 139266; pub const __FLT16_MIN_EXP__ = -14; pub const VK_HEADER_VERSION = 77; pub const GLFW_REFRESH_RATE = 135183; pub const VK_KHR_external_semaphore = 1; pub const VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION = 1; pub const __USE_XOPEN2K = 1; pub const VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME = "VK_EXT_swapchain_colorspace"; pub const __USE_FORTIFY_LEVEL = 0; pub const __ELF__ = 1; pub const VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION = 1; pub const __LDBL_MANT_DIG__ = 64; pub const GLFW_CONTEXT_ROBUSTNESS = 139269; pub const __USE_XOPEN2K8 = 1; pub const __CLANG_ATOMIC_INT_LOCK_FREE = 2; pub const INT16_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-32767, -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-32767, -1) else (-32767)(-1); pub const GLFW_KEY_G = 71; pub const __UINT64_FMTX__ = "lX"; pub const VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME = "VK_KHR_sampler_mirror_clamp_to_edge"; pub const VK_KHR_external_memory_fd = 1; pub const VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION = 3; pub const __DBL_MANT_DIG__ = 53; pub const __INT_LEAST32_MAX__ = 2147483647; pub const GLFW_KEY_SPACE = 32; pub const VK_KHR_external_semaphore_fd = 1; pub const VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME = "VK_KHR_draw_indirect_count"; pub const __OPENCL_MEMORY_SCOPE_WORK_GROUP = 1; pub const __USE_ISOC95 = 1; pub const VK_KHR_multiview = 1; pub const __UID_T_TYPE = __U32_TYPE; pub const GLFW_KEY_Z = 90; pub const GLFW_KEY_F14 = 303; pub const __LITTLE_ENDIAN__ = 1; pub const __SSE__ = 1; pub const __FLT_HAS_QUIET_NAN__ = 1; pub const __SIZEOF_SIZE_T__ = 8; pub const GLFW_INVALID_ENUM = 65539; pub const VK_IMG_filter_cubic = 1; pub const VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME = "VK_EXT_display_surface_counter"; pub const __UINT_LEAST16_FMTo__ = "ho"; pub const __CLANG_ATOMIC_WCHAR_T_LOCK_FREE = 2; pub const __UINTPTR_MAX__ = c_ulong(18446744073709551615); pub const VK_KHR_DEVICE_GROUP_SPEC_VERSION = 3; pub const UINT16_MAX = 65535; pub const __UINT_LEAST8_FMTu__ = "hhu"; pub const VK_LUID_SIZE_KHR = VK_LUID_SIZE; pub const VULKAN_CORE_H_ = 1; pub const GLFW_KEY_Q = 81; pub const VK_KHR_storage_buffer_storage_class = 1; pub const GLFW_KEY_F11 = 300; pub const VK_KHR_DISPLAY_EXTENSION_NAME = "VK_KHR_display"; pub const __SYSCALL_ULONG_TYPE = __ULONGWORD_TYPE; pub const __warnattr = msg; pub const __STD_TYPE = typedef; pub const GLFW_KEY_PAGE_DOWN = 267; pub const GLFW_KEY_F23 = 312; pub const __SIZEOF_WCHAR_T__ = 4; pub const GLFW_MOUSE_BUTTON_7 = 6; pub const __LDBL_MAX__ = inf; pub const VK_MAX_DEVICE_GROUP_SIZE = 32; pub const _LP64 = 1; pub const linux = 1; pub const VK_KHR_external_semaphore_capabilities = 1; pub const VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION = 1; pub const GLFW_STICKY_KEYS = 208898; pub const VK_NV_dedicated_allocation = 1; pub const VK_EXT_direct_mode_display = 1; pub const GLFW_KEY_TAB = 258; pub const VK_KHR_variable_pointers = 1; pub const GLFW_KEY_T = 84; pub const __FLT_DIG__ = 6; pub const __INT16_MAX__ = 32767; pub const GLFW_VISIBLE = 131076; pub const __FLT_MAX_10_EXP__ = 38; pub const _FEATURES_H = 1; pub const __UINTPTR_FMTX__ = "lX"; pub const __UINT_LEAST16_FMTu__ = "hu"; pub const __CLANG_ATOMIC_POINTER_LOCK_FREE = 2; pub const __WINT_WIDTH__ = 32; pub const VK_AMD_shader_trinary_minmax = 1; pub const VK_AMD_gpu_shader_half_float = 1; pub const __SHRT_MAX__ = 32767; pub const __GCC_ATOMIC_BOOL_LOCK_FREE = 2; pub const VK_WHOLE_SIZE = if (@typeId(@typeOf(ULL)) == @import("builtin").TypeId.Pointer) @ptrCast(~0, ULL) else if (@typeId(@typeOf(ULL)) == @import("builtin").TypeId.Int) @intToPtr(~0, ULL) else (~0)(ULL); pub const VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME = "VK_KHR_get_display_properties2"; pub const GLFW_FLOATING = 131079; pub const VK_VERSION_1_0 = 1; pub const __INT32_FMTd__ = "d"; pub const __DBL_MIN__ = 0.000000; pub const __S32_TYPE = int; pub const __INTPTR_WIDTH__ = 64; pub const __FLT16_MAX_10_EXP__ = 4; pub const VK_MAX_PHYSICAL_DEVICE_NAME_SIZE = 256; pub const __INT_FAST32_TYPE__ = int; pub const GLFW_KEY_KP_5 = 325; pub const __UINT_FAST32_FMTX__ = "X"; pub const _POSIX_SOURCE = 1; pub const VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME = "VK_KHR_dedicated_allocation"; pub const VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT; pub const GLFW_KEY_KP_ADD = 334; pub const __gnu_linux__ = 1; pub const VK_AMD_GCN_SHADER_EXTENSION_NAME = "VK_AMD_gcn_shader"; pub const VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME = "VK_NV_viewport_swizzle"; pub const VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION = 1; pub const GLFW_PLATFORM_ERROR = 65544; pub const GLFW_TRUE = 1; pub const GLFW_OPENGL_PROFILE = 139272; pub const VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION = 1; pub const VK_KHR_draw_indirect_count = 1; pub const VK_EXT_display_control = 1; pub const GLFW_KEY_KP_8 = 328; pub const __FLT16_HAS_INFINITY__ = 1; pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1; pub const GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8; pub const INT_FAST8_MIN = -128; pub const GLFW_JOYSTICK_1 = 0; pub const __GCC_ATOMIC_INT_LOCK_FREE = 2; pub const GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2; pub const GLFW_RELEASE = 0; pub const GLFW_KEY_PAUSE = 284; pub const VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION = 1; pub const VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME = "VK_EXT_external_memory_host"; pub const VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME = "VK_NV_external_memory"; pub const __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = 3; pub const GLFW_KEY_LEFT_SUPER = 343; pub const _BITS_STDINT_INTN_H = 1; pub const __INT_FAST8_FMTd__ = "hhd"; pub const __KEY_T_TYPE = __S32_TYPE; pub const __INT32_TYPE__ = int; pub const __USE_POSIX199506 = 1; pub const VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME = "VK_KHR_descriptor_update_template"; pub const VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION = 1; pub const VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION = 1; pub const GLFW_KEY_LEFT = 263; pub const VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; pub const GLFW_KEY_PRINT_SCREEN = 283; pub const GLFW_KEY_F8 = 297; pub const __FLT_MIN__ = 0.000000; pub const GLFW_KEY_NUM_LOCK = 282; pub const __INT8_FMTd__ = "hhd"; pub const VK_NV_shader_subgroup_partitioned = 1; pub const GLFW_CURSOR_DISABLED = 212995; pub const VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME = "VK_NV_viewport_array2"; pub const INT64_MAX = if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Pointer) @ptrCast(__INT64_C, 9223372036854775807) else if (@typeId(@typeOf(9223372036854775807)) == @import("builtin").TypeId.Int) @intToPtr(__INT64_C, 9223372036854775807) else __INT64_C(9223372036854775807); pub const __FLT_MAX_EXP__ = 128; pub const VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME = "VK_AMD_mixed_attachment_samples"; pub const VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT; pub const VK_EXT_DEBUG_REPORT_EXTENSION_NAME = "VK_EXT_debug_report"; pub const VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME = "VK_AMD_gpu_shader_int16"; pub const __INT_FAST64_FMTi__ = "li"; pub const __INT_LEAST8_FMTd__ = "hhd"; pub const VK_NULL_HANDLE = 0; pub const __UINT_LEAST32_FMTX__ = "X"; pub const VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION = 1; pub const __UINTMAX_MAX__ = c_ulong(18446744073709551615); pub const GLFW_KEY_HOME = 268; pub const GLFW_KEY_F3 = 292; pub const __UINT_FAST16_FMTo__ = "ho"; pub const VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME = "VK_KHR_external_semaphore_capabilities"; pub const VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME = "VK_EXT_external_memory_dma_buf"; pub const __LDBL_REDIR_DECL = name; pub const VK_AMD_negative_viewport_height = 1; pub const __OFF64_T_TYPE = __SQUAD_TYPE; pub const VK_KHR_MULTIVIEW_EXTENSION_NAME = "VK_KHR_multiview"; pub const VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME = "VK_AMD_negative_viewport_height"; pub const GLFW_KEY_5 = 53; pub const VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME = "VK_EXT_direct_mode_display"; pub const __SIZE_FMTx__ = "lx"; pub const __DBL_EPSILON__ = 0.000000; pub const INT_FAST32_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-c_long(9223372036854775807), -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-c_long(9223372036854775807), -1) else (-c_long(9223372036854775807))(-1); pub const VK_MAX_MEMORY_TYPES = 32; pub const INT32_MAX = 2147483647; pub const __BLKCNT_T_TYPE = __SYSCALL_SLONG_TYPE; pub const VK_KHR_external_fence_fd = 1; pub const VK_KHR_MAINTENANCE3_EXTENSION_NAME = "VK_KHR_maintenance3"; pub const GLFW_ICONIFIED = 131074; pub const __CHAR_BIT__ = 8; pub const GLFW_PRESS = 1; pub const GLFW_CURSOR_HIDDEN = 212994; pub const __INT16_FMTi__ = "hi"; pub const VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME = "VK_KHR_external_semaphore_fd"; pub const INT_LEAST32_MIN = if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Pointer) @ptrCast(-2147483647, -1) else if (@typeId(@typeOf(-1)) == @import("builtin").TypeId.Int) @intToPtr(-2147483647, -1) else (-2147483647)(-1); pub const __GNUC_MINOR__ = 2; pub const VK_AMD_gcn_shader = 1; pub const VK_KHR_sampler_ycbcr_conversion = 1; pub const __UINT_FAST32_MAX__ = c_uint(4294967295); pub const VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION = 1; pub const VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION = 1; pub const __FLT_EPSILON__ = 0.000000; pub const INT_FAST32_MAX = c_long(9223372036854775807); pub const GLFW_NO_RESET_NOTIFICATION = 200705; pub const GLFW_KEY_WORLD_1 = 161; pub const __llvm__ = 1; pub const GLFW_KEY_KP_DECIMAL = 330; pub const VK_EXT_sample_locations = 1; pub const __UINT_FAST64_MAX__ = c_ulong(18446744073709551615); pub const GLFW_KEY_RIGHT_CONTROL = 345; pub const __INT_FAST32_FMTi__ = "i"; pub const GLFW_KEY_J = 74; pub const INT16_MAX = 32767; pub const __FLT_HAS_INFINITY__ = 1; pub const __FSWORD_T_TYPE = __SYSCALL_SLONG_TYPE; pub const NULL = if (@typeId(@typeOf(0)) == @import("builtin").TypeId.Pointer) @ptrCast([*]void, 0) else if (@typeId(@typeOf(0)) == @import("builtin").TypeId.Int) @intToPtr([*]void, 0) else ([*]void)(0); pub const __OFF_T_TYPE = __SYSCALL_SLONG_TYPE; pub const VK_EXT_descriptor_indexing = 1; pub const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2; pub const __UINT32_FMTX__ = "X"; pub const UINT_LEAST8_MAX = 255; pub const GLFW_KEY_A = 65; pub const __UINT32_C_SUFFIX__ = U; pub const __INT32_MAX__ = 2147483647; pub const __GCC_ATOMIC_CHAR_LOCK_FREE = 2; pub const GLFW_NO_WINDOW_CONTEXT = 65546; pub const VK_KHR_maintenance1 = 1; pub const GLFW_KEY_INSERT = 260; pub const GLFW_ACCUM_ALPHA_BITS = 135178; pub const VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION = 1; pub const __DBL_HAS_QUIET_NAN__ = 1; pub const VK_KHR_BIND_MEMORY_2_SPEC_VERSION = 1; pub const VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME = "VK_EXT_sampler_filter_minmax"; pub const VK_AMD_shader_fragment_mask = 1; pub const __STDC_UTF_16__ = 1; pub const GLFW_KEY_D = 68; pub const __UINT_LEAST32_MAX__ = c_uint(4294967295); pub const __ATOMIC_RELEASE = 3; pub const __UINTMAX_C_SUFFIX__ = UL; pub const __WCHAR_MAX = __WCHAR_MAX__; pub const VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME = "VK_AMD_draw_indirect_count"; pub const __SIZEOF_LONG_DOUBLE__ = 16; pub const VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME = "VK_NV_geometry_shader_passthrough"; pub const VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME = "VK_EXT_shader_stencil_export"; pub const __ORDER_PDP_ENDIAN__ = 3412; pub const VK_KHR_dedicated_allocation = 1; pub const __GLIBC_USE_IEC_60559_FUNCS_EXT = 0; pub const VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION = 9; pub const VK_KHR_MAINTENANCE1_SPEC_VERSION = 2; pub const VK_EXT_vertex_attribute_divisor = 1; pub const VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION = 1; pub const VK_NV_external_memory = 1; pub const VK_AMD_shader_ballot = 1; pub const GLFW_KEY_RIGHT_SUPER = 347; pub const GLFW_KEY_DELETE = 261; pub const __INT16_TYPE__ = short; pub const GLFW_KEY_END = 269; pub const VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION = 1; pub const VK_NV_viewport_array2 = 1; pub const __SSE2_MATH__ = 1; pub const UINT_LEAST16_MAX = 65535; pub const __GLIBC_USE_IEC_60559_TYPES_EXT = 0; pub const UINT_LEAST32_MAX = c_uint(4294967295); pub const VK_EXT_sampler_filter_minmax = 1; pub const GLFW_MOD_CONTROL = 2; pub const __INT_FAST8_MAX__ = 127; pub const VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME = "VK_KHR_external_fence_capabilities"; pub const GLFW_KEY_KP_ENTER = 335; pub const VK_KHR_external_memory_capabilities = 1; pub const __STDC_IEC_559__ = 1; pub const GLFW_KEY_GRAVE_ACCENT = 96; pub const __USE_ISOC99 = 1; pub const GLFW_VRESIZE_CURSOR = 221190; pub const __INTPTR_MAX__ = c_long(9223372036854775807); pub const __UINT64_FMTu__ = "lu"; pub const __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__; pub const __SSE2__ = 1; pub const GLFW_KEY_F10 = 299; pub const VK_AMD_BUFFER_MARKER_EXTENSION_NAME = "VK_AMD_buffer_marker"; pub const __INTMAX_FMTi__ = "li"; pub const GLFW_KEY_F20 = 309; pub const __GNUC__ = 4; pub const GLFW_JOYSTICK_10 = 9; pub const VK_EXT_VALIDATION_FLAGS_SPEC_VERSION = 1; pub const VK_LUID_SIZE = 8; pub const GLFW_MOUSE_BUTTON_6 = 5; pub const __UINT32_MAX__ = c_uint(4294967295); pub const VK_KHR_surface = 1; pub const GLFW_OPENGL_API = 196609; pub const GLFW_API_UNAVAILABLE = 65542; pub const _POSIX_C_SOURCE = c_long(200809); pub const GLFW_KEY_U = 85; pub const VK_EXT_DEBUG_MARKER_EXTENSION_NAME = "VK_EXT_debug_marker"; pub const __DBL_MAX_EXP__ = 1024; pub const __INT8_FMTi__ = "hhi"; pub const VK_KHR_MAINTENANCE2_SPEC_VERSION = 1; pub const __FLT16_MIN_10_EXP__ = -13; pub const GLFW_MOUSE_BUTTON_3 = 2; pub const VK_KHR_16BIT_STORAGE_EXTENSION_NAME = "VK_KHR_16bit_storage"; pub const VK_KHR_device_group_creation = 1; pub const VK_VERSION_1_1 = 1; pub const WINT_MAX = c_uint(4294967295); pub const VK_AMD_rasterization_order = 1; pub const UINT_FAST16_MAX = c_ulong(18446744073709551615); pub const VK_KHR_16BIT_STORAGE_SPEC_VERSION = 1; pub const __INT_FAST64_MAX__ = c_long(9223372036854775807); pub const GLFW_RELEASE_BEHAVIOR_FLUSH = 217089; pub const GLFW_KEY_KP_2 = 322; pub const VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME = "VK_KHR_get_physical_device_properties2"; pub const VK_EXT_DEBUG_UTILS_SPEC_VERSION = 1; pub const VK_KHR_get_surface_capabilities2 = 1; pub const GLFW_KEY_LEFT_BRACKET = 91; pub const GLFW_MOUSE_BUTTON_8 = 7; pub const __ATOMIC_SEQ_CST = 5; pub const GLFW_SRGB_CAPABLE = 135182; pub const VK_KHR_16bit_storage = 1; pub const GLFW_FALSE = 0; pub const __SIZEOF_LONG_LONG__ = 8; pub const VK_NVX_multiview_per_view_attributes = 1; pub const VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION = 1; pub const VK_KHR_display_swapchain = 1; pub const __GNUC_STDC_INLINE__ = 1; pub const GLFW_KEY_KP_9 = 329; pub const __UINT8_MAX__ = 255; pub const VK_REMAINING_ARRAY_LAYERS = if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Pointer) @ptrCast(~0, U) else if (@typeId(@typeOf(U)) == @import("builtin").TypeId.Int) @intToPtr(~0, U) else (~0)(U); pub const VK_EXT_display_surface_counter = 1; pub const VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION = 1; pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1; pub const VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION = 1; pub const GLFW_MOD_ALT = 4; pub const __UINT16_FMTo__ = "ho"; pub const __OPENCL_MEMORY_SCOPE_DEVICE = 2; pub const INT_LEAST8_MAX = 127; pub const VK_AMD_SHADER_INFO_SPEC_VERSION = 1; pub const VK_EXT_blend_operation_advanced = 1; pub const GLFW_RESIZABLE = 131075; pub const __SIZEOF_POINTER__ = 8; pub const VK_UUID_SIZE = 16; pub const __TIMER_T_TYPE = [*]void; pub const __unix = 1; pub const __GLIBC_USE_IEC_60559_BFP_EXT = 0; pub const VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME = "VK_AMD_rasterization_order"; pub const VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME = "VK_EXT_descriptor_indexing"; pub const __INT_FAST16_FMTd__ = "hd"; pub const unix = 1; pub const VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION = 1; pub const __UINT_LEAST32_FMTu__ = "u"; pub const VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION = 1; pub const VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME = "VK_AMD_shader_fragment_mask"; pub const GLFW_KEY_8 = 56; pub const VK_NV_clip_space_w_scaling = 1; pub const GLFW_KEY_F9 = 298; pub const __FLT_MAX__ = 340282346999999984391321947108527833088.000000; pub const VK_NV_EXTERNAL_MEMORY_SPEC_VERSION = 1; pub const GLFW_JOYSTICK_5 = 4; pub const VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION = 1; pub const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2; pub const __k8__ = 1; pub const VK_KHR_incremental_present = 1; pub const __ATOMIC_CONSUME = 1; pub const __unix__ = 1; pub const VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION = 1; pub const VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION = 1; pub const __LDBL_HAS_INFINITY__ = 1; pub const VK_EXT_conservative_rasterization = 1; pub const __GNU_LIBRARY__ = 6; pub const __FLT_MIN_10_EXP__ = -37; pub const __UINTPTR_FMTo__ = "lo"; pub const GLFW_KEY_BACKSLASH = 92; pub const GLFW_KEY_F4 = 293; pub const __INT_LEAST16_FMTd__ = "hd"; pub const VK_EXT_DEBUG_MARKER_SPEC_VERSION = 4; pub const __UINTPTR_FMTx__ = "lx"; pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1; pub const __INT_LEAST64_FMTd__ = "ld"; pub const VK_KHR_push_descriptor = 1; pub const __attribute_alloc_size__ = params; pub const VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME = "VK_KHR_external_semaphore"; pub const VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION = 1; pub const __INT_LEAST8_MAX__ = 127; pub const GLFW_ACCUM_GREEN_BITS = 135176; pub const VK_NV_GLSL_SHADER_SPEC_VERSION = 1; pub const VK_KHR_DEVICE_GROUP_EXTENSION_NAME = "VK_KHR_device_group"; pub const GLFW_KEY_2 = 50; pub const VK_KHR_get_physical_device_properties2 = 1; pub const __GCC_ATOMIC_POINTER_LOCK_FREE = 2; pub const VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME = "VK_KHR_storage_buffer_storage_class"; pub const VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME = "VK_EXT_shader_subgroup_ballot"; pub const INT8_MAX = 127; pub const VK_KHR_MULTIVIEW_SPEC_VERSION = 1; pub const __UINT_FAST8_FMTx__ = "hhx"; pub const UINT_FAST32_MAX = c_ulong(18446744073709551615); pub const VK_KHR_MAINTENANCE2_EXTENSION_NAME = "VK_KHR_maintenance2"; pub const GLFW_VERSION_REVISION = 1; pub const VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME = "VK_KHR_push_descriptor"; pub const __UINT16_FMTx__ = "hx"; pub const __UINTPTR_FMTu__ = "lu"; pub const __UINT_LEAST16_FMTX__ = "hX"; pub const VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION = 1; pub const VK_EXT_discard_rectangles = 1; pub const __amd64__ = 1; pub const GLFW_VERSION_MAJOR = 3; pub const __UINT_FAST32_FMTo__ = "o"; pub const __linux__ = 1; pub const __LP64__ = 1; pub const __SYSCALL_WORDSIZE = 64; pub const VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION = 1; pub const __PTRDIFF_FMTi__ = "li"; pub const GLFW_KEY_K = 75; pub const VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME = "VK_EXT_shader_viewport_index_layer"; pub const _BITS_TYPESIZES_H = 1; pub const GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1; pub const GLFW_REPEAT = 2; pub const GLFW_CLIENT_API = 139265; pub const VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME = "VK_AMD_shader_explicit_vertex_parameter"; pub const __LONG_LONG_MAX__ = c_longlong(9223372036854775807); pub const GLFW_KEY_SCROLL_LOCK = 281; pub const GLFW_KEY_KP_EQUAL = 336; pub const VK_AMD_SHADER_INFO_EXTENSION_NAME = "VK_AMD_shader_info"; pub const GLFW_KEY_N = 78; pub const GLFW_KEY_RIGHT_ALT = 346; pub const VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION = 1; pub const INT_LEAST16_MAX = 32767; pub const __INO_T_MATCHES_INO64_T = 1; pub const VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME = "VK_KHR_get_memory_requirements2"; pub const VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME = "VK_AMD_gpu_shader_half_float"; pub const INT_LEAST32_MAX = 2147483647; pub const VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME = "VK_EXT_validation_flags"; pub const __INTMAX_MAX__ = c_long(9223372036854775807); pub const __UINT_LEAST32_FMTx__ = "x"; pub const __WCHAR_MAX__ = 2147483647; pub const VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME = "VK_NV_sample_mask_override_coverage"; pub const __CLANG_ATOMIC_CHAR32_T_LOCK_FREE = 2; pub const _BITS_STDINT_UINTN_H = 1; pub const __UINTMAX_FMTX__ = "lX"; pub const VK_EXT_shader_viewport_index_layer = 1; pub const VK_IMG_FILTER_CUBIC_SPEC_VERSION = 1; pub const GLFW_OPENGL_DEBUG_CONTEXT = 139271; pub const GLFW_KEY_E = 69; pub const GLFW_OPENGL_CORE_PROFILE = 204801; pub const VK_KHR_sampler_mirror_clamp_to_edge = 1; pub const VK_EXT_swapchain_colorspace = 1; pub const GLFW_HRESIZE_CURSOR = 221189; pub const VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME = "VK_KHR_get_surface_capabilities2"; pub const VK_AMD_SHADER_BALLOT_EXTENSION_NAME = "VK_AMD_shader_ballot"; pub const VK_KHR_MAINTENANCE1_EXTENSION_NAME = "VK_KHR_maintenance1"; pub const VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION = 1; pub const VkInstance_T = struct_VkInstance_T; pub const VkPhysicalDevice_T = struct_VkPhysicalDevice_T; pub const VkDevice_T = struct_VkDevice_T; pub const VkQueue_T = struct_VkQueue_T; pub const VkSemaphore_T = struct_VkSemaphore_T; pub const VkCommandBuffer_T = struct_VkCommandBuffer_T; pub const VkFence_T = struct_VkFence_T; pub const VkDeviceMemory_T = struct_VkDeviceMemory_T; pub const VkBuffer_T = struct_VkBuffer_T; pub const VkImage_T = struct_VkImage_T; pub const VkEvent_T = struct_VkEvent_T; pub const VkQueryPool_T = struct_VkQueryPool_T; pub const VkBufferView_T = struct_VkBufferView_T; pub const VkImageView_T = struct_VkImageView_T; pub const VkShaderModule_T = struct_VkShaderModule_T; pub const VkPipelineCache_T = struct_VkPipelineCache_T; pub const VkPipelineLayout_T = struct_VkPipelineLayout_T; pub const VkRenderPass_T = struct_VkRenderPass_T; pub const VkPipeline_T = struct_VkPipeline_T; pub const VkDescriptorSetLayout_T = struct_VkDescriptorSetLayout_T; pub const VkSampler_T = struct_VkSampler_T; pub const VkDescriptorPool_T = struct_VkDescriptorPool_T; pub const VkDescriptorSet_T = struct_VkDescriptorSet_T; pub const VkFramebuffer_T = struct_VkFramebuffer_T; pub const VkCommandPool_T = struct_VkCommandPool_T; pub const VkSamplerYcbcrConversion_T = struct_VkSamplerYcbcrConversion_T; pub const VkDescriptorUpdateTemplate_T = struct_VkDescriptorUpdateTemplate_T; pub const VkSurfaceKHR_T = struct_VkSurfaceKHR_T; pub const VkSwapchainKHR_T = struct_VkSwapchainKHR_T; pub const VkDisplayKHR_T = struct_VkDisplayKHR_T; pub const VkDisplayModeKHR_T = struct_VkDisplayModeKHR_T; pub const VkDebugReportCallbackEXT_T = struct_VkDebugReportCallbackEXT_T; pub const VkObjectTableNVX_T = struct_VkObjectTableNVX_T; pub const VkIndirectCommandsLayoutNVX_T = struct_VkIndirectCommandsLayoutNVX_T; pub const VkDebugUtilsMessengerEXT_T = struct_VkDebugUtilsMessengerEXT_T; pub const VkValidationCacheEXT_T = struct_VkValidationCacheEXT_T;
src/vulkan.zig
pub const HKEY_CLASSES_ROOT = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483648)); pub const HKEY_CURRENT_USER = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483647)); pub const HKEY_LOCAL_MACHINE = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483646)); pub const HKEY_USERS = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483645)); pub const HKEY_PERFORMANCE_DATA = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483644)); pub const HKEY_PERFORMANCE_TEXT = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483568)); pub const HKEY_PERFORMANCE_NLSTEXT = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483552)); pub const HKEY_CURRENT_CONFIG = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483643)); pub const HKEY_DYN_DATA = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483642)); pub const HKEY_CURRENT_USER_LOCAL_SETTINGS = @import("../zig.zig").typedConst(HKEY, @as(i32, -2147483641)); pub const RRF_SUBKEY_WOW6464KEY = @as(u32, 65536); pub const RRF_SUBKEY_WOW6432KEY = @as(u32, 131072); pub const RRF_WOW64_MASK = @as(u32, 196608); pub const RRF_NOEXPAND = @as(u32, 268435456); pub const RRF_ZEROONFAILURE = @as(u32, 536870912); pub const REG_PROCESS_APPKEY = @as(u32, 1); pub const PROVIDER_KEEPS_VALUE_LENGTH = @as(u32, 1); pub const REG_MUI_STRING_TRUNCATE = @as(u32, 1); pub const REG_SECURE_CONNECTION = @as(u32, 1); //-------------------------------------------------------------------------------- // Section: Types (16) //-------------------------------------------------------------------------------- pub const REG_VALUE_TYPE = enum(u32) { NONE = 0, SZ = 1, EXPAND_SZ = 2, BINARY = 3, DWORD = 4, // DWORD_LITTLE_ENDIAN = 4, this enum value conflicts with DWORD DWORD_BIG_ENDIAN = 5, LINK = 6, MULTI_SZ = 7, RESOURCE_LIST = 8, FULL_RESOURCE_DESCRIPTOR = 9, RESOURCE_REQUIREMENTS_LIST = 10, QWORD = 11, // QWORD_LITTLE_ENDIAN = 11, this enum value conflicts with QWORD }; pub const REG_NONE = REG_VALUE_TYPE.NONE; pub const REG_SZ = REG_VALUE_TYPE.SZ; pub const REG_EXPAND_SZ = REG_VALUE_TYPE.EXPAND_SZ; pub const REG_BINARY = REG_VALUE_TYPE.BINARY; pub const REG_DWORD = REG_VALUE_TYPE.DWORD; pub const REG_DWORD_LITTLE_ENDIAN = REG_VALUE_TYPE.DWORD; pub const REG_DWORD_BIG_ENDIAN = REG_VALUE_TYPE.DWORD_BIG_ENDIAN; pub const REG_LINK = REG_VALUE_TYPE.LINK; pub const REG_MULTI_SZ = REG_VALUE_TYPE.MULTI_SZ; pub const REG_RESOURCE_LIST = REG_VALUE_TYPE.RESOURCE_LIST; pub const REG_FULL_RESOURCE_DESCRIPTOR = REG_VALUE_TYPE.FULL_RESOURCE_DESCRIPTOR; pub const REG_RESOURCE_REQUIREMENTS_LIST = REG_VALUE_TYPE.RESOURCE_REQUIREMENTS_LIST; pub const REG_QWORD = REG_VALUE_TYPE.QWORD; pub const REG_QWORD_LITTLE_ENDIAN = REG_VALUE_TYPE.QWORD; pub const REG_SAM_FLAGS = enum(u32) { QUERY_VALUE = 1, SET_VALUE = 2, CREATE_SUB_KEY = 4, ENUMERATE_SUB_KEYS = 8, NOTIFY = 16, CREATE_LINK = 32, WOW64_32KEY = 512, WOW64_64KEY = 256, WOW64_RES = 768, READ = 131097, WRITE = 131078, // EXECUTE = 131097, this enum value conflicts with READ ALL_ACCESS = 983103, _, pub fn initFlags(o: struct { QUERY_VALUE: u1 = 0, SET_VALUE: u1 = 0, CREATE_SUB_KEY: u1 = 0, ENUMERATE_SUB_KEYS: u1 = 0, NOTIFY: u1 = 0, CREATE_LINK: u1 = 0, WOW64_32KEY: u1 = 0, WOW64_64KEY: u1 = 0, WOW64_RES: u1 = 0, READ: u1 = 0, WRITE: u1 = 0, ALL_ACCESS: u1 = 0, }) REG_SAM_FLAGS { return @intToEnum(REG_SAM_FLAGS, (if (o.QUERY_VALUE == 1) @enumToInt(REG_SAM_FLAGS.QUERY_VALUE) else 0) | (if (o.SET_VALUE == 1) @enumToInt(REG_SAM_FLAGS.SET_VALUE) else 0) | (if (o.CREATE_SUB_KEY == 1) @enumToInt(REG_SAM_FLAGS.CREATE_SUB_KEY) else 0) | (if (o.ENUMERATE_SUB_KEYS == 1) @enumToInt(REG_SAM_FLAGS.ENUMERATE_SUB_KEYS) else 0) | (if (o.NOTIFY == 1) @enumToInt(REG_SAM_FLAGS.NOTIFY) else 0) | (if (o.CREATE_LINK == 1) @enumToInt(REG_SAM_FLAGS.CREATE_LINK) else 0) | (if (o.WOW64_32KEY == 1) @enumToInt(REG_SAM_FLAGS.WOW64_32KEY) else 0) | (if (o.WOW64_64KEY == 1) @enumToInt(REG_SAM_FLAGS.WOW64_64KEY) else 0) | (if (o.WOW64_RES == 1) @enumToInt(REG_SAM_FLAGS.WOW64_RES) else 0) | (if (o.READ == 1) @enumToInt(REG_SAM_FLAGS.READ) else 0) | (if (o.WRITE == 1) @enumToInt(REG_SAM_FLAGS.WRITE) else 0) | (if (o.ALL_ACCESS == 1) @enumToInt(REG_SAM_FLAGS.ALL_ACCESS) else 0) ); } }; pub const KEY_QUERY_VALUE = REG_SAM_FLAGS.QUERY_VALUE; pub const KEY_SET_VALUE = REG_SAM_FLAGS.SET_VALUE; pub const KEY_CREATE_SUB_KEY = REG_SAM_FLAGS.CREATE_SUB_KEY; pub const KEY_ENUMERATE_SUB_KEYS = REG_SAM_FLAGS.ENUMERATE_SUB_KEYS; pub const KEY_NOTIFY = REG_SAM_FLAGS.NOTIFY; pub const KEY_CREATE_LINK = REG_SAM_FLAGS.CREATE_LINK; pub const KEY_WOW64_32KEY = REG_SAM_FLAGS.WOW64_32KEY; pub const KEY_WOW64_64KEY = REG_SAM_FLAGS.WOW64_64KEY; pub const KEY_WOW64_RES = REG_SAM_FLAGS.WOW64_RES; pub const KEY_READ = REG_SAM_FLAGS.READ; pub const KEY_WRITE = REG_SAM_FLAGS.WRITE; pub const KEY_EXECUTE = REG_SAM_FLAGS.READ; pub const KEY_ALL_ACCESS = REG_SAM_FLAGS.ALL_ACCESS; pub const REG_OPEN_CREATE_OPTIONS = enum(u32) { RESERVED = 0, // NON_VOLATILE = 0, this enum value conflicts with RESERVED VOLATILE = 1, CREATE_LINK = 2, BACKUP_RESTORE = 4, OPEN_LINK = 8, DONT_VIRTUALIZE = 16, _, pub fn initFlags(o: struct { RESERVED: u1 = 0, VOLATILE: u1 = 0, CREATE_LINK: u1 = 0, BACKUP_RESTORE: u1 = 0, OPEN_LINK: u1 = 0, DONT_VIRTUALIZE: u1 = 0, }) REG_OPEN_CREATE_OPTIONS { return @intToEnum(REG_OPEN_CREATE_OPTIONS, (if (o.RESERVED == 1) @enumToInt(REG_OPEN_CREATE_OPTIONS.RESERVED) else 0) | (if (o.VOLATILE == 1) @enumToInt(REG_OPEN_CREATE_OPTIONS.VOLATILE) else 0) | (if (o.CREATE_LINK == 1) @enumToInt(REG_OPEN_CREATE_OPTIONS.CREATE_LINK) else 0) | (if (o.BACKUP_RESTORE == 1) @enumToInt(REG_OPEN_CREATE_OPTIONS.BACKUP_RESTORE) else 0) | (if (o.OPEN_LINK == 1) @enumToInt(REG_OPEN_CREATE_OPTIONS.OPEN_LINK) else 0) | (if (o.DONT_VIRTUALIZE == 1) @enumToInt(REG_OPEN_CREATE_OPTIONS.DONT_VIRTUALIZE) else 0) ); } }; // TODO: enum 'REG_OPEN_CREATE_OPTIONS' has known issues with its value aliases pub const REG_CREATE_KEY_DISPOSITION = enum(u32) { CREATED_NEW_KEY = 1, OPENED_EXISTING_KEY = 2, }; pub const REG_CREATED_NEW_KEY = REG_CREATE_KEY_DISPOSITION.CREATED_NEW_KEY; pub const REG_OPENED_EXISTING_KEY = REG_CREATE_KEY_DISPOSITION.OPENED_EXISTING_KEY; pub const REG_SAVE_FORMAT = enum(u32) { STANDARD_FORMAT = 1, LATEST_FORMAT = 2, NO_COMPRESSION = 4, }; pub const REG_STANDARD_FORMAT = REG_SAVE_FORMAT.STANDARD_FORMAT; pub const REG_LATEST_FORMAT = REG_SAVE_FORMAT.LATEST_FORMAT; pub const REG_NO_COMPRESSION = REG_SAVE_FORMAT.NO_COMPRESSION; pub const REG_RESTORE_KEY_FLAGS = enum(i32) { FORCE_RESTORE = 8, WHOLE_HIVE_VOLATILE = 1, }; pub const REG_FORCE_RESTORE = REG_RESTORE_KEY_FLAGS.FORCE_RESTORE; pub const REG_WHOLE_HIVE_VOLATILE = REG_RESTORE_KEY_FLAGS.WHOLE_HIVE_VOLATILE; pub const REG_NOTIFY_FILTER = enum(u32) { CHANGE_NAME = 1, CHANGE_ATTRIBUTES = 2, CHANGE_LAST_SET = 4, CHANGE_SECURITY = 8, THREAD_AGNOSTIC = 268435456, _, pub fn initFlags(o: struct { CHANGE_NAME: u1 = 0, CHANGE_ATTRIBUTES: u1 = 0, CHANGE_LAST_SET: u1 = 0, CHANGE_SECURITY: u1 = 0, THREAD_AGNOSTIC: u1 = 0, }) REG_NOTIFY_FILTER { return @intToEnum(REG_NOTIFY_FILTER, (if (o.CHANGE_NAME == 1) @enumToInt(REG_NOTIFY_FILTER.CHANGE_NAME) else 0) | (if (o.CHANGE_ATTRIBUTES == 1) @enumToInt(REG_NOTIFY_FILTER.CHANGE_ATTRIBUTES) else 0) | (if (o.CHANGE_LAST_SET == 1) @enumToInt(REG_NOTIFY_FILTER.CHANGE_LAST_SET) else 0) | (if (o.CHANGE_SECURITY == 1) @enumToInt(REG_NOTIFY_FILTER.CHANGE_SECURITY) else 0) | (if (o.THREAD_AGNOSTIC == 1) @enumToInt(REG_NOTIFY_FILTER.THREAD_AGNOSTIC) else 0) ); } }; pub const REG_NOTIFY_CHANGE_NAME = REG_NOTIFY_FILTER.CHANGE_NAME; pub const REG_NOTIFY_CHANGE_ATTRIBUTES = REG_NOTIFY_FILTER.CHANGE_ATTRIBUTES; pub const REG_NOTIFY_CHANGE_LAST_SET = REG_NOTIFY_FILTER.CHANGE_LAST_SET; pub const REG_NOTIFY_CHANGE_SECURITY = REG_NOTIFY_FILTER.CHANGE_SECURITY; pub const REG_NOTIFY_THREAD_AGNOSTIC = REG_NOTIFY_FILTER.THREAD_AGNOSTIC; pub const RRF_RT = enum(u32) { ANY = 65535, DWORD = 24, QWORD = 72, REG_BINARY = 8, REG_DWORD = 16, REG_EXPAND_SZ = 4, REG_MULTI_SZ = 32, REG_NONE = 1, REG_QWORD = 64, REG_SZ = 2, _, pub fn initFlags(o: struct { ANY: u1 = 0, DWORD: u1 = 0, QWORD: u1 = 0, REG_BINARY: u1 = 0, REG_DWORD: u1 = 0, REG_EXPAND_SZ: u1 = 0, REG_MULTI_SZ: u1 = 0, REG_NONE: u1 = 0, REG_QWORD: u1 = 0, REG_SZ: u1 = 0, }) RRF_RT { return @intToEnum(RRF_RT, (if (o.ANY == 1) @enumToInt(RRF_RT.ANY) else 0) | (if (o.DWORD == 1) @enumToInt(RRF_RT.DWORD) else 0) | (if (o.QWORD == 1) @enumToInt(RRF_RT.QWORD) else 0) | (if (o.REG_BINARY == 1) @enumToInt(RRF_RT.REG_BINARY) else 0) | (if (o.REG_DWORD == 1) @enumToInt(RRF_RT.REG_DWORD) else 0) | (if (o.REG_EXPAND_SZ == 1) @enumToInt(RRF_RT.REG_EXPAND_SZ) else 0) | (if (o.REG_MULTI_SZ == 1) @enumToInt(RRF_RT.REG_MULTI_SZ) else 0) | (if (o.REG_NONE == 1) @enumToInt(RRF_RT.REG_NONE) else 0) | (if (o.REG_QWORD == 1) @enumToInt(RRF_RT.REG_QWORD) else 0) | (if (o.REG_SZ == 1) @enumToInt(RRF_RT.REG_SZ) else 0) ); } }; pub const RRF_RT_ANY = RRF_RT.ANY; pub const RRF_RT_DWORD = RRF_RT.DWORD; pub const RRF_RT_QWORD = RRF_RT.QWORD; pub const RRF_RT_REG_BINARY = RRF_RT.REG_BINARY; pub const RRF_RT_REG_DWORD = RRF_RT.REG_DWORD; pub const RRF_RT_REG_EXPAND_SZ = RRF_RT.REG_EXPAND_SZ; pub const RRF_RT_REG_MULTI_SZ = RRF_RT.REG_MULTI_SZ; pub const RRF_RT_REG_NONE = RRF_RT.REG_NONE; pub const RRF_RT_REG_QWORD = RRF_RT.REG_QWORD; pub const RRF_RT_REG_SZ = RRF_RT.REG_SZ; // TODO: this type has a FreeFunc 'RegCloseKey', what can Zig do with this information? pub const HKEY = *opaque{}; pub const val_context = extern struct { valuelen: i32, value_context: ?*c_void, val_buff_ptr: ?*c_void, }; pub const pvalueA = extern struct { pv_valuename: ?PSTR, pv_valuelen: i32, pv_value_context: ?*c_void, pv_type: u32, }; pub const pvalueW = extern struct { pv_valuename: ?PWSTR, pv_valuelen: i32, pv_value_context: ?*c_void, pv_type: u32, }; pub const PQUERYHANDLER = fn( keycontext: ?*c_void, val_list: ?*val_context, num_vals: u32, outputbuffer: ?*c_void, total_outlen: ?*u32, input_blen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const provider_info = extern struct { pi_R0_1val: ?PQUERYHANDLER, pi_R0_allvals: ?PQUERYHANDLER, pi_R3_1val: ?PQUERYHANDLER, pi_R3_allvals: ?PQUERYHANDLER, pi_flags: u32, pi_key_context: ?*c_void, }; pub const VALENTA = extern struct { ve_valuename: ?PSTR, ve_valuelen: u32, ve_valueptr: usize, ve_type: REG_VALUE_TYPE, }; pub const VALENTW = extern struct { ve_valuename: ?PWSTR, ve_valuelen: u32, ve_valueptr: usize, ve_type: REG_VALUE_TYPE, }; //-------------------------------------------------------------------------------- // Section: Functions (83) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegCloseKey( hKey: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOverridePredefKey( hKey: ?HKEY, hNewHKey: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOpenUserClassesRoot( hToken: ?HANDLE, dwOptions: u32, samDesired: u32, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOpenCurrentUser( samDesired: u32, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegDisablePredefinedCache( ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDisablePredefinedCacheEx( ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegConnectRegistryA( lpMachineName: ?[*:0]const u8, hKey: ?HKEY, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegConnectRegistryW( lpMachineName: ?[*:0]const u16, hKey: ?HKEY, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; pub extern "ADVAPI32" fn RegConnectRegistryExA( lpMachineName: ?[*:0]const u8, hKey: ?HKEY, Flags: u32, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; pub extern "ADVAPI32" fn RegConnectRegistryExW( lpMachineName: ?[*:0]const u16, hKey: ?HKEY, Flags: u32, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegCreateKeyA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegCreateKeyW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegCreateKeyExA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, Reserved: u32, lpClass: ?PSTR, dwOptions: REG_OPEN_CREATE_OPTIONS, samDesired: REG_SAM_FLAGS, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, phkResult: ?*?HKEY, lpdwDisposition: ?*REG_CREATE_KEY_DISPOSITION, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegCreateKeyExW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, Reserved: u32, lpClass: ?PWSTR, dwOptions: REG_OPEN_CREATE_OPTIONS, samDesired: REG_SAM_FLAGS, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, phkResult: ?*?HKEY, lpdwDisposition: ?*REG_CREATE_KEY_DISPOSITION, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegCreateKeyTransactedA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, Reserved: u32, lpClass: ?PSTR, dwOptions: REG_OPEN_CREATE_OPTIONS, samDesired: REG_SAM_FLAGS, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, phkResult: ?*?HKEY, lpdwDisposition: ?*REG_CREATE_KEY_DISPOSITION, hTransaction: ?HANDLE, pExtendedParemeter: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegCreateKeyTransactedW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, Reserved: u32, lpClass: ?PWSTR, dwOptions: REG_OPEN_CREATE_OPTIONS, samDesired: REG_SAM_FLAGS, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, phkResult: ?*?HKEY, lpdwDisposition: ?*REG_CREATE_KEY_DISPOSITION, hTransaction: ?HANDLE, pExtendedParemeter: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegDeleteKeyA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegDeleteKeyW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteKeyExA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, samDesired: u32, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteKeyExW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, samDesired: u32, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteKeyTransactedA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, samDesired: u32, Reserved: u32, hTransaction: ?HANDLE, pExtendedParameter: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteKeyTransactedW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, samDesired: u32, Reserved: u32, hTransaction: ?HANDLE, pExtendedParameter: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDisableReflectionKey( hBase: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegEnableReflectionKey( hBase: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegQueryReflectionKey( hBase: ?HKEY, bIsReflectionDisabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegDeleteValueA( hKey: ?HKEY, lpValueName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegDeleteValueW( hKey: ?HKEY, lpValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegEnumKeyA( hKey: ?HKEY, dwIndex: u32, lpName: ?[*:0]u8, cchName: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegEnumKeyW( hKey: ?HKEY, dwIndex: u32, lpName: ?[*:0]u16, cchName: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegEnumKeyExA( hKey: ?HKEY, dwIndex: u32, lpName: ?[*:0]u8, lpcchName: ?*u32, lpReserved: ?*u32, lpClass: ?[*:0]u8, lpcchClass: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegEnumKeyExW( hKey: ?HKEY, dwIndex: u32, lpName: ?[*:0]u16, lpcchName: ?*u32, lpReserved: ?*u32, lpClass: ?[*:0]u16, lpcchClass: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegEnumValueA( hKey: ?HKEY, dwIndex: u32, lpValueName: ?[*:0]u8, lpcchValueName: ?*u32, lpReserved: ?*u32, lpType: ?*u32, // TODO: what to do with BytesParamIndex 7? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegEnumValueW( hKey: ?HKEY, dwIndex: u32, lpValueName: ?[*:0]u16, lpcchValueName: ?*u32, lpReserved: ?*u32, lpType: ?*u32, // TODO: what to do with BytesParamIndex 7? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegFlushKey( hKey: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegGetKeySecurity( hKey: ?HKEY, SecurityInformation: u32, // TODO: what to do with BytesParamIndex 3? pSecurityDescriptor: ?*SECURITY_DESCRIPTOR, lpcbSecurityDescriptor: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegLoadKeyA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, lpFile: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegLoadKeyW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, lpFile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegNotifyChangeKeyValue( hKey: ?HKEY, bWatchSubtree: BOOL, dwNotifyFilter: REG_NOTIFY_FILTER, hEvent: ?HANDLE, fAsynchronous: BOOL, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOpenKeyA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOpenKeyW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOpenKeyExA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, ulOptions: u32, samDesired: REG_SAM_FLAGS, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegOpenKeyExW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, ulOptions: u32, samDesired: REG_SAM_FLAGS, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegOpenKeyTransactedA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, ulOptions: u32, samDesired: REG_SAM_FLAGS, phkResult: ?*?HKEY, hTransaction: ?HANDLE, pExtendedParemeter: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegOpenKeyTransactedW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, ulOptions: u32, samDesired: REG_SAM_FLAGS, phkResult: ?*?HKEY, hTransaction: ?HANDLE, pExtendedParemeter: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryInfoKeyA( hKey: ?HKEY, lpClass: ?[*:0]u8, lpcchClass: ?*u32, lpReserved: ?*u32, lpcSubKeys: ?*u32, lpcbMaxSubKeyLen: ?*u32, lpcbMaxClassLen: ?*u32, lpcValues: ?*u32, lpcbMaxValueNameLen: ?*u32, lpcbMaxValueLen: ?*u32, lpcbSecurityDescriptor: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryInfoKeyW( hKey: ?HKEY, lpClass: ?[*:0]u16, lpcchClass: ?*u32, lpReserved: ?*u32, lpcSubKeys: ?*u32, lpcbMaxSubKeyLen: ?*u32, lpcbMaxClassLen: ?*u32, lpcValues: ?*u32, lpcbMaxValueNameLen: ?*u32, lpcbMaxValueLen: ?*u32, lpcbSecurityDescriptor: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryValueA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 3? lpData: ?PSTR, lpcbData: ?*i32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryValueW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? lpData: ?PWSTR, lpcbData: ?*i32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryMultipleValuesA( hKey: ?HKEY, val_list: [*]VALENTA, num_vals: u32, // TODO: what to do with BytesParamIndex 4? lpValueBuf: ?PSTR, ldwTotsize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryMultipleValuesW( hKey: ?HKEY, val_list: [*]VALENTW, num_vals: u32, // TODO: what to do with BytesParamIndex 4? lpValueBuf: ?PWSTR, ldwTotsize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryValueExA( hKey: ?HKEY, lpValueName: ?[*:0]const u8, lpReserved: ?*u32, lpType: ?*REG_VALUE_TYPE, // TODO: what to do with BytesParamIndex 5? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegQueryValueExW( hKey: ?HKEY, lpValueName: ?[*:0]const u16, lpReserved: ?*u32, lpType: ?*REG_VALUE_TYPE, // TODO: what to do with BytesParamIndex 5? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegReplaceKeyA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, lpNewFile: ?[*:0]const u8, lpOldFile: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegReplaceKeyW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, lpNewFile: ?[*:0]const u16, lpOldFile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegRestoreKeyA( hKey: ?HKEY, lpFile: ?[*:0]const u8, dwFlags: REG_RESTORE_KEY_FLAGS, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegRestoreKeyW( hKey: ?HKEY, lpFile: ?[*:0]const u16, dwFlags: REG_RESTORE_KEY_FLAGS, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; pub extern "ADVAPI32" fn RegRenameKey( hKey: ?HKEY, lpSubKeyName: ?[*:0]const u16, lpNewKeyName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegSaveKeyA( hKey: ?HKEY, lpFile: ?[*:0]const u8, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegSaveKeyW( hKey: ?HKEY, lpFile: ?[*:0]const u16, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegSetKeySecurity( hKey: ?HKEY, SecurityInformation: u32, pSecurityDescriptor: ?*SECURITY_DESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegSetValueA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, dwType: REG_VALUE_TYPE, // TODO: what to do with BytesParamIndex 4? lpData: ?[*:0]const u8, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegSetValueW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, dwType: REG_VALUE_TYPE, // TODO: what to do with BytesParamIndex 4? lpData: ?[*:0]const u16, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegSetValueExA( hKey: ?HKEY, lpValueName: ?[*:0]const u8, Reserved: u32, dwType: REG_VALUE_TYPE, // TODO: what to do with BytesParamIndex 5? lpData: ?*const u8, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegSetValueExW( hKey: ?HKEY, lpValueName: ?[*:0]const u16, Reserved: u32, dwType: REG_VALUE_TYPE, // TODO: what to do with BytesParamIndex 5? lpData: ?*const u8, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegUnLoadKeyA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn RegUnLoadKeyW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteKeyValueA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, lpValueName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteKeyValueW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, lpValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegSetKeyValueA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, lpValueName: ?[*:0]const u8, dwType: u32, // TODO: what to do with BytesParamIndex 5? lpData: ?*const c_void, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegSetKeyValueW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, lpValueName: ?[*:0]const u16, dwType: u32, // TODO: what to do with BytesParamIndex 5? lpData: ?*const c_void, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteTreeA( hKey: ?HKEY, lpSubKey: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegDeleteTreeW( hKey: ?HKEY, lpSubKey: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegCopyTreeA( hKeySrc: ?HKEY, lpSubKey: ?[*:0]const u8, hKeyDest: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegGetValueA( hkey: ?HKEY, lpSubKey: ?[*:0]const u8, lpValue: ?[*:0]const u8, dwFlags: RRF_RT, pdwType: ?*u32, // TODO: what to do with BytesParamIndex 6? pvData: ?*c_void, pcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegGetValueW( hkey: ?HKEY, lpSubKey: ?[*:0]const u16, lpValue: ?[*:0]const u16, dwFlags: RRF_RT, pdwType: ?*u32, // TODO: what to do with BytesParamIndex 6? pvData: ?*c_void, pcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegCopyTreeW( hKeySrc: ?HKEY, lpSubKey: ?[*:0]const u16, hKeyDest: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegLoadMUIStringA( hKey: ?HKEY, pszValue: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 3? pszOutBuf: ?PSTR, cbOutBuf: u32, pcbData: ?*u32, Flags: u32, pszDirectory: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegLoadMUIStringW( hKey: ?HKEY, pszValue: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pszOutBuf: ?PWSTR, cbOutBuf: u32, pcbData: ?*u32, Flags: u32, pszDirectory: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegLoadAppKeyA( lpFile: ?[*:0]const u8, phkResult: ?*?HKEY, samDesired: u32, dwOptions: u32, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn RegLoadAppKeyW( lpFile: ?[*:0]const u16, phkResult: ?*?HKEY, samDesired: u32, dwOptions: u32, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegSaveKeyExA( hKey: ?HKEY, lpFile: ?[*:0]const u8, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, Flags: REG_SAVE_FORMAT, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegSaveKeyExW( hKey: ?HKEY, lpFile: ?[*:0]const u16, lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES, Flags: REG_SAVE_FORMAT, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; pub extern "api-ms-win-core-state-helpers-l1-1-0" fn GetRegistryValueWithFallbackW( hkeyPrimary: ?HKEY, pwszPrimarySubKey: ?[*:0]const u16, hkeyFallback: ?HKEY, pwszFallbackSubKey: ?[*:0]const u16, pwszValue: ?[*:0]const u16, dwFlags: u32, pdwType: ?*u32, pvData: ?*c_void, cbDataIn: u32, pcbDataOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) LSTATUS; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (36) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const pvalue = thismodule.pvalueA; pub const VALENT = thismodule.VALENTA; pub const RegConnectRegistry = thismodule.RegConnectRegistryA; pub const RegConnectRegistryEx = thismodule.RegConnectRegistryExA; pub const RegCreateKey = thismodule.RegCreateKeyA; pub const RegCreateKeyEx = thismodule.RegCreateKeyExA; pub const RegCreateKeyTransacted = thismodule.RegCreateKeyTransactedA; pub const RegDeleteKey = thismodule.RegDeleteKeyA; pub const RegDeleteKeyEx = thismodule.RegDeleteKeyExA; pub const RegDeleteKeyTransacted = thismodule.RegDeleteKeyTransactedA; pub const RegDeleteValue = thismodule.RegDeleteValueA; pub const RegEnumKey = thismodule.RegEnumKeyA; pub const RegEnumKeyEx = thismodule.RegEnumKeyExA; pub const RegEnumValue = thismodule.RegEnumValueA; pub const RegLoadKey = thismodule.RegLoadKeyA; pub const RegOpenKey = thismodule.RegOpenKeyA; pub const RegOpenKeyEx = thismodule.RegOpenKeyExA; pub const RegOpenKeyTransacted = thismodule.RegOpenKeyTransactedA; pub const RegQueryInfoKey = thismodule.RegQueryInfoKeyA; pub const RegQueryValue = thismodule.RegQueryValueA; pub const RegQueryMultipleValues = thismodule.RegQueryMultipleValuesA; pub const RegQueryValueEx = thismodule.RegQueryValueExA; pub const RegReplaceKey = thismodule.RegReplaceKeyA; pub const RegRestoreKey = thismodule.RegRestoreKeyA; pub const RegSaveKey = thismodule.RegSaveKeyA; pub const RegSetValue = thismodule.RegSetValueA; pub const RegSetValueEx = thismodule.RegSetValueExA; pub const RegUnLoadKey = thismodule.RegUnLoadKeyA; pub const RegDeleteKeyValue = thismodule.RegDeleteKeyValueA; pub const RegSetKeyValue = thismodule.RegSetKeyValueA; pub const RegDeleteTree = thismodule.RegDeleteTreeA; pub const RegCopyTree = thismodule.RegCopyTreeA; pub const RegGetValue = thismodule.RegGetValueA; pub const RegLoadMUIString = thismodule.RegLoadMUIStringA; pub const RegLoadAppKey = thismodule.RegLoadAppKeyA; pub const RegSaveKeyEx = thismodule.RegSaveKeyExA; }, .wide => struct { pub const pvalue = thismodule.pvalueW; pub const VALENT = thismodule.VALENTW; pub const RegConnectRegistry = thismodule.RegConnectRegistryW; pub const RegConnectRegistryEx = thismodule.RegConnectRegistryExW; pub const RegCreateKey = thismodule.RegCreateKeyW; pub const RegCreateKeyEx = thismodule.RegCreateKeyExW; pub const RegCreateKeyTransacted = thismodule.RegCreateKeyTransactedW; pub const RegDeleteKey = thismodule.RegDeleteKeyW; pub const RegDeleteKeyEx = thismodule.RegDeleteKeyExW; pub const RegDeleteKeyTransacted = thismodule.RegDeleteKeyTransactedW; pub const RegDeleteValue = thismodule.RegDeleteValueW; pub const RegEnumKey = thismodule.RegEnumKeyW; pub const RegEnumKeyEx = thismodule.RegEnumKeyExW; pub const RegEnumValue = thismodule.RegEnumValueW; pub const RegLoadKey = thismodule.RegLoadKeyW; pub const RegOpenKey = thismodule.RegOpenKeyW; pub const RegOpenKeyEx = thismodule.RegOpenKeyExW; pub const RegOpenKeyTransacted = thismodule.RegOpenKeyTransactedW; pub const RegQueryInfoKey = thismodule.RegQueryInfoKeyW; pub const RegQueryValue = thismodule.RegQueryValueW; pub const RegQueryMultipleValues = thismodule.RegQueryMultipleValuesW; pub const RegQueryValueEx = thismodule.RegQueryValueExW; pub const RegReplaceKey = thismodule.RegReplaceKeyW; pub const RegRestoreKey = thismodule.RegRestoreKeyW; pub const RegSaveKey = thismodule.RegSaveKeyW; pub const RegSetValue = thismodule.RegSetValueW; pub const RegSetValueEx = thismodule.RegSetValueExW; pub const RegUnLoadKey = thismodule.RegUnLoadKeyW; pub const RegDeleteKeyValue = thismodule.RegDeleteKeyValueW; pub const RegSetKeyValue = thismodule.RegSetKeyValueW; pub const RegDeleteTree = thismodule.RegDeleteTreeW; pub const RegCopyTree = thismodule.RegCopyTreeW; pub const RegGetValue = thismodule.RegGetValueW; pub const RegLoadMUIString = thismodule.RegLoadMUIStringW; pub const RegLoadAppKey = thismodule.RegLoadAppKeyW; pub const RegSaveKeyEx = thismodule.RegSaveKeyExW; }, .unspecified => if (@import("builtin").is_test) struct { pub const pvalue = *opaque{}; pub const VALENT = *opaque{}; pub const RegConnectRegistry = *opaque{}; pub const RegConnectRegistryEx = *opaque{}; pub const RegCreateKey = *opaque{}; pub const RegCreateKeyEx = *opaque{}; pub const RegCreateKeyTransacted = *opaque{}; pub const RegDeleteKey = *opaque{}; pub const RegDeleteKeyEx = *opaque{}; pub const RegDeleteKeyTransacted = *opaque{}; pub const RegDeleteValue = *opaque{}; pub const RegEnumKey = *opaque{}; pub const RegEnumKeyEx = *opaque{}; pub const RegEnumValue = *opaque{}; pub const RegLoadKey = *opaque{}; pub const RegOpenKey = *opaque{}; pub const RegOpenKeyEx = *opaque{}; pub const RegOpenKeyTransacted = *opaque{}; pub const RegQueryInfoKey = *opaque{}; pub const RegQueryValue = *opaque{}; pub const RegQueryMultipleValues = *opaque{}; pub const RegQueryValueEx = *opaque{}; pub const RegReplaceKey = *opaque{}; pub const RegRestoreKey = *opaque{}; pub const RegSaveKey = *opaque{}; pub const RegSetValue = *opaque{}; pub const RegSetValueEx = *opaque{}; pub const RegUnLoadKey = *opaque{}; pub const RegDeleteKeyValue = *opaque{}; pub const RegSetKeyValue = *opaque{}; pub const RegDeleteTree = *opaque{}; pub const RegCopyTree = *opaque{}; pub const RegGetValue = *opaque{}; pub const RegLoadMUIString = *opaque{}; pub const RegLoadAppKey = *opaque{}; pub const RegSaveKeyEx = *opaque{}; } else struct { pub const pvalue = @compileError("'pvalue' requires that UNICODE be set to true or false in the root module"); pub const VALENT = @compileError("'VALENT' requires that UNICODE be set to true or false in the root module"); pub const RegConnectRegistry = @compileError("'RegConnectRegistry' requires that UNICODE be set to true or false in the root module"); pub const RegConnectRegistryEx = @compileError("'RegConnectRegistryEx' requires that UNICODE be set to true or false in the root module"); pub const RegCreateKey = @compileError("'RegCreateKey' requires that UNICODE be set to true or false in the root module"); pub const RegCreateKeyEx = @compileError("'RegCreateKeyEx' requires that UNICODE be set to true or false in the root module"); pub const RegCreateKeyTransacted = @compileError("'RegCreateKeyTransacted' requires that UNICODE be set to true or false in the root module"); pub const RegDeleteKey = @compileError("'RegDeleteKey' requires that UNICODE be set to true or false in the root module"); pub const RegDeleteKeyEx = @compileError("'RegDeleteKeyEx' requires that UNICODE be set to true or false in the root module"); pub const RegDeleteKeyTransacted = @compileError("'RegDeleteKeyTransacted' requires that UNICODE be set to true or false in the root module"); pub const RegDeleteValue = @compileError("'RegDeleteValue' requires that UNICODE be set to true or false in the root module"); pub const RegEnumKey = @compileError("'RegEnumKey' requires that UNICODE be set to true or false in the root module"); pub const RegEnumKeyEx = @compileError("'RegEnumKeyEx' requires that UNICODE be set to true or false in the root module"); pub const RegEnumValue = @compileError("'RegEnumValue' requires that UNICODE be set to true or false in the root module"); pub const RegLoadKey = @compileError("'RegLoadKey' requires that UNICODE be set to true or false in the root module"); pub const RegOpenKey = @compileError("'RegOpenKey' requires that UNICODE be set to true or false in the root module"); pub const RegOpenKeyEx = @compileError("'RegOpenKeyEx' requires that UNICODE be set to true or false in the root module"); pub const RegOpenKeyTransacted = @compileError("'RegOpenKeyTransacted' requires that UNICODE be set to true or false in the root module"); pub const RegQueryInfoKey = @compileError("'RegQueryInfoKey' requires that UNICODE be set to true or false in the root module"); pub const RegQueryValue = @compileError("'RegQueryValue' requires that UNICODE be set to true or false in the root module"); pub const RegQueryMultipleValues = @compileError("'RegQueryMultipleValues' requires that UNICODE be set to true or false in the root module"); pub const RegQueryValueEx = @compileError("'RegQueryValueEx' requires that UNICODE be set to true or false in the root module"); pub const RegReplaceKey = @compileError("'RegReplaceKey' requires that UNICODE be set to true or false in the root module"); pub const RegRestoreKey = @compileError("'RegRestoreKey' requires that UNICODE be set to true or false in the root module"); pub const RegSaveKey = @compileError("'RegSaveKey' requires that UNICODE be set to true or false in the root module"); pub const RegSetValue = @compileError("'RegSetValue' requires that UNICODE be set to true or false in the root module"); pub const RegSetValueEx = @compileError("'RegSetValueEx' requires that UNICODE be set to true or false in the root module"); pub const RegUnLoadKey = @compileError("'RegUnLoadKey' requires that UNICODE be set to true or false in the root module"); pub const RegDeleteKeyValue = @compileError("'RegDeleteKeyValue' requires that UNICODE be set to true or false in the root module"); pub const RegSetKeyValue = @compileError("'RegSetKeyValue' requires that UNICODE be set to true or false in the root module"); pub const RegDeleteTree = @compileError("'RegDeleteTree' requires that UNICODE be set to true or false in the root module"); pub const RegCopyTree = @compileError("'RegCopyTree' requires that UNICODE be set to true or false in the root module"); pub const RegGetValue = @compileError("'RegGetValue' requires that UNICODE be set to true or false in the root module"); pub const RegLoadMUIString = @compileError("'RegLoadMUIString' requires that UNICODE be set to true or false in the root module"); pub const RegLoadAppKey = @compileError("'RegLoadAppKey' requires that UNICODE be set to true or false in the root module"); pub const RegSaveKeyEx = @compileError("'RegSaveKeyEx' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (8) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const FILETIME = @import("../foundation.zig").FILETIME; const HANDLE = @import("../foundation.zig").HANDLE; const LSTATUS = @import("../foundation.zig").LSTATUS; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; const SECURITY_DESCRIPTOR = @import("../security.zig").SECURITY_DESCRIPTOR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PQUERYHANDLER")) { _ = PQUERYHANDLER; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
deps/zigwin32/win32/system/registry.zig
const c = @import("c.zig"); const nk = @import("../nuklear.zig"); const std = @import("std"); const testing = std.testing; pub const Type = enum(u8) { lines = c.NK_CHART_LINES, column = c.NK_CHART_COLUMN, pub fn toNuklear(_type: Type) c.enum_nk_chart_type { return @intToEnum(c.enum_nk_chart_type, @enumToInt(_type)); } }; pub const Event = enum(nk.Flags) { hovering = c.NK_CHART_HOVERING, clicked = c.NK_CHART_CLICKED | c.NK_CHART_HOVERING, _, }; pub fn begin(ctx: *nk.Context, _type: Type, num: usize, min: f32, max: f32) bool { return c.nk_chart_begin(ctx, _type.toNuklear(), @intCast(c_int, num), min, max) != 0; } pub fn beginColored(ctx: *nk.Context, _type: Type, a: nk.Color, active: nk.Color, num: usize, min: f32, max: f32) bool { return c.nk_chart_begin_colored(ctx, _type.toNuklear(), a, active, @intCast(c_int, num), min, max) != 0; } pub fn addSlot(ctx: *nk.Context, _type: Type, count: usize, min_value: f32, max_value: f32) void { return c.nk_chart_add_slot(ctx, _type.toNuklear(), @intCast(c_int, count), min_value, max_value); } pub fn addSlotColored(ctx: *nk.Context, _type: Type, a: nk.Color, active: nk.Color, count: usize, min_value: f32, max_value: f32) void { return c.nk_chart_add_slot_colored(ctx, _type.toNuklear(), a, active, @intCast(c_int, count), min_value, max_value); } pub fn push(ctx: *nk.Context, value: f32) Event { return @intToEnum(Event, c.nk_chart_push(ctx, value)); } pub fn pushSlot(ctx: *nk.Context, value: f32, slot: usize) Event { return @intToEnum(Event, c.nk_chart_push_slot(ctx, value, @intCast(c_int, slot))); } pub fn end(ctx: *nk.Context) void { return c.nk_chart_end(ctx); } pub fn plot(ctx: *nk.Context, _type: Type, values: []const f32) void { return c.nk_plot( ctx, _type.toNuklear(), values.ptr, @intCast(c_int, values.len), 0, ); } pub fn function( ctx: *nk.Context, _type: Type, count: usize, offset: usize, userdata: anytype, getter: fn (@TypeOf(userdata), usize) f32, ) void { const T = @TypeOf(userdata); const Wrapped = struct { userdata: T, getter: fn (T, usize) f32, fn valueGetter(user: ?*c_void, index: c_int) callconv(.C) f32 { const casted = @ptrCast(*const @This(), @alignCast(@alignOf(@This()), user)); return casted.getter(casted.userdata, @intCast(usize, index)); } }; var wrapped = Wrapped{ .userdata = userdata, .getter = getter }; return c.nk_plot_function( ctx, _type.toNuklear(), @ptrCast(*c_void, &wrapped), Wrapped.valueGetter, @intCast(c_int, count), @intCast(c_int, offset), ); } test { testing.refAllDecls(@This()); } test "chart" { var ctx = &try nk.testing.init(); defer nk.free(ctx); if (nk.window.begin(ctx, &nk.id(opaque {}), nk.rect(10, 10, 10, 10), .{})) |_| { nk.layout.rowDynamic(ctx, 0.0, 1); nk.chart.function(ctx, .lines, 10, 0, {}, struct { fn func(_: void, i: usize) f32 { return @intToFloat(f32, i); } }.func); } nk.window.end(ctx); }
src/chart.zig
const assert = @import("std").debug.assert; const mem = @import("std").mem; test "arrays" { var array : [5]u32 = undefined; var i : u32 = 0; while (i < 5) { array[i] = i + 1; i = array[i]; } i = 0; var accumulator = u32(0); while (i < 5) { accumulator += array[i]; i += 1; } assert(accumulator == 15); assert(getArrayLen(array) == 5); } fn getArrayLen(a: []const u32) usize { return a.len; } test "void arrays" { var array: [4]void = undefined; array[0] = void{}; array[1] = array[2]; assert(@sizeOf(@typeOf(array)) == 0); assert(array.len == 4); } test "array literal" { const hex_mult = []u16{4096, 256, 16, 1}; assert(hex_mult.len == 4); assert(hex_mult[1] == 256); } test "array dot len const expr" { assert(comptime x: {break :x some_array.len == 4;}); } const ArrayDotLenConstExpr = struct { y: [some_array.len]u8, }; const some_array = []u8 {0, 1, 2, 3}; test "nested arrays" { const array_of_strings = [][]const u8 {"hello", "this", "is", "my", "thing"}; for (array_of_strings) |s, i| { if (i == 0) assert(mem.eql(u8, s, "hello")); if (i == 1) assert(mem.eql(u8, s, "this")); if (i == 2) assert(mem.eql(u8, s, "is")); if (i == 3) assert(mem.eql(u8, s, "my")); if (i == 4) assert(mem.eql(u8, s, "thing")); } } var s_array: [8]Sub = undefined; const Sub = struct { b: u8, }; const Str = struct { a: []Sub, }; test "set global var array via slice embedded in struct" { var s = Str { .a = s_array[0..]}; s.a[0].b = 1; s.a[1].b = 2; s.a[2].b = 3; assert(s_array[0].b == 1); assert(s_array[1].b == 2); assert(s_array[2].b == 3); } test "array literal with specified size" { var array = [2]u8{1, 2}; assert(array[0] == 1); assert(array[1] == 2); } test "array child property" { var x: [5]i32 = undefined; assert(@typeOf(x).Child == i32); } test "array len property" { var x: [5]i32 = undefined; assert(@typeOf(x).len == 5); }
test/cases/array.zig
pub const SERVICE_ALL_ACCESS = @as(u32, 983551); pub const SC_MANAGER_ALL_ACCESS = @as(u32, 983103); pub const SERVICE_NO_CHANGE = @as(u32, 4294967295); pub const SERVICE_CONTROL_STOP = @as(u32, 1); pub const SERVICE_CONTROL_PAUSE = @as(u32, 2); pub const SERVICE_CONTROL_CONTINUE = @as(u32, 3); pub const SERVICE_CONTROL_INTERROGATE = @as(u32, 4); pub const SERVICE_CONTROL_SHUTDOWN = @as(u32, 5); pub const SERVICE_CONTROL_PARAMCHANGE = @as(u32, 6); pub const SERVICE_CONTROL_NETBINDADD = @as(u32, 7); pub const SERVICE_CONTROL_NETBINDREMOVE = @as(u32, 8); pub const SERVICE_CONTROL_NETBINDENABLE = @as(u32, 9); pub const SERVICE_CONTROL_NETBINDDISABLE = @as(u32, 10); pub const SERVICE_CONTROL_DEVICEEVENT = @as(u32, 11); pub const SERVICE_CONTROL_HARDWAREPROFILECHANGE = @as(u32, 12); pub const SERVICE_CONTROL_POWEREVENT = @as(u32, 13); pub const SERVICE_CONTROL_SESSIONCHANGE = @as(u32, 14); pub const SERVICE_CONTROL_PRESHUTDOWN = @as(u32, 15); pub const SERVICE_CONTROL_TIMECHANGE = @as(u32, 16); pub const SERVICE_CONTROL_TRIGGEREVENT = @as(u32, 32); pub const SERVICE_CONTROL_LOWRESOURCES = @as(u32, 96); pub const SERVICE_CONTROL_SYSTEMLOWRESOURCES = @as(u32, 97); pub const SERVICE_ACCEPT_STOP = @as(u32, 1); pub const SERVICE_ACCEPT_PAUSE_CONTINUE = @as(u32, 2); pub const SERVICE_ACCEPT_SHUTDOWN = @as(u32, 4); pub const SERVICE_ACCEPT_PARAMCHANGE = @as(u32, 8); pub const SERVICE_ACCEPT_NETBINDCHANGE = @as(u32, 16); pub const SERVICE_ACCEPT_HARDWAREPROFILECHANGE = @as(u32, 32); pub const SERVICE_ACCEPT_POWEREVENT = @as(u32, 64); pub const SERVICE_ACCEPT_SESSIONCHANGE = @as(u32, 128); pub const SERVICE_ACCEPT_PRESHUTDOWN = @as(u32, 256); pub const SERVICE_ACCEPT_TIMECHANGE = @as(u32, 512); pub const SERVICE_ACCEPT_TRIGGEREVENT = @as(u32, 1024); pub const SERVICE_ACCEPT_USER_LOGOFF = @as(u32, 2048); pub const SERVICE_ACCEPT_LOWRESOURCES = @as(u32, 8192); pub const SERVICE_ACCEPT_SYSTEMLOWRESOURCES = @as(u32, 16384); pub const SC_MANAGER_CONNECT = @as(u32, 1); pub const SC_MANAGER_CREATE_SERVICE = @as(u32, 2); pub const SC_MANAGER_ENUMERATE_SERVICE = @as(u32, 4); pub const SC_MANAGER_LOCK = @as(u32, 8); pub const SC_MANAGER_QUERY_LOCK_STATUS = @as(u32, 16); pub const SC_MANAGER_MODIFY_BOOT_CONFIG = @as(u32, 32); pub const SERVICE_QUERY_CONFIG = @as(u32, 1); pub const SERVICE_CHANGE_CONFIG = @as(u32, 2); pub const SERVICE_QUERY_STATUS = @as(u32, 4); pub const SERVICE_ENUMERATE_DEPENDENTS = @as(u32, 8); pub const SERVICE_START = @as(u32, 16); pub const SERVICE_STOP = @as(u32, 32); pub const SERVICE_PAUSE_CONTINUE = @as(u32, 64); pub const SERVICE_INTERROGATE = @as(u32, 128); pub const SERVICE_USER_DEFINED_CONTROL = @as(u32, 256); pub const SERVICE_NOTIFY_STATUS_CHANGE_1 = @as(u32, 1); pub const SERVICE_NOTIFY_STATUS_CHANGE_2 = @as(u32, 2); pub const SERVICE_NOTIFY_STATUS_CHANGE = @as(u32, 2); pub const SERVICE_STOP_REASON_FLAG_MIN = @as(u32, 0); pub const SERVICE_STOP_REASON_FLAG_UNPLANNED = @as(u32, 268435456); pub const SERVICE_STOP_REASON_FLAG_CUSTOM = @as(u32, 536870912); pub const SERVICE_STOP_REASON_FLAG_PLANNED = @as(u32, 1073741824); pub const SERVICE_STOP_REASON_FLAG_MAX = @as(u32, 2147483648); pub const SERVICE_STOP_REASON_MAJOR_MIN = @as(u32, 0); pub const SERVICE_STOP_REASON_MAJOR_OTHER = @as(u32, 65536); pub const SERVICE_STOP_REASON_MAJOR_HARDWARE = @as(u32, 131072); pub const SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM = @as(u32, 196608); pub const SERVICE_STOP_REASON_MAJOR_SOFTWARE = @as(u32, 262144); pub const SERVICE_STOP_REASON_MAJOR_APPLICATION = @as(u32, 327680); pub const SERVICE_STOP_REASON_MAJOR_NONE = @as(u32, 393216); pub const SERVICE_STOP_REASON_MAJOR_MAX = @as(u32, 458752); pub const SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM = @as(u32, 4194304); pub const SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM = @as(u32, 16711680); pub const SERVICE_STOP_REASON_MINOR_MIN = @as(u32, 0); pub const SERVICE_STOP_REASON_MINOR_OTHER = @as(u32, 1); pub const SERVICE_STOP_REASON_MINOR_MAINTENANCE = @as(u32, 2); pub const SERVICE_STOP_REASON_MINOR_INSTALLATION = @as(u32, 3); pub const SERVICE_STOP_REASON_MINOR_UPGRADE = @as(u32, 4); pub const SERVICE_STOP_REASON_MINOR_RECONFIG = @as(u32, 5); pub const SERVICE_STOP_REASON_MINOR_HUNG = @as(u32, 6); pub const SERVICE_STOP_REASON_MINOR_UNSTABLE = @as(u32, 7); pub const SERVICE_STOP_REASON_MINOR_DISK = @as(u32, 8); pub const SERVICE_STOP_REASON_MINOR_NETWORKCARD = @as(u32, 9); pub const SERVICE_STOP_REASON_MINOR_ENVIRONMENT = @as(u32, 10); pub const SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER = @as(u32, 11); pub const SERVICE_STOP_REASON_MINOR_OTHERDRIVER = @as(u32, 12); pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK = @as(u32, 13); pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE = @as(u32, 14); pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX = @as(u32, 15); pub const SERVICE_STOP_REASON_MINOR_SECURITY = @as(u32, 16); pub const SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY = @as(u32, 17); pub const SERVICE_STOP_REASON_MINOR_WMI = @as(u32, 18); pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL = @as(u32, 19); pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL = @as(u32, 20); pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL = @as(u32, 21); pub const SERVICE_STOP_REASON_MINOR_MMC = @as(u32, 22); pub const SERVICE_STOP_REASON_MINOR_NONE = @as(u32, 23); pub const SERVICE_STOP_REASON_MINOR_MEMOTYLIMIT = @as(u32, 24); pub const SERVICE_STOP_REASON_MINOR_MAX = @as(u32, 25); pub const SERVICE_STOP_REASON_MINOR_MIN_CUSTOM = @as(u32, 256); pub const SERVICE_STOP_REASON_MINOR_MAX_CUSTOM = @as(u32, 65535); pub const SERVICE_CONTROL_STATUS_REASON_INFO = @as(u32, 1); pub const SERVICE_SID_TYPE_NONE = @as(u32, 0); pub const SERVICE_SID_TYPE_UNRESTRICTED = @as(u32, 1); pub const SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE = @as(u32, 7); pub const SERVICE_TRIGGER_TYPE_AGGREGATE = @as(u32, 30); pub const SERVICE_START_REASON_DEMAND = @as(u32, 1); pub const SERVICE_START_REASON_AUTO = @as(u32, 2); pub const SERVICE_START_REASON_TRIGGER = @as(u32, 4); pub const SERVICE_START_REASON_RESTART_ON_FAILURE = @as(u32, 8); pub const SERVICE_START_REASON_DELAYEDAUTO = @as(u32, 16); pub const SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON = @as(u32, 1); pub const SERVICE_LAUNCH_PROTECTED_NONE = @as(u32, 0); pub const SERVICE_LAUNCH_PROTECTED_WINDOWS = @as(u32, 1); pub const SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT = @as(u32, 2); pub const SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT = @as(u32, 3); pub const NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID = Guid.initString("4f27f2de-14e2-430b-a549-7cd48cbc8245"); pub const NETWORK_MANAGER_LAST_IP_ADDRESS_REMOVAL_GUID = Guid.initString("cc4ba62a-162e-4648-847a-b6bdf993e335"); pub const DOMAIN_JOIN_GUID = Guid.initString("1ce20aba-9851-4421-9430-1ddeb766e809"); pub const DOMAIN_LEAVE_GUID = Guid.initString("ddaf516e-58c2-4866-9574-c3b615d42ea1"); pub const FIREWALL_PORT_OPEN_GUID = Guid.initString("b7569e07-8421-4ee0-ad10-86915afdad09"); pub const FIREWALL_PORT_CLOSE_GUID = Guid.initString("a144ed38-8e12-4de4-9d96-e64740b1a524"); pub const MACHINE_POLICY_PRESENT_GUID = Guid.initString("659fcae6-5bdb-4da9-b1ff-ca2a178d46e0"); pub const USER_POLICY_PRESENT_GUID = Guid.initString("54fb46c8-f089-464c-b1fd-59d1b62c3b50"); pub const RPC_INTERFACE_EVENT_GUID = Guid.initString("bc90d167-9470-4139-a9ba-be0bbbf5b74d"); pub const NAMED_PIPE_EVENT_GUID = Guid.initString("1f81d131-3fac-4537-9e0c-7e7b0c2f4b55"); pub const CUSTOM_SYSTEM_STATE_CHANGE_EVENT_GUID = Guid.initString("2d7a2816-0c5e-45fc-9ce7-570e5ecde9c9"); //-------------------------------------------------------------------------------- // Section: Types (68) //-------------------------------------------------------------------------------- pub const ENUM_SERVICE_STATE = enum(u32) { ACTIVE = 1, INACTIVE = 2, STATE_ALL = 3, }; pub const SERVICE_ACTIVE = ENUM_SERVICE_STATE.ACTIVE; pub const SERVICE_INACTIVE = ENUM_SERVICE_STATE.INACTIVE; pub const SERVICE_STATE_ALL = ENUM_SERVICE_STATE.STATE_ALL; pub const SERVICE_ERROR = enum(u32) { CRITICAL = 3, IGNORE = 0, NORMAL = 1, SEVERE = 2, }; pub const SERVICE_ERROR_CRITICAL = SERVICE_ERROR.CRITICAL; pub const SERVICE_ERROR_IGNORE = SERVICE_ERROR.IGNORE; pub const SERVICE_ERROR_NORMAL = SERVICE_ERROR.NORMAL; pub const SERVICE_ERROR_SEVERE = SERVICE_ERROR.SEVERE; pub const SERVICE_CONFIG = enum(u32) { DELAYED_AUTO_START_INFO = 3, DESCRIPTION = 1, FAILURE_ACTIONS = 2, FAILURE_ACTIONS_FLAG = 4, PREFERRED_NODE = 9, PRESHUTDOWN_INFO = 7, REQUIRED_PRIVILEGES_INFO = 6, SERVICE_SID_INFO = 5, TRIGGER_INFO = 8, LAUNCH_PROTECTED = 12, }; pub const SERVICE_CONFIG_DELAYED_AUTO_START_INFO = SERVICE_CONFIG.DELAYED_AUTO_START_INFO; pub const SERVICE_CONFIG_DESCRIPTION = SERVICE_CONFIG.DESCRIPTION; pub const SERVICE_CONFIG_FAILURE_ACTIONS = SERVICE_CONFIG.FAILURE_ACTIONS; pub const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = SERVICE_CONFIG.FAILURE_ACTIONS_FLAG; pub const SERVICE_CONFIG_PREFERRED_NODE = SERVICE_CONFIG.PREFERRED_NODE; pub const SERVICE_CONFIG_PRESHUTDOWN_INFO = SERVICE_CONFIG.PRESHUTDOWN_INFO; pub const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = SERVICE_CONFIG.REQUIRED_PRIVILEGES_INFO; pub const SERVICE_CONFIG_SERVICE_SID_INFO = SERVICE_CONFIG.SERVICE_SID_INFO; pub const SERVICE_CONFIG_TRIGGER_INFO = SERVICE_CONFIG.TRIGGER_INFO; pub const SERVICE_CONFIG_LAUNCH_PROTECTED = SERVICE_CONFIG.LAUNCH_PROTECTED; pub const ENUM_SERVICE_TYPE = enum(u32) { DRIVER = 11, FILE_SYSTEM_DRIVER_ = 2, KERNEL_DRIVER = 1, WIN32 = 48, WIN32_OWN_PROCESS_ = 16, WIN32_SHARE_PROCESS = 32, ADAPTER = 4, // FILE_SYSTEM_DRIVER = 2, this enum value conflicts with FILE_SYSTEM_DRIVER_ RECOGNIZER_DRIVER = 8, // WIN32_OWN_PROCESS = 16, this enum value conflicts with WIN32_OWN_PROCESS_ USER_OWN_PROCESS = 80, USER_SHARE_PROCESS = 96, _, pub fn initFlags(o: struct { DRIVER: u1 = 0, FILE_SYSTEM_DRIVER_: u1 = 0, KERNEL_DRIVER: u1 = 0, WIN32: u1 = 0, WIN32_OWN_PROCESS_: u1 = 0, WIN32_SHARE_PROCESS: u1 = 0, ADAPTER: u1 = 0, RECOGNIZER_DRIVER: u1 = 0, USER_OWN_PROCESS: u1 = 0, USER_SHARE_PROCESS: u1 = 0, }) ENUM_SERVICE_TYPE { return @intToEnum(ENUM_SERVICE_TYPE, (if (o.DRIVER == 1) @enumToInt(ENUM_SERVICE_TYPE.DRIVER) else 0) | (if (o.FILE_SYSTEM_DRIVER_ == 1) @enumToInt(ENUM_SERVICE_TYPE.FILE_SYSTEM_DRIVER_) else 0) | (if (o.KERNEL_DRIVER == 1) @enumToInt(ENUM_SERVICE_TYPE.KERNEL_DRIVER) else 0) | (if (o.WIN32 == 1) @enumToInt(ENUM_SERVICE_TYPE.WIN32) else 0) | (if (o.WIN32_OWN_PROCESS_ == 1) @enumToInt(ENUM_SERVICE_TYPE.WIN32_OWN_PROCESS_) else 0) | (if (o.WIN32_SHARE_PROCESS == 1) @enumToInt(ENUM_SERVICE_TYPE.WIN32_SHARE_PROCESS) else 0) | (if (o.ADAPTER == 1) @enumToInt(ENUM_SERVICE_TYPE.ADAPTER) else 0) | (if (o.RECOGNIZER_DRIVER == 1) @enumToInt(ENUM_SERVICE_TYPE.RECOGNIZER_DRIVER) else 0) | (if (o.USER_OWN_PROCESS == 1) @enumToInt(ENUM_SERVICE_TYPE.USER_OWN_PROCESS) else 0) | (if (o.USER_SHARE_PROCESS == 1) @enumToInt(ENUM_SERVICE_TYPE.USER_SHARE_PROCESS) else 0) ); } }; pub const SERVICE_DRIVER = ENUM_SERVICE_TYPE.DRIVER; pub const SERVICE_FILE_SYSTEM_DRIVER_ = ENUM_SERVICE_TYPE.FILE_SYSTEM_DRIVER_; pub const SERVICE_KERNEL_DRIVER = ENUM_SERVICE_TYPE.KERNEL_DRIVER; pub const SERVICE_WIN32 = ENUM_SERVICE_TYPE.WIN32; pub const SERVICE_WIN32_OWN_PROCESS_ = ENUM_SERVICE_TYPE.WIN32_OWN_PROCESS_; pub const SERVICE_WIN32_SHARE_PROCESS = ENUM_SERVICE_TYPE.WIN32_SHARE_PROCESS; pub const SERVICE_ADAPTER = ENUM_SERVICE_TYPE.ADAPTER; pub const SERVICE_FILE_SYSTEM_DRIVER = ENUM_SERVICE_TYPE.FILE_SYSTEM_DRIVER_; pub const SERVICE_RECOGNIZER_DRIVER = ENUM_SERVICE_TYPE.RECOGNIZER_DRIVER; pub const SERVICE_WIN32_OWN_PROCESS = ENUM_SERVICE_TYPE.WIN32_OWN_PROCESS_; pub const SERVICE_USER_OWN_PROCESS = ENUM_SERVICE_TYPE.USER_OWN_PROCESS; pub const SERVICE_USER_SHARE_PROCESS = ENUM_SERVICE_TYPE.USER_SHARE_PROCESS; pub const SERVICE_START_TYPE = enum(u32) { AUTO_START = 2, BOOT_START = 0, DEMAND_START = 3, DISABLED = 4, SYSTEM_START = 1, }; pub const SERVICE_AUTO_START = SERVICE_START_TYPE.AUTO_START; pub const SERVICE_BOOT_START = SERVICE_START_TYPE.BOOT_START; pub const SERVICE_DEMAND_START = SERVICE_START_TYPE.DEMAND_START; pub const SERVICE_DISABLED = SERVICE_START_TYPE.DISABLED; pub const SERVICE_SYSTEM_START = SERVICE_START_TYPE.SYSTEM_START; pub const SERVICE_NOTIFY = enum(u32) { CREATED = 128, CONTINUE_PENDING = 16, DELETE_PENDING = 512, DELETED = 256, PAUSE_PENDING = 32, PAUSED = 64, RUNNING = 8, START_PENDING = 2, STOP_PENDING = 4, STOPPED = 1, _, pub fn initFlags(o: struct { CREATED: u1 = 0, CONTINUE_PENDING: u1 = 0, DELETE_PENDING: u1 = 0, DELETED: u1 = 0, PAUSE_PENDING: u1 = 0, PAUSED: u1 = 0, RUNNING: u1 = 0, START_PENDING: u1 = 0, STOP_PENDING: u1 = 0, STOPPED: u1 = 0, }) SERVICE_NOTIFY { return @intToEnum(SERVICE_NOTIFY, (if (o.CREATED == 1) @enumToInt(SERVICE_NOTIFY.CREATED) else 0) | (if (o.CONTINUE_PENDING == 1) @enumToInt(SERVICE_NOTIFY.CONTINUE_PENDING) else 0) | (if (o.DELETE_PENDING == 1) @enumToInt(SERVICE_NOTIFY.DELETE_PENDING) else 0) | (if (o.DELETED == 1) @enumToInt(SERVICE_NOTIFY.DELETED) else 0) | (if (o.PAUSE_PENDING == 1) @enumToInt(SERVICE_NOTIFY.PAUSE_PENDING) else 0) | (if (o.PAUSED == 1) @enumToInt(SERVICE_NOTIFY.PAUSED) else 0) | (if (o.RUNNING == 1) @enumToInt(SERVICE_NOTIFY.RUNNING) else 0) | (if (o.START_PENDING == 1) @enumToInt(SERVICE_NOTIFY.START_PENDING) else 0) | (if (o.STOP_PENDING == 1) @enumToInt(SERVICE_NOTIFY.STOP_PENDING) else 0) | (if (o.STOPPED == 1) @enumToInt(SERVICE_NOTIFY.STOPPED) else 0) ); } }; pub const SERVICE_NOTIFY_CREATED = SERVICE_NOTIFY.CREATED; pub const SERVICE_NOTIFY_CONTINUE_PENDING = SERVICE_NOTIFY.CONTINUE_PENDING; pub const SERVICE_NOTIFY_DELETE_PENDING = SERVICE_NOTIFY.DELETE_PENDING; pub const SERVICE_NOTIFY_DELETED = SERVICE_NOTIFY.DELETED; pub const SERVICE_NOTIFY_PAUSE_PENDING = SERVICE_NOTIFY.PAUSE_PENDING; pub const SERVICE_NOTIFY_PAUSED = SERVICE_NOTIFY.PAUSED; pub const SERVICE_NOTIFY_RUNNING = SERVICE_NOTIFY.RUNNING; pub const SERVICE_NOTIFY_START_PENDING = SERVICE_NOTIFY.START_PENDING; pub const SERVICE_NOTIFY_STOP_PENDING = SERVICE_NOTIFY.STOP_PENDING; pub const SERVICE_NOTIFY_STOPPED = SERVICE_NOTIFY.STOPPED; pub const SERVICE_RUNS_IN_PROCESS = enum(u32) { NON_SYSTEM_OR_NOT_RUNNING = 0, SYSTEM_PROCESS = 1, }; pub const SERVICE_RUNS_IN_NON_SYSTEM_OR_NOT_RUNNING = SERVICE_RUNS_IN_PROCESS.NON_SYSTEM_OR_NOT_RUNNING; pub const SERVICE_RUNS_IN_SYSTEM_PROCESS = SERVICE_RUNS_IN_PROCESS.SYSTEM_PROCESS; pub const SERVICE_TRIGGER_ACTION = enum(u32) { ART = 1, OP = 2, }; pub const SERVICE_TRIGGER_ACTION_SERVICE_START = SERVICE_TRIGGER_ACTION.ART; pub const SERVICE_TRIGGER_ACTION_SERVICE_STOP = SERVICE_TRIGGER_ACTION.OP; pub const SERVICE_TRIGGER_TYPE = enum(u32) { CUSTOM = 20, DEVICE_INTERFACE_ARRIVAL = 1, DOMAIN_JOIN = 3, FIREWALL_PORT_EVENT = 4, GROUP_POLICY = 5, IP_ADDRESS_AVAILABILITY = 2, NETWORK_ENDPOINT = 6, }; pub const SERVICE_TRIGGER_TYPE_CUSTOM = SERVICE_TRIGGER_TYPE.CUSTOM; pub const SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL = SERVICE_TRIGGER_TYPE.DEVICE_INTERFACE_ARRIVAL; pub const SERVICE_TRIGGER_TYPE_DOMAIN_JOIN = SERVICE_TRIGGER_TYPE.DOMAIN_JOIN; pub const SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT = SERVICE_TRIGGER_TYPE.FIREWALL_PORT_EVENT; pub const SERVICE_TRIGGER_TYPE_GROUP_POLICY = SERVICE_TRIGGER_TYPE.GROUP_POLICY; pub const SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY = SERVICE_TRIGGER_TYPE.IP_ADDRESS_AVAILABILITY; pub const SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT = SERVICE_TRIGGER_TYPE.NETWORK_ENDPOINT; pub const SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE = enum(u32) { BINARY = 1, STRING = 2, LEVEL = 3, KEYWORD_ANY = 4, KEYWORD_ALL = 5, }; pub const SERVICE_TRIGGER_DATA_TYPE_BINARY = SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE.BINARY; pub const SERVICE_TRIGGER_DATA_TYPE_STRING = SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE.STRING; pub const SERVICE_TRIGGER_DATA_TYPE_LEVEL = SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE.LEVEL; pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY = SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE.KEYWORD_ANY; pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL = SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE.KEYWORD_ALL; pub const SERVICE_STATUS_CURRENT_STATE = enum(u32) { CONTINUE_PENDING = 5, PAUSE_PENDING = 6, PAUSED = 7, RUNNING = 4, START_PENDING = 2, STOP_PENDING = 3, STOPPED = 1, }; pub const SERVICE_CONTINUE_PENDING = SERVICE_STATUS_CURRENT_STATE.CONTINUE_PENDING; pub const SERVICE_PAUSE_PENDING = SERVICE_STATUS_CURRENT_STATE.PAUSE_PENDING; pub const SERVICE_PAUSED = SERVICE_STATUS_CURRENT_STATE.PAUSED; pub const SERVICE_RUNNING = SERVICE_STATUS_CURRENT_STATE.RUNNING; pub const SERVICE_START_PENDING = SERVICE_STATUS_CURRENT_STATE.START_PENDING; pub const SERVICE_STOP_PENDING = SERVICE_STATUS_CURRENT_STATE.STOP_PENDING; pub const SERVICE_STOPPED = SERVICE_STATUS_CURRENT_STATE.STOPPED; pub const SERVICE_STATUS_HANDLE = isize; pub const SERVICE_TRIGGER_CUSTOM_STATE_ID = extern struct { Data: [2]u32, }; pub const SERVICE_CUSTOM_SYSTEM_STATE_CHANGE_DATA_ITEM = extern struct { u: extern union { CustomStateId: SERVICE_TRIGGER_CUSTOM_STATE_ID, s: extern struct { DataOffset: u32, Data: [1]u8, }, }, }; pub const SERVICE_DESCRIPTIONA = extern struct { lpDescription: ?PSTR, }; pub const SERVICE_DESCRIPTIONW = extern struct { lpDescription: ?PWSTR, }; pub const SC_ACTION_TYPE = enum(i32) { NONE = 0, RESTART = 1, REBOOT = 2, RUN_COMMAND = 3, OWN_RESTART = 4, }; pub const SC_ACTION_NONE = SC_ACTION_TYPE.NONE; pub const SC_ACTION_RESTART = SC_ACTION_TYPE.RESTART; pub const SC_ACTION_REBOOT = SC_ACTION_TYPE.REBOOT; pub const SC_ACTION_RUN_COMMAND = SC_ACTION_TYPE.RUN_COMMAND; pub const SC_ACTION_OWN_RESTART = SC_ACTION_TYPE.OWN_RESTART; pub const SC_ACTION = extern struct { Type: SC_ACTION_TYPE, Delay: u32, }; pub const SERVICE_FAILURE_ACTIONSA = extern struct { dwResetPeriod: u32, lpRebootMsg: ?PSTR, lpCommand: ?PSTR, cActions: u32, lpsaActions: ?*SC_ACTION, }; pub const SERVICE_FAILURE_ACTIONSW = extern struct { dwResetPeriod: u32, lpRebootMsg: ?PWSTR, lpCommand: ?PWSTR, cActions: u32, lpsaActions: ?*SC_ACTION, }; pub const SERVICE_DELAYED_AUTO_START_INFO = extern struct { fDelayedAutostart: BOOL, }; pub const SERVICE_FAILURE_ACTIONS_FLAG = extern struct { fFailureActionsOnNonCrashFailures: BOOL, }; pub const SERVICE_SID_INFO = extern struct { dwServiceSidType: u32, }; pub const SERVICE_REQUIRED_PRIVILEGES_INFOA = extern struct { pmszRequiredPrivileges: ?PSTR, }; pub const SERVICE_REQUIRED_PRIVILEGES_INFOW = extern struct { pmszRequiredPrivileges: ?PWSTR, }; pub const SERVICE_PRESHUTDOWN_INFO = extern struct { dwPreshutdownTimeout: u32, }; pub const SERVICE_TRIGGER_SPECIFIC_DATA_ITEM = extern struct { dwDataType: SERVICE_TRIGGER_SPECIFIC_DATA_ITEM_DATA_TYPE, cbData: u32, pData: ?*u8, }; pub const SERVICE_TRIGGER = extern struct { dwTriggerType: SERVICE_TRIGGER_TYPE, dwAction: SERVICE_TRIGGER_ACTION, pTriggerSubtype: ?*Guid, cDataItems: u32, pDataItems: ?*SERVICE_TRIGGER_SPECIFIC_DATA_ITEM, }; pub const SERVICE_TRIGGER_INFO = extern struct { cTriggers: u32, pTriggers: ?*SERVICE_TRIGGER, pReserved: ?*u8, }; pub const SERVICE_PREFERRED_NODE_INFO = extern struct { usPreferredNode: u16, fDelete: BOOLEAN, }; pub const SERVICE_TIMECHANGE_INFO = extern struct { liNewTime: LARGE_INTEGER, liOldTime: LARGE_INTEGER, }; pub const SERVICE_LAUNCH_PROTECTED_INFO = extern struct { dwLaunchProtected: u32, }; pub const SC_STATUS_TYPE = enum(i32) { O = 0, }; pub const SC_STATUS_PROCESS_INFO = SC_STATUS_TYPE.O; pub const SC_ENUM_TYPE = enum(i32) { O = 0, }; pub const SC_ENUM_PROCESS_INFO = SC_ENUM_TYPE.O; pub const SERVICE_STATUS = extern struct { dwServiceType: ENUM_SERVICE_TYPE, dwCurrentState: SERVICE_STATUS_CURRENT_STATE, dwControlsAccepted: u32, dwWin32ExitCode: u32, dwServiceSpecificExitCode: u32, dwCheckPoint: u32, dwWaitHint: u32, }; pub const SERVICE_STATUS_PROCESS = extern struct { dwServiceType: ENUM_SERVICE_TYPE, dwCurrentState: SERVICE_STATUS_CURRENT_STATE, dwControlsAccepted: u32, dwWin32ExitCode: u32, dwServiceSpecificExitCode: u32, dwCheckPoint: u32, dwWaitHint: u32, dwProcessId: u32, dwServiceFlags: SERVICE_RUNS_IN_PROCESS, }; pub const ENUM_SERVICE_STATUSA = extern struct { lpServiceName: ?PSTR, lpDisplayName: ?PSTR, ServiceStatus: SERVICE_STATUS, }; pub const ENUM_SERVICE_STATUSW = extern struct { lpServiceName: ?PWSTR, lpDisplayName: ?PWSTR, ServiceStatus: SERVICE_STATUS, }; pub const ENUM_SERVICE_STATUS_PROCESSA = extern struct { lpServiceName: ?PSTR, lpDisplayName: ?PSTR, ServiceStatusProcess: SERVICE_STATUS_PROCESS, }; pub const ENUM_SERVICE_STATUS_PROCESSW = extern struct { lpServiceName: ?PWSTR, lpDisplayName: ?PWSTR, ServiceStatusProcess: SERVICE_STATUS_PROCESS, }; pub const QUERY_SERVICE_LOCK_STATUSA = extern struct { fIsLocked: u32, lpLockOwner: ?PSTR, dwLockDuration: u32, }; pub const QUERY_SERVICE_LOCK_STATUSW = extern struct { fIsLocked: u32, lpLockOwner: ?PWSTR, dwLockDuration: u32, }; pub const QUERY_SERVICE_CONFIGA = extern struct { dwServiceType: ENUM_SERVICE_TYPE, dwStartType: SERVICE_START_TYPE, dwErrorControl: SERVICE_ERROR, lpBinaryPathName: ?PSTR, lpLoadOrderGroup: ?PSTR, dwTagId: u32, lpDependencies: ?PSTR, lpServiceStartName: ?PSTR, lpDisplayName: ?PSTR, }; pub const QUERY_SERVICE_CONFIGW = extern struct { dwServiceType: ENUM_SERVICE_TYPE, dwStartType: SERVICE_START_TYPE, dwErrorControl: SERVICE_ERROR, lpBinaryPathName: ?PWSTR, lpLoadOrderGroup: ?PWSTR, dwTagId: u32, lpDependencies: ?PWSTR, lpServiceStartName: ?PWSTR, lpDisplayName: ?PWSTR, }; pub const SERVICE_MAIN_FUNCTIONW = fn( dwNumServicesArgs: u32, lpServiceArgVectors: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub const SERVICE_MAIN_FUNCTIONA = fn( dwNumServicesArgs: u32, lpServiceArgVectors: ?*?*i8, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPSERVICE_MAIN_FUNCTIONW = fn( dwNumServicesArgs: u32, lpServiceArgVectors: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPSERVICE_MAIN_FUNCTIONA = fn( dwNumServicesArgs: u32, lpServiceArgVectors: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub const SERVICE_TABLE_ENTRYA = extern struct { lpServiceName: ?PSTR, lpServiceProc: ?LPSERVICE_MAIN_FUNCTIONA, }; pub const SERVICE_TABLE_ENTRYW = extern struct { lpServiceName: ?PWSTR, lpServiceProc: ?LPSERVICE_MAIN_FUNCTIONW, }; pub const HANDLER_FUNCTION = fn( dwControl: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const HANDLER_FUNCTION_EX = fn( dwControl: u32, dwEventType: u32, lpEventData: ?*anyopaque, lpContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPHANDLER_FUNCTION = fn( dwControl: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPHANDLER_FUNCTION_EX = fn( dwControl: u32, dwEventType: u32, lpEventData: ?*anyopaque, lpContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFN_SC_NOTIFY_CALLBACK = fn( pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const SERVICE_NOTIFY_1 = extern struct { dwVersion: u32, pfnNotifyCallback: ?PFN_SC_NOTIFY_CALLBACK, pContext: ?*anyopaque, dwNotificationStatus: u32, ServiceStatus: SERVICE_STATUS_PROCESS, }; pub const SERVICE_NOTIFY_2A = extern struct { dwVersion: u32, pfnNotifyCallback: ?PFN_SC_NOTIFY_CALLBACK, pContext: ?*anyopaque, dwNotificationStatus: u32, ServiceStatus: SERVICE_STATUS_PROCESS, dwNotificationTriggered: u32, pszServiceNames: ?PSTR, }; pub const SERVICE_NOTIFY_2W = extern struct { dwVersion: u32, pfnNotifyCallback: ?PFN_SC_NOTIFY_CALLBACK, pContext: ?*anyopaque, dwNotificationStatus: u32, ServiceStatus: SERVICE_STATUS_PROCESS, dwNotificationTriggered: u32, pszServiceNames: ?PWSTR, }; pub const SERVICE_CONTROL_STATUS_REASON_PARAMSA = extern struct { dwReason: u32, pszComment: ?PSTR, ServiceStatus: SERVICE_STATUS_PROCESS, }; pub const SERVICE_CONTROL_STATUS_REASON_PARAMSW = extern struct { dwReason: u32, pszComment: ?PWSTR, ServiceStatus: SERVICE_STATUS_PROCESS, }; pub const SERVICE_START_REASON = extern struct { dwReason: u32, }; pub const SC_EVENT_TYPE = enum(i32) { DATABASE_CHANGE = 0, PROPERTY_CHANGE = 1, STATUS_CHANGE = 2, }; pub const SC_EVENT_DATABASE_CHANGE = SC_EVENT_TYPE.DATABASE_CHANGE; pub const SC_EVENT_PROPERTY_CHANGE = SC_EVENT_TYPE.PROPERTY_CHANGE; pub const SC_EVENT_STATUS_CHANGE = SC_EVENT_TYPE.STATUS_CHANGE; pub const PSC_NOTIFICATION_CALLBACK = fn( dwNotify: u32, pCallbackContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const _SC_NOTIFICATION_REGISTRATION = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const SERVICE_REGISTRY_STATE_TYPE = enum(i32) { ServiceRegistryStateParameters = 0, ServiceRegistryStatePersistent = 1, MaxServiceRegistryStateType = 2, }; pub const ServiceRegistryStateParameters = SERVICE_REGISTRY_STATE_TYPE.ServiceRegistryStateParameters; pub const ServiceRegistryStatePersistent = SERVICE_REGISTRY_STATE_TYPE.ServiceRegistryStatePersistent; pub const MaxServiceRegistryStateType = SERVICE_REGISTRY_STATE_TYPE.MaxServiceRegistryStateType; pub const SERVICE_DIRECTORY_TYPE = enum(i32) { PersistentState = 0, TypeMax = 1, }; pub const ServiceDirectoryPersistentState = SERVICE_DIRECTORY_TYPE.PersistentState; pub const ServiceDirectoryTypeMax = SERVICE_DIRECTORY_TYPE.TypeMax; pub const SERVICE_SHARED_REGISTRY_STATE_TYPE = enum(i32) { e = 0, }; pub const ServiceSharedRegistryPersistentState = SERVICE_SHARED_REGISTRY_STATE_TYPE.e; pub const SERVICE_SHARED_DIRECTORY_TYPE = enum(i32) { e = 0, }; pub const ServiceSharedDirectoryPersistentState = SERVICE_SHARED_DIRECTORY_TYPE.e; //-------------------------------------------------------------------------------- // Section: Functions (56) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SetServiceBits( hServiceStatus: SERVICE_STATUS_HANDLE, dwServiceBits: u32, bSetBitsOn: BOOL, bUpdateImmediately: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn ChangeServiceConfigA( hService: SC_HANDLE, dwServiceType: u32, dwStartType: SERVICE_START_TYPE, dwErrorControl: SERVICE_ERROR, lpBinaryPathName: ?[*:0]const u8, lpLoadOrderGroup: ?[*:0]const u8, lpdwTagId: ?*u32, lpDependencies: ?[*:0]const u8, lpServiceStartName: ?[*:0]const u8, lpPassword: ?[*:0]const u8, lpDisplayName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn ChangeServiceConfigW( hService: SC_HANDLE, dwServiceType: u32, dwStartType: SERVICE_START_TYPE, dwErrorControl: SERVICE_ERROR, lpBinaryPathName: ?[*:0]const u16, lpLoadOrderGroup: ?[*:0]const u16, lpdwTagId: ?*u32, lpDependencies: ?[*:0]const u16, lpServiceStartName: ?[*:0]const u16, lpPassword: ?[*:0]const u16, lpDisplayName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn ChangeServiceConfig2A( hService: SC_HANDLE, dwInfoLevel: SERVICE_CONFIG, lpInfo: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn ChangeServiceConfig2W( hService: SC_HANDLE, dwInfoLevel: SERVICE_CONFIG, lpInfo: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn CloseServiceHandle( hSCObject: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn ControlService( hService: SC_HANDLE, dwControl: u32, lpServiceStatus: ?*SERVICE_STATUS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn CreateServiceA( hSCManager: SC_HANDLE, lpServiceName: ?[*:0]const u8, lpDisplayName: ?[*:0]const u8, dwDesiredAccess: u32, dwServiceType: ENUM_SERVICE_TYPE, dwStartType: SERVICE_START_TYPE, dwErrorControl: SERVICE_ERROR, lpBinaryPathName: ?[*:0]const u8, lpLoadOrderGroup: ?[*:0]const u8, lpdwTagId: ?*u32, lpDependencies: ?[*:0]const u8, lpServiceStartName: ?[*:0]const u8, lpPassword: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) SC_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn CreateServiceW( hSCManager: SC_HANDLE, lpServiceName: ?[*:0]const u16, lpDisplayName: ?[*:0]const u16, dwDesiredAccess: u32, dwServiceType: ENUM_SERVICE_TYPE, dwStartType: SERVICE_START_TYPE, dwErrorControl: SERVICE_ERROR, lpBinaryPathName: ?[*:0]const u16, lpLoadOrderGroup: ?[*:0]const u16, lpdwTagId: ?*u32, lpDependencies: ?[*:0]const u16, lpServiceStartName: ?[*:0]const u16, lpPassword: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) SC_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn DeleteService( hService: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn EnumDependentServicesA( hService: SC_HANDLE, dwServiceState: ENUM_SERVICE_STATE, // TODO: what to do with BytesParamIndex 3? lpServices: ?*ENUM_SERVICE_STATUSA, cbBufSize: u32, pcbBytesNeeded: ?*u32, lpServicesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn EnumDependentServicesW( hService: SC_HANDLE, dwServiceState: ENUM_SERVICE_STATE, // TODO: what to do with BytesParamIndex 3? lpServices: ?*ENUM_SERVICE_STATUSW, cbBufSize: u32, pcbBytesNeeded: ?*u32, lpServicesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn EnumServicesStatusA( hSCManager: SC_HANDLE, dwServiceType: ENUM_SERVICE_TYPE, dwServiceState: ENUM_SERVICE_STATE, // TODO: what to do with BytesParamIndex 4? lpServices: ?*ENUM_SERVICE_STATUSA, cbBufSize: u32, pcbBytesNeeded: ?*u32, lpServicesReturned: ?*u32, lpResumeHandle: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn EnumServicesStatusW( hSCManager: SC_HANDLE, dwServiceType: ENUM_SERVICE_TYPE, dwServiceState: ENUM_SERVICE_STATE, // TODO: what to do with BytesParamIndex 4? lpServices: ?*ENUM_SERVICE_STATUSW, cbBufSize: u32, pcbBytesNeeded: ?*u32, lpServicesReturned: ?*u32, lpResumeHandle: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn EnumServicesStatusExA( hSCManager: SC_HANDLE, InfoLevel: SC_ENUM_TYPE, dwServiceType: ENUM_SERVICE_TYPE, dwServiceState: ENUM_SERVICE_STATE, // TODO: what to do with BytesParamIndex 5? lpServices: ?*u8, cbBufSize: u32, pcbBytesNeeded: ?*u32, lpServicesReturned: ?*u32, lpResumeHandle: ?*u32, pszGroupName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn EnumServicesStatusExW( hSCManager: SC_HANDLE, InfoLevel: SC_ENUM_TYPE, dwServiceType: ENUM_SERVICE_TYPE, dwServiceState: ENUM_SERVICE_STATE, // TODO: what to do with BytesParamIndex 5? lpServices: ?*u8, cbBufSize: u32, pcbBytesNeeded: ?*u32, lpServicesReturned: ?*u32, lpResumeHandle: ?*u32, pszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn GetServiceKeyNameA( hSCManager: SC_HANDLE, lpDisplayName: ?[*:0]const u8, lpServiceName: ?[*:0]u8, lpcchBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn GetServiceKeyNameW( hSCManager: SC_HANDLE, lpDisplayName: ?[*:0]const u16, lpServiceName: ?[*:0]u16, lpcchBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn GetServiceDisplayNameA( hSCManager: SC_HANDLE, lpServiceName: ?[*:0]const u8, lpDisplayName: ?[*:0]u8, lpcchBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn GetServiceDisplayNameW( hSCManager: SC_HANDLE, lpServiceName: ?[*:0]const u16, lpDisplayName: ?[*:0]u16, lpcchBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn LockServiceDatabase( hSCManager: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn NotifyBootConfigStatus( BootAcceptable: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn OpenSCManagerA( lpMachineName: ?[*:0]const u8, lpDatabaseName: ?[*:0]const u8, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) SC_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn OpenSCManagerW( lpMachineName: ?[*:0]const u16, lpDatabaseName: ?[*:0]const u16, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) SC_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn OpenServiceA( hSCManager: SC_HANDLE, lpServiceName: ?[*:0]const u8, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) SC_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn OpenServiceW( hSCManager: SC_HANDLE, lpServiceName: ?[*:0]const u16, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) SC_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceConfigA( hService: SC_HANDLE, // TODO: what to do with BytesParamIndex 2? lpServiceConfig: ?*QUERY_SERVICE_CONFIGA, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceConfigW( hService: SC_HANDLE, // TODO: what to do with BytesParamIndex 2? lpServiceConfig: ?*QUERY_SERVICE_CONFIGW, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceConfig2A( hService: SC_HANDLE, dwInfoLevel: SERVICE_CONFIG, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*u8, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceConfig2W( hService: SC_HANDLE, dwInfoLevel: SERVICE_CONFIG, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*u8, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceLockStatusA( hSCManager: SC_HANDLE, // TODO: what to do with BytesParamIndex 2? lpLockStatus: ?*QUERY_SERVICE_LOCK_STATUSA, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceLockStatusW( hSCManager: SC_HANDLE, // TODO: what to do with BytesParamIndex 2? lpLockStatus: ?*QUERY_SERVICE_LOCK_STATUSW, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceObjectSecurity( hService: SC_HANDLE, dwSecurityInformation: u32, // TODO: what to do with BytesParamIndex 3? lpSecurityDescriptor: ?*SECURITY_DESCRIPTOR, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceStatus( hService: SC_HANDLE, lpServiceStatus: ?*SERVICE_STATUS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn QueryServiceStatusEx( hService: SC_HANDLE, InfoLevel: SC_STATUS_TYPE, // TODO: what to do with BytesParamIndex 3? lpBuffer: ?*u8, cbBufSize: u32, pcbBytesNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegisterServiceCtrlHandlerA( lpServiceName: ?[*:0]const u8, lpHandlerProc: ?LPHANDLER_FUNCTION, ) callconv(@import("std").os.windows.WINAPI) SERVICE_STATUS_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegisterServiceCtrlHandlerW( lpServiceName: ?[*:0]const u16, lpHandlerProc: ?LPHANDLER_FUNCTION, ) callconv(@import("std").os.windows.WINAPI) SERVICE_STATUS_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegisterServiceCtrlHandlerExA( lpServiceName: ?[*:0]const u8, lpHandlerProc: ?LPHANDLER_FUNCTION_EX, lpContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) SERVICE_STATUS_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn RegisterServiceCtrlHandlerExW( lpServiceName: ?[*:0]const u16, lpHandlerProc: ?LPHANDLER_FUNCTION_EX, lpContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) SERVICE_STATUS_HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SetServiceObjectSecurity( hService: SC_HANDLE, dwSecurityInformation: OBJECT_SECURITY_INFORMATION, lpSecurityDescriptor: ?*SECURITY_DESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SetServiceStatus( hServiceStatus: SERVICE_STATUS_HANDLE, lpServiceStatus: ?*SERVICE_STATUS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn StartServiceCtrlDispatcherA( lpServiceStartTable: ?*const SERVICE_TABLE_ENTRYA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn StartServiceCtrlDispatcherW( lpServiceStartTable: ?*const SERVICE_TABLE_ENTRYW, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn StartServiceA( hService: SC_HANDLE, dwNumServiceArgs: u32, lpServiceArgVectors: ?[*]?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn StartServiceW( hService: SC_HANDLE, dwNumServiceArgs: u32, lpServiceArgVectors: ?[*]?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn UnlockServiceDatabase( ScLock: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn NotifyServiceStatusChangeA( hService: SC_HANDLE, dwNotifyMask: SERVICE_NOTIFY, pNotifyBuffer: ?*SERVICE_NOTIFY_2A, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn NotifyServiceStatusChangeW( hService: SC_HANDLE, dwNotifyMask: SERVICE_NOTIFY, pNotifyBuffer: ?*SERVICE_NOTIFY_2W, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn ControlServiceExA( hService: SC_HANDLE, dwControl: u32, dwInfoLevel: u32, pControlParams: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ADVAPI32" fn ControlServiceExW( hService: SC_HANDLE, dwControl: u32, dwInfoLevel: u32, pControlParams: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "ADVAPI32" fn QueryServiceDynamicInformation( hServiceStatus: SERVICE_STATUS_HANDLE, dwInfoLevel: u32, ppDynamicInfo: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "ADVAPI32" fn WaitServiceState( hService: SC_HANDLE, dwNotify: u32, dwTimeout: u32, hCancelEvent: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.19041' pub extern "api-ms-win-service-core-l1-1-3" fn GetServiceRegistryStateKey( ServiceStatusHandle: SERVICE_STATUS_HANDLE, StateType: SERVICE_REGISTRY_STATE_TYPE, AccessMask: u32, ServiceStateKey: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.19041' pub extern "api-ms-win-service-core-l1-1-4" fn GetServiceDirectory( hServiceStatus: SERVICE_STATUS_HANDLE, eDirectoryType: SERVICE_DIRECTORY_TYPE, lpPathBuffer: ?[*]u16, cchPathBufferLength: u32, lpcchRequiredBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "api-ms-win-service-core-l1-1-5" fn GetSharedServiceRegistryStateKey( ServiceHandle: SC_HANDLE, StateType: SERVICE_SHARED_REGISTRY_STATE_TYPE, AccessMask: u32, ServiceStateKey: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "api-ms-win-service-core-l1-1-5" fn GetSharedServiceDirectory( ServiceHandle: SC_HANDLE, DirectoryType: SERVICE_SHARED_DIRECTORY_TYPE, PathBuffer: ?[*]u16, PathBufferLength: u32, RequiredBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (31) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const SERVICE_DESCRIPTION = thismodule.SERVICE_DESCRIPTIONA; pub const SERVICE_FAILURE_ACTIONS = thismodule.SERVICE_FAILURE_ACTIONSA; pub const SERVICE_REQUIRED_PRIVILEGES_INFO = thismodule.SERVICE_REQUIRED_PRIVILEGES_INFOA; pub const ENUM_SERVICE_STATUS = thismodule.ENUM_SERVICE_STATUSA; pub const ENUM_SERVICE_STATUS_PROCESS = thismodule.ENUM_SERVICE_STATUS_PROCESSA; pub const QUERY_SERVICE_LOCK_STATUS = thismodule.QUERY_SERVICE_LOCK_STATUSA; pub const QUERY_SERVICE_CONFIG = thismodule.QUERY_SERVICE_CONFIGA; pub const SERVICE_MAIN_FUNCTION = thismodule.SERVICE_MAIN_FUNCTIONA; pub const LPSERVICE_MAIN_FUNCTION = thismodule.LPSERVICE_MAIN_FUNCTIONA; pub const SERVICE_TABLE_ENTRY = thismodule.SERVICE_TABLE_ENTRYA; pub const SERVICE_NOTIFY_2 = thismodule.SERVICE_NOTIFY_2A; pub const SERVICE_CONTROL_STATUS_REASON_PARAMS = thismodule.SERVICE_CONTROL_STATUS_REASON_PARAMSA; pub const ChangeServiceConfig = thismodule.ChangeServiceConfigA; pub const ChangeServiceConfig2 = thismodule.ChangeServiceConfig2A; pub const CreateService = thismodule.CreateServiceA; pub const EnumDependentServices = thismodule.EnumDependentServicesA; pub const EnumServicesStatus = thismodule.EnumServicesStatusA; pub const EnumServicesStatusEx = thismodule.EnumServicesStatusExA; pub const GetServiceKeyName = thismodule.GetServiceKeyNameA; pub const GetServiceDisplayName = thismodule.GetServiceDisplayNameA; pub const OpenSCManager = thismodule.OpenSCManagerA; pub const OpenService = thismodule.OpenServiceA; pub const QueryServiceConfig = thismodule.QueryServiceConfigA; pub const QueryServiceConfig2 = thismodule.QueryServiceConfig2A; pub const QueryServiceLockStatus = thismodule.QueryServiceLockStatusA; pub const RegisterServiceCtrlHandler = thismodule.RegisterServiceCtrlHandlerA; pub const RegisterServiceCtrlHandlerEx = thismodule.RegisterServiceCtrlHandlerExA; pub const StartServiceCtrlDispatcher = thismodule.StartServiceCtrlDispatcherA; pub const StartService = thismodule.StartServiceA; pub const NotifyServiceStatusChange = thismodule.NotifyServiceStatusChangeA; pub const ControlServiceEx = thismodule.ControlServiceExA; }, .wide => struct { pub const SERVICE_DESCRIPTION = thismodule.SERVICE_DESCRIPTIONW; pub const SERVICE_FAILURE_ACTIONS = thismodule.SERVICE_FAILURE_ACTIONSW; pub const SERVICE_REQUIRED_PRIVILEGES_INFO = thismodule.SERVICE_REQUIRED_PRIVILEGES_INFOW; pub const ENUM_SERVICE_STATUS = thismodule.ENUM_SERVICE_STATUSW; pub const ENUM_SERVICE_STATUS_PROCESS = thismodule.ENUM_SERVICE_STATUS_PROCESSW; pub const QUERY_SERVICE_LOCK_STATUS = thismodule.QUERY_SERVICE_LOCK_STATUSW; pub const QUERY_SERVICE_CONFIG = thismodule.QUERY_SERVICE_CONFIGW; pub const SERVICE_MAIN_FUNCTION = thismodule.SERVICE_MAIN_FUNCTIONW; pub const LPSERVICE_MAIN_FUNCTION = thismodule.LPSERVICE_MAIN_FUNCTIONW; pub const SERVICE_TABLE_ENTRY = thismodule.SERVICE_TABLE_ENTRYW; pub const SERVICE_NOTIFY_2 = thismodule.SERVICE_NOTIFY_2W; pub const SERVICE_CONTROL_STATUS_REASON_PARAMS = thismodule.SERVICE_CONTROL_STATUS_REASON_PARAMSW; pub const ChangeServiceConfig = thismodule.ChangeServiceConfigW; pub const ChangeServiceConfig2 = thismodule.ChangeServiceConfig2W; pub const CreateService = thismodule.CreateServiceW; pub const EnumDependentServices = thismodule.EnumDependentServicesW; pub const EnumServicesStatus = thismodule.EnumServicesStatusW; pub const EnumServicesStatusEx = thismodule.EnumServicesStatusExW; pub const GetServiceKeyName = thismodule.GetServiceKeyNameW; pub const GetServiceDisplayName = thismodule.GetServiceDisplayNameW; pub const OpenSCManager = thismodule.OpenSCManagerW; pub const OpenService = thismodule.OpenServiceW; pub const QueryServiceConfig = thismodule.QueryServiceConfigW; pub const QueryServiceConfig2 = thismodule.QueryServiceConfig2W; pub const QueryServiceLockStatus = thismodule.QueryServiceLockStatusW; pub const RegisterServiceCtrlHandler = thismodule.RegisterServiceCtrlHandlerW; pub const RegisterServiceCtrlHandlerEx = thismodule.RegisterServiceCtrlHandlerExW; pub const StartServiceCtrlDispatcher = thismodule.StartServiceCtrlDispatcherW; pub const StartService = thismodule.StartServiceW; pub const NotifyServiceStatusChange = thismodule.NotifyServiceStatusChangeW; pub const ControlServiceEx = thismodule.ControlServiceExW; }, .unspecified => if (@import("builtin").is_test) struct { pub const SERVICE_DESCRIPTION = *opaque{}; pub const SERVICE_FAILURE_ACTIONS = *opaque{}; pub const SERVICE_REQUIRED_PRIVILEGES_INFO = *opaque{}; pub const ENUM_SERVICE_STATUS = *opaque{}; pub const ENUM_SERVICE_STATUS_PROCESS = *opaque{}; pub const QUERY_SERVICE_LOCK_STATUS = *opaque{}; pub const QUERY_SERVICE_CONFIG = *opaque{}; pub const SERVICE_MAIN_FUNCTION = *opaque{}; pub const LPSERVICE_MAIN_FUNCTION = *opaque{}; pub const SERVICE_TABLE_ENTRY = *opaque{}; pub const SERVICE_NOTIFY_2 = *opaque{}; pub const SERVICE_CONTROL_STATUS_REASON_PARAMS = *opaque{}; pub const ChangeServiceConfig = *opaque{}; pub const ChangeServiceConfig2 = *opaque{}; pub const CreateService = *opaque{}; pub const EnumDependentServices = *opaque{}; pub const EnumServicesStatus = *opaque{}; pub const EnumServicesStatusEx = *opaque{}; pub const GetServiceKeyName = *opaque{}; pub const GetServiceDisplayName = *opaque{}; pub const OpenSCManager = *opaque{}; pub const OpenService = *opaque{}; pub const QueryServiceConfig = *opaque{}; pub const QueryServiceConfig2 = *opaque{}; pub const QueryServiceLockStatus = *opaque{}; pub const RegisterServiceCtrlHandler = *opaque{}; pub const RegisterServiceCtrlHandlerEx = *opaque{}; pub const StartServiceCtrlDispatcher = *opaque{}; pub const StartService = *opaque{}; pub const NotifyServiceStatusChange = *opaque{}; pub const ControlServiceEx = *opaque{}; } else struct { pub const SERVICE_DESCRIPTION = @compileError("'SERVICE_DESCRIPTION' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_FAILURE_ACTIONS = @compileError("'SERVICE_FAILURE_ACTIONS' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_REQUIRED_PRIVILEGES_INFO = @compileError("'SERVICE_REQUIRED_PRIVILEGES_INFO' requires that UNICODE be set to true or false in the root module"); pub const ENUM_SERVICE_STATUS = @compileError("'ENUM_SERVICE_STATUS' requires that UNICODE be set to true or false in the root module"); pub const ENUM_SERVICE_STATUS_PROCESS = @compileError("'ENUM_SERVICE_STATUS_PROCESS' requires that UNICODE be set to true or false in the root module"); pub const QUERY_SERVICE_LOCK_STATUS = @compileError("'QUERY_SERVICE_LOCK_STATUS' requires that UNICODE be set to true or false in the root module"); pub const QUERY_SERVICE_CONFIG = @compileError("'QUERY_SERVICE_CONFIG' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_MAIN_FUNCTION = @compileError("'SERVICE_MAIN_FUNCTION' requires that UNICODE be set to true or false in the root module"); pub const LPSERVICE_MAIN_FUNCTION = @compileError("'LPSERVICE_MAIN_FUNCTION' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_TABLE_ENTRY = @compileError("'SERVICE_TABLE_ENTRY' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_NOTIFY_2 = @compileError("'SERVICE_NOTIFY_2' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_CONTROL_STATUS_REASON_PARAMS = @compileError("'SERVICE_CONTROL_STATUS_REASON_PARAMS' requires that UNICODE be set to true or false in the root module"); pub const ChangeServiceConfig = @compileError("'ChangeServiceConfig' requires that UNICODE be set to true or false in the root module"); pub const ChangeServiceConfig2 = @compileError("'ChangeServiceConfig2' requires that UNICODE be set to true or false in the root module"); pub const CreateService = @compileError("'CreateService' requires that UNICODE be set to true or false in the root module"); pub const EnumDependentServices = @compileError("'EnumDependentServices' requires that UNICODE be set to true or false in the root module"); pub const EnumServicesStatus = @compileError("'EnumServicesStatus' requires that UNICODE be set to true or false in the root module"); pub const EnumServicesStatusEx = @compileError("'EnumServicesStatusEx' requires that UNICODE be set to true or false in the root module"); pub const GetServiceKeyName = @compileError("'GetServiceKeyName' requires that UNICODE be set to true or false in the root module"); pub const GetServiceDisplayName = @compileError("'GetServiceDisplayName' requires that UNICODE be set to true or false in the root module"); pub const OpenSCManager = @compileError("'OpenSCManager' requires that UNICODE be set to true or false in the root module"); pub const OpenService = @compileError("'OpenService' requires that UNICODE be set to true or false in the root module"); pub const QueryServiceConfig = @compileError("'QueryServiceConfig' requires that UNICODE be set to true or false in the root module"); pub const QueryServiceConfig2 = @compileError("'QueryServiceConfig2' requires that UNICODE be set to true or false in the root module"); pub const QueryServiceLockStatus = @compileError("'QueryServiceLockStatus' requires that UNICODE be set to true or false in the root module"); pub const RegisterServiceCtrlHandler = @compileError("'RegisterServiceCtrlHandler' requires that UNICODE be set to true or false in the root module"); pub const RegisterServiceCtrlHandlerEx = @compileError("'RegisterServiceCtrlHandlerEx' requires that UNICODE be set to true or false in the root module"); pub const StartServiceCtrlDispatcher = @compileError("'StartServiceCtrlDispatcher' requires that UNICODE be set to true or false in the root module"); pub const StartService = @compileError("'StartService' requires that UNICODE be set to true or false in the root module"); pub const NotifyServiceStatusChange = @compileError("'NotifyServiceStatusChange' requires that UNICODE be set to true or false in the root module"); pub const ControlServiceEx = @compileError("'ControlServiceEx' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (11) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const HANDLE = @import("../foundation.zig").HANDLE; const HKEY = @import("../system/registry.zig").HKEY; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const OBJECT_SECURITY_INFORMATION = @import("../security.zig").OBJECT_SECURITY_INFORMATION; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SC_HANDLE = @import("../security.zig").SC_HANDLE; const SECURITY_DESCRIPTOR = @import("../security.zig").SECURITY_DESCRIPTOR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "SERVICE_MAIN_FUNCTIONW")) { _ = SERVICE_MAIN_FUNCTIONW; } if (@hasDecl(@This(), "SERVICE_MAIN_FUNCTIONA")) { _ = SERVICE_MAIN_FUNCTIONA; } if (@hasDecl(@This(), "LPSERVICE_MAIN_FUNCTIONW")) { _ = LPSERVICE_MAIN_FUNCTIONW; } if (@hasDecl(@This(), "LPSERVICE_MAIN_FUNCTIONA")) { _ = LPSERVICE_MAIN_FUNCTIONA; } if (@hasDecl(@This(), "HANDLER_FUNCTION")) { _ = HANDLER_FUNCTION; } if (@hasDecl(@This(), "HANDLER_FUNCTION_EX")) { _ = HANDLER_FUNCTION_EX; } if (@hasDecl(@This(), "LPHANDLER_FUNCTION")) { _ = LPHANDLER_FUNCTION; } if (@hasDecl(@This(), "LPHANDLER_FUNCTION_EX")) { _ = LPHANDLER_FUNCTION_EX; } if (@hasDecl(@This(), "PFN_SC_NOTIFY_CALLBACK")) { _ = PFN_SC_NOTIFY_CALLBACK; } if (@hasDecl(@This(), "PSC_NOTIFICATION_CALLBACK")) { _ = PSC_NOTIFICATION_CALLBACK; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/services.zig
const std = @import("std"); //-------------------------------------------------------------------------------------------------- pub fn part1() anyerror!void { const file = std.fs.cwd().openFile("data/day02_input.txt", .{}) catch |err| label: { std.debug.print("unable to open file: {e}\n", .{err}); const stderr = std.io.getStdErr(); break :label stderr; }; defer file.close(); const file_size = try file.getEndPos(); std.log.info("File size {}", .{file_size}); var reader = std.io.bufferedReader(file.reader()); var istream = reader.reader(); var buf: [32]u8 = undefined; var x: u32 = 0; var y: u32 = 0; while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| { //std.log.info("{s}", .{line}); var it = std.mem.split(u8, line, " "); const command = it.next() orelse "none"; const raw_value = it.next() orelse "0"; const value = try std.fmt.parseInt(u32, raw_value, 10); //std.log.info("Command={s}, Value={d}", .{ command, value }); if (std.mem.eql(u8, command, "forward")) { x += value; } else if (std.mem.eql(u8, command, "down")) { y += value; } else if (std.mem.eql(u8, command, "up")) { y -= value; } } std.log.info("Part 1 x={d}, y={d}, answer={d}", .{ x, y, x * y }); } //-------------------------------------------------------------------------------------------------- pub fn part2() anyerror!void { const file = std.fs.cwd().openFile("data/day02_input.txt", .{}) catch |err| label: { std.debug.print("unable to open file: {e}\n", .{err}); const stderr = std.io.getStdErr(); break :label stderr; }; defer file.close(); //const file_size = try file.getEndPos(); //std.log.info("File size {}", .{file_size}); var reader = std.io.bufferedReader(file.reader()); var istream = reader.reader(); var buf: [32]u8 = undefined; var x: i32 = 0; var y: i32 = 0; var aim: i32 = 0; while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| { //std.log.info("{s}", .{line}); var it = std.mem.split(u8, line, " "); const command = it.next() orelse "none"; const raw_value = it.next() orelse "0"; const value = try std.fmt.parseInt(i32, raw_value, 10); //std.log.info("Command={s}, Value={d}", .{ command, value }); if (std.mem.eql(u8, command, "forward")) { x += value; y += aim * value; } else if (std.mem.eql(u8, command, "down")) { aim += value; } else if (std.mem.eql(u8, command, "up")) { aim -= value; } } std.log.info("Part 2 x={d}, y={d}, answer={d}", .{ x, y, x * y }); } //-------------------------------------------------------------------------------------------------- pub fn main() anyerror!void { try part1(); try part2(); } //--------------------------------------------------------------------------------------------------
src/day02.zig
const std = @import("std"); const os = std.os; const wl = @import("wayland").server.wl; const wlr = @import("wlroots"); const xkb = @import("xkbcommon"); const gpa = std.heap.c_allocator; pub fn main() anyerror!void { wlr.log.init(.debug); var server: Server = undefined; try server.init(); defer server.deinit(); var buf: [11]u8 = undefined; const socket = try server.wl_server.addSocketAuto(&buf); if (os.argv.len >= 2) { const cmd = std.mem.span(os.argv[1]); var child = try std.ChildProcess.init(&[_][]const u8{ "/bin/sh", "-c", cmd }, gpa); defer child.deinit(); var env_map = try std.process.getEnvMap(gpa); defer env_map.deinit(); try env_map.put("WAYLAND_DISPLAY", socket); child.env_map = &env_map; try child.spawn(); } try server.backend.start(); std.log.info("Running compositor on WAYLAND_DISPLAY={s}", .{socket}); server.wl_server.run(); } const Server = struct { wl_server: *wl.Server, backend: *wlr.Backend, renderer: *wlr.Renderer, allocator: *wlr.Allocator, scene: *wlr.Scene, output_layout: *wlr.OutputLayout, new_output: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(newOutput), xdg_shell: *wlr.XdgShell, new_xdg_surface: wl.Listener(*wlr.XdgSurface) = wl.Listener(*wlr.XdgSurface).init(newXdgSurface), views: wl.list.Head(View, "link") = undefined, seat: *wlr.Seat, new_input: wl.Listener(*wlr.InputDevice) = wl.Listener(*wlr.InputDevice).init(newInput), request_set_cursor: wl.Listener(*wlr.Seat.event.RequestSetCursor) = wl.Listener(*wlr.Seat.event.RequestSetCursor).init(requestSetCursor), request_set_selection: wl.Listener(*wlr.Seat.event.RequestSetSelection) = wl.Listener(*wlr.Seat.event.RequestSetSelection).init(requestSetSelection), keyboards: wl.list.Head(Keyboard, "link") = undefined, cursor: *wlr.Cursor, cursor_mgr: *wlr.XcursorManager, cursor_motion: wl.Listener(*wlr.Pointer.event.Motion) = wl.Listener(*wlr.Pointer.event.Motion).init(cursorMotion), cursor_motion_absolute: wl.Listener(*wlr.Pointer.event.MotionAbsolute) = wl.Listener(*wlr.Pointer.event.MotionAbsolute).init(cursorMotionAbsolute), cursor_button: wl.Listener(*wlr.Pointer.event.Button) = wl.Listener(*wlr.Pointer.event.Button).init(cursorButton), cursor_axis: wl.Listener(*wlr.Pointer.event.Axis) = wl.Listener(*wlr.Pointer.event.Axis).init(cursorAxis), cursor_frame: wl.Listener(*wlr.Cursor) = wl.Listener(*wlr.Cursor).init(cursorFrame), cursor_mode: enum { passthrough, move, resize } = .passthrough, grabbed_view: ?*View = null, grab_x: f64 = 0, grab_y: f64 = 0, grab_box: wlr.Box = undefined, resize_edges: wlr.Edges = .{}, fn init(server: *Server) !void { const wl_server = try wl.Server.create(); const backend = try wlr.Backend.autocreate(wl_server); const renderer = try wlr.Renderer.autocreate(backend); server.* = .{ .wl_server = wl_server, .backend = backend, .renderer = renderer, .allocator = try wlr.Allocator.autocreate(backend, renderer), .scene = try wlr.Scene.create(), .output_layout = try wlr.OutputLayout.create(), .xdg_shell = try wlr.XdgShell.create(wl_server), .seat = try wlr.Seat.create(wl_server, "default"), .cursor = try wlr.Cursor.create(), .cursor_mgr = try wlr.XcursorManager.create(null, 24), }; try server.renderer.initServer(wl_server); try server.scene.attachOutputLayout(server.output_layout); _ = try wlr.Compositor.create(server.wl_server, server.renderer); _ = try wlr.DataDeviceManager.create(server.wl_server); server.backend.events.new_output.add(&server.new_output); server.xdg_shell.events.new_surface.add(&server.new_xdg_surface); server.views.init(); server.backend.events.new_input.add(&server.new_input); server.seat.events.request_set_cursor.add(&server.request_set_cursor); server.seat.events.request_set_selection.add(&server.request_set_selection); server.keyboards.init(); server.cursor.attachOutputLayout(server.output_layout); try server.cursor_mgr.load(1); server.cursor.events.motion.add(&server.cursor_motion); server.cursor.events.motion_absolute.add(&server.cursor_motion_absolute); server.cursor.events.button.add(&server.cursor_button); server.cursor.events.axis.add(&server.cursor_axis); server.cursor.events.frame.add(&server.cursor_frame); } fn deinit(server: *Server) void { server.wl_server.destroyClients(); server.wl_server.destroy(); } fn newOutput(listener: *wl.Listener(*wlr.Output), wlr_output: *wlr.Output) void { const server = @fieldParentPtr(Server, "new_output", listener); if (!wlr_output.initRender(server.allocator, server.renderer)) return; if (wlr_output.preferredMode()) |mode| { wlr_output.setMode(mode); wlr_output.enable(true); wlr_output.commit() catch return; } const output = gpa.create(Output) catch { std.log.err("failed to allocate new output", .{}); return; }; output.* = .{ .server = server, .wlr_output = wlr_output, }; wlr_output.events.frame.add(&output.frame); server.output_layout.addAuto(wlr_output); } fn newXdgSurface(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wlr.XdgSurface) void { const server = @fieldParentPtr(Server, "new_xdg_surface", listener); switch (xdg_surface.role) { .toplevel => { // Don't add the view to server.views until it is mapped const view = gpa.create(View) catch { std.log.err("failed to allocate new view", .{}); return; }; view.* = .{ .server = server, .xdg_surface = xdg_surface, .scene_node = server.scene.node.createSceneXdgSurface(xdg_surface) catch { gpa.destroy(view); std.log.err("failed to allocate new view", .{}); return; }, }; view.scene_node.data = @ptrToInt(view); xdg_surface.data = @ptrToInt(view.scene_node); xdg_surface.events.map.add(&view.map); xdg_surface.events.unmap.add(&view.unmap); xdg_surface.events.destroy.add(&view.destroy); xdg_surface.role_data.toplevel.events.request_move.add(&view.request_move); xdg_surface.role_data.toplevel.events.request_resize.add(&view.request_resize); }, .popup => { // These asserts are fine since tinywl.zig doesn't support anything else that can // make xdg popups (e.g. layer shell). const parent = wlr.XdgSurface.fromWlrSurface(xdg_surface.role_data.popup.parent.?); const parent_node = @intToPtr(?*wlr.SceneNode, parent.data) orelse { // The xdg surface user data could be left null due to allocation failure. return; }; const scene_node = parent_node.createSceneXdgSurface(xdg_surface) catch { std.log.err("failed to allocate xdg popup node", .{}); return; }; xdg_surface.data = @ptrToInt(scene_node); }, .none => unreachable, } } const ViewAtResult = struct { view: *View, surface: *wlr.Surface, sx: f64, sy: f64, }; fn viewAt(server: *Server, lx: f64, ly: f64) ?ViewAtResult { var sx: f64 = undefined; var sy: f64 = undefined; if (server.scene.node.at(lx, ly, &sx, &sy)) |node| { if (node.type != .surface) return null; const surface = wlr.SceneSurface.fromNode(node).surface; var it: ?*wlr.SceneNode = node; while (it) |n| : (it = n.parent) { if (@intToPtr(?*View, n.data)) |view| { return ViewAtResult{ .view = view, .surface = surface, .sx = sx, .sy = sy, }; } } } return null; } fn focusView(server: *Server, view: *View, surface: *wlr.Surface) void { if (server.seat.keyboard_state.focused_surface) |previous_surface| { if (previous_surface == surface) return; if (previous_surface.isXdgSurface()) { const xdg_surface = wlr.XdgSurface.fromWlrSurface(previous_surface); _ = xdg_surface.role_data.toplevel.setActivated(false); } } view.scene_node.raiseToTop(); view.link.remove(); server.views.prepend(view); _ = view.xdg_surface.role_data.toplevel.setActivated(true); const wlr_keyboard = server.seat.getKeyboard() orelse return; server.seat.keyboardNotifyEnter( surface, &wlr_keyboard.keycodes, wlr_keyboard.num_keycodes, &wlr_keyboard.modifiers, ); } fn newInput(listener: *wl.Listener(*wlr.InputDevice), device: *wlr.InputDevice) void { const server = @fieldParentPtr(Server, "new_input", listener); switch (device.type) { .keyboard => Keyboard.create(server, device) catch |err| { std.log.err("failed to create keyboard: {}", .{err}); return; }, .pointer => server.cursor.attachInputDevice(device), else => {}, } server.seat.setCapabilities(.{ .pointer = true, .keyboard = server.keyboards.length() > 0, }); } fn requestSetCursor( listener: *wl.Listener(*wlr.Seat.event.RequestSetCursor), event: *wlr.Seat.event.RequestSetCursor, ) void { const server = @fieldParentPtr(Server, "request_set_cursor", listener); if (event.seat_client == server.seat.pointer_state.focused_client) server.cursor.setSurface(event.surface, event.hotspot_x, event.hotspot_y); } fn requestSetSelection( listener: *wl.Listener(*wlr.Seat.event.RequestSetSelection), event: *wlr.Seat.event.RequestSetSelection, ) void { const server = @fieldParentPtr(Server, "request_set_selection", listener); server.seat.setSelection(event.source, event.serial); } fn cursorMotion( listener: *wl.Listener(*wlr.Pointer.event.Motion), event: *wlr.Pointer.event.Motion, ) void { const server = @fieldParentPtr(Server, "cursor_motion", listener); server.cursor.move(event.device, event.delta_x, event.delta_y); server.processCursorMotion(event.time_msec); } fn cursorMotionAbsolute( listener: *wl.Listener(*wlr.Pointer.event.MotionAbsolute), event: *wlr.Pointer.event.MotionAbsolute, ) void { const server = @fieldParentPtr(Server, "cursor_motion_absolute", listener); server.cursor.warpAbsolute(event.device, event.x, event.y); server.processCursorMotion(event.time_msec); } fn processCursorMotion(server: *Server, time_msec: u32) void { switch (server.cursor_mode) { .passthrough => if (server.viewAt(server.cursor.x, server.cursor.y)) |res| { server.seat.pointerNotifyEnter(res.surface, res.sx, res.sy); server.seat.pointerNotifyMotion(time_msec, res.sx, res.sy); } else { server.cursor_mgr.setCursorImage("left_ptr", server.cursor); server.seat.pointerClearFocus(); }, .move => { const view = server.grabbed_view.?; view.x = @floatToInt(i32, server.cursor.x - server.grab_x); view.y = @floatToInt(i32, server.cursor.y - server.grab_y); view.scene_node.setPosition(view.x, view.y); }, .resize => { const view = server.grabbed_view.?; const border_x = @floatToInt(i32, server.cursor.x - server.grab_x); const border_y = @floatToInt(i32, server.cursor.y - server.grab_y); var new_left = server.grab_box.x; var new_right = server.grab_box.x + server.grab_box.width; var new_top = server.grab_box.y; var new_bottom = server.grab_box.y + server.grab_box.height; if (server.resize_edges.top) { new_top = border_y; if (new_top >= new_bottom) new_top = new_bottom - 1; } else if (server.resize_edges.bottom) { new_bottom = border_y; if (new_bottom <= new_top) new_bottom = new_top + 1; } if (server.resize_edges.left) { new_left = border_x; if (new_left >= new_right) new_left = new_right - 1; } else if (server.resize_edges.right) { new_right = border_x; if (new_right <= new_left) new_right = new_left + 1; } var geo_box: wlr.Box = undefined; view.xdg_surface.getGeometry(&geo_box); view.x = new_left - geo_box.x; view.y = new_top - geo_box.y; view.scene_node.setPosition(view.x, view.y); const new_width = @intCast(u32, new_right - new_left); const new_height = @intCast(u32, new_bottom - new_top); _ = view.xdg_surface.role_data.toplevel.setSize(new_width, new_height); }, } } fn cursorButton( listener: *wl.Listener(*wlr.Pointer.event.Button), event: *wlr.Pointer.event.Button, ) void { const server = @fieldParentPtr(Server, "cursor_button", listener); _ = server.seat.pointerNotifyButton(event.time_msec, event.button, event.state); if (event.state == .released) { server.cursor_mode = .passthrough; } else if (server.viewAt(server.cursor.x, server.cursor.y)) |res| { server.focusView(res.view, res.surface); } } fn cursorAxis( listener: *wl.Listener(*wlr.Pointer.event.Axis), event: *wlr.Pointer.event.Axis, ) void { const server = @fieldParentPtr(Server, "cursor_axis", listener); server.seat.pointerNotifyAxis( event.time_msec, event.orientation, event.delta, event.delta_discrete, event.source, ); } fn cursorFrame(listener: *wl.Listener(*wlr.Cursor), _: *wlr.Cursor) void { const server = @fieldParentPtr(Server, "cursor_frame", listener); server.seat.pointerNotifyFrame(); } /// Assumes the modifier used for compositor keybinds is pressed /// Returns true if the key was handled fn handleKeybind(server: *Server, key: xkb.Keysym) bool { switch (@enumToInt(key)) { // Exit the compositor xkb.Keysym.Escape => server.wl_server.terminate(), // Focus the next view in the stack, pushing the current top to the back xkb.Keysym.F1 => { if (server.views.length() < 2) return true; const view = @fieldParentPtr(View, "link", server.views.link.prev.?); server.focusView(view, view.xdg_surface.surface); }, else => return false, } return true; } }; const Output = struct { server: *Server, wlr_output: *wlr.Output, frame: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(frame), fn frame(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void { const output = @fieldParentPtr(Output, "frame", listener); const scene_output = output.server.scene.getSceneOutput(output.wlr_output).?; _ = scene_output.commit(); var now: os.timespec = undefined; os.clock_gettime(os.CLOCK.MONOTONIC, &now) catch @panic("CLOCK_MONOTONIC not supported"); scene_output.sendFrameDone(&now); } }; const View = struct { server: *Server, link: wl.list.Link = undefined, xdg_surface: *wlr.XdgSurface, scene_node: *wlr.SceneNode, x: i32 = 0, y: i32 = 0, map: wl.Listener(*wlr.XdgSurface) = wl.Listener(*wlr.XdgSurface).init(map), unmap: wl.Listener(*wlr.XdgSurface) = wl.Listener(*wlr.XdgSurface).init(unmap), destroy: wl.Listener(*wlr.XdgSurface) = wl.Listener(*wlr.XdgSurface).init(destroy), request_move: wl.Listener(*wlr.XdgToplevel.event.Move) = wl.Listener(*wlr.XdgToplevel.event.Move).init(requestMove), request_resize: wl.Listener(*wlr.XdgToplevel.event.Resize) = wl.Listener(*wlr.XdgToplevel.event.Resize).init(requestResize), fn map(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wlr.XdgSurface) void { const view = @fieldParentPtr(View, "map", listener); view.server.views.prepend(view); view.server.focusView(view, xdg_surface.surface); } fn unmap(listener: *wl.Listener(*wlr.XdgSurface), _: *wlr.XdgSurface) void { const view = @fieldParentPtr(View, "unmap", listener); view.link.remove(); } fn destroy(listener: *wl.Listener(*wlr.XdgSurface), _: *wlr.XdgSurface) void { const view = @fieldParentPtr(View, "destroy", listener); view.map.link.remove(); view.unmap.link.remove(); view.destroy.link.remove(); view.request_move.link.remove(); view.request_resize.link.remove(); gpa.destroy(view); } fn requestMove( listener: *wl.Listener(*wlr.XdgToplevel.event.Move), _: *wlr.XdgToplevel.event.Move, ) void { const view = @fieldParentPtr(View, "request_move", listener); const server = view.server; server.grabbed_view = view; server.cursor_mode = .move; server.grab_x = server.cursor.x - @intToFloat(f64, view.x); server.grab_y = server.cursor.y - @intToFloat(f64, view.y); } fn requestResize( listener: *wl.Listener(*wlr.XdgToplevel.event.Resize), event: *wlr.XdgToplevel.event.Resize, ) void { const view = @fieldParentPtr(View, "request_resize", listener); const server = view.server; server.grabbed_view = view; server.cursor_mode = .resize; server.resize_edges = event.edges; var box: wlr.Box = undefined; view.xdg_surface.getGeometry(&box); const border_x = view.x + box.x + if (event.edges.right) box.width else 0; const border_y = view.y + box.y + if (event.edges.bottom) box.height else 0; server.grab_x = server.cursor.x - @intToFloat(f64, border_x); server.grab_y = server.cursor.y - @intToFloat(f64, border_y); server.grab_box = box; server.grab_box.x += view.x; server.grab_box.y += view.y; } }; const Keyboard = struct { server: *Server, link: wl.list.Link = undefined, device: *wlr.InputDevice, modifiers: wl.Listener(*wlr.Keyboard) = wl.Listener(*wlr.Keyboard).init(modifiers), key: wl.Listener(*wlr.Keyboard.event.Key) = wl.Listener(*wlr.Keyboard.event.Key).init(key), fn create(server: *Server, device: *wlr.InputDevice) !void { const keyboard = try gpa.create(Keyboard); errdefer gpa.destroy(keyboard); keyboard.* = .{ .server = server, .device = device, }; const context = xkb.Context.new(.no_flags) orelse return error.ContextFailed; defer context.unref(); const keymap = xkb.Keymap.newFromNames(context, null, .no_flags) orelse return error.KeymapFailed; defer keymap.unref(); const wlr_keyboard = device.device.keyboard; if (!wlr_keyboard.setKeymap(keymap)) return error.SetKeymapFailed; wlr_keyboard.setRepeatInfo(25, 600); wlr_keyboard.events.modifiers.add(&keyboard.modifiers); wlr_keyboard.events.key.add(&keyboard.key); server.seat.setKeyboard(device); server.keyboards.append(keyboard); } fn modifiers(listener: *wl.Listener(*wlr.Keyboard), wlr_keyboard: *wlr.Keyboard) void { const keyboard = @fieldParentPtr(Keyboard, "modifiers", listener); keyboard.server.seat.setKeyboard(keyboard.device); keyboard.server.seat.keyboardNotifyModifiers(&wlr_keyboard.modifiers); } fn key(listener: *wl.Listener(*wlr.Keyboard.event.Key), event: *wlr.Keyboard.event.Key) void { const keyboard = @fieldParentPtr(Keyboard, "key", listener); const wlr_keyboard = keyboard.device.device.keyboard; // Translate libinput keycode -> xkbcommon const keycode = event.keycode + 8; var handled = false; if (wlr_keyboard.getModifiers().alt and event.state == .pressed) { for (wlr_keyboard.xkb_state.?.keyGetSyms(keycode)) |sym| { if (keyboard.server.handleKeybind(sym)) { handled = true; break; } } } if (!handled) { keyboard.server.seat.setKeyboard(keyboard.device); keyboard.server.seat.keyboardNotifyKey(event.time_msec, event.keycode, event.state); } } };
tinywl/tinywl.zig
const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std"); const time = std.os.time; const mem = std.mem; const math = std.math; const Allocator = mem.Allocator; const assert = std.debug.assert; const warn = std.debug.warn; const gl = @import("modules/zig-sdl2/src/index.zig"); const misc = @import("modules/zig-misc/index.zig"); const saturateCast = misc.saturateCast; const colorns = @import("color.zig"); const Color = colorns.Color; const ColorU8 = colorns.ColorU8; const geo = @import("modules/zig-geometry/index.zig"); const V2f32 = geo.V2f32; const V3f32 = geo.V3f32; const M44f32 = geo.M44f32; const parseJsonFile = @import("modules/zig-json/parse_json_file.zig").parseJsonFile; const createMeshFromBabylonJson = @import("create_mesh_from_babylon_json.zig").createMeshFromBabylonJson; const Camera = @import("camera.zig").Camera; const meshns = @import("modules/zig-geometry/mesh.zig"); const Mesh = meshns.Mesh; const Vertex = meshns.Vertex; const Face = meshns.Face; const Texture = @import("texture.zig").Texture; const ki = @import("keyboard_input.zig"); const windowns = @import("window.zig"); const Entity = windowns.Entity; const RenderMode = windowns.RenderMode; const Window = windowns.Window; const DBG = false; const DBG1 = false; const DBG2 = false; const DBG3 = false; const DBG_RenderUsingModeWaitForKey = false; const DBG_Rotate = false; const DBG_Translate = false; const DBG_world_to_screen = false; const DBG_ft_bitmapToTexture = false; test "window" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 640, 480, "testWindow"); defer window.deinit(); assert(window.width == 640); assert(window.widthci == 640); assert(window.widthf == f32(640)); assert(window.height == 480); assert(window.heightci == 480); assert(window.heightf == f32(480)); assert(mem.eql(u8, window.name, "testWindow")); var color = ColorU8.init(0x01, 02, 03, 04); window.putPixel(0, 0, 0, color); assert(window.getPixel(0, 0) == color.asU32Argb()); } test "window.projectRetV2f32" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 640, 480, "testWindow"); defer window.deinit(); var v1 = V3f32.init(0, 0, 0); var r = window.projectRetV2f32(v1, &geo.m44f32_unit); assert(r.x() == window.widthf / 2.0); assert(r.y() == window.heightf / 2.0); v1 = V3f32.init(-1.0, 1.0, 0); r = window.projectRetV2f32(v1, &geo.m44f32_unit); assert(r.x() == 0); assert(r.y() == 0); v1 = V3f32.init(1.0, -1.0, 0); r = window.projectRetV2f32(v1, &geo.m44f32_unit); assert(r.x() == window.widthf); assert(r.y() == window.heightf); v1 = V3f32.init(-1.0, -1.0, 0); r = window.projectRetV2f32(v1, &geo.m44f32_unit); assert(r.x() == 0); assert(r.y() == window.heightf); v1 = V3f32.init(1.0, 1.0, 0); r = window.projectRetV2f32(v1, &geo.m44f32_unit); assert(r.x() == window.widthf); assert(r.y() == 0); } test "window.drawPointV2f32" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 640, 480, "testWindow"); defer window.deinit(); var p1 = V2f32.init(0, 0); var color = ColorU8.init(0x80, 0x80, 0x80, 0x80); window.drawPointV2f32(p1, color); assert(window.getPixel(0, 0) == color.asU32Argb()); p1 = V2f32.init(window.widthf / 2, window.heightf / 2); window.drawPointV2f32(p1, color); assert(window.getPixel(window.width / 2, window.height / 2) == color.asU32Argb()); } test "window.projectRetVertex" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 640, 480, "testWindow"); defer window.deinit(); var v1 = Vertex.init(0, 0, 0); var r = window.projectRetVertex(v1, &geo.m44f32_unit, &geo.m44f32_unit); assert(r.coord.x() == window.widthf / 2.0); assert(r.coord.y() == window.heightf / 2.0); v1 = Vertex.init(-0.5, 0.5, 0); r = window.projectRetVertex(v1, &geo.m44f32_unit, &geo.m44f32_unit); assert(r.coord.x() == 0); assert(r.coord.y() == 0); v1 = Vertex.init(0.5, -0.5, 0); r = window.projectRetVertex(v1, &geo.m44f32_unit, &geo.m44f32_unit); assert(r.coord.x() == window.widthf); assert(r.coord.y() == window.heightf); v1 = Vertex.init(-0.5, -0.5, 0); r = window.projectRetVertex(v1, &geo.m44f32_unit, &geo.m44f32_unit); assert(r.coord.x() == 0); assert(r.coord.y() == window.heightf); v1 = Vertex.init(0.5, 0.5, 0); r = window.projectRetVertex(v1, &geo.m44f32_unit, &geo.m44f32_unit); assert(r.coord.x() == window.widthf); assert(r.coord.y() == 0); } test "window.drawLine" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 640, 480, "testWindow"); defer window.deinit(); var point1 = V2f32.init(1, 1); var point2 = V2f32.init(4, 4); var color = ColorU8.init(0x80, 0x80, 0x80, 0x80); window.drawLine(point1, point2, color); assert(window.getPixel(1, 1) == color.asU32Argb()); assert(window.getPixel(2, 2) == color.asU32Argb()); assert(window.getPixel(3, 3) == color.asU32Argb()); } test "window.world.to.screen" { if (DBG_world_to_screen) warn("\n"); var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; const T = f32; const widthf: T = 512; const heightf: T = 512; const width: u32 = @floatToInt(u32, widthf); const height: u32 = @floatToInt(u32, heightf); const fov: T = 90; const aspect: T = widthf / heightf; const znear: T = 0.01; const zfar: T = 1.0; var camera_position = V3f32.init(0, 0, 2); var camera_target = V3f32.initVal(0); var camera = Camera.init(camera_position, camera_target); var window = try Window.init(pAllocator, width, height, "testWindow"); defer window.deinit(); var view_to_perspective_matrix = geo.perspectiveM44(f32, geo.rad(fov), aspect, znear, zfar); if (DBG_world_to_screen) warn("view_to_perspective_matrix=\n{}\n", view_to_perspective_matrix); var world_to_view_matrix: geo.M44f32 = undefined; world_to_view_matrix = geo.lookAtRh(&camera.position, &camera.target, &V3f32.unitY()); world_to_view_matrix = geo.m44f32_unit; world_to_view_matrix.data[3][2] = 2; if (DBG_world_to_screen) warn("world_to_view_matrix=\n{}\n", world_to_view_matrix); var world_vertexs = []V3f32{ V3f32.init(0, 1, 0), V3f32.init(-1, -1, 0), V3f32.init(0.5, -0.5, 0), }; var expected_view_vertexs = []V3f32{ V3f32.init(0, 1, 2), V3f32.init(-1, -1, 2), V3f32.init(0.5, -0.5, 2), }; var expected_projected_vertexs = []V3f32{ V3f32.init(0, 0.5, 1.00505), V3f32.init(-0.5, -0.5, 1.00505), V3f32.init(0.25, -0.25, 1.00505), }; var expected_screen_vertexs = [][2]u32{ []u32{ 256, 128 }, []u32{ 128, 384 }, []u32{ 320, 320 }, }; // Loop until end_time is reached but always loop once :) var msf: u64 = time.ns_per_s / time.ms_per_s; var timer = try time.Timer.start(); var end_time: u64 = 0; if (DBG_world_to_screen) end_time += (4000 * msf); while (true) { window.clear(); for (world_vertexs) |world_vert, i| { if (DBG_world_to_screen) warn("world_vert[{}] = {}\n", i, &world_vert); var view_vert = world_vert.transform(&world_to_view_matrix); if (DBG_world_to_screen) warn("view_vert = {}\n", view_vert); assert(view_vert.approxEql(&expected_view_vertexs[i], 5)); var projected_vert = view_vert.transform(&view_to_perspective_matrix); if (DBG_world_to_screen) warn("projected_vert = {}\n", projected_vert); assert(projected_vert.approxEql(&expected_projected_vertexs[i], 5)); var point = window.projectRetV2f32(projected_vert, &geo.m44f32_unit); var color = ColorU8.init(0xff, 0xff, 00, 0xff); window.drawPointV2f32(point, color); assert(window.getPixel(expected_screen_vertexs[i][0], expected_screen_vertexs[i][1]) == color.asU32Argb()); } var center = V2f32.init(window.widthf / 2, window.heightf / 2); window.drawPointV2f32(center, ColorU8.White); window.present(); if (timer.read() > end_time) break; } } test "window.render.cube" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 640, 480, "testWindow"); defer window.deinit(); var mesh: Mesh = undefined; // Unit cube about 0,0,0 mesh = try Mesh.init(pAllocator, "mesh1", 8, 12); defer mesh.deinit(); // Unit cube about 0,0,0 mesh.vertices[0] = Vertex.init(-1, 1, 1); mesh.vertices[1] = Vertex.init(-1, -1, 1); mesh.vertices[2] = Vertex.init(1, -1, 1); mesh.vertices[3] = Vertex.init(1, 1, 1); mesh.vertices[4] = Vertex.init(-1, 1, -1); mesh.vertices[5] = Vertex.init(-1, -1, -1); mesh.vertices[6] = Vertex.init(1, -1, -1); mesh.vertices[7] = Vertex.init(1, 1, -1); // 12 faces mesh.faces[0] = Face{ .a = 0, .b = 1, .c = 2, .normal = undefined }; mesh.faces[1] = Face{ .a = 0, .b = 2, .c = 3, .normal = undefined }; mesh.faces[2] = Face{ .a = 3, .b = 2, .c = 6, .normal = undefined }; mesh.faces[3] = Face{ .a = 3, .b = 6, .c = 7, .normal = undefined }; mesh.faces[4] = Face{ .a = 7, .b = 6, .c = 5, .normal = undefined }; mesh.faces[5] = Face{ .a = 7, .b = 5, .c = 4, .normal = undefined }; mesh.faces[6] = Face{ .a = 4, .b = 5, .c = 1, .normal = undefined }; mesh.faces[7] = Face{ .a = 4, .b = 1, .c = 0, .normal = undefined }; mesh.faces[8] = Face{ .a = 0, .b = 3, .c = 4, .normal = undefined }; mesh.faces[9] = Face{ .a = 3, .b = 7, .c = 4, .normal = undefined }; mesh.faces[10] = Face{ .a = 1, .b = 6, .c = 2, .normal = undefined }; mesh.faces[11] = Face{ .a = 1, .b = 5, .c = 6, .normal = undefined }; var entity = Entity{ .texture = null, .mesh = mesh, }; var entities = []Entity{entity}; var movement = V3f32.init(0.01, 0.01, 0); // Small amount of movement var camera_position = V3f32.init(0, 0, -5); var camera_target = V3f32.initVal(0); var camera = Camera.init(camera_position, camera_target); // Loop until end_time is reached but always loop once :) var ms_factor: u64 = time.ns_per_s / time.ms_per_s; var timer = try time.Timer.start(); var end_time: u64 = if (DBG or DBG1 or DBG2) (5000 * ms_factor) else (100 * ms_factor); while (true) { window.clear(); if (DBG1) { warn("rotation={.5}:{.5}:{.5}\n", entities[0].mesh.rotation.x(), entities[0].mesh.rotation.y(), entities[0].mesh.rotation.z()); } window.render(&camera, entities); var center = V2f32.init(window.widthf / 2, window.heightf / 2); window.drawPointV2f32(center, ColorU8.White); window.present(); entities[0].mesh.rotation = entities[0].mesh.rotation.add(&movement); if (timer.read() > end_time) break; } } test "window.keyctrl.triangle" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1000, 1000, "testWindow"); defer window.deinit(); // Black background color window.setBgColor(ColorU8.Black); // Triangle var mesh: Mesh = try Mesh.init(pAllocator, "triangle", 3, 1); defer mesh.deinit(); mesh.vertices[0] = Vertex.init(0, 1, 0); mesh.vertices[1] = Vertex.init(-1, -1, 0); mesh.vertices[2] = Vertex.init(0.5, -0.5, 0); mesh.faces[0] = Face.initComputeNormal(mesh.vertices, 0, 1, 2); var entities = []Entity{Entity{ .texture = null, .mesh = mesh, }}; keyCtrlEntities(&window, RenderMode.Points, entities[0..], !DBG); } test "window.keyctrl.cube" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1000, 1000, "render.cube"); defer window.deinit(); var file_name = "src/modules/3d-test-resources/cube.babylon"; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "cube", tree); defer mesh.deinit(); assert(std.mem.eql(u8, mesh.name, "cube")); var entities = []Entity{Entity{ .texture = null, .mesh = mesh, }}; keyCtrlEntities(&window, RenderMode.Points, entities[0..], !DBG); } test "window.keyctrl.pyramid" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1000, 1000, "testWindow"); defer window.deinit(); // Black background color window.setBgColor(ColorU8.Black); var file_name = "src/modules/3d-test-resources/pyramid.babylon"; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "pyramid", tree); defer mesh.deinit(); assert(std.mem.eql(u8, mesh.name, "pyramid")); var texture = Texture.init(pAllocator); defer texture.deinit(); try texture.loadFile("src/modules/3d-test-resources/bricks2.jpg"); var entities = []Entity{Entity{ .texture = texture, //null, .mesh = mesh, }}; keyCtrlEntities(&window, RenderMode.Triangles, entities[0..], !DBG); } test "window.keyctrl.tilted.pyramid" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1000, 1000, "testWindow"); defer window.deinit(); // Black background color window.setBgColor(ColorU8.Black); var file_name = "src/modules/3d-test-resources/tilted-pyramid.babylon"; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "pyramid", tree); defer mesh.deinit(); assert(std.mem.eql(u8, mesh.name, "pyramid")); var entities = []Entity{Entity{ .texture = null, .mesh = mesh, }}; keyCtrlEntities(&window, RenderMode.Triangles, entities[0..], !DBG); } test "window.keyctrl.suzanne" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1000, 1000, "testWindow"); defer window.deinit(); // Black background color window.setBgColor(ColorU8.Black); var file_name = "src/modules/3d-test-resources/suzanne.babylon"; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "suzanne", tree); defer mesh.deinit(); assert(std.mem.eql(u8, mesh.name, "suzanne")); assert(mesh.vertices.len == 507); assert(mesh.faces.len == 968); var entities = []Entity{Entity{ .texture = null, .mesh = mesh, }}; keyCtrlEntities(&window, RenderMode.Triangles, entities[0..], !DBG); } fn rotate(mod: u16, angles: V3f32, val: f32) V3f32 { var r = geo.rad(val); if (DBG_Rotate) warn("rotate: mod={x} angles={} rad(val)={}\n", mod, angles, r); var new_angles = angles; if ((mod & gl.KMOD_LCTRL) != 0) { new_angles = new_angles.add(&V3f32.init(r, 0, 0)); if (DBG_Rotate) warn("rotate: add X\n"); } if ((mod & gl.KMOD_LSHIFT) != 0) { new_angles = new_angles.add(&V3f32.init(0, r, 0)); if (DBG_Rotate) warn("rotate: add Y\n"); } if ((mod & gl.KMOD_RCTRL) != 0) { new_angles = new_angles.add(&V3f32.init(0, 0, r)); if (DBG_Rotate) warn("rotate: add Z\n"); } if (DBG_Rotate and !angles.approxEql(&new_angles, 4)) { warn("rotate: new_angles={}\n", new_angles); } return new_angles; } fn translate(mod: u16, pos: V3f32, val: f32) V3f32 { if (DBG_Translate) warn("translate: pos={}\n", pos); var new_pos = pos; if ((mod & gl.KMOD_LCTRL) != 0) { new_pos = pos.add(&V3f32.init(val, 0, 0)); if (DBG_Translate) warn("translate: add X\n"); } if ((mod & gl.KMOD_LSHIFT) != 0) { new_pos = pos.add(&V3f32.init(0, val, 0)); if (DBG_Translate) warn("translate: add Y\n"); } if ((mod & gl.KMOD_RCTRL) != 0) { new_pos = pos.add(&V3f32.init(0, 0, val)); if (DBG_Translate) warn("translate: add Z\n"); } if (DBG_Translate and !pos.eql(&new_pos)) { warn("translate: new_pos={}\n", new_pos); } return new_pos; } fn keyCtrlEntities(pWindow: *Window, renderMode: RenderMode, entities: []Entity, presentOnly: bool) void { const FocusType = enum { Camera, Object, }; var focus = FocusType.Object; var camera_position = V3f32.init(0, 0, -5); var camera_target = V3f32.init(0, 0, 0); var camera = Camera.init(camera_position, camera_target); if (presentOnly) { pWindow.clear(); pWindow.renderUsingMode(renderMode, &camera, entities[0..], true); pWindow.present(); } else { done: while (true) { // Update the display pWindow.clear(); var center = V2f32.init(pWindow.widthf / 2, pWindow.heightf / 2); pWindow.drawPointV2f32(center, ColorU8.White); if (DBG_RenderUsingModeWaitForKey) { pWindow.present(); } if (DBG1) warn("camera={}\n", &camera.position); if (DBG1) warn("rotation={}\n", entities[0].mesh.rotation); pWindow.renderUsingMode(renderMode, &camera, entities[0..], true); pWindow.present(); // Wait for a key var ks = ki.waitForKey("keyCtrlEntities", false, false); // Process the key // Check if changing focus switch (ks.code) { gl.SDLK_ESCAPE => break :done, gl.SDLK_c => { focus = FocusType.Camera; if (DBG) warn("focus = Camera"); }, gl.SDLK_o => { focus = FocusType.Object; if (DBG) warn("focus = Object"); }, else => {}, } if (focus == FocusType.Object) { // Process for Object switch (ks.code) { gl.SDLK_LEFT => entities[0].mesh.rotation = rotate(ks.mod, entities[0].mesh.rotation, f32(15)), gl.SDLK_RIGHT => entities[0].mesh.rotation = rotate(ks.mod, entities[0].mesh.rotation, -f32(15)), gl.SDLK_UP => entities[0].mesh.position = translate(ks.mod, entities[0].mesh.position, f32(1)), gl.SDLK_DOWN => entities[0].mesh.position = translate(ks.mod, entities[0].mesh.position, -f32(1)), else => {}, } } if (focus == FocusType.Camera) { // Process for Camera switch (ks.code) { gl.SDLK_LEFT => camera.target = rotate(ks.mod, camera.target, f32(15)), gl.SDLK_RIGHT => camera.target = rotate(ks.mod, camera.target, -f32(15)), gl.SDLK_UP => camera.position = translate(ks.mod, camera.position, f32(1)), gl.SDLK_DOWN => camera.position = translate(ks.mod, camera.position, -f32(1)), else => {}, } } } } } test "window.bm.suzanne" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1000, 1000, "testWindow"); defer window.deinit(); // Black background color window.setBgColor(ColorU8.Black); var file_name = "src/modules/3d-test-resources/suzanne.babylon"; var tree = try parseJsonFile(pAllocator, file_name); defer tree.deinit(); var mesh = try createMeshFromBabylonJson(pAllocator, "suzanne", tree); defer mesh.deinit(); assert(std.mem.eql(u8, mesh.name, "suzanne")); assert(mesh.vertices.len == 507); assert(mesh.faces.len == 968); var durationInMs: u64 = 1000; var entities = []Entity{Entity{ .texture = null, .mesh = mesh, }}; var loops = try timeRenderer(&window, durationInMs, RenderMode.Triangles, entities[0..]); var fps: f32 = @intToFloat(f32, loops * time.ms_per_s) / @intToFloat(f32, durationInMs); warn("\nwindow.bm.suzanne: fps={.5}\n", fps); } fn timeRenderer(pWindow: *Window, durationInMs: u64, renderMode: RenderMode, entities: []Entity) !u64 { var camera_position = V3f32.init(0, 0, -5); var camera_target = V3f32.init(0, 0, 0); var camera = Camera.init(camera_position, camera_target); // Loop until end_time is reached but always loop once :) var msf: u64 = time.ns_per_s / time.ms_per_s; var timer = try time.Timer.start(); var end_time: u64 = timer.read() + (durationInMs * msf); var loops: u64 = 0; while (true) { loops = loops + 1; // Render into a cleared screen pWindow.clear(); pWindow.renderUsingMode(renderMode, &camera, entities[0..], true); // Disable presenting as it limits framerate //pWindow.present(); // Rotate entities[0] around Y axis var rotation = geo.degToRad(f32(1)); var rotationVec = V3f32.init(0, rotation, 0); entities[0].mesh.rotation = entities[0].mesh.rotation.add(&rotationVec); if (timer.read() > end_time) break; } return loops; } const ft2 = @import("modules/zig-freetype2/freetype2.zig"); const CHAR_SIZE: usize = 14; // 14 "points" for character size const DPI: usize = 140; // dots per inch of my display fn ft_bitmapToTexture(texture: *Texture, bitmap: *ft2.FT_Bitmap, x: usize, y: usize, color: ColorU8, background: ColorU8) void { var i: usize = 0; var j: usize = 0; var p: usize = 0; var q: usize = 0; var glyph_width: usize = @intCast(usize, bitmap.width); var glyph_height: usize = @intCast(usize, bitmap.rows); var x_max: usize = x + glyph_width; var y_max: usize = y + glyph_height; if (DBG_ft_bitmapToTexture) warn("ft_bitmapToTexture: x={} y={} x_max={} y_max={} glyph_width={} glyph_height={} buffer={*}\n", x, y, x_max, y_max, glyph_width, glyph_height, bitmap.buffer); i = x; p = 0; while (i < x_max) { j = y; q = 0; while (j < y_max) { if ((i >= 0) and (j >= 0) and (i < texture.width) and (j < texture.height)) { var idx: usize = @intCast(usize, (q * glyph_width) + p); if (bitmap.buffer == null) return; // From http://web.comhem.se/~u34598116/content/FreeType2/main.html var ptr: *u8 = @intToPtr(*u8, @ptrToInt(bitmap.buffer.?) + idx); var opacity: f32 = @intToFloat(f32, ptr.*) / 255.0; var r: u8 = undefined; var g: u8 = undefined; var b: u8 = undefined; var c = background; if (opacity > 0) { r = @floatToInt(u8, (@intToFloat(f32, color.r) * opacity) + ((f32(1.0) - opacity) * @intToFloat(f32, background.r))); g = @floatToInt(u8, (@intToFloat(f32, color.g) * opacity) + ((f32(1.0) - opacity) * @intToFloat(f32, background.g))); b = @floatToInt(u8, (@intToFloat(f32, color.b) * opacity) + ((f32(1.0) - opacity) * @intToFloat(f32, background.b))); c = ColorU8.init(color.a, r, g, b); if (DBG_ft_bitmapToTexture) warn("<[{},{}]={.2}:{}> ", j, i, opacity, b); } texture.pixels.?[(j * texture.width) + i] = c; } j += 1; q += 1; } if (DBG_ft_bitmapToTexture) warn("\n"); i += 1; p += 1; } } fn showTexture(window: *Window, texture: *Texture) void { var y: usize = 0; while (y < texture.height) : (y += 1) { var x: usize = 0; while (x < texture.width) : (x += 1) { var color = texture.pixels.?[(y * texture.width) + x]; window.drawPointXy(@intCast(isize, x), @intCast(isize, y), color); } } window.present(); } test "test-freetype2" { // Based on https://www.freetype.org/freetype2/docs/tutorial/example1.c // Init Window var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var window = try Window.init(pAllocator, 1024, 1024, "testWindow"); defer window.deinit(); // Create a plane to write on. var mesh = try Mesh.init(pAllocator, "square", 4, 2); defer mesh.deinit(); assert(std.mem.eql(u8, mesh.name, "square")); assert(mesh.vertices.len == 4); assert(mesh.faces.len == 2); // Position and orient the Mesh mesh.position.set(0, 0, 0); mesh.rotation.set(0, 0, 0); // upside down triangle //-1,1 1,1 // _____ // | /| // | / | // | / | // | / | // |/ | // _____ // -1,-1 1,-1 mesh.vertices[0] = Vertex.init(-1, 1, 0); mesh.vertices[1] = Vertex.init(1, 1, 0); mesh.vertices[2] = Vertex.init(-1, -1, 0); mesh.vertices[3] = Vertex.init(1, -1, 0); // Compute the normal for the face and since both faces // are in the same plane the normal is the same. var normal = geo.computeFaceNormal(mesh.vertices, 0, 1, 2); // Define the two faces and since this is a planeand the face normal is the same for both mesh.faces[0] = geo.Face.init(0, 1, 2, normal); mesh.faces[1] = geo.Face.init(1, 3, 2, normal); // In addition, since this is a plane all the vertice normals are the same as the face normal mesh.vertices[0].normal_coord = normal; mesh.vertices[1].normal_coord = normal; mesh.vertices[2].normal_coord = normal; mesh.vertices[3].normal_coord = normal; // The texture_coord is a unit square and we map to the two triangles // "L" and "R": // 0,0 1,0 // _____ // | /| // | L / | // | / | // | / R | // |/ | // _______ // 0,1 1,1 mesh.vertices[0].texture_coord = V2f32.init(0, 0); // -1, 1 mesh.vertices[1].texture_coord = V2f32.init(1, 0); // 1, 1 mesh.vertices[2].texture_coord = V2f32.init(0, 1); // -1,-1 mesh.vertices[3].texture_coord = V2f32.init(1, 1); // 1,-1 // Setup parameters // Filename for font const cfilename = c"src/modules/3d-test-resources/liberation-fonts-ttf-2.00.4/LiberationMono-Regular.ttf"; // Convert Rotate angle in radians for font var angleInDegrees = f64(0.0); var angle = (angleInDegrees / 360.0) * math.pi * 2.0; // Text to display var text = "abcdefghijklmnopqrstuvwxyz"; // Init FT library var pLibrary: ?*ft2.FT_Library = undefined; assert(ft2.FT_Init_FreeType(&pLibrary) == 0); defer assert(ft2.FT_Done_FreeType(pLibrary) == 0); // Load a type face var pFace: ?*ft2.FT_Face = undefined; assert(ft2.FT_New_Face(pLibrary, cfilename, 0, &pFace) == 0); defer assert(ft2.FT_Done_Face(pFace) == 0); // Set character size assert(ft2.FT_Set_Char_Size(pFace, ft2.fixed26_6(CHAR_SIZE, 0), 0, DPI, DPI) == 0); // Setup matrix var matrix: ft2.FT_Matrix = undefined; matrix.xx = ft2.f64_fixed16_16(math.cos(angle)); matrix.xy = ft2.f64_fixed16_16(-math.sin(angle)); matrix.yx = ft2.f64_fixed16_16(math.sin(angle)); matrix.yy = ft2.f64_fixed16_16(math.cos(angle)); // Setup pen location var pen: ft2.FT_Vector = undefined; pen.x = ft2.f64_fixed26_6(5); // x = 5 points from left side pen.y = ft2.f64_fixed26_6(CHAR_SIZE); // y = CHAR_SIZE in points from top // Create and Initialize texture var texture = try Texture.initPixels(pAllocator, 600, 600, ColorU8.White); // Loop to print characters to texture var slot: *ft2.FT_GlyphSlot = (pFace.?.glyph) orelse return error.NoGlyphSlot; var n: usize = 0; while (n < text.len) : (n += 1) { // Setup transform ft2.FT_Set_Transform(pFace, &matrix, &pen); // Load glyph image into slot assert(ft2.FT_Load_Char(pFace, text[n], ft2.FT_LOAD_RENDER) == 0); if (DBG) { warn("{c} position: left={} top={} width={} rows={} pitch={} adv_x={} hAdv={} hBearingX=={}\n", text[n], slot.bitmap_left, slot.bitmap_top, slot.bitmap.width, slot.bitmap.rows, slot.bitmap.pitch, slot.advance.x, slot.metrics.horiAdvance, slot.metrics.horiBearingX); } // Draw the character at top of texture var line_spacing: usize = 50; // > Maximum "top" of character ft_bitmapToTexture(&texture, &slot.bitmap, @intCast(usize, slot.bitmap_left), (6 * line_spacing) - @intCast(usize, slot.bitmap_top), ColorU8.Black, ColorU8.White); // Move the pen pen.x += slot.advance.x; pen.y += slot.advance.y; } // Setup camera var camera_position = V3f32.init(0, 0, -5); var camera_target = V3f32.initVal(0); var camera = Camera.init(camera_position, camera_target); // background color window.setBgColor(ColorU8.Black); window.clear(); var entity = Entity{ .texture = texture, .mesh = mesh, }; var entities = []Entity{entity}; //showTexture(&window, &texture); // Render any entities but I do NOT need to negate_tnz window.renderUsingMode(RenderMode.Triangles, &camera, entities, false); window.present(); if (DBG) { ki.waitForEsc("Prese ESC to stop"); } }
src/test-window.zig
const std = @import("std"); const io = std.io; const fs = std.fs; const testing = std.testing; const mem = std.mem; const deflate = std.compress.deflate; // Flags for the FLG field in the header const FTEXT = 1 << 0; const FHCRC = 1 << 1; const FEXTRA = 1 << 2; const FNAME = 1 << 3; const FCOMMENT = 1 << 4; pub fn GzipStream(comptime ReaderType: type) type { return struct { const Self = @This(); pub const Error = ReaderType.Error || deflate.InflateStream(ReaderType).Error || error{ CorruptedData, WrongChecksum }; pub const Reader = io.Reader(*Self, Error, read); allocator: *mem.Allocator, inflater: deflate.InflateStream(ReaderType), in_reader: ReaderType, hasher: std.hash.Crc32, window_slice: []u8, read_amt: usize, info: struct { filename: ?[]const u8, comment: ?[]const u8, modification_time: u32, }, fn init(allocator: *mem.Allocator, source: ReaderType) !Self { // gzip header format is specified in RFC1952 const header = try source.readBytesNoEof(10); // Check the ID1/ID2 fields if (header[0] != 0x1f or header[1] != 0x8b) return error.BadHeader; const CM = header[2]; // The CM field must be 8 to indicate the use of DEFLATE if (CM != 8) return error.InvalidCompression; // Flags const FLG = header[3]; // Modification time, as a Unix timestamp. // If zero there's no timestamp available. const MTIME = mem.readIntLittle(u32, header[4..8]); // Extra flags const XFL = header[8]; // Operating system where the compression took place const OS = header[9]; if (FLG & FEXTRA != 0) { // Skip the extra data, we could read and expose it to the user // if somebody needs it. const len = try source.readIntLittle(u16); try source.skipBytes(len, .{}); } var filename: ?[]const u8 = null; if (FLG & FNAME != 0) { filename = try source.readUntilDelimiterAlloc( allocator, 0, std.math.maxInt(usize), ); } errdefer if (filename) |p| allocator.free(p); var comment: ?[]const u8 = null; if (FLG & FCOMMENT != 0) { comment = try source.readUntilDelimiterAlloc( allocator, 0, std.math.maxInt(usize), ); } errdefer if (comment) |p| allocator.free(p); if (FLG & FHCRC != 0) { // TODO: Evaluate and check the header checksum. The stdlib has // no CRC16 yet :( _ = try source.readIntLittle(u16); } // The RFC doesn't say anything about the DEFLATE window size to be // used, default to 32K. var window_slice = try allocator.alloc(u8, 32 * 1024); return Self{ .allocator = allocator, .inflater = deflate.inflateStream(source, window_slice), .in_reader = source, .hasher = std.hash.Crc32.init(), .window_slice = window_slice, .info = .{ .filename = filename, .comment = comment, .modification_time = MTIME, }, .read_amt = 0, }; } pub fn deinit(self: *Self) void { self.allocator.free(self.window_slice); if (self.info.filename) |filename| self.allocator.free(filename); if (self.info.comment) |comment| self.allocator.free(comment); } // Implements the io.Reader interface pub fn read(self: *Self, buffer: []u8) Error!usize { if (buffer.len == 0) return 0; // Read from the compressed stream and update the computed checksum const r = try self.inflater.read(buffer); if (r != 0) { self.hasher.update(buffer[0..r]); self.read_amt += r; return r; } // We've reached the end of stream, check if the checksum matches const hash = try self.in_reader.readIntLittle(u32); if (hash != self.hasher.final()) return error.WrongChecksum; // The ISIZE field is the size of the uncompressed input modulo 2^32 const input_size = try self.in_reader.readIntLittle(u32); if (self.read_amt & 0xffffffff != input_size) return error.CorruptedData; return 0; } pub fn reader(self: *Self) Reader { return .{ .context = self }; } }; } pub fn gzipStream(allocator: *mem.Allocator, reader: anytype) !GzipStream(@TypeOf(reader)) { return GzipStream(@TypeOf(reader)).init(allocator, reader); } fn testReader(data: []const u8, comptime expected: []const u8) !void { var in_stream = io.fixedBufferStream(data); var gzip_stream = try gzipStream(testing.allocator, in_stream.reader()); defer gzip_stream.deinit(); // Read and decompress the whole file const buf = try gzip_stream.reader().readAllAlloc(testing.allocator, std.math.maxInt(usize)); defer testing.allocator.free(buf); // Calculate its SHA256 hash and check it against the reference var hash: [32]u8 = undefined; std.crypto.hash.sha2.Sha256.hash(buf, hash[0..], .{}); assertEqual(expected, &hash); } // Assert `expected` == `input` where `input` is a bytestring. pub fn assertEqual(comptime expected: []const u8, input: []const u8) void { var expected_bytes: [expected.len / 2]u8 = undefined; for (expected_bytes) |*r, i| { r.* = std.fmt.parseInt(u8, expected[2 * i .. 2 * i + 2], 16) catch unreachable; } testing.expectEqualSlices(u8, &expected_bytes, input); } // All the test cases are obtained by compressing the RFC1952 text // // https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes // SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67 test "compressed data" { try testReader( @embedFile("rfc1952.txt.gz"), "164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67", ); } test "sanity checks" { // Truncated header testing.expectError( error.EndOfStream, testReader(&[_]u8{ 0x1f, 0x8B }, ""), ); // Wrong CM testing.expectError( error.InvalidCompression, testReader(&[_]u8{ 0x1f, 0x8b, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, ""), ); // Wrong checksum testing.expectError( error.WrongChecksum, testReader(&[_]u8{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, }, ""), ); // Truncated checksum testing.expectError( error.EndOfStream, testReader(&[_]u8{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, }, ""), ); // Wrong initial size testing.expectError( error.CorruptedData, testReader(&[_]u8{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, }, ""), ); // Truncated initial size field testing.expectError( error.EndOfStream, testReader(&[_]u8{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, ""), ); }
lib/std/compress/gzip.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day04.txt"); const Board = struct { grid: [25]u8, matches: [25]bool = [1]bool{ false } ** 25, pub fn create(input: []const u8) !Board { var grid = std.mem.zeroes([25]u8); var lines = tokenize(u8, input, "\n"); var i: u8 = 0; while (lines.next()) |line| { var iter = tokenize(u8, line, " "); while (iter.next()) |num| : (i += 1) { grid[i] = try parseInt(u8, num, 10); } } return Board{ .grid = grid, }; } pub fn mark(self: *Board, pick: u8) void { for (self.grid) |n, i| { if (n == pick) { self.matches[i] = true; } } } pub fn bingo(self: Board) bool { { // Check rows var i: u8 = 0; while (i < 5) : (i += 1) { var j: u8 = 0; while (j < 5) : (j += 1) { if (!self.matches[i * 5 + j]) break; if (j == 4) return true; } } } { // Check columns var i: u8 = 0; while (i < 5) : (i += 1) { var j: u8 = 0; while (j < 5) : (j += 1) { if (!self.matches[j * 5 + i]) break; if (j == 4) return true; } } } return false; } pub fn score(self: Board, pick: u8) usize { var sum: usize = 0; for (self.grid) |n, i| { if (self.matches[i]) continue; sum += n; } return sum * pick; } }; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); const allocator = arena.allocator(); var input = split(u8, data, "\n\n"); var picks = split(u8, input.next().?, ","); const boards = blk: { var arraylist = std.ArrayList(?Board).init(allocator); errdefer arraylist.deinit(); while (input.next()) |rawboard| try arraylist.append(try Board.create(rawboard)); break :blk arraylist.toOwnedSlice(); }; defer allocator.free(boards); var first: ?usize = null; var last: usize = undefined; while (picks.next()) |pick_str| { const pick = try parseInt(u8, pick_str, 10); for (boards) |*board| { if (board.* != null) { board.*.?.mark(pick); if (board.*.?.bingo()) { last = board.*.?.score(pick); if (first == null) first = last; board.* = null; } } } } print("Part 1: {d}\n", .{first}); print("Part 2: {d}\n", .{last}); } // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const indexOf = std.mem.indexOfScalar; const indexOfAny = std.mem.indexOfAny; const indexOfStr = std.mem.indexOfPosLinear; const lastIndexOf = std.mem.lastIndexOfScalar; const lastIndexOfAny = std.mem.lastIndexOfAny; const lastIndexOfStr = std.mem.lastIndexOfLinear; const trim = std.mem.trim; const sliceMin = std.mem.min; const sliceMax = std.mem.max; const parseInt = std.fmt.parseInt; const parseFloat = std.fmt.parseFloat; const min = std.math.min; const min3 = std.math.min3; const max = std.math.max; const max3 = std.math.max3; const print = std.debug.print; const assert = std.debug.assert; const sort = std.sort.sort; const asc = std.sort.asc; const desc = std.sort.desc;
src/day04.zig
const bu = @import("./bits.zig"); // bits utilities const std = @import("std"); const assert = std.debug.assert; const builtin = @import("builtin"); const math = std.math; const UINT8_MAX = math.maxInt(u8); const UINT16_MAX = math.maxInt(u16); pub const MAX_HUFFMAN_SYMBOLS = 288; // Deflate uses max 288 symbols. pub const MAX_HUFFMAN_BITS = 16; // Implode uses max 16-bit codewords. pub const HUFFMAN_LOOKUP_TABLE_BITS = 8; // Seems a good trade-off. pub const Error = error{ FailedToDecode, }; const huffman_decoder_t_table: type = struct { sym: u9 = 0, // Wide enough to fit the max symbol nbr. len: u7 = 0, // 0 means no symbol. }; pub const huffman_decoder_t: type = struct { // Lookup table for fast decoding of short codewords. table: [@as(u32, 1) << HUFFMAN_LOOKUP_TABLE_BITS]huffman_decoder_t_table = [1]huffman_decoder_t_table{.{}} ** (@as(u32, 1) << HUFFMAN_LOOKUP_TABLE_BITS), // "Sentinel bits" value for each codeword length. sentinel_bits: [MAX_HUFFMAN_BITS + 1]u32 = [1]u32{0} ** (MAX_HUFFMAN_BITS + 1), // First symbol index minus first codeword mod 2**16 for each length. offset_first_sym_idx: [MAX_HUFFMAN_BITS + 1]u16 = [1]u16{0} ** (MAX_HUFFMAN_BITS + 1), // Map from symbol index to symbol. syms: [MAX_HUFFMAN_SYMBOLS]u16 = [1]u16{0} ** MAX_HUFFMAN_SYMBOLS, //num_syms: usize, // for debug }; pub const huffman_encoder_t: type = struct { codewords: [MAX_HUFFMAN_SYMBOLS]u16, // LSB-first codewords. lengths: [MAX_HUFFMAN_SYMBOLS]u8, // Codeword lengths. }; // Initialize huffman decoder d for a code defined by the n codeword lengths. // Returns false if the codeword lengths do not correspond to a valid prefix // code. pub fn huffman_decoder_init(d: *huffman_decoder_t, lengths: [*]const u8, n: usize) bool { var i: usize = 0; var count = [_]u16{0} ** (MAX_HUFFMAN_BITS + 1); var code = [_]u16{0} ** (MAX_HUFFMAN_BITS + 1); var s: u32 = 0; var sym_idx = [_]u16{0} ** (MAX_HUFFMAN_BITS + 1); var l: u5 = 0; assert(n <= MAX_HUFFMAN_SYMBOLS); // d->num_syms = n; // see huffman_decoder_t.num_syms // Zero-initialize the lookup table. for (d.table) |_, di| { d.table[di].len = 0; } // Count the number of codewords of each length. i = 0; while (i < n) : (i += 1) { assert(lengths[i] <= MAX_HUFFMAN_BITS); count[lengths[i]] += 1; } count[0] = 0; // Ignore zero-length codewords. // Compute sentinel_bits and offset_first_sym_idx for each length. code[0] = 0; sym_idx[0] = 0; l = 1; while (l <= MAX_HUFFMAN_BITS) : (l += 1) { // First canonical codeword of this length. code[l] = @intCast(u16, (code[l - 1] + count[l - 1]) << 1); if (count[l] != 0 and (code[l] + (count[l] - 1)) > (@as(u32, 1) << l) - 1) { // The last codeword is longer than l bits. return false; } s = @intCast(u32, @intCast(u32, code[l]) + @intCast(u32, count[l])) << (MAX_HUFFMAN_BITS - l); d.sentinel_bits[l] = s; assert(d.sentinel_bits[l] >= code[l]); // "No overflow!" sym_idx[l] = sym_idx[l - 1] + count[l - 1]; var sub_tmp: u16 = 0; _ = @subWithOverflow(u16, sym_idx[l], code[l], &sub_tmp); d.offset_first_sym_idx[l] = sub_tmp; } // Build mapping from index to symbol and populate the lookup table. i = 0; while (i < n) : (i += 1) { l = @intCast(u5, lengths[i]); if (l == 0) { continue; } d.syms[sym_idx[l]] = @intCast(u16, i); sym_idx[l] += 1; if (l <= HUFFMAN_LOOKUP_TABLE_BITS) { table_insert(d, i, l, code[l]); code[l] += 1; } } return true; } // Use the decoder d to decode a symbol from the LSB-first zero-padded bits. // Returns the decoded symbol number or -1 if no symbol could be decoded. // *num_used_bits will be set to the number of bits used to decode the symbol, // or zero if no symbol could be decoded. pub inline fn huffman_decode(d: *const huffman_decoder_t, bits: u16, num_used_bits: *usize) !u16 { var lookup_bits: u64 = 0; var l: u5 = 0; var sym_idx: usize = 0; // First try the lookup table. lookup_bits = bu.lsb(bits, HUFFMAN_LOOKUP_TABLE_BITS); assert(lookup_bits < d.table.len); if (d.table[lookup_bits].len != 0) { assert(d.table[lookup_bits].len <= HUFFMAN_LOOKUP_TABLE_BITS); // asserts: assert(d.table[lookup_bits].sym < d.num_syms); num_used_bits.* = d.table[lookup_bits].len; return d.table[lookup_bits].sym; } // Then do canonical decoding with the bits in MSB-first order. var bits_decoded = bu.reverse16(bits, MAX_HUFFMAN_BITS); l = HUFFMAN_LOOKUP_TABLE_BITS + 1; while (l <= MAX_HUFFMAN_BITS) : (l += 1) { if (bits_decoded < d.sentinel_bits[l]) { bits_decoded >>= @intCast(u4, MAX_HUFFMAN_BITS - l); sym_idx = @truncate(u16, @intCast(u32, d.offset_first_sym_idx[l]) + @intCast(u32, bits_decoded)); // assert(sym_idx < d.num_syms); // see huffman_decoder_t.num_syms num_used_bits.* = l; return d.syms[sym_idx]; } } num_used_bits.* = 0; return Error.FailedToDecode; } // Initialize a Huffman encoder based on the n symbol frequencies. pub fn huffman_encoder_init(e: *huffman_encoder_t, freqs: [*]const u16, n: usize, max_codeword_len: u5) void { assert(n <= MAX_HUFFMAN_SYMBOLS); assert(max_codeword_len <= MAX_HUFFMAN_BITS); compute_huffman_lengths(freqs, n, max_codeword_len, &e.lengths); compute_canonical_code(&e.codewords, &e.lengths, n); } // Initialize a Huffman encoder based on the n codeword lengths. pub fn huffman_encoder_init2(e: *huffman_encoder_t, lengths: [*]const u8, n: usize) void { var i: usize = 0; while (i < n) : (i += 1) { e.lengths[i] = lengths[i]; } compute_canonical_code(&e.codewords, &e.lengths, n); } fn table_insert(d: *huffman_decoder_t, sym: usize, len: u5, codeword: u16) void { var pad_len: u5 = 0; var padding: u32 = 0; var index: u16 = 0; assert(len <= HUFFMAN_LOOKUP_TABLE_BITS); const codeword_decoded: u32 = bu.reverse16(codeword, len); // Make it LSB-first. pad_len = HUFFMAN_LOOKUP_TABLE_BITS - len; // Pad the pad_len upper bits with all bit combinations. while (padding < (@as(u32, 1) << pad_len)) : (padding += 1) { index = @truncate(u16, codeword_decoded | (padding << len)); d.table[index].sym = @intCast(u9, sym); d.table[index].len = @intCast(u7, len); assert(d.table[index].sym == sym); // "Fits in bitfield. assert(d.table[index].len == len); // "Fits in bitfield. } } // Swap the 32-bit values pointed to by a and b. fn swap32(a: *u32, b: *u32) void { var tmp: u32 = undefined; tmp = a.*; a.* = b.*; b.* = tmp; } // Move element at index in the n-element heap down to restore the minheap property. fn minheap_down(heap: [*]u32, n: usize, index: usize) void { var left: usize = 0; var right: usize = 0; var min: usize = 0; var i: usize = index; assert(i >= 1 and i <= n); // "i must be inside the heap" // While the i-th element has at least one child. while (i * 2 <= n) { left = i * 2; right = i * 2 + 1; // Find the child with lowest value. min = left; if (right <= n and heap[right] < heap[left]) { min = right; } // Move i down if it is larger. if (heap[min] < heap[i]) { swap32(&heap[min], &heap[i]); i = min; } else { break; } } } // Establish minheap property for heap[1..n]. fn minheap_heapify(heap: [*]u32, n: usize) void { // Floyd's algorithm. var i: usize = n / 2; while (i >= 1) : (i -= 1) { minheap_down(heap, n, i); } } // Construct a Huffman code for n symbols with the frequencies in freq, and // codeword length limited to max_len. The sum of the frequencies must be <= // UINT16_MAX. max_len must be large enough that a code is always possible, // i.e. 2 ** max_len >= n. Symbols with zero frequency are not part of the code // and get length zero. Outputs the codeword lengths in lengths[0..n-1]. fn compute_huffman_lengths(freqs: [*]const u16, n: usize, max_len: u5, lengths: [*]u8) void { var nodes = [_]u32{0} ** (MAX_HUFFMAN_SYMBOLS * 2 + 1); var p: u32 = 0; var q: u32 = 0; var freq: u16 = 0; var i: usize = 0; var h: usize = 0; var l: usize = 0; var freq_cap: u16 = UINT16_MAX; if (builtin.mode == .Debug) { var freq_sum: u32 = 0; i = 0; while (i < n) : (i += 1) { freq_sum += freqs[i]; } assert(freq_sum <= UINT16_MAX); // "Frequency sum too large!" } assert(n <= MAX_HUFFMAN_SYMBOLS); assert((@as(u32, 1) << max_len) >= n); // "max_len must be large enough" var try_again = true; try_again: while (try_again) { try_again = false; // Initialize the heap. h is the heap size. h = 0; i = 0; while (i < n) : (i += 1) { freq = freqs[i]; if (freq == 0) { continue; // Ignore zero-frequency symbols. } if (freq > freq_cap) { freq = freq_cap; // Enforce the frequency cap. } // High 16 bits: Symbol frequency. // Low 16 bits: Symbol link element index. h += 1; nodes[h] = (@intCast(u32, freq) << 16) | @intCast(u32, n + h); } minheap_heapify(&nodes, h); // Special case for fewer than two non-zero symbols. if (h < 2) { i = 0; while (i < n) : (i += 1) { lengths[i] = if (freqs[i] == 0) 0 else 1; } return; } // Build the Huffman tree. while (h > 1) { // Remove the lowest frequency node p from the heap. p = nodes[1]; nodes[1] = nodes[h]; h -= 1; minheap_down(&nodes, h, 1); // Get q, the next lowest frequency node. q = nodes[1]; // Replace q with a new symbol with the combined frequencies of // p and q, and with the no longer used h+1'th node as the // link element. nodes[1] = ((p & 0xffff0000) + (q & 0xffff0000)) | @intCast(u32, h + 1); // Set the links of p and q to point to the link element of // the new node. nodes[q & 0xffff] = @intCast(u32, h + 1); nodes[p & 0xffff] = nodes[q & 0xffff]; // Move the new symbol down to restore heap property. minheap_down(&nodes, h, 1); } // Compute the codeword length for each symbol. h = 0; i = 0; while (i < n) : (i += 1) { if (freqs[i] == 0) { lengths[i] = 0; continue; } h += 1; // Link element for the i-th symbol. p = nodes[n + h]; // Follow the links until we hit the root (link index 2). l = 1; while (p != 2) { l += 1; p = nodes[p]; } if (l > max_len) { // Lower freq_cap to flatten the distribution. assert(freq_cap != 1); // "Cannot lower freq_cap!" freq_cap /= 2; try_again = true; continue :try_again; } assert(l <= UINT8_MAX); lengths[i] = @intCast(u8, l); } } } fn compute_canonical_code(codewords: [*]u16, lengths: [*]const u8, n: usize) void { var i: usize = 0; var count = [_]u16{0} ** (MAX_HUFFMAN_BITS + 1); var code = [_]u16{0} ** (MAX_HUFFMAN_BITS + 1); var l: u5 = 0; // Count the number of codewords of each length. i = 0; while (i < n) : (i += 1) { count[lengths[i]] += 1; } count[0] = 0; // Ignore zero-length codes. // Compute the first codeword for each length. code[0] = 0; l = 1; while (l <= MAX_HUFFMAN_BITS) : (l += 1) { code[l] = @truncate(u16, (@intCast(u32, code[l - 1]) + @intCast(u32, count[l - 1])) << 1); } // Assign a codeword for each symbol. i = 0; while (i < n) : (i += 1) { l = @intCast(u5, lengths[i]); if (l == 0) { continue; } codewords[i] = bu.reverse16(code[l], l); // Make it LSB-first. code[l] = @truncate(u16, @intCast(u32, code[l]) + 1); } }
src/huffman.zig
const assert = @import("std").debug.assert; const imgui = @import("../../c.zig"); pub const c = @import("c.zig"); pub const ImPlotContext = c.ImPlotContext; pub const IMPLOT_AUTO = -1; pub const IMPLOT_AUTO_COL = imgui.ImVec4{ .x = 0, .y = 0, .z = 0, .w = -1 }; pub const Point = struct { pub fn init() *c.ImPlotPoint { return c.ImPlotPoint_ImPlotPoint_Nil(); } pub fn deinit(self: *c.ImPlotPoint) void { return c.ImPlotPoint_destroy(self); } pub fn fromDouble(_x: f64, _y: f64) *c.ImPlotPoint { return c.ImPlotPoint_ImPlotPoint_double(_x, _y); } pub fn fromVec2(p: imgui.ImVec2) *c.ImPlotPoint { return c.ImPlotPoint_ImPlotPoint_Vec2(p); } }; pub const Range = struct { pub fn init() *c.ImPlotRange { return c.ImPlotRange_ImPlotRange_Nil(); } pub fn deinit(self: *c.ImPlotRange) void { return c.ImPlotRange_destroy(self); } pub fn fromDouble(_min: f64, _max: f64) *c.ImPlotRange { return c.ImPlotRange_ImPlotRange_double(_min, _max); } pub fn contains(self: *c.ImPlotRange, value: f64) bool { return c.ImPlotRange_Contains(self, value); } pub fn size(self: *c.ImPlotRange) f64 { return c.ImPlotRange_Size(self); } }; pub const BufWriter = struct { pub fn init(buffer: [*c]u8, size: c_int) [*c]c.ImBufferWriter { return c.ImBufferWriter_ImBufferWriter(buffer, size); } pub fn deinit(self: [*c]c.ImBufferWriter) void { return c.ImBufferWriter_destroy(self); } pub const write = c.ImBufferWriter_Write; }; pub const InputMap = struct { pub fn init() *c.ImPlotInputMap { return c.ImPlotInputMap_ImPlotInputMap(); } pub fn deinit(self: *c.ImPlotInputMap) void { return c.ImPlotInputMap_destroy(self); } }; pub const DateTimeFmt = struct { pub fn init(date_fmt: c.ImPlotDateFmt, time_fmt: c.ImPlotTimeFmt, use_24_hr_clk: bool, use_iso_8601: bool) *c.ImPlotDateTimeFmt { return c.ImPlotDateTimeFmt_ImPlotDateTimeFmt(date_fmt, time_fmt, use_24_hr_clk, use_iso_8601); } pub fn deinit(self: *c.ImPlotDateTimeFmt) void { return c.ImPlotDateTimeFmt_destroy(self); } }; pub const Time = struct { pub fn init() *c.ImPlotTime { return c.ImPlotTime_ImPlotTime_Nil(); } pub fn deinit(self: *c.ImPlotTime) void { return c.ImPlotTime_destroy(self); } pub fn fromTimet(s: c.time_t, us: c_int) *c.ImPlotTime { return c.ImPlotTime_ImPlotTime_time_t(s, us); } pub fn rollOver(self: *c.ImPlotTime) void { return c.ImPlotTime_RollOver(self); } pub fn toDouble(self: *c.ImPlotTime) f64 { return c.ImPlotTime_ToDouble(self); } pub fn setDouble(self: *c.ImPlotTime, t: f64) void { return c.ImPlotTime_FromDouble(self, t); } }; pub const ColorMap = struct { pub fn init() *c.ImPlotColormapData { return c.ImPlotColormapData_ImPlotColormapData(); } pub fn deinit(self: *c.ImPlotColormapData) void { return c.ImPlotColormapData_destroy(self); } pub fn append(self: *c.ImPlotColormapData, name: [*c]const u8, keys: [*c]const imgui.ImU32, count: c_int, qual: bool) c_int { return c.ImPlotColormapData_Append(self, name, keys, count, qual); } pub fn appendTable(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) void { return c.ImPlotColormapData__AppendTable(self, cmap); } pub fn rebuildTables(self: *c.ImPlotColormapData) void { return c.ImPlotColormapData_RebuildTables(self); } pub fn isQual(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) bool { return c.ImPlotColormapData_IsQual(self, cmap); } pub fn getName(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) [*c]const u8 { return c.ImPlotColormapData_GetName(self, cmap); } pub fn getIndex(self: *c.ImPlotColormapData, name: [*c]const u8) c.ImPlotColormap { return c.ImPlotColormapData_GetIndex(self, name); } pub fn getKeys(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) [*c]const imgui.ImU32 { return c.ImPlotColormapData_GetKeys(self, cmap); } pub fn getKeyCount(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) c_int { return c.ImPlotColormapData_GetKeyCount(self, cmap); } pub fn getKeyColor(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap, idx: c_int) imgui.ImU32 { return c.ImPlotColormapData_GetKeyColor(self, cmap, idx); } pub fn setKeyColor(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap, idx: c_int, value: imgui.ImU32) void { return c.ImPlotColormapData_SetKeyColor(self, cmap, idx, value); } pub fn getTable(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) [*c]const imgui.ImU32 { return c.ImPlotColormapData_GetTable(self, cmap); } pub fn getTableSize(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap) c_int { return c.ImPlotColormapData_GetTableSize(self, cmap); } pub fn getTableColor(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap, idx: c_int) imgui.ImU32 { return c.ImPlotColormapData_GetTableColor(self, cmap, idx); } pub fn lerpTable(self: *c.ImPlotColormapData, cmap: c.ImPlotColormap, t: f32) imgui.ImU32 { return c.ImPlotColormapData_LerpTable(self, cmap, t); } }; pub const PointError = struct { pub fn init(x: f64, y: f64, neg: f64, pos: f64) *c.ImPlotPointError { return c.ImPlotPointError_ImPlotPointError(x, y, neg, pos); } pub fn deinit(self: *c.ImPlotPointError) void { return c.ImPlotPointError_destroy(self); } }; pub const AnnotationCollection = struct { pub fn init() *c.ImPlotAnnotationCollection { return c.ImPlotAnnotationCollection_ImPlotAnnotationCollection(); } pub fn deinit(self: *c.ImPlotAnnotationCollection) void { return c.ImPlotAnnotationCollection_destroy(self); } pub fn append(self: *c.ImPlotAnnotationCollection, pos: imgui.ImVec2, off: imgui.ImVec2, bg: imgui.ImU32, fg: imgui.ImU32, clamp: bool, fmt: [*c]const u8) void { return c.ImPlotAnnotationCollection_Append(self, pos, off, bg, fg, clamp, fmt); } pub fn getText(self: *c.ImPlotAnnotationCollection, idx: c_int) [*c]const u8 { return c.ImPlotAnnotationCollection_GetText(self, idx); } pub fn reset(self: *c.ImPlotAnnotationCollection) void { return c.ImPlotAnnotationCollection_Reset(self); } }; pub const Tick = struct { pub fn init(value: f64, major: bool, show_label: bool) *c.ImPlotTick { return c.ImPlotTick_ImPlotTick(value, major, show_label); } pub fn deinit(self: *c.ImPlotTick) void { return c.ImPlotTick_destroy(self); } }; pub const TickCollection = struct { pub fn init() *c.ImPlotTickCollection { return c.ImPlotTickCollection_ImPlotTickCollection(); } pub fn deinit(self: *c.ImPlotTickCollection) void { return c.ImPlotTickCollection_destroy(self); } pub fn append_PlotTick(self: *c.ImPlotTickCollection, tick: c.ImPlotTick) [*c]const c.ImPlotTick { return c.ImPlotTickCollection_Append_PlotTick(self, tick); } pub fn append_double(self: *c.ImPlotTickCollection, value: f64, major: bool, show_label: bool, fmt: [*c]const u8) [*c]const c.ImPlotTick { return c.ImPlotTickCollection_Append_double(self, value, major, show_label, fmt); } pub fn getText(self: *c.ImPlotTickCollection, idx: c_int) [*c]const u8 { return c.ImPlotTickCollection_GetText(self, idx); } pub fn reset(self: *c.ImPlotTickCollection) void { return c.ImPlotTickCollection_Reset(self); } }; pub const Axis = struct { pub fn init() *c.ImPlotAxis { return c.ImPlotAxis_ImPlotAxis(); } pub fn deinit(self: *c.ImPlotAxis) void { return c.ImPlotAxis_destroy(self); } pub fn setMin(self: *c.ImPlotAxis, _min: f64, force: bool) bool { return c.ImPlotAxis_SetMin(self, _min, force); } pub fn setMax(self: *c.ImPlotAxis, _max: f64, force: bool) bool { return c.ImPlotAxis_SetMax(self, _max, force); } pub fn setRange_double(self: *c.ImPlotAxis, _min: f64, _max: f64) void { return c.ImPlotAxis_SetRange_double(self, _min, _max); } pub fn setRange_PlotRange(self: *c.ImPlotAxis, range: c.ImPlotRange) void { return c.ImPlotAxis_SetRange_PlotRange(self, range); } pub fn setAspect(self: *c.ImPlotAxis, unit_per_pix: f64) void { return c.ImPlotAxis_SetAspect(self, unit_per_pix); } pub fn getAspect(self: *c.ImPlotAxis) f64 { return c.ImPlotAxis_GetAspect(self); } pub fn constrain(self: *c.ImPlotAxis) void { return c.ImPlotAxis_Constrain(self); } pub fn isLabeled(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsLabeled(self); } pub fn isInverted(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsInverted(self); } pub fn isAutoFitting(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsAutoFitting(self); } pub fn isRangeLocked(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsRangeLocked(self); } pub fn isLockedMin(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsLockedMin(self); } pub fn isLockedMax(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsLockedMax(self); } pub fn isLocked(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsLocked(self); } pub fn isInputLockedMin(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsInputLockedMin(self); } pub fn isInputLockedMax(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsInputLockedMax(self); } pub fn isInputLocked(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsInputLocked(self); } pub fn isTime(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsTime(self); } pub fn isLog(self: *c.ImPlotAxis) bool { return c.ImPlotAxis_IsLog(self); } }; pub const AlignmentData = struct { pub fn init() *c.ImPlotAlignmentData { return c.ImPlotAlignmentData_ImPlotAlignmentData(); } pub fn deinit(self: *c.ImPlotAlignmentData) void { return c.ImPlotAlignmentData_destroy(self); } pub fn begin(self: *c.ImPlotAlignmentData) void { return c.ImPlotAlignmentData_Begin(self); } pub fn update(self: *c.ImPlotAlignmentData, pad_a: [*c]f32, pad_b: [*c]f32) void { return c.ImPlotAlignmentData_Update(self, pad_a, pad_b); } pub fn end(self: *c.ImPlotAlignmentData) void { return c.ImPlotAlignmentData_End(self); } pub fn reset(self: *c.ImPlotAlignmentData) void { return c.ImPlotAlignmentData_Reset(self); } }; pub const Item = struct { pub fn init() *c.ImPlotItem { return c.ImPlotItem_ImPlotItem(); } pub fn deinit(self: *c.ImPlotItem) void { return c.ImPlotItem_destroy(self); } }; pub const LegendData = struct { pub fn init() *c.ImPlotLegendData { return c.ImPlotLegendData_ImPlotLegendData(); } pub fn deinit(self: *c.ImPlotLegendData) void { return c.ImPlotLegendData_destroy(self); } pub fn reset(self: *c.ImPlotLegendData) void { return c.ImPlotLegendData_Reset(self); } }; pub const ItemGroup = struct { pub fn init() *c.ImPlotItemGroup { return c.ImPlotItemGroup_ImPlotItemGroup(); } pub fn deinit(self: *c.ImPlotItemGroup) void { return c.ImPlotItemGroup_destroy(self); } pub fn getItemCount(self: *c.ImPlotItemGroup) c_int { return c.ImPlotItemGroup_GetItemCount(self); } pub fn getItemID(self: *c.ImPlotItemGroup, label_id: [*c]const u8) imgui.ImGuiID { return c.ImPlotItemGroup_GetItemID(self, label_id); } pub fn getItem_ID(self: *c.ImPlotItemGroup, id: imgui.ImGuiID) *c.ImPlotItem { return c.ImPlotItemGroup_GetItem_ID(self, id); } pub fn getItem_Str(self: *c.ImPlotItemGroup, label_id: [*c]const u8) *c.ImPlotItem { return c.ImPlotItemGroup_GetItem_Str(self, label_id); } pub fn getOrAddItem(self: *c.ImPlotItemGroup, id: imgui.ImGuiID) *c.ImPlotItem { return c.ImPlotItemGroup_GetOrAddItem(self, id); } pub fn getItemByIndex(self: *c.ImPlotItemGroup, i: c_int) *c.ImPlotItem { return c.ImPlotItemGroup_GetItemByIndex(self, i); } pub fn getItemIndex(self: *c.ImPlotItemGroup, item: *c.ImPlotItem) c_int { return c.ImPlotItemGroup_GetItemIndex(self, item); } pub fn getLegendCount(self: *c.ImPlotItemGroup) c_int { return c.ImPlotItemGroup_GetLegendCount(self); } pub fn getLegendItem(self: *c.ImPlotItemGroup, i: c_int) *c.ImPlotItem { return c.ImPlotItemGroup_GetLegendItem(self, i); } pub fn getLegendLabel(self: *c.ImPlotItemGroup, i: c_int) [*c]const u8 { return c.ImPlotItemGroup_GetLegendLabel(self, i); } pub fn reset(self: *c.ImPlotItemGroup) void { return c.ImPlotItemGroup_Reset(self); } }; pub const Plot = struct { pub fn init() *c.ImPlotPlot { return c.ImPlotPlot_ImPlotPlot(); } pub fn deinit(self: *c.ImPlotPlot) void { return c.ImPlotPlot_destroy(self); } pub fn anyYInputLocked(self: *c.ImPlotPlot) bool { return c.ImPlotPlot_AnyYInputLocked(self); } pub fn allYInputLocked(self: *c.ImPlotPlot) bool { return c.ImPlotPlot_AllYInputLocked(self); } pub fn isInputLocked(self: *c.ImPlotPlot) bool { return c.ImPlotPlot_IsInputLocked(self); } }; pub const Subplot = struct { pub fn init() *c.ImPlotSubplot { return c.ImPlotSubplot_ImPlotSubplot(); } pub fn destroy(self: *c.ImPlotSubplot) void { return c.ImPlotSubplot_destroy(self); } }; pub const NextPlotData = struct { pub fn init() *c.ImPlotNextPlotData { return c.ImPlotNextPlotData_ImPlotNextPlotData(); } pub fn deinit(self: *c.ImPlotNextPlotData) void { return c.ImPlotNextPlotData_destroy(self); } pub fn reset(self: *c.ImPlotNextPlotData) void { return c.ImPlotNextPlotData_Reset(self); } }; pub const NextItem = struct { pub fn init() *c.ImPlotNextItemData { return c.ImPlotNextItemData_ImPlotNextItemData(); } pub fn deinit(self: *c.ImPlotNextItemData) void { return c.ImPlotNextItemData_destroy(self); } pub fn reset(self: *c.ImPlotNextItemData) void { return c.ImPlotNextItemData_Reset(self); } }; pub const Limits = struct { pub fn init() *c.ImPlotLimits { return c.ImPlotLimits_ImPlotLimits_Nil(); } pub fn deinit(self: *c.ImPlotLimits) void { return c.ImPlotLimits_destroy(self); } pub fn fromDoubles(x_min: f64, x_max: f64, y_min: f64, y_max: f64) *c.ImPlotLimits { return c.ImPlotLimits_ImPlotLimits_double(x_min, x_max, y_min, y_max); } pub fn contains_PlotPoInt(self: *c.ImPlotLimits, p: c.ImPlotPoint) bool { return c.ImPlotLimits_Contains_PlotPoInt(self, p); } pub fn contains_double(self: *c.ImPlotLimits, x: f64, y: f64) bool { return c.ImPlotLimits_Contains_double(self, x, y); } pub fn min(self: *c.ImPlotLimits, pOut: *c.ImPlotPoint) void { return c.ImPlotLimits_Min(pOut, self); } pub fn max(self: *c.ImPlotLimits, pOut: *c.ImPlotPoint) void { return c.ImPlotLimits_Max(pOut, self); } }; pub const Style = struct { pub fn init() *c.ImPlotStyle { return c.ImPlotStyle_ImPlotStyle(); } pub fn deinit(self: *c.ImPlotStyle) void { return c.ImPlotStyle_destroy(self); } }; // Creates a new ImPlot context. Call this after ImGui::CreateContext. pub fn createContext() *c.ImPlotContext { return c.ImPlot_CreateContext(); } // Destroys an ImPlot context. Call this before ImGui::DestroyContext. NULL = destroy current context. pub fn destroyContext(ctx: *c.ImPlotContext) void { return c.ImPlot_DestroyContext(ctx); } // Returns the current ImPlot context. NULL if no context has ben set. pub fn getCurrentContext() *c.ImPlotContext { return c.ImPlot_GetCurrentContext(); } // Sets the current ImPlot context. pub fn setCurrentContext(ctx: *c.ImPlotContext) void { return c.ImPlot_SetCurrentContext(ctx); } // Sets the current **ImGui** context. This is ONLY necessary if you are compiling // ImPlot as a DLL (not recommended) separate from your ImGui compilation. It // sets the global variable GImGui, which is not shared across DLL boundaries. // See GImGui documentation in imgui.cpp for more details. pub fn setImGuiContext(ctx: [*c]imgui.ImGuiContext) void { return c.ImPlot_SetImGuiContext(ctx); } //----------------------------------------------------------------------------- // Begin/End Plot //----------------------------------------------------------------------------- // Starts a 2D plotting context. If this function returns true, EndPlot() MUST // be called! You are encouraged to use the following convention: // // if (BeginPlot(...)) { // ImPlot::PlotLine(...); // ... // EndPlot(); // } // // Important notes: // // - #title_id must be unique to the current ImGui ID scope. If you need to avoid ID // collisions or don't want to display a title in the plot, use double hashes // (e.g. "MyPlot##HiddenIdText" or "##NoTitle"). // - If #x_label and/or #y_label are provided, axes labels will be displayed. // - #size is the **frame** size of the plot widget, not the plot area. The default // size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle // (default is 400x300 px). // - Auxiliary y-axes must be enabled with ImPlotFlags_YAxis2/3 to be displayed. // - See ImPlotFlags and ImPlotAxisFlags for more available options. pub const BeginPlotOption = struct { x_label: [*c]const u8 = null, y_label: [*c]const u8 = null, size: imgui.ImVec2 = .{ .x = -1, .y = 0 }, flags: c.ImPlotFlags = c.ImPlotFlags_None, x_flags: c.ImPlotAxisFlags = c.ImPlotAxisFlags_None, y_flags: c.ImPlotAxisFlags = c.ImPlotAxisFlags_None, y2_flags: c.ImPlotAxisFlags = c.ImPlotAxisFlags_NoGridLines, y3_flags: c.ImPlotAxisFlags = c.ImPlotAxisFlags_NoGridLines, y2_label: [*c]const u8 = null, y3_label: [*c]const u8 = null, }; pub fn beginPlot(title_id: [:0]const u8, option: BeginPlotOption) bool { return c.ImPlot_BeginPlot(title_id, option.x_label, option.y_label, option.size, option.flags, option.x_flags, option.y_flags, option.y2_flags, option.y3_flags, option.y2_label, option.y3_label); } // Only call EndPlot() if BeginPlot() returns true! Typically called at the end // of an if statement conditioned on BeginPlot(). See example above. pub fn endPlot() void { return c.ImPlot_EndPlot(); } //----------------------------------------------------------------------------- // Begin/EndSubplots //----------------------------------------------------------------------------- // Starts a subdivided plotting context. If the function returns true, // EndSubplots() MUST be called! Call BeginPlot/EndPlot AT MOST [rows*cols] // times in between the begining and end of the subplot context. Plots are // added in row major order. // // Example: // // if (BeginSubplots("My Subplot",2,3,ImVec2(800,400)) { // for (int i = 0; i < 6; ++i) { // if (BeginPlot(...)) { // ImPlot::PlotLine(...); // ... // EndPlot(); // } // } // EndSubplots(); // } // // Produces: // // [0][1][2] // [3][4][5] // // Important notes: // // - #title_id must be unique to the current ImGui ID scope. If you need to avoid ID // collisions or don't want to display a title in the plot, use double hashes // (e.g. "MyPlot##HiddenIdText" or "##NoTitle"). // - #rows and #cols must be greater than 0. // - #size is the size of the entire grid of subplots, not the individual plots // - #row_ratios and #col_ratios must have AT LEAST #rows and #cols elements, // respectively. These are the sizes of the rows and columns expressed in ratios. // If the user adjusts the dimensions, the arrays are updated with new ratios. // // Important notes regarding BeginPlot from inside of BeginSubplots: // // - The #title_id parameter of _BeginPlot_ (see above) does NOT have to be // unique when called inside of a subplot context. Subplot IDs are hashed // for your convenience so you don't have call PushID or generate unique title // strings. Simply pass an empty string to BeginPlot unless you want to title // each subplot. // - The #size parameter of _BeginPlot_ (see above) is ignored when inside of a // subplot context. The actual size of the subplot will be based on the // #size value you pass to _BeginSubplots_ and #row/#col_ratios if provided. pub const BeginSubplotsOption = struct { flags: c.ImPlotSubplotFlags = c.ImPlotSubplotFlags_None, row_ratios: [*c]f32 = null, col_ratios: [*c]f32 = null, }; pub fn beginSubplots(title_id: [:0]const u8, rows: c_int, cols: c_int, size: imgui.ImVec2, option: BeginSubplotsOption) bool { return c.ImPlot_BeginSubplots(title_id, rows, cols, size, option.flags, option.row_ratios, option.col_ratios); } // Only call EndSubplots() if BeginSubplots() returns true! Typically called at the end // of an if statement conditioned on BeginSublots(). See example above. pub fn endSubplots() void { return c.ImPlot_EndSubplots(); } //----------------------------------------------------------------------------- // Plot Items //----------------------------------------------------------------------------- // The template functions below are explicitly instantiated in implot_items.cpp. // They are not intended to be used generically with custom types. You will get // a linker error if you try! All functions support the following scalar types: // // float, double, ImS8, ImU8, ImS16, ImU16, ImS32, ImU32, ImS64, ImU64 // // // If you need to plot custom or non-homogenous data you have a few options: // // 1. If your data is a simple struct/class (e.g. Vector2f), you can use striding. // This is the most performant option if applicable. // // struct Vector2f { float X, Y; }; // ... // Vector2f data[42]; // ImPlot::PlotLine("line", &data[0].x, &data[0].y, 42, 0, sizeof(Vector2f)); // or sizeof(float)*2 // // 2. Write a custom getter C function or C++ lambda and pass it and optionally your data to // an ImPlot function post-fixed with a G (e.g. PlotScatterG). This has a slight performance // cost, but probably not enough to worry about unless your data is very large. Examples: // // ImPlotPoint MyDataGetter(void* data, int idx) { // MyData* my_data = (MyData*)data; // ImPlotPoint p; // p.x = my_data->GetTime(idx); // p.y = my_data->GetValue(idx); // return p // } // ... // auto my_lambda = [](void*, int idx) { // double t = idx / 999.0; // return ImPlotPoint(t, 0.5+0.5*std::sin(2*PI*10*t)); // }; // ... // if (ImPlot::BeginPlot("MyPlot")) { // MyData my_data; // ImPlot::PlotScatterG("scatter", MyDataGetter, &my_data, my_data.Size()); // ImPlot::PlotLineG("line", my_lambda, nullptr, 1000); // ImPlot::EndPlot(); // } // // NB: All types are converted to double before plotting. You may lose information // if you try plotting extremely large 64-bit integral types. Proceed with caution! // Plots a standard 2D line plot. pub const PlotLineOption = struct { xscale: f64 = 1, x0: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotLine_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotLineOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotLine_FloatPtrInt, f64 => c.ImPlot_PlotLine_doublePtrInt, i8 => c.ImPlot_PlotLine_S8PtrInt, u8 => c.ImPlot_PlotLine_U8PtrInt, i16 => c.ImPlot_PlotLine_S16PtrInt, u16 => c.ImPlot_PlotLine_U16PtrInt, i32 => c.ImPlot_PlotLine_S32PtrInt, u32 => c.ImPlot_PlotLine_U32PtrInt, i64 => c.ImPlot_PlotLine_S64PtrInt, u64 => c.ImPlot_PlotLine_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotLine_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotLineOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotLine_FloatPtrFloatPtr, f64 => c.ImPlot_PlotLine_doublePtrdoublePtr, i8 => c.ImPlot_PlotLine_S8PtrS8Ptr, u8 => c.ImPlot_PlotLine_U8PtrU8Ptr, i16 => c.ImPlot_PlotLine_S16PtrS16Ptr, u16 => c.ImPlot_PlotLine_U16PtrU16Ptr, i32 => c.ImPlot_PlotLine_S32PtrS32Ptr, u32 => c.ImPlot_PlotLine_U32PtrU32Ptr, i64 => c.ImPlot_PlotLine_S64PtrS64Ptr, u64 => c.ImPlot_PlotLine_U64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotLineG(label_id: [:0]const u8, getter: c.ImPlotPoint_getter, data: ?*anyopaque, count: c_int) void { return c.ImPlot_PlotLineG(label_id, getter, data, count); } // Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle. pub const PlotScatterOption = struct { xscale: f64 = 1, x0: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotScatter_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotScatterOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotScatter_FloatPtrInt, f64 => c.ImPlot_PlotScatter_doublePtrInt, i8 => c.ImPlot_PlotScatter_S8PtrInt, u8 => c.ImPlot_PlotScatter_U8PtrInt, i16 => c.ImPlot_PlotScatter_S16PtrInt, u16 => c.ImPlot_PlotScatter_U16PtrInt, i32 => c.ImPlot_PlotScatter_S32PtrInt, u32 => c.ImPlot_PlotScatter_U32PtrInt, i64 => c.ImPlot_PlotScatter_S64PtrInt, u64 => c.ImPlot_PlotScatter_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotScatter_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotScatterOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotScatter_FloatPtrFloatPtr, f64 => c.ImPlot_PlotScatter_doublePtrdoublePtr, i8 => c.ImPlot_PlotScatter_S8PtrS8Ptr, u8 => c.ImPlot_PlotScatter_U8PtrU8Ptr, i16 => c.ImPlot_PlotScatter_S16PtrS16Ptr, u16 => c.ImPlot_PlotScatter_U16PtrU16Ptr, i32 => c.ImPlot_PlotScatter_S32PtrS32Ptr, u32 => c.ImPlot_PlotScatter_U32PtrU32Ptr, i64 => c.ImPlot_PlotScatter_S64PtrS64Ptr, u64 => c.ImPlot_PlotScatter_U64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotScatterG(label_id: [:0]const u8, getter: c.ImPlotPoint_getter, data: ?*anyopaque, count: c_int) void { return c.ImPlot_PlotScatterG(label_id, getter, data, count); } // Plots a a stairstep graph. The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]. pub const PlotStairsOption = struct { xscale: f64 = 1, x0: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotStairs_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotScatterOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotStairs_FloatPtrInt, f64 => c.ImPlot_PlotStairs_doublePtrInt, i8 => c.ImPlot_PlotStairs_S8PtrInt, u8 => c.ImPlot_PlotStairs_U8PtrInt, i16 => c.ImPlot_PlotStairs_S16PtrInt, u16 => c.ImPlot_PlotStairs_U16PtrInt, i32 => c.ImPlot_PlotStairs_S32PtrInt, u32 => c.ImPlot_PlotStairs_U32PtrInt, i64 => c.ImPlot_PlotStairs_S64PtrInt, u64 => c.ImPlot_PlotStairs_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotStairs_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotStairsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotStairs_FloatPtrFloatPtr, f64 => c.ImPlot_PlotStairs_doublePtrdoublePtr, i8 => c.ImPlot_PlotStairs_S8PtrS8Ptr, u8 => c.ImPlot_PlotStairs_U8PtrU8Ptr, i16 => c.ImPlot_PlotStairs_S16PtrS16Ptr, u16 => c.ImPlot_PlotStairs_U16PtrU16Ptr, i32 => c.ImPlot_PlotStairs_S32PtrS32Ptr, u32 => c.ImPlot_PlotStairs_U32PtrU32Ptr, i64 => c.ImPlot_PlotStairs_S64PtrS64Ptr, u64 => c.ImPlot_PlotStairs_U64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotStairsG(label_id: [:0]const u8, getter: ?fn (?*anyopaque, c_int) callconv(.C) c.ImPlotPoint, data: ?*anyopaque, count: c_int) void { return c.ImPlot_PlotStairsG(label_id, getter, data, count); } // Plots a shaded (filled) region between two lines, or a line and a horizontal reference. Set y_ref to +/-INFINITY for infinite fill extents. pub const PlotShadedOption = struct { y_ref: f64 = 0, xscale: f64 = 1, x0: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotShaded_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotShadedOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotShaded_FloatPtrInt, f64 => c.ImPlot_PlotShaded_doublePtrInt, i8 => c.ImPlot_PlotShaded_S8PtrInt, u8 => c.ImPlot_PlotShaded_U8PtrInt, i16 => c.ImPlot_PlotShaded_S16PtrInt, u16 => c.ImPlot_PlotShaded_U16PtrInt, i32 => c.ImPlot_PlotShaded_S32PtrInt, u32 => c.ImPlot_PlotShaded_U32PtrInt, i64 => c.ImPlot_PlotShaded_S64PtrInt, u64 => c.ImPlot_PlotShaded_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.y_ref, option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotShaded_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotShadedOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotShaded_FloatPtrFloatPtrInt, f64 => c.ImPlot_PlotShaded_doublePtrdoublePtrInt, i8 => c.ImPlot_PlotShaded_S8PtrS8PtrInt, u8 => c.ImPlot_PlotShaded_U8PtrU8PtrInt, i16 => c.ImPlot_PlotShaded_S16PtrS16PtrInt, u16 => c.ImPlot_PlotShaded_U16PtrU16PtrInt, i32 => c.ImPlot_PlotShaded_S32PtrS32PtrInt, u32 => c.ImPlot_PlotShaded_U32PtrU32PtrInt, i64 => c.ImPlot_PlotShaded_S64PtrS64PtrInt, u64 => c.ImPlot_PlotShaded_U64PtrU64PtrInt, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.y_ref, option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotShaded_PtrPtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys1: [*c]const T, ys2: [*c]const T, count: u32, option: PlotShadedOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotShaded_FloatPtrFloatPtrFloatPtr, f64 => c.ImPlot_PlotShaded_doublePtrdoublePtrdoublePtr, i8 => c.ImPlot_PlotShaded_S8PtrS8PtrS8Ptr, u8 => c.ImPlot_PlotShaded_U8PtrU8PtrU8Ptr, i16 => c.ImPlot_PlotShaded_S16PtrS16PtrS16Ptr, u16 => c.ImPlot_PlotShaded_U16PtrU16PtrU16Ptr, i32 => c.ImPlot_PlotShaded_S32PtrS32PtrS32Ptr, u32 => c.ImPlot_PlotShaded_U32PtrU32PtrU32Ptr, i64 => c.ImPlot_PlotShaded_S64PtrS64PtrS64Ptr, u64 => c.ImPlot_PlotShaded_U64PtrU64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys1, ys2, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 3, ); } pub fn plotShadedG(label_id: [:0]const u8, getter1: c.ImPlotPoint_getter, data1: ?*anyopaque, getter2: c.ImPlotPoint_getter, data2: ?*anyopaque, count: c_int) void { return c.ImPlot_PlotShadedG(label_id, getter1, data1, getter2, data2, count); } // Plots a vertical bar graph. #width and #shift are in X units. pub const PlotBarsOption = struct { width: f64 = 0.67, shift: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotBars_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotBarsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotBars_FloatPtrInt, f64 => c.ImPlot_PlotBars_doublePtrInt, i8 => c.ImPlot_PlotBars_S8PtrInt, u8 => c.ImPlot_PlotBars_U8PtrInt, i16 => c.ImPlot_PlotBars_S16PtrInt, u16 => c.ImPlot_PlotBars_U16PtrInt, i32 => c.ImPlot_PlotBars_S32PtrInt, u32 => c.ImPlot_PlotBars_U32PtrInt, i64 => c.ImPlot_PlotBars_S64PtrInt, u64 => c.ImPlot_PlotBars_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.width, option.shift, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotBars_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotBarsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotBars_FloatPtrFloatPtr, f64 => c.ImPlot_PlotBars_doublePtrdoublePtr, i8 => c.ImPlot_PlotBars_S8PtrS8Ptr, u8 => c.ImPlot_PlotBars_U8PtrU8Ptr, i16 => c.ImPlot_PlotBars_S16PtrS16Ptr, u16 => c.ImPlot_PlotBars_U16PtrU16Ptr, i32 => c.ImPlot_PlotBars_S32PtrS32Ptr, u32 => c.ImPlot_PlotBars_U32PtrU32Ptr, i64 => c.ImPlot_PlotBars_S64PtrS64Ptr, u64 => c.ImPlot_PlotBars_U64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.width, option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotBarsG(label_id: [:0]const u8, getter: c.ImPlotPoint_getter, data: ?*anyopaque, count: c_int, width: f64) void { return c.ImPlot_PlotBarsG(label_id, getter, data, count, width); } // Plots a horizontal bar graph. #height and #shift are in Y units. pub const PlotBarsHOption = struct { height: f64 = 0.67, shift: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotBarsH_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotBarsHOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotBarsH_FloatPtrInt, f64 => c.ImPlot_PlotBarsH_doublePtrInt, i8 => c.ImPlot_PlotBarsH_S8PtrInt, u8 => c.ImPlot_PlotBarsH_U8PtrInt, i16 => c.ImPlot_PlotBarsH_S16PtrInt, u16 => c.ImPlot_PlotBarsH_U16PtrInt, i32 => c.ImPlot_PlotBarsH_S32PtrInt, u32 => c.ImPlot_PlotBarsH_U32PtrInt, i64 => c.ImPlot_PlotBarsH_S64PtrInt, u64 => c.ImPlot_PlotBarsH_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.height, option.shift, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotBarsH_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotBarsHOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotBarsH_FloatPtrFloatPtr, f64 => c.ImPlot_PlotBarsH_doublePtrdoublePtr, i8 => c.ImPlot_PlotBarsH_S8PtrS8Ptr, u8 => c.ImPlot_PlotBarsH_U8PtrU8Ptr, i16 => c.ImPlot_PlotBarsH_S16PtrS16Ptr, u16 => c.ImPlot_PlotBarsH_U16PtrU16Ptr, i32 => c.ImPlot_PlotBarsH_S32PtrS32Ptr, u32 => c.ImPlot_PlotBarsH_U32PtrU32Ptr, i64 => c.ImPlot_PlotBarsH_S64PtrS64Ptr, u64 => c.ImPlot_PlotBarsH_U64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.height, option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotBarsHG(label_id: [:0]const u8, getter: c.ImPlotPoint_getter, data: ?*anyopaque, count: c_int, height: f64) void { return c.ImPlot_PlotBarsHG(label_id, getter, data, count, height); } // Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot. pub const PlotErrorBarsOption = struct { offset: c_int = 0, stride: ?c_int = null, }; pub fn plotErrorBars_PtrPtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, err: [*c]const T, count: u32, option: PlotErrorBarsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotErrorBars_FloatPtrFloatPtrFloatPtrInt, f64 => c.ImPlot_PlotErrorBars_doublePtrdoublePtrdoublePtrInt, i8 => c.ImPlot_PlotErrorBars_S8PtrS8PtrS8PtrInt, u8 => c.ImPlot_PlotErrorBars_U8PtrU8PtrU8PtrInt, i16 => c.ImPlot_PlotErrorBars_S16PtrS16PtrS16PtrInt, u16 => c.ImPlot_PlotErrorBars_U16PtrU16PtrU16PtrInt, i32 => c.ImPlot_PlotErrorBars_S32PtrS32PtrS32PtrInt, u32 => c.ImPlot_PlotErrorBars_U32PtrU32PtrU32PtrInt, i64 => c.ImPlot_PlotErrorBars_S64PtrS64PtrS64PtrInt, u64 => c.ImPlot_PlotErrorBars_U64PtrU64PtrU64PtrInt, else => unreachable, }; plotFn( label_id, xs, ys, err, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 3, ); } pub fn plotErrorBars_PtrPtrPtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, neg: [*c]const T, pos: [*c]const T, count: u32, option: PlotErrorBarsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotErrorBars_FloatPtrFloatPtrFloatPtrFloatPtr, f64 => c.ImPlot_PlotErrorBars_doublePtrdoublePtrdoublePtrdoublePtr, i8 => c.ImPlot_PlotErrorBars_S8PtrS8PtrS8PtrS8Ptr, u8 => c.ImPlot_PlotErrorBars_U8PtrU8PtrU8PtrU8Ptr, i16 => c.ImPlot_PlotErrorBars_S16PtrS16PtrS16PtrS16Ptr, u16 => c.ImPlot_PlotErrorBars_U16PtrU16PtrU16PtrU16Ptr, i32 => c.ImPlot_PlotErrorBars_S32PtrS32PtrS32PtrS32Ptr, u32 => c.ImPlot_PlotErrorBars_U32PtrU32PtrU32PtrU32Ptr, i64 => c.ImPlot_PlotErrorBars_S64PtrS64PtrS64PtrS64Ptr, u64 => c.ImPlot_PlotErrorBars_U64PtrU64PtrU64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, neg, pos, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 4, ); } // Plots horizontal error bars. The label_id should be the same as the label_id of the associated line or bar plot. pub const PlotErrorBarsHOption = struct { offset: c_int = 0, stride: ?c_int = null, }; pub fn plotErrorBarsH_PtrPtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, err: [*c]const T, count: u32, option: PlotErrorBarsHOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotErrorBarsH_FloatPtrFloatPtrFloatPtrInt, f64 => c.ImPlot_PlotErrorBarsH_doublePtrdoublePtrdoublePtrInt, i8 => c.ImPlot_PlotErrorBarsH_S8PtrS8PtrS8PtrInt, u8 => c.ImPlot_PlotErrorBarsH_U8PtrU8PtrU8PtrInt, i16 => c.ImPlot_PlotErrorBarsH_S16PtrS16PtrS16PtrInt, u16 => c.ImPlot_PlotErrorBarsH_U16PtrU16PtrU16PtrInt, i32 => c.ImPlot_PlotErrorBarsH_S32PtrS32PtrS32PtrInt, u32 => c.ImPlot_PlotErrorBarsH_U32PtrU32PtrU32PtrInt, i64 => c.ImPlot_PlotErrorBarsH_S64PtrS64PtrS64PtrInt, u64 => c.ImPlot_PlotErrorBarsH_U64PtrU64PtrU64PtrInt, else => unreachable, }; plotFn( label_id, xs, ys, err, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 3, ); } pub fn plotErrorBarsH_PtrPtrPtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, neg: [*c]const T, pos: [*c]const T, count: u32, option: PlotErrorBarsHOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotErrorBarsH_FloatPtrFloatPtrFloatPtrFloatPtr, f64 => c.ImPlot_PlotErrorBarsH_doublePtrdoublePtrdoublePtrdoublePtr, i8 => c.ImPlot_PlotErrorBarsH_S8PtrS8PtrS8PtrS8Ptr, u8 => c.ImPlot_PlotErrorBarsH_U8PtrU8PtrU8PtrU8Ptr, i16 => c.ImPlot_PlotErrorBarsH_S16PtrS16PtrS16PtrS16Ptr, u16 => c.ImPlot_PlotErrorBarsH_U16PtrU16PtrU16PtrU16Ptr, i32 => c.ImPlot_PlotErrorBarsH_S32PtrS32PtrS32PtrS32Ptr, u32 => c.ImPlot_PlotErrorBarsH_U32PtrU32PtrU32PtrU32Ptr, i64 => c.ImPlot_PlotErrorBarsH_S64PtrS64PtrS64PtrS64Ptr, u64 => c.ImPlot_PlotErrorBarsH_U64PtrU64PtrU64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, neg, pos, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 4, ); } // Plots vertical stems. pub const PlotStemsOption = struct { y_ref: f64 = 0, xscale: f64 = 1, x0: f64 = 0, offset: c_int = 0, stride: ?c_int = null, }; pub fn plotStems_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotStemsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotStems_FloatPtrInt, f64 => c.ImPlot_PlotStems_doublePtrInt, i8 => c.ImPlot_PlotStems_S8PtrInt, u8 => c.ImPlot_PlotStems_U8PtrInt, i16 => c.ImPlot_PlotStems_S16PtrInt, u16 => c.ImPlot_PlotStems_U16PtrInt, i32 => c.ImPlot_PlotStems_S32PtrInt, u32 => c.ImPlot_PlotStems_U32PtrInt, i64 => c.ImPlot_PlotStems_S64PtrInt, u64 => c.ImPlot_PlotStems_U64PtrInt, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.y_ref, option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotStems_PtrPtr(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotStemsOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotStems_FloatPtrFloatPtr, f64 => c.ImPlot_PlotStems_doublePtrdoublePtr, i8 => c.ImPlot_PlotStems_S8PtrS8Ptr, u8 => c.ImPlot_PlotStems_U8PtrU8Ptr, i16 => c.ImPlot_PlotStems_S16PtrS16Ptr, u16 => c.ImPlot_PlotStems_U16PtrU16Ptr, i32 => c.ImPlot_PlotStems_S32PtrS32Ptr, u32 => c.ImPlot_PlotStems_U32PtrU32Ptr, i64 => c.ImPlot_PlotStems_S64PtrS64Ptr, u64 => c.ImPlot_PlotStems_U64PtrU64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.y_ref, option.offset, option.stride orelse @sizeOf(T) * 2, ); } // Plots infinite vertical or horizontal lines (e.g. for references or asymptotes). pub const PlotVHLinesOption = struct { offset: c_int = 0, stride: ?c_int = null, }; pub fn plotVLines_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotVHLinesOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotVLines_FloatPtr, f64 => c.ImPlot_PlotVLines_doublePtr, i8 => c.ImPlot_PlotVLines_S8Ptr, u8 => c.ImPlot_PlotVLines_U8Ptr, i16 => c.ImPlot_PlotVLines_S16Ptr, u16 => c.ImPlot_PlotVLines_U16Ptr, i32 => c.ImPlot_PlotVLines_S32Ptr, u32 => c.ImPlot_PlotVLines_U32Ptr, i64 => c.ImPlot_PlotVLines_S64Ptr, u64 => c.ImPlot_PlotVLines_U64Ptr, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.y_ref, option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } pub fn plotHLines_Ptr(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotVHLinesOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotHLines_FloatPtr, f64 => c.ImPlot_PlotHLines_doublePtr, i8 => c.ImPlot_PlotHLines_S8Ptr, u8 => c.ImPlot_PlotHLines_U8Ptr, i16 => c.ImPlot_PlotHLines_S16Ptr, u16 => c.ImPlot_PlotHLines_U16Ptr, i32 => c.ImPlot_PlotHLines_S32Ptr, u32 => c.ImPlot_PlotHLines_U32Ptr, i64 => c.ImPlot_PlotHLines_S64Ptr, u64 => c.ImPlot_PlotHLines_U64Ptr, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.y_ref, option.xscale, option.x0, option.offset, option.stride orelse @sizeOf(T), ); } // Plots a pie chart. If the sum of values > 1 or normalize is true, each value will be normalized. Center and radius are in plot units. #label_fmt can be set to NULL for no labels. pub const PlotPieChartOption = struct { normalized: bool = false, label_fmt: [:0]const u8 = "%.1f", angle0: f64 = 90, }; pub fn plotPieChart(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, x: f64, y: f64, radius: f64, option: PlotPieChartOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotPieChart_FloatPtr, f64 => c.ImPlot_PlotPieChart_doublePtr, i8 => c.ImPlot_PlotPieChart_S8Ptr, u8 => c.ImPlot_PlotPieChart_U8Ptr, i16 => c.ImPlot_PlotPieChart_S16Ptr, u16 => c.ImPlot_PlotPieChart_U16Ptr, i32 => c.ImPlot_PlotPieChart_S32Ptr, u32 => c.ImPlot_PlotPieChart_U32Ptr, i64 => c.ImPlot_PlotPieChart_S64Ptr, u64 => c.ImPlot_PlotPieChart_U64Ptr, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), x, y, radius, option.normalized, option.label_fmt, option.angle0, ); } // Plots a 2D heatmap chart. Values are expected to be in row-major order. Leave #scale_min and scale_max both at 0 for automatic color scaling, or set them to a predefined range. #label_fmt can be set to NULL for no labels. pub const PlotHeatmapOption = struct { scale_min: f64 = 0, scale_max: f64 = 0, label_fmt: [:0]const u8 = "%.1f", bounds_min: c.ImPlotPoint = .{ .x = 0, .y = 0 }, bounds_max: c.ImPlotPoint = .{ .x = 1, .y = 1 }, }; pub fn plotHeatmap(label_id: [:0]const u8, comptime T: type, values: [*]const T, rows: u32, cols: u32, option: PlotHeatmapOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotHeatmap_FloatPtr, f64 => c.ImPlot_PlotHeatmap_doublePtr, i8 => c.ImPlot_PlotHeatmap_S8Ptr, u8 => c.ImPlot_PlotHeatmap_U8Ptr, i16 => c.ImPlot_PlotHeatmap_S16Ptr, u16 => c.ImPlot_PlotHeatmap_U16Ptr, i32 => c.ImPlot_PlotHeatmap_S32Ptr, u32 => c.ImPlot_PlotHeatmap_U32Ptr, i64 => c.ImPlot_PlotHeatmap_S64Ptr, u64 => c.ImPlot_PlotHeatmap_U64Ptr, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, rows), @intCast(c_int, cols), option.scale_min, option.scale_max, option.label_fmt, option.bounds_min, option.bounds_max, ); } // Plots a horizontal histogram. #bins can be a positive integer or an ImPlotBin_ method. If #cumulative is true, each bin contains its count plus the counts of all previous bins. // If #density is true, the PDF is visualized. If both are true, the CDF is visualized. If #range is left unspecified, the min/max of #values will be used as the range. // If #range is specified, outlier values outside of the range are not binned. However, outliers still count toward normalizing and cumulative counts unless #outliers is false. The largest bin count or density is returned. pub const PlotHistogramOption = struct { bins: c_int = c.ImPlotBin_Sturges, cumulative: bool = false, density: bool = false, range: c.ImPlotRange = .{ .x = 0, .y = 0 }, outlier: bool = true, bar_scale: f64 = 1.0, }; pub fn plotHistogram(label_id: [:0]const u8, comptime T: type, values: [*c]const T, count: u32, option: PlotHistogramOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotHistogram_FloatPtr, f64 => c.ImPlot_PlotHistogram_doublePtr, i8 => c.ImPlot_PlotHistogram_S8Ptr, u8 => c.ImPlot_PlotHistogram_U8Ptr, i16 => c.ImPlot_PlotHistogram_S16Ptr, u16 => c.ImPlot_PlotHistogram_U16Ptr, i32 => c.ImPlot_PlotHistogram_S32Ptr, u32 => c.ImPlot_PlotHistogram_U32Ptr, i64 => c.ImPlot_PlotHistogram_S64Ptr, u64 => c.ImPlot_PlotHistogram_U64Ptr, else => unreachable, }; plotFn( label_id, values, @intCast(c_int, count), option.bins, option.cumulative, option.density, option.range, option.outlier, option.bar_scale, ); } // Plots two dimensional, bivariate histogram as a heatmap. #x_bins and #y_bins can be a positive integer or an ImPlotBin. If #density is true, the PDF is visualized. // If #range is left unspecified, the min/max of #xs an #ys will be used as the ranges. If #range is specified, outlier values outside of range are not binned. // However, outliers still count toward the normalizing count for density plots unless #outliers is false. The largest bin count or density is returned. pub const PlotHistogram2DOption = struct { x_bins: c_int = c.ImPlotBin_Sturges, y_bins: c_int = c.ImPlotBin_Sturges, density: bool = false, range: c.ImPlotRange = .{ .x = 0, .y = 0 }, outlier: bool = true, }; pub fn plotHistogram2D(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotHistogram2DOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotHistogram2D_FloatPtr, f64 => c.ImPlot_PlotHistogram2D_doublePtr, i8 => c.ImPlot_PlotHistogram2D_S8Ptr, u8 => c.ImPlot_PlotHistogram2D_U8Ptr, i16 => c.ImPlot_PlotHistogram2D_S16Ptr, u16 => c.ImPlot_PlotHistogram2D_U16Ptr, i32 => c.ImPlot_PlotHistogram2D_S32Ptr, u32 => c.ImPlot_PlotHistogram2D_U32Ptr, i64 => c.ImPlot_PlotHistogram2D_S64Ptr, u64 => c.ImPlot_PlotHistogram2D_U64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.x_bins, option.y_bins, option.density, option.range, option.outlier, ); } // Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot. pub const PlotDigitalOption = struct { offset: c_int = 0, stride: ?c_int = null, }; pub fn plotDigital(label_id: [:0]const u8, comptime T: type, xs: [*c]const T, ys: [*c]const T, count: u32, option: PlotDigitalOption) void { const plotFn = switch (T) { f32 => c.ImPlot_PlotDigital_FloatPtr, f64 => c.ImPlot_PlotDigital_doublePtr, i8 => c.ImPlot_PlotDigital_S8Ptr, u8 => c.ImPlot_PlotDigital_U8Ptr, i16 => c.ImPlot_PlotDigital_S16Ptr, u16 => c.ImPlot_PlotDigital_U16Ptr, i32 => c.ImPlot_PlotDigital_S32Ptr, u32 => c.ImPlot_PlotDigital_U32Ptr, i64 => c.ImPlot_PlotDigital_S64Ptr, u64 => c.ImPlot_PlotDigital_U64Ptr, else => unreachable, }; plotFn( label_id, xs, ys, @intCast(c_int, count), option.offset, option.stride orelse @sizeOf(T) * 2, ); } pub fn plotDigitalG(label_id: [*c]const u8, getter: c.ImPlotPoint_getter, data: ?*anyopaque, count: c_int) void { return c.ImPlot_PlotDigitalG(label_id, getter, data, count); } // Plots an axis-aligned image. #bounds_min/bounds_max are in plot coordinates (y-up) and #uv0/uv1 are in texture coordinates (y-down). pub const PlotImageOption = struct { uv0: imgui.ImVec2 = .{ .x = 0, .y = 0 }, uv1: imgui.ImVec2 = .{ .x = 1, .y = 1 }, tint_col: imgui.ImVec4 = .{ .x = 1, .y = 1, .z = 1, .w = 1 }, }; pub fn plotImage(label_id: [:0]const u8, user_texture_id: imgui.ImTextureID, bounds_min: c.ImPlotPoint, bounds_max: c.ImPlotPoint, option: PlotImageOption) void { return c.ImPlot_PlotImage( label_id, user_texture_id, bounds_min, bounds_max, option.uv0, option.uv1, option.tint_col, ); } // Plots a centered text label at point x,y with an optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...). pub const PlotTextOption = struct { vertical: bool = false, pix_offset: imgui.ImVec2 = .{ .x = 0, .y = 0 }, }; pub fn plotText(text: [:0]const u8, x: f64, y: f64, option: PlotTextOption) void { return c.ImPlot_PlotText(text, x, y, option.vertical, option.pix_offset); } // Plots a dummy item (i.e. adds a legend entry colored by ImPlotCol_Line) pub fn plotDummy(label_id: [:0]const u8) void { return c.ImPlot_PlotDummy(label_id); } //----------------------------------------------------------------------------- // Plot Utils //----------------------------------------------------------------------------- ////// The following functions MUST be called BEFORE BeginPlot! // Set the axes range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the axes limits will be locked. pub fn setNextPlotLimits(xmin: f64, xmax: f64, ymin: f64, ymax: f64, cond: ?imgui.ImGuiCond) void { return c.ImPlot_SetNextPlotLimits(xmin, xmax, ymin, ymax, cond orelse imgui.ImGuiCond_Once); } // Set the X axis range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the X axis limits will be locked. pub fn setNextPlotLimitsX(xmin: f64, xmax: f64, cond: ?imgui.ImGuiCond) void { return c.ImPlot_SetNextPlotLimitsX(xmin, xmax, cond orelse imgui.ImGuiCond_Once); } // Set the Y axis range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the Y axis limits will be locked. pub const SetNextPlotLimitsYOption = struct { cond: imgui.ImGuiCond = imgui.ImGuiCond_Once, y_axis: c.ImPlotYAxis = c.ImPlotYAxis_1, }; pub fn setNextPlotLimitsY(ymin: f64, ymax: f64, option: SetNextPlotLimitsYOption) void { return c.ImPlot_SetNextPlotLimitsY( ymin, ymax, option.cond, option.y_axis, ); } // Links the next plot limits to external values. Set to NULL for no linkage. The pointer data must remain valid until the matching call to EndPlot. pub const LinkNextPlotLimitsOption = struct { ymin2: [*c]f64 = null, ymax2: [*c]f64 = null, ymin3: [*c]f64 = null, ymax3: [*c]f64 = null, }; pub fn linkNextPlotLimits(xmin: [*c]f64, xmax: [*c]f64, ymin: [*c]f64, ymax: [*c]f64, option: LinkNextPlotLimitsOption) void { return c.ImPlot_LinkNextPlotLimits( xmin, xmax, ymin, ymax, option.ymin2, option.ymax2, option.ymin3, option.ymax3, ); } // Fits the next plot axes to all plotted data if they are unlocked (equivalent to double-clicks). pub const FitNextPlotAxes = struct { x: bool = true, y: bool = true, y2: bool = true, y3: bool = true, }; pub fn fitNextPlotAxes(option: FitNextPlotAxes) void { return c.ImPlot_FitNextPlotAxes(option.x, option.y, option.y2, option.y3); } // Set the X axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true. pub const SetNextPlotTicksXOption = struct { labels: [*c]const [*c]const u8 = null, keep_default: bool = false, }; pub fn setNextPlotTicksX_doublePtr(values: [*c]const f64, n_ticks: c_int, option: SetNextPlotTicksXOption) void { return c.ImPlot_SetNextPlotTicksX_doublePtr(values, n_ticks, option.labels, option.keep_default); } pub fn setNextPlotTicksX_double(x_min: f64, x_max: f64, n_ticks: c_int, option: SetNextPlotTicksXOption) void { return c.ImPlot_SetNextPlotTicksX_double(x_min, x_max, n_ticks, option.labels, option.keep_default); } // Set the Y axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true. pub const SetNextPlotTicksYOption = struct { labels: [*c]const [*c]const u8 = null, keep_default: bool = false, y_axis: c.ImPlotYAxis = c.ImPlotYAxis_1, }; pub fn setNextPlotTicksY_doublePtr(values: [*c]const f64, n_ticks: c_int, option: SetNextPlotTicksYOption) void { return c.ImPlot_SetNextPlotTicksY_doublePtr(values, n_ticks, option.labels, option.keep_default, option.y_axis); } pub fn setNextPlotTicksY_double(y_min: f64, y_max: f64, n_ticks: c_int, option: SetNextPlotTicksYOption) void { return c.ImPlot_SetNextPlotTicksY_double(y_min, y_max, n_ticks, option.labels, option.keep_default, option.y_axis); } // Set the format for numeric X axis labels (default="%g"). Formated values will be doubles (i.e. don't supply %d, %i, etc.). Not applicable if ImPlotAxisFlags_Time enabled. pub fn setNextPlotFormatX(fmt: [:0]const u8) void { return c.ImPlot_SetNextPlotFormatX(fmt); } // Set the format for numeric Y axis labels (default="%g"). Formated values will be doubles (i.e. don't supply %d, %i, etc.). pub fn setNextPlotFormatY(fmt: [:0]const u8, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_SetNextPlotFormatY(fmt, y_axis orelse c.ImPlotYAxis_1); } //////// The following functions MUST be called BETWEEN Begin/EndPlot! // Select which Y axis will be used for subsequent plot elements. The default is ImPlotYAxis_1, or the first (left) Y axis. Enable 2nd and 3rd axes with ImPlotFlags_YAxisX. pub fn setPlotYAxis(y_axis: c.ImPlotYAxis) void { return c.ImPlot_SetPlotYAxis(y_axis); } // Hides or shows the next plot item (i.e. as if it were toggled from the legend). Use ImGuiCond_Always if you need to forcefully set this every frame. pub const HideNextItemOption = struct { hidden: bool = true, cond: ?imgui.ImGuiCond = imgui.ImGuiCond_Once, }; pub fn hideNextItem(option: HideNextItemOption) void { return c.ImPlot_HideNextItem(option.hidden, option.cond); } // Convert pixels to a position in the current plot's coordinate system. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially). pub fn pixelsToPlot_Vec2(pOut: *c.ImPlotPoint, pix: imgui.ImVec2, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_PixelsToPlot_Vec2(pOut, pix, y_axis orelse IMPLOT_AUTO); } pub fn pixelsToPlot_Float(pOut: *c.ImPlotPoint, x: f32, y: f32, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_PixelsToPlot_Float(pOut, x, y, y_axis orelse IMPLOT_AUTO); } // Convert a position in the current plot's coordinate system to pixels. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially). pub fn plotToPixels_PlotPoInt(pOut: [*c]imgui.ImVec2, plt: c.ImPlotPoint, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_PlotToPixels_PlotPoInt(pOut, plt, y_axis orelse IMPLOT_AUTO); } pub fn plotToPixels_double(pOut: [*c]imgui.ImVec2, x: f64, y: f64, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_PlotToPixels_double(pOut, x, y, y_axis orelse IMPLOT_AUTO); } // Get the current Plot position (top-left) in pixels. pub fn getPlotPos(pOut: [*c]imgui.ImVec2) void { return c.ImPlot_GetPlotPos(pOut); } // Get the curent Plot size in pixels. pub fn getPlotSize(pOut: [*c]imgui.ImVec2) void { return c.ImPlot_GetPlotSize(pOut); } // Returns true if the plot area in the current plot is hovered. pub fn isPlotHovered() bool { return c.ImPlot_IsPlotHovered(); } // Returns true if the XAxis plot area in the current plot is hovered. pub fn isPlotXAxisHovered() bool { return c.ImPlot_IsPlotXAxisHovered(); } // Returns true if the YAxis[n] plot area in the current plot is hovered. pub fn isPlotYAxisHovered(y_axis: ?c.ImPlotYAxis) bool { return c.ImPlot_IsPlotYAxisHovered(y_axis orelse 0); } // Returns the mouse position in x,y coordinates of the current plot. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially). pub fn getPlotMousePos(pOut: *c.ImPlotPoint, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_GetPlotMousePos(pOut, y_axis orelse IMPLOT_AUTO); } // Returns the current plot axis range. A negative y_axis uses the current value of SetPlotYAxis (ImPlotYAxis_1 initially). pub fn getPlotLimits(pOut: *c.ImPlotLimits, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_GetPlotLimits(pOut, y_axis orelse IMPLOT_AUTO); } // Returns true if the current plot is being box selected. pub fn isPlotSelected() bool { return c.ImPlot_IsPlotSelected(); } // Returns the current plot box selection bounds. pub fn getPlotSelection(pOut: *c.ImPlotLimits, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_GetPlotSelection(pOut, y_axis orelse IMPLOT_AUTO); } // Returns true if the current plot is being queried or has an active query. Query must be enabled with ImPlotFlags_Query. pub fn isPlotQueried() bool { return c.ImPlot_IsPlotQueried(); } // Returns the current plot query bounds. Query must be enabled with ImPlotFlags_Query. pub fn getPlotQuery(pOut: *c.ImPlotLimits, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_GetPlotQuery(pOut, y_axis orelse IMPLOT_AUTO); } // Set the current plot query bounds. Query must be enabled with ImPlotFlags_Query. pub fn setPlotQuery(query: c.ImPlotLimits, y_axis: ?c.ImPlotYAxis) void { return c.ImPlot_SetPlotQuery(query, y_axis orelse IMPLOT_AUTO); } // Returns true if the bounding frame of a subplot is hovered/ pub fn isSubplotsHovered() bool { return c.ImPlot_IsSubplotsHovered(); } //----------------------------------------------------------------------------- // Aligned Plots //----------------------------------------------------------------------------- // Consider using Begin/EndSubplots first. They are more feature rich and // accomplish the same behaviour by default. The functions below offer lower // level control of plot alignment. // Align axis padding over multiple plots in a single row or column. If this function returns true, EndAlignedPlots() must be called. #group_id must be unique. pub fn beginAlignedPlots(group_id: [:0]const u8, orientation: ?c.ImPlotOrientation) bool { return c.ImPlot_BeginAlignedPlots(group_id, orientation orelse c.ImPlotOrientation_Vertical); } pub fn endAlignedPlots() void { return c.ImPlot_EndAlignedPlots(); } //----------------------------------------------------------------------------- // Plot Tools //----------------------------------------------------------------------------- // The following functions MUST be called BETWEEN Begin/EndPlot! // Shows an annotation callout at a chosen point. pub fn annotate_Str(x: f64, y: f64, pix_offset: imgui.ImVec2, fmt: [*c]const u8) void { return c.ImPlot_Annotate_Str(x, y, pix_offset, fmt); } pub fn annotate_Vec4(x: f64, y: f64, pix_offset: imgui.ImVec2, color: imgui.ImVec4, fmt: [*c]const u8) void { return c.ImPlot_Annotate_Vec4(x, y, pix_offset, color, fmt); } // Same as above, but the annotation will always be clamped to stay inside the plot area. pub fn annotateClamped_Str(x: f64, y: f64, pix_offset: imgui.ImVec2, fmt: [*c]const u8) void { return c.ImPlot_AnnotateClamped_Str(x, y, pix_offset, fmt); } pub fn annotateClamped_Vec4(x: f64, y: f64, pix_offset: imgui.ImVec2, color: imgui.ImVec4, fmt: [*c]const u8) void { return c.ImPlot_AnnotateClamped_Vec4(x, y, pix_offset, color, fmt); } // Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text. pub const DragLineOption = struct { show_label: bool = true, col: imgui.ImVec4 = IMPLOT_AUTO_COL, thickness: f32 = 1, }; pub fn dragLineX(id: [:0]const u8, x_value: [*c]f64, option: DragLineOption) bool { return c.ImPlot_DragLineX(id, x_value, option.show_label, option.col, option.thickness); } // Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text. pub fn dragLineY(id: [:0]const u8, y_value: [*c]f64, option: DragLineOption) bool { return c.ImPlot_DragLineY(id, y_value, option.show_label, option.col, option.thickness); } // Shows a draggable point at x,y. #col defaults to ImGuiCol_Text. pub const DragPointOption = struct { show_label: bool = true, col: imgui.ImVec4 = IMPLOT_AUTO_COL, thickness: f32 = 4, }; pub fn dragPoint(id: [:0]const u8, x: [*c]f64, y: [*c]f64, option: DragPointOption) bool { return c.ImPlot_DragPoint(id, x, y, option.show_label, option.col, option.radius); } //----------------------------------------------------------------------------- // Legend Utils and Tools //----------------------------------------------------------------------------- // The following functions MUST be called BETWEEN Begin/EndPlot! // Set the location of the current plot's (or subplot's) legend. pub const SetLegendLocationOption = struct { orientation: c.ImPlotOrientation = c.ImPlotOrientation_Vertical, outside: bool = false, }; pub fn setLegendLocation(location: c.ImPlotLocation, option: SetLegendLocationOption) void { return c.ImPlot_SetLegendLocation(location, option.orientation, option.outside); } // Set the location of the current plot's mouse position text (default = South|East). pub fn setMousePosLocation(location: c.ImPlotLocation) void { return c.ImPlot_SetMousePosLocation(location); } // Returns true if a plot item legend entry is hovered. pub fn isLegendEntryHovered(label_id: [:0]const u8) bool { return c.ImPlot_IsLegendEntryHovered(label_id); } // Begin a popup for a legend entry. pub fn beginLegendPopup(label_id: [:0]const u8, mouse_button: ?imgui.ImGuiMouseButton) bool { return c.ImPlot_BeginLegendPopup(label_id, mouse_button orelse 1); } // End a popup for a legend entry. pub fn endLegendPopup() void { return c.ImPlot_EndLegendPopup(); } //----------------------------------------------------------------------------- // Drag and Drop Utils //----------------------------------------------------------------------------- // The following functions MUST be called BETWEEN Begin/EndPlot! // Turns the current plot's plotting area into a drag and drop target. Don't forget to call EndDragDropTarget! pub fn beginDragDropTarget() bool { return c.ImPlot_BeginDragDropTarget(); } // Turns the current plot's X-axis into a drag and drop target. Don't forget to call EndDragDropTarget! pub fn beginDragDropTargetX() bool { return c.ImPlot_BeginDragDropTargetX(); } // Turns the current plot's Y-Axis into a drag and drop target. Don't forget to call EndDragDropTarget! pub fn beginDragDropTargetY(axis: ?c.ImPlotYAxis) bool { return c.ImPlot_BeginDragDropTargetY(axis orelse c.ImPlotYAxis_1); } // Turns the current plot's legend into a drag and drop target. Don't forget to call EndDragDropTarget! pub fn beginDragDropTargetLegend() bool { return c.ImPlot_BeginDragDropTargetLegend(); } // Ends a drag and drop target (currently just an alias for ImGui::EndDragDropTarget). pub fn endDragDropTarget() void { return c.ImPlot_EndDragDropTarget(); } // NB: By default, plot and axes drag and drop *sources* require holding the Ctrl modifier to initiate the drag. // You can change the modifier if desired. If ImGuiKeyModFlags_None is provided, the axes will be locked from panning. // Turns the current plot's plotting area into a drag and drop source. Don't forget to call EndDragDropSource! pub const BeginDragDropSourceOption = struct { key_mods: imgui.ImGuiKeyModFlags = imgui.ImGuiKeyModFlags_Ctrl, flags: imgui.ImGuiDragDropFlags = 0, }; pub fn beginDragDropSource(option: BeginDragDropSourceOption) bool { return c.ImPlot_BeginDragDropSource(option.key_mods, option.flags); } // Turns the current plot's X-axis into a drag and drop source. Don't forget to call EndDragDropSource! pub fn beginDragDropSourceX(option: BeginDragDropSourceOption) bool { return c.ImPlot_BeginDragDropSourceX(option.key_mods, option.flags); } // Turns the current plot's Y-axis into a drag and drop source. Don't forget to call EndDragDropSource! pub const BeginDragDropSourceYOption = struct { axis: c.ImPlotYAxis = c.ImPlotYAxis_1, key_mods: imgui.ImGuiKeyModFlags = imgui.ImGuiKeyModFlags_Ctrl, flags: imgui.ImGuiDragDropFlags = 0, }; pub fn beginDragDropSourceY(option: BeginDragDropSourceYOption) bool { return c.ImPlot_BeginDragDropSourceY(option.axis, option.key_mods, option.flags); } // Turns an item in the current plot's legend into drag and drop source. Don't forget to call EndDragDropSource! pub fn beginDragDropSourceItem(label_id: [:0]const u8, flags: ?imgui.ImGuiDragDropFlags) bool { return c.ImPlot_BeginDragDropSourceItem(label_id, flags orelse 0); } // Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource). pub fn endDragDropSource() void { return c.ImPlot_EndDragDropSource(); } //----------------------------------------------------------------------------- // Plot and Item Styling //----------------------------------------------------------------------------- // Styling colors in ImPlot works similarly to styling colors in ImGui, but // with one important difference. Like ImGui, all style colors are stored in an // indexable array in ImPlotStyle. You can permanently modify these values through // GetStyle().Colors, or temporarily modify them with Push/Pop functions below. // However, by default all style colors in ImPlot default to a special color // IMPLOT_AUTO_COL. The behavior of this color depends upon the style color to // which it as applied: // // 1) For style colors associated with plot items (e.g. ImPlotCol_Line), // IMPLOT_AUTO_COL tells ImPlot to color the item with the next unused // color in the current colormap. Thus, every item will have a different // color up to the number of colors in the colormap, at which point the // colormap will roll over. For most use cases, you should not need to // set these style colors to anything but IMPLOT_COL_AUTO; you are // probably better off changing the current colormap. However, if you // need to explicitly color a particular item you may either Push/Pop // the style color around the item in question, or use the SetNextXXXStyle // API below. If you permanently set one of these style colors to a specific // color, or forget to call Pop, then all subsequent items will be styled // with the color you set. // // 2) For style colors associated with plot styling (e.g. ImPlotCol_PlotBg), // IMPLOT_AUTO_COL tells ImPlot to set that color from color data in your // **ImGuiStyle**. The ImGuiCol_ that these style colors default to are // detailed above, and in general have been mapped to produce plots visually // consistent with your current ImGui style. Of course, you are free to // manually set these colors to whatever you like, and further can Push/Pop // them around individual plots for plot-specific styling (e.g. coloring axes). // Provides access to plot style structure for permanant modifications to colors, sizes, etc. pub fn getStyle() *c.ImPlotStyle { return c.ImPlot_GetStyle(); } // Style plot colors for current ImGui style (default). pub fn styleColorsAuto(dst: ?*c.ImPlotStyle) void { return c.ImPlot_StyleColorsAuto(dst); } // Style plot colors for ImGui "Classic". pub fn styleColorsClassic(dst: ?*c.ImPlotStyle) void { return c.ImPlot_StyleColorsClassic(dst); } // Style plot colors for ImGui "Dark". pub fn styleColorsDark(dst: ?*c.ImPlotStyle) void { return c.ImPlot_StyleColorsDark(dst); } // Style plot colors for ImGui "Light". pub fn styleColorsLight(dst: ?*c.ImPlotStyle) void { return c.ImPlot_StyleColorsLight(dst); } // Use PushStyleX to temporarily modify your ImPlotStyle. The modification // will last until the matching call to PopStyleX. You MUST call a pop for // every push, otherwise you will leak memory! This behaves just like ImGui. // Temporarily modify a style color. Don't forget to call PopStyleColor! pub fn pushStyleColor_U32(idx: c.ImPlotCol, col: imgui.ImU32) void { return c.ImPlot_PushStyleColor_U32(idx, col); } pub fn pushStyleColor_Vec4(idx: c.ImPlotCol, col: imgui.ImVec4) void { return c.ImPlot_PushStyleColor_Vec4(idx, col); } // Undo temporary style color modification(s). Undo multiple pushes at once by increasing count. pub fn popStyleColor(count: ?c_int) void { return c.ImPlot_PopStyleColor(count orelse 1); } // Temporarily modify a style variable of float type. Don't forget to call PopStyleVar! pub fn pushStyleVar_Float(idx: c.ImPlotStyleVar, val: f32) void { return c.ImPlot_PushStyleVar_Float(idx, val); } // Temporarily modify a style variable of int type. Don't forget to call PopStyleVar! pub fn pushStyleVar_Int(idx: c.ImPlotStyleVar, val: c_int) void { return c.ImPlot_PushStyleVar_Int(idx, val); } // Temporarily modify a style variable of ImVec2 type. Don't forget to call PopStyleVar! pub fn pushStyleVar_Vec2(idx: c.ImPlotStyleVar, val: imgui.ImVec2) void { return c.ImPlot_PushStyleVar_Vec2(idx, val); } // Undo temporary style variable modification(s). Undo multiple pushes at once by increasing count. pub fn popStyleVar(count: ?c_int) void { return c.ImPlot_PopStyleVar(count orelse 1); } // The following can be used to modify the style of the next plot item ONLY. They do // NOT require calls to PopStyleX. Leave style attributes you don't want modified to // IMPLOT_AUTO or IMPLOT_AUTO_COL. Automatic styles will be deduced from the current // values in your ImPlotStyle or from Colormap data. // Set the line color and weight for the next item only. pub const SetNextLineStyleOption = struct { col: imgui.ImVec4 = IMPLOT_AUTO_COL, weight: f32 = IMPLOT_AUTO, }; pub fn setNextLineStyle(option: SetNextLineStyleOption) void { return c.ImPlot_SetNextLineStyle(option.col, option.weight); } // Set the fill color for the next item only. pub const SetNextFillStyleOption = struct { col: imgui.ImVec4 = IMPLOT_AUTO_COL, alpha_mod: f32 = IMPLOT_AUTO, }; pub fn setNextFillStyle(option: SetNextFillStyleOption) void { return c.ImPlot_SetNextFillStyle(option.col, option.alpha_mod); } // Set the marker style for the next item only. pub const SetNextMarkerStyleOption = struct { marker: c.ImPlotMarker = IMPLOT_AUTO, size: f32 = IMPLOT_AUTO, fill: imgui.ImVec4 = IMPLOT_AUTO_COL, weight: f32 = IMPLOT_AUTO, outline: imgui.ImVec4 = IMPLOT_AUTO_COL, }; pub fn setNextMarkerStyle(option: SetNextMarkerStyleOption) void { return c.ImPlot_SetNextMarkerStyle(option.marker, option.size, option.fill, option.weight, option.outline); } // Set the error bar style for the next item only. pub const SetNextErrorBarStyle = struct { col: imgui.ImVec4 = IMPLOT_AUTO_COL, size: f32 = IMPLOT_AUTO, weight: f32 = IMPLOT_AUTO, }; pub fn setNextErrorBarStyle(option: SetNextErrorBarStyle) void { return c.ImPlot_SetNextErrorBarStyle(option.col, option.size, option.weight); } // Gets the last item primary color (i.e. its legend icon color) pub fn getLastItemColor(pOut: [*c]imgui.ImVec4) void { return c.ImPlot_GetLastItemColor(pOut); } // Returns the null terminated string name for an ImPlotCol. pub fn getStyleColorName(idx: c.ImPlotCol) [*c]const u8 { return c.ImPlot_GetStyleColorName(idx); } // Returns the null terminated string name for an ImPlotMarker. pub fn getMarkerName(idx: c.ImPlotMarker) [*c]const u8 { return c.ImPlot_GetMarkerName(idx); } //----------------------------------------------------------------------------- // Colormaps //----------------------------------------------------------------------------- // Item styling is based on colormaps when the relevant ImPlotCol_XXX is set to // IMPLOT_AUTO_COL (default). Several built-in colormaps are available. You can // add and then push/pop your own colormaps as well. To permanently set a colormap, // modify the Colormap index member of your ImPlotStyle. // Colormap data will be ignored and a custom color will be used if you have done one of the following: // 1) Modified an item style color in your ImPlotStyle to anything other than IMPLOT_AUTO_COL. // 2) Pushed an item style color using PushStyleColor(). // 3) Set the next item style with a SetNextXXXStyle function. // Add a new colormap. The color data will be copied. The colormap can be used by pushing either the returned index or the // string name with PushColormap. The colormap name must be unique and the size must be greater than 1. You will receive // an assert otherwise! By default colormaps are considered to be qualitative (i.e. discrete). If you want to create a // continuous colormap, set #qual=false. This will treat the colors you provide as keys, and ImPlot will build a linearly // interpolated lookup table. The memory footprint of this table will be exactly ((size-1)*255+1)*4 bytes. pub fn addColormap_Vec4Ptr(name: [:0]const u8, cols: [*c]const imgui.ImVec4, size: c_int, qual: ?bool) c.ImPlotColormap { return c.ImPlot_AddColormap_Vec4Ptr(name, cols, size, qual orelse true); } pub fn addColormap_U32Ptr(name: [:0]const u8, cols: [*c]const imgui.ImU32, size: c_int, qual: ?bool) c.ImPlotColormap { return c.ImPlot_AddColormap_U32Ptr(name, cols, size, qual orelse true); } // Returns the number of available colormaps (i.e. the built-in + user-added count). pub fn getColormapCount() c_int { return c.ImPlot_GetColormapCount(); } // Returns a null terminated string name for a colormap given an index. Returns NULL if index is invalid. pub fn getColormapName(cmap: c.ImPlotColormap) [*c]const u8 { return c.ImPlot_GetColormapName(cmap); } // Returns an index number for a colormap given a valid string name. Returns -1 if name is invalid. pub fn getColormapIndex(name: [*c]const u8) c.ImPlotColormap { return c.ImPlot_GetColormapIndex(name); } // Temporarily switch to one of the built-in (i.e. ImPlotColormap_XXX) or user-added colormaps (i.e. a return value of AddColormap). Don't forget to call PopColormap! pub fn pushColormap_PlotColormap(cmap: c.ImPlotColormap) void { return c.ImPlot_PushColormap_PlotColormap(cmap); } // Push a colormap by string name. Use built-in names such as "Default", "Deep", "Jet", etc. or a string you provided to AddColormap. Don't forget to call PopColormap! pub fn pushColormap_Str(name: [*c]const u8) void { return c.ImPlot_PushColormap_Str(name); } // Undo temporary colormap modification(s). Undo multiple pushes at once by increasing count. pub fn popColormap(count: ?c_int) void { return c.ImPlot_PopColormap(count orelse 1); } // Returns the next color from the current colormap and advances the colormap for the current plot. // Can also be used with no return value to skip colors if desired. You need to call this between Begin/EndPlot! pub fn nextColormapColor(pOut: [*c]imgui.ImVec4) void { return c.ImPlot_NextColormapColor(pOut); } // Colormap utils. If cmap = IMPLOT_AUTO (default), the current colormap is assumed. // Pass an explicit colormap index (built-in or user-added) to specify otherwise. // Returns the size of a colormap. pub fn getColormapSize(cmap: ?c.ImPlotColormap) c_int { return c.ImPlot_GetColormapSize(cmap orelse IMPLOT_AUTO); } // Returns a color from a colormap given an index >= 0 (modulo will be performed). pub fn getColormapColor(pOut: [*c]imgui.ImVec4, idx: c_int, cmap: ?c.ImPlotColormap) void { return c.ImPlot_GetColormapColor(pOut, idx, cmap orelse IMPLOT_AUTO); } // Sample a color from the current colormap given t between 0 and 1. pub fn sampleColormap(pOut: [*c]imgui.ImVec4, t: f32, cmap: ?c.ImPlotColormap) void { return c.ImPlot_SampleColormap(pOut, t, cmap orelse IMPLOT_AUTO); } // Shows a vertical color scale with linear spaced ticks using the specified color map. Use double hashes to hide label (e.g. "##NoLabel"). pub const ColormapScaleOption = struct { size: imgui.ImVec2 = .{ .x = 0, .y = 0 }, cmap: c.ImPlotColormap = IMPLOT_AUTO, fmt: [:0]const u8 = "%g", }; pub fn colormapScale(label: [:0]const u8, scale_min: f64, scale_max: f64, option: ColormapScaleOption) void { return c.ImPlot_ColormapScale(label, scale_min, scale_max, option.size, option.cmap, option.fmt); } // Shows a horizontal slider with a colormap gradient background. Optionally returns the color sampled at t in [0 1]. pub const ColormapSliderOption = struct { out: [*c]imgui.ImVec4 = null, format: [:0]const u8 = "", cmap: c.ImPlotColormap = IMPLOT_AUTO, }; pub fn colormapSlider(label: [:0]const u8, t: *f32, option: ColormapSliderOption) bool { return c.ImPlot_ColormapSlider(label, t, option.out, option.format, option.cmap); } // Shows a button with a colormap gradient brackground. pub const ColormapButtonOption = struct { size: imgui.ImVec2 = .{ .x = 0, .y = 0 }, cmap: c.ImPlotColormap = IMPLOT_AUTO, }; pub fn colormapButton(label: [:0]const u8, option: ColormapButtonOption) bool { return c.ImPlot_ColormapButton(label, option.size, option.cmap); } // When items in a plot sample their color from a colormap, the color is cached and does not change // unless explicitly overriden. Therefore, if you change the colormap after the item has already been plotted, // item colors will NOT update. If you need item colors to resample the new colormap, then use this // function to bust the cached colors. If #plot_title_id is NULL, then every item in EVERY existing plot // will be cache busted. Otherwise only the plot specified by #plot_title_id will be busted. For the // latter, this function must be called in the same ImGui ID scope that the plot is in. You should rarely if ever // need this function, but it is available for applications that require runtime colormap swaps (e.g. Heatmaps demo). pub fn bustColorCache(plot_title_id: ?[:0]const u8) void { return c.ImPlot_BustColorCache(plot_title_id); } //----------------------------------------------------------------------------- // Miscellaneous //----------------------------------------------------------------------------- // Render icons similar to those that appear in legends (nifty for data lists). pub fn itemIcon_Vec4(col: imgui.ImVec4) void { return c.ImPlot_ItemIcon_Vec4(col); } pub fn itemIcon_U32(col: imgui.ImU32) void { return c.ImPlot_ItemIcon_U32(col); } pub fn colormapIcon(cmap: c.ImPlotColormap) void { return c.ImPlot_ColormapIcon(cmap); } // Get the plot draw list for custom rendering to the current plot area. Call between Begin/EndPlot. pub fn getPlotDrawList() [*c]imgui.ImDrawList { return c.ImPlot_GetPlotDrawList(); } // Push clip rect for rendering to current plot area. The rect can be expanded or contracted by #expand pixels. Call between Begin/EndPlot. pub fn pushPlotClipRect(expand: ?f32) void { return c.ImPlot_PushPlotClipRect(expand orelse 0); } // Pop plot clip rect. Call between Begin/EndPlot. pub fn popPlotClipRect() void { return c.ImPlot_PopPlotClipRect(); } // Shows ImPlot style selector dropdown menu. pub fn showStyleSelector(label: [:0]const u8) bool { return c.ImPlot_ShowStyleSelector(label); } // Shows ImPlot colormap selector dropdown menu. pub fn showColormapSelector(label: [:0]const u8) bool { return c.ImPlot_ShowColormapSelector(label); } // Shows ImPlot style editor block (not a window). pub fn showStyleEditor(ref: ?*c.ImPlotStyle) void { return c.ImPlot_ShowStyleEditor(ref); } // Add basic help/info block for end users (not a window). pub fn showUserGuide() void { return c.ImPlot_ShowUserGuide(); } // Shows ImPlot metrics/debug information window. pub fn showMetricsWindow(p_popen: ?*bool) void { return c.ImPlot_ShowMetricsWindow(p_popen); } //----------------------------------------------------------------------------- // Demo (add implot_demo.cpp to your sources!) //----------------------------------------------------------------------------- // Shows the ImPlot demo window. pub fn showDemoWindow(p_open: [*c]bool) void { return c.ImPlot_ShowDemoWindow(p_open); } /// ImPlot internal API pub const internal = struct { pub fn log10_Float(x: f32) f32 { return c.ImPlot_ImLog10_Float(x); } pub fn log10_double(x: f64) f64 { return c.ImPlot_ImLog10_double(x); } pub fn remap_Float(x: f32, x0: f32, x1: f32, y0: f32, y1: f32) f32 { return c.ImPlot_ImRemap_Float(x, x0, x1, y0, y1); } pub fn remap_double(x: f64, x0: f64, x1: f64, y0: f64, y1: f64) f64 { return c.ImPlot_ImRemap_double(x, x0, x1, y0, y1); } pub fn remap_S8(x: imgui.ImS8, x0: imgui.ImS8, x1: imgui.ImS8, y0: imgui.ImS8, y1: imgui.ImS8) imgui.ImS8 { return c.ImPlot_ImRemap_S8(x, x0, x1, y0, y1); } pub fn remap_U8(x: imgui.ImU8, x0: imgui.ImU8, x1: imgui.ImU8, y0: imgui.ImU8, y1: imgui.ImU8) imgui.ImU8 { return c.ImPlot_ImRemap_U8(x, x0, x1, y0, y1); } pub fn remap_S16(x: imgui.ImS16, x0: imgui.ImS16, x1: imgui.ImS16, y0: imgui.ImS16, y1: imgui.ImS16) imgui.ImS16 { return c.ImPlot_ImRemap_S16(x, x0, x1, y0, y1); } pub fn remap_U16(x: imgui.ImU16, x0: imgui.ImU16, x1: imgui.ImU16, y0: imgui.ImU16, y1: imgui.ImU16) imgui.ImU16 { return c.ImPlot_ImRemap_U16(x, x0, x1, y0, y1); } pub fn remap_S32(x: imgui.ImS32, x0: imgui.ImS32, x1: imgui.ImS32, y0: imgui.ImS32, y1: imgui.ImS32) imgui.ImS32 { return c.ImPlot_ImRemap_S32(x, x0, x1, y0, y1); } pub fn remap_U32(x: imgui.ImU32, x0: imgui.ImU32, x1: imgui.ImU32, y0: imgui.ImU32, y1: imgui.ImU32) imgui.ImU32 { return c.ImPlot_ImRemap_U32(x, x0, x1, y0, y1); } pub fn remap_S64(x: imgui.ImS64, x0: imgui.ImS64, x1: imgui.ImS64, y0: imgui.ImS64, y1: imgui.ImS64) imgui.ImS64 { return c.ImPlot_ImRemap_S64(x, x0, x1, y0, y1); } pub fn remap_U64(x: imgui.ImU64, x0: imgui.ImU64, x1: imgui.ImU64, y0: imgui.ImU64, y1: imgui.ImU64) imgui.ImU64 { return c.ImPlot_ImRemap_U64(x, x0, x1, y0, y1); } pub fn remap01_Float(x: f32, x0: f32, x1: f32) f32 { return c.ImPlot_ImRemap01_Float(x, x0, x1); } pub fn remap01_double(x: f64, x0: f64, x1: f64) f64 { return c.ImPlot_ImRemap01_double(x, x0, x1); } pub fn remap01_S8(x: imgui.ImS8, x0: imgui.ImS8, x1: imgui.ImS8) imgui.ImS8 { return c.ImPlot_ImRemap01_S8(x, x0, x1); } pub fn remap01_U8(x: imgui.ImU8, x0: imgui.ImU8, x1: imgui.ImU8) imgui.ImU8 { return c.ImPlot_ImRemap01_U8(x, x0, x1); } pub fn remap01_S16(x: imgui.ImS16, x0: imgui.ImS16, x1: imgui.ImS16) imgui.ImS16 { return c.ImPlot_ImRemap01_S16(x, x0, x1); } pub fn remap01_U16(x: imgui.ImU16, x0: imgui.ImU16, x1: imgui.ImU16) imgui.ImU16 { return c.ImPlot_ImRemap01_U16(x, x0, x1); } pub fn remap01_S32(x: imgui.ImS32, x0: imgui.ImS32, x1: imgui.ImS32) imgui.ImS32 { return c.ImPlot_ImRemap01_S32(x, x0, x1); } pub fn remap01_U32(x: imgui.ImU32, x0: imgui.ImU32, x1: imgui.ImU32) imgui.ImU32 { return c.ImPlot_ImRemap01_U32(x, x0, x1); } pub fn remap01_S64(x: imgui.ImS64, x0: imgui.ImS64, x1: imgui.ImS64) imgui.ImS64 { return c.ImPlot_ImRemap01_S64(x, x0, x1); } pub fn remap01_U64(x: imgui.ImU64, x0: imgui.ImU64, x1: imgui.ImU64) imgui.ImU64 { return c.ImPlot_ImRemap01_U64(x, x0, x1); } pub fn posMod(l: c_int, r: c_int) c_int { return c.ImPlot_ImPosMod(l, r); } pub fn nanOrInf(val: f64) bool { return c.ImPlot_ImNanOrInf(val); } pub fn constrainNan(val: f64) f64 { return c.ImPlot_ImConstrainNan(val); } pub fn constrainInf(val: f64) f64 { return c.ImPlot_ImConstrainInf(val); } pub fn constrainLog(val: f64) f64 { return c.ImPlot_ImConstrainLog(val); } pub fn constrainTime(val: f64) f64 { return c.ImPlot_ImConstrainTime(val); } pub fn almostEqual(v1: f64, v2: f64, ulp: c_int) bool { return c.ImPlot_ImAlmostEqual(v1, v2, ulp); } pub fn minArray_FloatPtr(values: [*c]const f32, count: c_int) f32 { return c.ImPlot_ImMinArray_FloatPtr(values, count); } pub fn minArray_doublePtr(values: [*c]const f64, count: c_int) f64 { return c.ImPlot_ImMinArray_doublePtr(values, count); } pub fn minArray_S8Ptr(values: [*c]const imgui.ImS8, count: c_int) imgui.ImS8 { return c.ImPlot_ImMinArray_S8Ptr(values, count); } pub fn minArray_U8Ptr(values: [*c]const imgui.ImU8, count: c_int) imgui.ImU8 { return c.ImPlot_ImMinArray_U8Ptr(values, count); } pub fn minArray_S16Ptr(values: [*c]const imgui.ImS16, count: c_int) imgui.ImS16 { return c.ImPlot_ImMinArray_S16Ptr(values, count); } pub fn minArray_U16Ptr(values: [*c]const imgui.ImU16, count: c_int) imgui.ImU16 { return c.ImPlot_ImMinArray_U16Ptr(values, count); } pub fn minArray_S32Ptr(values: [*c]const imgui.ImS32, count: c_int) imgui.ImS32 { return c.ImPlot_ImMinArray_S32Ptr(values, count); } pub fn minArray_U32Ptr(values: [*c]const imgui.ImU32, count: c_int) imgui.ImU32 { return c.ImPlot_ImMinArray_U32Ptr(values, count); } pub fn minArray_S64Ptr(values: [*c]const imgui.ImS64, count: c_int) imgui.ImS64 { return c.ImPlot_ImMinArray_S64Ptr(values, count); } pub fn minArray_U64Ptr(values: [*c]const imgui.ImU64, count: c_int) imgui.ImU64 { return c.ImPlot_ImMinArray_U64Ptr(values, count); } pub fn maxArray_FloatPtr(values: [*c]const f32, count: c_int) f32 { return c.ImPlot_ImMaxArray_FloatPtr(values, count); } pub fn maxArray_doublePtr(values: [*c]const f64, count: c_int) f64 { return c.ImPlot_ImMaxArray_doublePtr(values, count); } pub fn maxArray_S8Ptr(values: [*c]const imgui.ImS8, count: c_int) imgui.ImS8 { return c.ImPlot_ImMaxArray_S8Ptr(values, count); } pub fn maxArray_U8Ptr(values: [*c]const imgui.ImU8, count: c_int) imgui.ImU8 { return c.ImPlot_ImMaxArray_U8Ptr(values, count); } pub fn maxArray_S16Ptr(values: [*c]const imgui.ImS16, count: c_int) imgui.ImS16 { return c.ImPlot_ImMaxArray_S16Ptr(values, count); } pub fn maxArray_U16Ptr(values: [*c]const imgui.ImU16, count: c_int) imgui.ImU16 { return c.ImPlot_ImMaxArray_U16Ptr(values, count); } pub fn maxArray_S32Ptr(values: [*c]const imgui.ImS32, count: c_int) imgui.ImS32 { return c.ImPlot_ImMaxArray_S32Ptr(values, count); } pub fn maxArray_U32Ptr(values: [*c]const imgui.ImU32, count: c_int) imgui.ImU32 { return c.ImPlot_ImMaxArray_U32Ptr(values, count); } pub fn maxArray_S64Ptr(values: [*c]const imgui.ImS64, count: c_int) imgui.ImS64 { return c.ImPlot_ImMaxArray_S64Ptr(values, count); } pub fn maxArray_U64Ptr(values: [*c]const imgui.ImU64, count: c_int) imgui.ImU64 { return c.ImPlot_ImMaxArray_U64Ptr(values, count); } pub fn minMaxArray_FloatPtr(values: [*c]const f32, count: c_int, min_out: [*c]f32, max_out: [*c]f32) void { return c.ImPlot_ImMinMaxArray_FloatPtr(values, count, min_out, max_out); } pub fn minMaxArray_doublePtr(values: [*c]const f64, count: c_int, min_out: [*c]f64, max_out: [*c]f64) void { return c.ImPlot_ImMinMaxArray_doublePtr(values, count, min_out, max_out); } pub fn minMaxArray_S8Ptr(values: [*c]const imgui.ImS8, count: c_int, min_out: [*c]imgui.ImS8, max_out: [*c]imgui.ImS8) void { return c.ImPlot_ImMinMaxArray_S8Ptr(values, count, min_out, max_out); } pub fn minMaxArray_U8Ptr(values: [*c]const imgui.ImU8, count: c_int, min_out: [*c]imgui.ImU8, max_out: [*c]imgui.ImU8) void { return c.ImPlot_ImMinMaxArray_U8Ptr(values, count, min_out, max_out); } pub fn minMaxArray_S16Ptr(values: [*c]const imgui.ImS16, count: c_int, min_out: [*c]imgui.ImS16, max_out: [*c]imgui.ImS16) void { return c.ImPlot_ImMinMaxArray_S16Ptr(values, count, min_out, max_out); } pub fn minMaxArray_U16Ptr(values: [*c]const imgui.ImU16, count: c_int, min_out: [*c]imgui.ImU16, max_out: [*c]imgui.ImU16) void { return c.ImPlot_ImMinMaxArray_U16Ptr(values, count, min_out, max_out); } pub fn minMaxArray_S32Ptr(values: [*c]const imgui.ImS32, count: c_int, min_out: [*c]imgui.ImS32, max_out: [*c]imgui.ImS32) void { return c.ImPlot_ImMinMaxArray_S32Ptr(values, count, min_out, max_out); } pub fn minMaxArray_U32Ptr(values: [*c]const imgui.ImU32, count: c_int, min_out: [*c]imgui.ImU32, max_out: [*c]imgui.ImU32) void { return c.ImPlot_ImMinMaxArray_U32Ptr(values, count, min_out, max_out); } pub fn minMaxArray_S64Ptr(values: [*c]const imgui.ImS64, count: c_int, min_out: [*c]imgui.ImS64, max_out: [*c]imgui.ImS64) void { return c.ImPlot_ImMinMaxArray_S64Ptr(values, count, min_out, max_out); } pub fn minMaxArray_U64Ptr(values: [*c]const imgui.ImU64, count: c_int, min_out: [*c]imgui.ImU64, max_out: [*c]imgui.ImU64) void { return c.ImPlot_ImMinMaxArray_U64Ptr(values, count, min_out, max_out); } pub fn sum_FloatPtr(values: [*c]const f32, count: c_int) f32 { return c.ImPlot_ImSum_FloatPtr(values, count); } pub fn sum_doublePtr(values: [*c]const f64, count: c_int) f64 { return c.ImPlot_ImSum_doublePtr(values, count); } pub fn sum_S8Ptr(values: [*c]const imgui.ImS8, count: c_int) imgui.ImS8 { return c.ImPlot_ImSum_S8Ptr(values, count); } pub fn sum_U8Ptr(values: [*c]const imgui.ImU8, count: c_int) imgui.ImU8 { return c.ImPlot_ImSum_U8Ptr(values, count); } pub fn sum_S16Ptr(values: [*c]const imgui.ImS16, count: c_int) imgui.ImS16 { return c.ImPlot_ImSum_S16Ptr(values, count); } pub fn sum_U16Ptr(values: [*c]const imgui.ImU16, count: c_int) imgui.ImU16 { return c.ImPlot_ImSum_U16Ptr(values, count); } pub fn sum_S32Ptr(values: [*c]const imgui.ImS32, count: c_int) imgui.ImS32 { return c.ImPlot_ImSum_S32Ptr(values, count); } pub fn sum_U32Ptr(values: [*c]const imgui.ImU32, count: c_int) imgui.ImU32 { return c.ImPlot_ImSum_U32Ptr(values, count); } pub fn sum_S64Ptr(values: [*c]const imgui.ImS64, count: c_int) imgui.ImS64 { return c.ImPlot_ImSum_S64Ptr(values, count); } pub fn sum_U64Ptr(values: [*c]const imgui.ImU64, count: c_int) imgui.ImU64 { return c.ImPlot_ImSum_U64Ptr(values, count); } pub fn mean_FloatPtr(values: [*c]const f32, count: c_int) f64 { return c.ImPlot_ImMean_FloatPtr(values, count); } pub fn mean_doublePtr(values: [*c]const f64, count: c_int) f64 { return c.ImPlot_ImMean_doublePtr(values, count); } pub fn mean_S8Ptr(values: [*c]const imgui.ImS8, count: c_int) f64 { return c.ImPlot_ImMean_S8Ptr(values, count); } pub fn mean_U8Ptr(values: [*c]const imgui.ImU8, count: c_int) f64 { return c.ImPlot_ImMean_U8Ptr(values, count); } pub fn mean_S16Ptr(values: [*c]const imgui.ImS16, count: c_int) f64 { return c.ImPlot_ImMean_S16Ptr(values, count); } pub fn mean_U16Ptr(values: [*c]const imgui.ImU16, count: c_int) f64 { return c.ImPlot_ImMean_U16Ptr(values, count); } pub fn mean_S32Ptr(values: [*c]const imgui.ImS32, count: c_int) f64 { return c.ImPlot_ImMean_S32Ptr(values, count); } pub fn mean_U32Ptr(values: [*c]const imgui.ImU32, count: c_int) f64 { return c.ImPlot_ImMean_U32Ptr(values, count); } pub fn mean_S64Ptr(values: [*c]const imgui.ImS64, count: c_int) f64 { return c.ImPlot_ImMean_S64Ptr(values, count); } pub fn mean_U64Ptr(values: [*c]const imgui.ImU64, count: c_int) f64 { return c.ImPlot_ImMean_U64Ptr(values, count); } pub fn stdDev_FloatPtr(values: [*c]const f32, count: c_int) f64 { return c.ImPlot_ImStdDev_FloatPtr(values, count); } pub fn stdDev_doublePtr(values: [*c]const f64, count: c_int) f64 { return c.ImPlot_ImStdDev_doublePtr(values, count); } pub fn stdDev_S8Ptr(values: [*c]const imgui.ImS8, count: c_int) f64 { return c.ImPlot_ImStdDev_S8Ptr(values, count); } pub fn stdDev_U8Ptr(values: [*c]const imgui.ImU8, count: c_int) f64 { return c.ImPlot_ImStdDev_U8Ptr(values, count); } pub fn stdDev_S16Ptr(values: [*c]const imgui.ImS16, count: c_int) f64 { return c.ImPlot_ImStdDev_S16Ptr(values, count); } pub fn stdDev_U16Ptr(values: [*c]const imgui.ImU16, count: c_int) f64 { return c.ImPlot_ImStdDev_U16Ptr(values, count); } pub fn stdDev_S32Ptr(values: [*c]const imgui.ImS32, count: c_int) f64 { return c.ImPlot_ImStdDev_S32Ptr(values, count); } pub fn stdDev_U32Ptr(values: [*c]const imgui.ImU32, count: c_int) f64 { return c.ImPlot_ImStdDev_U32Ptr(values, count); } pub fn stdDev_S64Ptr(values: [*c]const imgui.ImS64, count: c_int) f64 { return c.ImPlot_ImStdDev_S64Ptr(values, count); } pub fn stdDev_U64Ptr(values: [*c]const imgui.ImU64, count: c_int) f64 { return c.ImPlot_ImStdDev_U64Ptr(values, count); } pub fn mixU32(a: imgui.ImU32, b: imgui.ImU32, s: imgui.ImU32) imgui.ImU32 { return c.ImPlot_ImMixU32(a, b, s); } pub fn lerpU32(colors: [*c]const imgui.ImU32, size: c_int, t: f32) imgui.ImU32 { return c.ImPlot_ImLerpU32(colors, size, t); } pub fn alphaU32(col: imgui.ImU32, alpha: f32) imgui.ImU32 { return c.ImPlot_ImAlphaU32(col, alpha); } pub fn initialize(ctx: *c.ImPlotContext) void { return c.ImPlot_Initialize(ctx); } pub fn resetCtxForNextPlot(ctx: *c.ImPlotContext) void { return c.ImPlot_ResetCtxForNextPlot(ctx); } pub fn resetCtxForNextAlignedPlots(ctx: *c.ImPlotContext) void { return c.ImPlot_ResetCtxForNextAlignedPlots(ctx); } pub fn resetCtxForNextSubplot(ctx: *c.ImPlotContext) void { return c.ImPlot_ResetCtxForNextSubplot(ctx); } pub fn getInputMap() *c.ImPlotInputMap { return c.ImPlot_GetInputMap(); } pub fn getPlot(title: [*c]const u8) *c.ImPlotPlot { return c.ImPlot_GetPlot(title); } pub fn getCurrentPlot() *c.ImPlotPlot { return c.ImPlot_GetCurrentPlot(); } pub fn bustPlotCache() void { return c.ImPlot_BustPlotCache(); } pub fn showPlotContextMenu(plot: *c.ImPlotPlot) void { return c.ImPlot_ShowPlotContextMenu(plot); } pub fn subplotNextCell() void { return c.ImPlot_SubplotNextCell(); } pub fn showSubplotsContextMenu(subplot: *c.ImPlotSubplot) void { return c.ImPlot_ShowSubplotsContextMenu(subplot); } pub fn beginItem(label_id: [*c]const u8, recolor_from: c.ImPlotCol) bool { return c.ImPlot_BeginItem(label_id, recolor_from); } pub fn endItem() void { return c.ImPlot_EndItem(); } pub fn registerOrGetItem(label_id: [*c]const u8, just_created: [*c]bool) *c.ImPlotItem { return c.ImPlot_RegisterOrGetItem(label_id, just_created); } pub fn getItem(label_id: [*c]const u8) *c.ImPlotItem { return c.ImPlot_GetItem(label_id); } pub fn getCurrentItem() *c.ImPlotItem { return c.ImPlot_GetCurrentItem(); } pub fn bustItemCache() void { return c.ImPlot_BustItemCache(); } pub fn getCurrentYAxis() c_int { return c.ImPlot_GetCurrentYAxis(); } pub fn updateAxisColors(axis_flag: c_int, axis: *c.ImPlotAxis) void { return c.ImPlot_UpdateAxisColors(axis_flag, axis); } pub fn updateTransformCache() void { return c.ImPlot_UpdateTransformCache(); } pub fn getCurrentScale() c.ImPlotScale { return c.ImPlot_GetCurrentScale(); } pub fn fitThisFrame() bool { return c.ImPlot_FitThisFrame(); } pub fn fitPointAxis(axis: *c.ImPlotAxis, ext: *c.ImPlotRange, v: f64) void { return c.ImPlot_FitPointAxis(axis, ext, v); } pub fn fitPointMultiAxis(axis: *c.ImPlotAxis, alt: *c.ImPlotAxis, ext: *c.ImPlotRange, v: f64, v_alt: f64) void { return c.ImPlot_FitPointMultiAxis(axis, alt, ext, v, v_alt); } pub fn fitPointX(x: f64) void { return c.ImPlot_FitPointX(x); } pub fn fitPointY(y: f64) void { return c.ImPlot_FitPointY(y); } pub fn fitPoint(p: c.ImPlotPoint) void { return c.ImPlot_FitPoint(p); } pub fn rangesOverlap(r1: c.ImPlotRange, r2: c.ImPlotRange) bool { return c.ImPlot_RangesOverlap(r1, r2); } pub fn pushLinkedAxis(axis: *c.ImPlotAxis) void { return c.ImPlot_PushLinkedAxis(axis); } pub fn pullLinkedAxis(axis: *c.ImPlotAxis) void { return c.ImPlot_PullLinkedAxis(axis); } pub fn showAxisContextMenu(axis: *c.ImPlotAxis, equal_axis: *c.ImPlotAxis, time_allowed: bool) void { return c.ImPlot_ShowAxisContextMenu(axis, equal_axis, time_allowed); } pub fn getFormatX() [*c]const u8 { return c.ImPlot_GetFormatX(); } pub fn getFormatY(y: c.ImPlotYAxis) [*c]const u8 { return c.ImPlot_GetFormatY(y); } pub fn getLocationPos(pOut: [*c]imgui.ImVec2, outer_rect: imgui.ImRect, inner_size: imgui.ImVec2, location: c.ImPlotLocation, pad: imgui.ImVec2) void { return c.ImPlot_GetLocationPos(pOut, outer_rect, inner_size, location, pad); } pub fn calcLegendSize(pOut: [*c]imgui.ImVec2, items: *c.ImPlotItemGroup, pad: imgui.ImVec2, spacing: imgui.ImVec2, orientation: c.ImPlotOrientation) void { return c.ImPlot_CalcLegendSize(pOut, items, pad, spacing, orientation); } pub fn showLegendEntries(items: *c.ImPlotItemGroup, legend_bb: imgui.ImRect, interactable: bool, pad: imgui.ImVec2, spacing: imgui.ImVec2, orientation: c.ImPlotOrientation, DrawList: [*c]imgui.ImDrawList) bool { return c.ImPlot_ShowLegendEntries(items, legend_bb, interactable, pad, spacing, orientation, DrawList); } pub fn showAltLegend(title_id: [*c]const u8, orientation: c.ImPlotOrientation, size: imgui.ImVec2, interactable: bool) void { return c.ImPlot_ShowAltLegend(title_id, orientation, size, interactable); } pub fn showLegendContextMenu(legend: *c.ImPlotLegendData, visible: bool) bool { return c.ImPlot_ShowLegendContextMenu(legend, visible); } pub fn labelTickTime(tick: *c.ImPlotTick, buffer: [*c]imgui.ImGuiTextBuffer, t: c.ImPlotTime, fmt: c.ImPlotDateTimeFmt) void { return c.ImPlot_LabelTickTime(tick, buffer, t, fmt); } pub fn addTicksDefault(range: c.ImPlotRange, pix: f32, orn: c.ImPlotOrientation, ticks: *c.ImPlotTickCollection, fmt: [*c]const u8) void { return c.ImPlot_AddTicksDefault(range, pix, orn, ticks, fmt); } pub fn addTicksLogarithmic(range: c.ImPlotRange, pix: f32, orn: c.ImPlotOrientation, ticks: *c.ImPlotTickCollection, fmt: [*c]const u8) void { return c.ImPlot_AddTicksLogarithmic(range, pix, orn, ticks, fmt); } pub fn addTicksTime(range: c.ImPlotRange, plot_width: f32, ticks: *c.ImPlotTickCollection) void { return c.ImPlot_AddTicksTime(range, plot_width, ticks); } pub fn addTicksCustom(values: [*c]const f64, labels: [*c]const [*c]const u8, n: c_int, ticks: *c.ImPlotTickCollection, fmt: [*c]const u8) void { return c.ImPlot_AddTicksCustom(values, labels, n, ticks, fmt); } pub fn labelAxisValue(axis: c.ImPlotAxis, ticks: c.ImPlotTickCollection, value: f64, buff: [*c]u8, size: c_int) c_int { return c.ImPlot_LabelAxisValue(axis, ticks, value, buff, size); } pub fn getItemData() [*c]const c.ImPlotNextItemData { return c.ImPlot_GetItemData(); } pub fn isColorAuto_Vec4(col: imgui.ImVec4) bool { return c.ImPlot_IsColorAuto_Vec4(col); } pub fn isColorAuto_PlotCol(idx: c.ImPlotCol) bool { return c.ImPlot_IsColorAuto_PlotCol(idx); } pub fn getAutoColor(pOut: [*c]imgui.ImVec4, idx: c.ImPlotCol) void { return c.ImPlot_GetAutoColor(pOut, idx); } pub fn getStyleColorVec4(pOut: [*c]imgui.ImVec4, idx: c.ImPlotCol) void { return c.ImPlot_GetStyleColorVec4(pOut, idx); } pub fn getStyleColorU32(idx: c.ImPlotCol) imgui.ImU32 { return c.ImPlot_GetStyleColorU32(idx); } pub fn addTextVertical(DrawList: [*c]imgui.ImDrawList, pos: imgui.ImVec2, col: imgui.ImU32, text_begin: [*c]const u8, text_end: [*c]const u8) void { return c.ImPlot_AddTextVertical(DrawList, pos, col, text_begin, text_end); } pub fn addTextCentered(DrawList: [*c]imgui.ImDrawList, top_center: imgui.ImVec2, col: imgui.ImU32, text_begin: [*c]const u8, text_end: [*c]const u8) void { return c.ImPlot_AddTextCentered(DrawList, top_center, col, text_begin, text_end); } pub fn calcTextSizeVertical(pOut: [*c]imgui.ImVec2, text: [*c]const u8) void { return c.ImPlot_CalcTextSizeVertical(pOut, text); } pub fn calcTextColor_Vec4(bg: imgui.ImVec4) imgui.ImU32 { return c.ImPlot_CalcTextColor_Vec4(bg); } pub fn calcTextColor_U32(bg: imgui.ImU32) imgui.ImU32 { return c.ImPlot_CalcTextColor_U32(bg); } pub fn calcHoverColor(col: imgui.ImU32) imgui.ImU32 { return c.ImPlot_CalcHoverColor(col); } pub fn clampLabelPos(pOut: [*c]imgui.ImVec2, pos: imgui.ImVec2, size: imgui.ImVec2, Min: imgui.ImVec2, Max: imgui.ImVec2) void { return c.ImPlot_ClampLabelPos(pOut, pos, size, Min, Max); } pub fn getColormapColorU32(idx: c_int, cmap: c.ImPlotColormap) imgui.ImU32 { return c.ImPlot_GetColormapColorU32(idx, cmap); } pub fn nextColormapColorU32() imgui.ImU32 { return c.ImPlot_NextColormapColorU32(); } pub fn sampleColormapU32(t: f32, cmap: c.ImPlotColormap) imgui.ImU32 { return c.ImPlot_SampleColormapU32(t, cmap); } pub fn renderColorBar(colors: [*c]const imgui.ImU32, size: c_int, DrawList: [*c]imgui.ImDrawList, bounds: imgui.ImRect, vert: bool, reversed: bool, continuous: bool) void { return c.ImPlot_RenderColorBar(colors, size, DrawList, bounds, vert, reversed, continuous); } pub fn niceNum(x: f64, round: bool) f64 { return c.ImPlot_NiceNum(x, round); } pub fn orderOfMagnitude(val: f64) c_int { return c.ImPlot_OrderOfMagnitude(val); } pub fn orderToPrecision(order: c_int) c_int { return c.ImPlot_OrderToPrecision(order); } pub fn precision(val: f64) c_int { return c.ImPlot_Precision(val); } pub fn roundTo(val: f64, prec: c_int) f64 { return c.ImPlot_RoundTo(val, prec); } pub fn intersection(pOut: [*c]imgui.ImVec2, a1: imgui.ImVec2, a2: imgui.ImVec2, b1: imgui.ImVec2, b2: imgui.ImVec2) void { return c.ImPlot_Intersection(pOut, a1, a2, b1, b2); } pub fn fillRange_Vector_FloatPtr(buffer: [*c]imgui.ImVector_float, n: c_int, vmin: f32, vmax: f32) void { return c.ImPlot_FillRange_Vector_FloatPtr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_doublePtr(buffer: [*c]c.ImVector_double, n: c_int, vmin: f64, vmax: f64) void { return c.ImPlot_FillRange_Vector_doublePtr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_S8Ptr(buffer: [*c]c.ImVector_ImS8, n: c_int, vmin: imgui.ImS8, vmax: imgui.ImS8) void { return c.ImPlot_FillRange_Vector_S8Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_U8Ptr(buffer: [*c]c.ImVector_ImU8, n: c_int, vmin: imgui.ImU8, vmax: imgui.ImU8) void { return c.ImPlot_FillRange_Vector_U8Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_S16Ptr(buffer: [*c]c.ImVector_ImS16, n: c_int, vmin: imgui.ImS16, vmax: imgui.ImS16) void { return c.ImPlot_FillRange_Vector_S16Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_U16Ptr(buffer: [*c]c.ImVector_ImU16, n: c_int, vmin: imgui.ImU16, vmax: imgui.ImU16) void { return c.ImPlot_FillRange_Vector_U16Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_S32Ptr(buffer: [*c]c.ImVector_ImS32, n: c_int, vmin: imgui.ImS32, vmax: imgui.ImS32) void { return c.ImPlot_FillRange_Vector_S32Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_U32Ptr(buffer: [*c]imgui.ImVector_ImU32, n: c_int, vmin: imgui.ImU32, vmax: imgui.ImU32) void { return c.ImPlot_FillRange_Vector_U32Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_S64Ptr(buffer: [*c]c.ImVector_ImS64, n: c_int, vmin: imgui.ImS64, vmax: imgui.ImS64) void { return c.ImPlot_FillRange_Vector_S64Ptr(buffer, n, vmin, vmax); } pub fn fillRange_Vector_U64Ptr(buffer: [*c]c.ImVector_ImU64, n: c_int, vmin: imgui.ImU64, vmax: imgui.ImU64) void { return c.ImPlot_FillRange_Vector_U64Ptr(buffer, n, vmin, vmax); } pub fn calculateBins_FloatPtr(values: [*c]const f32, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_FloatPtr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_doublePtr(values: [*c]const f64, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_doublePtr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_S8Ptr(values: [*c]const imgui.ImS8, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_S8Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_U8Ptr(values: [*c]const imgui.ImU8, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_U8Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_S16Ptr(values: [*c]const imgui.ImS16, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_S16Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_U16Ptr(values: [*c]const imgui.ImU16, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_U16Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_S32Ptr(values: [*c]const imgui.ImS32, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_S32Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_U32Ptr(values: [*c]const imgui.ImU32, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_U32Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_S64Ptr(values: [*c]const imgui.ImS64, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_S64Ptr(values, count, meth, range, bins_out, width_out); } pub fn calculateBins_U64Ptr(values: [*c]const imgui.ImU64, count: c_int, meth: c.ImPlotBin, range: c.ImPlotRange, bins_out: [*c]c_int, width_out: [*c]f64) void { return c.ImPlot_CalculateBins_U64Ptr(values, count, meth, range, bins_out, width_out); } pub fn isLeapYear(year: c_int) bool { return c.ImPlot_IsLeapYear(year); } pub fn getDaysInMonth(year: c_int, month: c_int) c_int { return c.ImPlot_GetDaysInMonth(year, month); } pub fn mkGmtTime(pOut: *c.ImPlotTime, ptm: [*c]c.struct_tm) void { return c.ImPlot_MkGmtTime(pOut, ptm); } pub fn getGmtTime(t: c.ImPlotTime, ptm: [*c]c.tm) [*c]c.tm { return c.ImPlot_GetGmtTime(t, ptm); } pub fn mkLocTime(pOut: *c.ImPlotTime, ptm: [*c]c.struct_tm) void { return c.ImPlot_MkLocTime(pOut, ptm); } pub fn getLocTime(t: c.ImPlotTime, ptm: [*c]c.tm) [*c]c.tm { return c.ImPlot_GetLocTime(t, ptm); } pub fn makeTime(pOut: *c.ImPlotTime, year: c_int, month: c_int, day: c_int, hour: c_int, min: c_int, sec: c_int, us: c_int) void { return c.ImPlot_MakeTime(pOut, year, month, day, hour, min, sec, us); } pub fn getYear(t: c.ImPlotTime) c_int { return c.ImPlot_GetYear(t); } pub fn addTime(pOut: *c.ImPlotTime, t: c.ImPlotTime, unit: c.ImPlotTimeUnit, count: c_int) void { return c.ImPlot_AddTime(pOut, t, unit, count); } pub fn floorTime(pOut: *c.ImPlotTime, t: c.ImPlotTime, unit: c.ImPlotTimeUnit) void { return c.ImPlot_FloorTime(pOut, t, unit); } pub fn ceilTime(pOut: *c.ImPlotTime, t: c.ImPlotTime, unit: c.ImPlotTimeUnit) void { return c.ImPlot_CeilTime(pOut, t, unit); } pub fn roundTime(pOut: *c.ImPlotTime, t: c.ImPlotTime, unit: c.ImPlotTimeUnit) void { return c.ImPlot_RoundTime(pOut, t, unit); } pub fn combineDateTime(pOut: *c.ImPlotTime, date_part: c.ImPlotTime, time_part: c.ImPlotTime) void { return c.ImPlot_CombineDateTime(pOut, date_part, time_part); } pub fn formatTime(t: c.ImPlotTime, buffer: [*c]u8, size: c_int, fmt: c.ImPlotTimeFmt, use_24_hr_clk: bool) c_int { return c.ImPlot_FormatTime(t, buffer, size, fmt, use_24_hr_clk); } pub fn formatDate(t: c.ImPlotTime, buffer: [*c]u8, size: c_int, fmt: c.ImPlotDateFmt, use_iso_8601: bool) c_int { return c.ImPlot_FormatDate(t, buffer, size, fmt, use_iso_8601); } pub fn formatDateTime(t: c.ImPlotTime, buffer: [*c]u8, size: c_int, fmt: c.ImPlotDateTimeFmt) c_int { return c.ImPlot_FormatDateTime(t, buffer, size, fmt); } pub fn showDatePicker(id: [*c]const u8, level: [*c]c_int, t: *c.ImPlotTime, t1: [*c]const c.ImPlotTime, t2: [*c]const c.ImPlotTime) bool { return c.ImPlot_ShowDatePicker(id, level, t, t1, t2); } pub fn showTimePicker(id: [*c]const u8, t: *c.ImPlotTime) bool { return c.ImPlot_ShowTimePicker(id, t); } };
src/deps/imgui/ext/implot/implot.zig
const std = @import("std"); const print = std.debug.print; const data = @embedFile("../data/day16.txt"); pub fn main() !void { var timer = try std.time.Timer.start(); print("🎁 Total versions: {}\n", .{totalVersionInPacket(data)}); print("Day 16 - part 01 took {:15}ns\n", .{timer.lap()}); timer.reset(); print("🎁 Evaluation: {}\n", .{evaluatePacket(data)}); print("Day 16 - part 02 took {:15}ns\n", .{timer.lap()}); print("❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️\n", .{}); } const Packet = struct { input : []const u8, bitOffset : u32, pub fn init(input : []const u8) @This() { return @This() { .input = input, .bitOffset = 0 }; } pub fn skipBits(this: *@This(), bits : u32) void { this.bitOffset += bits; } pub fn readBits(this : *@This(), comptime T : type) T { const numBits : u32 = @typeInfo(T).Int.bits; // We support at most 32-bits read this way. std.debug.assert(numBits <= @typeInfo(u32).Int.bits); // Input is in hex. const inputLo = this.bitOffset / 4; const inputHi = std.math.min(this.input.len, (this.bitOffset + numBits + 4) / 4); const slice = this.input[inputLo..inputHi]; var sliceAsInt : u32 = std.fmt.parseInt(u32, slice, 16) catch unreachable; // Our algorithm effectively always needs a pad hex character on the end, // so if we end up on the last word, add a pad character by shiting by 4. if (((this.bitOffset + numBits + 4) / 4) > this.input.len) { sliceAsInt <<= 4; } const sliceHi = 4 - ((this.bitOffset + numBits) % 4); // Remove any trailing bits that don't form part of our result. sliceAsInt >>= @intCast(u5, sliceHi); // Remove any leading bits that don't form part of our result. sliceAsInt &= (1 << numBits) - 1; // Move the bit offset on. this.bitOffset += numBits; return @intCast(T, sliceAsInt); } pub fn totalVersion(this : *@This()) u32 { const version = this.readBits(u3); const typeId = this.readBits(u3); var total : u32 = version; switch (typeId) { 4 => { var decimal : u32 = 0; // We've got a literal! while (this.readBits(u1) == 1) { const bits = @intCast(@TypeOf(decimal), this.readBits(u4)); decimal <<= 4; decimal |= bits; } const bits = @intCast(@TypeOf(decimal), this.readBits(u4)); decimal <<= 4; decimal |= bits; }, else => { // Check the 'length type ID'. if (this.readBits(u1) == 0) { // If the length type ID is 0, then the next 15 bits are a number that // represents the total length in bits of the sub-packets contained by // this packet. const lengthInBits = this.readBits(u15); const currentOffset = this.bitOffset; while ((currentOffset + lengthInBits) != this.bitOffset) { total += this.totalVersion(); } } else { const numSubPackets = this.readBits(u11); var index : u32 = 0; while (index < numSubPackets) : (index += 1) { total += this.totalVersion(); } } }, } return total; } fn foldResult(typeId : u3, a : u64, b : u64) u64 { switch (typeId) { 0 => return a + b, 1 => return a * b, 2 => return std.math.min(a, b), 3 => return std.math.max(a, b), 5 => return if (a > b) 1 else 0, 6 => return if (a < b) 1 else 0, 7 => return if (a == b) 1 else 0, else => unreachable, } } pub fn evaluate(this : *@This()) u64 { const version = this.readBits(u3); const typeId = this.readBits(u3); switch (typeId) { 4 => { var decimal : u64 = 0; // We've got a literal! while (this.readBits(u1) == 1) { const bits = @intCast(@TypeOf(decimal), this.readBits(u4)); decimal <<= 4; decimal |= bits; } const bits = @intCast(@TypeOf(decimal), this.readBits(u4)); decimal <<= 4; decimal |= bits; return decimal; }, else => { // Check the 'length type ID'. if (this.readBits(u1) == 0) { // If the length type ID is 0, then the next 15 bits are a number that // represents the total length in bits of the sub-packets contained by // this packet. const lengthInBits = this.readBits(u15); const currentOffset = this.bitOffset; var result : ?u64 = null; while ((currentOffset + lengthInBits) != this.bitOffset) { const subPacketResult = this.evaluate(); if (result == null) { result = subPacketResult; } else { result = foldResult(typeId, result.?, subPacketResult); } } return result.?; } else { const numSubPackets = this.readBits(u11); var result : ?u64 = null; var index : u32 = 0; while (index < numSubPackets) : (index += 1) { const subPacketResult = this.evaluate(); if (result == null) { result = subPacketResult; } else { result = foldResult(typeId, result.?, subPacketResult); } } return result.?; } }, } return total; } }; fn totalVersionInPacket(input : []const u8) u32 { var packet = Packet.init(input); return packet.totalVersion(); } fn evaluatePacket(input : []const u8) u64 { var packet = Packet.init(input); return packet.evaluate(); } test "D2FE28" { const input = "D2FE28"; try std.testing.expect(totalVersionInPacket(input) == 6); } test "38006F45291200" { const input = "38006F45291200"; try std.testing.expect(totalVersionInPacket(input) == 9); } test "EE00D40C823060" { const input = "EE00D40C823060"; try std.testing.expect(totalVersionInPacket(input) == 14); } test "8A004A801A8002F478" { const input = "8A004A801A8002F478"; try std.testing.expect(totalVersionInPacket(input) == 16); } test "620080001611562C8802118E34" { const input = "620080001611562C8802118E34"; try std.testing.expect(totalVersionInPacket(input) == 12); } test "C0015000016115A2E0802F182340" { const input = "C0015000016115A2E0802F182340"; try std.testing.expect(totalVersionInPacket(input) == 23); } test "A0016C880162017C3686B18A3D4780" { const input = "A0016C880162017C3686B18A3D4780"; try std.testing.expect(totalVersionInPacket(input) == 31); } test "C200B40A82" { const input = "C200B40A82"; try std.testing.expect(evaluatePacket(input) == 3); } test "04005AC33890" { const input = "04005AC33890"; try std.testing.expect(evaluatePacket(input) == 54); } test "880086C3E88112" { const input = "880086C3E88112"; try std.testing.expect(evaluatePacket(input) == 7); } test "CE00C43D881120" { const input = "CE00C43D881120"; try std.testing.expect(evaluatePacket(input) == 9); } test "D8005AC2A8F0" { const input = "D8005AC2A8F0"; try std.testing.expect(evaluatePacket(input) == 1); } test "F600BC2D8F" { const input = "F600BC2D8F"; try std.testing.expect(evaluatePacket(input) == 0); } test "9C005AC2F8F0" { const input = "9C005AC2F8F0"; try std.testing.expect(evaluatePacket(input) == 0); } test "9C0141080250320F1802104A08" { const input = "9C0141080250320F1802104A08"; try std.testing.expect(evaluatePacket(input) == 1); }
src/day16.zig
const std = @import("std"); pub const SSCAN = struct { key: []const u8, cursor: []const u8, pattern: Pattern, count: Count, pub const Pattern = union(enum) { NoPattern, Pattern: []const u8, pub const RedisArguments = struct { pub fn count(self: Pattern) usize { return switch (self) { .NoPattern => 0, .Pattern => 2, }; } pub fn serialize(self: Pattern, comptime rootSerializer: type, msg: anytype) !void { switch (self) { .NoPattern => {}, .Pattern => |p| { try rootSerializer.serializeArgument(msg, []const u8, "MATCH"); try rootSerializer.serializeArgument(msg, []const u8, p); }, } } }; }; pub const Count = union(enum) { NoCount, Count: usize, pub const RedisArguments = struct { pub fn count(self: Count) usize { return switch (self) { .NoCount => 0, .Count => 2, }; } pub fn serialize(self: Count, comptime rootSerializer: type, msg: anytype) !void { switch (self) { .NoCount => {}, .Count => |c| { try rootSerializer.serializeArgument(msg, []const u8, "COUNT"); try rootSerializer.serializeArgument(msg, usize, c); }, } } }; }; /// Instantiates a new SPOP command. pub fn init(key: []const u8, cursor: []const u8, pattern: Pattern, count: Count) SSCAN { // TODO: support std.hashmap used as a set! return .{ .key = key, .cursor = cursor, .pattern = pattern, .count = count }; } /// Validates if the command is syntactically correct. pub fn validate(_: SSCAN) !void {} pub const RedisCommand = struct { pub fn serialize(self: SSCAN, comptime rootSerializer: type, msg: anytype) !void { return rootSerializer.serializeCommand(msg, .{ "SSCAN", self.key, self.cursor, self.pattern, self.count, }); } }; }; test "basic usage" { const cmd = SSCAN.init("myset", "0", .NoPattern, .NoCount); try cmd.validate(); const cmd1 = SSCAN.init("myset", "0", SSCAN.Pattern{ .Pattern = "zig_*" }, SSCAN.Count{ .Count = 5 }); try cmd1.validate(); } test "serializer" { const serializer = @import("../../serializer.zig").CommandSerializer; var correctBuf: [1000]u8 = undefined; var correctMsg = std.io.fixedBufferStream(correctBuf[0..]); var testBuf: [1000]u8 = undefined; var testMsg = std.io.fixedBufferStream(testBuf[0..]); { { correctMsg.reset(); testMsg.reset(); try serializer.serializeCommand( testMsg.writer(), SSCAN.init("myset", "0", .NoPattern, .NoCount), ); try serializer.serializeCommand( correctMsg.writer(), .{ "SSCAN", "myset", "0" }, ); // std.debug.warn("{}\n\n\n{}\n", .{ correctMsg.getWritten(), testMsg.getWritten() }); try std.testing.expectEqualSlices(u8, correctMsg.getWritten(), testMsg.getWritten()); } { correctMsg.reset(); testMsg.reset(); try serializer.serializeCommand( testMsg.writer(), SSCAN.init("myset", "0", SSCAN.Pattern{ .Pattern = "zig_*" }, SSCAN.Count{ .Count = 5 }), ); try serializer.serializeCommand( correctMsg.writer(), .{ "SSCAN", "myset", 0, "MATCH", "zig_*", "COUNT", 5 }, ); // std.debug.warn("\n{}\n\n\n{}\n", .{ correctMsg.getWritten(), testMsg.getWritten() }); try std.testing.expectEqualSlices(u8, correctMsg.getWritten(), testMsg.getWritten()); } } }
src/commands/sets/sscan.zig
const std = @import("std"); const GameSimulation = @import("GameSimulation.zig"); const CharacterData = @import("CharacterData.zig"); const Component = @import("Component.zig"); const math = @import("utils/math.zig"); // Create a new hitbox translated by the offset provided. fn TranslateHitbox(hitbox: CharacterData.Hitbox, offset: math.IntVector2D) CharacterData.Hitbox { return CharacterData.Hitbox { .left = (hitbox.left + offset.x), .top = (hitbox.top + offset.y), .right = (hitbox.right + offset.x), .bottom = (hitbox.bottom + offset.y) }; } // Check to see if two hitboxes overlap fn DoHitboxesOverlap(a: CharacterData.Hitbox, b: CharacterData.Hitbox) bool { const IsNotOverlapping = (a.left > b.right) or (b.left > a.right) or (a.bottom > b.top) or (b.bottom > a.top); return !IsNotOverlapping; } fn GetActiveAttackHiboxes(gameState: *const GameSimulation.GameState, entity: usize) ?*CharacterData.HitboxGroup { // Unused for now _ = gameState; _ = entity; // if(gameState.gameData) | gameData | // { // gameData.CharacterProperties[entity]. // } return null; } const ScratchHitboxSet = struct { hitboxStore: [10]CharacterData.Hitbox, hitboxes: []CharacterData.Hitbox }; const CollisionSystem = struct { // Working memory to pass between the collision system stages AttackerEntityBoxes: std.ArrayList(ScratchHitboxSet), DefenderEntityBoxes: std.ArrayList(ScratchHitboxSet), fn Init(allocator: std.mem.Allocator) !CollisionSystem { var Attacker = try std.ArrayList(ScratchHitboxSet).initCapacity(allocator, 10); var Defender = try std.ArrayList(ScratchHitboxSet).initCapacity(allocator, 10); return CollisionSystem { .AttackerEntityBoxes = Attacker, .DefenderEntityBoxes = Defender }; } // fn PrepareHitbox(self: CollisionSystem, gameState: *GameSimulation.GameState) void // { // } fn Execute(self: CollisionSystem, gameState: *GameSimulation.GameState) void { // TODO: Remove when the parameter is used. _ = gameState; // Preprocessing step. Generated hitboxes used to actually check collision. // var entity: usize = 0; // while (entity < gameState.entityCount) // { // const entityOffset = gameState.physicsComponent[entity].position; // // Get active attack hitboxes and offset them. // // GetActiveAttackHitboxes(entity); // TranslateHitbox(hitbox, entityOffset); // entity += 1; // } for(self.AttackerEntityBoxes.items) | AttackBoxes, attackerIndex | { for(AttackBoxes.hitboxes) | attackBox | { for(self.DefenderEntityBoxes.items) | VulnerableBoxes, defenderIndex | { // Don't check an attacker against itself. if(attackerIndex == defenderIndex) { continue; } for(VulnerableBoxes.hitboxes) | vulnerableBox | { if(DoHitboxesOverlap(attackBox, vulnerableBox)) { // Generate Hit event. } } } } } } }; test "Initializing the collision system" { var ArenaAllocator = std.heap.ArenaAllocator.init(std.heap.page_allocator); var collisionSystem : CollisionSystem = try CollisionSystem.Init(ArenaAllocator.allocator()); // The collision system currently supports processing 10 attack boxes at a time. try std.testing.expect(collisionSystem.AttackerEntityBoxes.capacity == 10); try std.testing.expect(collisionSystem.AttackerEntityBoxes.items.len == 0); // The collision system currently supports processing 10 vulnerable boxes at a time. try std.testing.expect(collisionSystem.DefenderEntityBoxes.capacity == 10); try std.testing.expect(collisionSystem.DefenderEntityBoxes.items.len == 0); } test "Test clearing out scratch hitbox data each frame" { var ArenaAllocator = std.heap.ArenaAllocator.init(std.heap.page_allocator); var collisionSystem : CollisionSystem = try CollisionSystem.Init(ArenaAllocator.allocator()); var Allocator = ArenaAllocator.allocator(); // Our game state var gameState = GameSimulation.GameState{.allocator = ArenaAllocator.allocator() }; gameState.Init(); if(gameState.gameData) | *gameData | { var Character = try CharacterData.CharacterProperties.init(Allocator); // Add a test character try gameData.Characters.append(Character); } // Check to see if hitboxes are staged // collisionSytstem.PrepareHitbox(&gameState); try std.testing.expect(collisionSystem.AttackerEntityBoxes.items.len == 2); try std.testing.expect(collisionSystem.DefenderEntityBoxes.items.len == 4); collisionSystem.Execute(&gameState); }
src/CollisionSystem.zig
const std = @import("std"); const DocumentStore = @import("document_store.zig"); const ast = std.zig.ast; const types = @import("types.zig"); /// Get a declaration's doc comment node fn getDocCommentNode(tree: *ast.Tree, node: *ast.Node) ?*ast.Node.DocComment { if (node.cast(ast.Node.FnProto)) |func| { return func.doc_comments; } else if (node.cast(ast.Node.VarDecl)) |var_decl| { return var_decl.doc_comments; } else if (node.cast(ast.Node.ContainerField)) |field| { return field.doc_comments; } else if (node.cast(ast.Node.ErrorTag)) |tag| { return tag.doc_comments; } return null; } /// Gets a declaration's doc comments, caller must free memory when a value is returned /// Like: ///```zig ///var comments = getFunctionDocComments(allocator, tree, func); ///defer if (comments) |comments_pointer| allocator.free(comments_pointer); ///``` pub fn getDocComments( allocator: *std.mem.Allocator, tree: *ast.Tree, node: *ast.Node, format: types.MarkupKind, ) !?[]const u8 { if (getDocCommentNode(tree, node)) |doc_comment_node| { return try collectDocComments(allocator, tree, doc_comment_node, format); } return null; } pub fn collectDocComments( allocator: *std.mem.Allocator, tree: *ast.Tree, doc_comments: *ast.Node.DocComment, format: types.MarkupKind, ) ![]const u8 { var lines = std.ArrayList([]const u8).init(allocator); defer lines.deinit(); var curr_line_tok = doc_comments.first_line; while (true) : (curr_line_tok += 1) { switch (tree.token_ids[curr_line_tok]) { .LineComment => continue, .DocComment, .ContainerDocComment => { try lines.append(std.fmt.trim(tree.tokenSlice(curr_line_tok)[3..])); }, else => break, } } return try std.mem.join(allocator, if (format == .Markdown) " \n" else "\n", lines.items); } /// Gets a function signature (keywords, name, return value) pub fn getFunctionSignature(tree: *ast.Tree, func: *ast.Node.FnProto) []const u8 { const start = tree.token_locs[func.firstToken()].start; const end = tree.token_locs[switch (func.return_type) { .Explicit, .InferErrorSet => |node| node.lastToken(), .Invalid => |r_paren| r_paren, }].end; return tree.source[start..end]; } /// Gets a function snippet insert text pub fn getFunctionSnippet(allocator: *std.mem.Allocator, tree: *ast.Tree, func: *ast.Node.FnProto, skip_self_param: bool) ![]const u8 { const name_tok = func.name_token orelse unreachable; var buffer = std.ArrayList(u8).init(allocator); try buffer.ensureCapacity(128); try buffer.appendSlice(tree.tokenSlice(name_tok)); try buffer.append('('); var buf_stream = buffer.outStream(); for (func.paramsConst()) |param, param_num| { if (skip_self_param and param_num == 0) continue; if (param_num != @boolToInt(skip_self_param)) try buffer.appendSlice(", ${") else try buffer.appendSlice("${"); try buf_stream.print("{}:", .{param_num + 1}); if (param.comptime_token) |_| { try buffer.appendSlice("comptime "); } if (param.noalias_token) |_| { try buffer.appendSlice("noalias "); } if (param.name_token) |name_token| { try buffer.appendSlice(tree.tokenSlice(name_token)); try buffer.appendSlice(": "); } switch (param.param_type) { .var_args => try buffer.appendSlice("..."), .var_type => try buffer.appendSlice("var"), .type_expr => |type_expr| { var curr_tok = type_expr.firstToken(); var end_tok = type_expr.lastToken(); while (curr_tok <= end_tok) : (curr_tok += 1) { const id = tree.token_ids[curr_tok]; const is_comma = id == .Comma; if (curr_tok == end_tok and is_comma) continue; try buffer.appendSlice(tree.tokenSlice(curr_tok)); if (is_comma or id == .Keyword_const) try buffer.append(' '); } }, } try buffer.append('}'); } try buffer.append(')'); return buffer.toOwnedSlice(); } /// Gets a function signature (keywords, name, return value) pub fn getVariableSignature(tree: *ast.Tree, var_decl: *ast.Node.VarDecl) []const u8 { const start = tree.token_locs[var_decl.firstToken()].start; const end = tree.token_locs[var_decl.semicolon_token].start; return tree.source[start..end]; } // analysis.getContainerFieldSignature(handle.tree, field) pub fn getContainerFieldSignature(tree: *ast.Tree, field: *ast.Node.ContainerField) []const u8 { const start = tree.token_locs[field.firstToken()].start; const end = tree.token_locs[field.lastToken()].end; return tree.source[start..end]; } /// The type node is "type" fn typeIsType(tree: *ast.Tree, node: *ast.Node) bool { if (node.cast(ast.Node.Identifier)) |ident| { return std.mem.eql(u8, tree.tokenSlice(ident.token), "type"); } return false; } pub fn isTypeFunction(tree: *ast.Tree, func: *ast.Node.FnProto) bool { switch (func.return_type) { .Explicit => |node| return typeIsType(tree, node), .InferErrorSet, .Invalid => return false, } } // STYLE pub fn isCamelCase(name: []const u8) bool { return !std.ascii.isUpper(name[0]) and std.mem.indexOf(u8, name, "_") == null; } pub fn isPascalCase(name: []const u8) bool { return std.ascii.isUpper(name[0]) and std.mem.indexOf(u8, name, "_") == null; } // ANALYSIS ENGINE pub fn getDeclNameToken(tree: *ast.Tree, node: *ast.Node) ?ast.TokenIndex { switch (node.id) { .VarDecl => { const vari = node.cast(ast.Node.VarDecl).?; return vari.name_token; }, .FnProto => { const func = node.cast(ast.Node.FnProto).?; if (func.name_token == null) return null; return func.name_token.?; }, .ContainerField => { const field = node.cast(ast.Node.ContainerField).?; return field.name_token; }, .ErrorTag => { const tag = node.cast(ast.Node.ErrorTag).?; return tag.name_token; }, // We need identifier for captures and error set tags .Identifier => { const ident = node.cast(ast.Node.Identifier).?; return ident.token; }, .TestDecl => { const decl = node.cast(ast.Node.TestDecl).?; return (decl.name.cast(ast.Node.StringLiteral) orelse return null).token; }, else => {}, } return null; } fn getDeclName(tree: *ast.Tree, node: *ast.Node) ?[]const u8 { const name = tree.tokenSlice(getDeclNameToken(tree, node) orelse return null); return switch (node.id) { .TestDecl => name[1 .. name.len - 1], else => name, }; } fn isContainerDecl(decl_handle: DeclWithHandle) bool { return switch (decl_handle.decl.*) { .ast_node => |inner_node| inner_node.id == .ContainerDecl or inner_node.id == .Root, else => false, }; } fn resolveVarDeclAliasInternal( store: *DocumentStore, arena: *std.heap.ArenaAllocator, node_handle: NodeWithHandle, root: bool, ) error{OutOfMemory}!?DeclWithHandle { const handle = node_handle.handle; if (node_handle.node.cast(ast.Node.Identifier)) |ident| { return try lookupSymbolGlobal(store, arena, handle, handle.tree.tokenSlice(ident.token), handle.tree.token_locs[ident.token].start); } if (node_handle.node.cast(ast.Node.InfixOp)) |infix_op| { if (infix_op.op != .Period) return null; const container_node = if (infix_op.lhs.cast(ast.Node.BuiltinCall)) |builtin_call| block: { if (!std.mem.eql(u8, handle.tree.tokenSlice(builtin_call.builtin_token), "@import")) return null; const inner_node = (try resolveTypeOfNode(store, arena, .{ .node = infix_op.lhs, .handle = handle })) orelse return null; std.debug.assert(inner_node.type.data.other.id == .Root); break :block NodeWithHandle{ .node = inner_node.type.data.other, .handle = inner_node.handle }; } else if (try resolveVarDeclAliasInternal(store, arena, .{ .node = infix_op.lhs, .handle = handle }, false)) |decl_handle| block: { if (decl_handle.decl.* != .ast_node) return null; const resolved = (try resolveTypeOfNode(store, arena, .{ .node = decl_handle.decl.ast_node, .handle = decl_handle.handle })) orelse return null; const resolved_node = switch (resolved.type.data) { .other => |n| n, else => return null, }; if (resolved_node.id != .ContainerDecl and resolved_node.id != .Root) return null; break :block NodeWithHandle{ .node = resolved_node, .handle = resolved.handle }; } else return null; if (try lookupSymbolContainer(store, arena, container_node, handle.tree.tokenSlice(infix_op.rhs.firstToken()), false)) |inner_decl| { if (root) return inner_decl; return inner_decl; } } return null; } /// Resolves variable declarations consisting of chains of imports and field accesses of containers, ending with the same name as the variable decl's name /// Examples: ///```zig /// const decl = @import("decl-file.zig").decl; /// const other = decl.middle.other; ///``` pub fn resolveVarDeclAlias(store: *DocumentStore, arena: *std.heap.ArenaAllocator, decl_handle: NodeWithHandle) !?DeclWithHandle { const decl = decl_handle.node; const handle = decl_handle.handle; if (decl.cast(ast.Node.VarDecl)) |var_decl| { if (var_decl.init_node == null) return null; if (handle.tree.token_ids[var_decl.mut_token] != .Keyword_const) return null; const base_expr = var_decl.init_node.?; if (base_expr.cast(ast.Node.InfixOp)) |infix_op| { if (infix_op.op != .Period) return null; const name = handle.tree.tokenSlice(infix_op.rhs.firstToken()); if (!std.mem.eql(u8, handle.tree.tokenSlice(var_decl.name_token), name)) return null; return try resolveVarDeclAliasInternal(store, arena, .{ .node = base_expr, .handle = handle }, true); } } return null; } fn findReturnStatementInternal( tree: *ast.Tree, fn_decl: *ast.Node.FnProto, base_node: *ast.Node, already_found: *bool, ) ?*ast.Node.ControlFlowExpression { var result: ?*ast.Node.ControlFlowExpression = null; var child_idx: usize = 0; while (base_node.iterate(child_idx)) |child_node| : (child_idx += 1) { switch (child_node.id) { .ControlFlowExpression => blk: { const cfe = child_node.cast(ast.Node.ControlFlowExpression).?; if (cfe.kind != .Return) break :blk; // If we are calling ourselves recursively, ignore this return. if (cfe.rhs) |rhs| { if (rhs.cast(ast.Node.Call)) |call_node| { if (call_node.lhs.id == .Identifier) { if (std.mem.eql(u8, getDeclName(tree, call_node.lhs).?, getDeclName(tree, &fn_decl.base).?)) { continue; } } } } if (already_found.*) return null; already_found.* = true; result = cfe; continue; }, else => {}, } result = findReturnStatementInternal(tree, fn_decl, child_node, already_found); } return result; } fn findReturnStatement(tree: *ast.Tree, fn_decl: *ast.Node.FnProto) ?*ast.Node.ControlFlowExpression { var already_found = false; return findReturnStatementInternal(tree, fn_decl, fn_decl.body_node.?, &already_found); } /// Resolves the return type of a function fn resolveReturnType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, fn_decl: *ast.Node.FnProto, handle: *DocumentStore.Handle, bound_type_params: *BoundTypeParams, ) !?TypeWithHandle { if (isTypeFunction(handle.tree, fn_decl) and fn_decl.body_node != null) { // If this is a type function and it only contains a single return statement that returns // a container declaration, we will return that declaration. const ret = findReturnStatement(handle.tree, fn_decl) orelse return null; if (ret.rhs) |rhs| { return try resolveTypeOfNodeInternal(store, arena, .{ .node = rhs, .handle = handle, }, bound_type_params); } return null; } return switch (fn_decl.return_type) { .InferErrorSet => |return_type| block: { const child_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = return_type, .handle = handle, }, bound_type_params)) orelse return null; const child_type_node = switch (child_type.type.data) { .other => |n| n, else => return null, }; break :block TypeWithHandle{ .type = .{ .data = .{ .error_union = child_type_node }, .is_type_val = false }, .handle = child_type.handle }; }, .Explicit => |return_type| ((try resolveTypeOfNodeInternal(store, arena, .{ .node = return_type, .handle = handle, }, bound_type_params)) orelse return null).instanceTypeVal(), .Invalid => null, }; } /// Resolves the child type of an optional type fn resolveUnwrapOptionalType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, opt: TypeWithHandle, bound_type_params: *BoundTypeParams, ) !?TypeWithHandle { const opt_node = switch (opt.type.data) { .other => |n| n, else => return null, }; if (opt_node.cast(ast.Node.PrefixOp)) |prefix_op| { if (prefix_op.op == .OptionalType) { return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = prefix_op.rhs, .handle = opt.handle, }, bound_type_params)) orelse return null).instanceTypeVal(); } } return null; } fn resolveUnwrapErrorType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, rhs: TypeWithHandle, bound_type_params: *BoundTypeParams, ) !?TypeWithHandle { const rhs_node = switch (rhs.type.data) { .other => |n| n, .error_union => |n| return TypeWithHandle{ .type = .{ .data = .{ .other = n }, .is_type_val = rhs.type.is_type_val }, .handle = rhs.handle, }, .primitive, .slice => return null, }; if (rhs_node.cast(ast.Node.InfixOp)) |infix_op| { if (infix_op.op == .ErrorUnion) { return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = infix_op.rhs, .handle = rhs.handle, }, bound_type_params)) orelse return null).instanceTypeVal(); } } return null; } /// Resolves the child type of a defer type fn resolveDerefType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, deref: TypeWithHandle, bound_type_params: *BoundTypeParams, ) !?TypeWithHandle { const deref_node = switch (deref.type.data) { .other => |n| n, else => return null, }; if (deref_node.cast(ast.Node.PrefixOp)) |pop| { if (pop.op == .PtrType) { const op_token_id = deref.handle.tree.token_ids[pop.op_token]; switch (op_token_id) { .Asterisk => { return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = pop.rhs, .handle = deref.handle, }, bound_type_params)) orelse return null).instanceTypeVal(); }, .LBracket, .AsteriskAsterisk => return null, else => unreachable, } } } return null; } /// Resolves bracket access type (both slicing and array access) fn resolveBracketAccessType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, lhs: TypeWithHandle, rhs: enum { Single, Range }, bound_type_params: *BoundTypeParams, ) !?TypeWithHandle { const lhs_node = switch (lhs.type.data) { .other => |n| n, else => return null, }; if (lhs_node.cast(ast.Node.PrefixOp)) |pop| { switch (pop.op) { .SliceType => { if (rhs == .Single) return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = pop.rhs, .handle = lhs.handle, }, bound_type_params)) orelse return null).instanceTypeVal(); return lhs; }, .ArrayType => { if (rhs == .Single) return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = pop.rhs, .handle = lhs.handle, }, bound_type_params)) orelse return null).instanceTypeVal(); return TypeWithHandle{ .type = .{ .data = .{ .slice = pop.rhs }, .is_type_val = false }, .handle = lhs.handle, }; }, .PtrType => { if (pop.rhs.cast(std.zig.ast.Node.PrefixOp)) |child_pop| { switch (child_pop.op) { .ArrayType => { if (rhs == .Single) { return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = child_pop.rhs, .handle = lhs.handle, }, bound_type_params)) orelse return null).instanceTypeVal(); } return lhs; }, else => {}, } } }, else => {}, } } return null; } /// Called to remove one level of pointerness before a field access pub fn resolveFieldAccessLhsType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, lhs: TypeWithHandle, bound_type_params: *BoundTypeParams, ) !TypeWithHandle { return (try resolveDerefType(store, arena, lhs, bound_type_params)) orelse lhs; } pub const BoundTypeParams = std.AutoHashMap(*const ast.Node.FnProto.ParamDecl, TypeWithHandle); fn allDigits(str: []const u8) bool { for (str) |c| { if (!std.ascii.isDigit(c)) return false; } return true; } pub fn isTypeIdent(tree: *ast.Tree, token_idx: ast.TokenIndex) bool { const PrimitiveTypes = std.ComptimeStringMap(void, .{ .{"isize"}, .{"usize"}, .{"c_short"}, .{"c_ushort"}, .{"c_int"}, .{"c_uint"}, .{"c_long"}, .{"c_ulong"}, .{"c_longlong"}, .{"c_ulonglong"}, .{"c_longdouble"}, .{"c_void"}, .{"f16"}, .{"f32"}, .{"f64"}, .{"f128"}, .{"bool"}, .{"void"}, .{"noreturn"}, .{"type"}, .{"anyerror"}, .{"comptime_int"}, .{"comptime_float"}, .{"anyframe"}, }); const text = tree.tokenSlice(token_idx); if (PrimitiveTypes.has(text)) return true; if (text.len > 1 and (text[0] == 'u' or text[0] == 'i') and allDigits(text[1..])) return true; return false; } /// Resolves the type of a node pub fn resolveTypeOfNodeInternal( store: *DocumentStore, arena: *std.heap.ArenaAllocator, node_handle: NodeWithHandle, bound_type_params: *BoundTypeParams, ) error{OutOfMemory}!?TypeWithHandle { const node = node_handle.node; const handle = node_handle.handle; switch (node.id) { .VarDecl => { const vari = node.cast(ast.Node.VarDecl).?; if (vari.type_node) |type_node| block: { return ((try resolveTypeOfNodeInternal( store, arena, .{ .node = vari.type_node orelse break :block, .handle = handle }, bound_type_params, )) orelse break :block).instanceTypeVal(); } return try resolveTypeOfNodeInternal(store, arena, .{ .node = vari.init_node.?, .handle = handle }, bound_type_params); }, .Identifier => { if (isTypeIdent(handle.tree, node.firstToken())) { return TypeWithHandle{ .type = .{ .data = .primitive, .is_type_val = true }, .handle = handle, }; } if (try lookupSymbolGlobal(store, arena, handle, handle.tree.getNodeSource(node), handle.tree.token_locs[node.firstToken()].start)) |child| { switch (child.decl.*) { .ast_node => |n| if (n == node) return null, else => {}, } return try child.resolveType(store, arena, bound_type_params); } return null; }, .ContainerField => { const field = node.cast(ast.Node.ContainerField).?; return ((try resolveTypeOfNodeInternal( store, arena, .{ .node = field.type_expr orelse return null, .handle = handle }, bound_type_params, )) orelse return null).instanceTypeVal(); }, .Call => { const call = node.cast(ast.Node.Call).?; const decl = (try resolveTypeOfNodeInternal( store, arena, .{ .node = call.lhs, .handle = handle }, bound_type_params, )) orelse return null; if (decl.type.is_type_val) return null; const decl_node = switch (decl.type.data) { .other => |n| n, else => return null, }; if (decl_node.cast(ast.Node.FnProto)) |fn_decl| { var has_self_param: u8 = 0; if (call.lhs.cast(ast.Node.InfixOp)) |lhs_infix_op| { if (lhs_infix_op.op == .Period) { has_self_param = 1; } } // Bidn type params to the expressions passed in the calls. const param_len = std.math.min(call.params_len + has_self_param, fn_decl.params_len); for (fn_decl.paramsConst()) |*decl_param, param_idx| { if (param_idx < has_self_param) continue; if (param_idx >= param_len) break; const type_param = switch (decl_param.param_type) { .type_expr => |type_node| typeIsType(decl.handle.tree, type_node), else => false, }; if (!type_param) continue; const call_param_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = call.paramsConst()[param_idx - has_self_param], .handle = handle, }, bound_type_params)) orelse continue; if (!call_param_type.type.is_type_val) continue; _ = try bound_type_params.put(decl_param, call_param_type); } return try resolveReturnType(store, arena, fn_decl, decl.handle, bound_type_params); } return null; }, .GroupedExpression => { const grouped = node.cast(ast.Node.GroupedExpression).?; return try resolveTypeOfNodeInternal(store, arena, .{ .node = grouped.expr, .handle = handle }, bound_type_params); }, .StructInitializer => { const struct_init = node.cast(ast.Node.StructInitializer).?; return ((try resolveTypeOfNodeInternal( store, arena, .{ .node = struct_init.lhs, .handle = handle }, bound_type_params, )) orelse return null).instanceTypeVal(); }, .ErrorSetDecl => { const set = node.cast(ast.Node.ErrorSetDecl).?; var i: usize = 0; while (set.iterate(i)) |decl| : (i += 1) { try store.error_completions.add(handle.tree, decl); } return TypeWithHandle.typeVal(node_handle); }, .SuffixOp => { const suffix_op = node.cast(ast.Node.SuffixOp).?; const left_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = suffix_op.lhs, .handle = handle, }, bound_type_params)) orelse return null; return switch (suffix_op.op) { .UnwrapOptional => try resolveUnwrapOptionalType(store, arena, left_type, bound_type_params), .Deref => try resolveDerefType(store, arena, left_type, bound_type_params), .ArrayAccess => try resolveBracketAccessType(store, arena, left_type, .Single, bound_type_params), .Slice => try resolveBracketAccessType(store, arena, left_type, .Range, bound_type_params), else => null, }; }, .InfixOp => { const infix_op = node.cast(ast.Node.InfixOp).?; switch (infix_op.op) { .Period => { const rhs_str = nodeToString(handle.tree, infix_op.rhs) orelse return null; // If we are accessing a pointer type, remove one pointerness level :) const left_type = try resolveFieldAccessLhsType( store, arena, (try resolveTypeOfNodeInternal(store, arena, .{ .node = infix_op.lhs, .handle = handle, }, bound_type_params)) orelse return null, bound_type_params, ); const left_type_node = switch (left_type.type.data) { .other => |n| n, else => return null, }; if (try lookupSymbolContainer( store, arena, .{ .node = left_type_node, .handle = left_type.handle }, rhs_str, !left_type.type.is_type_val, )) |child| { return try child.resolveType(store, arena, bound_type_params); } else return null; }, .UnwrapOptional => { const left_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = infix_op.lhs, .handle = handle, }, bound_type_params)) orelse return null; return try resolveUnwrapOptionalType(store, arena, left_type, bound_type_params); }, .Catch => { const left_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = infix_op.lhs, .handle = handle, }, bound_type_params)) orelse return null; return try resolveUnwrapErrorType(store, arena, left_type, bound_type_params); }, .ErrorUnion => return TypeWithHandle.typeVal(node_handle), else => return null, } }, .PrefixOp => { const prefix_op = node.cast(ast.Node.PrefixOp).?; switch (prefix_op.op) { .SliceType, .ArrayType, .OptionalType, .PtrType, => return TypeWithHandle.typeVal(node_handle), .Try => { const rhs_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = prefix_op.rhs, .handle = handle, }, bound_type_params)) orelse return null; return try resolveUnwrapErrorType(store, arena, rhs_type, bound_type_params); }, else => {}, } }, .BuiltinCall => { const builtin_call = node.cast(ast.Node.BuiltinCall).?; const call_name = handle.tree.tokenSlice(builtin_call.builtin_token); if (std.mem.eql(u8, call_name, "@This")) { if (builtin_call.params_len != 0) return null; return innermostContainer(handle, handle.tree.token_locs[builtin_call.firstToken()].start); } const cast_map = std.ComptimeStringMap(void, .{ .{"@as"}, .{"@bitCast"}, .{"@fieldParentPtr"}, .{"@floatCast"}, .{"@floatToInt"}, .{"@intCast"}, .{"@intToEnum"}, .{"@intToFloat"}, .{"@intToPtr"}, .{"@truncate"}, .{"@ptrCast"}, }); if (cast_map.has(call_name)) { if (builtin_call.params_len < 1) return null; return ((try resolveTypeOfNodeInternal(store, arena, .{ .node = builtin_call.paramsConst()[0], .handle = handle, }, bound_type_params)) orelse return null).instanceTypeVal(); } // Almost the same as the above, return a type value though. // TODO Do peer type resolution, we just keep the first for now. if (std.mem.eql(u8, call_name, "@TypeOf")) { if (builtin_call.params_len < 1) return null; var resolved_type = (try resolveTypeOfNodeInternal(store, arena, .{ .node = builtin_call.paramsConst()[0], .handle = handle, }, bound_type_params)) orelse return null; if (resolved_type.type.is_type_val) return null; resolved_type.type.is_type_val = true; return resolved_type; } if (!std.mem.eql(u8, call_name, "@import")) return null; if (builtin_call.params_len < 1) return null; const import_param = builtin_call.paramsConst()[0]; if (import_param.id != .StringLiteral) return null; const import_str = handle.tree.tokenSlice(import_param.cast(ast.Node.StringLiteral).?.token); const new_handle = (store.resolveImport(handle, import_str[1 .. import_str.len - 1]) catch |err| block: { std.debug.warn("Error {} while processing import {}\n", .{ err, import_str }); return null; }) orelse return null; return TypeWithHandle.typeVal(.{ .node = &new_handle.tree.root_node.base, .handle = new_handle }); }, .ContainerDecl => { const container = node.cast(ast.Node.ContainerDecl).?; const kind = handle.tree.token_ids[container.kind_token]; if (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None)) { return TypeWithHandle.typeVal(node_handle); } var i: usize = 0; while (container.iterate(i)) |decl| : (i += 1) { if (decl.id != .ContainerField) continue; try store.enum_completions.add(handle.tree, decl); } return TypeWithHandle.typeVal(node_handle); }, .FnProto => { // This is a function type if (node.cast(ast.Node.FnProto).?.name_token == null) { return TypeWithHandle.typeVal(node_handle); } return TypeWithHandle{ .type = .{ .data = .{ .other = node }, .is_type_val = false }, .handle = handle, }; }, .MultilineStringLiteral, .StringLiteral => return TypeWithHandle{ .type = .{ .data = .{ .other = node }, .is_type_val = false }, .handle = handle, }, else => {}, //std.debug.warn("Type resolution case not implemented; {}\n", .{node.id}), } return null; } // TODO Reorganize this file, perhaps split into a couple as well // TODO Make this better, nested levels of type vals pub const Type = struct { data: union(enum) { slice: *ast.Node, error_union: *ast.Node, other: *ast.Node, primitive, }, /// If true, the type `type`, the attached data is the value of the type value. is_type_val: bool, }; pub const TypeWithHandle = struct { type: Type, handle: *DocumentStore.Handle, fn typeVal(node_handle: NodeWithHandle) TypeWithHandle { return .{ .type = .{ .data = .{ .other = node_handle.node }, .is_type_val = true, }, .handle = node_handle.handle, }; } fn instanceTypeVal(self: TypeWithHandle) ?TypeWithHandle { if (!self.type.is_type_val) return null; return TypeWithHandle{ .type = .{ .data = self.type.data, .is_type_val = false }, .handle = self.handle, }; } fn isRoot(self: TypeWithHandle) bool { switch (self.type.data) { .other => |n| return n.id == .Root, else => return false, } } fn isContainer(self: TypeWithHandle, container_kind_tok: std.zig.Token.Id) bool { switch (self.type.data) { .other => |n| { if (n.cast(ast.Node.ContainerDecl)) |cont| { return self.handle.tree.token_ids[cont.kind_token] == container_kind_tok; } return false; }, else => return false, } } pub fn isStructType(self: TypeWithHandle) bool { return self.isContainer(.Keyword_struct) or self.isRoot(); } pub fn isEnumType(self: TypeWithHandle) bool { return self.isContainer(.Keyword_enum); } pub fn isUnionType(self: TypeWithHandle) bool { return self.isContainer(.Keyword_union); } pub fn isTypeFunc(self: TypeWithHandle) bool { switch (self.type.data) { .other => |n| { if (n.cast(ast.Node.FnProto)) |fn_proto| { return isTypeFunction(self.handle.tree, fn_proto); } return false; }, else => return false, } } pub fn isFunc(self: TypeWithHandle) bool { switch (self.type.data) { .other => |n| { return n.id == .FnProto; }, else => return false, } } }; pub fn resolveTypeOfNode(store: *DocumentStore, arena: *std.heap.ArenaAllocator, node_handle: NodeWithHandle) error{OutOfMemory}!?TypeWithHandle { var bound_type_params = BoundTypeParams.init(&arena.allocator); return resolveTypeOfNodeInternal(store, arena, node_handle, &bound_type_params); } fn maybeCollectImport(tree: *ast.Tree, builtin_call: *ast.Node.BuiltinCall, arr: *std.ArrayList([]const u8)) !void { if (!std.mem.eql(u8, tree.tokenSlice(builtin_call.builtin_token), "@import")) return; if (builtin_call.params_len > 1) return; const import_param = builtin_call.paramsConst()[0]; if (import_param.id != .StringLiteral) return; const import_str = tree.tokenSlice(import_param.cast(ast.Node.StringLiteral).?.token); try arr.append(import_str[1 .. import_str.len - 1]); } /// Collects all imports we can find into a slice of import paths (without quotes). /// The import paths are valid as long as the tree is. pub fn collectImports(import_arr: *std.ArrayList([]const u8), tree: *ast.Tree) !void { // TODO: Currently only detects `const smth = @import("string literal")<.SomeThing>;` for (tree.root_node.decls()) |decl| { if (decl.id != .VarDecl) continue; const var_decl = decl.cast(ast.Node.VarDecl).?; if (var_decl.init_node == null) continue; switch (var_decl.init_node.?.id) { .BuiltinCall => { const builtin_call = var_decl.init_node.?.cast(ast.Node.BuiltinCall).?; try maybeCollectImport(tree, builtin_call, import_arr); }, .InfixOp => { const infix_op = var_decl.init_node.?.cast(ast.Node.InfixOp).?; switch (infix_op.op) { .Period => {}, else => continue, } if (infix_op.lhs.id != .BuiltinCall) continue; try maybeCollectImport(tree, infix_op.lhs.cast(ast.Node.BuiltinCall).?, import_arr); }, else => {}, } } } pub const NodeWithHandle = struct { node: *ast.Node, handle: *DocumentStore.Handle, }; pub fn getFieldAccessType( store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, source_index: usize, tokenizer: *std.zig.Tokenizer, ) !?TypeWithHandle { var current_type = TypeWithHandle.typeVal(.{ .node = &handle.tree.root_node.base, .handle = handle, }); // TODO Actually bind params here when calling functions instead of just skipping args. var bound_type_params = BoundTypeParams.init(&arena.allocator); while (true) { const tok = tokenizer.next(); switch (tok.id) { .Eof => return try resolveFieldAccessLhsType(store, arena, current_type, &bound_type_params), .Identifier => { if (try lookupSymbolGlobal(store, arena, current_type.handle, tokenizer.buffer[tok.loc.start..tok.loc.end], source_index)) |child| { current_type = (try child.resolveType(store, arena, &bound_type_params)) orelse return null; } else return null; }, .Period => { const after_period = tokenizer.next(); switch (after_period.id) { .Eof => return try resolveFieldAccessLhsType(store, arena, current_type, &bound_type_params), .Identifier => { if (after_period.loc.end == tokenizer.buffer.len) return try resolveFieldAccessLhsType(store, arena, current_type, &bound_type_params); current_type = try resolveFieldAccessLhsType(store, arena, current_type, &bound_type_params); const current_type_node = switch (current_type.type.data) { .other => |n| n, else => return null, }; if (try lookupSymbolContainer( store, arena, .{ .node = current_type_node, .handle = current_type.handle }, tokenizer.buffer[after_period.loc.start..after_period.loc.end], !current_type.type.is_type_val, )) |child| { current_type = (try child.resolveType(store, arena, &bound_type_params)) orelse return null; } else return null; }, .QuestionMark => { current_type = (try resolveUnwrapOptionalType(store, arena, current_type, &bound_type_params)) orelse return null; }, else => { std.debug.warn("Unrecognized token {} after period.\n", .{after_period.id}); return null; }, } }, .PeriodAsterisk => { current_type = (try resolveDerefType(store, arena, current_type, &bound_type_params)) orelse return null; }, .LParen => { const current_type_node = switch (current_type.type.data) { .other => |n| n, else => return null, }; // Can't call a function type, we need a function type instance. if (current_type.type.is_type_val) return null; if (current_type_node.cast(ast.Node.FnProto)) |func| { if (try resolveReturnType(store, arena, func, current_type.handle, &bound_type_params)) |ret| { current_type = ret; // Skip to the right paren var paren_count: usize = 1; var next = tokenizer.next(); while (next.id != .Eof) : (next = tokenizer.next()) { if (next.id == .RParen) { paren_count -= 1; if (paren_count == 0) break; } else if (next.id == .LParen) { paren_count += 1; } } else return null; } else return null; } else return null; }, .LBracket => { var brack_count: usize = 1; var next = tokenizer.next(); var is_range = false; while (next.id != .Eof) : (next = tokenizer.next()) { if (next.id == .RBracket) { brack_count -= 1; if (brack_count == 0) break; } else if (next.id == .LBracket) { brack_count += 1; } else if (next.id == .Ellipsis2 and brack_count == 1) { is_range = true; } } else return null; current_type = (try resolveBracketAccessType(store, arena, current_type, if (is_range) .Range else .Single, &bound_type_params)) orelse return null; }, else => { std.debug.warn("Unimplemented token: {}\n", .{tok.id}); return null; }, } } return try resolveFieldAccessLhsType(store, arena, current_type, &bound_type_params); } pub fn isNodePublic(tree: *ast.Tree, node: *ast.Node) bool { switch (node.id) { .VarDecl => { const var_decl = node.cast(ast.Node.VarDecl).?; return var_decl.visib_token != null; }, .FnProto => { const func = node.cast(ast.Node.FnProto).?; return func.visib_token != null; }, else => return true, } } pub fn nodeToString(tree: *ast.Tree, node: *ast.Node) ?[]const u8 { switch (node.id) { .ContainerField => { const field = node.cast(ast.Node.ContainerField).?; return tree.tokenSlice(field.name_token); }, .ErrorTag => { const tag = node.cast(ast.Node.ErrorTag).?; return tree.tokenSlice(tag.name_token); }, .Identifier => { const field = node.cast(ast.Node.Identifier).?; return tree.tokenSlice(field.token); }, .FnProto => { const func = node.cast(ast.Node.FnProto).?; if (func.name_token) |name_token| { return tree.tokenSlice(name_token); } }, else => { std.debug.warn("INVALID: {}\n", .{node.id}); }, } return null; } fn nodeContainsSourceIndex(tree: *ast.Tree, node: *ast.Node, source_index: usize) bool { const first_token = tree.token_locs[node.firstToken()]; const last_token = tree.token_locs[node.lastToken()]; return source_index >= first_token.start and source_index <= last_token.end; } pub fn getImportStr(tree: *ast.Tree, source_index: usize) ?[]const u8 { var node = &tree.root_node.base; var child_idx: usize = 0; while (node.iterate(child_idx)) |child| { if (!nodeContainsSourceIndex(tree, child, source_index)) { child_idx += 1; continue; } if (child.cast(ast.Node.BuiltinCall)) |builtin_call| blk: { const call_name = tree.tokenSlice(builtin_call.builtin_token); if (!std.mem.eql(u8, call_name, "@import")) break :blk; if (builtin_call.params_len != 1) break :blk; const import_param = builtin_call.paramsConst()[0]; const import_str_node = import_param.cast(ast.Node.StringLiteral) orelse break :blk; const import_str = tree.tokenSlice(import_str_node.token); return import_str[1 .. import_str.len - 1]; } node = child; child_idx = 0; } return null; } pub const SourceRange = std.zig.Token.Loc; pub const PositionContext = union(enum) { builtin: SourceRange, comment, string_literal: SourceRange, field_access: SourceRange, var_access: SourceRange, global_error_set, enum_literal, pre_label, label: bool, other, empty, pub fn range(self: PositionContext) ?SourceRange { return switch (self) { .builtin => |r| r, .comment => null, .string_literal => |r| r, .field_access => |r| r, .var_access => |r| r, .enum_literal => null, .pre_label => null, .label => null, .other => null, .empty => null, .global_error_set => null, }; } }; const StackState = struct { ctx: PositionContext, stack_id: enum { Paren, Bracket, Global }, }; fn peek(arr: *std.ArrayList(StackState)) !*StackState { if (arr.items.len == 0) { try arr.append(.{ .ctx = .empty, .stack_id = .Global }); } return &arr.items[arr.items.len - 1]; } fn tokenRangeAppend(prev: SourceRange, token: std.zig.Token) SourceRange { return .{ .start = prev.start, .end = token.loc.end, }; } pub fn documentPositionContext(allocator: *std.mem.Allocator, document: types.TextDocument, position: types.Position) !PositionContext { const line = try document.getLine(@intCast(usize, position.line)); const pos_char = @intCast(usize, position.character) + 1; const idx = if (pos_char > line.len) line.len else pos_char; var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); var tokenizer = std.zig.Tokenizer.init(line[0..idx]); var stack = try std.ArrayList(StackState).initCapacity(&arena.allocator, 8); while (true) { const tok = tokenizer.next(); // Early exits. switch (tok.id) { .Invalid, .Invalid_ampersands => { // Single '@' do not return a builtin token so we check this on our own. if (line[idx - 1] == '@') { return PositionContext{ .builtin = .{ .start = idx - 1, .end = idx, }, }; } return .other; }, .LineComment, .DocComment, .ContainerDocComment => return .comment, .Eof => break, else => {}, } // State changes var curr_ctx = try peek(&stack); switch (tok.id) { .StringLiteral, .MultilineStringLiteralLine => curr_ctx.ctx = .{ .string_literal = tok.loc }, .Identifier => switch (curr_ctx.ctx) { .empty, .pre_label => curr_ctx.ctx = .{ .var_access = tok.loc }, .label => |filled| if (!filled) { curr_ctx.ctx = .{ .label = true }; } else { curr_ctx.ctx = .{ .var_access = tok.loc }; }, else => {}, }, .Builtin => switch (curr_ctx.ctx) { .empty, .pre_label => curr_ctx.ctx = .{ .builtin = tok.loc }, else => {}, }, .Period, .PeriodAsterisk => switch (curr_ctx.ctx) { .empty, .pre_label => curr_ctx.ctx = .enum_literal, .enum_literal => curr_ctx.ctx = .empty, .field_access => {}, .other => {}, .global_error_set => {}, else => curr_ctx.ctx = .{ .field_access = tokenRangeAppend(curr_ctx.ctx.range().?, tok), }, }, .Keyword_break, .Keyword_continue => curr_ctx.ctx = .pre_label, .Colon => if (curr_ctx.ctx == .pre_label) { curr_ctx.ctx = .{ .label = false }; } else { curr_ctx.ctx = .empty; }, .QuestionMark => switch (curr_ctx.ctx) { .field_access => {}, else => curr_ctx.ctx = .empty, }, .LParen => try stack.append(.{ .ctx = .empty, .stack_id = .Paren }), .LBracket => try stack.append(.{ .ctx = .empty, .stack_id = .Bracket }), .RParen => { _ = stack.pop(); if (curr_ctx.stack_id != .Paren) { (try peek(&stack)).ctx = .empty; } }, .RBracket => { _ = stack.pop(); if (curr_ctx.stack_id != .Bracket) { (try peek(&stack)).ctx = .empty; } }, .Keyword_error => curr_ctx.ctx = .global_error_set, else => curr_ctx.ctx = .empty, } switch (curr_ctx.ctx) { .field_access => |r| curr_ctx.ctx = .{ .field_access = tokenRangeAppend(r, tok), }, else => {}, } } return block: { if (stack.popOrNull()) |state| break :block state.ctx; break :block .empty; }; } fn addOutlineNodes(allocator: *std.mem.Allocator, children: *std.ArrayList(types.DocumentSymbol), tree: *ast.Tree, child: *ast.Node) anyerror!void { switch (child.id) { .StringLiteral, .IntegerLiteral, .BuiltinCall, .Call, .Identifier, .InfixOp, .PrefixOp, .SuffixOp, .ControlFlowExpression, .ArrayInitializerDot, .SwitchElse, .SwitchCase, .For, .EnumLiteral, .PointerIndexPayload, .StructInitializerDot, .PointerPayload, .While, .Switch, .Else, .BoolLiteral, .NullLiteral, .Defer, .StructInitializer, .FieldInitializer, .If, .MultilineStringLiteral, .UndefinedLiteral, .VarType, .Block, .ErrorSetDecl => return, .ContainerDecl => { const decl = child.cast(ast.Node.ContainerDecl).?; for (decl.fieldsAndDecls()) |cchild| try addOutlineNodes(allocator, children, tree, cchild); return; }, else => {}, } _ = try children.append(try getDocumentSymbolsInternal(allocator, tree, child)); } fn getDocumentSymbolsInternal(allocator: *std.mem.Allocator, tree: *ast.Tree, node: *ast.Node) anyerror!types.DocumentSymbol { // const symbols = std.ArrayList(types.DocumentSymbol).init(allocator); const start_loc = tree.tokenLocation(0, node.firstToken()); const end_loc = tree.tokenLocation(0, node.lastToken()); const range = types.Range{ .start = .{ .line = @intCast(i64, start_loc.line), .character = @intCast(i64, start_loc.column), }, .end = .{ .line = @intCast(i64, end_loc.line), .character = @intCast(i64, end_loc.column), }, }; if (getDeclName(tree, node) == null) { std.debug.warn("NULL NAME: {}\n", .{node.id}); } const maybe_name = if (getDeclName(tree, node)) |name| name else ""; // TODO: Get my lazy bum to fix detail newlines return types.DocumentSymbol{ .name = if (maybe_name.len == 0) switch (node.id) { .TestDecl => "Nameless Test", else => "no_name", } else maybe_name, // .detail = (try getDocComments(allocator, tree, node)) orelse "", .detail = "", .kind = switch (node.id) { .FnProto => .Function, .VarDecl => .Variable, .ContainerField => .Field, else => .Variable, }, .range = range, .selectionRange = range, .children = ch: { var children = std.ArrayList(types.DocumentSymbol).init(allocator); var index: usize = 0; while (node.iterate(index)) |child| : (index += 1) { try addOutlineNodes(allocator, &children, tree, child); } break :ch children.items; }, }; // return symbols.items; } pub fn getDocumentSymbols(allocator: *std.mem.Allocator, tree: *ast.Tree) ![]types.DocumentSymbol { var symbols = std.ArrayList(types.DocumentSymbol).init(allocator); for (tree.root_node.decls()) |node| { _ = try symbols.append(try getDocumentSymbolsInternal(allocator, tree, node)); } return symbols.items; } pub const Declaration = union(enum) { ast_node: *ast.Node, param_decl: *ast.Node.FnProto.ParamDecl, pointer_payload: struct { node: *ast.Node.PointerPayload, condition: *ast.Node, }, array_payload: struct { identifier: *ast.Node, array_expr: *ast.Node, }, switch_payload: struct { node: *ast.Node.PointerPayload, items: []const *ast.Node, }, label_decl: *ast.Node, // .id is While, For or Block (firstToken will be the label) }; pub const DeclWithHandle = struct { decl: *Declaration, handle: *DocumentStore.Handle, pub fn location(self: DeclWithHandle) ast.Tree.Location { const tree = self.handle.tree; return switch (self.decl.*) { .ast_node => |n| block: { const name_token = getDeclNameToken(tree, n).?; break :block tree.tokenLocation(0, name_token); }, .param_decl => |p| tree.tokenLocation(0, p.name_token.?), .pointer_payload => |pp| tree.tokenLocation(0, pp.node.value_symbol.firstToken()), .array_payload => |ap| tree.tokenLocation(0, ap.identifier.firstToken()), .switch_payload => |sp| tree.tokenLocation(0, sp.node.value_symbol.firstToken()), .label_decl => |ld| tree.tokenLocation(0, ld.firstToken()), }; } fn isPublic(self: DeclWithHandle) bool { return switch (self.decl.*) { .ast_node => |node| isNodePublic(self.handle.tree, node), else => true, }; } pub fn resolveType(self: DeclWithHandle, store: *DocumentStore, arena: *std.heap.ArenaAllocator, bound_type_params: *BoundTypeParams) !?TypeWithHandle { return switch (self.decl.*) { .ast_node => |node| try resolveTypeOfNodeInternal(store, arena, .{ .node = node, .handle = self.handle }, bound_type_params), .param_decl => |param_decl| switch (param_decl.param_type) { .type_expr => |type_node| { if (typeIsType(self.handle.tree, type_node)) { var bound_param_it = bound_type_params.iterator(); while (bound_param_it.next()) |entry| { if (entry.key == param_decl) return entry.value; } return null; } return ((try resolveTypeOfNodeInternal( store, arena, .{ .node = type_node, .handle = self.handle }, bound_type_params, )) orelse return null).instanceTypeVal(); }, else => null, }, .pointer_payload => |pay| try resolveUnwrapOptionalType( store, arena, (try resolveTypeOfNodeInternal(store, arena, .{ .node = pay.condition, .handle = self.handle, }, bound_type_params)) orelse return null, bound_type_params, ), .array_payload => |pay| try resolveBracketAccessType( store, arena, (try resolveTypeOfNodeInternal(store, arena, .{ .node = pay.array_expr, .handle = self.handle, }, bound_type_params)) orelse return null, .Single, bound_type_params, ), .label_decl => return null, // TODO Resolve switch payload types .switch_payload => |pay| return null, }; } }; fn findContainerScope(container_handle: NodeWithHandle) ?*Scope { const container = container_handle.node; const handle = container_handle.handle; if (container.id != .ContainerDecl and container.id != .Root and container.id != .ErrorSetDecl) { return null; } // Find the container scope. var container_scope: ?*Scope = null; for (handle.document_scope.scopes) |*scope| { switch (scope.*.data) { .container => |node| if (node == container) { container_scope = scope; break; }, else => {}, } } return container_scope; } pub fn iterateSymbolsContainer( store: *DocumentStore, arena: *std.heap.ArenaAllocator, container_handle: NodeWithHandle, orig_handle: *DocumentStore.Handle, comptime callback: var, context: var, instance_access: bool, ) error{OutOfMemory}!void { const container = container_handle.node; const handle = container_handle.handle; const is_enum = if (container.cast(ast.Node.ContainerDecl)) |cont_decl| handle.tree.token_ids[cont_decl.kind_token] == .Keyword_enum else false; if (findContainerScope(container_handle)) |container_scope| { var decl_it = container_scope.decls.iterator(); while (decl_it.next()) |entry| { switch (entry.value) { .ast_node => |node| { if (node.id == .ContainerField) { if (!instance_access and !is_enum) continue; if (instance_access and is_enum) continue; } }, .label_decl => continue, else => {}, } const decl = DeclWithHandle{ .decl = &entry.value, .handle = handle }; if (handle != orig_handle and !decl.isPublic()) continue; try callback(context, decl); } for (container_scope.uses) |use| { if (handle != orig_handle and use.visib_token == null) continue; const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue; const use_expr_node = switch (use_expr.type.data) { .other => |n| n, else => continue, }; try iterateSymbolsContainer(store, arena, .{ .node = use_expr_node, .handle = use_expr.handle }, orig_handle, callback, context, false); } } std.debug.warn("Did not find container scope when iterating container {} (name: {})\n", .{ container, getDeclName(handle.tree, container) }); } pub fn iterateLabels( handle: *DocumentStore.Handle, source_index: usize, comptime callback: var, context: var, ) error{OutOfMemory}!void { for (handle.document_scope.scopes) |scope| { if (source_index >= scope.range.start and source_index < scope.range.end) { var decl_it = scope.decls.iterator(); while (decl_it.next()) |entry| { switch (entry.value) { .label_decl => {}, else => continue, } try callback(context, DeclWithHandle{ .decl = &entry.value, .handle = handle }); } } if (scope.range.start >= source_index) return; } } pub fn iterateSymbolsGlobal( store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, source_index: usize, comptime callback: var, context: var, ) error{OutOfMemory}!void { for (handle.document_scope.scopes) |scope| { if (source_index >= scope.range.start and source_index < scope.range.end) { var decl_it = scope.decls.iterator(); while (decl_it.next()) |entry| { if (entry.value == .ast_node and entry.value.ast_node.id == .ContainerField) continue; if (entry.value == .label_decl) continue; try callback(context, DeclWithHandle{ .decl = &entry.value, .handle = handle }); } for (scope.uses) |use| { const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue; const use_expr_node = switch (use_expr.type.data) { .other => |n| n, else => continue, }; try iterateSymbolsContainer(store, arena, .{ .node = use_expr_node, .handle = use_expr.handle }, handle, callback, context, false); } } if (scope.range.start >= source_index) return; } } pub fn innermostContainer(handle: *DocumentStore.Handle, source_index: usize) TypeWithHandle { var current = handle.document_scope.scopes[0].data.container; if (handle.document_scope.scopes.len == 1) return TypeWithHandle.typeVal(.{ .node = current, .handle = handle }); for (handle.document_scope.scopes[1..]) |scope| { if (source_index >= scope.range.start and source_index < scope.range.end) { switch (scope.data) { .container => |node| current = node, else => {}, } } if (scope.range.start > source_index) break; } return TypeWithHandle.typeVal(.{ .node = current, .handle = handle }); } fn resolveUse( store: *DocumentStore, arena: *std.heap.ArenaAllocator, uses: []const *ast.Node.Use, symbol: []const u8, handle: *DocumentStore.Handle, ) error{OutOfMemory}!?DeclWithHandle { for (uses) |use| { const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue; const use_expr_node = switch (use_expr.type.data) { .other => |n| n, else => continue, }; if (try lookupSymbolContainer(store, arena, .{ .node = use_expr_node, .handle = use_expr.handle }, symbol, false)) |candidate| { if (candidate.handle != handle and !candidate.isPublic()) { continue; } return candidate; } } return null; } pub fn lookupLabel( handle: *DocumentStore.Handle, symbol: []const u8, source_index: usize, ) error{OutOfMemory}!?DeclWithHandle { for (handle.document_scope.scopes) |scope| { if (source_index >= scope.range.start and source_index < scope.range.end) { if (scope.decls.get(symbol)) |candidate| { switch (candidate.value) { .label_decl => {}, else => continue, } return DeclWithHandle{ .decl = &candidate.value, .handle = handle, }; } } if (scope.range.start > source_index) return null; } return null; } pub fn lookupSymbolGlobal( store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, symbol: []const u8, source_index: usize, ) error{OutOfMemory}!?DeclWithHandle { for (handle.document_scope.scopes) |scope| { if (source_index >= scope.range.start and source_index < scope.range.end) { if (scope.decls.get(symbol)) |candidate| { switch (candidate.value) { .ast_node => |node| { if (node.id == .ContainerField) continue; }, .label_decl => continue, else => {}, } return DeclWithHandle{ .decl = &candidate.value, .handle = handle, }; } if (try resolveUse(store, arena, scope.uses, symbol, handle)) |result| return result; } if (scope.range.start > source_index) return null; } return null; } pub fn lookupSymbolContainer( store: *DocumentStore, arena: *std.heap.ArenaAllocator, container_handle: NodeWithHandle, symbol: []const u8, /// If true, we are looking up the symbol like we are accessing through a field access /// of an instance of the type, otherwise as a field access of the type value itself. instance_access: bool, ) error{OutOfMemory}!?DeclWithHandle { const container = container_handle.node; const handle = container_handle.handle; const is_enum = if (container.cast(ast.Node.ContainerDecl)) |cont_decl| handle.tree.token_ids[cont_decl.kind_token] == .Keyword_enum else false; if (findContainerScope(container_handle)) |container_scope| { if (container_scope.decls.get(symbol)) |candidate| { switch (candidate.value) { .ast_node => |node| { if (node.id == .ContainerField) { if (!instance_access and !is_enum) return null; if (instance_access and is_enum) return null; } }, .label_decl => unreachable, else => {}, } return DeclWithHandle{ .decl = &candidate.value, .handle = handle }; } if (try resolveUse(store, arena, container_scope.uses, symbol, handle)) |result| return result; return null; } // std.debug.warn("Did not find container scope when looking up in container {} (name: {})\n", .{ container, getDeclName(handle.tree, container) }); return null; } pub const DocumentScope = struct { scopes: []Scope, pub fn debugPrint(self: DocumentScope) void { for (self.scopes) |scope| { std.debug.warn( \\-------------------------- \\Scope {}, range: [{}, {}) \\ {} usingnamespaces \\Decls: , .{ scope.data, scope.range.start, scope.range.end, scope.uses.len, }); var decl_it = scope.decls.iterator(); var idx: usize = 0; while (decl_it.next()) |name_decl| : (idx += 1) { if (idx != 0) std.debug.warn(", ", .{}); std.debug.warn("{}", .{name_decl.key}); } std.debug.warn("\n--------------------------\n", .{}); } } pub fn deinit(self: DocumentScope, allocator: *std.mem.Allocator) void { for (self.scopes) |scope| { scope.decls.deinit(); allocator.free(scope.uses); allocator.free(scope.tests); } allocator.free(self.scopes); } }; pub const Scope = struct { pub const Data = union(enum) { container: *ast.Node, // .id is ContainerDecl or Root or ErrorSetDecl function: *ast.Node, // .id is FnProto block: *ast.Node, // .id is Block other, }; range: SourceRange, decls: std.StringHashMap(Declaration), tests: []const *ast.Node, uses: []const *ast.Node.Use, data: Data, }; pub fn makeDocumentScope(allocator: *std.mem.Allocator, tree: *ast.Tree) !DocumentScope { var scopes = std.ArrayList(Scope).init(allocator); errdefer scopes.deinit(); try makeScopeInternal(allocator, &scopes, tree, &tree.root_node.base); return DocumentScope{ .scopes = scopes.toOwnedSlice(), }; } fn nodeSourceRange(tree: *ast.Tree, node: *ast.Node) SourceRange { return SourceRange{ .start = tree.token_locs[node.firstToken()].start, .end = tree.token_locs[node.lastToken()].end, }; } // TODO Make enum and error stores per-document // CLear the doc ones before calling this and // rebuild them here. // TODO Possibly collect all imports to diff them on changes // as well fn makeScopeInternal( allocator: *std.mem.Allocator, scopes: *std.ArrayList(Scope), tree: *ast.Tree, node: *ast.Node, ) error{OutOfMemory}!void { if (node.id == .Root or node.id == .ContainerDecl or node.id == .ErrorSetDecl) { const ast_decls = switch (node.id) { .ContainerDecl => node.cast(ast.Node.ContainerDecl).?.fieldsAndDeclsConst(), .Root => node.cast(ast.Node.Root).?.declsConst(), .ErrorSetDecl => node.cast(ast.Node.ErrorSetDecl).?.declsConst(), else => unreachable, }; (try scopes.addOne()).* = .{ .range = nodeSourceRange(tree, node), .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .{ .container = node }, }; const scope_idx = scopes.items.len - 1; var uses = std.ArrayList(*ast.Node.Use).init(allocator); var tests = std.ArrayList(*ast.Node).init(allocator); errdefer { scopes.items[scope_idx].decls.deinit(); uses.deinit(); tests.deinit(); } for (ast_decls) |decl| { if (decl.cast(ast.Node.Use)) |use| { try uses.append(use); continue; } try makeScopeInternal(allocator, scopes, tree, decl); const name = getDeclName(tree, decl) orelse continue; if (decl.id == .TestDecl) { try tests.append(decl); continue; } if (decl.cast(ast.Node.ContainerField)) |field| { if (field.type_expr == null and field.value_expr == null) { if (node.id == .Root) continue; if (node.cast(ast.Node.ContainerDecl)) |container| { const kind = tree.token_ids[container.kind_token]; if (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None)) { continue; } } } } if (try scopes.items[scope_idx].decls.put(name, .{ .ast_node = decl })) |existing| { // TODO Record a redefinition error. } } scopes.items[scope_idx].uses = uses.toOwnedSlice(); return; } switch (node.id) { .FnProto => { const func = node.cast(ast.Node.FnProto).?; (try scopes.addOne()).* = .{ .range = nodeSourceRange(tree, node), .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .{ .function = node }, }; var scope_idx = scopes.items.len - 1; errdefer scopes.items[scope_idx].decls.deinit(); for (func.params()) |*param| { if (param.name_token) |name_tok| { if (try scopes.items[scope_idx].decls.put(tree.tokenSlice(name_tok), .{ .param_decl = param })) |existing| { // TODO Record a redefinition error } } } if (func.body_node) |body| { try makeScopeInternal(allocator, scopes, tree, body); } return; }, .TestDecl => { return try makeScopeInternal(allocator, scopes, tree, node.cast(ast.Node.TestDecl).?.body_node); }, .Block => { const block = node.cast(ast.Node.Block).?; if (block.label) |label| { std.debug.assert(tree.token_ids[label] == .Identifier); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[block.lbrace].start, .end = tree.token_locs[block.rbrace].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); try scope.decls.putNoClobber(tree.tokenSlice(label), .{ .label_decl = node, }); } (try scopes.addOne()).* = .{ .range = nodeSourceRange(tree, node), .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .{ .block = node }, }; var scope_idx = scopes.items.len - 1; var uses = std.ArrayList(*ast.Node.Use).init(allocator); errdefer { scopes.items[scope_idx].decls.deinit(); uses.deinit(); } var child_idx: usize = 0; while (node.iterate(child_idx)) |child_node| : (child_idx += 1) { if (child_node.cast(ast.Node.Use)) |use| { try uses.append(use); continue; } try makeScopeInternal(allocator, scopes, tree, child_node); if (child_node.cast(ast.Node.VarDecl)) |var_decl| { const name = tree.tokenSlice(var_decl.name_token); if (try scopes.items[scope_idx].decls.put(name, .{ .ast_node = child_node })) |existing| { // TODO Record a redefinition error. } } } scopes.items[scope_idx].uses = uses.toOwnedSlice(); return; }, .Comptime => { return try makeScopeInternal(allocator, scopes, tree, node.cast(ast.Node.Comptime).?.expr); }, .If => { const if_node = node.cast(ast.Node.If).?; if (if_node.payload) |payload| { std.debug.assert(payload.id == .PointerPayload); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[payload.firstToken()].start, .end = tree.token_locs[if_node.body.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); const ptr_payload = payload.cast(ast.Node.PointerPayload).?; std.debug.assert(ptr_payload.value_symbol.id == .Identifier); const name = tree.tokenSlice(ptr_payload.value_symbol.firstToken()); try scope.decls.putNoClobber(name, .{ .pointer_payload = .{ .node = ptr_payload, .condition = if_node.condition, }, }); } try makeScopeInternal(allocator, scopes, tree, if_node.body); if (if_node.@"else") |else_node| { if (else_node.payload) |payload| { std.debug.assert(payload.id == .Payload); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[payload.firstToken()].start, .end = tree.token_locs[else_node.body.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); const err_payload = payload.cast(ast.Node.Payload).?; std.debug.assert(err_payload.error_symbol.id == .Identifier); const name = tree.tokenSlice(err_payload.error_symbol.firstToken()); try scope.decls.putNoClobber(name, .{ .ast_node = payload }); } try makeScopeInternal(allocator, scopes, tree, else_node.body); } }, .While => { const while_node = node.cast(ast.Node.While).?; if (while_node.label) |label| { std.debug.assert(tree.token_ids[label] == .Identifier); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[while_node.while_token].start, .end = tree.token_locs[while_node.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); try scope.decls.putNoClobber(tree.tokenSlice(label), .{ .label_decl = node, }); } if (while_node.payload) |payload| { std.debug.assert(payload.id == .PointerPayload); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[payload.firstToken()].start, .end = tree.token_locs[while_node.body.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); const ptr_payload = payload.cast(ast.Node.PointerPayload).?; std.debug.assert(ptr_payload.value_symbol.id == .Identifier); const name = tree.tokenSlice(ptr_payload.value_symbol.firstToken()); try scope.decls.putNoClobber(name, .{ .pointer_payload = .{ .node = ptr_payload, .condition = while_node.condition, }, }); } try makeScopeInternal(allocator, scopes, tree, while_node.body); if (while_node.@"else") |else_node| { if (else_node.payload) |payload| { std.debug.assert(payload.id == .Payload); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[payload.firstToken()].start, .end = tree.token_locs[else_node.body.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); const err_payload = payload.cast(ast.Node.Payload).?; std.debug.assert(err_payload.error_symbol.id == .Identifier); const name = tree.tokenSlice(err_payload.error_symbol.firstToken()); try scope.decls.putNoClobber(name, .{ .ast_node = payload }); } try makeScopeInternal(allocator, scopes, tree, else_node.body); } }, .For => { const for_node = node.cast(ast.Node.For).?; if (for_node.label) |label| { std.debug.assert(tree.token_ids[label] == .Identifier); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[for_node.for_token].start, .end = tree.token_locs[for_node.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); try scope.decls.putNoClobber(tree.tokenSlice(label), .{ .label_decl = node, }); } std.debug.assert(for_node.payload.id == .PointerIndexPayload); const ptr_idx_payload = for_node.payload.cast(ast.Node.PointerIndexPayload).?; std.debug.assert(ptr_idx_payload.value_symbol.id == .Identifier); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[ptr_idx_payload.firstToken()].start, .end = tree.token_locs[for_node.body.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); const value_name = tree.tokenSlice(ptr_idx_payload.value_symbol.firstToken()); try scope.decls.putNoClobber(value_name, .{ .array_payload = .{ .identifier = ptr_idx_payload.value_symbol, .array_expr = for_node.array_expr, }, }); if (ptr_idx_payload.index_symbol) |index_symbol| { std.debug.assert(index_symbol.id == .Identifier); const index_name = tree.tokenSlice(index_symbol.firstToken()); if (try scope.decls.put(index_name, .{ .ast_node = index_symbol })) |existing| { // TODO Record a redefinition error } } try makeScopeInternal(allocator, scopes, tree, for_node.body); if (for_node.@"else") |else_node| { std.debug.assert(else_node.payload == null); try makeScopeInternal(allocator, scopes, tree, else_node.body); } }, .Switch => { const switch_node = node.cast(ast.Node.Switch).?; for (switch_node.casesConst()) |case| { if (case.*.cast(ast.Node.SwitchCase)) |case_node| { if (case_node.payload) |payload| { std.debug.assert(payload.id == .PointerPayload); var scope = try scopes.addOne(); scope.* = .{ .range = .{ .start = tree.token_locs[payload.firstToken()].start, .end = tree.token_locs[case_node.expr.lastToken()].end, }, .decls = std.StringHashMap(Declaration).init(allocator), .uses = &[0]*ast.Node.Use{}, .tests = &[0]*ast.Node{}, .data = .other, }; errdefer scope.decls.deinit(); const ptr_payload = payload.cast(ast.Node.PointerPayload).?; std.debug.assert(ptr_payload.value_symbol.id == .Identifier); const name = tree.tokenSlice(ptr_payload.value_symbol.firstToken()); try scope.decls.putNoClobber(name, .{ .switch_payload = .{ .node = ptr_payload, .items = case_node.itemsConst(), }, }); } try makeScopeInternal(allocator, scopes, tree, case_node.expr); } } }, .VarDecl => { const var_decl = node.cast(ast.Node.VarDecl).?; if (var_decl.type_node) |type_node| { try makeScopeInternal(allocator, scopes, tree, type_node); } if (var_decl.init_node) |init_node| { try makeScopeInternal(allocator, scopes, tree, init_node); } }, else => { var child_idx: usize = 0; while (node.iterate(child_idx)) |child_node| : (child_idx += 1) { try makeScopeInternal(allocator, scopes, tree, child_node); } }, } }
src/analysis.zig
const fmath = @import("index.zig"); pub fn fma(comptime T: type, x: T, y: T, z: T) -> T { switch (T) { f32 => @inlineCall(fma32, x, y, z), f64 => @inlineCall(fma64, x, y ,z), else => @compileError("fma not implemented for " ++ @typeName(T)), } } fn fma32(x: f32, y: f32, z: f32) -> f32 { const xy = f64(x) * y; const xy_z = xy + z; const u = @bitCast(u64, xy_z); const e = (u >> 52) & 0x7FF; if ((u & 0x1FFFFFFF) != 0x10000000 or e == 0x7FF or xy_z - xy == z) { f32(xy_z) } else { // TODO: Handle inexact case with double-rounding f32(xy_z) } } fn fma64(x: f64, y: f64, z: f64) -> f64 { if (!fmath.isFinite(x) or !fmath.isFinite(y)) { return x * y + z; } if (!fmath.isFinite(z)) { return z; } if (x == 0.0 or y == 0.0) { return x * y + z; } if (z == 0.0) { return x * y; } const x1 = fmath.frexp(x); var ex = x1.exponent; var xs = x1.significand; const x2 = fmath.frexp(y); var ey = x2.exponent; var ys = x2.significand; const x3 = fmath.frexp(z); var ez = x3.exponent; var zs = x3.significand; var spread = ex + ey - ez; if (spread <= 53 * 2) { zs = fmath.scalbn(zs, -spread); } else { zs = fmath.copysign(f64, fmath.f64_min, zs); } const xy = dd_mul(xs, ys); const r = dd_add(xy.hi, zs); spread = ex + ey; if (r.hi == 0.0) { return xy.hi + zs + fmath.scalbn(xy.lo, spread); } const adj = add_adjusted(r.lo, xy.lo); if (spread + fmath.ilogb(r.hi) > -1023) { fmath.scalbn(r.hi + adj, spread) } else { add_and_denorm(r.hi, adj, spread) } } const dd = struct { hi: f64, lo: f64, }; fn dd_add(a: f64, b: f64) -> dd { var ret: dd = undefined; ret.hi = a + b; const s = ret.hi - a; ret.lo = (a - (ret.hi - s)) + (b - s); ret } fn dd_mul(a: f64, b: f64) -> dd { var ret: dd = undefined; const split: f64 = 0x1.0p27 + 1.0; var p = a * split; var ha = a - p; ha += p; var la = a - ha; p = b * split; var hb = b - p; hb += p; var lb = b - hb; p = ha * hb; var q = ha * lb + la * hb; ret.hi = p + q; ret.lo = p - ret.hi + q + la * lb; ret } fn add_adjusted(a: f64, b: f64) -> f64 { var sum = dd_add(a, b); if (sum.lo != 0) { var uhii = @bitCast(u64, sum.hi); if (uhii & 1 == 0) { // hibits += copysign(1.0, sum.hi, sum.lo) const uloi = @bitCast(u64, sum.lo); uhii += 1 - ((uhii ^ uloi) >> 62); sum.hi = @bitCast(f64, uhii); } } sum.hi } fn add_and_denorm(a: f64, b: f64, scale: i32) -> f64 { var sum = dd_add(a, b); if (sum.lo != 0) { var uhii = @bitCast(u64, sum.hi); const bits_lost = -i32((uhii >> 52) & 0x7FF) - scale + 1; if ((bits_lost != 1) == (uhii & 1 != 0)) { const uloi = @bitCast(u64, sum.lo); uhii += 1 - (((uhii ^ uloi) >> 62) & 2); sum.hi = @bitCast(f64, uhii); } } fmath.scalbn(sum.hi, scale) } test "fma" { fmath.assert(fma(f32, 0.0, 1.0, 1.0) == fma32(0.0, 1.0, 1.0)); fmath.assert(fma(f64, 0.0, 1.0, 1.0) == fma64(0.0, 1.0, 1.0)); } test "fma32" { const epsilon = 0.000001; fmath.assert(fmath.approxEq(f32, fma32(0.0, 5.0, 9.124), 9.124, epsilon)); fmath.assert(fmath.approxEq(f32, fma32(0.2, 5.0, 9.124), 10.124, epsilon)); fmath.assert(fmath.approxEq(f32, fma32(0.8923, 5.0, 9.124), 13.5855, epsilon)); fmath.assert(fmath.approxEq(f32, fma32(1.5, 5.0, 9.124), 16.624, epsilon)); fmath.assert(fmath.approxEq(f32, fma32(37.45, 5.0, 9.124), 196.374004, epsilon)); fmath.assert(fmath.approxEq(f32, fma32(89.123, 5.0, 9.124), 454.739005, epsilon)); fmath.assert(fmath.approxEq(f32, fma32(123123.234375, 5.0, 9.124), 615625.295875, epsilon)); } test "fma64" { const epsilon = 0.000001; fmath.assert(fmath.approxEq(f64, fma64(0.0, 5.0, 9.124), 9.124, epsilon)); fmath.assert(fmath.approxEq(f64, fma64(0.2, 5.0, 9.124), 10.124, epsilon)); fmath.assert(fmath.approxEq(f64, fma64(0.8923, 5.0, 9.124), 13.5855, epsilon)); fmath.assert(fmath.approxEq(f64, fma64(1.5, 5.0, 9.124), 16.624, epsilon)); fmath.assert(fmath.approxEq(f64, fma64(37.45, 5.0, 9.124), 196.374, epsilon)); fmath.assert(fmath.approxEq(f64, fma64(89.123, 5.0, 9.124), 454.739, epsilon)); fmath.assert(fmath.approxEq(f64, fma64(123123.234375, 5.0, 9.124), 615625.295875, epsilon)); }
src/fma.zig
const std = @import("std"); const helper = @import("helper.zig"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const input = @embedFile("../inputs/day18.txt"); pub fn run(alloc: Allocator, stdout_: anytype) !void { var arena = std.heap.ArenaAllocator.init(alloc); const arena_alloc = arena.allocator(); defer arena.deinit(); const rawnums = try getRawNums(arena_alloc, input); const res1 = try part1(rawnums.items); const res2 = try part2(rawnums.items); if (stdout_) |stdout| { try stdout.print("Part 1: {}\n", .{res1}); try stdout.print("Part 2: {}\n", .{res2}); } } fn part1(rawnums: []const RawNum) !i64 { var acc = try rawnums[0].clone(); var i: usize = 1; while (i < rawnums.len) : (i += 1) { try acc.addToSelf(rawnums[i]); } return acc.getMagnitude(); } fn part2(rawnums: []const RawNum) !i64 { var max: i64 = std.math.minInt(i64); var i: usize = 0; while (i < rawnums.len) : (i += 1) { var j: usize = 0; while (j < rawnums.len) : (j += 1) { if (i == j) continue; var base = try rawnums[i].clone(); try base.addToSelf(rawnums[j]); max = std.math.max(max, base.getMagnitude()); } } return max; } fn getRawNums(alloc: Allocator, inp: []const u8) !ArrayList(RawNum) { var list = ArrayList(RawNum).init(alloc); var lines = helper.getlines(inp); while (lines.next()) |line| { const rawnum = try RawNum.fromLine(alloc, line); try list.append(rawnum); } return list; } const RawNumElem = union(enum) { open_brace, close_brace, number: u8, }; const RawNum = struct { elems: ArrayList(RawNumElem), const Self = @This(); pub fn fromLine(alloc: Allocator, line: []const u8) !Self { var list = try ArrayList(RawNumElem).initCapacity(alloc, line.len); for (line) |ch| { try list.append(switch (ch) { '[' => .open_brace, ']' => .close_brace, else => if (!std.ascii.isDigit(ch)) continue else .{ .number = ch - '0' }, }); } return Self{ .elems = list }; } pub fn addToSelf(self: *Self, other: Self) !void { try self.concatToSelf(other); try self.reduce(); } pub fn clone(self: Self) !Self { var newlist = try ArrayList(RawNumElem).initCapacity(self.elems.allocator, self.elems.capacity); try newlist.appendSlice(self.elems.items); return Self{ .elems = newlist }; } fn concatToSelf(self: *Self, other: Self) !void { try self.elems.insert(0, .open_brace); try self.elems.appendSlice(other.elems.items); try self.elems.append(.close_brace); } fn reduce(self: *Self) !void { while (try self.reduceOnce()) {} } fn reduceOnce(self: *Self) !bool { var nesting_level: i32 = 0; // these loops must be separate because exploding must happen // before splitting. for (self.elems.items) |item, i| switch (item) { .open_brace => if (nesting_level >= 4) { self.explodeAt(i); return true; } else { nesting_level += 1; }, .close_brace => nesting_level -= 1, .number => {}, }; for (self.elems.items) |item, i| switch (item) { .open_brace, .close_brace => {}, .number => |num| if (num >= 10) { try self.splitAt(i); return true; }, }; return false; } fn explodeAt(self: *Self, i: usize) void { var items = self.elems.items; const left = items[i + 1].number; const right = items[i + 2].number; self.addNumToFirstLeft(i, left); self.addNumToFirstRight(i + 3, right); const new_items: [1]RawNumElem = .{.{ .number = 0 }}; self.elems.replaceRange(i, 4, &new_items) catch unreachable; } fn addNumToFirstLeft(self: *Self, i: usize, num: u8) void { var j: usize = 1; while (j <= i) : (j += 1) { switch (self.elems.items[i - j]) { .number => |*found| { found.* += num; break; }, else => {}, } } } fn addNumToFirstRight(self: *Self, i: usize, num: u8) void { var j: usize = 1; while (i + j < self.elems.items.len) : (j += 1) { switch (self.elems.items[i + j]) { .number => |*found| { found.* += num; break; }, else => {}, } } } fn splitAt(self: *Self, i: usize) !void { const num = self.elems.items[i].number; const left = num / 2; const right = num - left; const new_items: [4]RawNumElem = .{ .open_brace, .{ .number = left }, .{ .number = right }, .close_brace, }; try self.elems.replaceRange(i, 1, &new_items); } fn getMagnitude(self: Self) i64 { var i: usize = 0; return self.getMagnitudeInner(&i); } fn getMagnitudeInner(self: Self, i: *usize) i64 { switch (self.elems.items[i.*]) { .number => |num| return num, .close_brace => unreachable, .open_brace => { i.* += 1; const left = self.getMagnitudeInner(i); i.* += 1; const right = self.getMagnitudeInner(i); i.* += 1; return 3 * left + 2 * right; }, } } fn print(self: *const Self) void { const stdout = std.io.getStdOut().writer(); for (self.elems.items) |item| switch (item) { .open_brace => stdout.print("[ ", .{}) catch unreachable, .close_brace => stdout.print("] ", .{}) catch unreachable, .number => |n| stdout.print("{} ", .{n}) catch unreachable, }; stdout.print("\n", .{}) catch unreachable; } }; const eql = std.mem.eql; const tokenize = std.mem.tokenize; const split = std.mem.split; const count = std.mem.count; const parseUnsigned = std.fmt.parseUnsigned; const parseInt = std.fmt.parseInt; const sort = std.sort.sort;
src/day18.zig
const std = @import("std"); const builtin = @import("builtin"); pub const utils = @import("utils"); pub const system_calls = @import("system_calls.zig"); pub const start = @import("start.zig"); pub const keyboard = @import("keyboard.zig"); pub const io = @import("io.zig"); pub const memory = @import("memory.zig"); pub const is_cross_compiled = builtin.os.tag == .freestanding; const root = @import("root"); pub const is_kernel = is_cross_compiled and @hasDecl(root, "kernel_main"); pub const is_program = is_cross_compiled and @hasDecl(root, "main"); comptime { if (is_program) { // Force include program stubs. Based on std.zig. _ = start; } } pub var proc_info: if (is_program) *const ProcessInfo else void = undefined; pub fn panic(msg: []const u8, trace: ?*std.builtin.StackTrace) noreturn { _ = trace; var buffer: [128]u8 = undefined; var ts = utils.ToString{.buffer = buffer[0..]}; ts.string("\x1bc") catch unreachable; ts.string(proc_info.name) catch unreachable; ts.string(" panicked: ") catch unreachable; ts.string(msg) catch unreachable; ts.string("\n") catch unreachable; system_calls.print_string(ts.get()); system_calls.exit(1); } pub const DirEntry = struct { dir: []const u8, dir_inode: ?usize = null, current_entry_buffer: [128]u8 = undefined, current_entry: []u8 = undefined, current_entry_inode: ?usize = null, done: bool = false, }; pub const ProcessInfo = struct { path: []const u8, name: []const u8 = utils.make_const_slice(u8, @intToPtr([*]const u8, 1024), 0), args: []const []const u8 = utils.make_const_slice( []const u8, @intToPtr([*]const []const u8, 1024), 0), kernel_mode: bool = false, }; pub const fs = struct { pub const Error = error { FileNotFound, NotADirectory, NotAFile, InvalidFilesystem, } || io.FileError; pub fn open(path: []const u8) Error!io.File { return io.File{.valid = true, .id = try system_calls.file_open(path)}; } }; pub const threading = struct { pub const Error = error { NoCurrentProcess, } || utils.Error || memory.MemoryError; }; pub const ThreadingOrFsError = fs.Error || threading.Error; pub const elf = struct { pub const Error = error { InvalidElfFile, InvalidElfObjectType, InvalidElfPlatform, }; }; pub const ExecError = ThreadingOrFsError || elf.Error; pub const Blocking = enum { Blocking, NonBlocking, };
libs/georgios/georgios.zig
const std = @import("std"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = &gpa.allocator; const Players = struct { p1: std.ArrayList(usize), p2: std.ArrayList(usize) }; const Player = enum { p1, p2 }; fn get_input() !Players { const f = try std.fs.cwd().openFile("inputs/day22.txt", .{ .read = true }); var file_contents = try f.reader().readAllAlloc( allocator, // file wont be bigger, RIGHT? 999_999_999, ); defer allocator.free(file_contents); var file_contents_trimmed = std.mem.trim(u8, file_contents, "\n"); var p1 = std.ArrayList(usize).init(allocator); var p2 = std.ArrayList(usize).init(allocator); var p1Now = true; var lines = std.mem.split(file_contents_trimmed, "\n"); while (lines.next()) |line| { if (line.len == 0) { p1Now = false; continue; } if (line[0] == 'P') { continue; } if (p1Now) { try p1.append(try std.fmt.parseInt(usize, line, 10)); } else { try p2.append(try std.fmt.parseInt(usize, line, 10)); } } return Players{ .p1 = p1, .p2 = p2 }; } fn copyPlayers(players: *Players, p1Length: usize, p2Length: usize) !Players { var p1 = std.ArrayList(usize).init(allocator); try p1.ensureCapacity(p1Length); var p2 = std.ArrayList(usize).init(allocator); try p2.ensureCapacity(p2Length); var i: usize = 0; while (i < p1Length) : (i += 1) { try p1.append(players.p1.items[i]); } i = 0; while (i < p2Length) : (i += 1) { try p2.append(players.p2.items[i]); } return Players{ .p1 = p1, .p2 = p2 }; } fn play(players: *Players, isPart1: bool) !Player { var round: usize = 0; while (players.p1.items.len != 0 and players.p2.items.len != 0) : (round += 1) { // yeah nah I'm not gonna check if I'm in a loop, just bail me out if it's taking too long if (round > 1_000) return .p1; var card1 = players.p1.orderedRemove(0); var card2 = players.p2.orderedRemove(0); var winner: Player = if (card1 > card2) .p1 else .p2; if (!isPart1 and card1 <= players.p1.items.len and card2 <= players.p2.items.len) { var copy = try copyPlayers(players, card1, card2); defer copy.p1.deinit(); defer copy.p2.deinit(); // oopsie recursive inferred errors no work winner = play(&copy, isPart1) catch unreachable; } if (winner == .p1) { try players.p1.append(card1); try players.p1.append(card2); } else { try players.p2.append(card2); try players.p2.append(card1); } } return if (players.p1.items.len == 0) .p2 else .p1; } fn countResult(players: Players, winner: Player) usize { var res: usize = 0; var curr: usize = std.math.max(players.p1.items.len, players.p2.items.len); for (switch (winner) { .p1 => players.p1.items, .p2 => players.p2.items, }) |item| { res += item * curr; curr -= 1; } return res; } fn part1() !usize { var data = get_input() catch unreachable; defer data.p1.deinit(); defer data.p2.deinit(); return countResult(data, try play(&data, true)); } fn part2() !usize { var data = get_input() catch unreachable; defer data.p1.deinit(); defer data.p2.deinit(); return countResult(data, try play(&data, false)); } pub fn main() void { std.debug.print("day 22:\n\tpart 1: {}\n\tpart 2: {}\n", .{ part1(), part2() }); }
src/day22.zig
const StringReplacer = @import("strings").StringReplacer; const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const Buffer = std.Buffer; const Value = json.Value; const json = std.json; const testing = std.testing; const warn = std.debug.warn; pub const Dump = struct { escape: StringReplacer, buf: Buffer, pub fn init(a: *Allocator) !Dump { return Dump{ .escape = try StringReplacer.init( a, [_][]const u8{ \\" , \\\" }, ), .buf = try Buffer.init(a, ""), }; } pub fn deinit(this: *Dump) void { (&this.escape).deinit(); (&this.buf).deinit(); } pub fn dump(this: *Dump, self: Value, stream: var) anyerror!void { switch (self) { Value.Null => { try stream.write("null"); }, Value.Bool => |inner| { try stream.print("{}", inner); }, Value.Integer => |inner| { try stream.print("{}", inner); }, Value.Float => |inner| { try stream.print("{d:.5}", inner); }, Value.String => |inner| { const r = &this.escape; var b = &this.buf; try b.resize(0); try r.replace(inner, b); try stream.print("\"{}\"", b.toSlice()); }, Value.Array => |inner| { var not_first = false; try stream.write("["); for (inner.toSliceConst()) |value| { if (not_first) { try stream.write(","); } not_first = true; try this.dump(value, stream); } try stream.write("]"); }, Value.Object => |inner| { var not_first = false; try stream.write("{"); var it = inner.iterator(); while (it.next()) |entry| { if (not_first) { try stream.write(","); } not_first = true; try stream.print("\"{}\":", entry.key); try this.dump(entry.value, stream); } try stream.write("}"); }, } } pub fn dumpIndent(this: *Dump, self: Value, stream: var, indent: usize) anyerror!void { if (indent == 0) { try this.dump(self, stream); } else { try this.dumpIndentLevel(self, stream, indent, 0); } } fn dumpIndentLevel(this: *Dump, self: Value, stream: var, indent: usize, level: usize) anyerror!void { switch (self) { Value.Null => { try stream.write("null"); }, Value.Bool => |inner| { try stream.print("{}", inner); }, Value.Integer => |inner| { try stream.print("{}", inner); }, Value.Float => |inner| { try stream.print("{.5}", inner); }, Value.String => |inner| { const r = &this.escape; var b = &this.buf; try b.resize(0); try r.replace(inner, b); try stream.print("\"{}\"", b.toSlice()); }, Value.Array => |inner| { var not_first = false; try stream.write("[\n"); for (inner.toSliceConst()) |value| { if (not_first) { try stream.write(",\n"); } not_first = true; try padSpace(stream, level + indent); try this.dumpIndentLevel(value, stream, indent, level + indent); } try stream.write("\n"); try padSpace(stream, level); try stream.write("]"); }, Value.Object => |inner| { var not_first = false; try stream.write("{\n"); var it = inner.iterator(); while (it.next()) |entry| { if (not_first) { try stream.write(",\n"); } not_first = true; try padSpace(stream, level + indent); try stream.print("\"{}\": ", entry.key); try this.dumpIndentLevel(entry.value, stream, indent, level + indent); } try stream.write("\n"); try padSpace(stream, level); try stream.write("}"); }, } } fn padSpace(stream: var, indent: usize) !void { var i: usize = 0; while (i < indent) : (i += 1) { try stream.write(" "); } } };
src/json/json.zig
pub usingnamespace @import("std").c.builtins; const enum_unnamed_1 = extern enum(c_int) { ROARING_VERSION_MAJOR = 0, ROARING_VERSION_MINOR = 3, ROARING_VERSION_REVISION = 1, _, }; pub const ROARING_VERSION_MAJOR = @enumToInt(enum_unnamed_1.ROARING_VERSION_MAJOR); pub const ROARING_VERSION_MINOR = @enumToInt(enum_unnamed_1.ROARING_VERSION_MINOR); pub const ROARING_VERSION_REVISION = @enumToInt(enum_unnamed_1.ROARING_VERSION_REVISION); pub const __u_char = u8; pub const __u_short = c_ushort; pub const __u_int = c_uint; pub const __u_long = c_ulong; pub const __int8_t = i8; pub const __uint8_t = u8; pub const __int16_t = c_short; pub const __uint16_t = c_ushort; pub const __int32_t = c_int; pub const __uint32_t = c_uint; pub const __int64_t = c_long; pub const __uint64_t = c_ulong; pub const __int_least8_t = __int8_t; pub const __uint_least8_t = __uint8_t; pub const __int_least16_t = __int16_t; pub const __uint_least16_t = __uint16_t; pub const __int_least32_t = __int32_t; pub const __uint_least32_t = __uint32_t; pub const __int_least64_t = __int64_t; pub const __uint_least64_t = __uint64_t; pub const __quad_t = c_long; pub const __u_quad_t = c_ulong; pub const __intmax_t = c_long; pub const __uintmax_t = c_ulong; pub const __dev_t = c_ulong; pub const __uid_t = c_uint; pub const __gid_t = c_uint; pub const __ino_t = c_ulong; pub const __ino64_t = c_ulong; pub const __mode_t = c_uint; pub const __nlink_t = c_ulong; pub const __off_t = c_long; pub const __off64_t = c_long; pub const __pid_t = c_int; pub const __fsid_t = extern struct { __val: [2]c_int, }; pub const __clock_t = c_long; pub const __rlim_t = c_ulong; pub const __rlim64_t = c_ulong; pub const __id_t = c_uint; pub const __time_t = c_long; pub const __useconds_t = c_uint; pub const __suseconds_t = c_long; pub const __suseconds64_t = c_long; pub const __daddr_t = c_int; pub const __key_t = c_int; pub const __clockid_t = c_int; pub const __timer_t = ?*c_void; pub const __blksize_t = c_long; pub const __blkcnt_t = c_long; pub const __blkcnt64_t = c_long; pub const __fsblkcnt_t = c_ulong; pub const __fsblkcnt64_t = c_ulong; pub const __fsfilcnt_t = c_ulong; pub const __fsfilcnt64_t = c_ulong; pub const __fsword_t = c_long; pub const __ssize_t = c_long; pub const __syscall_slong_t = c_long; pub const __syscall_ulong_t = c_ulong; pub const __loff_t = __off64_t; pub const __caddr_t = [*c]u8; pub const __intptr_t = c_long; pub const __socklen_t = c_uint; pub const __sig_atomic_t = c_int; pub const int_least8_t = __int_least8_t; pub const int_least16_t = __int_least16_t; pub const int_least32_t = __int_least32_t; pub const int_least64_t = __int_least64_t; pub const uint_least8_t = __uint_least8_t; pub const uint_least16_t = __uint_least16_t; pub const uint_least32_t = __uint_least32_t; pub const uint_least64_t = __uint_least64_t; pub const int_fast8_t = i8; pub const int_fast16_t = c_long; pub const int_fast32_t = c_long; pub const int_fast64_t = c_long; pub const uint_fast8_t = u8; pub const uint_fast16_t = c_ulong; pub const uint_fast32_t = c_ulong; pub const uint_fast64_t = c_ulong; pub const intmax_t = __intmax_t; pub const uintmax_t = __uintmax_t; pub const struct_roaring_array_s = extern struct { size: i32, allocation_size: i32, containers: [*c]?*c_void, keys: [*c]u16, typecodes: [*c]u8, flags: u8, }; pub const roaring_array_t = struct_roaring_array_s; pub const roaring_iterator = ?fn (u32, ?*c_void) callconv(.C) bool; pub const roaring_iterator64 = ?fn (u64, ?*c_void) callconv(.C) bool; pub const struct_roaring_statistics_s = extern struct { n_containers: u32, n_array_containers: u32, n_run_containers: u32, n_bitset_containers: u32, n_values_array_containers: u32, n_values_run_containers: u32, n_values_bitset_containers: u32, n_bytes_array_containers: u32, n_bytes_run_containers: u32, n_bytes_bitset_containers: u32, max_value: u32, min_value: u32, sum_value: u64, cardinality: u64, }; pub const roaring_statistics_t = struct_roaring_statistics_s; pub const ptrdiff_t = c_long; pub const wchar_t = c_int; pub const max_align_t = extern struct { __clang_max_align_nonce1: c_longlong align(8), __clang_max_align_nonce2: c_longdouble align(16), }; pub const struct_roaring_bitmap_s = extern struct { high_low_container: roaring_array_t, }; pub const roaring_bitmap_t = struct_roaring_bitmap_s; pub extern fn roaring_bitmap_create_with_capacity(cap: u32) [*c]roaring_bitmap_t; pub fn roaring_bitmap_create() callconv(.C) [*c]roaring_bitmap_t { return roaring_bitmap_create_with_capacity(@bitCast(u32, @as(c_int, 0))); } pub extern fn roaring_bitmap_init_with_capacity(r: [*c]roaring_bitmap_t, cap: u32) bool; pub fn roaring_bitmap_init_cleared(arg_r: [*c]roaring_bitmap_t) callconv(.C) void { var r = arg_r; _ = roaring_bitmap_init_with_capacity(r, @bitCast(u32, @as(c_int, 0))); } pub extern fn roaring_bitmap_from_range(min: u64, max: u64, step: u32) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_of_ptr(n_args: usize, vals: [*c]const u32) [*c]roaring_bitmap_t; pub fn roaring_bitmap_get_copy_on_write(arg_r: [*c]const roaring_bitmap_t) callconv(.C) bool { var r = arg_r; return (@bitCast(c_int, @as(c_uint, r.*.high_low_container.flags)) & @as(c_int, 1)) != 0; } pub fn roaring_bitmap_set_copy_on_write(arg_r: [*c]roaring_bitmap_t, arg_cow: bool) callconv(.C) void { var r = arg_r; var cow = arg_cow; if (cow) { r.*.high_low_container.flags |= @bitCast(u8, @truncate(i8, @as(c_int, 1))); } else { r.*.high_low_container.flags &= @bitCast(u8, @truncate(i8, ~@as(c_int, 1))); } } pub extern fn roaring_bitmap_printf_describe(r: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_of(n: usize, ...) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_copy(r: [*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_overwrite(dest: [*c]roaring_bitmap_t, src: [*c]const roaring_bitmap_t) bool; pub extern fn roaring_bitmap_printf(r: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_and(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_and_cardinality(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) u64; pub extern fn roaring_bitmap_intersect(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) bool; pub extern fn roaring_bitmap_jaccard_index(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) f64; pub extern fn roaring_bitmap_or_cardinality(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) u64; pub extern fn roaring_bitmap_andnot_cardinality(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) u64; pub extern fn roaring_bitmap_xor_cardinality(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) u64; pub extern fn roaring_bitmap_and_inplace(r1: [*c]roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_or(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_or_inplace(r1: [*c]roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_or_many(number: usize, rs: [*c][*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_or_many_heap(number: u32, rs: [*c][*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_xor(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_xor_inplace(r1: [*c]roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_xor_many(number: usize, rs: [*c][*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_andnot(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_andnot_inplace(r1: [*c]roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_free(r: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_add_many(r: [*c]roaring_bitmap_t, n_args: usize, vals: [*c]const u32) void; pub extern fn roaring_bitmap_add(r: [*c]roaring_bitmap_t, x: u32) void; pub extern fn roaring_bitmap_add_checked(r: [*c]roaring_bitmap_t, x: u32) bool; pub extern fn roaring_bitmap_add_range_closed(r: [*c]roaring_bitmap_t, min: u32, max: u32) void; pub fn roaring_bitmap_add_range(arg_r: [*c]roaring_bitmap_t, arg_min: u64, arg_max: u64) callconv(.C) void { var r = arg_r; var min = arg_min; var max = arg_max; if (max == min) return; roaring_bitmap_add_range_closed(r, @bitCast(u32, @truncate(c_uint, min)), @bitCast(u32, @truncate(c_uint, max -% @bitCast(c_ulong, @as(c_long, @as(c_int, 1)))))); } pub extern fn roaring_bitmap_remove(r: [*c]roaring_bitmap_t, x: u32) void; pub extern fn roaring_bitmap_remove_range_closed(r: [*c]roaring_bitmap_t, min: u32, max: u32) void; pub fn roaring_bitmap_remove_range(arg_r: [*c]roaring_bitmap_t, arg_min: u64, arg_max: u64) callconv(.C) void { var r = arg_r; var min = arg_min; var max = arg_max; if (max == min) return; roaring_bitmap_remove_range_closed(r, @bitCast(u32, @truncate(c_uint, min)), @bitCast(u32, @truncate(c_uint, max -% @bitCast(c_ulong, @as(c_long, @as(c_int, 1)))))); } pub extern fn roaring_bitmap_remove_many(r: [*c]roaring_bitmap_t, n_args: usize, vals: [*c]const u32) void; pub extern fn roaring_bitmap_remove_checked(r: [*c]roaring_bitmap_t, x: u32) bool; pub extern fn roaring_bitmap_contains(r: [*c]const roaring_bitmap_t, val: u32) bool; pub extern fn roaring_bitmap_contains_range(r: [*c]const roaring_bitmap_t, range_start: u64, range_end: u64) bool; pub extern fn roaring_bitmap_get_cardinality(r: [*c]const roaring_bitmap_t) u64; pub extern fn roaring_bitmap_range_cardinality(r: [*c]const roaring_bitmap_t, range_start: u64, range_end: u64) u64; pub extern fn roaring_bitmap_is_empty(r: [*c]const roaring_bitmap_t) bool; pub extern fn roaring_bitmap_clear(r: [*c]roaring_bitmap_t) void; pub extern fn roaring_bitmap_to_uint32_array(r: [*c]const roaring_bitmap_t, ans: [*c]u32) void; pub extern fn roaring_bitmap_range_uint32_array(r: [*c]const roaring_bitmap_t, offset: usize, limit: usize, ans: [*c]u32) bool; pub extern fn roaring_bitmap_remove_run_compression(r: [*c]roaring_bitmap_t) bool; pub extern fn roaring_bitmap_run_optimize(r: [*c]roaring_bitmap_t) bool; pub extern fn roaring_bitmap_shrink_to_fit(r: [*c]roaring_bitmap_t) usize; pub extern fn roaring_bitmap_serialize(r: [*c]const roaring_bitmap_t, buf: [*c]u8) usize; pub extern fn roaring_bitmap_deserialize(buf: ?*const c_void) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_size_in_bytes(r: [*c]const roaring_bitmap_t) usize; pub extern fn roaring_bitmap_portable_deserialize(buf: [*c]const u8) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_portable_deserialize_safe(buf: [*c]const u8, maxbytes: usize) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_portable_deserialize_size(buf: [*c]const u8, maxbytes: usize) usize; pub extern fn roaring_bitmap_portable_size_in_bytes(r: [*c]const roaring_bitmap_t) usize; pub extern fn roaring_bitmap_portable_serialize(r: [*c]const roaring_bitmap_t, buf: [*c]u8) usize; pub extern fn roaring_bitmap_frozen_size_in_bytes(r: [*c]const roaring_bitmap_t) usize; pub extern fn roaring_bitmap_frozen_serialize(r: [*c]const roaring_bitmap_t, buf: [*c]u8) void; pub extern fn roaring_bitmap_frozen_view(buf: [*c]const u8, length: usize) [*c]const roaring_bitmap_t; pub extern fn roaring_iterate(r: [*c]const roaring_bitmap_t, iterator: roaring_iterator, ptr: ?*c_void) bool; pub extern fn roaring_iterate64(r: [*c]const roaring_bitmap_t, iterator: roaring_iterator64, high_bits: u64, ptr: ?*c_void) bool; pub extern fn roaring_bitmap_equals(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) bool; pub extern fn roaring_bitmap_is_subset(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) bool; pub extern fn roaring_bitmap_is_strict_subset(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) bool; pub extern fn roaring_bitmap_lazy_or(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t, bitsetconversion: bool) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_lazy_or_inplace(r1: [*c]roaring_bitmap_t, r2: [*c]const roaring_bitmap_t, bitsetconversion: bool) void; pub extern fn roaring_bitmap_repair_after_lazy(r1: [*c]roaring_bitmap_t) void; pub extern fn roaring_bitmap_lazy_xor(r1: [*c]const roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_lazy_xor_inplace(r1: [*c]roaring_bitmap_t, r2: [*c]const roaring_bitmap_t) void; pub extern fn roaring_bitmap_flip(r1: [*c]const roaring_bitmap_t, range_start: u64, range_end: u64) [*c]roaring_bitmap_t; pub extern fn roaring_bitmap_flip_inplace(r1: [*c]roaring_bitmap_t, range_start: u64, range_end: u64) void; pub extern fn roaring_bitmap_select(r: [*c]const roaring_bitmap_t, rank: u32, element: [*c]u32) bool; pub extern fn roaring_bitmap_rank(r: [*c]const roaring_bitmap_t, x: u32) u64; pub extern fn roaring_bitmap_minimum(r: [*c]const roaring_bitmap_t) u32; pub extern fn roaring_bitmap_maximum(r: [*c]const roaring_bitmap_t) u32; pub extern fn roaring_bitmap_statistics(r: [*c]const roaring_bitmap_t, stat: [*c]roaring_statistics_t) void; pub const struct_roaring_uint32_iterator_s = extern struct { parent: [*c]const roaring_bitmap_t, container_index: i32, in_container_index: i32, run_index: i32, current_value: u32, has_value: bool, container: ?*const c_void, typecode: u8, highbits: u32, }; pub const roaring_uint32_iterator_t = struct_roaring_uint32_iterator_s; pub extern fn roaring_init_iterator(r: [*c]const roaring_bitmap_t, newit: [*c]roaring_uint32_iterator_t) void; pub extern fn roaring_init_iterator_last(r: [*c]const roaring_bitmap_t, newit: [*c]roaring_uint32_iterator_t) void; pub extern fn roaring_create_iterator(r: [*c]const roaring_bitmap_t) [*c]roaring_uint32_iterator_t; pub extern fn roaring_advance_uint32_iterator(it: [*c]roaring_uint32_iterator_t) bool; pub extern fn roaring_previous_uint32_iterator(it: [*c]roaring_uint32_iterator_t) bool; pub extern fn roaring_move_uint32_iterator_equalorlarger(it: [*c]roaring_uint32_iterator_t, val: u32) bool; pub extern fn roaring_copy_uint32_iterator(it: [*c]const roaring_uint32_iterator_t) [*c]roaring_uint32_iterator_t; pub extern fn roaring_free_uint32_iterator(it: [*c]roaring_uint32_iterator_t) void; pub extern fn roaring_read_uint32_iterator(it: [*c]roaring_uint32_iterator_t, buf: [*c]u32, count: u32) u32; pub const __INTMAX_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // (no file):62:9 pub const __UINTMAX_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_unsigned"); // (no file):66:9 pub const __PTRDIFF_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // (no file):73:9 pub const __INTPTR_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // (no file):77:9 pub const __SIZE_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_unsigned"); // (no file):81:9 pub const __UINTPTR_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_unsigned"); // (no file):96:9 pub const __INT64_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // (no file):159:9 pub const __UINT64_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_unsigned"); // (no file):187:9 pub const __INT_LEAST64_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // (no file):225:9 pub const __UINT_LEAST64_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_unsigned"); // (no file):229:9 pub const __INT_FAST64_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // (no file):265:9 pub const __UINT_FAST64_TYPE__ = @compileError("unable to translate C expr: unexpected token .Keyword_unsigned"); // (no file):269:9 pub const ROARING_VERSION = @compileError("unable to translate C expr: unexpected token .Equal"); // croaring/roaring.h:26:9 pub const __GLIBC_USE = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/features.h:179:9 pub const __NTH = @compileError("unable to translate C expr: unexpected token .Identifier"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:57:11 pub const __NTHNL = @compileError("unable to translate C expr: unexpected token .Identifier"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:58:11 pub const __CONCAT = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:109:9 pub const __STRING = @compileError("unable to translate C expr: unexpected token .Hash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:110:9 pub const __warnattr = @compileError("unable to translate C expr: unexpected token .Eof"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:144:10 pub const __errordecl = @compileError("unable to translate C expr: unexpected token .Keyword_extern"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:145:10 pub const __flexarr = @compileError("unable to translate C expr: unexpected token .LBracket"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:153:10 pub const __REDIRECT = @compileError("unable to translate C expr: unexpected token .Hash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:184:10 pub const __REDIRECT_NTH = @compileError("unable to translate C expr: unexpected token .Hash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:191:11 pub const __REDIRECT_NTHNL = @compileError("unable to translate C expr: unexpected token .Hash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:193:11 pub const __ASMNAME2 = @compileError("unable to translate C expr: unexpected token .Identifier"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:197:10 pub const __attribute_alloc_size__ = @compileError("unable to translate C expr: unexpected token .Eof"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:229:10 pub const __extern_inline = @compileError("unable to translate C expr: unexpected token .Keyword_extern"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:356:11 pub const __extern_always_inline = @compileError("unable to translate C expr: unexpected token .Keyword_extern"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:357:11 pub const __attribute_copy__ = @compileError("unable to translate C expr: unexpected token .Eof"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:451:10 pub const __LDBL_REDIR2_DECL = @compileError("unable to translate C expr: unexpected token .Eof"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:522:10 pub const __LDBL_REDIR_DECL = @compileError("unable to translate C expr: unexpected token .Eof"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:523:10 pub const __glibc_macro_warning1 = @compileError("unable to translate C expr: unexpected token .Hash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:537:10 pub const __attr_access = @compileError("unable to translate C expr: unexpected token .Eof"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/sys/cdefs.h:569:11 pub const __S16_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:109:9 pub const __U16_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:110:9 pub const __SLONGWORD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:113:9 pub const __ULONGWORD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:114:9 pub const __SQUAD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:128:10 pub const __UQUAD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:129:10 pub const __SWORD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:130:10 pub const __UWORD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:131:10 pub const __S64_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:134:10 pub const __U64_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_int"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:135:10 pub const __STD_TYPE = @compileError("unable to translate C expr: unexpected token .Keyword_typedef"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/bits/types.h:137:10 pub const __FSID_T_TYPE = @compileError("unable to translate C expr: expected Identifier instead got: LBrace"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/x86_64-linux-gnu/bits/typesizes.h:73:9 pub const __INT64_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:106:11 pub const __UINT64_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:107:11 pub const INT64_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:252:11 pub const UINT32_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:260:10 pub const UINT64_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:262:11 pub const INTMAX_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:269:11 pub const UINTMAX_C = @compileError("unable to translate C expr: unexpected token .HashHash"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/libc/include/generic-glibc/stdint.h:270:11 pub const offsetof = @compileError("TODO implement function '__builtin_offsetof' in std.c.builtins"); // /home/justin/system/zig-linux-x86_64-0.8.0/lib/include/stddef.h:104:9 pub const __llvm__ = @as(c_int, 1); pub const __clang__ = @as(c_int, 1); pub const __clang_major__ = @as(c_int, 12); pub const __clang_minor__ = @as(c_int, 0); pub const __clang_patchlevel__ = @as(c_int, 1); pub const __clang_version__ = "12.0.1 (<EMAIL>:ziglang/zig-bootstrap.git 8cc2870e09320a390cafe4e23624e8ed40bd363c)"; pub const __GNUC__ = @as(c_int, 4); pub const __GNUC_MINOR__ = @as(c_int, 2); pub const __GNUC_PATCHLEVEL__ = @as(c_int, 1); pub const __GXX_ABI_VERSION = @as(c_int, 1002); pub const __ATOMIC_RELAXED = @as(c_int, 0); pub const __ATOMIC_CONSUME = @as(c_int, 1); pub const __ATOMIC_ACQUIRE = @as(c_int, 2); pub const __ATOMIC_RELEASE = @as(c_int, 3); pub const __ATOMIC_ACQ_REL = @as(c_int, 4); pub const __ATOMIC_SEQ_CST = @as(c_int, 5); pub const __OPENCL_MEMORY_SCOPE_WORK_ITEM = @as(c_int, 0); pub const __OPENCL_MEMORY_SCOPE_WORK_GROUP = @as(c_int, 1); pub const __OPENCL_MEMORY_SCOPE_DEVICE = @as(c_int, 2); pub const __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = @as(c_int, 3); pub const __OPENCL_MEMORY_SCOPE_SUB_GROUP = @as(c_int, 4); pub const __PRAGMA_REDEFINE_EXTNAME = @as(c_int, 1); pub const __VERSION__ = "Clang 12.0.1 (<EMAIL>:ziglang/zig-bootstrap.git 8cc2870e09320a390cafe4e23624e8ed40bd363c)"; pub const __OBJC_BOOL_IS_BOOL = @as(c_int, 0); pub const __CONSTANT_CFSTRINGS__ = @as(c_int, 1); pub const __OPTIMIZE__ = @as(c_int, 1); pub const __ORDER_LITTLE_ENDIAN__ = @as(c_int, 1234); pub const __ORDER_BIG_ENDIAN__ = @as(c_int, 4321); pub const __ORDER_PDP_ENDIAN__ = @as(c_int, 3412); pub const __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__; pub const __LITTLE_ENDIAN__ = @as(c_int, 1); pub const _LP64 = @as(c_int, 1); pub const __LP64__ = @as(c_int, 1); pub const __CHAR_BIT__ = @as(c_int, 8); pub const __SCHAR_MAX__ = @as(c_int, 127); pub const __SHRT_MAX__ = @as(c_int, 32767); pub const __INT_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __LONG_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __LONG_LONG_MAX__ = @as(c_longlong, 9223372036854775807); pub const __WCHAR_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __WINT_MAX__ = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __INTMAX_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __SIZE_MAX__ = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __UINTMAX_MAX__ = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __PTRDIFF_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __INTPTR_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __UINTPTR_MAX__ = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __SIZEOF_DOUBLE__ = @as(c_int, 8); pub const __SIZEOF_FLOAT__ = @as(c_int, 4); pub const __SIZEOF_INT__ = @as(c_int, 4); pub const __SIZEOF_LONG__ = @as(c_int, 8); pub const __SIZEOF_LONG_DOUBLE__ = @as(c_int, 16); pub const __SIZEOF_LONG_LONG__ = @as(c_int, 8); pub const __SIZEOF_POINTER__ = @as(c_int, 8); pub const __SIZEOF_SHORT__ = @as(c_int, 2); pub const __SIZEOF_PTRDIFF_T__ = @as(c_int, 8); pub const __SIZEOF_SIZE_T__ = @as(c_int, 8); pub const __SIZEOF_WCHAR_T__ = @as(c_int, 4); pub const __SIZEOF_WINT_T__ = @as(c_int, 4); pub const __SIZEOF_INT128__ = @as(c_int, 16); pub const __INTMAX_FMTd__ = "ld"; pub const __INTMAX_FMTi__ = "li"; pub const __INTMAX_C_SUFFIX__ = L; pub const __UINTMAX_FMTo__ = "lo"; pub const __UINTMAX_FMTu__ = "lu"; pub const __UINTMAX_FMTx__ = "lx"; pub const __UINTMAX_FMTX__ = "lX"; pub const __UINTMAX_C_SUFFIX__ = UL; pub const __INTMAX_WIDTH__ = @as(c_int, 64); pub const __PTRDIFF_FMTd__ = "ld"; pub const __PTRDIFF_FMTi__ = "li"; pub const __PTRDIFF_WIDTH__ = @as(c_int, 64); pub const __INTPTR_FMTd__ = "ld"; pub const __INTPTR_FMTi__ = "li"; pub const __INTPTR_WIDTH__ = @as(c_int, 64); pub const __SIZE_FMTo__ = "lo"; pub const __SIZE_FMTu__ = "lu"; pub const __SIZE_FMTx__ = "lx"; pub const __SIZE_FMTX__ = "lX"; pub const __SIZE_WIDTH__ = @as(c_int, 64); pub const __WCHAR_TYPE__ = c_int; pub const __WCHAR_WIDTH__ = @as(c_int, 32); pub const __WINT_TYPE__ = c_uint; pub const __WINT_WIDTH__ = @as(c_int, 32); pub const __SIG_ATOMIC_WIDTH__ = @as(c_int, 32); pub const __SIG_ATOMIC_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __CHAR16_TYPE__ = c_ushort; pub const __CHAR32_TYPE__ = c_uint; pub const __UINTMAX_WIDTH__ = @as(c_int, 64); pub const __UINTPTR_FMTo__ = "lo"; pub const __UINTPTR_FMTu__ = "lu"; pub const __UINTPTR_FMTx__ = "lx"; pub const __UINTPTR_FMTX__ = "lX"; pub const __UINTPTR_WIDTH__ = @as(c_int, 64); pub const __FLT_DENORM_MIN__ = @as(f32, 1.40129846e-45); pub const __FLT_HAS_DENORM__ = @as(c_int, 1); pub const __FLT_DIG__ = @as(c_int, 6); pub const __FLT_DECIMAL_DIG__ = @as(c_int, 9); pub const __FLT_EPSILON__ = @as(f32, 1.19209290e-7); pub const __FLT_HAS_INFINITY__ = @as(c_int, 1); pub const __FLT_HAS_QUIET_NAN__ = @as(c_int, 1); pub const __FLT_MANT_DIG__ = @as(c_int, 24); pub const __FLT_MAX_10_EXP__ = @as(c_int, 38); pub const __FLT_MAX_EXP__ = @as(c_int, 128); pub const __FLT_MAX__ = @as(f32, 3.40282347e+38); pub const __FLT_MIN_10_EXP__ = -@as(c_int, 37); pub const __FLT_MIN_EXP__ = -@as(c_int, 125); pub const __FLT_MIN__ = @as(f32, 1.17549435e-38); pub const __DBL_DENORM_MIN__ = 4.9406564584124654e-324; pub const __DBL_HAS_DENORM__ = @as(c_int, 1); pub const __DBL_DIG__ = @as(c_int, 15); pub const __DBL_DECIMAL_DIG__ = @as(c_int, 17); pub const __DBL_EPSILON__ = 2.2204460492503131e-16; pub const __DBL_HAS_INFINITY__ = @as(c_int, 1); pub const __DBL_HAS_QUIET_NAN__ = @as(c_int, 1); pub const __DBL_MANT_DIG__ = @as(c_int, 53); pub const __DBL_MAX_10_EXP__ = @as(c_int, 308); pub const __DBL_MAX_EXP__ = @as(c_int, 1024); pub const __DBL_MAX__ = 1.7976931348623157e+308; pub const __DBL_MIN_10_EXP__ = -@as(c_int, 307); pub const __DBL_MIN_EXP__ = -@as(c_int, 1021); pub const __DBL_MIN__ = 2.2250738585072014e-308; pub const __LDBL_DENORM_MIN__ = @as(c_longdouble, 3.64519953188247460253e-4951); pub const __LDBL_HAS_DENORM__ = @as(c_int, 1); pub const __LDBL_DIG__ = @as(c_int, 18); pub const __LDBL_DECIMAL_DIG__ = @as(c_int, 21); pub const __LDBL_EPSILON__ = @as(c_longdouble, 1.08420217248550443401e-19); pub const __LDBL_HAS_INFINITY__ = @as(c_int, 1); pub const __LDBL_HAS_QUIET_NAN__ = @as(c_int, 1); pub const __LDBL_MANT_DIG__ = @as(c_int, 64); pub const __LDBL_MAX_10_EXP__ = @as(c_int, 4932); pub const __LDBL_MAX_EXP__ = @as(c_int, 16384); pub const __LDBL_MAX__ = @as(c_longdouble, 1.18973149535723176502e+4932); pub const __LDBL_MIN_10_EXP__ = -@as(c_int, 4931); pub const __LDBL_MIN_EXP__ = -@as(c_int, 16381); pub const __LDBL_MIN__ = @as(c_longdouble, 3.36210314311209350626e-4932); pub const __POINTER_WIDTH__ = @as(c_int, 64); pub const __BIGGEST_ALIGNMENT__ = @as(c_int, 16); pub const __WINT_UNSIGNED__ = @as(c_int, 1); pub const __INT8_TYPE__ = i8; pub const __INT8_FMTd__ = "hhd"; pub const __INT8_FMTi__ = "hhi"; pub const __INT16_TYPE__ = c_short; pub const __INT16_FMTd__ = "hd"; pub const __INT16_FMTi__ = "hi"; pub const __INT32_TYPE__ = c_int; pub const __INT32_FMTd__ = "d"; pub const __INT32_FMTi__ = "i"; pub const __INT64_FMTd__ = "ld"; pub const __INT64_FMTi__ = "li"; pub const __INT64_C_SUFFIX__ = L; pub const __UINT8_TYPE__ = u8; pub const __UINT8_FMTo__ = "hho"; pub const __UINT8_FMTu__ = "hhu"; pub const __UINT8_FMTx__ = "hhx"; pub const __UINT8_FMTX__ = "hhX"; pub const __UINT8_MAX__ = @as(c_int, 255); pub const __INT8_MAX__ = @as(c_int, 127); pub const __UINT16_TYPE__ = c_ushort; pub const __UINT16_FMTo__ = "ho"; pub const __UINT16_FMTu__ = "hu"; pub const __UINT16_FMTx__ = "hx"; pub const __UINT16_FMTX__ = "hX"; pub const __UINT16_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 65535, .decimal); pub const __INT16_MAX__ = @as(c_int, 32767); pub const __UINT32_TYPE__ = c_uint; pub const __UINT32_FMTo__ = "o"; pub const __UINT32_FMTu__ = "u"; pub const __UINT32_FMTx__ = "x"; pub const __UINT32_FMTX__ = "X"; pub const __UINT32_C_SUFFIX__ = U; pub const __UINT32_MAX__ = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __INT32_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __UINT64_FMTo__ = "lo"; pub const __UINT64_FMTu__ = "lu"; pub const __UINT64_FMTx__ = "lx"; pub const __UINT64_FMTX__ = "lX"; pub const __UINT64_C_SUFFIX__ = UL; pub const __UINT64_MAX__ = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __INT64_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __INT_LEAST8_TYPE__ = i8; pub const __INT_LEAST8_MAX__ = @as(c_int, 127); pub const __INT_LEAST8_FMTd__ = "hhd"; pub const __INT_LEAST8_FMTi__ = "hhi"; pub const __UINT_LEAST8_TYPE__ = u8; pub const __UINT_LEAST8_MAX__ = @as(c_int, 255); pub const __UINT_LEAST8_FMTo__ = "hho"; pub const __UINT_LEAST8_FMTu__ = "hhu"; pub const __UINT_LEAST8_FMTx__ = "hhx"; pub const __UINT_LEAST8_FMTX__ = "hhX"; pub const __INT_LEAST16_TYPE__ = c_short; pub const __INT_LEAST16_MAX__ = @as(c_int, 32767); pub const __INT_LEAST16_FMTd__ = "hd"; pub const __INT_LEAST16_FMTi__ = "hi"; pub const __UINT_LEAST16_TYPE__ = c_ushort; pub const __UINT_LEAST16_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 65535, .decimal); pub const __UINT_LEAST16_FMTo__ = "ho"; pub const __UINT_LEAST16_FMTu__ = "hu"; pub const __UINT_LEAST16_FMTx__ = "hx"; pub const __UINT_LEAST16_FMTX__ = "hX"; pub const __INT_LEAST32_TYPE__ = c_int; pub const __INT_LEAST32_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INT_LEAST32_FMTd__ = "d"; pub const __INT_LEAST32_FMTi__ = "i"; pub const __UINT_LEAST32_TYPE__ = c_uint; pub const __UINT_LEAST32_MAX__ = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __UINT_LEAST32_FMTo__ = "o"; pub const __UINT_LEAST32_FMTu__ = "u"; pub const __UINT_LEAST32_FMTx__ = "x"; pub const __UINT_LEAST32_FMTX__ = "X"; pub const __INT_LEAST64_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __INT_LEAST64_FMTd__ = "ld"; pub const __INT_LEAST64_FMTi__ = "li"; pub const __UINT_LEAST64_MAX__ = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __UINT_LEAST64_FMTo__ = "lo"; pub const __UINT_LEAST64_FMTu__ = "lu"; pub const __UINT_LEAST64_FMTx__ = "lx"; pub const __UINT_LEAST64_FMTX__ = "lX"; pub const __INT_FAST8_TYPE__ = i8; pub const __INT_FAST8_MAX__ = @as(c_int, 127); pub const __INT_FAST8_FMTd__ = "hhd"; pub const __INT_FAST8_FMTi__ = "hhi"; pub const __UINT_FAST8_TYPE__ = u8; pub const __UINT_FAST8_MAX__ = @as(c_int, 255); pub const __UINT_FAST8_FMTo__ = "hho"; pub const __UINT_FAST8_FMTu__ = "hhu"; pub const __UINT_FAST8_FMTx__ = "hhx"; pub const __UINT_FAST8_FMTX__ = "hhX"; pub const __INT_FAST16_TYPE__ = c_short; pub const __INT_FAST16_MAX__ = @as(c_int, 32767); pub const __INT_FAST16_FMTd__ = "hd"; pub const __INT_FAST16_FMTi__ = "hi"; pub const __UINT_FAST16_TYPE__ = c_ushort; pub const __UINT_FAST16_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 65535, .decimal); pub const __UINT_FAST16_FMTo__ = "ho"; pub const __UINT_FAST16_FMTu__ = "hu"; pub const __UINT_FAST16_FMTx__ = "hx"; pub const __UINT_FAST16_FMTX__ = "hX"; pub const __INT_FAST32_TYPE__ = c_int; pub const __INT_FAST32_MAX__ = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const __INT_FAST32_FMTd__ = "d"; pub const __INT_FAST32_FMTi__ = "i"; pub const __UINT_FAST32_TYPE__ = c_uint; pub const __UINT_FAST32_MAX__ = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const __UINT_FAST32_FMTo__ = "o"; pub const __UINT_FAST32_FMTu__ = "u"; pub const __UINT_FAST32_FMTx__ = "x"; pub const __UINT_FAST32_FMTX__ = "X"; pub const __INT_FAST64_MAX__ = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const __INT_FAST64_FMTd__ = "ld"; pub const __INT_FAST64_FMTi__ = "li"; pub const __UINT_FAST64_MAX__ = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const __UINT_FAST64_FMTo__ = "lo"; pub const __UINT_FAST64_FMTu__ = "lu"; pub const __UINT_FAST64_FMTx__ = "lx"; pub const __UINT_FAST64_FMTX__ = "lX"; pub const __FINITE_MATH_ONLY__ = @as(c_int, 0); pub const __GNUC_STDC_INLINE__ = @as(c_int, 1); pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = @as(c_int, 1); pub const __CLANG_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_INT_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2); pub const __CLANG_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_INT_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2); pub const __GCC_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2); pub const __PIC__ = @as(c_int, 2); pub const __pic__ = @as(c_int, 2); pub const __FLT_EVAL_METHOD__ = @as(c_int, 0); pub const __FLT_RADIX__ = @as(c_int, 2); pub const __DECIMAL_DIG__ = __LDBL_DECIMAL_DIG__; pub const __SSP_STRONG__ = @as(c_int, 2); pub const __GCC_ASM_FLAG_OUTPUTS__ = @as(c_int, 1); pub const __code_model_small__ = @as(c_int, 1); pub const __amd64__ = @as(c_int, 1); pub const __amd64 = @as(c_int, 1); pub const __x86_64 = @as(c_int, 1); pub const __x86_64__ = @as(c_int, 1); pub const __SEG_GS = @as(c_int, 1); pub const __SEG_FS = @as(c_int, 1); pub const __seg_gs = __attribute__(address_space(@as(c_int, 256))); pub const __seg_fs = __attribute__(address_space(@as(c_int, 257))); pub const __corei7 = @as(c_int, 1); pub const __corei7__ = @as(c_int, 1); pub const __tune_corei7__ = @as(c_int, 1); pub const __NO_MATH_INLINES = @as(c_int, 1); pub const __AES__ = @as(c_int, 1); pub const __PCLMUL__ = @as(c_int, 1); pub const __LAHF_SAHF__ = @as(c_int, 1); pub const __LZCNT__ = @as(c_int, 1); pub const __RDRND__ = @as(c_int, 1); pub const __FSGSBASE__ = @as(c_int, 1); pub const __BMI__ = @as(c_int, 1); pub const __BMI2__ = @as(c_int, 1); pub const __POPCNT__ = @as(c_int, 1); pub const __PRFCHW__ = @as(c_int, 1); pub const __RDSEED__ = @as(c_int, 1); pub const __ADX__ = @as(c_int, 1); pub const __MOVBE__ = @as(c_int, 1); pub const __FMA__ = @as(c_int, 1); pub const __F16C__ = @as(c_int, 1); pub const __FXSR__ = @as(c_int, 1); pub const __XSAVE__ = @as(c_int, 1); pub const __XSAVEOPT__ = @as(c_int, 1); pub const __XSAVEC__ = @as(c_int, 1); pub const __XSAVES__ = @as(c_int, 1); pub const __CLFLUSHOPT__ = @as(c_int, 1); pub const __SGX__ = @as(c_int, 1); pub const __INVPCID__ = @as(c_int, 1); pub const __AVX2__ = @as(c_int, 1); pub const __AVX__ = @as(c_int, 1); pub const __SSE4_2__ = @as(c_int, 1); pub const __SSE4_1__ = @as(c_int, 1); pub const __SSSE3__ = @as(c_int, 1); pub const __SSE3__ = @as(c_int, 1); pub const __SSE2__ = @as(c_int, 1); pub const __SSE2_MATH__ = @as(c_int, 1); pub const __SSE__ = @as(c_int, 1); pub const __SSE_MATH__ = @as(c_int, 1); pub const __MMX__ = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = @as(c_int, 1); pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = @as(c_int, 1); pub const __SIZEOF_FLOAT128__ = @as(c_int, 16); pub const unix = @as(c_int, 1); pub const __unix = @as(c_int, 1); pub const __unix__ = @as(c_int, 1); pub const linux = @as(c_int, 1); pub const __linux = @as(c_int, 1); pub const __linux__ = @as(c_int, 1); pub const __ELF__ = @as(c_int, 1); pub const __gnu_linux__ = @as(c_int, 1); pub const __FLOAT128__ = @as(c_int, 1); pub const __STDC__ = @as(c_int, 1); pub const __STDC_HOSTED__ = @as(c_int, 1); pub const __STDC_VERSION__ = @as(c_long, 201710); pub const __STDC_UTF_16__ = @as(c_int, 1); pub const __STDC_UTF_32__ = @as(c_int, 1); pub const _DEBUG = @as(c_int, 1); pub const bool_2 = bool; pub const true_3 = @as(c_int, 1); pub const false_4 = @as(c_int, 0); pub const __bool_true_false_are_defined = @as(c_int, 1); pub const _STDINT_H = @as(c_int, 1); pub const _FEATURES_H = @as(c_int, 1); pub inline fn __GNUC_PREREQ(maj: anytype, min: anytype) @TypeOf(((__GNUC__ << @as(c_int, 16)) + __GNUC_MINOR__) >= ((maj << @as(c_int, 16)) + min)) { return ((__GNUC__ << @as(c_int, 16)) + __GNUC_MINOR__) >= ((maj << @as(c_int, 16)) + min); } pub inline fn __glibc_clang_prereq(maj: anytype, min: anytype) @TypeOf(((__clang_major__ << @as(c_int, 16)) + __clang_minor__) >= ((maj << @as(c_int, 16)) + min)) { return ((__clang_major__ << @as(c_int, 16)) + __clang_minor__) >= ((maj << @as(c_int, 16)) + min); } pub const _DEFAULT_SOURCE = @as(c_int, 1); pub const __GLIBC_USE_ISOC2X = @as(c_int, 0); pub const __USE_ISOC11 = @as(c_int, 1); pub const __USE_ISOC99 = @as(c_int, 1); pub const __USE_ISOC95 = @as(c_int, 1); pub const __USE_POSIX_IMPLICITLY = @as(c_int, 1); pub const _POSIX_SOURCE = @as(c_int, 1); pub const _POSIX_C_SOURCE = @as(c_long, 200809); pub const __USE_POSIX = @as(c_int, 1); pub const __USE_POSIX2 = @as(c_int, 1); pub const __USE_POSIX199309 = @as(c_int, 1); pub const __USE_POSIX199506 = @as(c_int, 1); pub const __USE_XOPEN2K = @as(c_int, 1); pub const __USE_XOPEN2K8 = @as(c_int, 1); pub const _ATFILE_SOURCE = @as(c_int, 1); pub const __USE_MISC = @as(c_int, 1); pub const __USE_ATFILE = @as(c_int, 1); pub const __USE_FORTIFY_LEVEL = @as(c_int, 0); pub const __GLIBC_USE_DEPRECATED_GETS = @as(c_int, 0); pub const __GLIBC_USE_DEPRECATED_SCANF = @as(c_int, 0); pub const _STDC_PREDEF_H = @as(c_int, 1); pub const __STDC_IEC_559__ = @as(c_int, 1); pub const __STDC_IEC_559_COMPLEX__ = @as(c_int, 1); pub const __STDC_ISO_10646__ = @as(c_long, 201706); pub const __GNU_LIBRARY__ = @as(c_int, 6); pub const __GLIBC__ = @as(c_int, 2); pub const __GLIBC_MINOR__ = @as(c_int, 33); pub inline fn __GLIBC_PREREQ(maj: anytype, min: anytype) @TypeOf(((__GLIBC__ << @as(c_int, 16)) + __GLIBC_MINOR__) >= ((maj << @as(c_int, 16)) + min)) { return ((__GLIBC__ << @as(c_int, 16)) + __GLIBC_MINOR__) >= ((maj << @as(c_int, 16)) + min); } pub const _SYS_CDEFS_H = @as(c_int, 1); pub const __THROW = __attribute__(__nothrow__ ++ __LEAF); pub const __THROWNL = __attribute__(__nothrow__); pub inline fn __glibc_clang_has_extension(ext: anytype) @TypeOf(__has_extension(ext)) { return __has_extension(ext); } pub inline fn __P(args: anytype) @TypeOf(args) { return args; } pub inline fn __PMT(args: anytype) @TypeOf(args) { return args; } pub const __ptr_t = ?*c_void; pub inline fn __bos(ptr: anytype) @TypeOf(__builtin_object_size(ptr, __USE_FORTIFY_LEVEL > @as(c_int, 1))) { return __builtin_object_size(ptr, __USE_FORTIFY_LEVEL > @as(c_int, 1)); } pub inline fn __bos0(ptr: anytype) @TypeOf(__builtin_object_size(ptr, @as(c_int, 0))) { return __builtin_object_size(ptr, @as(c_int, 0)); } pub inline fn __glibc_objsize0(__o: anytype) @TypeOf(__bos0(__o)) { return __bos0(__o); } pub inline fn __glibc_objsize(__o: anytype) @TypeOf(__bos(__o)) { return __bos(__o); } pub const __glibc_c99_flexarr_available = @as(c_int, 1); pub inline fn __ASMNAME(cname: anytype) @TypeOf(__ASMNAME2(__USER_LABEL_PREFIX__, cname)) { return __ASMNAME2(__USER_LABEL_PREFIX__, cname); } pub const __attribute_malloc__ = __attribute__(__malloc__); pub const __attribute_pure__ = __attribute__(__pure__); pub const __attribute_const__ = __attribute__(__const__); pub const __attribute_used__ = __attribute__(__used__); pub const __attribute_noinline__ = __attribute__(__noinline__); pub const __attribute_deprecated__ = __attribute__(__deprecated__); pub inline fn __attribute_deprecated_msg__(msg: anytype) @TypeOf(__attribute__(__deprecated__(msg))) { return __attribute__(__deprecated__(msg)); } pub inline fn __attribute_format_arg__(x: anytype) @TypeOf(__attribute__(__format_arg__(x))) { return __attribute__(__format_arg__(x)); } pub inline fn __attribute_format_strfmon__(a: anytype, b: anytype) @TypeOf(__attribute__(__format__(__strfmon__, a, b))) { return __attribute__(__format__(__strfmon__, a, b)); } pub inline fn __nonnull(params: anytype) @TypeOf(__attribute__(__nonnull__ ++ params)) { return __attribute__(__nonnull__ ++ params); } pub const __attribute_warn_unused_result__ = __attribute__(__warn_unused_result__); pub const __always_inline = __inline ++ __attribute__(__always_inline__); pub const __fortify_function = __extern_always_inline ++ __attribute_artificial__; pub const __restrict_arr = __restrict; pub inline fn __glibc_unlikely(cond: anytype) @TypeOf(__builtin_expect(cond, @as(c_int, 0))) { return __builtin_expect(cond, @as(c_int, 0)); } pub inline fn __glibc_likely(cond: anytype) @TypeOf(__builtin_expect(cond, @as(c_int, 1))) { return __builtin_expect(cond, @as(c_int, 1)); } pub inline fn __glibc_has_attribute(attr: anytype) @TypeOf(__has_attribute(attr)) { return __has_attribute(attr); } pub const __WORDSIZE = @as(c_int, 64); pub const __WORDSIZE_TIME64_COMPAT32 = @as(c_int, 1); pub const __SYSCALL_WORDSIZE = @as(c_int, 64); pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = @as(c_int, 0); pub inline fn __LDBL_REDIR1(name: anytype, proto: anytype, alias: anytype) @TypeOf(name ++ proto) { return name ++ proto; } pub inline fn __LDBL_REDIR(name: anytype, proto: anytype) @TypeOf(name ++ proto) { return name ++ proto; } pub inline fn __LDBL_REDIR1_NTH(name: anytype, proto: anytype, alias: anytype) @TypeOf(name ++ proto ++ __THROW) { return name ++ proto ++ __THROW; } pub inline fn __LDBL_REDIR_NTH(name: anytype, proto: anytype) @TypeOf(name ++ proto ++ __THROW) { return name ++ proto ++ __THROW; } pub inline fn __REDIRECT_LDBL(name: anytype, proto: anytype, alias: anytype) @TypeOf(__REDIRECT(name, proto, alias)) { return __REDIRECT(name, proto, alias); } pub inline fn __REDIRECT_NTH_LDBL(name: anytype, proto: anytype, alias: anytype) @TypeOf(__REDIRECT_NTH(name, proto, alias)) { return __REDIRECT_NTH(name, proto, alias); } pub inline fn __glibc_macro_warning(message: anytype) @TypeOf(__glibc_macro_warning1(GCC ++ warning ++ message)) { return __glibc_macro_warning1(GCC ++ warning ++ message); } pub const __HAVE_GENERIC_SELECTION = @as(c_int, 1); pub const __attribute_returns_twice__ = __attribute__(__returns_twice__); pub const __USE_EXTERN_INLINES = @as(c_int, 1); pub const __GLIBC_USE_LIB_EXT2 = @as(c_int, 0); pub const __GLIBC_USE_IEC_60559_BFP_EXT = @as(c_int, 0); pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X = @as(c_int, 0); pub const __GLIBC_USE_IEC_60559_FUNCS_EXT = @as(c_int, 0); pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = @as(c_int, 0); pub const __GLIBC_USE_IEC_60559_TYPES_EXT = @as(c_int, 0); pub const _BITS_TYPES_H = @as(c_int, 1); pub const __TIMESIZE = __WORDSIZE; pub const __S32_TYPE = c_int; pub const __U32_TYPE = c_uint; pub const __SLONG32_TYPE = c_int; pub const __ULONG32_TYPE = c_uint; pub const _BITS_TYPESIZES_H = @as(c_int, 1); pub const __SYSCALL_SLONG_TYPE = __SLONGWORD_TYPE; pub const __SYSCALL_ULONG_TYPE = __ULONGWORD_TYPE; pub const __DEV_T_TYPE = __UQUAD_TYPE; pub const __UID_T_TYPE = __U32_TYPE; pub const __GID_T_TYPE = __U32_TYPE; pub const __INO_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __INO64_T_TYPE = __UQUAD_TYPE; pub const __MODE_T_TYPE = __U32_TYPE; pub const __NLINK_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __FSWORD_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __OFF_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __OFF64_T_TYPE = __SQUAD_TYPE; pub const __PID_T_TYPE = __S32_TYPE; pub const __RLIM_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __RLIM64_T_TYPE = __UQUAD_TYPE; pub const __BLKCNT_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __BLKCNT64_T_TYPE = __SQUAD_TYPE; pub const __FSBLKCNT_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __FSBLKCNT64_T_TYPE = __UQUAD_TYPE; pub const __FSFILCNT_T_TYPE = __SYSCALL_ULONG_TYPE; pub const __FSFILCNT64_T_TYPE = __UQUAD_TYPE; pub const __ID_T_TYPE = __U32_TYPE; pub const __CLOCK_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __TIME_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __USECONDS_T_TYPE = __U32_TYPE; pub const __SUSECONDS_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __SUSECONDS64_T_TYPE = __SQUAD_TYPE; pub const __DADDR_T_TYPE = __S32_TYPE; pub const __KEY_T_TYPE = __S32_TYPE; pub const __CLOCKID_T_TYPE = __S32_TYPE; pub const __TIMER_T_TYPE = ?*c_void; pub const __BLKSIZE_T_TYPE = __SYSCALL_SLONG_TYPE; pub const __SSIZE_T_TYPE = __SWORD_TYPE; pub const __CPU_MASK_TYPE = __SYSCALL_ULONG_TYPE; pub const __OFF_T_MATCHES_OFF64_T = @as(c_int, 1); pub const __INO_T_MATCHES_INO64_T = @as(c_int, 1); pub const __RLIM_T_MATCHES_RLIM64_T = @as(c_int, 1); pub const __STATFS_MATCHES_STATFS64 = @as(c_int, 1); pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 = @as(c_int, 1); pub const __FD_SETSIZE = @as(c_int, 1024); pub const _BITS_TIME64_H = @as(c_int, 1); pub const __TIME64_T_TYPE = __TIME_T_TYPE; pub const _BITS_WCHAR_H = @as(c_int, 1); pub const __WCHAR_MAX = __WCHAR_MAX__; pub const __WCHAR_MIN = -__WCHAR_MAX - @as(c_int, 1); pub const _BITS_STDINT_INTN_H = @as(c_int, 1); pub const _BITS_STDINT_UINTN_H = @as(c_int, 1); pub const INT8_MIN = -@as(c_int, 128); pub const INT16_MIN = -@as(c_int, 32767) - @as(c_int, 1); pub const INT32_MIN = -@import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal) - @as(c_int, 1); pub const INT64_MIN = -__INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)) - @as(c_int, 1); pub const INT8_MAX = @as(c_int, 127); pub const INT16_MAX = @as(c_int, 32767); pub const INT32_MAX = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const INT64_MAX = __INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)); pub const UINT8_MAX = @as(c_int, 255); pub const UINT16_MAX = @import("std").meta.promoteIntLiteral(c_int, 65535, .decimal); pub const UINT32_MAX = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const UINT64_MAX = __UINT64_C(@import("std").meta.promoteIntLiteral(c_int, 18446744073709551615, .decimal)); pub const INT_LEAST8_MIN = -@as(c_int, 128); pub const INT_LEAST16_MIN = -@as(c_int, 32767) - @as(c_int, 1); pub const INT_LEAST32_MIN = -@import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal) - @as(c_int, 1); pub const INT_LEAST64_MIN = -__INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)) - @as(c_int, 1); pub const INT_LEAST8_MAX = @as(c_int, 127); pub const INT_LEAST16_MAX = @as(c_int, 32767); pub const INT_LEAST32_MAX = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const INT_LEAST64_MAX = __INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)); pub const UINT_LEAST8_MAX = @as(c_int, 255); pub const UINT_LEAST16_MAX = @import("std").meta.promoteIntLiteral(c_int, 65535, .decimal); pub const UINT_LEAST32_MAX = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub const UINT_LEAST64_MAX = __UINT64_C(@import("std").meta.promoteIntLiteral(c_int, 18446744073709551615, .decimal)); pub const INT_FAST8_MIN = -@as(c_int, 128); pub const INT_FAST16_MIN = -@import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal) - @as(c_int, 1); pub const INT_FAST32_MIN = -@import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal) - @as(c_int, 1); pub const INT_FAST64_MIN = -__INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)) - @as(c_int, 1); pub const INT_FAST8_MAX = @as(c_int, 127); pub const INT_FAST16_MAX = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const INT_FAST32_MAX = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const INT_FAST64_MAX = __INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)); pub const UINT_FAST8_MAX = @as(c_int, 255); pub const UINT_FAST16_MAX = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const UINT_FAST32_MAX = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const UINT_FAST64_MAX = __UINT64_C(@import("std").meta.promoteIntLiteral(c_int, 18446744073709551615, .decimal)); pub const INTPTR_MIN = -@import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal) - @as(c_int, 1); pub const INTPTR_MAX = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const UINTPTR_MAX = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const INTMAX_MIN = -__INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)) - @as(c_int, 1); pub const INTMAX_MAX = __INT64_C(@import("std").meta.promoteIntLiteral(c_int, 9223372036854775807, .decimal)); pub const UINTMAX_MAX = __UINT64_C(@import("std").meta.promoteIntLiteral(c_int, 18446744073709551615, .decimal)); pub const PTRDIFF_MIN = -@import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal) - @as(c_int, 1); pub const PTRDIFF_MAX = @import("std").meta.promoteIntLiteral(c_long, 9223372036854775807, .decimal); pub const SIG_ATOMIC_MIN = -@import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal) - @as(c_int, 1); pub const SIG_ATOMIC_MAX = @import("std").meta.promoteIntLiteral(c_int, 2147483647, .decimal); pub const SIZE_MAX = @import("std").meta.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); pub const WCHAR_MIN = __WCHAR_MIN; pub const WCHAR_MAX = __WCHAR_MAX; pub const WINT_MIN = @as(c_uint, 0); pub const WINT_MAX = @import("std").meta.promoteIntLiteral(c_uint, 4294967295, .decimal); pub inline fn INT8_C(c: anytype) @TypeOf(c) { return c; } pub inline fn INT16_C(c: anytype) @TypeOf(c) { return c; } pub inline fn INT32_C(c: anytype) @TypeOf(c) { return c; } pub inline fn UINT8_C(c: anytype) @TypeOf(c) { return c; } pub inline fn UINT16_C(c: anytype) @TypeOf(c) { return c; } pub const ROARING_CONTAINER_T = c_void; pub const MAX_CONTAINERS = @import("std").meta.promoteIntLiteral(c_int, 65536, .decimal); pub const SERIALIZATION_ARRAY_UINT32 = @as(c_int, 1); pub const SERIALIZATION_CONTAINER = @as(c_int, 2); pub const ROARING_FLAG_COW = UINT8_C(@as(c_int, 0x1)); pub const ROARING_FLAG_FROZEN = UINT8_C(@as(c_int, 0x2)); pub const NULL = @import("std").meta.cast(?*c_void, @as(c_int, 0)); pub const roaring_array_s = struct_roaring_array_s; pub const roaring_statistics_s = struct_roaring_statistics_s; pub const roaring_bitmap_s = struct_roaring_bitmap_s; pub const roaring_uint32_iterator_s = struct_roaring_uint32_iterator_s;
src/zig-cache/o/f4687eedd2a239469f6160be2c4a4703/cimport.zig
const std = @import("std"); const zwl = @import("zwl"); const Platform = zwl.Platform(.{ .single_window = true, .backends_enabled = .{ .software = true, .opengl = false, .vulkan = false, }, .remote = true, .platforms_enabled = .{ .wayland = (std.builtin.os.tag != .windows), }, }); var stripes: [32][4]u8 = undefined; var logo: [70][200][4]u8 = undefined; pub const log_level = .info; pub fn main() !void { var platform = try Platform.init(std.heap.page_allocator, .{}); defer platform.deinit(); // init logo, stripes var seed_bytes: [@sizeOf(u64)]u8 = undefined; std.crypto.random.bytes(seed_bytes[0..]); var rng = std.rand.DefaultPrng.init(std.mem.readIntNative(u64, &seed_bytes)); for (stripes) |*stripe| { stripe.* = .{ @as(u8, rng.random.int(u6)) + 191, @as(u8, rng.random.int(u6)) + 191, @as(u8, rng.random.int(u6)) + 191, 0 }; } _ = try std.fs.cwd().readFile("logo.bgra", std.mem.asBytes(&logo)); var window = try platform.createWindow(.{ .title = "Softlogo", .width = 512, .height = 512, .resizeable = false, .visible = true, .decorations = true, .track_damage = false, .backend = .software, }); defer window.deinit(); { var pixbuf = try window.mapPixels(); paint(pixbuf); const updates = [_]zwl.UpdateArea{.{ .x = 0, .y = 0, .w = 128, .h = 128 }}; try window.submitPixels(&updates); } while (true) { const event = try platform.waitForEvent(); switch (event) { .WindowVBlank => |win| { var pixbuf = try win.mapPixels(); paint(pixbuf); const updates = [_]zwl.UpdateArea{.{ .x = 0, .y = 0, .w = pixbuf.width, .h = pixbuf.height }}; try win.submitPixels(&updates); }, .WindowResized => |win| { const size = win.getSize(); std.log.info("Window resized: {}x{}", .{ size[0], size[1] }); }, .WindowDestroyed => |win| { std.log.info("Window destroyed", .{}); return; }, .ApplicationTerminated => { // Can only happen on Windows return; }, else => {}, } } } fn paint(pixbuf: zwl.PixelBuffer) void { const ts = std.time.milliTimestamp(); const tsf = @intToFloat(f32, @intCast(usize, ts) % (60 * 1000000)); var y: usize = 0; while (y < pixbuf.height) : (y += 1) { var x: usize = 0; while (x < pixbuf.width) : (x += 1) { const fp = @intToFloat(f32, x * 2 + y / 2) * 0.01 + tsf * 0.005; const background = stripes[@floatToInt(u32, fp) % stripes.len]; const mid = [2]i32{ pixbuf.width >> 1, pixbuf.height >> 1 }; if (x < mid[0] - 100 or x >= mid[0] + 100 or y < mid[1] - 35 or y >= mid[1] + 35) { pixbuf.data[y * pixbuf.width + x] = @bitCast(u32, background); } else { const tx = @intCast(usize, @intCast(isize, x) - (mid[0] - 100)); const ty = @intCast(usize, @intCast(isize, y) - (mid[1] - 35)); const pix = logo[ty][tx]; const B = @intCast(u16, pix[0]) * pix[3] + @intCast(u16, background[0]) * (255 - pix[3]); const G = @intCast(u16, pix[1]) * pix[3] + @intCast(u16, background[1]) * (255 - pix[3]); const R = @intCast(u16, pix[2]) * pix[3] + @intCast(u16, background[2]) * (255 - pix[3]); pixbuf.data[y * pixbuf.width + x] = @bitCast(u32, [4]u8{ @intCast(u8, B >> 8), @intCast(u8, G >> 8), @intCast(u8, R >> 8), 0 }); } } } }
didot-zwl/zwl/examples/softlogo.zig
const std = @import("std"); const testing = std.testing; const meta = std.meta; const assert = std.debug.assert; const Allocator = std.mem.Allocator; pub const ReadVarNumError = error{ TooManyBytes, }; // https://wiki.vg/Protocol#VarInt_and_VarLong pub fn readVarNum(comptime T: type, reader: anytype, read_length: ?*u16) !T { if (@typeInfo(T) != .Int) { @compileError("readVarNum expects an integer type"); } else if (meta.bitCount(T) < 8) { @compileError("readVarNum expects a byte or larger"); } const max_bytes = (@sizeOf(T) * 5) / 4; var value: T = 0; var len: std.math.Log2Int(T) = 0; while (true) { // could this be inlined? const read_byte = try reader.readByte(); value |= @as(T, read_byte & 0b01111111) << (len * 7); len += 1; if (len > max_bytes) { return ReadVarNumError.TooManyBytes; } if ((read_byte & 0b10000000) != 0b10000000) { break; } } if (read_length) |ptr| { ptr.* = @intCast(u16, len); } return value; } pub fn writeVarNum(comptime T: type, writer: anytype, value: T, write_length: ?*u16) !void { if (@typeInfo(T) != .Int) { @compileError("writeVarNum expects an integer type"); } var remaining = @bitCast(meta.Int(.unsigned, @typeInfo(T).Int.bits), value); var len: u16 = 0; while (true) { const next_data = @truncate(u8, remaining) & 0b01111111; remaining = remaining >> 7; try writer.writeByte(if (remaining > 0) next_data | 0b10000000 else next_data); len += 1; if (remaining == 0) { break; } } if (write_length) |ptr| { ptr.* = len; } } pub const VarNumTestCases = .{ .{ .T = i32, .r = 0, .v = .{0x00} }, .{ .T = i32, .r = 1, .v = .{0x01} }, .{ .T = i32, .r = 2, .v = .{0x02} }, .{ .T = i32, .r = 127, .v = .{0x7f} }, .{ .T = i32, .r = 128, .v = .{ 0x80, 0x01 } }, .{ .T = i32, .r = 255, .v = .{ 0xff, 0x01 } }, .{ .T = i32, .r = 25565, .v = .{ 0xdd, 0xc7, 0x01 } }, .{ .T = i32, .r = 2097151, .v = .{ 0xff, 0xff, 0x7f } }, .{ .T = i32, .r = 2147483647, .v = .{ 0xff, 0xff, 0xff, 0xff, 0x07 } }, .{ .T = i32, .r = -1, .v = .{ 0xff, 0xff, 0xff, 0xff, 0x0f } }, .{ .T = i32, .r = -2147483648, .v = .{ 0x80, 0x80, 0x80, 0x80, 0x08 } }, .{ .T = i64, .r = 2147483647, .v = .{ 0xff, 0xff, 0xff, 0xff, 0x07 } }, .{ .T = i64, .r = -1, .v = .{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01 } }, .{ .T = i64, .r = -2147483648, .v = .{ 0x80, 0x80, 0x80, 0x80, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x01 } }, .{ .T = i64, .r = 9223372036854775807, .v = .{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f } }, .{ .T = i64, .r = -9223372036854775808, .v = .{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01 } }, }; test "read var num" { inline for (VarNumTestCases) |pair| { const buf: [pair.v.len]u8 = pair.v; var reader = std.io.fixedBufferStream(&buf); try testing.expectEqual(@intCast(pair.T, pair.r), try readVarNum(pair.T, reader.reader(), null)); } } test "write var num" { inline for (VarNumTestCases) |pair| { var wrote = std.ArrayList(u8).init(testing.allocator); defer wrote.deinit(); try writeVarNum(pair.T, wrote.writer(), @intCast(pair.T, pair.r), null); const buf: [pair.v.len]u8 = pair.v; try testing.expect(std.mem.eql(u8, &buf, wrote.items)); } } pub fn VarNum(comptime T: type) type { assert(@typeInfo(T) == .Int); return struct { pub const UserType = T; pub fn write(self: anytype, writer: anytype) !void { try writeVarNum(T, writer, @as(UserType, self), null); } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { _ = alloc; return readVarNum(T, reader, null); } pub fn deinit(self: UserType, alloc: Allocator) void { _ = self; _ = alloc; } pub fn size(self: anytype) usize { var temp_val = @as(UserType, self); var total_size: usize = 0; while (true) { total_size += 1; temp_val = temp_val >> 7; if (temp_val == 0) { break; } } return total_size; } }; }
src/varnum.zig
const c = @import("c.zig"); const nk = @import("../nuklear.zig"); const std = @import("std"); const builtin = std.builtin; const debug = std.debug; const heap = std.heap; const math = std.math; const mem = std.mem; const meta = std.meta; const testing = std.testing; pub const Format = c.nk_layout_format; pub fn resetMinRowHeight(ctx: *nk.Context) void { c.nk_layout_reset_min_row_height(ctx); } // pub fn widgetBounds(ctx: *nk.Context) nk.Rect { // const res = c.nk_layout_widget_bounds(ctx); // return nk.Rect.fromNuklear(&res).*; // } pub fn ratioFromPixel(ctx: *nk.Context, pixel_width: f32) f32 { return c.nk_layout_ratio_from_pixel(ctx, pixel_width); } pub fn rowDynamic(ctx: *nk.Context, height: f32, cols: usize) void { c.nk_layout_row_dynamic(ctx, height, @intCast(c_int, cols)); } pub fn rowStatic(ctx: *nk.Context, height: f32, item_width: usize, cols: usize) void { c.nk_layout_row_static(ctx, height, @intCast(c_int, item_width), @intCast(c_int, cols)); } pub fn rowBegin(ctx: *nk.Context, format: Format, row_height: f32, cols: usize) void { c.nk_layout_row_begin(ctx, format, row_height, @intCast(c_int, cols)); } pub fn rowPush(ctx: *nk.Context, value: f32) void { c.nk_layout_row_push(ctx, value); } pub fn rowEnd(ctx: *nk.Context) void { c.nk_layout_row_end(ctx); } pub fn row(ctx: *nk.Context, format: Format, height: f32, ratios: []const f32) void { c.nk_layout_row(ctx, format, height, @intCast(c_int, ratios.len), ratios.ptr); } pub fn rowTemplateBegin(ctx: *nk.Context, row_height: f32) void { c.nk_layout_row_template_begin(ctx, row_height); } pub fn rowTemplatePushDynamic(ctx: *nk.Context) void { c.nk_layout_row_template_push_dynamic(ctx); } pub fn rowTemplatePushVariable(ctx: *nk.Context, min_width: f32) void { c.nk_layout_row_template_push_variable(ctx, min_width); } pub fn rowTemplatePushStatic(ctx: *nk.Context, width: f32) void { c.nk_layout_row_template_push_static(ctx, width); } pub fn rowTemplateEnd(ctx: *nk.Context) void { c.nk_layout_row_template_end(ctx); } pub fn spaceBegin(ctx: *nk.Context, format: Format, height: f32, widget_count: usize) void { const count = @intCast(c_int, math.max(widget_count, math.maxInt(c_int))); c.nk_layout_space_begin(ctx, format, height, count); } pub fn spacePush(ctx: *nk.Context, bounds: nk.Rect) void { c.nk_layout_space_push(ctx, bounds); } pub fn spaceEnd(ctx: *nk.Context) void { c.nk_layout_space_end(ctx); } // pub fn spaceBounds(ctx: *nk.Context) nk.Rect { // const res = c.nk_layout_space_bounds(ctx); // return nk.Rect.fromNuklear(&res).*; // } // pub fn spaceToScreen(ctx: *nk.Context, ret: Vec2) Vec2 { // const res = c.nk_layout_space_to_screen(ctx, ret); // return Vec2.fromNuklear(&res).*; // } // pub fn spaceToLocal(ctx: *nk.Context, ret: Vec2) Vec2 { // const res = c.nk_layout_space_to_local(ctx, ret); // return Vec2.fromNuklear(&res).*; // } // pub fn spaceRectToScreen(ctx: *nk.Context, ret: nk.Rect) nk.Rect { // const res = c.nk_layout_space_rect_to_screen(ctx, ret); // return nk.Rect.fromNuklear(&res).*; // } // pub fn spaceRectToLocal(ctx: *nk.Context, ret: nk.Rect) nk.Rect { // const res = c.nk_layout_space_rect_to_local(ctx, ret); // return nk.Rect.fromNuklear(&res).*; // } test { testing.refAllDecls(@This()); }
src/layout.zig
const std = @import("std"); const stb_image = @import("vendored/stb_image/build.zig"); const zmesh = @import("vendored/zmesh/build.zig"); pub const pkg = std.build.Pkg{ .name = "brucelib.graphics", .path = .{ .path = thisDir() ++ "/src/main.zig" }, .dependencies = &.{ std.build.Pkg{ .name = "zwin32", .path = .{ .path = thisDir() ++ "/vendored/zwin32/src/zwin32.zig" }, }, std.build.Pkg{ .name = "zmath", .path = .{ .path = thisDir() ++ "/vendored/zmath/zmath.zig" }, }, std.build.Pkg{ .name = "zig-opengl", .path = .{ .path = thisDir() ++ "/vendored/zig-opengl-exports/gl_4v4.zig" }, }, stb_image.pkg, zmesh.pkg, }, }; pub fn build(b: *std.build.Builder) void { const build_mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); const tests = buildTests(b, build_mode, target); const test_step = b.step("test", "Run tests"); test_step.dependOn(&tests.step); } pub fn buildTests( b: *std.build.Builder, build_mode: std.builtin.Mode, target: std.zig.CrossTarget, ) *std.build.LibExeObjStep { const tests = b.addTest(pkg.path.path); tests.setBuildMode(build_mode); tests.setTarget(target); for (pkg.dependencies.?) |dep| tests.addPackage(dep); buildAndLink(tests); return tests; } pub fn buildAndLink(obj: *std.build.LibExeObjStep) void { const lib = obj.builder.addStaticLibrary(pkg.name, pkg.path.path); lib.setBuildMode(obj.build_mode); lib.setTarget(obj.target); lib.linkLibC(); if (lib.target.isLinux()) { lib.linkSystemLibrary("GL"); } else if (lib.target.isDarwin()) { lib.linkFramework("OpenGL"); lib.linkFramework("MetalKit"); } else if (lib.target.isWindows()) { lib.linkSystemLibrary("d3d11"); lib.linkSystemLibrary("dxgi"); lib.linkSystemLibrary("D3DCompiler_47"); } else { std.debug.panic("Unsupported target!", .{}); } obj.addIncludeDir(stb_image.include_dir); zmesh.link(obj); for (pkg.dependencies.?) |dep| { lib.addPackage(dep); } lib.install(); obj.linkLibrary(lib); } fn thisDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; }
modules/graphics/build.zig
const std = @import("std"); const alka = @import("alka"); const m = alka.math; usingnamespace alka.log; pub const mlog = std.log.scoped(.app); pub const log_level: std.log.Level = .info; const vertex_shader = \\#version 330 core \\layout (location = 0) in vec2 aPos; \\layout (location = 1) in vec2 aTexCoord; \\layout (location = 2) in vec4 aColour; \\ \\out vec2 ourTexCoord; \\out vec4 ourColour; \\uniform mat4 view; \\ \\void main() { \\ gl_Position = view * vec4(aPos.xy, 0.0, 1.0); \\ ourTexCoord = aTexCoord; \\ ourColour = aColour; \\} ; const fragment_shader = \\#version 330 core \\out vec4 final; \\in vec2 ourTexCoord; \\in vec4 ourColour; \\uniform sampler2D uTexture; \\ \\void main() { \\ vec4 texelColour = texture(uTexture, ourTexCoord); \\ final = vec4(1, 0, 0, 1) * texelColour; // everything is red \\} ; fn draw() !void { // push the shader // id try alka.pushShader(1); const r = m.Rectangle{ .position = m.Vec2f{ .x = 100.0, .y = 200.0 }, .size = m.Vec2f{ .x = 50.0, .y = 50.0 } }; const col = alka.Colour{ .r = 1, .g = 1, .b = 1, .a = 1 }; //try alka.drawRectangleAdv(r, m.Vec2f{ .x = 25, .y = 25 }, m.deg2radf(45), col); try alka.drawRectangleLinesAdv(r, m.Vec2f{ .x = 25, .y = 25 }, m.deg2radf(125), col); const r2 = m.Rectangle{ .position = m.Vec2f{ .x = 200.0, .y = 200.0 }, .size = m.Vec2f{ .x = 30.0, .y = 30.0 } }; const col2 = alka.Colour.rgba(30, 80, 200, 255); //try alka.drawRectangle(r2, col2); try alka.drawRectangleLines(r2, col2); // pops the pushed shader alka.popShader(); // position, radius, colour // segment count is 16 by default //try alka.drawCircleLines(m.Vec2f{ .x = 350, .y = 260 }, 24, col); //try alka.drawCircle(m.Vec2f{ .x = 450, .y = 260 }, 24, col); // position, radius, segment count, startangle, endangle, colour try alka.drawCircleLinesAdv(m.Vec2f{ .x = 350, .y = 260 }, 24, 8, 0, 360, col); try alka.drawCircleLinesAdv(m.Vec2f{ .x = 350, .y = 360 }, 24, 32, 0, 360, col); try alka.drawCircleAdv(m.Vec2f{ .x = 450, .y = 260 }, 24, 32, 0, 360, col); try alka.drawCircleAdv(m.Vec2f{ .x = 450, .y = 360 }, 24, 8, 0, 360, col); // start, end, thickness, colour try alka.drawLine(m.Vec2f{ .x = 300, .y = 300 }, m.Vec2f{ .x = 400, .y = 350 }, 1, col); var i: f32 = 0; while (i < 10) : (i += 2) { try alka.drawPixel(m.Vec2f{ .x = 300 + i, .y = 400 }, col); } } pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const callbacks = alka.Callbacks{ .update = null, .fixed = null, .draw = draw, .resize = null, .close = null, }; try alka.init(&gpa.allocator, callbacks, 1024, 768, "Custom Shaders", 0, false); try alka.getAssetManager().loadShader(1, vertex_shader, fragment_shader); try alka.open(); try alka.update(); try alka.close(); try alka.deinit(); const leaked = gpa.deinit(); if (leaked) return error.Leak; }
examples/customshaders.zig
const std = @import("std"); const json = std.json; // JSON Types pub const String = []const u8; pub const Integer = i64; pub const Float = f64; pub const Bool = bool; pub const Array = json.Array; pub const Object = json.ObjectMap; // pub const Any = @TypeOf(var); // Basic structures pub const DocumentUri = String; pub const Position = struct { line: Integer, character: Integer }; pub const Range = struct { start: Position, end: Position }; pub const Location = struct { uri: DocumentUri, range: Range }; /// Id of a request pub const RequestId = union(enum) { String: String, Integer: Integer, Float: Float, }; /// Params of a request pub const RequestParams = union(enum) { }; pub const NotificationParams = union(enum) { LogMessageParams: LogMessageParams, PublishDiagnosticsParams: PublishDiagnosticsParams }; /// Params of a response (result) pub const ResponseParams = union(enum) { CompletionList: CompletionList }; /// JSONRPC error pub const Error = struct { code: Integer, message: String, data: String, }; /// JSONRPC request pub const Request = struct { jsonrpc: String = "2.0", method: String, id: ?RequestId = RequestId{.Integer = 0}, params: RequestParams }; /// JSONRPC notifications pub const Notification = struct { jsonrpc: String = "2.0", method: String, params: NotificationParams }; /// JSONRPC response pub const Response = struct { jsonrpc: String = "2.0", @"error": ?Error = null, id: RequestId, result: ResponseParams, }; /// Type of a debug message pub const MessageType = enum(Integer) { Error = 1, Warning = 2, Info = 3, Log = 4, pub fn jsonStringify( value: MessageType, options: json.StringifyOptions, out_stream: var, ) !void { try json.stringify(@enumToInt(value), options, out_stream); } }; /// Params for a LogMessage Notification (window/logMessage) pub const LogMessageParams = struct { @"type": MessageType, message: String }; pub const DiagnosticSeverity = enum(Integer) { Error = 1, Warning = 2, Information = 3, Hint = 4, pub fn jsonStringify( value: DiagnosticSeverity, options: json.StringifyOptions, out_stream: var, ) !void { try json.stringify(@enumToInt(value), options, out_stream); } }; pub const Diagnostic = struct { range: Range, severity: DiagnosticSeverity, code: String, source: String, message: String, }; pub const PublishDiagnosticsParams = struct { uri: DocumentUri, diagnostics: []Diagnostic }; pub const TextDocument = struct { uri: DocumentUri, // This is a substring of mem starting at 0 text: String, // This holds the memory that we have actually allocated. mem: []u8, sane_text: ?String = null, pub fn positionToIndex(self: TextDocument, position: Position) !usize { var split_iterator = std.mem.split(self.text, "\n"); var line: i64 = 0; while (line < position.line) : (line += 1) { _ = split_iterator.next() orelse return error.InvalidParams; } var index = @intCast(i64, split_iterator.index.?) + position.character; if (index < 0 or index >= @intCast(i64, self.text.len)) { return error.InvalidParams; } return @intCast(usize, index); } pub fn getLine(self: TextDocument, target_line: usize) ![]const u8 { var split_iterator = std.mem.split(self.text, "\n"); var line: i64 = 0; while (line < target_line) : (line += 1) { _ = split_iterator.next() orelse return error.InvalidParams; } if (split_iterator.next()) |next| { return next; } else return error.InvalidParams; } }; pub const TextEdit = struct { range: Range, newText: String, }; pub const MarkupKind = enum(u1) { PlainText = 0, // plaintext Markdown = 1, // markdown pub fn jsonStringify( value: MarkupKind, options: json.StringifyOptions, out_stream: var, ) !void { if (@enumToInt(value) == 0) { try json.stringify("plaintext", options, out_stream); } else { try json.stringify("markdown", options, out_stream); } } }; pub const MarkupContent = struct { kind: MarkupKind = MarkupKind.Markdown, value: String }; // pub const TextDocumentIdentifier = struct { // uri: DocumentUri, // }; // pub const CompletionTriggerKind = enum(Integer) { // Invoked = 1, // TriggerCharacter = 2, // TriggerForIncompleteCompletions = 3, // pub fn jsonStringify( // value: CompletionTriggerKind, // options: json.StringifyOptions, // out_stream: var, // ) !void { // try json.stringify(@enumToInt(value), options, out_stream); // } // }; pub const CompletionList = struct { isIncomplete: Bool, items: []const CompletionItem, }; pub const CompletionItemKind = enum(Integer) { Text = 1, Method = 2, Function = 3, Constructor = 4, Field = 5, Variable = 6, Class = 7, Interface = 8, Module = 9, Property = 10, Unit = 11, Value = 12, Enum = 13, Keyword = 14, Snippet = 15, Color = 16, File = 17, Reference = 18, Folder = 19, EnumMember = 20, Constant = 21, Struct = 22, Event = 23, Operator = 24, TypeParameter = 25, pub fn jsonStringify( value: CompletionItemKind, options: json.StringifyOptions, out_stream: var, ) !void { try json.stringify(@enumToInt(value), options, out_stream); } }; pub const InsertTextFormat = enum(Integer) { PlainText = 1, Snippet = 2, pub fn jsonStringify( value: InsertTextFormat, options: json.StringifyOptions, out_stream: var, ) !void { try json.stringify(@enumToInt(value), options, out_stream); } }; pub const CompletionItem = struct { label: String, kind: CompletionItemKind, textEdit: ?TextEdit = null, filterText: ?String = null, insertText: ?String = null, insertTextFormat: ?InsertTextFormat = InsertTextFormat.PlainText, detail: ?String = null, documentation: ?MarkupContent = null // filterText: String = .NotDefined, };
src/types.zig
const std = @import("std"); const crypto = std.crypto; const aes = crypto.core.aes; const assert = std.debug.assert; const math = std.math; const mem = std.mem; const AuthenticationError = crypto.errors.AuthenticationError; pub const Aes128Ocb = AesOcb(aes.Aes128); pub const Aes256Ocb = AesOcb(aes.Aes256); const Block = [16]u8; /// AES-OCB (RFC 7253 - https://competitions.cr.yp.to/round3/ocbv11.pdf) fn AesOcb(comptime Aes: anytype) type { const EncryptCtx = aes.AesEncryptCtx(Aes); const DecryptCtx = aes.AesDecryptCtx(Aes); return struct { pub const key_length = Aes.key_bits / 8; pub const nonce_length: usize = 12; pub const tag_length: usize = 16; const Lx = struct { star: Block align(16), dol: Block align(16), table: [56]Block align(16) = undefined, upto: usize, fn double(l: Block) callconv(.Inline) Block { const l_ = mem.readIntBig(u128, &l); const l_2 = (l_ << 1) ^ (0x87 & -%(l_ >> 127)); var l2: Block = undefined; mem.writeIntBig(u128, &l2, l_2); return l2; } fn precomp(lx: *Lx, upto: usize) []const Block { const table = &lx.table; assert(upto < table.len); var i = lx.upto; while (i + 1 <= upto) : (i += 1) { table[i + 1] = double(table[i]); } lx.upto = upto; return lx.table[0 .. upto + 1]; } fn init(aes_enc_ctx: EncryptCtx) Lx { const zeros = [_]u8{0} ** 16; var star: Block = undefined; aes_enc_ctx.encrypt(&star, &zeros); const dol = double(star); var lx = Lx{ .star = star, .dol = dol, .upto = 0 }; lx.table[0] = double(dol); return lx; } }; fn hash(aes_enc_ctx: EncryptCtx, lx: *Lx, a: []const u8) Block { const full_blocks: usize = a.len / 16; const x_max = if (full_blocks > 0) math.log2_int(usize, full_blocks) else 0; const lt = lx.precomp(x_max); var sum = [_]u8{0} ** 16; var offset = [_]u8{0} ** 16; var i: usize = 0; while (i < full_blocks) : (i += 1) { xorWith(&offset, lt[@ctz(usize, i + 1)]); var e = xorBlocks(offset, a[i * 16 ..][0..16].*); aes_enc_ctx.encrypt(&e, &e); xorWith(&sum, e); } const leftover = a.len % 16; if (leftover > 0) { xorWith(&offset, lx.star); var padded = [_]u8{0} ** 16; mem.copy(u8, padded[0..leftover], a[i * 16 ..][0..leftover]); padded[leftover] = 1; var e = xorBlocks(offset, padded); aes_enc_ctx.encrypt(&e, &e); xorWith(&sum, e); } return sum; } fn getOffset(aes_enc_ctx: EncryptCtx, npub: [nonce_length]u8) Block { var nx = [_]u8{0} ** 16; nx[0] = @intCast(u8, @truncate(u7, tag_length * 8) << 1); nx[16 - nonce_length - 1] = 1; mem.copy(u8, nx[16 - nonce_length ..], &npub); const bottom = @truncate(u6, nx[15]); nx[15] &= 0xc0; var ktop_: Block = undefined; aes_enc_ctx.encrypt(&ktop_, &nx); const ktop = mem.readIntBig(u128, &ktop_); var stretch = (@as(u192, ktop) << 64) | @as(u192, @truncate(u64, ktop >> 64) ^ @truncate(u64, ktop >> 56)); var offset: Block = undefined; mem.writeIntBig(u128, &offset, @truncate(u128, stretch >> (64 - @as(u7, bottom)))); return offset; } const has_aesni = std.Target.x86.featureSetHas(std.Target.current.cpu.features, .aes); const has_armaes = std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes); const wb: usize = if ((std.Target.current.cpu.arch == .x86_64 and has_aesni) or (std.Target.current.cpu.arch == .aarch64 and has_armaes)) 4 else 0; /// c: ciphertext: output buffer should be of size m.len /// tag: authentication tag: output MAC /// m: message /// ad: Associated Data /// npub: public nonce /// k: secret key pub fn encrypt(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const u8, npub: [nonce_length]u8, key: [key_length]u8) void { assert(c.len == m.len); const aes_enc_ctx = Aes.initEnc(key); const full_blocks: usize = m.len / 16; const x_max = if (full_blocks > 0) math.log2_int(usize, full_blocks) else 0; var lx = Lx.init(aes_enc_ctx); const lt = lx.precomp(x_max); var offset = getOffset(aes_enc_ctx, npub); var sum = [_]u8{0} ** 16; var i: usize = 0; while (wb > 0 and i + wb <= full_blocks) : (i += wb) { var offsets: [wb]Block align(16) = undefined; var es: [16 * wb]u8 align(16) = undefined; var j: usize = 0; while (j < wb) : (j += 1) { xorWith(&offset, lt[@ctz(usize, i + 1 + j)]); offsets[j] = offset; const p = m[(i + j) * 16 ..][0..16].*; mem.copy(u8, es[j * 16 ..][0..16], &xorBlocks(p, offsets[j])); xorWith(&sum, p); } aes_enc_ctx.encryptWide(wb, &es, &es); j = 0; while (j < wb) : (j += 1) { const e = es[j * 16 ..][0..16].*; mem.copy(u8, c[(i + j) * 16 ..][0..16], &xorBlocks(e, offsets[j])); } } while (i < full_blocks) : (i += 1) { xorWith(&offset, lt[@ctz(usize, i + 1)]); const p = m[i * 16 ..][0..16].*; var e = xorBlocks(p, offset); aes_enc_ctx.encrypt(&e, &e); mem.copy(u8, c[i * 16 ..][0..16], &xorBlocks(e, offset)); xorWith(&sum, p); } const leftover = m.len % 16; if (leftover > 0) { xorWith(&offset, lx.star); var pad = offset; aes_enc_ctx.encrypt(&pad, &pad); for (m[i * 16 ..]) |x, j| { c[i * 16 + j] = pad[j] ^ x; } var e = [_]u8{0} ** 16; mem.copy(u8, e[0..leftover], m[i * 16 ..][0..leftover]); e[leftover] = 0x80; xorWith(&sum, e); } var e = xorBlocks(xorBlocks(sum, offset), lx.dol); aes_enc_ctx.encrypt(&e, &e); tag.* = xorBlocks(e, hash(aes_enc_ctx, &lx, ad)); } /// m: message: output buffer should be of size c.len /// c: ciphertext /// tag: authentication tag /// ad: Associated Data /// npub: public nonce /// k: secret key pub fn decrypt(m: []u8, c: []const u8, tag: [tag_length]u8, ad: []const u8, npub: [nonce_length]u8, key: [key_length]u8) AuthenticationError!void { assert(c.len == m.len); const aes_enc_ctx = Aes.initEnc(key); const aes_dec_ctx = DecryptCtx.initFromEnc(aes_enc_ctx); const full_blocks: usize = m.len / 16; const x_max = if (full_blocks > 0) math.log2_int(usize, full_blocks) else 0; var lx = Lx.init(aes_enc_ctx); const lt = lx.precomp(x_max); var offset = getOffset(aes_enc_ctx, npub); var sum = [_]u8{0} ** 16; var i: usize = 0; while (wb > 0 and i + wb <= full_blocks) : (i += wb) { var offsets: [wb]Block align(16) = undefined; var es: [16 * wb]u8 align(16) = undefined; var j: usize = 0; while (j < wb) : (j += 1) { xorWith(&offset, lt[@ctz(usize, i + 1 + j)]); offsets[j] = offset; const q = c[(i + j) * 16 ..][0..16].*; mem.copy(u8, es[j * 16 ..][0..16], &xorBlocks(q, offsets[j])); } aes_dec_ctx.decryptWide(wb, &es, &es); j = 0; while (j < wb) : (j += 1) { const p = xorBlocks(es[j * 16 ..][0..16].*, offsets[j]); mem.copy(u8, m[(i + j) * 16 ..][0..16], &p); xorWith(&sum, p); } } while (i < full_blocks) : (i += 1) { xorWith(&offset, lt[@ctz(usize, i + 1)]); const q = c[i * 16 ..][0..16].*; var e = xorBlocks(q, offset); aes_dec_ctx.decrypt(&e, &e); const p = xorBlocks(e, offset); mem.copy(u8, m[i * 16 ..][0..16], &p); xorWith(&sum, p); } const leftover = m.len % 16; if (leftover > 0) { xorWith(&offset, lx.star); var pad = offset; aes_enc_ctx.encrypt(&pad, &pad); for (c[i * 16 ..]) |x, j| { m[i * 16 + j] = pad[j] ^ x; } var e = [_]u8{0} ** 16; mem.copy(u8, e[0..leftover], m[i * 16 ..][0..leftover]); e[leftover] = 0x80; xorWith(&sum, e); } var e = xorBlocks(xorBlocks(sum, offset), lx.dol); aes_enc_ctx.encrypt(&e, &e); var computed_tag = xorBlocks(e, hash(aes_enc_ctx, &lx, ad)); const verify = crypto.utils.timingSafeEql([tag_length]u8, computed_tag, tag); crypto.utils.secureZero(u8, &computed_tag); if (!verify) { return error.AuthenticationFailed; } } }; } fn xorBlocks(x: Block, y: Block) callconv(.Inline) Block { var z: Block = x; for (z) |*v, i| { v.* = x[i] ^ y[i]; } return z; } fn xorWith(x: *Block, y: Block) callconv(.Inline) void { for (x) |*v, i| { v.* ^= y[i]; } } const hexToBytes = std.fmt.hexToBytes; test "AesOcb test vector 1" { var k: [Aes128Ocb.key_length]u8 = undefined; var nonce: [Aes128Ocb.nonce_length]u8 = undefined; var tag: [Aes128Ocb.tag_length]u8 = undefined; _ = try hexToBytes(&k, "000102030405060708090A0B0C0D0E0F"); _ = try hexToBytes(&nonce, "BBAA99887766554433221100"); var c: [0]u8 = undefined; Aes128Ocb.encrypt(&c, &tag, "", "", nonce, k); var expected_c: [c.len]u8 = undefined; var expected_tag: [tag.len]u8 = undefined; _ = try hexToBytes(&expected_tag, "785407BFFFC8AD9EDCC5520AC9111EE6"); var m: [0]u8 = undefined; try Aes128Ocb.decrypt(&m, "", tag, "", nonce, k); } test "AesOcb test vector 2" { var k: [Aes128Ocb.key_length]u8 = undefined; var nonce: [Aes128Ocb.nonce_length]u8 = undefined; var tag: [Aes128Ocb.tag_length]u8 = undefined; var ad: [40]u8 = undefined; _ = try hexToBytes(&k, "000102030405060708090A0B0C0D0E0F"); _ = try hexToBytes(&ad, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627"); _ = try hexToBytes(&nonce, "BBAA9988776655443322110E"); var c: [0]u8 = undefined; Aes128Ocb.encrypt(&c, &tag, "", &ad, nonce, k); var expected_tag: [tag.len]u8 = undefined; _ = try hexToBytes(&expected_tag, "C5CD9D1850C141E358649994EE701B68"); var m: [0]u8 = undefined; try Aes128Ocb.decrypt(&m, &c, tag, &ad, nonce, k); } test "AesOcb test vector 3" { var k: [Aes128Ocb.key_length]u8 = undefined; var nonce: [Aes128Ocb.nonce_length]u8 = undefined; var tag: [Aes128Ocb.tag_length]u8 = undefined; var m: [40]u8 = undefined; var c: [m.len]u8 = undefined; _ = try hexToBytes(&k, "000102030405060708090A0B0C0D0E0F"); _ = try hexToBytes(&m, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627"); _ = try hexToBytes(&nonce, "BBAA9988776655443322110F"); Aes128Ocb.encrypt(&c, &tag, &m, "", nonce, k); var expected_c: [c.len]u8 = undefined; var expected_tag: [tag.len]u8 = undefined; _ = try hexToBytes(&expected_tag, "479AD363AC366B95A98CA5F3000B1479"); _ = try hexToBytes(&expected_c, "4412923493C57D5DE0D700F753CCE0D1D2D95060122E9F15A5DDBFC5787E50B5CC55EE507BCB084E"); var m2: [m.len]u8 = undefined; try Aes128Ocb.decrypt(&m2, &c, tag, "", nonce, k); assert(mem.eql(u8, &m, &m2)); } test "AesOcb test vector 4" { var k: [Aes128Ocb.key_length]u8 = undefined; var nonce: [Aes128Ocb.nonce_length]u8 = undefined; var tag: [Aes128Ocb.tag_length]u8 = undefined; var m: [40]u8 = undefined; var ad = m; var c: [m.len]u8 = undefined; _ = try hexToBytes(&k, "000102030405060708090A0B0C0D0E0F"); _ = try hexToBytes(&m, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627"); _ = try hexToBytes(&nonce, "BBAA99887766554433221104"); Aes128Ocb.encrypt(&c, &tag, &m, &ad, nonce, k); var expected_c: [c.len]u8 = undefined; var expected_tag: [tag.len]u8 = undefined; _ = try hexToBytes(&expected_tag, "3AD7A4FF3835B8C5701C1CCEC8FC3358"); _ = try hexToBytes(&expected_c, "571D535B60B277188BE5147170A9A22C"); var m2: [m.len]u8 = undefined; try Aes128Ocb.decrypt(&m2, &c, tag, &ad, nonce, k); assert(mem.eql(u8, &m, &m2)); }
lib/std/crypto/aes_ocb.zig
const std = @import("std"); const graphics = @import("didot-graphics"); const Allocator = std.mem.Allocator; pub const AssetType = enum(u8) { Mesh, Texture, Shader }; pub const Asset = struct { /// Pointer to object objectPtr: usize = 0, objectAllocator: ?*Allocator = null, /// If the function is null, the asset is already loaded. /// Otherwise this method must called, objectPtr must be set to the function result /// and must have been allocated on the given Allocator (or duped if not). /// That internal behaviour is handled with the get() function loader: ?fn(*Allocator, usize) anyerror!usize = null, /// Optional data that can be used by the loader. loaderData: usize = 0, objectType: AssetType, /// If true, after loading the asset, loader is not set to null /// (making it re-usable) and unload() can be called. If false, loader is /// set to null and cannot be unloaded. unloadable: bool = true, /// Allocator must be the same as the one used to create loaderData pub fn get(self: *Asset, allocator: *Allocator) !usize { if (self.objectPtr == 0) { if (self.loader) |loader| { self.objectPtr = try loader(allocator, self.loaderData); self.objectAllocator = allocator; if (!self.unloadable) { // if it cannot be reloaded, we can destroy loaderData if (self.loaderData != 0) { allocator.destroy(@intToPtr(*u8, self.loaderData)); self.loaderData = 0; } self.loader = null; } } } return self.objectPtr; } /// Temporarily unload the asset until it is needed again pub fn unload(self: *Asset) void { if (self.unloadable and self.objectPtr != 0) { if (self.objectAllocator) |alloc| { alloc.destroy(@intToPtr(*u8, self.objectPtr)); } self.objectPtr = 0; } } pub fn deinit(self: *Asset) void { if (self.objectAllocator) |alloc| { alloc.destroy(@intToPtr(*u8, self.objectPtr)); if (self.loaderData != 0) { alloc.destroy(@intToPtr(*u8, self.loaderData)); self.loaderData = 0; } } } }; pub const AssetError = error { UnexpectedType }; const AssetMap = std.StringHashMap(Asset); pub const AssetManager = struct { assets: AssetMap, allocator: *Allocator, pub fn init(allocator: *Allocator) AssetManager { var map = AssetMap.init(allocator); return AssetManager { .assets = map, .allocator = allocator }; } pub fn getAsset(self: *AssetManager, key: []const u8) ?Asset { return self.assets.get(key); } pub inline fn isType(self: *AssetManager, key: []const u8, expected: AssetType) bool { if (@import("builtin").mode == .Debug or @import("builtin").mode == .ReleaseSafe) { if (self.assets.get(key)) |asset| { return asset.objectType == expected; } else { return false; } } else { return true; } } pub fn getExpected(self: *AssetManager, key: []const u8, expected: AssetType) anyerror!?usize { if (self.assets.get(key)) |*asset| { const value = try asset.get(self.allocator); try self.assets.put(key, asset.*); if (asset.objectType != expected) { return AssetError.UnexpectedType; } return value; } else { return null; } } pub fn get(self: *AssetManager, key: []const u8) anyerror!?usize { if (self.assets.get(key)) |*asset| { const value = try asset.get(self.allocator); try self.assets.put(key, asset.*); return value; } else { return null; } } pub fn has(self: *AssetManager, key: []const u8) bool { return self.assets.get(key) != null; } pub fn put(self: *AssetManager, key: []const u8, asset: Asset) !void { try self.assets.put(key, asset); } pub fn deinit(self: *AssetManager) void { var iterator = self.assets.iterator(); while (iterator.next()) |item| { item.value.deinit(); } self.assets.deinit(); } };
didot-objects/assets.zig
pub const NETCON_MAX_NAME_LEN = @as(u32, 256); pub const S_OBJECT_NO_LONGER_VALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, 2)); pub const NETISO_GEID_FOR_WDAG = @as(u32, 1); pub const NETISO_GEID_FOR_NEUTRAL_AWARE = @as(u32, 2); //-------------------------------------------------------------------------------- // Section: Types (97) //-------------------------------------------------------------------------------- const CLSID_UPnPNAT_Value = Guid.initString("ae1e00aa-3fd5-403c-8a27-2bbdc30cd0e1"); pub const CLSID_UPnPNAT = &CLSID_UPnPNAT_Value; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IUPnPNAT_Value = Guid.initString("b171c812-cc76-485a-94d8-b6b3a2794e99"); pub const IID_IUPnPNAT = &IID_IUPnPNAT_Value; pub const IUPnPNAT = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StaticPortMappingCollection: fn( self: *const IUPnPNAT, ppSPMs: ?*?*IStaticPortMappingCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DynamicPortMappingCollection: fn( self: *const IUPnPNAT, ppDPMs: ?*?*IDynamicPortMappingCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NATEventManager: fn( self: *const IUPnPNAT, ppNEM: ?*?*INATEventManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUPnPNAT_get_StaticPortMappingCollection(self: *const T, ppSPMs: ?*?*IStaticPortMappingCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IUPnPNAT.VTable, self.vtable).get_StaticPortMappingCollection(@ptrCast(*const IUPnPNAT, self), ppSPMs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUPnPNAT_get_DynamicPortMappingCollection(self: *const T, ppDPMs: ?*?*IDynamicPortMappingCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IUPnPNAT.VTable, self.vtable).get_DynamicPortMappingCollection(@ptrCast(*const IUPnPNAT, self), ppDPMs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUPnPNAT_get_NATEventManager(self: *const T, ppNEM: ?*?*INATEventManager) callconv(.Inline) HRESULT { return @ptrCast(*const IUPnPNAT.VTable, self.vtable).get_NATEventManager(@ptrCast(*const IUPnPNAT, self), ppNEM); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INATEventManager_Value = Guid.initString("624bd588-9060-4109-b0b0-1adbbcac32df"); pub const IID_INATEventManager = &IID_INATEventManager_Value; pub const INATEventManager = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ExternalIPAddressCallback: fn( self: *const INATEventManager, pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_NumberOfEntriesCallback: fn( self: *const INATEventManager, pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INATEventManager_put_ExternalIPAddressCallback(self: *const T, pUnk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INATEventManager.VTable, self.vtable).put_ExternalIPAddressCallback(@ptrCast(*const INATEventManager, self), pUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INATEventManager_put_NumberOfEntriesCallback(self: *const T, pUnk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INATEventManager.VTable, self.vtable).put_NumberOfEntriesCallback(@ptrCast(*const INATEventManager, self), pUnk); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INATExternalIPAddressCallback_Value = Guid.initString("9c416740-a34e-446f-ba06-abd04c3149ae"); pub const IID_INATExternalIPAddressCallback = &IID_INATExternalIPAddressCallback_Value; pub const INATExternalIPAddressCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, NewExternalIPAddress: fn( self: *const INATExternalIPAddressCallback, bstrNewExternalIPAddress: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INATExternalIPAddressCallback_NewExternalIPAddress(self: *const T, bstrNewExternalIPAddress: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INATExternalIPAddressCallback.VTable, self.vtable).NewExternalIPAddress(@ptrCast(*const INATExternalIPAddressCallback, self), bstrNewExternalIPAddress); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INATNumberOfEntriesCallback_Value = Guid.initString("c83a0a74-91ee-41b6-b67a-67e0f00bbd78"); pub const IID_INATNumberOfEntriesCallback = &IID_INATNumberOfEntriesCallback_Value; pub const INATNumberOfEntriesCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, NewNumberOfEntries: fn( self: *const INATNumberOfEntriesCallback, lNewNumberOfEntries: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INATNumberOfEntriesCallback_NewNumberOfEntries(self: *const T, lNewNumberOfEntries: i32) callconv(.Inline) HRESULT { return @ptrCast(*const INATNumberOfEntriesCallback.VTable, self.vtable).NewNumberOfEntries(@ptrCast(*const INATNumberOfEntriesCallback, self), lNewNumberOfEntries); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDynamicPortMappingCollection_Value = Guid.initString("b60de00f-156e-4e8d-9ec1-3a2342c10899"); pub const IID_IDynamicPortMappingCollection = &IID_IDynamicPortMappingCollection_Value; pub const IDynamicPortMappingCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IDynamicPortMappingCollection, pVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IDynamicPortMappingCollection, bstrRemoteHost: ?BSTR, lExternalPort: i32, bstrProtocol: ?BSTR, ppDPM: ?*?*IDynamicPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IDynamicPortMappingCollection, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IDynamicPortMappingCollection, bstrRemoteHost: ?BSTR, lExternalPort: i32, bstrProtocol: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IDynamicPortMappingCollection, bstrRemoteHost: ?BSTR, lExternalPort: i32, bstrProtocol: ?BSTR, lInternalPort: i32, bstrInternalClient: ?BSTR, bEnabled: i16, bstrDescription: ?BSTR, lLeaseDuration: i32, ppDPM: ?*?*IDynamicPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMappingCollection_get__NewEnum(self: *const T, pVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMappingCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const IDynamicPortMappingCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMappingCollection_get_Item(self: *const T, bstrRemoteHost: ?BSTR, lExternalPort: i32, bstrProtocol: ?BSTR, ppDPM: ?*?*IDynamicPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMappingCollection.VTable, self.vtable).get_Item(@ptrCast(*const IDynamicPortMappingCollection, self), bstrRemoteHost, lExternalPort, bstrProtocol, ppDPM); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMappingCollection_get_Count(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMappingCollection.VTable, self.vtable).get_Count(@ptrCast(*const IDynamicPortMappingCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMappingCollection_Remove(self: *const T, bstrRemoteHost: ?BSTR, lExternalPort: i32, bstrProtocol: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMappingCollection.VTable, self.vtable).Remove(@ptrCast(*const IDynamicPortMappingCollection, self), bstrRemoteHost, lExternalPort, bstrProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMappingCollection_Add(self: *const T, bstrRemoteHost: ?BSTR, lExternalPort: i32, bstrProtocol: ?BSTR, lInternalPort: i32, bstrInternalClient: ?BSTR, bEnabled: i16, bstrDescription: ?BSTR, lLeaseDuration: i32, ppDPM: ?*?*IDynamicPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMappingCollection.VTable, self.vtable).Add(@ptrCast(*const IDynamicPortMappingCollection, self), bstrRemoteHost, lExternalPort, bstrProtocol, lInternalPort, bstrInternalClient, bEnabled, bstrDescription, lLeaseDuration, ppDPM); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDynamicPortMapping_Value = Guid.initString("4fc80282-23b6-4378-9a27-cd8f17c9400c"); pub const IID_IDynamicPortMapping = &IID_IDynamicPortMapping_Value; pub const IDynamicPortMapping = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExternalIPAddress: fn( self: *const IDynamicPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteHost: fn( self: *const IDynamicPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExternalPort: fn( self: *const IDynamicPortMapping, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Protocol: fn( self: *const IDynamicPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InternalPort: fn( self: *const IDynamicPortMapping, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InternalClient: fn( self: *const IDynamicPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IDynamicPortMapping, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Description: fn( self: *const IDynamicPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LeaseDuration: fn( self: *const IDynamicPortMapping, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RenewLease: fn( self: *const IDynamicPortMapping, lLeaseDurationDesired: i32, pLeaseDurationReturned: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditInternalClient: fn( self: *const IDynamicPortMapping, bstrInternalClient: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enable: fn( self: *const IDynamicPortMapping, vb: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditDescription: fn( self: *const IDynamicPortMapping, bstrDescription: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditInternalPort: fn( self: *const IDynamicPortMapping, lInternalPort: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_ExternalIPAddress(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_ExternalIPAddress(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_RemoteHost(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_RemoteHost(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_ExternalPort(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_ExternalPort(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_Protocol(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_Protocol(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_InternalPort(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_InternalPort(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_InternalClient(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_InternalClient(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_Enabled(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_Enabled(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_Description(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_Description(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_get_LeaseDuration(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).get_LeaseDuration(@ptrCast(*const IDynamicPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_RenewLease(self: *const T, lLeaseDurationDesired: i32, pLeaseDurationReturned: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).RenewLease(@ptrCast(*const IDynamicPortMapping, self), lLeaseDurationDesired, pLeaseDurationReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_EditInternalClient(self: *const T, bstrInternalClient: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).EditInternalClient(@ptrCast(*const IDynamicPortMapping, self), bstrInternalClient); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_Enable(self: *const T, vb: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).Enable(@ptrCast(*const IDynamicPortMapping, self), vb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_EditDescription(self: *const T, bstrDescription: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).EditDescription(@ptrCast(*const IDynamicPortMapping, self), bstrDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicPortMapping_EditInternalPort(self: *const T, lInternalPort: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicPortMapping.VTable, self.vtable).EditInternalPort(@ptrCast(*const IDynamicPortMapping, self), lInternalPort); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IStaticPortMappingCollection_Value = Guid.initString("cd1f3e77-66d6-4664-82c7-36dbb641d0f1"); pub const IID_IStaticPortMappingCollection = &IID_IStaticPortMappingCollection_Value; pub const IStaticPortMappingCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IStaticPortMappingCollection, pVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IStaticPortMappingCollection, lExternalPort: i32, bstrProtocol: ?BSTR, ppSPM: ?*?*IStaticPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IStaticPortMappingCollection, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IStaticPortMappingCollection, lExternalPort: i32, bstrProtocol: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IStaticPortMappingCollection, lExternalPort: i32, bstrProtocol: ?BSTR, lInternalPort: i32, bstrInternalClient: ?BSTR, bEnabled: i16, bstrDescription: ?BSTR, ppSPM: ?*?*IStaticPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMappingCollection_get__NewEnum(self: *const T, pVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMappingCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const IStaticPortMappingCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMappingCollection_get_Item(self: *const T, lExternalPort: i32, bstrProtocol: ?BSTR, ppSPM: ?*?*IStaticPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMappingCollection.VTable, self.vtable).get_Item(@ptrCast(*const IStaticPortMappingCollection, self), lExternalPort, bstrProtocol, ppSPM); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMappingCollection_get_Count(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMappingCollection.VTable, self.vtable).get_Count(@ptrCast(*const IStaticPortMappingCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMappingCollection_Remove(self: *const T, lExternalPort: i32, bstrProtocol: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMappingCollection.VTable, self.vtable).Remove(@ptrCast(*const IStaticPortMappingCollection, self), lExternalPort, bstrProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMappingCollection_Add(self: *const T, lExternalPort: i32, bstrProtocol: ?BSTR, lInternalPort: i32, bstrInternalClient: ?BSTR, bEnabled: i16, bstrDescription: ?BSTR, ppSPM: ?*?*IStaticPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMappingCollection.VTable, self.vtable).Add(@ptrCast(*const IStaticPortMappingCollection, self), lExternalPort, bstrProtocol, lInternalPort, bstrInternalClient, bEnabled, bstrDescription, ppSPM); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IStaticPortMapping_Value = Guid.initString("6f10711f-729b-41e5-93b8-f21d0f818df1"); pub const IID_IStaticPortMapping = &IID_IStaticPortMapping_Value; pub const IStaticPortMapping = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExternalIPAddress: fn( self: *const IStaticPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExternalPort: fn( self: *const IStaticPortMapping, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InternalPort: fn( self: *const IStaticPortMapping, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Protocol: fn( self: *const IStaticPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InternalClient: fn( self: *const IStaticPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IStaticPortMapping, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Description: fn( self: *const IStaticPortMapping, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditInternalClient: fn( self: *const IStaticPortMapping, bstrInternalClient: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enable: fn( self: *const IStaticPortMapping, vb: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditDescription: fn( self: *const IStaticPortMapping, bstrDescription: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditInternalPort: fn( self: *const IStaticPortMapping, lInternalPort: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_ExternalIPAddress(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_ExternalIPAddress(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_ExternalPort(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_ExternalPort(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_InternalPort(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_InternalPort(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_Protocol(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_Protocol(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_InternalClient(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_InternalClient(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_Enabled(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_Enabled(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_get_Description(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).get_Description(@ptrCast(*const IStaticPortMapping, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_EditInternalClient(self: *const T, bstrInternalClient: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).EditInternalClient(@ptrCast(*const IStaticPortMapping, self), bstrInternalClient); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_Enable(self: *const T, vb: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).Enable(@ptrCast(*const IStaticPortMapping, self), vb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_EditDescription(self: *const T, bstrDescription: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).EditDescription(@ptrCast(*const IStaticPortMapping, self), bstrDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStaticPortMapping_EditInternalPort(self: *const T, lInternalPort: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStaticPortMapping.VTable, self.vtable).EditInternalPort(@ptrCast(*const IStaticPortMapping, self), lInternalPort); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_NetSharingManager_Value = Guid.initString("5c63c1ad-3956-4ff8-8486-40034758315b"); pub const CLSID_NetSharingManager = &CLSID_NetSharingManager_Value; const IID_IEnumNetConnection_Value = Guid.initString("c08956a0-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_IEnumNetConnection = &IID_IEnumNetConnection_Value; pub const IEnumNetConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumNetConnection, celt: u32, rgelt: [*]?*INetConnection, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumNetConnection, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumNetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumNetConnection, ppenum: ?*?*IEnumNetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetConnection_Next(self: *const T, celt: u32, rgelt: [*]?*INetConnection, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetConnection.VTable, self.vtable).Next(@ptrCast(*const IEnumNetConnection, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetConnection_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetConnection.VTable, self.vtable).Skip(@ptrCast(*const IEnumNetConnection, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetConnection_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetConnection.VTable, self.vtable).Reset(@ptrCast(*const IEnumNetConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetConnection_Clone(self: *const T, ppenum: ?*?*IEnumNetConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetConnection.VTable, self.vtable).Clone(@ptrCast(*const IEnumNetConnection, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const NETCON_CHARACTERISTIC_FLAGS = enum(i32) { NONE = 0, ALL_USERS = 1, ALLOW_DUPLICATION = 2, ALLOW_REMOVAL = 4, ALLOW_RENAME = 8, INCOMING_ONLY = 32, OUTGOING_ONLY = 64, BRANDED = 128, SHARED = 256, BRIDGED = 512, FIREWALLED = 1024, DEFAULT = 2048, HOMENET_CAPABLE = 4096, SHARED_PRIVATE = 8192, QUARANTINED = 16384, RESERVED = 32768, HOSTED_NETWORK = 65536, VIRTUAL_STATION = 131072, WIFI_DIRECT = 262144, BLUETOOTH_MASK = 983040, LAN_MASK = 15728640, }; pub const NCCF_NONE = NETCON_CHARACTERISTIC_FLAGS.NONE; pub const NCCF_ALL_USERS = NETCON_CHARACTERISTIC_FLAGS.ALL_USERS; pub const NCCF_ALLOW_DUPLICATION = NETCON_CHARACTERISTIC_FLAGS.ALLOW_DUPLICATION; pub const NCCF_ALLOW_REMOVAL = NETCON_CHARACTERISTIC_FLAGS.ALLOW_REMOVAL; pub const NCCF_ALLOW_RENAME = NETCON_CHARACTERISTIC_FLAGS.ALLOW_RENAME; pub const NCCF_INCOMING_ONLY = NETCON_CHARACTERISTIC_FLAGS.INCOMING_ONLY; pub const NCCF_OUTGOING_ONLY = NETCON_CHARACTERISTIC_FLAGS.OUTGOING_ONLY; pub const NCCF_BRANDED = NETCON_CHARACTERISTIC_FLAGS.BRANDED; pub const NCCF_SHARED = NETCON_CHARACTERISTIC_FLAGS.SHARED; pub const NCCF_BRIDGED = NETCON_CHARACTERISTIC_FLAGS.BRIDGED; pub const NCCF_FIREWALLED = NETCON_CHARACTERISTIC_FLAGS.FIREWALLED; pub const NCCF_DEFAULT = NETCON_CHARACTERISTIC_FLAGS.DEFAULT; pub const NCCF_HOMENET_CAPABLE = NETCON_CHARACTERISTIC_FLAGS.HOMENET_CAPABLE; pub const NCCF_SHARED_PRIVATE = NETCON_CHARACTERISTIC_FLAGS.SHARED_PRIVATE; pub const NCCF_QUARANTINED = NETCON_CHARACTERISTIC_FLAGS.QUARANTINED; pub const NCCF_RESERVED = NETCON_CHARACTERISTIC_FLAGS.RESERVED; pub const NCCF_HOSTED_NETWORK = NETCON_CHARACTERISTIC_FLAGS.HOSTED_NETWORK; pub const NCCF_VIRTUAL_STATION = NETCON_CHARACTERISTIC_FLAGS.VIRTUAL_STATION; pub const NCCF_WIFI_DIRECT = NETCON_CHARACTERISTIC_FLAGS.WIFI_DIRECT; pub const NCCF_BLUETOOTH_MASK = NETCON_CHARACTERISTIC_FLAGS.BLUETOOTH_MASK; pub const NCCF_LAN_MASK = NETCON_CHARACTERISTIC_FLAGS.LAN_MASK; pub const NETCON_STATUS = enum(i32) { DISCONNECTED = 0, CONNECTING = 1, CONNECTED = 2, DISCONNECTING = 3, HARDWARE_NOT_PRESENT = 4, HARDWARE_DISABLED = 5, HARDWARE_MALFUNCTION = 6, MEDIA_DISCONNECTED = 7, AUTHENTICATING = 8, AUTHENTICATION_SUCCEEDED = 9, AUTHENTICATION_FAILED = 10, INVALID_ADDRESS = 11, CREDENTIALS_REQUIRED = 12, ACTION_REQUIRED = 13, ACTION_REQUIRED_RETRY = 14, CONNECT_FAILED = 15, }; pub const NCS_DISCONNECTED = NETCON_STATUS.DISCONNECTED; pub const NCS_CONNECTING = NETCON_STATUS.CONNECTING; pub const NCS_CONNECTED = NETCON_STATUS.CONNECTED; pub const NCS_DISCONNECTING = NETCON_STATUS.DISCONNECTING; pub const NCS_HARDWARE_NOT_PRESENT = NETCON_STATUS.HARDWARE_NOT_PRESENT; pub const NCS_HARDWARE_DISABLED = NETCON_STATUS.HARDWARE_DISABLED; pub const NCS_HARDWARE_MALFUNCTION = NETCON_STATUS.HARDWARE_MALFUNCTION; pub const NCS_MEDIA_DISCONNECTED = NETCON_STATUS.MEDIA_DISCONNECTED; pub const NCS_AUTHENTICATING = NETCON_STATUS.AUTHENTICATING; pub const NCS_AUTHENTICATION_SUCCEEDED = NETCON_STATUS.AUTHENTICATION_SUCCEEDED; pub const NCS_AUTHENTICATION_FAILED = NETCON_STATUS.AUTHENTICATION_FAILED; pub const NCS_INVALID_ADDRESS = NETCON_STATUS.INVALID_ADDRESS; pub const NCS_CREDENTIALS_REQUIRED = NETCON_STATUS.CREDENTIALS_REQUIRED; pub const NCS_ACTION_REQUIRED = NETCON_STATUS.ACTION_REQUIRED; pub const NCS_ACTION_REQUIRED_RETRY = NETCON_STATUS.ACTION_REQUIRED_RETRY; pub const NCS_CONNECT_FAILED = NETCON_STATUS.CONNECT_FAILED; pub const NETCON_TYPE = enum(i32) { DIRECT_CONNECT = 0, INBOUND = 1, INTERNET = 2, LAN = 3, PHONE = 4, TUNNEL = 5, BRIDGE = 6, }; pub const NCT_DIRECT_CONNECT = NETCON_TYPE.DIRECT_CONNECT; pub const NCT_INBOUND = NETCON_TYPE.INBOUND; pub const NCT_INTERNET = NETCON_TYPE.INTERNET; pub const NCT_LAN = NETCON_TYPE.LAN; pub const NCT_PHONE = NETCON_TYPE.PHONE; pub const NCT_TUNNEL = NETCON_TYPE.TUNNEL; pub const NCT_BRIDGE = NETCON_TYPE.BRIDGE; pub const NETCON_MEDIATYPE = enum(i32) { NONE = 0, DIRECT = 1, ISDN = 2, LAN = 3, PHONE = 4, TUNNEL = 5, PPPOE = 6, BRIDGE = 7, SHAREDACCESSHOST_LAN = 8, SHAREDACCESSHOST_RAS = 9, }; pub const NCM_NONE = NETCON_MEDIATYPE.NONE; pub const NCM_DIRECT = NETCON_MEDIATYPE.DIRECT; pub const NCM_ISDN = NETCON_MEDIATYPE.ISDN; pub const NCM_LAN = NETCON_MEDIATYPE.LAN; pub const NCM_PHONE = NETCON_MEDIATYPE.PHONE; pub const NCM_TUNNEL = NETCON_MEDIATYPE.TUNNEL; pub const NCM_PPPOE = NETCON_MEDIATYPE.PPPOE; pub const NCM_BRIDGE = NETCON_MEDIATYPE.BRIDGE; pub const NCM_SHAREDACCESSHOST_LAN = NETCON_MEDIATYPE.SHAREDACCESSHOST_LAN; pub const NCM_SHAREDACCESSHOST_RAS = NETCON_MEDIATYPE.SHAREDACCESSHOST_RAS; pub const NETCON_PROPERTIES = extern struct { guidId: Guid, pszwName: ?PWSTR, pszwDeviceName: ?PWSTR, Status: NETCON_STATUS, MediaType: NETCON_MEDIATYPE, dwCharacter: u32, clsidThisObject: Guid, clsidUiObject: Guid, }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetConnection_Value = Guid.initString("c08956a1-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_INetConnection = &IID_INetConnection_Value; pub const INetConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Connect: fn( self: *const INetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const INetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const INetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Duplicate: fn( self: *const INetConnection, pszwDuplicateName: ?[*:0]const u16, ppCon: ?*?*INetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperties: fn( self: *const INetConnection, ppProps: ?*?*NETCON_PROPERTIES, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUiObjectClassId: fn( self: *const INetConnection, pclsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Rename: fn( self: *const INetConnection, pszwNewName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_Connect(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).Connect(@ptrCast(*const INetConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_Disconnect(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).Disconnect(@ptrCast(*const INetConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).Delete(@ptrCast(*const INetConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_Duplicate(self: *const T, pszwDuplicateName: ?[*:0]const u16, ppCon: ?*?*INetConnection) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).Duplicate(@ptrCast(*const INetConnection, self), pszwDuplicateName, ppCon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_GetProperties(self: *const T, ppProps: ?*?*NETCON_PROPERTIES) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).GetProperties(@ptrCast(*const INetConnection, self), ppProps); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_GetUiObjectClassId(self: *const T, pclsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).GetUiObjectClassId(@ptrCast(*const INetConnection, self), pclsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnection_Rename(self: *const T, pszwNewName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnection.VTable, self.vtable).Rename(@ptrCast(*const INetConnection, self), pszwNewName); } };} pub usingnamespace MethodMixin(@This()); }; pub const NETCONMGR_ENUM_FLAGS = enum(i32) { DEFAULT = 0, HIDDEN = 1, }; pub const NCME_DEFAULT = NETCONMGR_ENUM_FLAGS.DEFAULT; pub const NCME_HIDDEN = NETCONMGR_ENUM_FLAGS.HIDDEN; const IID_INetConnectionManager_Value = Guid.initString("c08956a2-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_INetConnectionManager = &IID_INetConnectionManager_Value; pub const INetConnectionManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumConnections: fn( self: *const INetConnectionManager, Flags: NETCONMGR_ENUM_FLAGS, ppEnum: ?*?*IEnumNetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionManager_EnumConnections(self: *const T, Flags: NETCONMGR_ENUM_FLAGS, ppEnum: ?*?*IEnumNetConnection) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionManager.VTable, self.vtable).EnumConnections(@ptrCast(*const INetConnectionManager, self), Flags, ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; pub const NETCONUI_CONNECT_FLAGS = enum(i32) { DEFAULT = 0, NO_UI = 1, ENABLE_DISABLE = 2, }; pub const NCUC_DEFAULT = NETCONUI_CONNECT_FLAGS.DEFAULT; pub const NCUC_NO_UI = NETCONUI_CONNECT_FLAGS.NO_UI; pub const NCUC_ENABLE_DISABLE = NETCONUI_CONNECT_FLAGS.ENABLE_DISABLE; const IID_INetConnectionConnectUi_Value = Guid.initString("c08956a3-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_INetConnectionConnectUi = &IID_INetConnectionConnectUi_Value; pub const INetConnectionConnectUi = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetConnection: fn( self: *const INetConnectionConnectUi, pCon: ?*INetConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Connect: fn( self: *const INetConnectionConnectUi, hwndParent: ?HWND, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const INetConnectionConnectUi, hwndParent: ?HWND, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionConnectUi_SetConnection(self: *const T, pCon: ?*INetConnection) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionConnectUi.VTable, self.vtable).SetConnection(@ptrCast(*const INetConnectionConnectUi, self), pCon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionConnectUi_Connect(self: *const T, hwndParent: ?HWND, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionConnectUi.VTable, self.vtable).Connect(@ptrCast(*const INetConnectionConnectUi, self), hwndParent, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionConnectUi_Disconnect(self: *const T, hwndParent: ?HWND, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionConnectUi.VTable, self.vtable).Disconnect(@ptrCast(*const INetConnectionConnectUi, self), hwndParent, dwFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IEnumNetSharingPortMapping_Value = Guid.initString("c08956b0-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_IEnumNetSharingPortMapping = &IID_IEnumNetSharingPortMapping_Value; pub const IEnumNetSharingPortMapping = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumNetSharingPortMapping, celt: u32, rgVar: [*]VARIANT, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumNetSharingPortMapping, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumNetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumNetSharingPortMapping, ppenum: ?*?*IEnumNetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPortMapping_Next(self: *const T, celt: u32, rgVar: [*]VARIANT, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPortMapping.VTable, self.vtable).Next(@ptrCast(*const IEnumNetSharingPortMapping, self), celt, rgVar, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPortMapping_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPortMapping.VTable, self.vtable).Skip(@ptrCast(*const IEnumNetSharingPortMapping, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPortMapping_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPortMapping.VTable, self.vtable).Reset(@ptrCast(*const IEnumNetSharingPortMapping, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPortMapping_Clone(self: *const T, ppenum: ?*?*IEnumNetSharingPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPortMapping.VTable, self.vtable).Clone(@ptrCast(*const IEnumNetSharingPortMapping, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingPortMappingProps_Value = Guid.initString("24b7e9b5-e38f-4685-851b-00892cf5f940"); pub const IID_INetSharingPortMappingProps = &IID_INetSharingPortMappingProps_Value; pub const INetSharingPortMappingProps = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetSharingPortMappingProps, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IPProtocol: fn( self: *const INetSharingPortMappingProps, pucIPProt: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExternalPort: fn( self: *const INetSharingPortMappingProps, pusPort: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InternalPort: fn( self: *const INetSharingPortMappingProps, pusPort: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Options: fn( self: *const INetSharingPortMappingProps, pdwOptions: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TargetName: fn( self: *const INetSharingPortMappingProps, pbstrTargetName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TargetIPAddress: fn( self: *const INetSharingPortMappingProps, pbstrTargetIPAddress: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const INetSharingPortMappingProps, pbool: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_Name(@ptrCast(*const INetSharingPortMappingProps, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_IPProtocol(self: *const T, pucIPProt: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_IPProtocol(@ptrCast(*const INetSharingPortMappingProps, self), pucIPProt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_ExternalPort(self: *const T, pusPort: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_ExternalPort(@ptrCast(*const INetSharingPortMappingProps, self), pusPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_InternalPort(self: *const T, pusPort: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_InternalPort(@ptrCast(*const INetSharingPortMappingProps, self), pusPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_Options(self: *const T, pdwOptions: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_Options(@ptrCast(*const INetSharingPortMappingProps, self), pdwOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_TargetName(self: *const T, pbstrTargetName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_TargetName(@ptrCast(*const INetSharingPortMappingProps, self), pbstrTargetName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_TargetIPAddress(self: *const T, pbstrTargetIPAddress: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_TargetIPAddress(@ptrCast(*const INetSharingPortMappingProps, self), pbstrTargetIPAddress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingProps_get_Enabled(self: *const T, pbool: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingProps.VTable, self.vtable).get_Enabled(@ptrCast(*const INetSharingPortMappingProps, self), pbool); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingPortMapping_Value = Guid.initString("c08956b1-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_INetSharingPortMapping = &IID_INetSharingPortMapping_Value; pub const INetSharingPortMapping = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, Disable: fn( self: *const INetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enable: fn( self: *const INetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Properties: fn( self: *const INetSharingPortMapping, ppNSPMP: ?*?*INetSharingPortMappingProps, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const INetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMapping_Disable(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMapping.VTable, self.vtable).Disable(@ptrCast(*const INetSharingPortMapping, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMapping_Enable(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMapping.VTable, self.vtable).Enable(@ptrCast(*const INetSharingPortMapping, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMapping_get_Properties(self: *const T, ppNSPMP: ?*?*INetSharingPortMappingProps) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMapping.VTable, self.vtable).get_Properties(@ptrCast(*const INetSharingPortMapping, self), ppNSPMP); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMapping_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMapping.VTable, self.vtable).Delete(@ptrCast(*const INetSharingPortMapping, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IEnumNetSharingEveryConnection_Value = Guid.initString("c08956b8-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_IEnumNetSharingEveryConnection = &IID_IEnumNetSharingEveryConnection_Value; pub const IEnumNetSharingEveryConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumNetSharingEveryConnection, celt: u32, rgVar: [*]VARIANT, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumNetSharingEveryConnection, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumNetSharingEveryConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumNetSharingEveryConnection, ppenum: ?*?*IEnumNetSharingEveryConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingEveryConnection_Next(self: *const T, celt: u32, rgVar: [*]VARIANT, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingEveryConnection.VTable, self.vtable).Next(@ptrCast(*const IEnumNetSharingEveryConnection, self), celt, rgVar, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingEveryConnection_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingEveryConnection.VTable, self.vtable).Skip(@ptrCast(*const IEnumNetSharingEveryConnection, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingEveryConnection_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingEveryConnection.VTable, self.vtable).Reset(@ptrCast(*const IEnumNetSharingEveryConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingEveryConnection_Clone(self: *const T, ppenum: ?*?*IEnumNetSharingEveryConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingEveryConnection.VTable, self.vtable).Clone(@ptrCast(*const IEnumNetSharingEveryConnection, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IEnumNetSharingPublicConnection_Value = Guid.initString("c08956b4-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_IEnumNetSharingPublicConnection = &IID_IEnumNetSharingPublicConnection_Value; pub const IEnumNetSharingPublicConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumNetSharingPublicConnection, celt: u32, rgVar: [*]VARIANT, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumNetSharingPublicConnection, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumNetSharingPublicConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumNetSharingPublicConnection, ppenum: ?*?*IEnumNetSharingPublicConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPublicConnection_Next(self: *const T, celt: u32, rgVar: [*]VARIANT, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPublicConnection.VTable, self.vtable).Next(@ptrCast(*const IEnumNetSharingPublicConnection, self), celt, rgVar, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPublicConnection_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPublicConnection.VTable, self.vtable).Skip(@ptrCast(*const IEnumNetSharingPublicConnection, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPublicConnection_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPublicConnection.VTable, self.vtable).Reset(@ptrCast(*const IEnumNetSharingPublicConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPublicConnection_Clone(self: *const T, ppenum: ?*?*IEnumNetSharingPublicConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPublicConnection.VTable, self.vtable).Clone(@ptrCast(*const IEnumNetSharingPublicConnection, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IEnumNetSharingPrivateConnection_Value = Guid.initString("c08956b5-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_IEnumNetSharingPrivateConnection = &IID_IEnumNetSharingPrivateConnection_Value; pub const IEnumNetSharingPrivateConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumNetSharingPrivateConnection, celt: u32, rgVar: [*]VARIANT, pCeltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumNetSharingPrivateConnection, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumNetSharingPrivateConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumNetSharingPrivateConnection, ppenum: ?*?*IEnumNetSharingPrivateConnection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPrivateConnection_Next(self: *const T, celt: u32, rgVar: [*]VARIANT, pCeltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPrivateConnection.VTable, self.vtable).Next(@ptrCast(*const IEnumNetSharingPrivateConnection, self), celt, rgVar, pCeltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPrivateConnection_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPrivateConnection.VTable, self.vtable).Skip(@ptrCast(*const IEnumNetSharingPrivateConnection, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPrivateConnection_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPrivateConnection.VTable, self.vtable).Reset(@ptrCast(*const IEnumNetSharingPrivateConnection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumNetSharingPrivateConnection_Clone(self: *const T, ppenum: ?*?*IEnumNetSharingPrivateConnection) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumNetSharingPrivateConnection.VTable, self.vtable).Clone(@ptrCast(*const IEnumNetSharingPrivateConnection, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingPortMappingCollection_Value = Guid.initString("02e4a2de-da20-4e34-89c8-ac22275a010b"); pub const IID_INetSharingPortMappingCollection = &IID_INetSharingPortMappingCollection_Value; pub const INetSharingPortMappingCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetSharingPortMappingCollection, pVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetSharingPortMappingCollection, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingCollection_get__NewEnum(self: *const T, pVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetSharingPortMappingCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPortMappingCollection_get_Count(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPortMappingCollection.VTable, self.vtable).get_Count(@ptrCast(*const INetSharingPortMappingCollection, self), pVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetConnectionProps_Value = Guid.initString("f4277c95-ce5b-463d-8167-5662d9bcaa72"); pub const IID_INetConnectionProps = &IID_INetConnectionProps_Value; pub const INetConnectionProps = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Guid: fn( self: *const INetConnectionProps, pbstrGuid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetConnectionProps, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DeviceName: fn( self: *const INetConnectionProps, pbstrDeviceName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Status: fn( self: *const INetConnectionProps, pStatus: ?*NETCON_STATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MediaType: fn( self: *const INetConnectionProps, pMediaType: ?*NETCON_MEDIATYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Characteristics: fn( self: *const INetConnectionProps, pdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionProps_get_Guid(self: *const T, pbstrGuid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionProps.VTable, self.vtable).get_Guid(@ptrCast(*const INetConnectionProps, self), pbstrGuid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionProps_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionProps.VTable, self.vtable).get_Name(@ptrCast(*const INetConnectionProps, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionProps_get_DeviceName(self: *const T, pbstrDeviceName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionProps.VTable, self.vtable).get_DeviceName(@ptrCast(*const INetConnectionProps, self), pbstrDeviceName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionProps_get_Status(self: *const T, pStatus: ?*NETCON_STATUS) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionProps.VTable, self.vtable).get_Status(@ptrCast(*const INetConnectionProps, self), pStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionProps_get_MediaType(self: *const T, pMediaType: ?*NETCON_MEDIATYPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionProps.VTable, self.vtable).get_MediaType(@ptrCast(*const INetConnectionProps, self), pMediaType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetConnectionProps_get_Characteristics(self: *const T, pdwFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const INetConnectionProps.VTable, self.vtable).get_Characteristics(@ptrCast(*const INetConnectionProps, self), pdwFlags); } };} pub usingnamespace MethodMixin(@This()); }; pub const SHARINGCONNECTIONTYPE = enum(i32) { UBLIC = 0, RIVATE = 1, }; pub const ICSSHARINGTYPE_PUBLIC = SHARINGCONNECTIONTYPE.UBLIC; pub const ICSSHARINGTYPE_PRIVATE = SHARINGCONNECTIONTYPE.RIVATE; pub const SHARINGCONNECTION_ENUM_FLAGS = enum(i32) { DEFAULT = 0, ENABLED = 1, }; pub const ICSSC_DEFAULT = SHARINGCONNECTION_ENUM_FLAGS.DEFAULT; pub const ICSSC_ENABLED = SHARINGCONNECTION_ENUM_FLAGS.ENABLED; pub const ICS_TARGETTYPE = enum(i32) { NAME = 0, IPADDRESS = 1, }; pub const ICSTT_NAME = ICS_TARGETTYPE.NAME; pub const ICSTT_IPADDRESS = ICS_TARGETTYPE.IPADDRESS; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingConfiguration_Value = Guid.initString("c08956b6-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_INetSharingConfiguration = &IID_INetSharingConfiguration_Value; pub const INetSharingConfiguration = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SharingEnabled: fn( self: *const INetSharingConfiguration, pbEnabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SharingConnectionType: fn( self: *const INetSharingConfiguration, pType: ?*SHARINGCONNECTIONTYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisableSharing: fn( self: *const INetSharingConfiguration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableSharing: fn( self: *const INetSharingConfiguration, Type: SHARINGCONNECTIONTYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InternetFirewallEnabled: fn( self: *const INetSharingConfiguration, pbEnabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisableInternetFirewall: fn( self: *const INetSharingConfiguration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableInternetFirewall: fn( self: *const INetSharingConfiguration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EnumPortMappings: fn( self: *const INetSharingConfiguration, Flags: SHARINGCONNECTION_ENUM_FLAGS, ppColl: ?*?*INetSharingPortMappingCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddPortMapping: fn( self: *const INetSharingConfiguration, bstrName: ?BSTR, ucIPProtocol: u8, usExternalPort: u16, usInternalPort: u16, dwOptions: u32, bstrTargetNameOrIPAddress: ?BSTR, eTargetType: ICS_TARGETTYPE, ppMapping: ?*?*INetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemovePortMapping: fn( self: *const INetSharingConfiguration, pMapping: ?*INetSharingPortMapping, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_get_SharingEnabled(self: *const T, pbEnabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).get_SharingEnabled(@ptrCast(*const INetSharingConfiguration, self), pbEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_get_SharingConnectionType(self: *const T, pType: ?*SHARINGCONNECTIONTYPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).get_SharingConnectionType(@ptrCast(*const INetSharingConfiguration, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_DisableSharing(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).DisableSharing(@ptrCast(*const INetSharingConfiguration, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_EnableSharing(self: *const T, Type: SHARINGCONNECTIONTYPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).EnableSharing(@ptrCast(*const INetSharingConfiguration, self), Type); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_get_InternetFirewallEnabled(self: *const T, pbEnabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).get_InternetFirewallEnabled(@ptrCast(*const INetSharingConfiguration, self), pbEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_DisableInternetFirewall(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).DisableInternetFirewall(@ptrCast(*const INetSharingConfiguration, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_EnableInternetFirewall(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).EnableInternetFirewall(@ptrCast(*const INetSharingConfiguration, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_get_EnumPortMappings(self: *const T, Flags: SHARINGCONNECTION_ENUM_FLAGS, ppColl: ?*?*INetSharingPortMappingCollection) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).get_EnumPortMappings(@ptrCast(*const INetSharingConfiguration, self), Flags, ppColl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_AddPortMapping(self: *const T, bstrName: ?BSTR, ucIPProtocol: u8, usExternalPort: u16, usInternalPort: u16, dwOptions: u32, bstrTargetNameOrIPAddress: ?BSTR, eTargetType: ICS_TARGETTYPE, ppMapping: ?*?*INetSharingPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).AddPortMapping(@ptrCast(*const INetSharingConfiguration, self), bstrName, ucIPProtocol, usExternalPort, usInternalPort, dwOptions, bstrTargetNameOrIPAddress, eTargetType, ppMapping); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingConfiguration_RemovePortMapping(self: *const T, pMapping: ?*INetSharingPortMapping) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingConfiguration.VTable, self.vtable).RemovePortMapping(@ptrCast(*const INetSharingConfiguration, self), pMapping); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingEveryConnectionCollection_Value = Guid.initString("33c4643c-7811-46fa-a89a-768597bd7223"); pub const IID_INetSharingEveryConnectionCollection = &IID_INetSharingEveryConnectionCollection_Value; pub const INetSharingEveryConnectionCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetSharingEveryConnectionCollection, pVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetSharingEveryConnectionCollection, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingEveryConnectionCollection_get__NewEnum(self: *const T, pVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingEveryConnectionCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetSharingEveryConnectionCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingEveryConnectionCollection_get_Count(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingEveryConnectionCollection.VTable, self.vtable).get_Count(@ptrCast(*const INetSharingEveryConnectionCollection, self), pVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingPublicConnectionCollection_Value = Guid.initString("7d7a6355-f372-4971-a149-bfc927be762a"); pub const IID_INetSharingPublicConnectionCollection = &IID_INetSharingPublicConnectionCollection_Value; pub const INetSharingPublicConnectionCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetSharingPublicConnectionCollection, pVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetSharingPublicConnectionCollection, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPublicConnectionCollection_get__NewEnum(self: *const T, pVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPublicConnectionCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetSharingPublicConnectionCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPublicConnectionCollection_get_Count(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPublicConnectionCollection.VTable, self.vtable).get_Count(@ptrCast(*const INetSharingPublicConnectionCollection, self), pVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingPrivateConnectionCollection_Value = Guid.initString("38ae69e0-4409-402a-a2cb-e965c727f840"); pub const IID_INetSharingPrivateConnectionCollection = &IID_INetSharingPrivateConnectionCollection_Value; pub const INetSharingPrivateConnectionCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetSharingPrivateConnectionCollection, pVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetSharingPrivateConnectionCollection, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPrivateConnectionCollection_get__NewEnum(self: *const T, pVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPrivateConnectionCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetSharingPrivateConnectionCollection, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingPrivateConnectionCollection_get_Count(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingPrivateConnectionCollection.VTable, self.vtable).get_Count(@ptrCast(*const INetSharingPrivateConnectionCollection, self), pVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_INetSharingManager_Value = Guid.initString("c08956b7-1cd3-11d1-b1c5-00805fc1270e"); pub const IID_INetSharingManager = &IID_INetSharingManager_Value; pub const INetSharingManager = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SharingInstalled: fn( self: *const INetSharingManager, pbInstalled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EnumPublicConnections: fn( self: *const INetSharingManager, Flags: SHARINGCONNECTION_ENUM_FLAGS, ppColl: ?*?*INetSharingPublicConnectionCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EnumPrivateConnections: fn( self: *const INetSharingManager, Flags: SHARINGCONNECTION_ENUM_FLAGS, ppColl: ?*?*INetSharingPrivateConnectionCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_INetSharingConfigurationForINetConnection: fn( self: *const INetSharingManager, pNetConnection: ?*INetConnection, ppNetSharingConfiguration: ?*?*INetSharingConfiguration, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EnumEveryConnection: fn( self: *const INetSharingManager, ppColl: ?*?*INetSharingEveryConnectionCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NetConnectionProps: fn( self: *const INetSharingManager, pNetConnection: ?*INetConnection, ppProps: ?*?*INetConnectionProps, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingManager_get_SharingInstalled(self: *const T, pbInstalled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingManager.VTable, self.vtable).get_SharingInstalled(@ptrCast(*const INetSharingManager, self), pbInstalled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingManager_get_EnumPublicConnections(self: *const T, Flags: SHARINGCONNECTION_ENUM_FLAGS, ppColl: ?*?*INetSharingPublicConnectionCollection) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingManager.VTable, self.vtable).get_EnumPublicConnections(@ptrCast(*const INetSharingManager, self), Flags, ppColl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingManager_get_EnumPrivateConnections(self: *const T, Flags: SHARINGCONNECTION_ENUM_FLAGS, ppColl: ?*?*INetSharingPrivateConnectionCollection) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingManager.VTable, self.vtable).get_EnumPrivateConnections(@ptrCast(*const INetSharingManager, self), Flags, ppColl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingManager_get_INetSharingConfigurationForINetConnection(self: *const T, pNetConnection: ?*INetConnection, ppNetSharingConfiguration: ?*?*INetSharingConfiguration) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingManager.VTable, self.vtable).get_INetSharingConfigurationForINetConnection(@ptrCast(*const INetSharingManager, self), pNetConnection, ppNetSharingConfiguration); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingManager_get_EnumEveryConnection(self: *const T, ppColl: ?*?*INetSharingEveryConnectionCollection) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingManager.VTable, self.vtable).get_EnumEveryConnection(@ptrCast(*const INetSharingManager, self), ppColl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetSharingManager_get_NetConnectionProps(self: *const T, pNetConnection: ?*INetConnection, ppProps: ?*?*INetConnectionProps) callconv(.Inline) HRESULT { return @ptrCast(*const INetSharingManager.VTable, self.vtable).get_NetConnectionProps(@ptrCast(*const INetSharingManager, self), pNetConnection, ppProps); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_NetFwRule_Value = Guid.initString("2c5bc43e-3369-4c33-ab0c-be9469677af4"); pub const CLSID_NetFwRule = &CLSID_NetFwRule_Value; const CLSID_NetFwOpenPort_Value = Guid.initString("0ca545c6-37ad-4a6c-bf92-9f7610067ef5"); pub const CLSID_NetFwOpenPort = &CLSID_NetFwOpenPort_Value; const CLSID_NetFwAuthorizedApplication_Value = Guid.initString("ec9846b3-2762-4a6b-a214-6acb603462d2"); pub const CLSID_NetFwAuthorizedApplication = &CLSID_NetFwAuthorizedApplication_Value; const CLSID_NetFwPolicy2_Value = Guid.initString("e2b3c97f-6ae1-41ac-817a-f6f92166d7dd"); pub const CLSID_NetFwPolicy2 = &CLSID_NetFwPolicy2_Value; const CLSID_NetFwProduct_Value = Guid.initString("9d745ed8-c514-4d1d-bf42-751fed2d5ac7"); pub const CLSID_NetFwProduct = &CLSID_NetFwProduct_Value; const CLSID_NetFwProducts_Value = Guid.initString("cc19079b-8272-4d73-bb70-cdb533527b61"); pub const CLSID_NetFwProducts = &CLSID_NetFwProducts_Value; const CLSID_NetFwMgr_Value = Guid.initString("304ce942-6e39-40d8-943a-b913c40c9cd4"); pub const CLSID_NetFwMgr = &CLSID_NetFwMgr_Value; pub const NET_FW_POLICY_TYPE = enum(i32) { GROUP = 0, LOCAL = 1, EFFECTIVE = 2, TYPE_MAX = 3, }; pub const NET_FW_POLICY_GROUP = NET_FW_POLICY_TYPE.GROUP; pub const NET_FW_POLICY_LOCAL = NET_FW_POLICY_TYPE.LOCAL; pub const NET_FW_POLICY_EFFECTIVE = NET_FW_POLICY_TYPE.EFFECTIVE; pub const NET_FW_POLICY_TYPE_MAX = NET_FW_POLICY_TYPE.TYPE_MAX; pub const NET_FW_PROFILE_TYPE = enum(i32) { DOMAIN = 0, STANDARD = 1, CURRENT = 2, TYPE_MAX = 3, }; pub const NET_FW_PROFILE_DOMAIN = NET_FW_PROFILE_TYPE.DOMAIN; pub const NET_FW_PROFILE_STANDARD = NET_FW_PROFILE_TYPE.STANDARD; pub const NET_FW_PROFILE_CURRENT = NET_FW_PROFILE_TYPE.CURRENT; pub const NET_FW_PROFILE_TYPE_MAX = NET_FW_PROFILE_TYPE.TYPE_MAX; pub const NET_FW_PROFILE_TYPE2 = enum(i32) { DOMAIN = 1, PRIVATE = 2, PUBLIC = 4, ALL = 2147483647, }; pub const NET_FW_PROFILE2_DOMAIN = NET_FW_PROFILE_TYPE2.DOMAIN; pub const NET_FW_PROFILE2_PRIVATE = NET_FW_PROFILE_TYPE2.PRIVATE; pub const NET_FW_PROFILE2_PUBLIC = NET_FW_PROFILE_TYPE2.PUBLIC; pub const NET_FW_PROFILE2_ALL = NET_FW_PROFILE_TYPE2.ALL; pub const NET_FW_IP_VERSION = enum(i32) { V4 = 0, V6 = 1, ANY = 2, MAX = 3, }; pub const NET_FW_IP_VERSION_V4 = NET_FW_IP_VERSION.V4; pub const NET_FW_IP_VERSION_V6 = NET_FW_IP_VERSION.V6; pub const NET_FW_IP_VERSION_ANY = NET_FW_IP_VERSION.ANY; pub const NET_FW_IP_VERSION_MAX = NET_FW_IP_VERSION.MAX; pub const NET_FW_SCOPE = enum(i32) { ALL = 0, LOCAL_SUBNET = 1, CUSTOM = 2, MAX = 3, }; pub const NET_FW_SCOPE_ALL = NET_FW_SCOPE.ALL; pub const NET_FW_SCOPE_LOCAL_SUBNET = NET_FW_SCOPE.LOCAL_SUBNET; pub const NET_FW_SCOPE_CUSTOM = NET_FW_SCOPE.CUSTOM; pub const NET_FW_SCOPE_MAX = NET_FW_SCOPE.MAX; pub const NET_FW_IP_PROTOCOL = enum(i32) { TCP = 6, UDP = 17, ANY = 256, }; pub const NET_FW_IP_PROTOCOL_TCP = NET_FW_IP_PROTOCOL.TCP; pub const NET_FW_IP_PROTOCOL_UDP = NET_FW_IP_PROTOCOL.UDP; pub const NET_FW_IP_PROTOCOL_ANY = NET_FW_IP_PROTOCOL.ANY; pub const NET_FW_SERVICE_TYPE = enum(i32) { FILE_AND_PRINT = 0, UPNP = 1, REMOTE_DESKTOP = 2, NONE = 3, TYPE_MAX = 4, }; pub const NET_FW_SERVICE_FILE_AND_PRINT = NET_FW_SERVICE_TYPE.FILE_AND_PRINT; pub const NET_FW_SERVICE_UPNP = NET_FW_SERVICE_TYPE.UPNP; pub const NET_FW_SERVICE_REMOTE_DESKTOP = NET_FW_SERVICE_TYPE.REMOTE_DESKTOP; pub const NET_FW_SERVICE_NONE = NET_FW_SERVICE_TYPE.NONE; pub const NET_FW_SERVICE_TYPE_MAX = NET_FW_SERVICE_TYPE.TYPE_MAX; pub const NET_FW_RULE_DIRECTION = enum(i32) { IN = 1, OUT = 2, MAX = 3, }; pub const NET_FW_RULE_DIR_IN = NET_FW_RULE_DIRECTION.IN; pub const NET_FW_RULE_DIR_OUT = NET_FW_RULE_DIRECTION.OUT; pub const NET_FW_RULE_DIR_MAX = NET_FW_RULE_DIRECTION.MAX; pub const NET_FW_ACTION = enum(i32) { BLOCK = 0, ALLOW = 1, MAX = 2, }; pub const NET_FW_ACTION_BLOCK = NET_FW_ACTION.BLOCK; pub const NET_FW_ACTION_ALLOW = NET_FW_ACTION.ALLOW; pub const NET_FW_ACTION_MAX = NET_FW_ACTION.MAX; pub const NET_FW_MODIFY_STATE = enum(i32) { OK = 0, GP_OVERRIDE = 1, INBOUND_BLOCKED = 2, }; pub const NET_FW_MODIFY_STATE_OK = NET_FW_MODIFY_STATE.OK; pub const NET_FW_MODIFY_STATE_GP_OVERRIDE = NET_FW_MODIFY_STATE.GP_OVERRIDE; pub const NET_FW_MODIFY_STATE_INBOUND_BLOCKED = NET_FW_MODIFY_STATE.INBOUND_BLOCKED; pub const NET_FW_RULE_CATEGORY = enum(i32) { BOOT = 0, STEALTH = 1, FIREWALL = 2, CONSEC = 3, MAX = 4, }; pub const NET_FW_RULE_CATEGORY_BOOT = NET_FW_RULE_CATEGORY.BOOT; pub const NET_FW_RULE_CATEGORY_STEALTH = NET_FW_RULE_CATEGORY.STEALTH; pub const NET_FW_RULE_CATEGORY_FIREWALL = NET_FW_RULE_CATEGORY.FIREWALL; pub const NET_FW_RULE_CATEGORY_CONSEC = NET_FW_RULE_CATEGORY.CONSEC; pub const NET_FW_RULE_CATEGORY_MAX = NET_FW_RULE_CATEGORY.MAX; pub const NET_FW_EDGE_TRAVERSAL_TYPE = enum(i32) { DENY = 0, ALLOW = 1, DEFER_TO_APP = 2, DEFER_TO_USER = 3, }; pub const NET_FW_EDGE_TRAVERSAL_TYPE_DENY = NET_FW_EDGE_TRAVERSAL_TYPE.DENY; pub const NET_FW_EDGE_TRAVERSAL_TYPE_ALLOW = NET_FW_EDGE_TRAVERSAL_TYPE.ALLOW; pub const NET_FW_EDGE_TRAVERSAL_TYPE_DEFER_TO_APP = NET_FW_EDGE_TRAVERSAL_TYPE.DEFER_TO_APP; pub const NET_FW_EDGE_TRAVERSAL_TYPE_DEFER_TO_USER = NET_FW_EDGE_TRAVERSAL_TYPE.DEFER_TO_USER; pub const NET_FW_AUTHENTICATE_TYPE = enum(i32) { NONE = 0, NO_ENCAPSULATION = 1, WITH_INTEGRITY = 2, AND_NEGOTIATE_ENCRYPTION = 3, AND_ENCRYPT = 4, }; pub const NET_FW_AUTHENTICATE_NONE = NET_FW_AUTHENTICATE_TYPE.NONE; pub const NET_FW_AUTHENTICATE_NO_ENCAPSULATION = NET_FW_AUTHENTICATE_TYPE.NO_ENCAPSULATION; pub const NET_FW_AUTHENTICATE_WITH_INTEGRITY = NET_FW_AUTHENTICATE_TYPE.WITH_INTEGRITY; pub const NET_FW_AUTHENTICATE_AND_NEGOTIATE_ENCRYPTION = NET_FW_AUTHENTICATE_TYPE.AND_NEGOTIATE_ENCRYPTION; pub const NET_FW_AUTHENTICATE_AND_ENCRYPT = NET_FW_AUTHENTICATE_TYPE.AND_ENCRYPT; pub const NETISO_FLAG = enum(i32) { FORCE_COMPUTE_BINARIES = 1, MAX = 2, }; pub const NETISO_FLAG_FORCE_COMPUTE_BINARIES = NETISO_FLAG.FORCE_COMPUTE_BINARIES; pub const NETISO_FLAG_MAX = NETISO_FLAG.MAX; pub const INET_FIREWALL_AC_CREATION_TYPE = enum(i32) { NONE = 0, PACKAGE_ID_ONLY = 1, BINARY = 2, MAX = 4, }; pub const INET_FIREWALL_AC_NONE = INET_FIREWALL_AC_CREATION_TYPE.NONE; pub const INET_FIREWALL_AC_PACKAGE_ID_ONLY = INET_FIREWALL_AC_CREATION_TYPE.PACKAGE_ID_ONLY; pub const INET_FIREWALL_AC_BINARY = INET_FIREWALL_AC_CREATION_TYPE.BINARY; pub const INET_FIREWALL_AC_MAX = INET_FIREWALL_AC_CREATION_TYPE.MAX; pub const INET_FIREWALL_AC_CHANGE_TYPE = enum(i32) { INVALID = 0, CREATE = 1, DELETE = 2, MAX = 3, }; pub const INET_FIREWALL_AC_CHANGE_INVALID = INET_FIREWALL_AC_CHANGE_TYPE.INVALID; pub const INET_FIREWALL_AC_CHANGE_CREATE = INET_FIREWALL_AC_CHANGE_TYPE.CREATE; pub const INET_FIREWALL_AC_CHANGE_DELETE = INET_FIREWALL_AC_CHANGE_TYPE.DELETE; pub const INET_FIREWALL_AC_CHANGE_MAX = INET_FIREWALL_AC_CHANGE_TYPE.MAX; pub const INET_FIREWALL_AC_CAPABILITIES = extern struct { count: u32, capabilities: ?*SID_AND_ATTRIBUTES, }; pub const INET_FIREWALL_AC_BINARIES = extern struct { count: u32, binaries: ?*?PWSTR, }; pub const INET_FIREWALL_AC_CHANGE = extern struct { changeType: INET_FIREWALL_AC_CHANGE_TYPE, createType: INET_FIREWALL_AC_CREATION_TYPE, appContainerSid: ?*SID, userSid: ?*SID, displayName: ?PWSTR, Anonymous: extern union { capabilities: INET_FIREWALL_AC_CAPABILITIES, binaries: INET_FIREWALL_AC_BINARIES, }, }; pub const INET_FIREWALL_APP_CONTAINER = extern struct { appContainerSid: ?*SID, userSid: ?*SID, appContainerName: ?PWSTR, displayName: ?PWSTR, description: ?PWSTR, capabilities: INET_FIREWALL_AC_CAPABILITIES, binaries: INET_FIREWALL_AC_BINARIES, workingDirectory: ?PWSTR, packageFullName: ?PWSTR, }; pub const PAC_CHANGES_CALLBACK_FN = fn( context: ?*anyopaque, pChange: ?*const INET_FIREWALL_AC_CHANGE, ) callconv(@import("std").os.windows.WINAPI) void; pub const NETISO_ERROR_TYPE = enum(i32) { NONE = 0, PRIVATE_NETWORK = 1, INTERNET_CLIENT = 2, INTERNET_CLIENT_SERVER = 3, MAX = 4, }; pub const NETISO_ERROR_TYPE_NONE = NETISO_ERROR_TYPE.NONE; pub const NETISO_ERROR_TYPE_PRIVATE_NETWORK = NETISO_ERROR_TYPE.PRIVATE_NETWORK; pub const NETISO_ERROR_TYPE_INTERNET_CLIENT = NETISO_ERROR_TYPE.INTERNET_CLIENT; pub const NETISO_ERROR_TYPE_INTERNET_CLIENT_SERVER = NETISO_ERROR_TYPE.INTERNET_CLIENT_SERVER; pub const NETISO_ERROR_TYPE_MAX = NETISO_ERROR_TYPE.MAX; pub const PNETISO_EDP_ID_CALLBACK_FN = fn( context: ?*anyopaque, wszEnterpriseId: ?[*:0]const u16, dwErr: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const _tag_FW_DYNAMIC_KEYWORD_ORIGIN_TYPE = enum(i32) { INVALID = 0, LOCAL = 1, MDM = 2, }; pub const FW_DYNAMIC_KEYWORD_ORIGIN_INVALID = _tag_FW_DYNAMIC_KEYWORD_ORIGIN_TYPE.INVALID; pub const FW_DYNAMIC_KEYWORD_ORIGIN_LOCAL = _tag_FW_DYNAMIC_KEYWORD_ORIGIN_TYPE.LOCAL; pub const FW_DYNAMIC_KEYWORD_ORIGIN_MDM = _tag_FW_DYNAMIC_KEYWORD_ORIGIN_TYPE.MDM; pub const _tag_FW_DYNAMIC_KEYWORD_ADDRESS0 = extern struct { id: Guid, keyword: ?[*:0]const u16, flags: u32, addresses: ?[*:0]const u16, }; pub const _tag_FW_DYNAMIC_KEYWORD_ADDRESS_DATA0 = extern struct { dynamicKeywordAddress: _tag_FW_DYNAMIC_KEYWORD_ADDRESS0, next: ?*_tag_FW_DYNAMIC_KEYWORD_ADDRESS_DATA0, schemaVersion: u16, originType: _tag_FW_DYNAMIC_KEYWORD_ORIGIN_TYPE, }; pub const _tag_FW_DYNAMIC_KEYWORD_ADDRESS_FLAGS = enum(i32) { E = 1, }; pub const FW_DYNAMIC_KEYWORD_ADDRESS_FLAGS_AUTO_RESOLVE = _tag_FW_DYNAMIC_KEYWORD_ADDRESS_FLAGS.E; pub const _tag_FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS = enum(i32) { AUTO_RESOLVE = 1, NON_AUTO_RESOLVE = 2, ALL = 3, }; pub const FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS_AUTO_RESOLVE = _tag_FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS.AUTO_RESOLVE; pub const FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS_NON_AUTO_RESOLVE = _tag_FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS.NON_AUTO_RESOLVE; pub const FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS_ALL = _tag_FW_DYNAMIC_KEYWORD_ADDRESS_ENUM_FLAGS.ALL; pub const PFN_FWADDDYNAMICKEYWORDADDRESS0 = fn( dynamicKeywordAddress: ?*const _tag_FW_DYNAMIC_KEYWORD_ADDRESS0, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFN_FWDELETEDYNAMICKEYWORDADDRESS0 = fn( dynamicKeywordAddressId: Guid, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFN_FWENUMDYNAMICKEYWORDADDRESSESBYTYPE0 = fn( flags: u32, dynamicKeywordAddressData: ?*?*_tag_FW_DYNAMIC_KEYWORD_ADDRESS_DATA0, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFN_FWENUMDYNAMICKEYWORDADDRESSBYID0 = fn( dynamicKeywordAddressId: Guid, dynamicKeywordAddressData: ?*?*_tag_FW_DYNAMIC_KEYWORD_ADDRESS_DATA0, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFN_FWFREEDYNAMICKEYWORDADDRESSDATA0 = fn( dynamicKeywordAddressData: ?*_tag_FW_DYNAMIC_KEYWORD_ADDRESS_DATA0, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFN_FWUPDATEDYNAMICKEYWORDADDRESS0 = fn( dynamicKeywordAddressId: Guid, updatedAddresses: ?[*:0]const u16, append: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwRemoteAdminSettings_Value = Guid.initString("d4becddf-6f73-4a83-b832-9c66874cd20e"); pub const IID_INetFwRemoteAdminSettings = &IID_INetFwRemoteAdminSettings_Value; pub const INetFwRemoteAdminSettings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IpVersion: fn( self: *const INetFwRemoteAdminSettings, ipVersion: ?*NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IpVersion: fn( self: *const INetFwRemoteAdminSettings, ipVersion: NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Scope: fn( self: *const INetFwRemoteAdminSettings, scope: ?*NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Scope: fn( self: *const INetFwRemoteAdminSettings, scope: NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteAddresses: fn( self: *const INetFwRemoteAdminSettings, remoteAddrs: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteAddresses: fn( self: *const INetFwRemoteAdminSettings, remoteAddrs: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const INetFwRemoteAdminSettings, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const INetFwRemoteAdminSettings, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_get_IpVersion(self: *const T, ipVersion: ?*NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).get_IpVersion(@ptrCast(*const INetFwRemoteAdminSettings, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_put_IpVersion(self: *const T, ipVersion: NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).put_IpVersion(@ptrCast(*const INetFwRemoteAdminSettings, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_get_Scope(self: *const T, scope: ?*NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).get_Scope(@ptrCast(*const INetFwRemoteAdminSettings, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_put_Scope(self: *const T, scope: NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).put_Scope(@ptrCast(*const INetFwRemoteAdminSettings, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_get_RemoteAddresses(self: *const T, remoteAddrs: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).get_RemoteAddresses(@ptrCast(*const INetFwRemoteAdminSettings, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_put_RemoteAddresses(self: *const T, remoteAddrs: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).put_RemoteAddresses(@ptrCast(*const INetFwRemoteAdminSettings, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_get_Enabled(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).get_Enabled(@ptrCast(*const INetFwRemoteAdminSettings, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRemoteAdminSettings_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRemoteAdminSettings.VTable, self.vtable).put_Enabled(@ptrCast(*const INetFwRemoteAdminSettings, self), enabled); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwIcmpSettings_Value = Guid.initString("a6207b2e-7cdd-426a-951e-5e1cbc5afead"); pub const IID_INetFwIcmpSettings = &IID_INetFwIcmpSettings_Value; pub const INetFwIcmpSettings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowOutboundDestinationUnreachable: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowOutboundDestinationUnreachable: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowRedirect: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowRedirect: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowInboundEchoRequest: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowInboundEchoRequest: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowOutboundTimeExceeded: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowOutboundTimeExceeded: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowOutboundParameterProblem: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowOutboundParameterProblem: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowOutboundSourceQuench: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowOutboundSourceQuench: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowInboundRouterRequest: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowInboundRouterRequest: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowInboundTimestampRequest: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowInboundTimestampRequest: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowInboundMaskRequest: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowInboundMaskRequest: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowOutboundPacketTooBig: fn( self: *const INetFwIcmpSettings, allow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowOutboundPacketTooBig: fn( self: *const INetFwIcmpSettings, allow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowOutboundDestinationUnreachable(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowOutboundDestinationUnreachable(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowOutboundDestinationUnreachable(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowOutboundDestinationUnreachable(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowRedirect(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowRedirect(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowRedirect(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowRedirect(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowInboundEchoRequest(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowInboundEchoRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowInboundEchoRequest(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowInboundEchoRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowOutboundTimeExceeded(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowOutboundTimeExceeded(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowOutboundTimeExceeded(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowOutboundTimeExceeded(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowOutboundParameterProblem(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowOutboundParameterProblem(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowOutboundParameterProblem(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowOutboundParameterProblem(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowOutboundSourceQuench(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowOutboundSourceQuench(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowOutboundSourceQuench(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowOutboundSourceQuench(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowInboundRouterRequest(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowInboundRouterRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowInboundRouterRequest(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowInboundRouterRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowInboundTimestampRequest(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowInboundTimestampRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowInboundTimestampRequest(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowInboundTimestampRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowInboundMaskRequest(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowInboundMaskRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowInboundMaskRequest(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowInboundMaskRequest(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_get_AllowOutboundPacketTooBig(self: *const T, allow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).get_AllowOutboundPacketTooBig(@ptrCast(*const INetFwIcmpSettings, self), allow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwIcmpSettings_put_AllowOutboundPacketTooBig(self: *const T, allow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwIcmpSettings.VTable, self.vtable).put_AllowOutboundPacketTooBig(@ptrCast(*const INetFwIcmpSettings, self), allow); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwOpenPort_Value = Guid.initString("e0483ba0-47ff-4d9c-a6d6-7741d0b195f7"); pub const IID_INetFwOpenPort = &IID_INetFwOpenPort_Value; pub const INetFwOpenPort = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetFwOpenPort, name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const INetFwOpenPort, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IpVersion: fn( self: *const INetFwOpenPort, ipVersion: ?*NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IpVersion: fn( self: *const INetFwOpenPort, ipVersion: NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Protocol: fn( self: *const INetFwOpenPort, ipProtocol: ?*NET_FW_IP_PROTOCOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Protocol: fn( self: *const INetFwOpenPort, ipProtocol: NET_FW_IP_PROTOCOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Port: fn( self: *const INetFwOpenPort, portNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Port: fn( self: *const INetFwOpenPort, portNumber: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Scope: fn( self: *const INetFwOpenPort, scope: ?*NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Scope: fn( self: *const INetFwOpenPort, scope: NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteAddresses: fn( self: *const INetFwOpenPort, remoteAddrs: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteAddresses: fn( self: *const INetFwOpenPort, remoteAddrs: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const INetFwOpenPort, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const INetFwOpenPort, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BuiltIn: fn( self: *const INetFwOpenPort, builtIn: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_Name(self: *const T, name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_Name(@ptrCast(*const INetFwOpenPort, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_Name(@ptrCast(*const INetFwOpenPort, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_IpVersion(self: *const T, ipVersion: ?*NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_IpVersion(@ptrCast(*const INetFwOpenPort, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_IpVersion(self: *const T, ipVersion: NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_IpVersion(@ptrCast(*const INetFwOpenPort, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_Protocol(self: *const T, ipProtocol: ?*NET_FW_IP_PROTOCOL) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_Protocol(@ptrCast(*const INetFwOpenPort, self), ipProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_Protocol(self: *const T, ipProtocol: NET_FW_IP_PROTOCOL) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_Protocol(@ptrCast(*const INetFwOpenPort, self), ipProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_Port(self: *const T, portNumber: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_Port(@ptrCast(*const INetFwOpenPort, self), portNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_Port(self: *const T, portNumber: i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_Port(@ptrCast(*const INetFwOpenPort, self), portNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_Scope(self: *const T, scope: ?*NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_Scope(@ptrCast(*const INetFwOpenPort, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_Scope(self: *const T, scope: NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_Scope(@ptrCast(*const INetFwOpenPort, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_RemoteAddresses(self: *const T, remoteAddrs: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_RemoteAddresses(@ptrCast(*const INetFwOpenPort, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_RemoteAddresses(self: *const T, remoteAddrs: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_RemoteAddresses(@ptrCast(*const INetFwOpenPort, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_Enabled(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_Enabled(@ptrCast(*const INetFwOpenPort, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).put_Enabled(@ptrCast(*const INetFwOpenPort, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPort_get_BuiltIn(self: *const T, builtIn: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPort.VTable, self.vtable).get_BuiltIn(@ptrCast(*const INetFwOpenPort, self), builtIn); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwOpenPorts_Value = Guid.initString("c0e9d7fa-e07e-430a-b19a-090ce82d92e2"); pub const IID_INetFwOpenPorts = &IID_INetFwOpenPorts_Value; pub const INetFwOpenPorts = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetFwOpenPorts, count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const INetFwOpenPorts, port: ?*INetFwOpenPort, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const INetFwOpenPorts, portNumber: i32, ipProtocol: NET_FW_IP_PROTOCOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const INetFwOpenPorts, portNumber: i32, ipProtocol: NET_FW_IP_PROTOCOL, openPort: ?*?*INetFwOpenPort, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetFwOpenPorts, newEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPorts_get_Count(self: *const T, count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPorts.VTable, self.vtable).get_Count(@ptrCast(*const INetFwOpenPorts, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPorts_Add(self: *const T, port: ?*INetFwOpenPort) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPorts.VTable, self.vtable).Add(@ptrCast(*const INetFwOpenPorts, self), port); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPorts_Remove(self: *const T, portNumber: i32, ipProtocol: NET_FW_IP_PROTOCOL) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPorts.VTable, self.vtable).Remove(@ptrCast(*const INetFwOpenPorts, self), portNumber, ipProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPorts_Item(self: *const T, portNumber: i32, ipProtocol: NET_FW_IP_PROTOCOL, openPort: ?*?*INetFwOpenPort) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPorts.VTable, self.vtable).Item(@ptrCast(*const INetFwOpenPorts, self), portNumber, ipProtocol, openPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwOpenPorts_get__NewEnum(self: *const T, newEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwOpenPorts.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetFwOpenPorts, self), newEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwService_Value = Guid.initString("79fd57c8-908e-4a36-9888-d5b3f0a444cf"); pub const IID_INetFwService = &IID_INetFwService_Value; pub const INetFwService = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetFwService, name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const INetFwService, type: ?*NET_FW_SERVICE_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Customized: fn( self: *const INetFwService, customized: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IpVersion: fn( self: *const INetFwService, ipVersion: ?*NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IpVersion: fn( self: *const INetFwService, ipVersion: NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Scope: fn( self: *const INetFwService, scope: ?*NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Scope: fn( self: *const INetFwService, scope: NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteAddresses: fn( self: *const INetFwService, remoteAddrs: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteAddresses: fn( self: *const INetFwService, remoteAddrs: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const INetFwService, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const INetFwService, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_GloballyOpenPorts: fn( self: *const INetFwService, openPorts: ?*?*INetFwOpenPorts, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_Name(self: *const T, name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_Name(@ptrCast(*const INetFwService, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_Type(self: *const T, type_: ?*NET_FW_SERVICE_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_Type(@ptrCast(*const INetFwService, self), type_); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_Customized(self: *const T, customized: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_Customized(@ptrCast(*const INetFwService, self), customized); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_IpVersion(self: *const T, ipVersion: ?*NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_IpVersion(@ptrCast(*const INetFwService, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_put_IpVersion(self: *const T, ipVersion: NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).put_IpVersion(@ptrCast(*const INetFwService, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_Scope(self: *const T, scope: ?*NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_Scope(@ptrCast(*const INetFwService, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_put_Scope(self: *const T, scope: NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).put_Scope(@ptrCast(*const INetFwService, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_RemoteAddresses(self: *const T, remoteAddrs: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_RemoteAddresses(@ptrCast(*const INetFwService, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_put_RemoteAddresses(self: *const T, remoteAddrs: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).put_RemoteAddresses(@ptrCast(*const INetFwService, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_Enabled(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_Enabled(@ptrCast(*const INetFwService, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).put_Enabled(@ptrCast(*const INetFwService, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwService_get_GloballyOpenPorts(self: *const T, openPorts: ?*?*INetFwOpenPorts) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwService.VTable, self.vtable).get_GloballyOpenPorts(@ptrCast(*const INetFwService, self), openPorts); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwServices_Value = Guid.initString("79649bb4-903e-421b-94c9-79848e79f6ee"); pub const IID_INetFwServices = &IID_INetFwServices_Value; pub const INetFwServices = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetFwServices, count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const INetFwServices, svcType: NET_FW_SERVICE_TYPE, service: ?*?*INetFwService, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetFwServices, newEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwServices_get_Count(self: *const T, count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwServices.VTable, self.vtable).get_Count(@ptrCast(*const INetFwServices, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwServices_Item(self: *const T, svcType: NET_FW_SERVICE_TYPE, service: ?*?*INetFwService) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwServices.VTable, self.vtable).Item(@ptrCast(*const INetFwServices, self), svcType, service); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwServices_get__NewEnum(self: *const T, newEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwServices.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetFwServices, self), newEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwAuthorizedApplication_Value = Guid.initString("b5e64ffa-c2c5-444e-a301-fb5e00018050"); pub const IID_INetFwAuthorizedApplication = &IID_INetFwAuthorizedApplication_Value; pub const INetFwAuthorizedApplication = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetFwAuthorizedApplication, name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const INetFwAuthorizedApplication, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ProcessImageFileName: fn( self: *const INetFwAuthorizedApplication, imageFileName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ProcessImageFileName: fn( self: *const INetFwAuthorizedApplication, imageFileName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IpVersion: fn( self: *const INetFwAuthorizedApplication, ipVersion: ?*NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IpVersion: fn( self: *const INetFwAuthorizedApplication, ipVersion: NET_FW_IP_VERSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Scope: fn( self: *const INetFwAuthorizedApplication, scope: ?*NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Scope: fn( self: *const INetFwAuthorizedApplication, scope: NET_FW_SCOPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteAddresses: fn( self: *const INetFwAuthorizedApplication, remoteAddrs: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteAddresses: fn( self: *const INetFwAuthorizedApplication, remoteAddrs: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const INetFwAuthorizedApplication, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const INetFwAuthorizedApplication, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_get_Name(self: *const T, name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).get_Name(@ptrCast(*const INetFwAuthorizedApplication, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).put_Name(@ptrCast(*const INetFwAuthorizedApplication, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_get_ProcessImageFileName(self: *const T, imageFileName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).get_ProcessImageFileName(@ptrCast(*const INetFwAuthorizedApplication, self), imageFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_put_ProcessImageFileName(self: *const T, imageFileName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).put_ProcessImageFileName(@ptrCast(*const INetFwAuthorizedApplication, self), imageFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_get_IpVersion(self: *const T, ipVersion: ?*NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).get_IpVersion(@ptrCast(*const INetFwAuthorizedApplication, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_put_IpVersion(self: *const T, ipVersion: NET_FW_IP_VERSION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).put_IpVersion(@ptrCast(*const INetFwAuthorizedApplication, self), ipVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_get_Scope(self: *const T, scope: ?*NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).get_Scope(@ptrCast(*const INetFwAuthorizedApplication, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_put_Scope(self: *const T, scope: NET_FW_SCOPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).put_Scope(@ptrCast(*const INetFwAuthorizedApplication, self), scope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_get_RemoteAddresses(self: *const T, remoteAddrs: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).get_RemoteAddresses(@ptrCast(*const INetFwAuthorizedApplication, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_put_RemoteAddresses(self: *const T, remoteAddrs: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).put_RemoteAddresses(@ptrCast(*const INetFwAuthorizedApplication, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_get_Enabled(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).get_Enabled(@ptrCast(*const INetFwAuthorizedApplication, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplication_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplication.VTable, self.vtable).put_Enabled(@ptrCast(*const INetFwAuthorizedApplication, self), enabled); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwAuthorizedApplications_Value = Guid.initString("644efd52-ccf9-486c-97a2-39f352570b30"); pub const IID_INetFwAuthorizedApplications = &IID_INetFwAuthorizedApplications_Value; pub const INetFwAuthorizedApplications = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetFwAuthorizedApplications, count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const INetFwAuthorizedApplications, app: ?*INetFwAuthorizedApplication, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const INetFwAuthorizedApplications, imageFileName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const INetFwAuthorizedApplications, imageFileName: ?BSTR, app: ?*?*INetFwAuthorizedApplication, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetFwAuthorizedApplications, newEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplications_get_Count(self: *const T, count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplications.VTable, self.vtable).get_Count(@ptrCast(*const INetFwAuthorizedApplications, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplications_Add(self: *const T, app: ?*INetFwAuthorizedApplication) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplications.VTable, self.vtable).Add(@ptrCast(*const INetFwAuthorizedApplications, self), app); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplications_Remove(self: *const T, imageFileName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplications.VTable, self.vtable).Remove(@ptrCast(*const INetFwAuthorizedApplications, self), imageFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplications_Item(self: *const T, imageFileName: ?BSTR, app: ?*?*INetFwAuthorizedApplication) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplications.VTable, self.vtable).Item(@ptrCast(*const INetFwAuthorizedApplications, self), imageFileName, app); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwAuthorizedApplications_get__NewEnum(self: *const T, newEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwAuthorizedApplications.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetFwAuthorizedApplications, self), newEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwRule_Value = Guid.initString("af230d27-baba-4e42-aced-f524f22cfce2"); pub const IID_INetFwRule = &IID_INetFwRule_Value; pub const INetFwRule = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetFwRule, name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const INetFwRule, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Description: fn( self: *const INetFwRule, desc: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Description: fn( self: *const INetFwRule, desc: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ApplicationName: fn( self: *const INetFwRule, imageFileName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ApplicationName: fn( self: *const INetFwRule, imageFileName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ServiceName: fn( self: *const INetFwRule, serviceName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ServiceName: fn( self: *const INetFwRule, serviceName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Protocol: fn( self: *const INetFwRule, protocol: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Protocol: fn( self: *const INetFwRule, protocol: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalPorts: fn( self: *const INetFwRule, portNumbers: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LocalPorts: fn( self: *const INetFwRule, portNumbers: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemotePorts: fn( self: *const INetFwRule, portNumbers: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemotePorts: fn( self: *const INetFwRule, portNumbers: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalAddresses: fn( self: *const INetFwRule, localAddrs: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LocalAddresses: fn( self: *const INetFwRule, localAddrs: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteAddresses: fn( self: *const INetFwRule, remoteAddrs: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteAddresses: fn( self: *const INetFwRule, remoteAddrs: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IcmpTypesAndCodes: fn( self: *const INetFwRule, icmpTypesAndCodes: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IcmpTypesAndCodes: fn( self: *const INetFwRule, icmpTypesAndCodes: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Direction: fn( self: *const INetFwRule, dir: ?*NET_FW_RULE_DIRECTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Direction: fn( self: *const INetFwRule, dir: NET_FW_RULE_DIRECTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Interfaces: fn( self: *const INetFwRule, interfaces: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Interfaces: fn( self: *const INetFwRule, interfaces: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InterfaceTypes: fn( self: *const INetFwRule, interfaceTypes: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_InterfaceTypes: fn( self: *const INetFwRule, interfaceTypes: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const INetFwRule, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const INetFwRule, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Grouping: fn( self: *const INetFwRule, context: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Grouping: fn( self: *const INetFwRule, context: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Profiles: fn( self: *const INetFwRule, profileTypesBitmask: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Profiles: fn( self: *const INetFwRule, profileTypesBitmask: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EdgeTraversal: fn( self: *const INetFwRule, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EdgeTraversal: fn( self: *const INetFwRule, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Action: fn( self: *const INetFwRule, action: ?*NET_FW_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Action: fn( self: *const INetFwRule, action: NET_FW_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Name(self: *const T, name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Name(@ptrCast(*const INetFwRule, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Name(@ptrCast(*const INetFwRule, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Description(self: *const T, desc: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Description(@ptrCast(*const INetFwRule, self), desc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Description(self: *const T, desc: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Description(@ptrCast(*const INetFwRule, self), desc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_ApplicationName(self: *const T, imageFileName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_ApplicationName(@ptrCast(*const INetFwRule, self), imageFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_ApplicationName(self: *const T, imageFileName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_ApplicationName(@ptrCast(*const INetFwRule, self), imageFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_ServiceName(self: *const T, serviceName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_ServiceName(@ptrCast(*const INetFwRule, self), serviceName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_ServiceName(self: *const T, serviceName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_ServiceName(@ptrCast(*const INetFwRule, self), serviceName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Protocol(self: *const T, protocol: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Protocol(@ptrCast(*const INetFwRule, self), protocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Protocol(self: *const T, protocol: i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Protocol(@ptrCast(*const INetFwRule, self), protocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_LocalPorts(self: *const T, portNumbers: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_LocalPorts(@ptrCast(*const INetFwRule, self), portNumbers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_LocalPorts(self: *const T, portNumbers: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_LocalPorts(@ptrCast(*const INetFwRule, self), portNumbers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_RemotePorts(self: *const T, portNumbers: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_RemotePorts(@ptrCast(*const INetFwRule, self), portNumbers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_RemotePorts(self: *const T, portNumbers: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_RemotePorts(@ptrCast(*const INetFwRule, self), portNumbers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_LocalAddresses(self: *const T, localAddrs: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_LocalAddresses(@ptrCast(*const INetFwRule, self), localAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_LocalAddresses(self: *const T, localAddrs: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_LocalAddresses(@ptrCast(*const INetFwRule, self), localAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_RemoteAddresses(self: *const T, remoteAddrs: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_RemoteAddresses(@ptrCast(*const INetFwRule, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_RemoteAddresses(self: *const T, remoteAddrs: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_RemoteAddresses(@ptrCast(*const INetFwRule, self), remoteAddrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_IcmpTypesAndCodes(self: *const T, icmpTypesAndCodes: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_IcmpTypesAndCodes(@ptrCast(*const INetFwRule, self), icmpTypesAndCodes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_IcmpTypesAndCodes(self: *const T, icmpTypesAndCodes: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_IcmpTypesAndCodes(@ptrCast(*const INetFwRule, self), icmpTypesAndCodes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Direction(self: *const T, dir: ?*NET_FW_RULE_DIRECTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Direction(@ptrCast(*const INetFwRule, self), dir); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Direction(self: *const T, dir: NET_FW_RULE_DIRECTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Direction(@ptrCast(*const INetFwRule, self), dir); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Interfaces(self: *const T, interfaces: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Interfaces(@ptrCast(*const INetFwRule, self), interfaces); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Interfaces(self: *const T, interfaces: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Interfaces(@ptrCast(*const INetFwRule, self), interfaces); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_InterfaceTypes(self: *const T, interfaceTypes: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_InterfaceTypes(@ptrCast(*const INetFwRule, self), interfaceTypes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_InterfaceTypes(self: *const T, interfaceTypes: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_InterfaceTypes(@ptrCast(*const INetFwRule, self), interfaceTypes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Enabled(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Enabled(@ptrCast(*const INetFwRule, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Enabled(@ptrCast(*const INetFwRule, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Grouping(self: *const T, context: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Grouping(@ptrCast(*const INetFwRule, self), context); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Grouping(self: *const T, context: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Grouping(@ptrCast(*const INetFwRule, self), context); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Profiles(self: *const T, profileTypesBitmask: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Profiles(@ptrCast(*const INetFwRule, self), profileTypesBitmask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Profiles(self: *const T, profileTypesBitmask: i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Profiles(@ptrCast(*const INetFwRule, self), profileTypesBitmask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_EdgeTraversal(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_EdgeTraversal(@ptrCast(*const INetFwRule, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_EdgeTraversal(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_EdgeTraversal(@ptrCast(*const INetFwRule, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_get_Action(self: *const T, action: ?*NET_FW_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).get_Action(@ptrCast(*const INetFwRule, self), action); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule_put_Action(self: *const T, action: NET_FW_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule.VTable, self.vtable).put_Action(@ptrCast(*const INetFwRule, self), action); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_INetFwRule2_Value = Guid.initString("9c27c8da-189b-4dde-89f7-8b39a316782c"); pub const IID_INetFwRule2 = &IID_INetFwRule2_Value; pub const INetFwRule2 = extern struct { pub const VTable = extern struct { base: INetFwRule.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EdgeTraversalOptions: fn( self: *const INetFwRule2, lOptions: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EdgeTraversalOptions: fn( self: *const INetFwRule2, lOptions: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace INetFwRule.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule2_get_EdgeTraversalOptions(self: *const T, lOptions: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule2.VTable, self.vtable).get_EdgeTraversalOptions(@ptrCast(*const INetFwRule2, self), lOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule2_put_EdgeTraversalOptions(self: *const T, lOptions: i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule2.VTable, self.vtable).put_EdgeTraversalOptions(@ptrCast(*const INetFwRule2, self), lOptions); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_INetFwRule3_Value = Guid.initString("b21563ff-d696-4222-ab46-4e89b73ab34a"); pub const IID_INetFwRule3 = &IID_INetFwRule3_Value; pub const INetFwRule3 = extern struct { pub const VTable = extern struct { base: INetFwRule2.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalAppPackageId: fn( self: *const INetFwRule3, wszPackageId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LocalAppPackageId: fn( self: *const INetFwRule3, wszPackageId: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalUserOwner: fn( self: *const INetFwRule3, wszUserOwner: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LocalUserOwner: fn( self: *const INetFwRule3, wszUserOwner: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalUserAuthorizedList: fn( self: *const INetFwRule3, wszUserAuthList: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LocalUserAuthorizedList: fn( self: *const INetFwRule3, wszUserAuthList: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteUserAuthorizedList: fn( self: *const INetFwRule3, wszUserAuthList: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteUserAuthorizedList: fn( self: *const INetFwRule3, wszUserAuthList: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteMachineAuthorizedList: fn( self: *const INetFwRule3, wszUserAuthList: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RemoteMachineAuthorizedList: fn( self: *const INetFwRule3, wszUserAuthList: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SecureFlags: fn( self: *const INetFwRule3, lOptions: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SecureFlags: fn( self: *const INetFwRule3, lOptions: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace INetFwRule2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_get_LocalAppPackageId(self: *const T, wszPackageId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).get_LocalAppPackageId(@ptrCast(*const INetFwRule3, self), wszPackageId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_put_LocalAppPackageId(self: *const T, wszPackageId: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).put_LocalAppPackageId(@ptrCast(*const INetFwRule3, self), wszPackageId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_get_LocalUserOwner(self: *const T, wszUserOwner: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).get_LocalUserOwner(@ptrCast(*const INetFwRule3, self), wszUserOwner); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_put_LocalUserOwner(self: *const T, wszUserOwner: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).put_LocalUserOwner(@ptrCast(*const INetFwRule3, self), wszUserOwner); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_get_LocalUserAuthorizedList(self: *const T, wszUserAuthList: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).get_LocalUserAuthorizedList(@ptrCast(*const INetFwRule3, self), wszUserAuthList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_put_LocalUserAuthorizedList(self: *const T, wszUserAuthList: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).put_LocalUserAuthorizedList(@ptrCast(*const INetFwRule3, self), wszUserAuthList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_get_RemoteUserAuthorizedList(self: *const T, wszUserAuthList: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).get_RemoteUserAuthorizedList(@ptrCast(*const INetFwRule3, self), wszUserAuthList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_put_RemoteUserAuthorizedList(self: *const T, wszUserAuthList: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).put_RemoteUserAuthorizedList(@ptrCast(*const INetFwRule3, self), wszUserAuthList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_get_RemoteMachineAuthorizedList(self: *const T, wszUserAuthList: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).get_RemoteMachineAuthorizedList(@ptrCast(*const INetFwRule3, self), wszUserAuthList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_put_RemoteMachineAuthorizedList(self: *const T, wszUserAuthList: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).put_RemoteMachineAuthorizedList(@ptrCast(*const INetFwRule3, self), wszUserAuthList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_get_SecureFlags(self: *const T, lOptions: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).get_SecureFlags(@ptrCast(*const INetFwRule3, self), lOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRule3_put_SecureFlags(self: *const T, lOptions: i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRule3.VTable, self.vtable).put_SecureFlags(@ptrCast(*const INetFwRule3, self), lOptions); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwRules_Value = Guid.initString("9c4c6277-5027-441e-afae-ca1f542da009"); pub const IID_INetFwRules = &IID_INetFwRules_Value; pub const INetFwRules = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetFwRules, count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const INetFwRules, rule: ?*INetFwRule, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const INetFwRules, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const INetFwRules, name: ?BSTR, rule: ?*?*INetFwRule, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetFwRules, newEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRules_get_Count(self: *const T, count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRules.VTable, self.vtable).get_Count(@ptrCast(*const INetFwRules, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRules_Add(self: *const T, rule: ?*INetFwRule) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRules.VTable, self.vtable).Add(@ptrCast(*const INetFwRules, self), rule); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRules_Remove(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRules.VTable, self.vtable).Remove(@ptrCast(*const INetFwRules, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRules_Item(self: *const T, name: ?BSTR, rule: ?*?*INetFwRule) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRules.VTable, self.vtable).Item(@ptrCast(*const INetFwRules, self), name, rule); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwRules_get__NewEnum(self: *const T, newEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwRules.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetFwRules, self), newEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwServiceRestriction_Value = Guid.initString("8267bbe3-f890-491c-b7b6-2db1ef0e5d2b"); pub const IID_INetFwServiceRestriction = &IID_INetFwServiceRestriction_Value; pub const INetFwServiceRestriction = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, RestrictService: fn( self: *const INetFwServiceRestriction, serviceName: ?BSTR, appName: ?BSTR, restrictService: i16, serviceSidRestricted: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ServiceRestricted: fn( self: *const INetFwServiceRestriction, serviceName: ?BSTR, appName: ?BSTR, serviceRestricted: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Rules: fn( self: *const INetFwServiceRestriction, rules: ?*?*INetFwRules, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwServiceRestriction_RestrictService(self: *const T, serviceName: ?BSTR, appName: ?BSTR, restrictService: i16, serviceSidRestricted: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwServiceRestriction.VTable, self.vtable).RestrictService(@ptrCast(*const INetFwServiceRestriction, self), serviceName, appName, restrictService, serviceSidRestricted); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwServiceRestriction_ServiceRestricted(self: *const T, serviceName: ?BSTR, appName: ?BSTR, serviceRestricted: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwServiceRestriction.VTable, self.vtable).ServiceRestricted(@ptrCast(*const INetFwServiceRestriction, self), serviceName, appName, serviceRestricted); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwServiceRestriction_get_Rules(self: *const T, rules: ?*?*INetFwRules) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwServiceRestriction.VTable, self.vtable).get_Rules(@ptrCast(*const INetFwServiceRestriction, self), rules); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwProfile_Value = Guid.initString("174a0dda-e9f9-449d-993b-21ab667ca456"); pub const IID_INetFwProfile = &IID_INetFwProfile_Value; pub const INetFwProfile = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const INetFwProfile, type: ?*NET_FW_PROFILE_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FirewallEnabled: fn( self: *const INetFwProfile, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_FirewallEnabled: fn( self: *const INetFwProfile, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExceptionsNotAllowed: fn( self: *const INetFwProfile, notAllowed: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ExceptionsNotAllowed: fn( self: *const INetFwProfile, notAllowed: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NotificationsDisabled: fn( self: *const INetFwProfile, disabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_NotificationsDisabled: fn( self: *const INetFwProfile, disabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UnicastResponsesToMulticastBroadcastDisabled: fn( self: *const INetFwProfile, disabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UnicastResponsesToMulticastBroadcastDisabled: fn( self: *const INetFwProfile, disabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteAdminSettings: fn( self: *const INetFwProfile, remoteAdminSettings: ?*?*INetFwRemoteAdminSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IcmpSettings: fn( self: *const INetFwProfile, icmpSettings: ?*?*INetFwIcmpSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_GloballyOpenPorts: fn( self: *const INetFwProfile, openPorts: ?*?*INetFwOpenPorts, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Services: fn( self: *const INetFwProfile, services: ?*?*INetFwServices, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AuthorizedApplications: fn( self: *const INetFwProfile, apps: ?*?*INetFwAuthorizedApplications, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_Type(self: *const T, type_: ?*NET_FW_PROFILE_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_Type(@ptrCast(*const INetFwProfile, self), type_); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_FirewallEnabled(self: *const T, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_FirewallEnabled(@ptrCast(*const INetFwProfile, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_put_FirewallEnabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).put_FirewallEnabled(@ptrCast(*const INetFwProfile, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_ExceptionsNotAllowed(self: *const T, notAllowed: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_ExceptionsNotAllowed(@ptrCast(*const INetFwProfile, self), notAllowed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_put_ExceptionsNotAllowed(self: *const T, notAllowed: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).put_ExceptionsNotAllowed(@ptrCast(*const INetFwProfile, self), notAllowed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_NotificationsDisabled(self: *const T, disabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_NotificationsDisabled(@ptrCast(*const INetFwProfile, self), disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_put_NotificationsDisabled(self: *const T, disabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).put_NotificationsDisabled(@ptrCast(*const INetFwProfile, self), disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_UnicastResponsesToMulticastBroadcastDisabled(self: *const T, disabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_UnicastResponsesToMulticastBroadcastDisabled(@ptrCast(*const INetFwProfile, self), disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_put_UnicastResponsesToMulticastBroadcastDisabled(self: *const T, disabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).put_UnicastResponsesToMulticastBroadcastDisabled(@ptrCast(*const INetFwProfile, self), disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_RemoteAdminSettings(self: *const T, remoteAdminSettings: ?*?*INetFwRemoteAdminSettings) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_RemoteAdminSettings(@ptrCast(*const INetFwProfile, self), remoteAdminSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_IcmpSettings(self: *const T, icmpSettings: ?*?*INetFwIcmpSettings) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_IcmpSettings(@ptrCast(*const INetFwProfile, self), icmpSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_GloballyOpenPorts(self: *const T, openPorts: ?*?*INetFwOpenPorts) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_GloballyOpenPorts(@ptrCast(*const INetFwProfile, self), openPorts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_Services(self: *const T, services: ?*?*INetFwServices) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_Services(@ptrCast(*const INetFwProfile, self), services); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProfile_get_AuthorizedApplications(self: *const T, apps: ?*?*INetFwAuthorizedApplications) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProfile.VTable, self.vtable).get_AuthorizedApplications(@ptrCast(*const INetFwProfile, self), apps); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwPolicy_Value = Guid.initString("d46d2478-9ac9-4008-9dc7-5563ce5536cc"); pub const IID_INetFwPolicy = &IID_INetFwPolicy_Value; pub const INetFwPolicy = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentProfile: fn( self: *const INetFwPolicy, profile: ?*?*INetFwProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProfileByType: fn( self: *const INetFwPolicy, profileType: NET_FW_PROFILE_TYPE, profile: ?*?*INetFwProfile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy_get_CurrentProfile(self: *const T, profile: ?*?*INetFwProfile) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy.VTable, self.vtable).get_CurrentProfile(@ptrCast(*const INetFwPolicy, self), profile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy_GetProfileByType(self: *const T, profileType: NET_FW_PROFILE_TYPE, profile: ?*?*INetFwProfile) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy.VTable, self.vtable).GetProfileByType(@ptrCast(*const INetFwPolicy, self), profileType, profile); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwPolicy2_Value = Guid.initString("98325047-c671-4174-8d81-defcd3f03186"); pub const IID_INetFwPolicy2 = &IID_INetFwPolicy2_Value; pub const INetFwPolicy2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentProfileTypes: fn( self: *const INetFwPolicy2, profileTypesBitmask: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FirewallEnabled: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_FirewallEnabled: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExcludedInterfaces: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, interfaces: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ExcludedInterfaces: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, interfaces: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BlockAllInboundTraffic: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, Block: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_BlockAllInboundTraffic: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, Block: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NotificationsDisabled: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, disabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_NotificationsDisabled: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, disabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UnicastResponsesToMulticastBroadcastDisabled: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, disabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UnicastResponsesToMulticastBroadcastDisabled: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, disabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Rules: fn( self: *const INetFwPolicy2, rules: ?*?*INetFwRules, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ServiceRestriction: fn( self: *const INetFwPolicy2, ServiceRestriction: ?*?*INetFwServiceRestriction, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableRuleGroup: fn( self: *const INetFwPolicy2, profileTypesBitmask: i32, group: ?BSTR, enable: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRuleGroupEnabled: fn( self: *const INetFwPolicy2, profileTypesBitmask: i32, group: ?BSTR, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RestoreLocalFirewallDefaults: fn( self: *const INetFwPolicy2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultInboundAction: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, action: ?*NET_FW_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DefaultInboundAction: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, action: NET_FW_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultOutboundAction: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, action: ?*NET_FW_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DefaultOutboundAction: fn( self: *const INetFwPolicy2, profileType: NET_FW_PROFILE_TYPE2, action: NET_FW_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IsRuleGroupCurrentlyEnabled: fn( self: *const INetFwPolicy2, group: ?BSTR, enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalPolicyModifyState: fn( self: *const INetFwPolicy2, modifyState: ?*NET_FW_MODIFY_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_CurrentProfileTypes(self: *const T, profileTypesBitmask: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_CurrentProfileTypes(@ptrCast(*const INetFwPolicy2, self), profileTypesBitmask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_FirewallEnabled(self: *const T, profileType: NET_FW_PROFILE_TYPE2, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_FirewallEnabled(@ptrCast(*const INetFwPolicy2, self), profileType, enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_FirewallEnabled(self: *const T, profileType: NET_FW_PROFILE_TYPE2, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_FirewallEnabled(@ptrCast(*const INetFwPolicy2, self), profileType, enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_ExcludedInterfaces(self: *const T, profileType: NET_FW_PROFILE_TYPE2, interfaces: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_ExcludedInterfaces(@ptrCast(*const INetFwPolicy2, self), profileType, interfaces); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_ExcludedInterfaces(self: *const T, profileType: NET_FW_PROFILE_TYPE2, interfaces: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_ExcludedInterfaces(@ptrCast(*const INetFwPolicy2, self), profileType, interfaces); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_BlockAllInboundTraffic(self: *const T, profileType: NET_FW_PROFILE_TYPE2, Block: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_BlockAllInboundTraffic(@ptrCast(*const INetFwPolicy2, self), profileType, Block); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_BlockAllInboundTraffic(self: *const T, profileType: NET_FW_PROFILE_TYPE2, Block: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_BlockAllInboundTraffic(@ptrCast(*const INetFwPolicy2, self), profileType, Block); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_NotificationsDisabled(self: *const T, profileType: NET_FW_PROFILE_TYPE2, disabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_NotificationsDisabled(@ptrCast(*const INetFwPolicy2, self), profileType, disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_NotificationsDisabled(self: *const T, profileType: NET_FW_PROFILE_TYPE2, disabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_NotificationsDisabled(@ptrCast(*const INetFwPolicy2, self), profileType, disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_UnicastResponsesToMulticastBroadcastDisabled(self: *const T, profileType: NET_FW_PROFILE_TYPE2, disabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_UnicastResponsesToMulticastBroadcastDisabled(@ptrCast(*const INetFwPolicy2, self), profileType, disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_UnicastResponsesToMulticastBroadcastDisabled(self: *const T, profileType: NET_FW_PROFILE_TYPE2, disabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_UnicastResponsesToMulticastBroadcastDisabled(@ptrCast(*const INetFwPolicy2, self), profileType, disabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_Rules(self: *const T, rules: ?*?*INetFwRules) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_Rules(@ptrCast(*const INetFwPolicy2, self), rules); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_ServiceRestriction(self: *const T, ServiceRestriction: ?*?*INetFwServiceRestriction) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_ServiceRestriction(@ptrCast(*const INetFwPolicy2, self), ServiceRestriction); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_EnableRuleGroup(self: *const T, profileTypesBitmask: i32, group: ?BSTR, enable: i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).EnableRuleGroup(@ptrCast(*const INetFwPolicy2, self), profileTypesBitmask, group, enable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_IsRuleGroupEnabled(self: *const T, profileTypesBitmask: i32, group: ?BSTR, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).IsRuleGroupEnabled(@ptrCast(*const INetFwPolicy2, self), profileTypesBitmask, group, enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_RestoreLocalFirewallDefaults(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).RestoreLocalFirewallDefaults(@ptrCast(*const INetFwPolicy2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_DefaultInboundAction(self: *const T, profileType: NET_FW_PROFILE_TYPE2, action: ?*NET_FW_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_DefaultInboundAction(@ptrCast(*const INetFwPolicy2, self), profileType, action); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_DefaultInboundAction(self: *const T, profileType: NET_FW_PROFILE_TYPE2, action: NET_FW_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_DefaultInboundAction(@ptrCast(*const INetFwPolicy2, self), profileType, action); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_DefaultOutboundAction(self: *const T, profileType: NET_FW_PROFILE_TYPE2, action: ?*NET_FW_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_DefaultOutboundAction(@ptrCast(*const INetFwPolicy2, self), profileType, action); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_put_DefaultOutboundAction(self: *const T, profileType: NET_FW_PROFILE_TYPE2, action: NET_FW_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).put_DefaultOutboundAction(@ptrCast(*const INetFwPolicy2, self), profileType, action); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_IsRuleGroupCurrentlyEnabled(self: *const T, group: ?BSTR, enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_IsRuleGroupCurrentlyEnabled(@ptrCast(*const INetFwPolicy2, self), group, enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwPolicy2_get_LocalPolicyModifyState(self: *const T, modifyState: ?*NET_FW_MODIFY_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwPolicy2.VTable, self.vtable).get_LocalPolicyModifyState(@ptrCast(*const INetFwPolicy2, self), modifyState); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetFwMgr_Value = Guid.initString("f7898af5-cac4-4632-a2ec-da06e5111af2"); pub const IID_INetFwMgr = &IID_INetFwMgr_Value; pub const INetFwMgr = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalPolicy: fn( self: *const INetFwMgr, localPolicy: ?*?*INetFwPolicy, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentProfileType: fn( self: *const INetFwMgr, profileType: ?*NET_FW_PROFILE_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RestoreDefaults: fn( self: *const INetFwMgr, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPortAllowed: fn( self: *const INetFwMgr, imageFileName: ?BSTR, ipVersion: NET_FW_IP_VERSION, portNumber: i32, localAddress: ?BSTR, ipProtocol: NET_FW_IP_PROTOCOL, allowed: ?*VARIANT, restricted: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsIcmpTypeAllowed: fn( self: *const INetFwMgr, ipVersion: NET_FW_IP_VERSION, localAddress: ?BSTR, type: u8, allowed: ?*VARIANT, restricted: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwMgr_get_LocalPolicy(self: *const T, localPolicy: ?*?*INetFwPolicy) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwMgr.VTable, self.vtable).get_LocalPolicy(@ptrCast(*const INetFwMgr, self), localPolicy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwMgr_get_CurrentProfileType(self: *const T, profileType: ?*NET_FW_PROFILE_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwMgr.VTable, self.vtable).get_CurrentProfileType(@ptrCast(*const INetFwMgr, self), profileType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwMgr_RestoreDefaults(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwMgr.VTable, self.vtable).RestoreDefaults(@ptrCast(*const INetFwMgr, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwMgr_IsPortAllowed(self: *const T, imageFileName: ?BSTR, ipVersion: NET_FW_IP_VERSION, portNumber: i32, localAddress: ?BSTR, ipProtocol: NET_FW_IP_PROTOCOL, allowed: ?*VARIANT, restricted: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwMgr.VTable, self.vtable).IsPortAllowed(@ptrCast(*const INetFwMgr, self), imageFileName, ipVersion, portNumber, localAddress, ipProtocol, allowed, restricted); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwMgr_IsIcmpTypeAllowed(self: *const T, ipVersion: NET_FW_IP_VERSION, localAddress: ?BSTR, type_: u8, allowed: ?*VARIANT, restricted: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwMgr.VTable, self.vtable).IsIcmpTypeAllowed(@ptrCast(*const INetFwMgr, self), ipVersion, localAddress, type_, allowed, restricted); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_INetFwProduct_Value = Guid.initString("71881699-18f4-458b-b892-3ffce5e07f75"); pub const IID_INetFwProduct = &IID_INetFwProduct_Value; pub const INetFwProduct = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RuleCategories: fn( self: *const INetFwProduct, ruleCategories: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RuleCategories: fn( self: *const INetFwProduct, ruleCategories: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisplayName: fn( self: *const INetFwProduct, displayName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisplayName: fn( self: *const INetFwProduct, displayName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PathToSignedProductExe: fn( self: *const INetFwProduct, path: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProduct_get_RuleCategories(self: *const T, ruleCategories: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProduct.VTable, self.vtable).get_RuleCategories(@ptrCast(*const INetFwProduct, self), ruleCategories); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProduct_put_RuleCategories(self: *const T, ruleCategories: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProduct.VTable, self.vtable).put_RuleCategories(@ptrCast(*const INetFwProduct, self), ruleCategories); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProduct_get_DisplayName(self: *const T, displayName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProduct.VTable, self.vtable).get_DisplayName(@ptrCast(*const INetFwProduct, self), displayName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProduct_put_DisplayName(self: *const T, displayName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProduct.VTable, self.vtable).put_DisplayName(@ptrCast(*const INetFwProduct, self), displayName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProduct_get_PathToSignedProductExe(self: *const T, path: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProduct.VTable, self.vtable).get_PathToSignedProductExe(@ptrCast(*const INetFwProduct, self), path); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_INetFwProducts_Value = Guid.initString("39eb36e0-2097-40bd-8af2-63a13b525362"); pub const IID_INetFwProducts = &IID_INetFwProducts_Value; pub const INetFwProducts = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const INetFwProducts, count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Register: fn( self: *const INetFwProducts, product: ?*INetFwProduct, registration: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const INetFwProducts, index: i32, product: ?*?*INetFwProduct, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const INetFwProducts, newEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProducts_get_Count(self: *const T, count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProducts.VTable, self.vtable).get_Count(@ptrCast(*const INetFwProducts, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProducts_Register(self: *const T, product: ?*INetFwProduct, registration: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProducts.VTable, self.vtable).Register(@ptrCast(*const INetFwProducts, self), product, registration); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProducts_Item(self: *const T, index: i32, product: ?*?*INetFwProduct) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProducts.VTable, self.vtable).Item(@ptrCast(*const INetFwProducts, self), index, product); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetFwProducts_get__NewEnum(self: *const T, newEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const INetFwProducts.VTable, self.vtable).get__NewEnum(@ptrCast(*const INetFwProducts, self), newEnum); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (8) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationSetupAppContainerBinaries( applicationContainerSid: ?PSID, packageFullName: ?[*:0]const u16, packageFolder: ?[*:0]const u16, displayName: ?[*:0]const u16, bBinariesFullyComputed: BOOL, binaries: [*]?PWSTR, binariesCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationRegisterForAppContainerChanges( flags: u32, callback: ?PAC_CHANGES_CALLBACK_FN, context: ?*anyopaque, registrationObject: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationUnregisterForAppContainerChanges( registrationObject: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationFreeAppContainers( pPublicAppCs: ?*INET_FIREWALL_APP_CONTAINER, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationEnumAppContainers( Flags: u32, pdwNumPublicAppCs: ?*u32, ppPublicAppCs: ?*?*INET_FIREWALL_APP_CONTAINER, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationGetAppContainerConfig( pdwNumPublicAppCs: ?*u32, appContainerSids: ?*?*SID_AND_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationSetAppContainerConfig( dwNumPublicAppCs: u32, appContainerSids: [*]SID_AND_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "api-ms-win-net-isolation-l1-1-0" fn NetworkIsolationDiagnoseConnectFailureAndGetInfo( wszServerName: ?[*:0]const u16, netIsoError: ?*NETISO_ERROR_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (13) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const HANDLE = @import("../foundation.zig").HANDLE; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IDispatch = @import("../system/com.zig").IDispatch; const IUnknown = @import("../system/com.zig").IUnknown; const PSID = @import("../foundation.zig").PSID; const PWSTR = @import("../foundation.zig").PWSTR; const SID = @import("../security.zig").SID; const SID_AND_ATTRIBUTES = @import("../security.zig").SID_AND_ATTRIBUTES; const VARIANT = @import("../system/com.zig").VARIANT; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PAC_CHANGES_CALLBACK_FN")) { _ = PAC_CHANGES_CALLBACK_FN; } if (@hasDecl(@This(), "PNETISO_EDP_ID_CALLBACK_FN")) { _ = PNETISO_EDP_ID_CALLBACK_FN; } if (@hasDecl(@This(), "PFN_FWADDDYNAMICKEYWORDADDRESS0")) { _ = PFN_FWADDDYNAMICKEYWORDADDRESS0; } if (@hasDecl(@This(), "PFN_FWDELETEDYNAMICKEYWORDADDRESS0")) { _ = PFN_FWDELETEDYNAMICKEYWORDADDRESS0; } if (@hasDecl(@This(), "PFN_FWENUMDYNAMICKEYWORDADDRESSESBYTYPE0")) { _ = PFN_FWENUMDYNAMICKEYWORDADDRESSESBYTYPE0; } if (@hasDecl(@This(), "PFN_FWENUMDYNAMICKEYWORDADDRESSBYID0")) { _ = PFN_FWENUMDYNAMICKEYWORDADDRESSBYID0; } if (@hasDecl(@This(), "PFN_FWFREEDYNAMICKEYWORDADDRESSDATA0")) { _ = PFN_FWFREEDYNAMICKEYWORDADDRESSDATA0; } if (@hasDecl(@This(), "PFN_FWUPDATEDYNAMICKEYWORDADDRESS0")) { _ = PFN_FWUPDATEDYNAMICKEYWORDADDRESS0; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/network_management/windows_firewall.zig
const std = @import("std"); const input = @embedFile("data/input13"); usingnamespace @import("util.zig"); pub fn main() !void { const data = parse(input); const part1 = findEarliestBus(data); const part2 = findEarliestTimestamp(data); print("[Part1] Earliest bus: {}", .{part1}); print("[Part2] Earliest timestamp: {}", .{part2}); } const Data = struct { timestamp: usize, bus_ids: []const ?usize }; fn parse(comptime inputStr: []const u8) Data { comptime { @setEvalBranchQuota(10000); var reader = lines(inputStr); const timestamp = std.fmt.parseUnsigned(usize, reader.next().?, 10) catch unreachable; var ids: []const ?usize = &[_]?usize{}; const ids_line = reader.next().?; var ids_reader = std.mem.split(ids_line, ","); while (ids_reader.next()) |id_str| { const id = if (id_str[0] == 'x') null else (std.fmt.parseUnsigned(usize, id_str, 10) catch unreachable); ids = ids ++ [_]?usize{ id }; } return comptime Data { .timestamp = timestamp, .bus_ids = ids }; } } fn findEarliestBus(data: Data) usize { var earliest_id: usize = 0; var earliest_time_remaining: usize = std.math.maxInt(usize); for (data.bus_ids) |opt_id| { if (opt_id) |id| { const time_remaining = id - (data.timestamp % id); if (time_remaining < earliest_time_remaining) { earliest_id = id; earliest_time_remaining = time_remaining; } } } return earliest_id * earliest_time_remaining; } fn findEarliestTimestamp(data: Data) usize { const bus_ids = data.bus_ids; const num_matches_required = blk: { var n: usize = 0; for (bus_ids) |opt_id, time_offset| { if (opt_id) |id| { n += 1; } } break :blk n; }; var step: usize = bus_ids[0].?; var num_matches_in_step: usize = 1; var timestamp: usize = step; while (true) : (timestamp += step) { var new_step: usize = step; var num_matches: usize = num_matches_in_step; var n: usize = 0; for (bus_ids) |opt_id, time_offset| { if (opt_id) |id| { n += 1; if (n <= num_matches_in_step) { continue; } if ((@intCast(usize, timestamp + time_offset) % id) != 0) { break; } else { num_matches += 1; new_step *= id; } } } if (num_matches == num_matches_required) { return timestamp; } else if (num_matches > num_matches_in_step) { step = new_step; num_matches_in_step = num_matches; } } unreachable; } const expectEqual = std.testing.expectEqual; test "findEarliestBus" { expectEqual(@as(usize, 295), findEarliestBus(testData)); } test "findEarliestTimestamp" { expectEqual(@as(usize, 1068781), findEarliestTimestamp(testData)); } const testData = parse( \\939 \\7,13,x,x,59,x,31,19 );
src/day13.zig
const std = @import("std"); const unicode = std.unicode; const sdl = @import("sdl.zig"); const Audio = @import("audio.zig").Audio; const DumbFont16 = @import("dumbfont.zig").DumbFont16; const PF2Font = @import("pf2.zig").PF2Font; const bounce_bytes = @embedFile("../assets/bounce.wav"); const main_font_bytes = @embedFile("../assets/04b_30.dumbfont16"); const pf2_bytes = @embedFile("../assets/ka1.pf2"); const Player = enum { left, right, }; const Phase = union(enum) { starting, playing, finished: Player, }; const PlayerState = struct { me: Player, y: i32, up: bool = false, down: bool = false, score: u8 = 0, pub fn paddle_top(self: PlayerState) i32 { return self.y - (PADDLE_HEIGHT / 2); } pub fn paddle_bottom(self: PlayerState) i32 { return self.y + (PADDLE_HEIGHT / 2); } pub fn paddle_left(self: PlayerState) i32 { switch (self.me) { .left => return 0, .right => return WIDTH - PADDLE_WIDTH, } } pub fn paddle_right(self: PlayerState) i32 { switch (self.me) { .left => return PADDLE_WIDTH, .right => return WIDTH, } } }; const Ball = struct { radius: i32, x: i32, y: i32, vx: i32, vy: i32, pub fn bottom(self: Ball) i32 { return self.y + (BALL_RADIUS / 2); } pub fn top(self: Ball) i32 { return self.y - (BALL_RADIUS / 2); } pub fn left(self: Ball) i32 { return self.x - (BALL_RADIUS / 2); } pub fn right(self: Ball) i32 { return self.x + (BALL_RADIUS / 2); } }; const GameAssets = struct { bounce_pcm: []const i16, main_font: *DumbFont16, other_font: *PF2Font, }; const GameState = struct { phase: Phase, left: PlayerState, right: PlayerState, ball: Ball, pub fn init() GameState { return GameState{ .phase = .starting, .left = .{ .me = .left, .y = HEIGHT / 2, }, .right = .{ .me = .right, .y = HEIGHT / 2, }, .ball = .{ .radius = BALL_RADIUS, .x = WIDTH / 2, .y = HEIGHT / 2, .vx = 0, .vy = 0, }, }; } pub fn restart(self: *GameState) void { switch (self.phase) { .finished => |winner| { self.phase = .playing; self.left.y = HEIGHT / 2; self.right.y = HEIGHT / 2; self.ball.x = WIDTH / 2; self.ball.y = HEIGHT / 2; switch (winner) { .left => { self.ball.vx = BALL_SPEED; }, .right => { self.ball.vx = -BALL_SPEED; }, } self.ball.vy = BALL_SPEED; self.ball.radius = BALL_RADIUS; }, else => {}, } } }; const MainMenuButtons = enum { Play, Exit, }; const MainMenuState = struct { selectedItem: MainMenuButtons, }; const GlobalGameState = union(enum) { MainMenu: MainMenuState, Game: GameState, }; const BALL_SPEED = 5; const BALL_RADIUS = 20; const WIDTH = 800; const HEIGHT = 600; const PADDLE_HEIGHT = 100; const PADDLE_WIDTH = 30; const MEM_SIZE = 1024 * 1024 * 128; // 128 megs pub fn main() anyerror!void { var other_font = try PF2Font.fromConstMem(pf2_bytes); std.debug.warn("Font: {}\n", .{other_font}); var game_mem = try std.heap.c_allocator.alloc(u8, MEM_SIZE); var allocator = std.heap.FixedBufferAllocator.init(game_mem); try sdl.init(sdl.SDL_INIT_EVERYTHING); var window = try sdl.Window.init( "Pong", sdl.SDL_WINDOWPOS_UNDEFINED, sdl.SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, sdl.SDL_WINDOW_OPENGL | sdl.SDL_WINDOW_ALLOW_HIGHDPI, ); var render = try sdl.Renderer.init(&window, -1, sdl.SDL_RENDERER_PRESENTVSYNC | sdl.SDL_RENDERER_ACCELERATED); const maybe_info = render.info() catch null; if (maybe_info) |info| { std.debug.warn("Render name: {s}\nRender info: {}\n", .{ info.name, info }); } var bounce_rwops = try sdl.RWops.fromConstMem(bounce_bytes, bounce_bytes.len); var bounce_spec: sdl.SDL_AudioSpec = undefined; var bounce_pcm: [*c]u8 = undefined; var bounce_pcm_len: u32 = undefined; if (sdl.SDL_LoadWAV_RW(bounce_rwops.rwops, 0, &bounce_spec, &bounce_pcm, &bounce_pcm_len) == null) { return error.WAVLoadError; } std.debug.warn("Bounce Audio Spec: {}\n", .{bounce_spec}); var main_font = try DumbFont16.fromConstMem(main_font_bytes[0..]); var assets = GameAssets{ .bounce_pcm = @ptrCast([*c]i16, @alignCast(@alignOf(i16), bounce_pcm))[0 .. bounce_pcm_len / 2], .main_font = &main_font, .other_font = &other_font, }; var audio = Audio.init(); try audio.open(); audio.start(); var shouldExit: bool = false; var state = GlobalGameState{ .MainMenu = MainMenuState{ .selectedItem = .Play } }; mainloop: while (!shouldExit) { var event: sdl.SDL_Event = undefined; while (sdl.SDL_PollEvent(&event) != 0) { switch (event.type) { sdl.SDL_QUIT => break :mainloop, sdl.SDL_KEYUP => processInput(&audio, &state, &shouldExit, &assets, event.key), sdl.SDL_KEYDOWN => processInput(&audio, &state, &shouldExit, &assets, event.key), else => {}, } } try gameUpdateAndRender(&assets, &state, &shouldExit, &render, &audio); } } fn processInput(audio: *Audio, global_game_state: *GlobalGameState, shouldExit: *bool, assets: *const GameAssets, event: sdl.SDL_KeyboardEvent) void { switch (global_game_state.*) { .MainMenu => |*state| { if (event.state == sdl.SDL_PRESSED) { switch (event.keysym.scancode) { sdl.SDL_Scancode.SDL_SCANCODE_W, sdl.SDL_Scancode.SDL_SCANCODE_S => { audio.play(.{ .data = assets.bounce_pcm, .offset = 0, .volume = 127 }); switch (state.selectedItem) { .Play => state.selectedItem = .Exit, .Exit => state.selectedItem = .Play, } }, sdl.SDL_Scancode.SDL_SCANCODE_RETURN => { switch (state.selectedItem) { .Play => global_game_state.* = GlobalGameState{ .Game = GameState.init() }, .Exit => shouldExit.* = true, } }, else => {}, } } }, .Game => |*game_state| { switch (game_state.phase) { .starting => { game_state.phase = .playing; game_state.ball.vx = BALL_SPEED; game_state.ball.vy = BALL_SPEED; }, .playing => { switch (event.keysym.scancode) { sdl.SDL_Scancode.SDL_SCANCODE_W => { game_state.left.up = event.state == sdl.SDL_PRESSED; }, sdl.SDL_Scancode.SDL_SCANCODE_S => { game_state.left.down = event.state == sdl.SDL_PRESSED; }, sdl.SDL_Scancode.SDL_SCANCODE_UP => { game_state.right.up = event.state == sdl.SDL_PRESSED; }, sdl.SDL_Scancode.SDL_SCANCODE_DOWN => { game_state.right.down = event.state == sdl.SDL_PRESSED; }, else => {}, } }, .finished => { game_state.restart(); }, } }, } } const TOP_OFFSET = 64; fn gameUpdateAndRender(assets: *GameAssets, global_state: *GlobalGameState, shouldExit: *bool, render: *sdl.Renderer, audio: *Audio) !void { try render.setDrawColor(sdl.Color.black); try render.clear(); switch (global_state.*) { .MainMenu => |*state| { try render.setDrawColor(sdl.Color.white); try drawAlignedText(render, "ZIG PONG", .center, assets.other_font, 0, 800, 100, 4, 1); const buttonPadding = 20; const buttonFontScale = 3; switch (state.selectedItem) { .Play => { var textWidth = try measureText("PLAY", assets.other_font, buttonFontScale, 1); var halfWidth = @divTrunc(textWidth, 2); try render.fillRect(&.{ .x = 400 - halfWidth - buttonPadding, .y = 400 + assets.other_font.descent * buttonFontScale - assets.other_font.maxHeight * buttonFontScale - buttonPadding, .w = textWidth + buttonPadding * 2, .h = assets.other_font.maxHeight * buttonFontScale + buttonPadding * 2, }); try render.setDrawColor(sdl.Color.black); try drawAlignedText(render, "PLAY", .center, assets.other_font, 0, 800, 400, buttonFontScale, 1); try render.setDrawColor(sdl.Color.white); try drawAlignedText(render, "EXIT", .center, assets.other_font, 0, 800, 500, buttonFontScale, 1); }, .Exit => { try drawAlignedText(render, "PLAY", .center, assets.other_font, 0, 800, 400, buttonFontScale, 1); var textWidth = try measureText("EXIT", assets.other_font, buttonFontScale, 1); var halfWidth = @divTrunc(textWidth, 2); try render.fillRect(&.{ .x = 400 - halfWidth - buttonPadding, .y = 500 + assets.other_font.descent * buttonFontScale - assets.other_font.maxHeight * buttonFontScale - buttonPadding, .w = textWidth + buttonPadding * 2, .h = assets.other_font.maxHeight * buttonFontScale + buttonPadding * 2, }); try render.setDrawColor(sdl.Color.black); try drawAlignedText(render, "EXIT", .center, assets.other_font, 0, 800, 500, buttonFontScale, 1); try render.setDrawColor(sdl.Color.white); }, } }, .Game => |*state| { try render.setDrawColor(sdl.Color.white); // try render.fillRect(&.{ .x = 500, .y = 500, .w = 100, .h = 100 }); switch (state.phase) { .playing => { if (state.left.up) { state.left.y -= 10; } if (state.left.down) { state.left.y += 10; } if (state.right.up) { state.right.y -= 10; } if (state.right.down) { state.right.y += 10; } state.left.y = std.math.clamp(state.left.y, PADDLE_HEIGHT / 2 + TOP_OFFSET, HEIGHT - (PADDLE_HEIGHT / 2)); state.right.y = std.math.clamp(state.right.y, PADDLE_HEIGHT / 2 + TOP_OFFSET, HEIGHT - (PADDLE_HEIGHT / 2)); state.ball.x += state.ball.vx; state.ball.y += state.ball.vy; if (state.ball.bottom() >= HEIGHT) { state.ball.vy = -state.ball.vy; } if (state.ball.top() < TOP_OFFSET) { state.ball.vy = -state.ball.vy; } if (state.ball.left() <= state.left.paddle_right() and state.ball.vx < 0) { var top = state.left.paddle_top() - state.ball.radius; var bottom = state.left.paddle_bottom() + state.ball.radius; if (state.ball.y >= top and state.ball.y <= bottom) { state.ball.vx = -state.ball.vx; audio.play(.{ .offset = @as(u64, 0), .data = assets.bounce_pcm, .volume = 127, }); } } if (state.ball.right() >= state.right.paddle_left() and state.ball.vx > 0) { var top = state.right.paddle_top() - state.ball.radius; var bottom = state.right.paddle_bottom() + state.ball.radius; if (state.ball.y >= top and state.ball.y <= bottom) { state.ball.vx = -state.ball.vx; audio.play(.{ .offset = 1, .data = assets.bounce_pcm, .volume = 127, }); } } if (state.ball.left() < 0) { state.phase = Phase{ .finished = .right }; _ = @addWithOverflow(u8, state.right.score, 1, &state.right.score); } else if (state.ball.right() >= WIDTH) { state.phase = Phase{ .finished = .left }; _ = @addWithOverflow(u8, state.left.score, 1, &state.left.score); } try render.fillRect(&.{ .x = state.ball.x - (@divTrunc(state.ball.radius, 2)), .y = state.ball.y - (@divTrunc(state.ball.radius, 2)), .w = state.ball.radius, .h = state.ball.radius, }); }, .finished => |winner| { var text = blk: { switch (winner) { .left => break :blk "Left Player Won!", .right => break :blk "Right Player Won!", } }; try drawAlignedText(render, text, .center, assets.other_font, 0, 800, 300, 3, 1); try drawAlignedText(render, "Press any button to continue", .center, assets.other_font, 0, 800, 400, 2, 1); }, else => {}, } const SEP_WIDTH = 4; try render.fillRect(&.{ .x = WIDTH / 2 - SEP_WIDTH / 2, .y = TOP_OFFSET, .w = SEP_WIDTH, .h = HEIGHT, }); // Score drawing var score = [_]u8{0} ** 3; var leftScoreLen = std.fmt.formatIntBuf(score[0..], state.left.score, 10, false, .{}); try drawAlignedText(render, score[0..leftScoreLen], .right, assets.other_font, 0, WIDTH / 2 - SEP_WIDTH / 2 - 16, TOP_OFFSET - 16, 3, 0); var rightScoreLen = std.fmt.formatIntBuf(score[0..], state.right.score, 10, false, .{}); try drawAlignedText(render, score[0..rightScoreLen], .left, assets.other_font, WIDTH / 2 + SEP_WIDTH / 2 + 16, WIDTH, TOP_OFFSET - 16, 3, 0); // Left paddle try render.fillRect(&.{ .x = 0, .y = state.left.y - (PADDLE_HEIGHT / 2), .w = PADDLE_WIDTH, .h = PADDLE_HEIGHT, }); // Left paddle try render.fillRect(&.{ .x = WIDTH - PADDLE_WIDTH, .y = state.right.y - (PADDLE_HEIGHT / 2), .w = PADDLE_WIDTH, .h = PADDLE_HEIGHT, }); // try drawTextPf2(render, "Test, I'm a ball", state.ball.x, state.ball.y, assets.other_font, 2, 1); const soundRatioX = WIDTH / @intToFloat(f32, audio.buffer_copy.len / 2); const soundRatio = HEIGHT / @intToFloat(f32, std.math.maxInt(i16)); const graphSize = (soundRatio) * HEIGHT; var i: usize = 0; while (i < audio.buffer_copy.len / 2) : (i += 1) { try render.fillRect(&.{ .x = @floatToInt(c_int, @intToFloat(f32, i) * soundRatioX), .y = HEIGHT - @floatToInt(c_int, (graphSize)), .w = 1, .h = @floatToInt(c_int, @intToFloat(f32, audio.buffer_copy[i]) * soundRatio), }); } }, } render.present(); } pub const TextAlign = enum { left, center, right, }; fn drawAlignedText(render: *sdl.Renderer, text: []const u8, alignment: TextAlign, font: *PF2Font, minX: i32, maxX: i32, y: i32, scale: i32, letterSpacing: i32) !void { std.debug.assert(minX <= maxX); var x: i32 = undefined; switch (alignment) { .left => x = minX, .center => { var width = try measureText(text, font, scale, letterSpacing); var boundsMiddle = @divTrunc(maxX - minX, 2); x = boundsMiddle - @divTrunc(width, 2); }, .right => { var width = try measureText(text, font, scale, letterSpacing); x = maxX - width; }, } try drawTextPf2(render, text, x, y, font, scale, letterSpacing); } fn measureText(text: []const u8, font: *PF2Font, scale: i32, letterSpacing: i32) !i32 { var width: i32 = 0; var view = try unicode.Utf8View.init(text); var iter = view.iterator(); while (iter.nextCodepoint()) |codepoint| { var glyph = font.getChar(codepoint) orelse continue; width += glyph.deviceWidth * scale + letterSpacing; } if (width > 0) { width -= letterSpacing; } return width; } fn drawTextPf2(render: *sdl.Renderer, text: []const u8, screenX: i32, screenY: i32, font: *PF2Font, scale: i32, letterSpacing: i32) !void { var offset: i32 = 0; var view = try unicode.Utf8View.init(text); var iter = view.iterator(); while (iter.nextCodepoint()) |codepoint| { var glyph = font.getChar(codepoint) orelse continue; var y: usize = 0; while (y < glyph.height) : (y += 1) { var x: usize = 0; while (x < glyph.width) : (x += 1) { var bitIndex = y * glyph.width + x; var currentByte = glyph.pixels[bitIndex / 8]; var currentByteBitIndex = bitIndex % 8; if (currentByte & (@as(u8, 0b10000000) >> @intCast(u3, currentByteBitIndex)) > 0) { try render.fillRect(&.{ .x = glyph.xOffset * scale + screenX + @intCast(i32, x) * scale + @intCast(i32, offset), .y = screenY + @intCast(i32, y) * scale - glyph.yOffset * scale - glyph.height * scale, .w = scale, .h = scale, }); } } } offset += glyph.deviceWidth * scale + letterSpacing; } } fn drawText(render: *sdl.Renderer, text: []const u8, x: i32, y: i32, font: *DumbFont16, scale: i32, letterSpacing: i32) !void { var offset: i32 = 0; for (text) |char, i| { var glyph = &font.glyphs[char]; var glyphY: usize = 0; while (glyphY < 16) : (glyphY += 1) { var row = glyph.pixels[glyphY]; var glyphX: usize = 0; while (glyphX < 16) : (glyphX += 1) { if ((row & @as(u16, 1) << @intCast(u4, glyphX)) > 0) { try render.fillRect(&.{ .x = x + @intCast(i32, glyphX) * scale + @intCast(i32, offset), .y = y + @intCast(i32, glyphY) * scale, .w = scale, .h = scale, }); } } } switch (char) { '1', 'i', 'I' => { offset += 10 * scale + letterSpacing; }, ' ' => { offset += 4 * scale; }, '\'' => { offset += 8 * scale; }, else => { offset += 16 * scale + letterSpacing; }, } } }
src/main.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const limit = 1 * 1024 * 1024 * 1024; const text = try std.fs.cwd().readFileAlloc(allocator, "day22.txt", limit); defer allocator.free(text); const State = struct { const clean = 0; const weak = 1; const infected = 2; const flagged = 3; }; var submap: [1000]u2 = undefined; const init = blk: { var len: usize = 0; var width: usize = 0; var it = std.mem.split(u8, text, "\n"); while (it.next()) |line0| { const line = std.mem.trim(u8, line0, " \n\t\r"); if (line.len == 0) continue; width = line.len; for (line) |c| { submap[len] = if (c == '#') State.infected else State.clean; len += 1; } } break :blk .{ submap[0..len], width }; }; const stride = 2048; const half = stride / 2; const center = half * stride + half; var map: [stride * stride]u2 = undefined; std.mem.set(u2, &map, State.clean); if (false) { map[center + (-1) * stride + 1] = State.infected; map[center + 0 * stride - 1] = State.infected; } else { const m = init[0]; const w = init[1]; const h = m.len / w; var offset = center - (w / 2) - stride * (h / 2); var i: usize = 0; while (i < h) : (i += 1) { std.mem.copy(u2, map[offset .. offset + w], m[i * w .. i * w + w]); offset += stride; } } var pos: isize = center; var dir: u2 = 0; const moves = [_]isize{ -stride, 1, stride, -1 }; var infections: u32 = 0; var steps: u32 = 0; while (steps < 10000000) : (steps += 1) { const m = &map[@intCast(usize, pos)]; switch (m.*) { State.clean => { m.* +%= 1; dir -%= 1; }, State.weak => { m.* +%= 1; dir +%= 0; infections += 1; }, State.infected => { m.* +%= 1; dir +%= 1; }, State.flagged => { m.* +%= 1; dir +%= 2; }, } pos += moves[dir]; } try stdout.print("steps={}, infections={}\n", .{ steps, infections }); }
2017/day22.zig
const std = @import("std"); const io = std.io; const mem = std.mem; const macho = std.macho; const Allocator = mem.Allocator; const FormatOptions = std.fmt.FormatOptions; pub const LoadCommand = union(enum) { Segment: SegmentCommand, DyldInfoOnly: macho.dyld_info_command, Symtab: macho.symtab_command, Dysymtab: macho.dysymtab_command, Dylinker: DylinkerCommand, Dylib: DylibCommand, Main: macho.entry_point_command, VersionMin: macho.version_min_command, SourceVersion: macho.source_version_command, LinkeditData: macho.linkedit_data_command, Unknown: UnknownCommand, pub fn parse(allocator: *Allocator, reader: anytype) !LoadCommand { const header = try reader.readStruct(macho.load_command); try reader.context.seekBy(-@sizeOf(macho.load_command)); return switch (header.cmd) { macho.LC_SEGMENT_64 => LoadCommand{ .Segment = try SegmentCommand.parse(allocator, reader), }, macho.LC_DYLD_INFO, macho.LC_DYLD_INFO_ONLY, => LoadCommand{ .DyldInfoOnly = try parseCommand(macho.dyld_info_command, reader), }, macho.LC_SYMTAB => LoadCommand{ .Symtab = try parseCommand(macho.symtab_command, reader), }, macho.LC_DYSYMTAB => LoadCommand{ .Dysymtab = try parseCommand(macho.dysymtab_command, reader), }, macho.LC_ID_DYLINKER, macho.LC_LOAD_DYLINKER, macho.LC_DYLD_ENVIRONMENT, => LoadCommand{ .Dylinker = try DylinkerCommand.parse(allocator, reader), }, macho.LC_ID_DYLIB, macho.LC_LOAD_WEAK_DYLIB, macho.LC_LOAD_DYLIB, macho.LC_REEXPORT_DYLIB, => LoadCommand{ .Dylib = try DylibCommand.parse(allocator, reader), }, macho.LC_MAIN => LoadCommand{ .Main = try parseCommand(macho.entry_point_command, reader), }, macho.LC_VERSION_MIN_MACOSX, macho.LC_VERSION_MIN_IPHONEOS, macho.LC_VERSION_MIN_WATCHOS, macho.LC_VERSION_MIN_TVOS, => LoadCommand{ .VersionMin = try parseCommand(macho.version_min_command, reader), }, macho.LC_SOURCE_VERSION => LoadCommand{ .SourceVersion = try parseCommand(macho.source_version_command, reader), }, macho.LC_FUNCTION_STARTS, macho.LC_DATA_IN_CODE, macho.LC_CODE_SIGNATURE, => LoadCommand{ .LinkeditData = try parseCommand(macho.linkedit_data_command, reader), }, else => LoadCommand{ .Unknown = try UnknownCommand.parse(allocator, reader), }, }; } pub fn cmd(self: LoadCommand) u32 { return switch (self) { .DyldInfoOnly => |x| x.cmd, .Symtab => |x| x.cmd, .Dysymtab => |x| x.cmd, .Main => |x| x.cmd, .VersionMin => |x| x.cmd, .SourceVersion => |x| x.cmd, .LinkeditData => |x| x.cmd, .Segment => |x| x.cmd(), .Dylinker => |x| x.cmd(), .Dylib => |x| x.cmd(), .Unknown => |x| x.cmd(), }; } pub fn cmdsize(self: LoadCommand) u32 { return switch (self) { .DyldInfoOnly => |x| x.cmdsize, .Symtab => |x| x.cmdsize, .Dysymtab => |x| x.cmdsize, .Main => |x| x.cmdsize, .VersionMin => |x| x.cmdsize, .SourceVersion => |x| x.cmdsize, .LinkeditData => |x| x.cmdsize, .Segment => |x| x.cmdsize(), .Dylinker => |x| x.cmdsize(), .Dylib => |x| x.cmdsize(), .Unknown => |x| x.cmdsize(), }; } pub fn format( self: LoadCommand, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { return switch (self) { .Segment => |x| x.format(fmt, options, writer), .DyldInfoOnly => |x| formatDyldInfoCommand(x, fmt, options, writer), .Symtab => |x| formatSymtabCommand(x, fmt, options, writer), .Dysymtab => |x| formatDysymtabCommand(x, fmt, options, writer), .Dylinker => |x| x.format(fmt, options, writer), .Dylib => |x| x.format(fmt, options, writer), .Main => |x| formatMainCommand(x, fmt, options, writer), .VersionMin => |x| formatVersionMinCommand(x, fmt, options, writer), .SourceVersion => |x| formatSourceVersionCommand(x, fmt, options, writer), .LinkeditData => |x| formatLinkeditDataCommand(x, fmt, options, writer), .Unknown => |x| x.format(fmt, options, writer), }; } pub fn deinit(self: *LoadCommand, allocator: *Allocator) void { return switch (self.*) { .Segment => |*x| x.deinit(allocator), .Dylinker => |*x| x.deinit(allocator), .Dylib => |*x| x.deinit(allocator), .Unknown => |*x| x.deinit(allocator), else => {}, }; } }; pub const SegmentCommand = struct { inner: macho.segment_command_64, section_headers: std.ArrayListUnmanaged(macho.section_64) = .{}, pub fn parse(allocator: *Allocator, reader: anytype) !SegmentCommand { const inner = try reader.readStruct(macho.segment_command_64); var segment = SegmentCommand{ .inner = inner, }; try segment.section_headers.ensureCapacity(allocator, inner.nsects); var i: usize = 0; while (i < inner.nsects) : (i += 1) { const section_header = try reader.readStruct(macho.section_64); segment.section_headers.appendAssumeCapacity(section_header); } return segment; } pub fn cmd(self: SegmentCommand) u32 { return self.inner.cmd; } pub fn cmdsize(self: SegmentCommand) u32 { return self.inner.cmdsize; } pub fn format( self: SegmentCommand, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Segment command\n", .{}); try writer.print(" Command ID: LC_SEGMENT_64(0x{x})\n", .{self.inner.cmd}); try writer.print(" Command size: {}\n", .{self.inner.cmdsize}); try writer.print(" Segment name: {s}\n", .{self.inner.segname}); try writer.print(" VM address: 0x{x:0>16}\n", .{self.inner.vmaddr}); try writer.print(" VM size: {}\n", .{self.inner.vmsize}); try writer.print(" File offset: 0x{x:0>8}\n", .{self.inner.fileoff}); try writer.print(" File size: {}\n", .{self.inner.filesize}); try writer.print(" Maximum VM protection: 0x{x}\n", .{self.inner.maxprot}); try writer.print(" Initial VM protection: 0x{x}\n", .{self.inner.initprot}); try writer.print(" Number of sections: {}\n", .{self.inner.nsects}); try writer.print(" Flags: 0x{x}", .{self.inner.flags}); if (self.section_headers.items.len > 0) { try writer.print("\n Sections", .{}); for (self.section_headers.items) |section| { try writer.print("\n", .{}); try formatSectionHeader(section, fmt, options, writer); } } } pub fn deinit(self: *SegmentCommand, allocator: *Allocator) void { self.section_headers.deinit(allocator); } fn formatSectionHeader( section: macho.section_64, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print(" Section header\n", .{}); try writer.print(" Section name: {s}\n", .{section.sectname}); try writer.print(" Segment name: {s}\n", .{section.segname}); try writer.print(" Address: 0x{x:0>16}\n", .{section.addr}); try writer.print(" Size: {}\n", .{section.size}); try writer.print(" Offset: 0x{x:0>8}\n", .{section.offset}); try writer.print(" Alignment: {}\n", .{section.@"align"}); try writer.print(" Relocations offset: 0x{x:0>8}\n", .{section.reloff}); try writer.print(" Number of relocations: {}\n", .{section.nreloc}); try writer.print(" Flags: 0x{x}\n", .{section.flags}); try writer.print(" Reserved1: 0x{x}\n", .{section.reserved1}); try writer.print(" Reserved2: {}\n", .{section.reserved2}); try writer.print(" Reserved3: {}", .{section.reserved3}); } }; pub const DylinkerCommand = struct { inner: macho.dylinker_command, name: std.ArrayListUnmanaged(u8) = .{}, pub fn parse(allocator: *Allocator, reader: anytype) !DylinkerCommand { const inner = try reader.readStruct(macho.dylinker_command); var dylinker = DylinkerCommand{ .inner = inner, }; try reader.context.seekBy(-@sizeOf(macho.dylinker_command)); try reader.context.seekBy(inner.name); const name_len = inner.cmdsize - inner.name; try dylinker.name.ensureCapacity(allocator, name_len); var i: usize = 0; while (i < name_len) : (i += 1) { dylinker.name.appendAssumeCapacity(try reader.readByte()); } return dylinker; } pub fn cmd(self: DylinkerCommand) u32 { return self.inner.cmd; } pub fn cmdsize(self: DylinkerCommand) u32 { return self.inner.cmdsize; } pub fn format( self: DylinkerCommand, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Dylinker command\n", .{}); const cmd_id = switch (self.inner.cmd) { macho.LC_ID_DYLINKER => "LC_ID_DYLINKER", macho.LC_LOAD_DYLINKER => "LC_LOAD_DYLINKER", macho.LC_DYLD_ENVIRONMENT => "LC_DYLD_ENVIRONMENT", else => unreachable, }; try writer.print(" Command ID: {s}(0x{x})\n", .{ cmd_id, self.inner.cmd }); try writer.print(" String offset: {}\n", .{self.inner.name}); try writer.print(" Name: {s}", .{self.name.items}); } pub fn deinit(self: *DylinkerCommand, allocator: *Allocator) void { self.name.deinit(allocator); } }; pub const DylibCommand = struct { inner: macho.dylib_command, name: std.ArrayListUnmanaged(u8) = .{}, pub fn parse(allocator: *Allocator, reader: anytype) !DylibCommand { const inner = try reader.readStruct(macho.dylib_command); var dylib = DylibCommand{ .inner = inner, }; try reader.context.seekBy(-@sizeOf(macho.dylib_command)); try reader.context.seekBy(inner.dylib.name); const name_len = inner.cmdsize - inner.dylib.name; try dylib.name.ensureCapacity(allocator, name_len); var i: usize = 0; while (i < name_len) : (i += 1) { dylib.name.appendAssumeCapacity(try reader.readByte()); } return dylib; } pub fn cmd(self: DylibCommand) u32 { return self.inner.cmd; } pub fn cmdsize(self: DylibCommand) u32 { return self.inner.cmdsize; } pub fn format( self: DylibCommand, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Dylib command\n", .{}); const cmd_id = switch (self.inner.cmd) { macho.LC_ID_DYLIB => "LC_ID_DYLIB", macho.LC_LOAD_WEAK_DYLIB => "LC_LOAD_WEAK_DYLIB", macho.LC_LOAD_DYLIB => "LC_LOAD_DYLIB", macho.LC_REEXPORT_DYLIB => "LC_REEXPORT_DYLIB", else => unreachable, }; try writer.print(" Command ID: {s}(0x{x})\n", .{ cmd_id, self.inner.cmd }); try writer.print(" String offset: {}\n", .{self.inner.dylib.name}); try writer.print(" Timestamp: {}\n", .{self.inner.dylib.timestamp}); try writer.print(" Current version: {}\n", .{self.inner.dylib.current_version}); try writer.print(" Compatibility version: {}\n", .{self.inner.dylib.compatibility_version}); try writer.print(" Name: {s}", .{self.name.items}); } pub fn deinit(self: *DylibCommand, allocator: *Allocator) void { self.name.deinit(allocator); } }; fn parseCommand(comptime Cmd: type, reader: anytype) !Cmd { return try reader.readStruct(Cmd); } fn formatDyldInfoCommand( cmd: macho.dyld_info_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Dyld info command\n", .{}); const cmd_id = switch (cmd.cmd) { macho.LC_DYLD_INFO => "LC_DYLD_INFO", macho.LC_DYLD_INFO_ONLY => "LC_DYLD_INFO_ONLY", else => unreachable, }; try writer.print(" Command ID: {s}(0x{x})\n", .{ cmd_id, cmd.cmd }); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" Rebase table offset: 0x{x:0>8}\n", .{cmd.rebase_off}); try writer.print(" Rebase table size: {}\n", .{cmd.rebase_size}); try writer.print(" Bind table offset: 0x{x:0>8}\n", .{cmd.bind_off}); try writer.print(" Bind table size: {}\n", .{cmd.bind_size}); try writer.print(" Weak bind table offset: 0x{x:0>8}\n", .{cmd.weak_bind_off}); try writer.print(" Weak bind table size: {}\n", .{cmd.weak_bind_size}); try writer.print(" Lazy bind table offset: 0x{x:0>8}\n", .{cmd.lazy_bind_off}); try writer.print(" Lazy bind table size: {}\n", .{cmd.lazy_bind_size}); try writer.print(" Export table offset: 0x{x:0>8}\n", .{cmd.export_off}); try writer.print(" Export table size: {}", .{cmd.export_size}); } fn formatSymtabCommand( cmd: macho.symtab_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Symtab command\n", .{}); try writer.print(" Command ID: LC_SYMTAB(0x{x})\n", .{cmd.cmd}); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" Symbol table offset: 0x{x:0>8}\n", .{cmd.symoff}); try writer.print(" Number of symbol table entries: {}\n", .{cmd.nsyms}); try writer.print(" String table offset: 0x{x:0>8}\n", .{cmd.stroff}); try writer.print(" String table size: {}", .{cmd.strsize}); } fn formatDysymtabCommand( cmd: macho.dysymtab_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Dysymtab command\n", .{}); try writer.print(" Command ID: LC_DYSYMTAB(0x{x})\n", .{cmd.cmd}); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" Index of local symbols: {}\n", .{cmd.ilocalsym}); try writer.print(" Number of local symbols: {}\n", .{cmd.nlocalsym}); try writer.print(" Index of externally defined symbols: {}\n", .{cmd.iextdefsym}); try writer.print(" Number of externally defined symbols: {}\n", .{cmd.nextdefsym}); try writer.print(" Index of undefined symbols: {}\n", .{cmd.iundefsym}); try writer.print(" Number of undefined symbols: {}\n", .{cmd.nundefsym}); try writer.print(" Table of contents offset: 0x{x:0>8}\n", .{cmd.tocoff}); try writer.print(" Number of entries in table of contents: {}\n", .{cmd.ntoc}); try writer.print(" Module table offset: 0x{x:0>8}\n", .{cmd.modtaboff}); try writer.print(" Number of module table entries: {}\n", .{cmd.nmodtab}); try writer.print(" Referenced symbol table offset: 0x{x:0>8}\n", .{cmd.extrefsymoff}); try writer.print(" Number of referenced symbol table entries: {}\n", .{cmd.nextrefsyms}); try writer.print(" Indirect symbol table offset: 0x{x:0>8}\n", .{cmd.indirectsymoff}); try writer.print(" Number of indirect symbol table entries: {}\n", .{cmd.nindirectsyms}); try writer.print(" External relocation table offset: 0x{x:0>8}\n", .{cmd.extreloff}); try writer.print(" Number of external relocation table entries: {}\n", .{cmd.nextrel}); try writer.print(" Local relocation table offset: 0x{x:0>8}\n", .{cmd.locreloff}); try writer.print(" Number of local relocation table entries: {}", .{cmd.nlocrel}); } fn formatMainCommand( cmd: macho.entry_point_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Main command\n", .{}); try writer.print(" Command ID: LC_MAIN(0x{x})\n", .{cmd.cmd}); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" File (__TEXT) offset of main(): 0x{x:0>8}\n", .{cmd.entryoff}); try writer.print(" Initial stack size: {}", .{cmd.stacksize}); } fn formatVersionMinCommand( cmd: macho.version_min_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Version minimum command\n", .{}); const cmd_id = switch (cmd.cmd) { macho.LC_VERSION_MIN_MACOSX => "LC_VERSION_MIN_MACOSX", macho.LC_VERSION_MIN_IPHONEOS => "LC_VERSION_MIN_IPHONEOS", macho.LC_VERSION_MIN_WATCHOS => "LC_VERSION_MIN_WATCHOS", macho.LC_VERSION_MIN_TVOS => "LC_VERSION_MIN_TVOS", else => unreachable, }; try writer.print(" Command ID: {s}(0x{x})\n", .{ cmd_id, cmd.cmd }); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" Version: {}\n", .{cmd.version}); try writer.print(" SDK version: {}", .{cmd.sdk}); } fn formatSourceVersionCommand( cmd: macho.source_version_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Source version command\n", .{}); try writer.print(" Command ID: LC_SOURCE_VERSION(0x{x})\n", .{cmd.cmd}); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" Version: {}", .{cmd.version}); } fn formatLinkeditDataCommand( cmd: macho.linkedit_data_command, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Linkedit data command\n", .{}); const cmd_id = switch (cmd.cmd) { macho.LC_CODE_SIGNATURE => "LC_CODE_SIGNATURE", macho.LC_FUNCTION_STARTS => "LC_FUNCTION_STARTS", macho.LC_DATA_IN_CODE => "LC_DATA_IN_CODE", else => unreachable, }; try writer.print(" Command ID: {s}(0x{x})\n", .{ cmd_id, cmd.cmd }); try writer.print(" Command size: {}\n", .{cmd.cmdsize}); try writer.print(" Data offset: {}\n", .{cmd.dataoff}); try writer.print(" Data size: {}", .{cmd.datasize}); } pub const UnknownCommand = struct { inner: macho.load_command, contents: std.ArrayListUnmanaged(u8) = .{}, pub fn parse(allocator: *Allocator, reader: anytype) !UnknownCommand { const inner = try reader.readStruct(macho.load_command); var contents = try allocator.alloc(u8, inner.cmdsize - @sizeOf(macho.load_command)); _ = try reader.readAll(contents[0..]); return UnknownCommand{ .inner = inner, .contents = std.ArrayList(u8).fromOwnedSlice(allocator, contents).toUnmanaged(), }; } pub fn cmd(self: UnknownCommand) u32 { return self.inner.cmd; } pub fn cmdsize(self: UnknownCommand) u32 { return self.inner.cmdsize; } pub fn format( self: UnknownCommand, comptime fmt: []const u8, options: FormatOptions, writer: anytype, ) !void { try writer.print("Unknown command\n", .{}); try writer.print(" Command ID: ??(0x{x})\n", .{self.inner.cmd}); try writer.print(" Command size: {}\n", .{self.inner.cmdsize}); try writer.print(" Raw contents: 0x{x}", .{ std.fmt.fmtSliceHexLower(self.contents.items[0..]), }); } pub fn deinit(self: *UnknownCommand, allocator: *Allocator) void { self.contents.deinit(allocator); } };
src/ZachO/commands.zig
pub const OFFLINEFILES_SYNC_STATE_LOCAL_KNOWN = @as(u32, 1); pub const OFFLINEFILES_SYNC_STATE_REMOTE_KNOWN = @as(u32, 2); pub const OFFLINEFILES_CHANGES_NONE = @as(u32, 0); pub const OFFLINEFILES_CHANGES_LOCAL_SIZE = @as(u32, 1); pub const OFFLINEFILES_CHANGES_LOCAL_ATTRIBUTES = @as(u32, 2); pub const OFFLINEFILES_CHANGES_LOCAL_TIME = @as(u32, 4); pub const OFFLINEFILES_CHANGES_REMOTE_SIZE = @as(u32, 8); pub const OFFLINEFILES_CHANGES_REMOTE_ATTRIBUTES = @as(u32, 16); pub const OFFLINEFILES_CHANGES_REMOTE_TIME = @as(u32, 32); pub const OFFLINEFILES_ITEM_FILTER_FLAG_MODIFIED_DATA = @as(u32, 1); pub const OFFLINEFILES_ITEM_FILTER_FLAG_MODIFIED_ATTRIBUTES = @as(u32, 2); pub const OFFLINEFILES_ITEM_FILTER_FLAG_MODIFIED = @as(u32, 4); pub const OFFLINEFILES_ITEM_FILTER_FLAG_CREATED = @as(u32, 8); pub const OFFLINEFILES_ITEM_FILTER_FLAG_DELETED = @as(u32, 16); pub const OFFLINEFILES_ITEM_FILTER_FLAG_DIRTY = @as(u32, 32); pub const OFFLINEFILES_ITEM_FILTER_FLAG_SPARSE = @as(u32, 64); pub const OFFLINEFILES_ITEM_FILTER_FLAG_FILE = @as(u32, 128); pub const OFFLINEFILES_ITEM_FILTER_FLAG_DIRECTORY = @as(u32, 256); pub const OFFLINEFILES_ITEM_FILTER_FLAG_PINNED_USER = @as(u32, 512); pub const OFFLINEFILES_ITEM_FILTER_FLAG_PINNED_OTHERS = @as(u32, 1024); pub const OFFLINEFILES_ITEM_FILTER_FLAG_PINNED_COMPUTER = @as(u32, 2048); pub const OFFLINEFILES_ITEM_FILTER_FLAG_PINNED = @as(u32, 4096); pub const OFFLINEFILES_ITEM_FILTER_FLAG_GHOST = @as(u32, 8192); pub const OFFLINEFILES_ITEM_FILTER_FLAG_SUSPENDED = @as(u32, 16384); pub const OFFLINEFILES_ITEM_FILTER_FLAG_OFFLINE = @as(u32, 32768); pub const OFFLINEFILES_ITEM_FILTER_FLAG_ONLINE = @as(u32, 65536); pub const OFFLINEFILES_ITEM_FILTER_FLAG_USER_WRITE = @as(u32, 131072); pub const OFFLINEFILES_ITEM_FILTER_FLAG_USER_READ = @as(u32, 262144); pub const OFFLINEFILES_ITEM_FILTER_FLAG_USER_ANYACCESS = @as(u32, 524288); pub const OFFLINEFILES_ITEM_FILTER_FLAG_OTHER_WRITE = @as(u32, 1048576); pub const OFFLINEFILES_ITEM_FILTER_FLAG_OTHER_READ = @as(u32, 2097152); pub const OFFLINEFILES_ITEM_FILTER_FLAG_OTHER_ANYACCESS = @as(u32, 4194304); pub const OFFLINEFILES_ITEM_FILTER_FLAG_GUEST_WRITE = @as(u32, 8388608); pub const OFFLINEFILES_ITEM_FILTER_FLAG_GUEST_READ = @as(u32, 16777216); pub const OFFLINEFILES_ITEM_FILTER_FLAG_GUEST_ANYACCESS = @as(u32, 33554432); pub const OFFLINEFILES_ITEM_QUERY_REMOTEINFO = @as(u32, 1); pub const OFFLINEFILES_ITEM_QUERY_CONNECTIONSTATE = @as(u32, 2); pub const OFFLINEFILES_ITEM_QUERY_LOCALDIRTYBYTECOUNT = @as(u32, 4); pub const OFFLINEFILES_ITEM_QUERY_REMOTEDIRTYBYTECOUNT = @as(u32, 8); pub const OFFLINEFILES_ITEM_QUERY_INCLUDETRANSPARENTCACHE = @as(u32, 16); pub const OFFLINEFILES_ITEM_QUERY_ATTEMPT_TRANSITIONONLINE = @as(u32, 32); pub const OFFLINEFILES_ITEM_QUERY_ADMIN = @as(u32, 2147483648); pub const OFFLINEFILES_ENUM_FLAT = @as(u32, 1); pub const OFFLINEFILES_ENUM_FLAT_FILESONLY = @as(u32, 2); pub const OFFLINEFILES_SETTING_SCOPE_USER = @as(u32, 1); pub const OFFLINEFILES_SETTING_SCOPE_COMPUTER = @as(u32, 2); pub const OFFLINEFILES_PINLINKTARGETS_NEVER = @as(u32, 0); pub const OFFLINEFILES_PINLINKTARGETS_EXPLICIT = @as(u32, 1); pub const OFFLINEFILES_PINLINKTARGETS_ALWAYS = @as(u32, 2); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_FILLSPARSE = @as(u32, 1); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_SYNCIN = @as(u32, 2); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_SYNCOUT = @as(u32, 4); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_PINNEWFILES = @as(u32, 8); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_PINLINKTARGETS = @as(u32, 16); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_PINFORUSER = @as(u32, 32); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_PINFORUSER_POLICY = @as(u32, 64); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_PINFORALL = @as(u32, 128); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_PINFORREDIR = @as(u32, 256); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_LOWPRIORITY = @as(u32, 512); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_ASYNCPROGRESS = @as(u32, 1024); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_INTERACTIVE = @as(u32, 2048); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_CONSOLE = @as(u32, 4096); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_SKIPSUSPENDEDDIRS = @as(u32, 8192); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_BACKGROUND = @as(u32, 65536); pub const OFFLINEFILES_SYNC_CONTROL_FLAG_NONEWFILESOUT = @as(u32, 131072); pub const OFFLINEFILES_SYNC_CONTROL_CR_MASK = @as(u32, 4026531840); pub const OFFLINEFILES_SYNC_CONTROL_CR_DEFAULT = @as(u32, 0); pub const OFFLINEFILES_SYNC_CONTROL_CR_KEEPLOCAL = @as(u32, 268435456); pub const OFFLINEFILES_SYNC_CONTROL_CR_KEEPREMOTE = @as(u32, 536870912); pub const OFFLINEFILES_SYNC_CONTROL_CR_KEEPLATEST = @as(u32, 805306368); pub const OFFLINEFILES_PIN_CONTROL_FLAG_FORUSER = @as(u32, 32); pub const OFFLINEFILES_PIN_CONTROL_FLAG_FORUSER_POLICY = @as(u32, 64); pub const OFFLINEFILES_PIN_CONTROL_FLAG_FORALL = @as(u32, 128); pub const OFFLINEFILES_PIN_CONTROL_FLAG_FORREDIR = @as(u32, 256); pub const OFFLINEFILES_PIN_CONTROL_FLAG_FILL = @as(u32, 1); pub const OFFLINEFILES_PIN_CONTROL_FLAG_LOWPRIORITY = @as(u32, 512); pub const OFFLINEFILES_PIN_CONTROL_FLAG_ASYNCPROGRESS = @as(u32, 1024); pub const OFFLINEFILES_PIN_CONTROL_FLAG_INTERACTIVE = @as(u32, 2048); pub const OFFLINEFILES_PIN_CONTROL_FLAG_CONSOLE = @as(u32, 4096); pub const OFFLINEFILES_PIN_CONTROL_FLAG_PINLINKTARGETS = @as(u32, 16); pub const OFFLINEFILES_PIN_CONTROL_FLAG_BACKGROUND = @as(u32, 65536); pub const OFFLINEFILES_ENCRYPTION_CONTROL_FLAG_LOWPRIORITY = @as(u32, 512); pub const OFFLINEFILES_ENCRYPTION_CONTROL_FLAG_ASYNCPROGRESS = @as(u32, 1024); pub const OFFLINEFILES_ENCRYPTION_CONTROL_FLAG_INTERACTIVE = @as(u32, 2048); pub const OFFLINEFILES_ENCRYPTION_CONTROL_FLAG_CONSOLE = @as(u32, 4096); pub const OFFLINEFILES_ENCRYPTION_CONTROL_FLAG_BACKGROUND = @as(u32, 65536); pub const OFFLINEFILES_DELETE_FLAG_NOAUTOCACHED = @as(u32, 1); pub const OFFLINEFILES_DELETE_FLAG_NOPINNED = @as(u32, 2); pub const OFFLINEFILES_DELETE_FLAG_DELMODIFIED = @as(u32, 4); pub const OFFLINEFILES_DELETE_FLAG_ADMIN = @as(u32, 2147483648); pub const OFFLINEFILES_TRANSITION_FLAG_INTERACTIVE = @as(u32, 1); pub const OFFLINEFILES_TRANSITION_FLAG_CONSOLE = @as(u32, 2); pub const OFFLINEFILES_SYNC_ITEM_CHANGE_NONE = @as(u32, 0); pub const OFFLINEFILES_SYNC_ITEM_CHANGE_CHANGETIME = @as(u32, 1); pub const OFFLINEFILES_SYNC_ITEM_CHANGE_WRITETIME = @as(u32, 2); pub const OFFLINEFILES_SYNC_ITEM_CHANGE_FILESIZE = @as(u32, 4); pub const OFFLINEFILES_SYNC_ITEM_CHANGE_ATTRIBUTES = @as(u32, 8); //-------------------------------------------------------------------------------- // Section: Types (51) //-------------------------------------------------------------------------------- const CLSID_OfflineFilesSetting_Value = @import("../zig.zig").Guid.initString("fd3659e9-a920-4123-ad64-7fc76c7aacdf"); pub const CLSID_OfflineFilesSetting = &CLSID_OfflineFilesSetting_Value; const CLSID_OfflineFilesCache_Value = @import("../zig.zig").Guid.initString("48c6be7c-3871-43cc-b46f-1449a1bb2ff3"); pub const CLSID_OfflineFilesCache = &CLSID_OfflineFilesCache_Value; pub const OFFLINEFILES_ITEM_TYPE = enum(i32) { FILE = 0, DIRECTORY = 1, SHARE = 2, SERVER = 3, }; pub const OFFLINEFILES_ITEM_TYPE_FILE = OFFLINEFILES_ITEM_TYPE.FILE; pub const OFFLINEFILES_ITEM_TYPE_DIRECTORY = OFFLINEFILES_ITEM_TYPE.DIRECTORY; pub const OFFLINEFILES_ITEM_TYPE_SHARE = OFFLINEFILES_ITEM_TYPE.SHARE; pub const OFFLINEFILES_ITEM_TYPE_SERVER = OFFLINEFILES_ITEM_TYPE.SERVER; pub const OFFLINEFILES_ITEM_COPY = enum(i32) { LOCAL = 0, REMOTE = 1, ORIGINAL = 2, }; pub const OFFLINEFILES_ITEM_COPY_LOCAL = OFFLINEFILES_ITEM_COPY.LOCAL; pub const OFFLINEFILES_ITEM_COPY_REMOTE = OFFLINEFILES_ITEM_COPY.REMOTE; pub const OFFLINEFILES_ITEM_COPY_ORIGINAL = OFFLINEFILES_ITEM_COPY.ORIGINAL; pub const OFFLINEFILES_CONNECT_STATE = enum(i32) { UNKNOWN = 0, OFFLINE = 1, ONLINE = 2, TRANSPARENTLY_CACHED = 3, PARTLY_TRANSPARENTLY_CACHED = 4, }; pub const OFFLINEFILES_CONNECT_STATE_UNKNOWN = OFFLINEFILES_CONNECT_STATE.UNKNOWN; pub const OFFLINEFILES_CONNECT_STATE_OFFLINE = OFFLINEFILES_CONNECT_STATE.OFFLINE; pub const OFFLINEFILES_CONNECT_STATE_ONLINE = OFFLINEFILES_CONNECT_STATE.ONLINE; pub const OFFLINEFILES_CONNECT_STATE_TRANSPARENTLY_CACHED = OFFLINEFILES_CONNECT_STATE.TRANSPARENTLY_CACHED; pub const OFFLINEFILES_CONNECT_STATE_PARTLY_TRANSPARENTLY_CACHED = OFFLINEFILES_CONNECT_STATE.PARTLY_TRANSPARENTLY_CACHED; pub const OFFLINEFILES_OFFLINE_REASON = enum(i32) { UNKNOWN = 0, NOT_APPLICABLE = 1, CONNECTION_FORCED = 2, CONNECTION_SLOW = 3, CONNECTION_ERROR = 4, ITEM_VERSION_CONFLICT = 5, ITEM_SUSPENDED = 6, }; pub const OFFLINEFILES_OFFLINE_REASON_UNKNOWN = OFFLINEFILES_OFFLINE_REASON.UNKNOWN; pub const OFFLINEFILES_OFFLINE_REASON_NOT_APPLICABLE = OFFLINEFILES_OFFLINE_REASON.NOT_APPLICABLE; pub const OFFLINEFILES_OFFLINE_REASON_CONNECTION_FORCED = OFFLINEFILES_OFFLINE_REASON.CONNECTION_FORCED; pub const OFFLINEFILES_OFFLINE_REASON_CONNECTION_SLOW = OFFLINEFILES_OFFLINE_REASON.CONNECTION_SLOW; pub const OFFLINEFILES_OFFLINE_REASON_CONNECTION_ERROR = OFFLINEFILES_OFFLINE_REASON.CONNECTION_ERROR; pub const OFFLINEFILES_OFFLINE_REASON_ITEM_VERSION_CONFLICT = OFFLINEFILES_OFFLINE_REASON.ITEM_VERSION_CONFLICT; pub const OFFLINEFILES_OFFLINE_REASON_ITEM_SUSPENDED = OFFLINEFILES_OFFLINE_REASON.ITEM_SUSPENDED; pub const OFFLINEFILES_CACHING_MODE = enum(i32) { NONE = 0, NOCACHING = 1, MANUAL = 2, AUTO_DOC = 3, AUTO_PROGANDDOC = 4, }; pub const OFFLINEFILES_CACHING_MODE_NONE = OFFLINEFILES_CACHING_MODE.NONE; pub const OFFLINEFILES_CACHING_MODE_NOCACHING = OFFLINEFILES_CACHING_MODE.NOCACHING; pub const OFFLINEFILES_CACHING_MODE_MANUAL = OFFLINEFILES_CACHING_MODE.MANUAL; pub const OFFLINEFILES_CACHING_MODE_AUTO_DOC = OFFLINEFILES_CACHING_MODE.AUTO_DOC; pub const OFFLINEFILES_CACHING_MODE_AUTO_PROGANDDOC = OFFLINEFILES_CACHING_MODE.AUTO_PROGANDDOC; pub const OFFLINEFILES_OP_RESPONSE = enum(i32) { CONTINUE = 0, RETRY = 1, ABORT = 2, }; pub const OFFLINEFILES_OP_CONTINUE = OFFLINEFILES_OP_RESPONSE.CONTINUE; pub const OFFLINEFILES_OP_RETRY = OFFLINEFILES_OP_RESPONSE.RETRY; pub const OFFLINEFILES_OP_ABORT = OFFLINEFILES_OP_RESPONSE.ABORT; pub const OFFLINEFILES_EVENTS = enum(i32) { EVENT_CACHEMOVED = 0, EVENT_CACHEISFULL = 1, EVENT_CACHEISCORRUPTED = 2, EVENT_ENABLED = 3, EVENT_ENCRYPTIONCHANGED = 4, EVENT_SYNCBEGIN = 5, EVENT_SYNCFILERESULT = 6, EVENT_SYNCCONFLICTRECADDED = 7, EVENT_SYNCCONFLICTRECUPDATED = 8, EVENT_SYNCCONFLICTRECREMOVED = 9, EVENT_SYNCEND = 10, EVENT_BACKGROUNDSYNCBEGIN = 11, EVENT_BACKGROUNDSYNCEND = 12, EVENT_NETTRANSPORTARRIVED = 13, EVENT_NONETTRANSPORTS = 14, EVENT_ITEMDISCONNECTED = 15, EVENT_ITEMRECONNECTED = 16, EVENT_ITEMAVAILABLEOFFLINE = 17, EVENT_ITEMNOTAVAILABLEOFFLINE = 18, EVENT_ITEMPINNED = 19, EVENT_ITEMNOTPINNED = 20, EVENT_ITEMMODIFIED = 21, EVENT_ITEMADDEDTOCACHE = 22, EVENT_ITEMDELETEDFROMCACHE = 23, EVENT_ITEMRENAMED = 24, EVENT_DATALOST = 25, EVENT_PING = 26, EVENT_ITEMRECONNECTBEGIN = 27, EVENT_ITEMRECONNECTEND = 28, EVENT_CACHEEVICTBEGIN = 29, EVENT_CACHEEVICTEND = 30, EVENT_POLICYCHANGEDETECTED = 31, EVENT_PREFERENCECHANGEDETECTED = 32, EVENT_SETTINGSCHANGESAPPLIED = 33, EVENT_TRANSPARENTCACHEITEMNOTIFY = 34, EVENT_PREFETCHFILEBEGIN = 35, EVENT_PREFETCHFILEEND = 36, EVENT_PREFETCHCLOSEHANDLEBEGIN = 37, EVENT_PREFETCHCLOSEHANDLEEND = 38, NUM_EVENTS = 39, }; pub const OFFLINEFILES_EVENT_CACHEMOVED = OFFLINEFILES_EVENTS.EVENT_CACHEMOVED; pub const OFFLINEFILES_EVENT_CACHEISFULL = OFFLINEFILES_EVENTS.EVENT_CACHEISFULL; pub const OFFLINEFILES_EVENT_CACHEISCORRUPTED = OFFLINEFILES_EVENTS.EVENT_CACHEISCORRUPTED; pub const OFFLINEFILES_EVENT_ENABLED = OFFLINEFILES_EVENTS.EVENT_ENABLED; pub const OFFLINEFILES_EVENT_ENCRYPTIONCHANGED = OFFLINEFILES_EVENTS.EVENT_ENCRYPTIONCHANGED; pub const OFFLINEFILES_EVENT_SYNCBEGIN = OFFLINEFILES_EVENTS.EVENT_SYNCBEGIN; pub const OFFLINEFILES_EVENT_SYNCFILERESULT = OFFLINEFILES_EVENTS.EVENT_SYNCFILERESULT; pub const OFFLINEFILES_EVENT_SYNCCONFLICTRECADDED = OFFLINEFILES_EVENTS.EVENT_SYNCCONFLICTRECADDED; pub const OFFLINEFILES_EVENT_SYNCCONFLICTRECUPDATED = OFFLINEFILES_EVENTS.EVENT_SYNCCONFLICTRECUPDATED; pub const OFFLINEFILES_EVENT_SYNCCONFLICTRECREMOVED = OFFLINEFILES_EVENTS.EVENT_SYNCCONFLICTRECREMOVED; pub const OFFLINEFILES_EVENT_SYNCEND = OFFLINEFILES_EVENTS.EVENT_SYNCEND; pub const OFFLINEFILES_EVENT_BACKGROUNDSYNCBEGIN = OFFLINEFILES_EVENTS.EVENT_BACKGROUNDSYNCBEGIN; pub const OFFLINEFILES_EVENT_BACKGROUNDSYNCEND = OFFLINEFILES_EVENTS.EVENT_BACKGROUNDSYNCEND; pub const OFFLINEFILES_EVENT_NETTRANSPORTARRIVED = OFFLINEFILES_EVENTS.EVENT_NETTRANSPORTARRIVED; pub const OFFLINEFILES_EVENT_NONETTRANSPORTS = OFFLINEFILES_EVENTS.EVENT_NONETTRANSPORTS; pub const OFFLINEFILES_EVENT_ITEMDISCONNECTED = OFFLINEFILES_EVENTS.EVENT_ITEMDISCONNECTED; pub const OFFLINEFILES_EVENT_ITEMRECONNECTED = OFFLINEFILES_EVENTS.EVENT_ITEMRECONNECTED; pub const OFFLINEFILES_EVENT_ITEMAVAILABLEOFFLINE = OFFLINEFILES_EVENTS.EVENT_ITEMAVAILABLEOFFLINE; pub const OFFLINEFILES_EVENT_ITEMNOTAVAILABLEOFFLINE = OFFLINEFILES_EVENTS.EVENT_ITEMNOTAVAILABLEOFFLINE; pub const OFFLINEFILES_EVENT_ITEMPINNED = OFFLINEFILES_EVENTS.EVENT_ITEMPINNED; pub const OFFLINEFILES_EVENT_ITEMNOTPINNED = OFFLINEFILES_EVENTS.EVENT_ITEMNOTPINNED; pub const OFFLINEFILES_EVENT_ITEMMODIFIED = OFFLINEFILES_EVENTS.EVENT_ITEMMODIFIED; pub const OFFLINEFILES_EVENT_ITEMADDEDTOCACHE = OFFLINEFILES_EVENTS.EVENT_ITEMADDEDTOCACHE; pub const OFFLINEFILES_EVENT_ITEMDELETEDFROMCACHE = OFFLINEFILES_EVENTS.EVENT_ITEMDELETEDFROMCACHE; pub const OFFLINEFILES_EVENT_ITEMRENAMED = OFFLINEFILES_EVENTS.EVENT_ITEMRENAMED; pub const OFFLINEFILES_EVENT_DATALOST = OFFLINEFILES_EVENTS.EVENT_DATALOST; pub const OFFLINEFILES_EVENT_PING = OFFLINEFILES_EVENTS.EVENT_PING; pub const OFFLINEFILES_EVENT_ITEMRECONNECTBEGIN = OFFLINEFILES_EVENTS.EVENT_ITEMRECONNECTBEGIN; pub const OFFLINEFILES_EVENT_ITEMRECONNECTEND = OFFLINEFILES_EVENTS.EVENT_ITEMRECONNECTEND; pub const OFFLINEFILES_EVENT_CACHEEVICTBEGIN = OFFLINEFILES_EVENTS.EVENT_CACHEEVICTBEGIN; pub const OFFLINEFILES_EVENT_CACHEEVICTEND = OFFLINEFILES_EVENTS.EVENT_CACHEEVICTEND; pub const OFFLINEFILES_EVENT_POLICYCHANGEDETECTED = OFFLINEFILES_EVENTS.EVENT_POLICYCHANGEDETECTED; pub const OFFLINEFILES_EVENT_PREFERENCECHANGEDETECTED = OFFLINEFILES_EVENTS.EVENT_PREFERENCECHANGEDETECTED; pub const OFFLINEFILES_EVENT_SETTINGSCHANGESAPPLIED = OFFLINEFILES_EVENTS.EVENT_SETTINGSCHANGESAPPLIED; pub const OFFLINEFILES_EVENT_TRANSPARENTCACHEITEMNOTIFY = OFFLINEFILES_EVENTS.EVENT_TRANSPARENTCACHEITEMNOTIFY; pub const OFFLINEFILES_EVENT_PREFETCHFILEBEGIN = OFFLINEFILES_EVENTS.EVENT_PREFETCHFILEBEGIN; pub const OFFLINEFILES_EVENT_PREFETCHFILEEND = OFFLINEFILES_EVENTS.EVENT_PREFETCHFILEEND; pub const OFFLINEFILES_EVENT_PREFETCHCLOSEHANDLEBEGIN = OFFLINEFILES_EVENTS.EVENT_PREFETCHCLOSEHANDLEBEGIN; pub const OFFLINEFILES_EVENT_PREFETCHCLOSEHANDLEEND = OFFLINEFILES_EVENTS.EVENT_PREFETCHCLOSEHANDLEEND; pub const OFFLINEFILES_NUM_EVENTS = OFFLINEFILES_EVENTS.NUM_EVENTS; pub const OFFLINEFILES_PATHFILTER_MATCH = enum(i32) { SELF = 0, CHILD = 1, DESCENDENT = 2, SELFORCHILD = 3, SELFORDESCENDENT = 4, }; pub const OFFLINEFILES_PATHFILTER_SELF = OFFLINEFILES_PATHFILTER_MATCH.SELF; pub const OFFLINEFILES_PATHFILTER_CHILD = OFFLINEFILES_PATHFILTER_MATCH.CHILD; pub const OFFLINEFILES_PATHFILTER_DESCENDENT = OFFLINEFILES_PATHFILTER_MATCH.DESCENDENT; pub const OFFLINEFILES_PATHFILTER_SELFORCHILD = OFFLINEFILES_PATHFILTER_MATCH.SELFORCHILD; pub const OFFLINEFILES_PATHFILTER_SELFORDESCENDENT = OFFLINEFILES_PATHFILTER_MATCH.SELFORDESCENDENT; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE = enum(i32) { RESOLVE_NONE = 0, RESOLVE_KEEPLOCAL = 1, RESOLVE_KEEPREMOTE = 2, RESOLVE_KEEPALLCHANGES = 3, RESOLVE_KEEPLATEST = 4, RESOLVE_LOG = 5, RESOLVE_SKIP = 6, ABORT = 7, RESOLVE_NUMCODES = 8, }; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_NONE = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_NONE; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_KEEPLOCAL = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_KEEPLOCAL; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_KEEPREMOTE = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_KEEPREMOTE; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_KEEPALLCHANGES = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_KEEPALLCHANGES; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_KEEPLATEST = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_KEEPLATEST; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_LOG = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_LOG; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_SKIP = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_SKIP; pub const OFFLINEFILES_SYNC_CONFLICT_ABORT = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.ABORT; pub const OFFLINEFILES_SYNC_CONFLICT_RESOLVE_NUMCODES = OFFLINEFILES_SYNC_CONFLICT_RESOLVE.RESOLVE_NUMCODES; pub const OFFLINEFILES_ITEM_TIME = enum(i32) { CREATION = 0, LASTACCESS = 1, LASTWRITE = 2, }; pub const OFFLINEFILES_ITEM_TIME_CREATION = OFFLINEFILES_ITEM_TIME.CREATION; pub const OFFLINEFILES_ITEM_TIME_LASTACCESS = OFFLINEFILES_ITEM_TIME.LASTACCESS; pub const OFFLINEFILES_ITEM_TIME_LASTWRITE = OFFLINEFILES_ITEM_TIME.LASTWRITE; pub const OFFLINEFILES_COMPARE = enum(i32) { EQ = 0, NEQ = 1, LT = 2, GT = 3, LTE = 4, GTE = 5, }; pub const OFFLINEFILES_COMPARE_EQ = OFFLINEFILES_COMPARE.EQ; pub const OFFLINEFILES_COMPARE_NEQ = OFFLINEFILES_COMPARE.NEQ; pub const OFFLINEFILES_COMPARE_LT = OFFLINEFILES_COMPARE.LT; pub const OFFLINEFILES_COMPARE_GT = OFFLINEFILES_COMPARE.GT; pub const OFFLINEFILES_COMPARE_LTE = OFFLINEFILES_COMPARE.LTE; pub const OFFLINEFILES_COMPARE_GTE = OFFLINEFILES_COMPARE.GTE; pub const OFFLINEFILES_SETTING_VALUE_TYPE = enum(i32) { UI4 = 0, BSTR = 1, BSTR_DBLNULTERM = 2, @"2DIM_ARRAY_BSTR_UI4" = 3, @"2DIM_ARRAY_BSTR_BSTR" = 4, }; pub const OFFLINEFILES_SETTING_VALUE_UI4 = OFFLINEFILES_SETTING_VALUE_TYPE.UI4; pub const OFFLINEFILES_SETTING_VALUE_BSTR = OFFLINEFILES_SETTING_VALUE_TYPE.BSTR; pub const OFFLINEFILES_SETTING_VALUE_BSTR_DBLNULTERM = OFFLINEFILES_SETTING_VALUE_TYPE.BSTR_DBLNULTERM; pub const OFFLINEFILES_SETTING_VALUE_2DIM_ARRAY_BSTR_UI4 = OFFLINEFILES_SETTING_VALUE_TYPE.@"2DIM_ARRAY_BSTR_UI4"; pub const OFFLINEFILES_SETTING_VALUE_2DIM_ARRAY_BSTR_BSTR = OFFLINEFILES_SETTING_VALUE_TYPE.@"2DIM_ARRAY_BSTR_BSTR"; pub const OFFLINEFILES_SYNC_OPERATION = enum(i32) { CREATE_COPY_ON_SERVER = 0, CREATE_COPY_ON_CLIENT = 1, SYNC_TO_SERVER = 2, SYNC_TO_CLIENT = 3, DELETE_SERVER_COPY = 4, DELETE_CLIENT_COPY = 5, PIN = 6, PREPARE = 7, }; pub const OFFLINEFILES_SYNC_OPERATION_CREATE_COPY_ON_SERVER = OFFLINEFILES_SYNC_OPERATION.CREATE_COPY_ON_SERVER; pub const OFFLINEFILES_SYNC_OPERATION_CREATE_COPY_ON_CLIENT = OFFLINEFILES_SYNC_OPERATION.CREATE_COPY_ON_CLIENT; pub const OFFLINEFILES_SYNC_OPERATION_SYNC_TO_SERVER = OFFLINEFILES_SYNC_OPERATION.SYNC_TO_SERVER; pub const OFFLINEFILES_SYNC_OPERATION_SYNC_TO_CLIENT = OFFLINEFILES_SYNC_OPERATION.SYNC_TO_CLIENT; pub const OFFLINEFILES_SYNC_OPERATION_DELETE_SERVER_COPY = OFFLINEFILES_SYNC_OPERATION.DELETE_SERVER_COPY; pub const OFFLINEFILES_SYNC_OPERATION_DELETE_CLIENT_COPY = OFFLINEFILES_SYNC_OPERATION.DELETE_CLIENT_COPY; pub const OFFLINEFILES_SYNC_OPERATION_PIN = OFFLINEFILES_SYNC_OPERATION.PIN; pub const OFFLINEFILES_SYNC_OPERATION_PREPARE = OFFLINEFILES_SYNC_OPERATION.PREPARE; pub const OFFLINEFILES_SYNC_STATE = enum(i32) { Stable = 0, FileOnClient_DirOnServer = 1, FileOnClient_NoServerCopy = 2, DirOnClient_FileOnServer = 3, DirOnClient_FileChangedOnServer = 4, DirOnClient_NoServerCopy = 5, FileCreatedOnClient_NoServerCopy = 6, FileCreatedOnClient_FileChangedOnServer = 7, FileCreatedOnClient_DirChangedOnServer = 8, FileCreatedOnClient_FileOnServer = 9, FileCreatedOnClient_DirOnServer = 10, FileCreatedOnClient_DeletedOnServer = 11, FileChangedOnClient_ChangedOnServer = 12, FileChangedOnClient_DirOnServer = 13, FileChangedOnClient_DirChangedOnServer = 14, FileChangedOnClient_DeletedOnServer = 15, FileSparseOnClient_ChangedOnServer = 16, FileSparseOnClient_DeletedOnServer = 17, FileSparseOnClient_DirOnServer = 18, FileSparseOnClient_DirChangedOnServer = 19, DirCreatedOnClient_NoServerCopy = 20, DirCreatedOnClient_DirOnServer = 21, DirCreatedOnClient_FileOnServer = 22, DirCreatedOnClient_FileChangedOnServer = 23, DirCreatedOnClient_DirChangedOnServer = 24, DirCreatedOnClient_DeletedOnServer = 25, DirChangedOnClient_FileOnServer = 26, DirChangedOnClient_FileChangedOnServer = 27, DirChangedOnClient_ChangedOnServer = 28, DirChangedOnClient_DeletedOnServer = 29, NoClientCopy_FileOnServer = 30, NoClientCopy_DirOnServer = 31, NoClientCopy_FileChangedOnServer = 32, NoClientCopy_DirChangedOnServer = 33, DeletedOnClient_FileOnServer = 34, DeletedOnClient_DirOnServer = 35, DeletedOnClient_FileChangedOnServer = 36, DeletedOnClient_DirChangedOnServer = 37, FileSparseOnClient = 38, FileChangedOnClient = 39, FileRenamedOnClient = 40, DirSparseOnClient = 41, DirChangedOnClient = 42, DirRenamedOnClient = 43, FileChangedOnServer = 44, FileRenamedOnServer = 45, FileDeletedOnServer = 46, DirChangedOnServer = 47, DirRenamedOnServer = 48, DirDeletedOnServer = 49, FileReplacedAndDeletedOnClient_FileOnServer = 50, FileReplacedAndDeletedOnClient_FileChangedOnServer = 51, FileReplacedAndDeletedOnClient_DirOnServer = 52, FileReplacedAndDeletedOnClient_DirChangedOnServer = 53, NUMSTATES = 54, }; pub const OFFLINEFILES_SYNC_STATE_Stable = OFFLINEFILES_SYNC_STATE.Stable; pub const OFFLINEFILES_SYNC_STATE_FileOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.FileOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_FileOnClient_NoServerCopy = OFFLINEFILES_SYNC_STATE.FileOnClient_NoServerCopy; pub const OFFLINEFILES_SYNC_STATE_DirOnClient_FileOnServer = OFFLINEFILES_SYNC_STATE.DirOnClient_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_DirOnClient_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.DirOnClient_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirOnClient_NoServerCopy = OFFLINEFILES_SYNC_STATE.DirOnClient_NoServerCopy; pub const OFFLINEFILES_SYNC_STATE_FileCreatedOnClient_NoServerCopy = OFFLINEFILES_SYNC_STATE.FileCreatedOnClient_NoServerCopy; pub const OFFLINEFILES_SYNC_STATE_FileCreatedOnClient_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.FileCreatedOnClient_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileCreatedOnClient_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.FileCreatedOnClient_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileCreatedOnClient_FileOnServer = OFFLINEFILES_SYNC_STATE.FileCreatedOnClient_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_FileCreatedOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.FileCreatedOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_FileCreatedOnClient_DeletedOnServer = OFFLINEFILES_SYNC_STATE.FileCreatedOnClient_DeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileChangedOnClient_ChangedOnServer = OFFLINEFILES_SYNC_STATE.FileChangedOnClient_ChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileChangedOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.FileChangedOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_FileChangedOnClient_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.FileChangedOnClient_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileChangedOnClient_DeletedOnServer = OFFLINEFILES_SYNC_STATE.FileChangedOnClient_DeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileSparseOnClient_ChangedOnServer = OFFLINEFILES_SYNC_STATE.FileSparseOnClient_ChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileSparseOnClient_DeletedOnServer = OFFLINEFILES_SYNC_STATE.FileSparseOnClient_DeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileSparseOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.FileSparseOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_FileSparseOnClient_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.FileSparseOnClient_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirCreatedOnClient_NoServerCopy = OFFLINEFILES_SYNC_STATE.DirCreatedOnClient_NoServerCopy; pub const OFFLINEFILES_SYNC_STATE_DirCreatedOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.DirCreatedOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_DirCreatedOnClient_FileOnServer = OFFLINEFILES_SYNC_STATE.DirCreatedOnClient_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_DirCreatedOnClient_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.DirCreatedOnClient_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirCreatedOnClient_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.DirCreatedOnClient_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirCreatedOnClient_DeletedOnServer = OFFLINEFILES_SYNC_STATE.DirCreatedOnClient_DeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirChangedOnClient_FileOnServer = OFFLINEFILES_SYNC_STATE.DirChangedOnClient_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_DirChangedOnClient_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.DirChangedOnClient_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirChangedOnClient_ChangedOnServer = OFFLINEFILES_SYNC_STATE.DirChangedOnClient_ChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirChangedOnClient_DeletedOnServer = OFFLINEFILES_SYNC_STATE.DirChangedOnClient_DeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_NoClientCopy_FileOnServer = OFFLINEFILES_SYNC_STATE.NoClientCopy_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_NoClientCopy_DirOnServer = OFFLINEFILES_SYNC_STATE.NoClientCopy_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_NoClientCopy_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.NoClientCopy_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_NoClientCopy_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.NoClientCopy_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DeletedOnClient_FileOnServer = OFFLINEFILES_SYNC_STATE.DeletedOnClient_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_DeletedOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.DeletedOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_DeletedOnClient_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.DeletedOnClient_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DeletedOnClient_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.DeletedOnClient_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileSparseOnClient = OFFLINEFILES_SYNC_STATE.FileSparseOnClient; pub const OFFLINEFILES_SYNC_STATE_FileChangedOnClient = OFFLINEFILES_SYNC_STATE.FileChangedOnClient; pub const OFFLINEFILES_SYNC_STATE_FileRenamedOnClient = OFFLINEFILES_SYNC_STATE.FileRenamedOnClient; pub const OFFLINEFILES_SYNC_STATE_DirSparseOnClient = OFFLINEFILES_SYNC_STATE.DirSparseOnClient; pub const OFFLINEFILES_SYNC_STATE_DirChangedOnClient = OFFLINEFILES_SYNC_STATE.DirChangedOnClient; pub const OFFLINEFILES_SYNC_STATE_DirRenamedOnClient = OFFLINEFILES_SYNC_STATE.DirRenamedOnClient; pub const OFFLINEFILES_SYNC_STATE_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileRenamedOnServer = OFFLINEFILES_SYNC_STATE.FileRenamedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileDeletedOnServer = OFFLINEFILES_SYNC_STATE.FileDeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirRenamedOnServer = OFFLINEFILES_SYNC_STATE.DirRenamedOnServer; pub const OFFLINEFILES_SYNC_STATE_DirDeletedOnServer = OFFLINEFILES_SYNC_STATE.DirDeletedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileReplacedAndDeletedOnClient_FileOnServer = OFFLINEFILES_SYNC_STATE.FileReplacedAndDeletedOnClient_FileOnServer; pub const OFFLINEFILES_SYNC_STATE_FileReplacedAndDeletedOnClient_FileChangedOnServer = OFFLINEFILES_SYNC_STATE.FileReplacedAndDeletedOnClient_FileChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_FileReplacedAndDeletedOnClient_DirOnServer = OFFLINEFILES_SYNC_STATE.FileReplacedAndDeletedOnClient_DirOnServer; pub const OFFLINEFILES_SYNC_STATE_FileReplacedAndDeletedOnClient_DirChangedOnServer = OFFLINEFILES_SYNC_STATE.FileReplacedAndDeletedOnClient_DirChangedOnServer; pub const OFFLINEFILES_SYNC_STATE_NUMSTATES = OFFLINEFILES_SYNC_STATE.NUMSTATES; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesEvents_Value = @import("../zig.zig").Guid.initString("e25585c1-0caa-4eb1-873b-1cae5b77c314"); pub const IID_IOfflineFilesEvents = &IID_IOfflineFilesEvents_Value; pub const IOfflineFilesEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CacheMoved: fn( self: *const IOfflineFilesEvents, pszOldPath: ?[*:0]const u16, pszNewPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CacheIsFull: fn( self: *const IOfflineFilesEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CacheIsCorrupted: fn( self: *const IOfflineFilesEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enabled: fn( self: *const IOfflineFilesEvents, bEnabled: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EncryptionChanged: fn( self: *const IOfflineFilesEvents, bWasEncrypted: BOOL, bWasPartial: BOOL, bIsEncrypted: BOOL, bIsPartial: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncBegin: fn( self: *const IOfflineFilesEvents, rSyncId: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncFileResult: fn( self: *const IOfflineFilesEvents, rSyncId: ?*const Guid, pszFile: ?[*:0]const u16, hrResult: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncConflictRecAdded: fn( self: *const IOfflineFilesEvents, pszConflictPath: ?[*:0]const u16, pftConflictDateTime: ?*const FILETIME, ConflictSyncState: OFFLINEFILES_SYNC_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncConflictRecUpdated: fn( self: *const IOfflineFilesEvents, pszConflictPath: ?[*:0]const u16, pftConflictDateTime: ?*const FILETIME, ConflictSyncState: OFFLINEFILES_SYNC_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncConflictRecRemoved: fn( self: *const IOfflineFilesEvents, pszConflictPath: ?[*:0]const u16, pftConflictDateTime: ?*const FILETIME, ConflictSyncState: OFFLINEFILES_SYNC_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncEnd: fn( self: *const IOfflineFilesEvents, rSyncId: ?*const Guid, hrResult: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NetTransportArrived: fn( self: *const IOfflineFilesEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NoNetTransports: fn( self: *const IOfflineFilesEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemDisconnected: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemReconnected: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemAvailableOffline: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemNotAvailableOffline: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemPinned: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemNotPinned: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemModified: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, bModifiedData: BOOL, bModifiedAttributes: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemAddedToCache: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemDeletedFromCache: fn( self: *const IOfflineFilesEvents, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemRenamed: fn( self: *const IOfflineFilesEvents, pszOldPath: ?[*:0]const u16, pszNewPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DataLost: fn( self: *const IOfflineFilesEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Ping: fn( self: *const IOfflineFilesEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_CacheMoved(self: *const T, pszOldPath: ?[*:0]const u16, pszNewPath: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).CacheMoved(@ptrCast(*const IOfflineFilesEvents, self), pszOldPath, pszNewPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_CacheIsFull(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).CacheIsFull(@ptrCast(*const IOfflineFilesEvents, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_CacheIsCorrupted(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).CacheIsCorrupted(@ptrCast(*const IOfflineFilesEvents, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_Enabled(self: *const T, bEnabled: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).Enabled(@ptrCast(*const IOfflineFilesEvents, self), bEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_EncryptionChanged(self: *const T, bWasEncrypted: BOOL, bWasPartial: BOOL, bIsEncrypted: BOOL, bIsPartial: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).EncryptionChanged(@ptrCast(*const IOfflineFilesEvents, self), bWasEncrypted, bWasPartial, bIsEncrypted, bIsPartial); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_SyncBegin(self: *const T, rSyncId: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).SyncBegin(@ptrCast(*const IOfflineFilesEvents, self), rSyncId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_SyncFileResult(self: *const T, rSyncId: ?*const Guid, pszFile: ?[*:0]const u16, hrResult: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).SyncFileResult(@ptrCast(*const IOfflineFilesEvents, self), rSyncId, pszFile, hrResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_SyncConflictRecAdded(self: *const T, pszConflictPath: ?[*:0]const u16, pftConflictDateTime: ?*const FILETIME, ConflictSyncState: OFFLINEFILES_SYNC_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).SyncConflictRecAdded(@ptrCast(*const IOfflineFilesEvents, self), pszConflictPath, pftConflictDateTime, ConflictSyncState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_SyncConflictRecUpdated(self: *const T, pszConflictPath: ?[*:0]const u16, pftConflictDateTime: ?*const FILETIME, ConflictSyncState: OFFLINEFILES_SYNC_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).SyncConflictRecUpdated(@ptrCast(*const IOfflineFilesEvents, self), pszConflictPath, pftConflictDateTime, ConflictSyncState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_SyncConflictRecRemoved(self: *const T, pszConflictPath: ?[*:0]const u16, pftConflictDateTime: ?*const FILETIME, ConflictSyncState: OFFLINEFILES_SYNC_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).SyncConflictRecRemoved(@ptrCast(*const IOfflineFilesEvents, self), pszConflictPath, pftConflictDateTime, ConflictSyncState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_SyncEnd(self: *const T, rSyncId: ?*const Guid, hrResult: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).SyncEnd(@ptrCast(*const IOfflineFilesEvents, self), rSyncId, hrResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_NetTransportArrived(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).NetTransportArrived(@ptrCast(*const IOfflineFilesEvents, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_NoNetTransports(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).NoNetTransports(@ptrCast(*const IOfflineFilesEvents, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemDisconnected(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemDisconnected(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemReconnected(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemReconnected(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemAvailableOffline(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemAvailableOffline(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemNotAvailableOffline(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemNotAvailableOffline(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemPinned(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemPinned(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemNotPinned(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemNotPinned(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemModified(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE, bModifiedData: BOOL, bModifiedAttributes: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemModified(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType, bModifiedData, bModifiedAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemAddedToCache(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemAddedToCache(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemDeletedFromCache(self: *const T, pszPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemDeletedFromCache(@ptrCast(*const IOfflineFilesEvents, self), pszPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_ItemRenamed(self: *const T, pszOldPath: ?[*:0]const u16, pszNewPath: ?[*:0]const u16, ItemType: OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).ItemRenamed(@ptrCast(*const IOfflineFilesEvents, self), pszOldPath, pszNewPath, ItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_DataLost(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).DataLost(@ptrCast(*const IOfflineFilesEvents, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents_Ping(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents.VTable, self.vtable).Ping(@ptrCast(*const IOfflineFilesEvents, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesEvents2_Value = @import("../zig.zig").Guid.initString("1ead8f56-ff76-4faa-a795-6f6ef792498b"); pub const IID_IOfflineFilesEvents2 = &IID_IOfflineFilesEvents2_Value; pub const IOfflineFilesEvents2 = extern struct { pub const VTable = extern struct { base: IOfflineFilesEvents.VTable, ItemReconnectBegin: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemReconnectEnd: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CacheEvictBegin: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CacheEvictEnd: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BackgroundSyncBegin: fn( self: *const IOfflineFilesEvents2, dwSyncControlFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BackgroundSyncEnd: fn( self: *const IOfflineFilesEvents2, dwSyncControlFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PolicyChangeDetected: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PreferenceChangeDetected: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SettingsChangesApplied: fn( self: *const IOfflineFilesEvents2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesEvents.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_ItemReconnectBegin(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).ItemReconnectBegin(@ptrCast(*const IOfflineFilesEvents2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_ItemReconnectEnd(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).ItemReconnectEnd(@ptrCast(*const IOfflineFilesEvents2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_CacheEvictBegin(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).CacheEvictBegin(@ptrCast(*const IOfflineFilesEvents2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_CacheEvictEnd(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).CacheEvictEnd(@ptrCast(*const IOfflineFilesEvents2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_BackgroundSyncBegin(self: *const T, dwSyncControlFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).BackgroundSyncBegin(@ptrCast(*const IOfflineFilesEvents2, self), dwSyncControlFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_BackgroundSyncEnd(self: *const T, dwSyncControlFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).BackgroundSyncEnd(@ptrCast(*const IOfflineFilesEvents2, self), dwSyncControlFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_PolicyChangeDetected(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).PolicyChangeDetected(@ptrCast(*const IOfflineFilesEvents2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_PreferenceChangeDetected(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).PreferenceChangeDetected(@ptrCast(*const IOfflineFilesEvents2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents2_SettingsChangesApplied(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents2.VTable, self.vtable).SettingsChangesApplied(@ptrCast(*const IOfflineFilesEvents2, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOfflineFilesEvents3_Value = @import("../zig.zig").Guid.initString("9ba04a45-ee69-42f0-9ab1-7db5c8805808"); pub const IID_IOfflineFilesEvents3 = &IID_IOfflineFilesEvents3_Value; pub const IOfflineFilesEvents3 = extern struct { pub const VTable = extern struct { base: IOfflineFilesEvents2.VTable, TransparentCacheItemNotify: fn( self: *const IOfflineFilesEvents3, pszPath: ?[*:0]const u16, EventType: OFFLINEFILES_EVENTS, ItemType: OFFLINEFILES_ITEM_TYPE, bModifiedData: BOOL, bModifiedAttributes: BOOL, pzsOldPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PrefetchFileBegin: fn( self: *const IOfflineFilesEvents3, pszPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PrefetchFileEnd: fn( self: *const IOfflineFilesEvents3, pszPath: ?[*:0]const u16, hrResult: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesEvents2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents3_TransparentCacheItemNotify(self: *const T, pszPath: ?[*:0]const u16, EventType: OFFLINEFILES_EVENTS, ItemType: OFFLINEFILES_ITEM_TYPE, bModifiedData: BOOL, bModifiedAttributes: BOOL, pzsOldPath: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents3.VTable, self.vtable).TransparentCacheItemNotify(@ptrCast(*const IOfflineFilesEvents3, self), pszPath, EventType, ItemType, bModifiedData, bModifiedAttributes, pzsOldPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents3_PrefetchFileBegin(self: *const T, pszPath: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents3.VTable, self.vtable).PrefetchFileBegin(@ptrCast(*const IOfflineFilesEvents3, self), pszPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents3_PrefetchFileEnd(self: *const T, pszPath: ?[*:0]const u16, hrResult: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents3.VTable, self.vtable).PrefetchFileEnd(@ptrCast(*const IOfflineFilesEvents3, self), pszPath, hrResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IOfflineFilesEvents4_Value = @import("../zig.zig").Guid.initString("dbd69b1e-c7d2-473e-b35f-9d8c24c0c484"); pub const IID_IOfflineFilesEvents4 = &IID_IOfflineFilesEvents4_Value; pub const IOfflineFilesEvents4 = extern struct { pub const VTable = extern struct { base: IOfflineFilesEvents3.VTable, PrefetchCloseHandleBegin: fn( self: *const IOfflineFilesEvents4, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PrefetchCloseHandleEnd: fn( self: *const IOfflineFilesEvents4, dwClosedHandleCount: u32, dwOpenHandleCount: u32, hrResult: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesEvents3.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents4_PrefetchCloseHandleBegin(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents4.VTable, self.vtable).PrefetchCloseHandleBegin(@ptrCast(*const IOfflineFilesEvents4, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEvents4_PrefetchCloseHandleEnd(self: *const T, dwClosedHandleCount: u32, dwOpenHandleCount: u32, hrResult: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEvents4.VTable, self.vtable).PrefetchCloseHandleEnd(@ptrCast(*const IOfflineFilesEvents4, self), dwClosedHandleCount, dwOpenHandleCount, hrResult); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesEventsFilter_Value = @import("../zig.zig").Guid.initString("33fc4e1b-0716-40fa-ba65-6e62a84a846f"); pub const IID_IOfflineFilesEventsFilter = &IID_IOfflineFilesEventsFilter_Value; pub const IOfflineFilesEventsFilter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPathFilter: fn( self: *const IOfflineFilesEventsFilter, ppszFilter: ?*?PWSTR, pMatch: ?*OFFLINEFILES_PATHFILTER_MATCH, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIncludedEvents: fn( self: *const IOfflineFilesEventsFilter, cElements: u32, prgEvents: [*]OFFLINEFILES_EVENTS, pcEvents: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExcludedEvents: fn( self: *const IOfflineFilesEventsFilter, cElements: u32, prgEvents: [*]OFFLINEFILES_EVENTS, pcEvents: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEventsFilter_GetPathFilter(self: *const T, ppszFilter: ?*?PWSTR, pMatch: ?*OFFLINEFILES_PATHFILTER_MATCH) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEventsFilter.VTable, self.vtable).GetPathFilter(@ptrCast(*const IOfflineFilesEventsFilter, self), ppszFilter, pMatch); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEventsFilter_GetIncludedEvents(self: *const T, cElements: u32, prgEvents: [*]OFFLINEFILES_EVENTS, pcEvents: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEventsFilter.VTable, self.vtable).GetIncludedEvents(@ptrCast(*const IOfflineFilesEventsFilter, self), cElements, prgEvents, pcEvents); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesEventsFilter_GetExcludedEvents(self: *const T, cElements: u32, prgEvents: [*]OFFLINEFILES_EVENTS, pcEvents: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesEventsFilter.VTable, self.vtable).GetExcludedEvents(@ptrCast(*const IOfflineFilesEventsFilter, self), cElements, prgEvents, pcEvents); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesErrorInfo_Value = @import("../zig.zig").Guid.initString("7112fa5f-7571-435a-8eb7-195c7c1429bc"); pub const IID_IOfflineFilesErrorInfo = &IID_IOfflineFilesErrorInfo_Value; pub const IOfflineFilesErrorInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRawData: fn( self: *const IOfflineFilesErrorInfo, ppBlob: ?*?*BYTE_BLOB, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescription: fn( self: *const IOfflineFilesErrorInfo, ppszDescription: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesErrorInfo_GetRawData(self: *const T, ppBlob: ?*?*BYTE_BLOB) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesErrorInfo.VTable, self.vtable).GetRawData(@ptrCast(*const IOfflineFilesErrorInfo, self), ppBlob); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesErrorInfo_GetDescription(self: *const T, ppszDescription: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesErrorInfo.VTable, self.vtable).GetDescription(@ptrCast(*const IOfflineFilesErrorInfo, self), ppszDescription); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSyncErrorItemInfo_Value = @import("../zig.zig").Guid.initString("ecdbaf0d-6a18-4d55-8017-108f7660ba44"); pub const IID_IOfflineFilesSyncErrorItemInfo = &IID_IOfflineFilesSyncErrorItemInfo_Value; pub const IOfflineFilesSyncErrorItemInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetFileAttributes: fn( self: *const IOfflineFilesSyncErrorItemInfo, pdwAttributes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFileTimes: fn( self: *const IOfflineFilesSyncErrorItemInfo, pftLastWrite: ?*FILETIME, pftChange: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFileSize: fn( self: *const IOfflineFilesSyncErrorItemInfo, pSize: ?*LARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorItemInfo_GetFileAttributes(self: *const T, pdwAttributes: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorItemInfo.VTable, self.vtable).GetFileAttributes(@ptrCast(*const IOfflineFilesSyncErrorItemInfo, self), pdwAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorItemInfo_GetFileTimes(self: *const T, pftLastWrite: ?*FILETIME, pftChange: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorItemInfo.VTable, self.vtable).GetFileTimes(@ptrCast(*const IOfflineFilesSyncErrorItemInfo, self), pftLastWrite, pftChange); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorItemInfo_GetFileSize(self: *const T, pSize: ?*LARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorItemInfo.VTable, self.vtable).GetFileSize(@ptrCast(*const IOfflineFilesSyncErrorItemInfo, self), pSize); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSyncErrorInfo_Value = @import("../zig.zig").Guid.initString("59f95e46-eb54-49d1-be76-de95458d01b0"); pub const IID_IOfflineFilesSyncErrorInfo = &IID_IOfflineFilesSyncErrorInfo_Value; pub const IOfflineFilesSyncErrorInfo = extern struct { pub const VTable = extern struct { base: IOfflineFilesErrorInfo.VTable, GetSyncOperation: fn( self: *const IOfflineFilesSyncErrorInfo, pSyncOp: ?*OFFLINEFILES_SYNC_OPERATION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetItemChangeFlags: fn( self: *const IOfflineFilesSyncErrorInfo, pdwItemChangeFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InfoEnumerated: fn( self: *const IOfflineFilesSyncErrorInfo, pbLocalEnumerated: ?*BOOL, pbRemoteEnumerated: ?*BOOL, pbOriginalEnumerated: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InfoAvailable: fn( self: *const IOfflineFilesSyncErrorInfo, pbLocalInfo: ?*BOOL, pbRemoteInfo: ?*BOOL, pbOriginalInfo: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocalInfo: fn( self: *const IOfflineFilesSyncErrorInfo, ppInfo: ?*?*IOfflineFilesSyncErrorItemInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRemoteInfo: fn( self: *const IOfflineFilesSyncErrorInfo, ppInfo: ?*?*IOfflineFilesSyncErrorItemInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOriginalInfo: fn( self: *const IOfflineFilesSyncErrorInfo, ppInfo: ?*?*IOfflineFilesSyncErrorItemInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesErrorInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_GetSyncOperation(self: *const T, pSyncOp: ?*OFFLINEFILES_SYNC_OPERATION) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).GetSyncOperation(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), pSyncOp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_GetItemChangeFlags(self: *const T, pdwItemChangeFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).GetItemChangeFlags(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), pdwItemChangeFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_InfoEnumerated(self: *const T, pbLocalEnumerated: ?*BOOL, pbRemoteEnumerated: ?*BOOL, pbOriginalEnumerated: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).InfoEnumerated(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), pbLocalEnumerated, pbRemoteEnumerated, pbOriginalEnumerated); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_InfoAvailable(self: *const T, pbLocalInfo: ?*BOOL, pbRemoteInfo: ?*BOOL, pbOriginalInfo: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).InfoAvailable(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), pbLocalInfo, pbRemoteInfo, pbOriginalInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_GetLocalInfo(self: *const T, ppInfo: ?*?*IOfflineFilesSyncErrorItemInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).GetLocalInfo(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), ppInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_GetRemoteInfo(self: *const T, ppInfo: ?*?*IOfflineFilesSyncErrorItemInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).GetRemoteInfo(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), ppInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncErrorInfo_GetOriginalInfo(self: *const T, ppInfo: ?*?*IOfflineFilesSyncErrorItemInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncErrorInfo.VTable, self.vtable).GetOriginalInfo(@ptrCast(*const IOfflineFilesSyncErrorInfo, self), ppInfo); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesProgress_Value = @import("../zig.zig").Guid.initString("fad63237-c55b-4911-9850-bcf96d4c979e"); pub const IID_IOfflineFilesProgress = &IID_IOfflineFilesProgress_Value; pub const IOfflineFilesProgress = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin: fn( self: *const IOfflineFilesProgress, pbAbort: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryAbort: fn( self: *const IOfflineFilesProgress, pbAbort: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, End: fn( self: *const IOfflineFilesProgress, hrResult: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesProgress_Begin(self: *const T, pbAbort: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesProgress.VTable, self.vtable).Begin(@ptrCast(*const IOfflineFilesProgress, self), pbAbort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesProgress_QueryAbort(self: *const T, pbAbort: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesProgress.VTable, self.vtable).QueryAbort(@ptrCast(*const IOfflineFilesProgress, self), pbAbort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesProgress_End(self: *const T, hrResult: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesProgress.VTable, self.vtable).End(@ptrCast(*const IOfflineFilesProgress, self), hrResult); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSimpleProgress_Value = @import("../zig.zig").Guid.initString("c34f7f9b-c43d-4f9d-a776-c0eb6de5d401"); pub const IID_IOfflineFilesSimpleProgress = &IID_IOfflineFilesSimpleProgress_Value; pub const IOfflineFilesSimpleProgress = extern struct { pub const VTable = extern struct { base: IOfflineFilesProgress.VTable, ItemBegin: fn( self: *const IOfflineFilesSimpleProgress, pszFile: ?[*:0]const u16, pResponse: ?*OFFLINEFILES_OP_RESPONSE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ItemResult: fn( self: *const IOfflineFilesSimpleProgress, pszFile: ?[*:0]const u16, hrResult: HRESULT, pResponse: ?*OFFLINEFILES_OP_RESPONSE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesProgress.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSimpleProgress_ItemBegin(self: *const T, pszFile: ?[*:0]const u16, pResponse: ?*OFFLINEFILES_OP_RESPONSE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSimpleProgress.VTable, self.vtable).ItemBegin(@ptrCast(*const IOfflineFilesSimpleProgress, self), pszFile, pResponse); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSimpleProgress_ItemResult(self: *const T, pszFile: ?[*:0]const u16, hrResult: HRESULT, pResponse: ?*OFFLINEFILES_OP_RESPONSE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSimpleProgress.VTable, self.vtable).ItemResult(@ptrCast(*const IOfflineFilesSimpleProgress, self), pszFile, hrResult, pResponse); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSyncProgress_Value = @import("../zig.zig").Guid.initString("6931f49a-6fc7-4c1b-b265-56793fc451b7"); pub const IID_IOfflineFilesSyncProgress = &IID_IOfflineFilesSyncProgress_Value; pub const IOfflineFilesSyncProgress = extern struct { pub const VTable = extern struct { base: IOfflineFilesProgress.VTable, SyncItemBegin: fn( self: *const IOfflineFilesSyncProgress, pszFile: ?[*:0]const u16, pResponse: ?*OFFLINEFILES_OP_RESPONSE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SyncItemResult: fn( self: *const IOfflineFilesSyncProgress, pszFile: ?[*:0]const u16, hrResult: HRESULT, pErrorInfo: ?*IOfflineFilesSyncErrorInfo, pResponse: ?*OFFLINEFILES_OP_RESPONSE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesProgress.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncProgress_SyncItemBegin(self: *const T, pszFile: ?[*:0]const u16, pResponse: ?*OFFLINEFILES_OP_RESPONSE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncProgress.VTable, self.vtable).SyncItemBegin(@ptrCast(*const IOfflineFilesSyncProgress, self), pszFile, pResponse); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncProgress_SyncItemResult(self: *const T, pszFile: ?[*:0]const u16, hrResult: HRESULT, pErrorInfo: ?*IOfflineFilesSyncErrorInfo, pResponse: ?*OFFLINEFILES_OP_RESPONSE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncProgress.VTable, self.vtable).SyncItemResult(@ptrCast(*const IOfflineFilesSyncProgress, self), pszFile, hrResult, pErrorInfo, pResponse); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSyncConflictHandler_Value = @import("../zig.zig").Guid.initString("b6dd5092-c65c-46b6-97b8-fadd08e7e1be"); pub const IID_IOfflineFilesSyncConflictHandler = &IID_IOfflineFilesSyncConflictHandler_Value; pub const IOfflineFilesSyncConflictHandler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ResolveConflict: fn( self: *const IOfflineFilesSyncConflictHandler, pszPath: ?[*:0]const u16, fStateKnown: u32, state: OFFLINEFILES_SYNC_STATE, fChangeDetails: u32, pConflictResolution: ?*OFFLINEFILES_SYNC_CONFLICT_RESOLVE, ppszNewName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSyncConflictHandler_ResolveConflict(self: *const T, pszPath: ?[*:0]const u16, fStateKnown: u32, state: OFFLINEFILES_SYNC_STATE, fChangeDetails: u32, pConflictResolution: ?*OFFLINEFILES_SYNC_CONFLICT_RESOLVE, ppszNewName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSyncConflictHandler.VTable, self.vtable).ResolveConflict(@ptrCast(*const IOfflineFilesSyncConflictHandler, self), pszPath, fStateKnown, state, fChangeDetails, pConflictResolution, ppszNewName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesItemFilter_Value = @import("../zig.zig").Guid.initString("f4b5a26c-dc05-4f20-ada4-551f1077be5c"); pub const IID_IOfflineFilesItemFilter = &IID_IOfflineFilesItemFilter_Value; pub const IOfflineFilesItemFilter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetFilterFlags: fn( self: *const IOfflineFilesItemFilter, pullFlags: ?*u64, pullMask: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTimeFilter: fn( self: *const IOfflineFilesItemFilter, pftTime: ?*FILETIME, pbEvalTimeOfDay: ?*BOOL, pTimeType: ?*OFFLINEFILES_ITEM_TIME, pCompare: ?*OFFLINEFILES_COMPARE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPatternFilter: fn( self: *const IOfflineFilesItemFilter, pszPattern: [*:0]u16, cchPattern: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItemFilter_GetFilterFlags(self: *const T, pullFlags: ?*u64, pullMask: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItemFilter.VTable, self.vtable).GetFilterFlags(@ptrCast(*const IOfflineFilesItemFilter, self), pullFlags, pullMask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItemFilter_GetTimeFilter(self: *const T, pftTime: ?*FILETIME, pbEvalTimeOfDay: ?*BOOL, pTimeType: ?*OFFLINEFILES_ITEM_TIME, pCompare: ?*OFFLINEFILES_COMPARE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItemFilter.VTable, self.vtable).GetTimeFilter(@ptrCast(*const IOfflineFilesItemFilter, self), pftTime, pbEvalTimeOfDay, pTimeType, pCompare); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItemFilter_GetPatternFilter(self: *const T, pszPattern: [*:0]u16, cchPattern: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItemFilter.VTable, self.vtable).GetPatternFilter(@ptrCast(*const IOfflineFilesItemFilter, self), pszPattern, cchPattern); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesItem_Value = @import("../zig.zig").Guid.initString("4a753da6-e044-4f12-a718-5d14d079a906"); pub const IID_IOfflineFilesItem = &IID_IOfflineFilesItem_Value; pub const IOfflineFilesItem = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetItemType: fn( self: *const IOfflineFilesItem, pItemType: ?*OFFLINEFILES_ITEM_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPath: fn( self: *const IOfflineFilesItem, ppszPath: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParentItem: fn( self: *const IOfflineFilesItem, ppItem: ?*?*IOfflineFilesItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const IOfflineFilesItem, dwQueryFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsMarkedForDeletion: fn( self: *const IOfflineFilesItem, pbMarkedForDeletion: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItem_GetItemType(self: *const T, pItemType: ?*OFFLINEFILES_ITEM_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItem.VTable, self.vtable).GetItemType(@ptrCast(*const IOfflineFilesItem, self), pItemType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItem_GetPath(self: *const T, ppszPath: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItem.VTable, self.vtable).GetPath(@ptrCast(*const IOfflineFilesItem, self), ppszPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItem_GetParentItem(self: *const T, ppItem: ?*?*IOfflineFilesItem) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItem.VTable, self.vtable).GetParentItem(@ptrCast(*const IOfflineFilesItem, self), ppItem); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItem_Refresh(self: *const T, dwQueryFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItem.VTable, self.vtable).Refresh(@ptrCast(*const IOfflineFilesItem, self), dwQueryFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItem_IsMarkedForDeletion(self: *const T, pbMarkedForDeletion: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItem.VTable, self.vtable).IsMarkedForDeletion(@ptrCast(*const IOfflineFilesItem, self), pbMarkedForDeletion); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesServerItem_Value = @import("../zig.zig").Guid.initString("9b1c9576-a92b-4151-8e9e-7c7b3ec2e016"); pub const IID_IOfflineFilesServerItem = &IID_IOfflineFilesServerItem_Value; pub const IOfflineFilesServerItem = extern struct { pub const VTable = extern struct { base: IOfflineFilesItem.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesItem.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesShareItem_Value = @import("../zig.zig").Guid.initString("bab7e48d-4804-41b5-a44d-0f199b06b145"); pub const IID_IOfflineFilesShareItem = &IID_IOfflineFilesShareItem_Value; pub const IOfflineFilesShareItem = extern struct { pub const VTable = extern struct { base: IOfflineFilesItem.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesItem.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesDirectoryItem_Value = @import("../zig.zig").Guid.initString("2273597a-a08c-4a00-a37a-c1ae4e9a1cfd"); pub const IID_IOfflineFilesDirectoryItem = &IID_IOfflineFilesDirectoryItem_Value; pub const IOfflineFilesDirectoryItem = extern struct { pub const VTable = extern struct { base: IOfflineFilesItem.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesItem.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesFileItem_Value = @import("../zig.zig").Guid.initString("8dfadead-26c2-4eff-8a72-6b50723d9a00"); pub const IID_IOfflineFilesFileItem = &IID_IOfflineFilesFileItem_Value; pub const IOfflineFilesFileItem = extern struct { pub const VTable = extern struct { base: IOfflineFilesItem.VTable, IsSparse: fn( self: *const IOfflineFilesFileItem, pbIsSparse: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEncrypted: fn( self: *const IOfflineFilesFileItem, pbIsEncrypted: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesItem.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesFileItem_IsSparse(self: *const T, pbIsSparse: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesFileItem.VTable, self.vtable).IsSparse(@ptrCast(*const IOfflineFilesFileItem, self), pbIsSparse); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesFileItem_IsEncrypted(self: *const T, pbIsEncrypted: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesFileItem.VTable, self.vtable).IsEncrypted(@ptrCast(*const IOfflineFilesFileItem, self), pbIsEncrypted); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IEnumOfflineFilesItems_Value = @import("../zig.zig").Guid.initString("da70e815-c361-4407-bc0b-0d7046e5f2cd"); pub const IID_IEnumOfflineFilesItems = &IID_IEnumOfflineFilesItems_Value; pub const IEnumOfflineFilesItems = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOfflineFilesItems, celt: u32, rgelt: [*]?*IOfflineFilesItem, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOfflineFilesItems, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOfflineFilesItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOfflineFilesItems, ppenum: ?*?*IEnumOfflineFilesItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesItems_Next(self: *const T, celt: u32, rgelt: [*]?*IOfflineFilesItem, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesItems.VTable, self.vtable).Next(@ptrCast(*const IEnumOfflineFilesItems, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesItems_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesItems.VTable, self.vtable).Skip(@ptrCast(*const IEnumOfflineFilesItems, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesItems_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesItems.VTable, self.vtable).Reset(@ptrCast(*const IEnumOfflineFilesItems, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesItems_Clone(self: *const T, ppenum: ?*?*IEnumOfflineFilesItems) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesItems.VTable, self.vtable).Clone(@ptrCast(*const IEnumOfflineFilesItems, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesItemContainer_Value = @import("../zig.zig").Guid.initString("3836f049-9413-45dd-bf46-b5aaa82dc310"); pub const IID_IOfflineFilesItemContainer = &IID_IOfflineFilesItemContainer_Value; pub const IOfflineFilesItemContainer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumItems: fn( self: *const IOfflineFilesItemContainer, dwQueryFlags: u32, ppenum: ?*?*IEnumOfflineFilesItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumItemsEx: fn( self: *const IOfflineFilesItemContainer, pIncludeFileFilter: ?*IOfflineFilesItemFilter, pIncludeDirFilter: ?*IOfflineFilesItemFilter, pExcludeFileFilter: ?*IOfflineFilesItemFilter, pExcludeDirFilter: ?*IOfflineFilesItemFilter, dwEnumFlags: u32, dwQueryFlags: u32, ppenum: ?*?*IEnumOfflineFilesItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItemContainer_EnumItems(self: *const T, dwQueryFlags: u32, ppenum: ?*?*IEnumOfflineFilesItems) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItemContainer.VTable, self.vtable).EnumItems(@ptrCast(*const IOfflineFilesItemContainer, self), dwQueryFlags, ppenum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesItemContainer_EnumItemsEx(self: *const T, pIncludeFileFilter: ?*IOfflineFilesItemFilter, pIncludeDirFilter: ?*IOfflineFilesItemFilter, pExcludeFileFilter: ?*IOfflineFilesItemFilter, pExcludeDirFilter: ?*IOfflineFilesItemFilter, dwEnumFlags: u32, dwQueryFlags: u32, ppenum: ?*?*IEnumOfflineFilesItems) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesItemContainer.VTable, self.vtable).EnumItemsEx(@ptrCast(*const IOfflineFilesItemContainer, self), pIncludeFileFilter, pIncludeDirFilter, pExcludeFileFilter, pExcludeDirFilter, dwEnumFlags, dwQueryFlags, ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesChangeInfo_Value = @import("../zig.zig").Guid.initString("a96e6fa4-e0d1-4c29-960b-ee508fe68c72"); pub const IID_IOfflineFilesChangeInfo = &IID_IOfflineFilesChangeInfo_Value; pub const IOfflineFilesChangeInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsDirty: fn( self: *const IOfflineFilesChangeInfo, pbDirty: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsDeletedOffline: fn( self: *const IOfflineFilesChangeInfo, pbDeletedOffline: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsCreatedOffline: fn( self: *const IOfflineFilesChangeInfo, pbCreatedOffline: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsLocallyModifiedData: fn( self: *const IOfflineFilesChangeInfo, pbLocallyModifiedData: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsLocallyModifiedAttributes: fn( self: *const IOfflineFilesChangeInfo, pbLocallyModifiedAttributes: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsLocallyModifiedTime: fn( self: *const IOfflineFilesChangeInfo, pbLocallyModifiedTime: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesChangeInfo_IsDirty(self: *const T, pbDirty: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesChangeInfo.VTable, self.vtable).IsDirty(@ptrCast(*const IOfflineFilesChangeInfo, self), pbDirty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesChangeInfo_IsDeletedOffline(self: *const T, pbDeletedOffline: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesChangeInfo.VTable, self.vtable).IsDeletedOffline(@ptrCast(*const IOfflineFilesChangeInfo, self), pbDeletedOffline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesChangeInfo_IsCreatedOffline(self: *const T, pbCreatedOffline: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesChangeInfo.VTable, self.vtable).IsCreatedOffline(@ptrCast(*const IOfflineFilesChangeInfo, self), pbCreatedOffline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesChangeInfo_IsLocallyModifiedData(self: *const T, pbLocallyModifiedData: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesChangeInfo.VTable, self.vtable).IsLocallyModifiedData(@ptrCast(*const IOfflineFilesChangeInfo, self), pbLocallyModifiedData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesChangeInfo_IsLocallyModifiedAttributes(self: *const T, pbLocallyModifiedAttributes: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesChangeInfo.VTable, self.vtable).IsLocallyModifiedAttributes(@ptrCast(*const IOfflineFilesChangeInfo, self), pbLocallyModifiedAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesChangeInfo_IsLocallyModifiedTime(self: *const T, pbLocallyModifiedTime: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesChangeInfo.VTable, self.vtable).IsLocallyModifiedTime(@ptrCast(*const IOfflineFilesChangeInfo, self), pbLocallyModifiedTime); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesDirtyInfo_Value = @import("../zig.zig").Guid.initString("0f50ce33-bac9-4eaa-a11d-da0e527d047d"); pub const IID_IOfflineFilesDirtyInfo = &IID_IOfflineFilesDirtyInfo_Value; pub const IOfflineFilesDirtyInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, LocalDirtyByteCount: fn( self: *const IOfflineFilesDirtyInfo, pDirtyByteCount: ?*LARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoteDirtyByteCount: fn( self: *const IOfflineFilesDirtyInfo, pDirtyByteCount: ?*LARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesDirtyInfo_LocalDirtyByteCount(self: *const T, pDirtyByteCount: ?*LARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesDirtyInfo.VTable, self.vtable).LocalDirtyByteCount(@ptrCast(*const IOfflineFilesDirtyInfo, self), pDirtyByteCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesDirtyInfo_RemoteDirtyByteCount(self: *const T, pDirtyByteCount: ?*LARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesDirtyInfo.VTable, self.vtable).RemoteDirtyByteCount(@ptrCast(*const IOfflineFilesDirtyInfo, self), pDirtyByteCount); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesFileSysInfo_Value = @import("../zig.zig").Guid.initString("bc1a163f-7bfd-4d88-9c66-96ea9a6a3d6b"); pub const IID_IOfflineFilesFileSysInfo = &IID_IOfflineFilesFileSysInfo_Value; pub const IOfflineFilesFileSysInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAttributes: fn( self: *const IOfflineFilesFileSysInfo, copy: OFFLINEFILES_ITEM_COPY, pdwAttributes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTimes: fn( self: *const IOfflineFilesFileSysInfo, copy: OFFLINEFILES_ITEM_COPY, pftCreationTime: ?*FILETIME, pftLastWriteTime: ?*FILETIME, pftChangeTime: ?*FILETIME, pftLastAccessTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFileSize: fn( self: *const IOfflineFilesFileSysInfo, copy: OFFLINEFILES_ITEM_COPY, pSize: ?*LARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesFileSysInfo_GetAttributes(self: *const T, copy: OFFLINEFILES_ITEM_COPY, pdwAttributes: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesFileSysInfo.VTable, self.vtable).GetAttributes(@ptrCast(*const IOfflineFilesFileSysInfo, self), copy, pdwAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesFileSysInfo_GetTimes(self: *const T, copy: OFFLINEFILES_ITEM_COPY, pftCreationTime: ?*FILETIME, pftLastWriteTime: ?*FILETIME, pftChangeTime: ?*FILETIME, pftLastAccessTime: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesFileSysInfo.VTable, self.vtable).GetTimes(@ptrCast(*const IOfflineFilesFileSysInfo, self), copy, pftCreationTime, pftLastWriteTime, pftChangeTime, pftLastAccessTime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesFileSysInfo_GetFileSize(self: *const T, copy: OFFLINEFILES_ITEM_COPY, pSize: ?*LARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesFileSysInfo.VTable, self.vtable).GetFileSize(@ptrCast(*const IOfflineFilesFileSysInfo, self), copy, pSize); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesPinInfo_Value = @import("../zig.zig").Guid.initString("5b2b0655-b3fd-497d-adeb-bd156bc8355b"); pub const IID_IOfflineFilesPinInfo = &IID_IOfflineFilesPinInfo_Value; pub const IOfflineFilesPinInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsPinned: fn( self: *const IOfflineFilesPinInfo, pbPinned: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPinnedForUser: fn( self: *const IOfflineFilesPinInfo, pbPinnedForUser: ?*BOOL, pbInherit: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPinnedForUserByPolicy: fn( self: *const IOfflineFilesPinInfo, pbPinnedForUser: ?*BOOL, pbInherit: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPinnedForComputer: fn( self: *const IOfflineFilesPinInfo, pbPinnedForComputer: ?*BOOL, pbInherit: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPinnedForFolderRedirection: fn( self: *const IOfflineFilesPinInfo, pbPinnedForFolderRedirection: ?*BOOL, pbInherit: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesPinInfo_IsPinned(self: *const T, pbPinned: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesPinInfo.VTable, self.vtable).IsPinned(@ptrCast(*const IOfflineFilesPinInfo, self), pbPinned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesPinInfo_IsPinnedForUser(self: *const T, pbPinnedForUser: ?*BOOL, pbInherit: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesPinInfo.VTable, self.vtable).IsPinnedForUser(@ptrCast(*const IOfflineFilesPinInfo, self), pbPinnedForUser, pbInherit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesPinInfo_IsPinnedForUserByPolicy(self: *const T, pbPinnedForUser: ?*BOOL, pbInherit: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesPinInfo.VTable, self.vtable).IsPinnedForUserByPolicy(@ptrCast(*const IOfflineFilesPinInfo, self), pbPinnedForUser, pbInherit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesPinInfo_IsPinnedForComputer(self: *const T, pbPinnedForComputer: ?*BOOL, pbInherit: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesPinInfo.VTable, self.vtable).IsPinnedForComputer(@ptrCast(*const IOfflineFilesPinInfo, self), pbPinnedForComputer, pbInherit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesPinInfo_IsPinnedForFolderRedirection(self: *const T, pbPinnedForFolderRedirection: ?*BOOL, pbInherit: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesPinInfo.VTable, self.vtable).IsPinnedForFolderRedirection(@ptrCast(*const IOfflineFilesPinInfo, self), pbPinnedForFolderRedirection, pbInherit); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesPinInfo2_Value = @import("../zig.zig").Guid.initString("623c58a2-42ed-4ad7-b69a-0f1b30a72d0d"); pub const IID_IOfflineFilesPinInfo2 = &IID_IOfflineFilesPinInfo2_Value; pub const IOfflineFilesPinInfo2 = extern struct { pub const VTable = extern struct { base: IOfflineFilesPinInfo.VTable, IsPartlyPinned: fn( self: *const IOfflineFilesPinInfo2, pbPartlyPinned: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesPinInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesPinInfo2_IsPartlyPinned(self: *const T, pbPartlyPinned: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesPinInfo2.VTable, self.vtable).IsPartlyPinned(@ptrCast(*const IOfflineFilesPinInfo2, self), pbPartlyPinned); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOfflineFilesTransparentCacheInfo_Value = @import("../zig.zig").Guid.initString("bcaf4a01-5b68-4b56-a6a1-8d2786ede8e3"); pub const IID_IOfflineFilesTransparentCacheInfo = &IID_IOfflineFilesTransparentCacheInfo_Value; pub const IOfflineFilesTransparentCacheInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsTransparentlyCached: fn( self: *const IOfflineFilesTransparentCacheInfo, pbTransparentlyCached: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesTransparentCacheInfo_IsTransparentlyCached(self: *const T, pbTransparentlyCached: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesTransparentCacheInfo.VTable, self.vtable).IsTransparentlyCached(@ptrCast(*const IOfflineFilesTransparentCacheInfo, self), pbTransparentlyCached); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesGhostInfo_Value = @import("../zig.zig").Guid.initString("2b09d48c-8ab5-464f-a755-a59d92f99429"); pub const IID_IOfflineFilesGhostInfo = &IID_IOfflineFilesGhostInfo_Value; pub const IOfflineFilesGhostInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsGhosted: fn( self: *const IOfflineFilesGhostInfo, pbGhosted: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesGhostInfo_IsGhosted(self: *const T, pbGhosted: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesGhostInfo.VTable, self.vtable).IsGhosted(@ptrCast(*const IOfflineFilesGhostInfo, self), pbGhosted); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesConnectionInfo_Value = @import("../zig.zig").Guid.initString("efb23a09-a867-4be8-83a6-86969a7d0856"); pub const IID_IOfflineFilesConnectionInfo = &IID_IOfflineFilesConnectionInfo_Value; pub const IOfflineFilesConnectionInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetConnectState: fn( self: *const IOfflineFilesConnectionInfo, pConnectState: ?*OFFLINEFILES_CONNECT_STATE, pOfflineReason: ?*OFFLINEFILES_OFFLINE_REASON, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetConnectState: fn( self: *const IOfflineFilesConnectionInfo, hwndParent: ?HWND, dwFlags: u32, ConnectState: OFFLINEFILES_CONNECT_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TransitionOnline: fn( self: *const IOfflineFilesConnectionInfo, hwndParent: ?HWND, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TransitionOffline: fn( self: *const IOfflineFilesConnectionInfo, hwndParent: ?HWND, dwFlags: u32, bForceOpenFilesClosed: BOOL, pbOpenFilesPreventedTransition: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesConnectionInfo_GetConnectState(self: *const T, pConnectState: ?*OFFLINEFILES_CONNECT_STATE, pOfflineReason: ?*OFFLINEFILES_OFFLINE_REASON) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesConnectionInfo.VTable, self.vtable).GetConnectState(@ptrCast(*const IOfflineFilesConnectionInfo, self), pConnectState, pOfflineReason); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesConnectionInfo_SetConnectState(self: *const T, hwndParent: ?HWND, dwFlags: u32, ConnectState: OFFLINEFILES_CONNECT_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesConnectionInfo.VTable, self.vtable).SetConnectState(@ptrCast(*const IOfflineFilesConnectionInfo, self), hwndParent, dwFlags, ConnectState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesConnectionInfo_TransitionOnline(self: *const T, hwndParent: ?HWND, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesConnectionInfo.VTable, self.vtable).TransitionOnline(@ptrCast(*const IOfflineFilesConnectionInfo, self), hwndParent, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesConnectionInfo_TransitionOffline(self: *const T, hwndParent: ?HWND, dwFlags: u32, bForceOpenFilesClosed: BOOL, pbOpenFilesPreventedTransition: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesConnectionInfo.VTable, self.vtable).TransitionOffline(@ptrCast(*const IOfflineFilesConnectionInfo, self), hwndParent, dwFlags, bForceOpenFilesClosed, pbOpenFilesPreventedTransition); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesShareInfo_Value = @import("../zig.zig").Guid.initString("7bcc43e7-31ce-4ca4-8ccd-1cff2dc494da"); pub const IID_IOfflineFilesShareInfo = &IID_IOfflineFilesShareInfo_Value; pub const IOfflineFilesShareInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetShareItem: fn( self: *const IOfflineFilesShareInfo, ppShareItem: ?*?*IOfflineFilesShareItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetShareCachingMode: fn( self: *const IOfflineFilesShareInfo, pCachingMode: ?*OFFLINEFILES_CACHING_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsShareDfsJunction: fn( self: *const IOfflineFilesShareInfo, pbIsDfsJunction: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesShareInfo_GetShareItem(self: *const T, ppShareItem: ?*?*IOfflineFilesShareItem) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesShareInfo.VTable, self.vtable).GetShareItem(@ptrCast(*const IOfflineFilesShareInfo, self), ppShareItem); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesShareInfo_GetShareCachingMode(self: *const T, pCachingMode: ?*OFFLINEFILES_CACHING_MODE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesShareInfo.VTable, self.vtable).GetShareCachingMode(@ptrCast(*const IOfflineFilesShareInfo, self), pCachingMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesShareInfo_IsShareDfsJunction(self: *const T, pbIsDfsJunction: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesShareInfo.VTable, self.vtable).IsShareDfsJunction(@ptrCast(*const IOfflineFilesShareInfo, self), pbIsDfsJunction); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSuspend_Value = @import("../zig.zig").Guid.initString("62c4560f-bc0b-48ca-ad9d-34cb528d99a9"); pub const IID_IOfflineFilesSuspend = &IID_IOfflineFilesSuspend_Value; pub const IOfflineFilesSuspend = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SuspendRoot: fn( self: *const IOfflineFilesSuspend, bSuspend: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSuspend_SuspendRoot(self: *const T, bSuspend: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSuspend.VTable, self.vtable).SuspendRoot(@ptrCast(*const IOfflineFilesSuspend, self), bSuspend); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSuspendInfo_Value = @import("../zig.zig").Guid.initString("a457c25b-4e9c-4b04-85af-8932ccd97889"); pub const IID_IOfflineFilesSuspendInfo = &IID_IOfflineFilesSuspendInfo_Value; pub const IOfflineFilesSuspendInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsSuspended: fn( self: *const IOfflineFilesSuspendInfo, pbSuspended: ?*BOOL, pbSuspendedRoot: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSuspendInfo_IsSuspended(self: *const T, pbSuspended: ?*BOOL, pbSuspendedRoot: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSuspendInfo.VTable, self.vtable).IsSuspended(@ptrCast(*const IOfflineFilesSuspendInfo, self), pbSuspended, pbSuspendedRoot); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesSetting_Value = @import("../zig.zig").Guid.initString("d871d3f7-f613-48a1-827e-7a34e560fff6"); pub const IID_IOfflineFilesSetting = &IID_IOfflineFilesSetting_Value; pub const IOfflineFilesSetting = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetName: fn( self: *const IOfflineFilesSetting, ppszName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetValueType: fn( self: *const IOfflineFilesSetting, pType: ?*OFFLINEFILES_SETTING_VALUE_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPreference: fn( self: *const IOfflineFilesSetting, pvarValue: ?*VARIANT, dwScope: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPreferenceScope: fn( self: *const IOfflineFilesSetting, pdwScope: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPreference: fn( self: *const IOfflineFilesSetting, pvarValue: ?*const VARIANT, dwScope: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeletePreference: fn( self: *const IOfflineFilesSetting, dwScope: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPolicy: fn( self: *const IOfflineFilesSetting, pvarValue: ?*VARIANT, dwScope: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPolicyScope: fn( self: *const IOfflineFilesSetting, pdwScope: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetValue: fn( self: *const IOfflineFilesSetting, pvarValue: ?*VARIANT, pbSetByPolicy: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetName(self: *const T, ppszName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetName(@ptrCast(*const IOfflineFilesSetting, self), ppszName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetValueType(self: *const T, pType: ?*OFFLINEFILES_SETTING_VALUE_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetValueType(@ptrCast(*const IOfflineFilesSetting, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetPreference(self: *const T, pvarValue: ?*VARIANT, dwScope: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetPreference(@ptrCast(*const IOfflineFilesSetting, self), pvarValue, dwScope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetPreferenceScope(self: *const T, pdwScope: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetPreferenceScope(@ptrCast(*const IOfflineFilesSetting, self), pdwScope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_SetPreference(self: *const T, pvarValue: ?*const VARIANT, dwScope: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).SetPreference(@ptrCast(*const IOfflineFilesSetting, self), pvarValue, dwScope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_DeletePreference(self: *const T, dwScope: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).DeletePreference(@ptrCast(*const IOfflineFilesSetting, self), dwScope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetPolicy(self: *const T, pvarValue: ?*VARIANT, dwScope: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetPolicy(@ptrCast(*const IOfflineFilesSetting, self), pvarValue, dwScope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetPolicyScope(self: *const T, pdwScope: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetPolicyScope(@ptrCast(*const IOfflineFilesSetting, self), pdwScope); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesSetting_GetValue(self: *const T, pvarValue: ?*VARIANT, pbSetByPolicy: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesSetting.VTable, self.vtable).GetValue(@ptrCast(*const IOfflineFilesSetting, self), pvarValue, pbSetByPolicy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IEnumOfflineFilesSettings_Value = @import("../zig.zig").Guid.initString("729680c4-1a38-47bc-9e5c-02c51562ac30"); pub const IID_IEnumOfflineFilesSettings = &IID_IEnumOfflineFilesSettings_Value; pub const IEnumOfflineFilesSettings = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOfflineFilesSettings, celt: u32, rgelt: [*]?*IOfflineFilesSetting, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOfflineFilesSettings, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOfflineFilesSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOfflineFilesSettings, ppenum: ?*?*IEnumOfflineFilesSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesSettings_Next(self: *const T, celt: u32, rgelt: [*]?*IOfflineFilesSetting, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesSettings.VTable, self.vtable).Next(@ptrCast(*const IEnumOfflineFilesSettings, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesSettings_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesSettings.VTable, self.vtable).Skip(@ptrCast(*const IEnumOfflineFilesSettings, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesSettings_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesSettings.VTable, self.vtable).Reset(@ptrCast(*const IEnumOfflineFilesSettings, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOfflineFilesSettings_Clone(self: *const T, ppenum: ?*?*IEnumOfflineFilesSettings) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOfflineFilesSettings.VTable, self.vtable).Clone(@ptrCast(*const IEnumOfflineFilesSettings, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IOfflineFilesCache_Value = @import("../zig.zig").Guid.initString("855d6203-7914-48b9-8d40-4c56f5acffc5"); pub const IID_IOfflineFilesCache = &IID_IOfflineFilesCache_Value; pub const IOfflineFilesCache = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Synchronize: fn( self: *const IOfflineFilesCache, hwndParent: ?HWND, rgpszPaths: [*]?PWSTR, cPaths: u32, bAsync: BOOL, dwSyncControl: u32, pISyncConflictHandler: ?*IOfflineFilesSyncConflictHandler, pIProgress: ?*IOfflineFilesSyncProgress, pSyncId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItems: fn( self: *const IOfflineFilesCache, rgpszPaths: [*]?PWSTR, cPaths: u32, dwFlags: u32, bAsync: BOOL, pIProgress: ?*IOfflineFilesSimpleProgress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItemsForUser: fn( self: *const IOfflineFilesCache, pszUser: ?[*:0]const u16, rgpszPaths: [*]?PWSTR, cPaths: u32, dwFlags: u32, bAsync: BOOL, pIProgress: ?*IOfflineFilesSimpleProgress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Pin: fn( self: *const IOfflineFilesCache, hwndParent: ?HWND, rgpszPaths: [*]?PWSTR, cPaths: u32, bDeep: BOOL, bAsync: BOOL, dwPinControlFlags: u32, pIProgress: ?*IOfflineFilesSyncProgress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unpin: fn( self: *const IOfflineFilesCache, hwndParent: ?HWND, rgpszPaths: [*]?PWSTR, cPaths: u32, bDeep: BOOL, bAsync: BOOL, dwPinControlFlags: u32, pIProgress: ?*IOfflineFilesSyncProgress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEncryptionStatus: fn( self: *const IOfflineFilesCache, pbEncrypted: ?*BOOL, pbPartial: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Encrypt: fn( self: *const IOfflineFilesCache, hwndParent: ?HWND, bEncrypt: BOOL, dwEncryptionControlFlags: u32, bAsync: BOOL, pIProgress: ?*IOfflineFilesSyncProgress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindItem: fn( self: *const IOfflineFilesCache, pszPath: ?[*:0]const u16, dwQueryFlags: u32, ppItem: ?*?*IOfflineFilesItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindItemEx: fn( self: *const IOfflineFilesCache, pszPath: ?[*:0]const u16, pIncludeFileFilter: ?*IOfflineFilesItemFilter, pIncludeDirFilter: ?*IOfflineFilesItemFilter, pExcludeFileFilter: ?*IOfflineFilesItemFilter, pExcludeDirFilter: ?*IOfflineFilesItemFilter, dwQueryFlags: u32, ppItem: ?*?*IOfflineFilesItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RenameItem: fn( self: *const IOfflineFilesCache, pszPathOriginal: ?[*:0]const u16, pszPathNew: ?[*:0]const u16, bReplaceIfExists: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocation: fn( self: *const IOfflineFilesCache, ppszPath: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDiskSpaceInformation: fn( self: *const IOfflineFilesCache, pcbVolumeTotal: ?*u64, pcbLimit: ?*u64, pcbUsed: ?*u64, pcbUnpinnedLimit: ?*u64, pcbUnpinnedUsed: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDiskSpaceLimits: fn( self: *const IOfflineFilesCache, cbLimit: u64, cbUnpinnedLimit: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessAdminPinPolicy: fn( self: *const IOfflineFilesCache, pPinProgress: ?*IOfflineFilesSyncProgress, pUnpinProgress: ?*IOfflineFilesSyncProgress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSettingObject: fn( self: *const IOfflineFilesCache, pszSettingName: ?[*:0]const u16, ppSetting: ?*?*IOfflineFilesSetting, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumSettingObjects: fn( self: *const IOfflineFilesCache, ppEnum: ?*?*IEnumOfflineFilesSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPathCacheable: fn( self: *const IOfflineFilesCache, pszPath: ?[*:0]const u16, pbCacheable: ?*BOOL, pShareCachingMode: ?*OFFLINEFILES_CACHING_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_Synchronize(self: *const T, hwndParent: ?HWND, rgpszPaths: [*]?PWSTR, cPaths: u32, bAsync: BOOL, dwSyncControl: u32, pISyncConflictHandler: ?*IOfflineFilesSyncConflictHandler, pIProgress: ?*IOfflineFilesSyncProgress, pSyncId: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).Synchronize(@ptrCast(*const IOfflineFilesCache, self), hwndParent, rgpszPaths, cPaths, bAsync, dwSyncControl, pISyncConflictHandler, pIProgress, pSyncId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_DeleteItems(self: *const T, rgpszPaths: [*]?PWSTR, cPaths: u32, dwFlags: u32, bAsync: BOOL, pIProgress: ?*IOfflineFilesSimpleProgress) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).DeleteItems(@ptrCast(*const IOfflineFilesCache, self), rgpszPaths, cPaths, dwFlags, bAsync, pIProgress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_DeleteItemsForUser(self: *const T, pszUser: ?[*:0]const u16, rgpszPaths: [*]?PWSTR, cPaths: u32, dwFlags: u32, bAsync: BOOL, pIProgress: ?*IOfflineFilesSimpleProgress) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).DeleteItemsForUser(@ptrCast(*const IOfflineFilesCache, self), pszUser, rgpszPaths, cPaths, dwFlags, bAsync, pIProgress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_Pin(self: *const T, hwndParent: ?HWND, rgpszPaths: [*]?PWSTR, cPaths: u32, bDeep: BOOL, bAsync: BOOL, dwPinControlFlags: u32, pIProgress: ?*IOfflineFilesSyncProgress) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).Pin(@ptrCast(*const IOfflineFilesCache, self), hwndParent, rgpszPaths, cPaths, bDeep, bAsync, dwPinControlFlags, pIProgress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_Unpin(self: *const T, hwndParent: ?HWND, rgpszPaths: [*]?PWSTR, cPaths: u32, bDeep: BOOL, bAsync: BOOL, dwPinControlFlags: u32, pIProgress: ?*IOfflineFilesSyncProgress) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).Unpin(@ptrCast(*const IOfflineFilesCache, self), hwndParent, rgpszPaths, cPaths, bDeep, bAsync, dwPinControlFlags, pIProgress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_GetEncryptionStatus(self: *const T, pbEncrypted: ?*BOOL, pbPartial: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).GetEncryptionStatus(@ptrCast(*const IOfflineFilesCache, self), pbEncrypted, pbPartial); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_Encrypt(self: *const T, hwndParent: ?HWND, bEncrypt: BOOL, dwEncryptionControlFlags: u32, bAsync: BOOL, pIProgress: ?*IOfflineFilesSyncProgress) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).Encrypt(@ptrCast(*const IOfflineFilesCache, self), hwndParent, bEncrypt, dwEncryptionControlFlags, bAsync, pIProgress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_FindItem(self: *const T, pszPath: ?[*:0]const u16, dwQueryFlags: u32, ppItem: ?*?*IOfflineFilesItem) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).FindItem(@ptrCast(*const IOfflineFilesCache, self), pszPath, dwQueryFlags, ppItem); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_FindItemEx(self: *const T, pszPath: ?[*:0]const u16, pIncludeFileFilter: ?*IOfflineFilesItemFilter, pIncludeDirFilter: ?*IOfflineFilesItemFilter, pExcludeFileFilter: ?*IOfflineFilesItemFilter, pExcludeDirFilter: ?*IOfflineFilesItemFilter, dwQueryFlags: u32, ppItem: ?*?*IOfflineFilesItem) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).FindItemEx(@ptrCast(*const IOfflineFilesCache, self), pszPath, pIncludeFileFilter, pIncludeDirFilter, pExcludeFileFilter, pExcludeDirFilter, dwQueryFlags, ppItem); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_RenameItem(self: *const T, pszPathOriginal: ?[*:0]const u16, pszPathNew: ?[*:0]const u16, bReplaceIfExists: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).RenameItem(@ptrCast(*const IOfflineFilesCache, self), pszPathOriginal, pszPathNew, bReplaceIfExists); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_GetLocation(self: *const T, ppszPath: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).GetLocation(@ptrCast(*const IOfflineFilesCache, self), ppszPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_GetDiskSpaceInformation(self: *const T, pcbVolumeTotal: ?*u64, pcbLimit: ?*u64, pcbUsed: ?*u64, pcbUnpinnedLimit: ?*u64, pcbUnpinnedUsed: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).GetDiskSpaceInformation(@ptrCast(*const IOfflineFilesCache, self), pcbVolumeTotal, pcbLimit, pcbUsed, pcbUnpinnedLimit, pcbUnpinnedUsed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_SetDiskSpaceLimits(self: *const T, cbLimit: u64, cbUnpinnedLimit: u64) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).SetDiskSpaceLimits(@ptrCast(*const IOfflineFilesCache, self), cbLimit, cbUnpinnedLimit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_ProcessAdminPinPolicy(self: *const T, pPinProgress: ?*IOfflineFilesSyncProgress, pUnpinProgress: ?*IOfflineFilesSyncProgress) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).ProcessAdminPinPolicy(@ptrCast(*const IOfflineFilesCache, self), pPinProgress, pUnpinProgress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_GetSettingObject(self: *const T, pszSettingName: ?[*:0]const u16, ppSetting: ?*?*IOfflineFilesSetting) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).GetSettingObject(@ptrCast(*const IOfflineFilesCache, self), pszSettingName, ppSetting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_EnumSettingObjects(self: *const T, ppEnum: ?*?*IEnumOfflineFilesSettings) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).EnumSettingObjects(@ptrCast(*const IOfflineFilesCache, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache_IsPathCacheable(self: *const T, pszPath: ?[*:0]const u16, pbCacheable: ?*BOOL, pShareCachingMode: ?*OFFLINEFILES_CACHING_MODE) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache.VTable, self.vtable).IsPathCacheable(@ptrCast(*const IOfflineFilesCache, self), pszPath, pbCacheable, pShareCachingMode); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOfflineFilesCache2_Value = @import("../zig.zig").Guid.initString("8c075039-1551-4ed9-8781-56705c04d3c0"); pub const IID_IOfflineFilesCache2 = &IID_IOfflineFilesCache2_Value; pub const IOfflineFilesCache2 = extern struct { pub const VTable = extern struct { base: IOfflineFilesCache.VTable, RenameItemEx: fn( self: *const IOfflineFilesCache2, pszPathOriginal: ?[*:0]const u16, pszPathNew: ?[*:0]const u16, bReplaceIfExists: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOfflineFilesCache.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOfflineFilesCache2_RenameItemEx(self: *const T, pszPathOriginal: ?[*:0]const u16, pszPathNew: ?[*:0]const u16, bReplaceIfExists: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOfflineFilesCache2.VTable, self.vtable).RenameItemEx(@ptrCast(*const IOfflineFilesCache2, self), pszPathOriginal, pszPathNew, bReplaceIfExists); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (4) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows6.0.6000' pub extern "CSCAPI" fn OfflineFilesEnable( bEnable: BOOL, pbRebootRequired: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "CSCAPI" fn OfflineFilesStart( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "CSCAPI" fn OfflineFilesQueryStatus( pbActive: ?*BOOL, pbEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "CSCAPI" fn OfflineFilesQueryStatusEx( pbActive: ?*BOOL, pbEnabled: ?*BOOL, pbAvailable: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (10) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BYTE_BLOB = @import("../system/com.zig").BYTE_BLOB; const FILETIME = @import("../foundation.zig").FILETIME; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IUnknown = @import("../system/com.zig").IUnknown; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const PWSTR = @import("../foundation.zig").PWSTR; const VARIANT = @import("../system/com.zig").VARIANT; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/storage/offline_files.zig
const std = @import("std"); const print = @import("std").debug.print; const led_driver = @import("led_driver.zig"); const gnss = @import("gnss.zig"); const web = @import("zhp"); pub const GnssContext = struct { gnss: *gnss.GNSS, led: led_driver.LP50xx, timeout: u16 = 1000, }; pub const AppContext = struct { app: *web.Application, }; pub var gnss_ctx: GnssContext = undefined; pub const HeartBeatContext = struct { idx: u8 = 0, on: u32 = 100, off: u32 = 900, color: [3]u8 = [_]u8{ 255, 255, 255 }, led: led_driver.LP50xx, }; pub fn heartbeat_thread(ctx: HeartBeatContext) void { while (true) { ctx.led.set(ctx.idx, ctx.color); std.time.sleep(ctx.on * std.time.ns_per_ms); ctx.led.set(ctx.idx, [_]u8{ 0, 0, 0 }); std.time.sleep(ctx.off * std.time.ns_per_ms); } } pub fn gnss_thread(ctx: GnssContext) void { while (true) { ctx.gnss.set_next_timeout(ctx.timeout); if (ctx.gnss.get_pvt()) { ctx.led.set(0, [_]u8{ 0, 255, 0 }); if (ctx.gnss.last_nav_pvt()) |pvt| { print("PVT {s} at ({d:.6},{d:.6}) height {d:.2}", .{ pvt.timestamp, pvt.latitude, pvt.longitude, pvt.height }); print(" heading {d:.2} velocity ({d:.2},{d:.2},{d:.2}) speed {d:.2}", .{ pvt.heading, pvt.velocity[0], pvt.velocity[1], pvt.velocity[2], pvt.speed }); print(" fix {d} sat {} flags {} {} {}\n", .{ pvt.fix_type, pvt.satellite_count, pvt.flags[0], pvt.flags[1], pvt.flags[2] }); } } else { ctx.led.set(0, [_]u8{ 255, 0, 0 }); } std.time.sleep(std.time.ns_per_ms * @intCast(u64, ctx.timeout / 2)); } } pub fn app_thread(ctx: AppContext) void { defer ctx.app.deinit(); ctx.app.listen("0.0.0.0", 5000) catch |err| { print("app : could not open server port\n", .{}); return; }; ctx.app.start() catch |err| { print("app : could not start\n", .{}); return; }; }
src/threads.zig
const std = @import("std"); const zelda = @import("zelda"); const clowdword = @import("cloudword_gen.zig"); const CloudGenerator = clowdword.CloudGenerator; const WordFrequency = clowdword.WordFreq; const programUseCache: bool = false; var progress = std.Progress{}; // The stopwordURL can be changed here, remember the stopword list is a list separated by new lines =) const stopwordURL = "https://gist.githubusercontent.com/rg089/35e00abf8941d72d419224cfd5b5925d/raw/12d899b70156fd0041fa9778d657330b024b959c/stopwords.txt"; const MaxHackerNewsValue = u64; // If some day we need a bigger uint, we can just change this line const TextResponse = struct { title: []const u8, text: []const u8, }; var semaphore = std.Thread.Semaphore{ .permits = 1 }; const FileError = error{ CannotGetCurrentFile, }; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){}; var arena = std.heap.ArenaAllocator.init(gpa.allocator()); defer arena.deinit(); var allocator = gpa.allocator(); var stdout = std.io.getStdOut().writer(); const cpuCount = try std.Thread.getCpuCount(); var threads: []std.Thread = try allocator.alloc(std.Thread, cpuCount - 2); var cloudWordGenerator: CloudGenerator = CloudGenerator.init(allocator); try stdout.print("Starting collecting information, this can take a while\n", .{}); { // This blocks are for defining an inner scope, so all defered deallocations are handled before making the file =) var max_hackerNews_size = try getHackernewsMaxValue(allocator); var node = try progress.start("Downloading", max_hackerNews_size); var itemsToSave: []TextResponse = try allocator.alloc(TextResponse, max_hackerNews_size); defer allocator.free(itemsToSave); var cacheDir: ?std.fs.Dir = try getCacheDir(allocator, programUseCache); if (cacheDir) |dir| { _ = dir; // TODO: Write This Branch (Get information from the cache) } if (max_hackerNews_size % threads.len == 0) { var chunks: MaxHackerNewsValue = try std.math.divExact(MaxHackerNewsValue, max_hackerNews_size, threads.len); for (threads) |v, i| { _ = v; errdefer threads[i].join(); threads[i] = try std.Thread.spawn(.{}, saveItems, .{ allocator, itemsToSave, chunks * i, (chunks * i) + chunks }); } } else { var chunks: MaxHackerNewsValue = try std.math.divFloor(MaxHackerNewsValue, max_hackerNews_size, threads.len); for (threads) |v, i| { _ = v; errdefer threads[i].join(); threads[i] = try std.Thread.spawn(.{}, saveItems, .{ allocator, itemsToSave, chunks * i, (chunks * i) + (chunks + if (i == cpuCount - 1) @as(MaxHackerNewsValue, 1) else @as(MaxHackerNewsValue, 0)) }); } } for (threads) |v| { v.join(); } if (programUseCache) { // TODO: save all files in items to save in a cache file } node.completeOne(); var stopword = node.start("Getting stopwords", 1); stopword.activate(); var stopwords: [][]const u8 = try getStopWords(allocator, stopwordURL, programUseCache); var words: []WordFrequency = try analyzeWords(allocator, itemsToSave, stopwords); for (words) |v| { cloudWordGenerator.addWord(v); } // Free all the stuff we don't need, why now, because we have a 500mb+ gb allocated =) try stdout.print("Dealing with resources, please wait a moment\n", .{}); } var fileGen = progress.root.start("Generating File", 1); fileGen.activate(); var fileNameBuffer: [4096]u8 = undefined; var fileName = try std.fmt.bufPrint(&fileNameBuffer, "zig-cloudword-{d}.svg", .{std.time.timestamp()}); var outFile: std.fs.File = try std.fs.cwd().createFile(fileName, std.fs.File.CreateFlags{}); try outFile.writeAll(try cloudWordGenerator.generateCloudFile()); outFile.close(); fileGen.completeOne(); try stdout.print("Done\n", .{}); } fn getStopWords(allocator: std.mem.Allocator, url: []const u8, useCache: bool) ![][]const u8 { var listOfWords: std.ArrayList([]const u8) = std.ArrayList([]const u8).init(allocator); errdefer listOfWords.deinit(); if (useCache) { // TODO: Get Response from here } var response = try zelda.get(allocator, url); defer response.deinit(); progress.root.completeOne(); if (response.body) |body| { var stopWord = progress.root.start("Creating List of Stop Words", 1); stopWord.activate(); var bodySplit = std.mem.split(u8, body, "\n"); while (bodySplit.next()) |value| { try listOfWords.append(value); try listOfWords.append(" "); stopWord.completeOne(); } } return listOfWords.toOwnedSlice(); } fn analyzeWords(allocator: std.mem.Allocator, hackerNewsItems: []TextResponse, stopWords: [][]const u8) ![]WordFrequency { var pointer: std.ArrayList([]const u8) = try std.ArrayList([]const u8).initCapacity(allocator, @divFloor(hackerNewsItems.len, 10)); // We allocate the 10% to make this a bit faster defer pointer.deinit(); var zigComments = progress.root.start("Getting Items related to Zig", 0); zigComments.activate(); for (hackerNewsItems) |items, i| { var zigPosTitle = std.mem.indexOfAny(u8, items.title, "zig"); var zigPosText = std.mem.indexOfAny(u8, items.title, "zig"); if (zigPosTitle != null) { try pointer.append(hackerNewsItems[i].title); zigComments.completeOne(); } if (zigPosText != null) { try pointer.append(hackerNewsItems[i].text); zigComments.completeOne(); } } var set: std.StringArrayHashMap(u64) = std.StringArrayHashMap(u64).init(allocator); defer set.deinit(); var gettingWords = progress.root.start("Analyzing Frequency of words", 0); gettingWords.activate(); for (pointer.items) |item| { var titleIterator = std.mem.tokenize(u8, item, " <>"); while (titleIterator.next()) |val| external: { for (stopWords) |stop| { if (std.mem.eql(u8, val, stop)) { break :external; } } var v = try set.getOrPut(val); if (v.found_existing) { v.value_ptr.* = v.value_ptr.* + 1; } else { v.value_ptr.* = 1; } gettingWords.completeOne(); } } var wordFrequencies: std.ArrayList(WordFrequency) = std.ArrayList(WordFrequency).init(allocator); var setIterator = set.iterator(); while (setIterator.next()) |val| { var nice = WordFrequency{ .text = val.key_ptr.*, .frequency = val.value_ptr.* }; try wordFrequencies.append(nice); } return wordFrequencies.toOwnedSlice(); } fn getCacheDir(allocator: std.mem.Allocator, useCache: bool) !?std.fs.Dir { if (!useCache) return null; var currentExeDir: []u8 = try std.fs.selfExeDirPathAlloc(allocator); defer allocator.free(currentExeDir); var cachePath = try std.fs.path.join(allocator, &.{ currentExeDir, "cache" }); defer allocator.free(cachePath); // Let's check if the folder exist, otherwise create it var cacheDir = std.fs.openDirAbsolute(cachePath, std.fs.Dir.OpenDirOptions{}) catch blk: { // We suppose it does not exist and create it var exeDir: std.fs.Dir = try std.fs.openDirAbsolute(currentExeDir, .{}); // If this fails, we just go out try exeDir.makeDir("cache"); //same here exeDir.close(); break :blk std.fs.openDirAbsolute(cachePath, std.fs.Dir.OpenDirOptions{}) catch unreachable; // It's imposible that this fails }; return cacheDir; } fn getHackernewsMaxValue(allocator: std.mem.Allocator) !MaxHackerNewsValue { const response: MaxHackerNewsValue = try zelda.getAndParseResponse(MaxHackerNewsValue, .{ .allocator = allocator }, allocator, "https://hacker-news.firebaseio.com/v0/maxitem.json"); defer std.json.parseFree(MaxHackerNewsValue, response, .{ .allocator = allocator }); return response; } fn getHackerNewsItem(allocator: std.mem.Allocator, client: *zelda.HttpClient, id: MaxHackerNewsValue) !TextResponse { var buffer: [4096]u8 = undefined; var response: zelda.request.Response = try client.perform(zelda.request.Request{ .method = zelda.request.Method.GET, .url = try std.fmt.bufPrint(&buffer, "https://hacker-news.firebaseio.com/v0/item/{d}.json", .{id}), .use_global_connection_pool = false, }); var body: []u8 = undefined; if (response.body) |bod| { body = try allocator.dupe(u8, bod); } else return error.MissingResponseBody; defer allocator.free(body); semaphore.wait(); response.deinit(); semaphore.post(); var textResponse: TextResponse = try std.json.parse(TextResponse, &std.json.TokenStream.init(body), .{ .allocator = allocator }); defer std.json.parseFree(TextResponse, textResponse, .{ .allocator = allocator }); return textResponse; } fn saveItems(allocator: std.mem.Allocator, slice: []TextResponse, start: usize, end: usize) !void { var client: *zelda.HttpClient = try zelda.HttpClient.init(allocator, .{ .userAgent = "zig-relevance-cloud/0.0.1" }); // Client per thread defer client.deinit(); var index: usize = end; var retry_attempts: u8 = 0; while (index > start) { progress.root.activate(); slice[index - 1] = getHackerNewsItem(allocator, client, index) catch blk: { // TODO: handle correctly errors if (retry_attempts >= 3) { retry_attempts += 1; // Maybe a sleep here // std.time.sleep(5000000000); continue; } break :blk TextResponse{ .text = "", .title = "" }; }; index -= 1; retry_attempts = 0; progress.root.completeOne(); } }
src/main.zig
const std = @import("std"); // So before we continue, some specific notes about the format. // + The world in which DEFLATE operates in is a bitstream. // The lowest bit of each byte is the first bit in the stream, going forwards. // Note however that DEFLATE can forcibly align the stream to an 8-bit boundary in some situations. // + Most integer fields are little-endian bit-wise, such that an aligned little-endian integer field is stored 'as-is'. // + Huffman codes are 'effectively' big-endian bit-wise. // Some may consider this arguably a detail of how I like to represent Huffman codes, // but my logic can be explained by understanding the algorithm that builds a Huffman tree from bit lengths. // This algorithm is based around numbers, and the resulting codes following it in this manner are in this 'big-endian' form. // It therefore follows that this is the canonical form for calculating the Huffman codes. // DEFLATE has a maximum Huffman code length of 15, // which gives room in a 16-bit integer for a 1-bit 'always there' prefix to indicate length when implementing the Huffman search via, say, a 65536-entry lookup table. // So in a decompressor, you start with 1 (the empty bitstring), and shift it left adding in new incoming bits at the right end. // In a compressor, you simply have a mapping from symbols to integers, with separate lengths. // And about the compressor & fixed huffman format: // + This compressor only uses Fixed Huffman blocks, as they're easy to write while giving some compression. // + The literal tree uses the following lengths: // for lI = 0, 143 do codeLen[sym] = 8 end // for lI = 144, 255 do codeLen[sym] = 9 end // for lI = 256, 279 do codeLen[sym] = 7 end // for lI = 280, 287 do codeLen[sym] = 8 end // What this calculated to is [TABLE MOVED TO writeFxhLiteralSymbol] // + The distance tree is 32 symbols all of length 5, effectively equivalent to a 1:1 "just write 5 bits" mapping. // HOWEVER, the bits are reversed as per the difference between Huffman and non-Huffman integers above. // Note that the last 2 symbols of the distance tree will never occur in the compressed data. // (This implies they're padding.) // -- Main Body -- const DEFLATE_LENGTH_BITBASE = struct { // Table of extension bit counts for given length symbols, starting with 257. const BIT: []const u8 = &[29]u8{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }; // Table of base lengths for given length symbols, starting with 257. // First value here implies minimum length. const BASE: []const u16 = &[29]u16{ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 }; }; const DEFLATE_DIST_BITBASE = struct { // Table of extension bit counts for given distance symbols const BIT: []const u8 = &[30]u8{ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; // Table of base distances for given distance symbols const BASE: []const u16 = &[30]u16{ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }; }; // Note: it's assumed that bitbases are in increasing order. // If not, this won't work. fn chooseBitBase(val: u16, comptime bitbase: type) usize { for (bitbase.BASE) |base, idx| { var bit = bitbase.BIT[idx]; var extent = base + (@as(u16, 1) << @truncate(u4, bit)); if ((val >= base) and (val < extent)) { return idx; } } std.debug.panic("failed to find {}", .{ val }); } pub fn DeflateCompressor(comptime WindowType: type, comptime WriterType: type) type { return struct { const Window = WindowType; forward_writer: BitWriterType, window: Window, const BitWriterType = std.io.BitWriter(std.builtin.Endian.Little, WriterType); const Self = @This(); // NOTE: This type does not perform any dynamic allocation. // This operation inherently cannot fail (no writing is performed yet). pub fn init(src: WriterType) Self { return Self { .forward_writer = BitWriterType.init(src), .window = Window.init() }; } // Internal: Write symbol, fixed-huffman-table: literal fn writeFxhLiteralSymbol(self: *Self, sym: u9) BitWriterType.Error!void { if (sym < 144) { // Symbols 0, 143 inc. are 8-bit, base 48 try self.forward_writer.writeBits(@bitReverse(u8, @truncate(u8, sym + 48)), 8); } else if (sym < 256) { // Symbols 144, 255 inc. are 9-bit, base 400 try self.forward_writer.writeBits(@bitReverse(u9, @truncate(u9, sym + 256)), 9); } else if (sym < 280) { // Symbols 256, 279 inc. are 7-bit, base 0 try self.forward_writer.writeBits(@bitReverse(u7, @truncate(u7, sym - 256)), 7); } else { // Symbols 280, 287 inc. are 8-bit, base 192 try self.forward_writer.writeBits(@bitReverse(u8, @truncate(u8, sym - 88)), 8); } } // Internal: Write symbol, fixed-huffman-table: distance fn writeFxhDistanceSymbol(self: *Self, sym: u5) BitWriterType.Error!void { try self.forward_writer.writeBits(@bitReverse(u5, sym), 5); } // This opens a fixed-huffman chunk. // Operations not intended to be used in this mode will have terrible effects if they are used anyway. // Note that final must be the same between open & close calls. // Finally, the state of the DEFLATE stream is undefined if any error occurs. // This type will never generate an error that was not received from the underlying writers. pub fn openFixedChunk(self: *Self, final: bool) BitWriterType.Error!void { // Final block flag. try self.forward_writer.writeBits(@boolToInt(final), 1); // Fixed Huffman block try self.forward_writer.writeBits(@as(u2, 1), 2); } // This closes a fixed-huffman chunk. // Note that final must be the same between open & close calls. // Finally, the state of the DEFLATE stream is undefined if any error occurs. // This type will never generate an error that was not received from the underlying writers. pub fn closeFixedChunk(self: *Self, final: bool) BitWriterType.Error!void { try self.writeFxhLiteralSymbol(256); if (final) { try self.forward_writer.flushBits(); } } // Writes an atomic unit of data into an active chunk. // This will only consume part of the data given (that part which represents this small atomic unit). // Returns the amount remaining, allowing you to refill it up to the window size (this allows for perfect streaming compression) // This is only valid in an openFixedChunk-closeFixedChunk pair. // Finally, the state of the DEFLATE stream is undefined if any error occurs. // This type will never generate an error that was not received from the underlying writers. pub fn writeFixedUnit(self: *Self, chunk: []const u8) BitWriterType.Error![]const u8 { // Find... var find = self.window.find(chunk); var successChunk: []const u8 = &[0]u8{}; // Note the use of DEFLATE_LENGTH_BITBASE here ; the minimum length is important. var hasDLPair: bool = find.length >= DEFLATE_LENGTH_BITBASE.BASE[0]; if (hasDLPair) { // std.log.err("has DL pair", .{}); // Verify pair is probably shorter than an equivalent literal. // This also does the setup for the actual writing. // If it is shorter, then the writing is actually done here. // For reference, u12 will always be correct: // + max length is 258 // + max lit. bits is 9 // + therefore max size is 2322 // Work out equivalent literal size. // This doesn't account for potential future finds, // but that's not really likely to be a problem. var litBits: u12 = 0; for (chunk[0..find.length]) |b| { if (b < 144) { litBits += 8; } else { litBits += 9; } } // Length index var lenIdx = chooseBitBase(find.length, DEFLATE_LENGTH_BITBASE); var lenSym = @intCast(u9, lenIdx) + 257; // Distance index var dstIdx = @intCast(u5, chooseBitBase(find.distance, DEFLATE_DIST_BITBASE)); // Using those indexes, calculate bits.. var lenSymBits: u12 = 8; if (lenSym < 280) { lenSymBits = 7; } var dpBits: u12 = lenSymBits + DEFLATE_LENGTH_BITBASE.BIT[lenIdx] + 5 + DEFLATE_DIST_BITBASE.BIT[dstIdx]; if (dpBits < litBits) { // Length-Distance pair // Length & extension... try self.writeFxhLiteralSymbol(lenSym); try self.forward_writer.writeBits(find.length - DEFLATE_LENGTH_BITBASE.BASE[lenIdx], DEFLATE_LENGTH_BITBASE.BIT[lenIdx]); // Distance & extension... try self.writeFxhDistanceSymbol(dstIdx); try self.forward_writer.writeBits(find.distance - DEFLATE_DIST_BITBASE.BASE[dstIdx], DEFLATE_DIST_BITBASE.BIT[dstIdx]); // Actually advance successChunk = chunk[0..find.length]; // std.log.err("was executed, L{} - '{s}'", .{find.length, successChunk}); } else { // Not worth it hasDLPair = false; } } if (!hasDLPair) { // DL pair failed - write literal try self.writeFxhLiteralSymbol(@intCast(u9, chunk[0])); successChunk = chunk[0..1]; // std.log.err("was lit X {}", .{chunk[0]}); } self.window.inject(successChunk); return chunk[successChunk.len..]; } // Writes a chunk. You should make chunks as big as possible, or you will waste resources. // In particular, this operation: // + Opens a new fixed-huffman block // + Writes the entirety of the chunk to the block // + Closes the Huffman block // The block may be marked final, which terminates the DEFLATE stream. // Setting final causes an automatic flush of the underlying BitWriter as no further data should be written after this point. // Writing data after a chunk in which the final flag has been set may cause corruption depending on the mode of operation of the framing format. // Finally, the state of the DEFLATE stream is undefined if any error occurs. // This type will never generate an error that was not received from the underlying writers. pub fn write(self: *Self, chunk: []const u8, final: bool) BitWriterType.Error!void { try self.openFixedChunk(final); var thisChunk: []const u8 = chunk; while (thisChunk.len > 0) { thisChunk = try self.writeFixedUnit(thisChunk); } try self.closeFixedChunk(final); } // Writes a chunk as a literal block (or if required, set of literal blocks) // This is not an efficient method of storing data, but it ensures the underlying BitWriter can be (and will have been) flushed, // without decompressor side effects such as needing to be a final block, bitstream corruption, or added output data. // It's important to note that passing an empty chunk is a valid way to use this if you for some reason *must* get the stream aligned without terminating it. // Writing data after a chunk in which the final flag has been set may cause corruption depending on the mode of operation of the framing format. // The final flag may be set here in order to finalize a stream which wasn't previously finalized, // but this is wasteful in comparison to supplying it on the previous block. // Finally, the state of the DEFLATE stream is undefined if any error occurs. // This type will never generate an error that was not received from the underlying writers. pub fn writeLiteral(self: *Self, chunk: []const u8, final: bool) BitWriterType.Error!void { var hasWrittenOneBlock: bool = false; var thisChunk: []const u8 = chunk; while ((!hasWrittenOneBlock) or (thisChunk.len > 0)) { var nextChunk: []const u8 = &[0]u8{}; if (thisChunk.len >= 0x10000) { nextChunk = thisChunk[0xFFFF..]; thisChunk = thisChunk[0..0xFFFF]; } var thisFinal = (nextChunk.len == 0) and final; // Final block flag. try self.forward_writer.writeBits(@boolToInt(thisFinal), 1); // Literal block - this is what gets the alignment try self.forward_writer.writeBits(@as(u2, 0), 2); // Alignment caused by literal block try self.forward_writer.flushBits(); // Literal block length const thisChunkLen = @truncate(u16, thisChunk.len); try self.forward_writer.writeBits(thisChunkLen, 16); // Literal block length inverted try self.forward_writer.writeBits(~thisChunkLen, 16); // Flush bits just in case. try self.forward_writer.flushBits(); // Time to write contents. try self.forward_writer.forward_writer.writeAll(thisChunk); // Advance hasWrittenOneBlock = true; thisChunk = nextChunk; } // Update window self.window.inject(chunk); } }; }
src/compressor.zig
usingnamespace @import("raylib"); usingnamespace @import("rlights.zig"); usingnamespace @import("raylib-math"); const resourceDir = "raylib/examples/shaders/resources/"; pub fn main() !void { // Initialization //-------------------------------------------------------------------------------------- const screenWidth = 800; const screenHeight = 450; //SetConfigFlags(.FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x // (if available) InitWindow(screenWidth, screenHeight, "raylib [shaders] example - basic lighting"); // Define the camera to look into our 3d world const camera = Camera{ .position = .{ .x = 2.0, .y = 2.0, .z = 6.0 }, // Camera position .target = .{ .x = 0.0, .y = 0.5, .z = 0.0 }, // Camera looking at point .up = .{ .x = 0.0, .y = 1.0, .z = 0.0 }, // Camera up vector (rotation towards target) .fovy = 45.0, // Camera field-of-view Y .projection = CameraProjection.CAMERA_PERSPECTIVE, // Camera mode type }; // Load models var modelA = LoadModelFromMesh(GenMeshTorus(0.4, 1.0, 16, 32)); var modelB = LoadModelFromMesh(GenMeshCube(1.0, 1.0, 1.0)); var modelC = LoadModelFromMesh(GenMeshSphere(0.5, 32, 32)); // Load models texture const texture = LoadTexture(resourceDir ++ "texel_checker.png"); // Assign texture to default model material modelA.materials[0].maps[@enumToInt(MAP_DIFFUSE)].texture = texture; modelB.materials[0].maps[@enumToInt(MAP_DIFFUSE)].texture = texture; modelC.materials[0].maps[@enumToInt(MAP_DIFFUSE)].texture = texture; var shader = LoadShader( resourceDir ++ "/shaders/glsl330/base_lighting.vs", resourceDir ++ "/shaders/glsl330/lighting.fs", ); // Get some shader loactions shader.locs[@enumToInt(ShaderLocationIndex.SHADER_LOC_MATRIX_MODEL)] = GetShaderLocation(shader, "matModel"); shader.locs[@enumToInt(ShaderLocationIndex.SHADER_LOC_VECTOR_VIEW)] = GetShaderLocation(shader, "viewPos"); // ambient light level const ambientLoc = GetShaderLocation(shader, "ambient"); const ambientVals = [4]f32{ 0.2, 0.2, 0.2, 1.0 }; SetShaderValue(shader, ambientLoc, &ambientVals, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC4)); var angle: f32 = 6.282; // All models use the same shader modelA.materials[0].shader = shader; modelB.materials[0].shader = shader; modelC.materials[0].shader = shader; // Using 4 point lights, white, red, green and blue var lights = [_]Light{ try CreateLight(LightType.point, .{ .x = 4, .y = 2, .z = 4 }, Vector3Zero(), WHITE, shader), try CreateLight(LightType.point, .{ .x = 4, .y = 2, .z = 4 }, Vector3Zero(), RED, shader), try CreateLight(LightType.point, .{ .x = 0, .y = 4, .z = 2 }, Vector3Zero(), GREEN, shader), try CreateLight(LightType.point, .{ .x = 0, .y = 4, .z = 2 }, Vector3Zero(), BLUE, shader), }; SetCameraMode(camera, CameraMode.CAMERA_ORBITAL); // Set an orbital camera mode SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- if (IsKeyPressed(KeyboardKey.KEY_W)) { lights[0].enabled = !lights[0].enabled; } if (IsKeyPressed(KeyboardKey.KEY_R)) { lights[1].enabled = !lights[1].enabled; } if (IsKeyPressed(KeyboardKey.KEY_G)) { lights[2].enabled = !lights[2].enabled; } if (IsKeyPressed(KeyboardKey.KEY_B)) { lights[3].enabled = !lights[3].enabled; } //UpdateCamera(&camera); // Update camera // Make the lights do differing orbits angle -= 0.02; lights[0].position.x = @cos(angle) * 4.0; lights[0].position.z = @sin(angle) * 4.0; lights[1].position.x = @cos(-angle * 0.6) * 4.0; lights[1].position.z = @sin(-angle * 0.6) * 4.0; lights[2].position.y = @cos(angle * 0.2) * 4.0; lights[2].position.z = @sin(angle * 0.2) * 4.0; lights[3].position.y = @cos(-angle * 0.35) * 4.0; lights[3].position.z = @sin(-angle * 0.35) * 4.0; UpdateLightValues(shader, lights[0]); UpdateLightValues(shader, lights[1]); UpdateLightValues(shader, lights[2]); UpdateLightValues(shader, lights[3]); // Rotate the torus modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025)); modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012)); // Update the light shader with the camera view position const cameraPos = [3]f32{ camera.position.x, camera.position.y, camera.position.z }; SetShaderValue(shader, shader.locs[@enumToInt(ShaderLocationIndex.SHADER_LOC_VECTOR_VIEW)], &cameraPos, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC3)); //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(RAYWHITE); BeginMode3D(camera); // Draw the three models DrawModel(modelA, Vector3Zero(), 1.0, WHITE); DrawModel(modelB, .{ .x = -1.6, .y = 0, .z = 0 }, 1.0, WHITE); DrawModel(modelC, .{ .x = 1.6, .y = 0, .z = 0 }, 1.0, WHITE); // Draw markers to show where the lights are if (lights[0].enabled) { DrawSphereEx(lights[0].position, 0.2, 8, 8, WHITE); } if (lights[1].enabled) { DrawSphereEx(lights[1].position, 0.2, 8, 8, RED); } if (lights[2].enabled) { DrawSphereEx(lights[2].position, 0.2, 8, 8, GREEN); } if (lights[3].enabled) { DrawSphereEx(lights[3].position, 0.2, 8, 8, BLUE); } DrawGrid(10, 1.0); EndMode3D(); DrawFPS(10, 10); DrawText("Use keys RGBW to toggle lights", 10, 30, 20, DARKGRAY); EndDrawing(); //---------------------------------------------------------------------------------- } // De-Initialization //-------------------------------------------------------------------------------------- UnloadModel(modelA); // Unload the modelA UnloadModel(modelB); // Unload the modelB UnloadModel(modelC); // Unload the modelC UnloadTexture(texture); // Unload the texture UnloadShader(shader); // Unload shader CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- }
examples/shaders/shaders_basic_lighting.zig
const std = @import("std"); const zs = @import("zstack.zig"); const Engine = zs.Engine; const Options = zs.Options; const Window = zs.window.Window; const Flag = zstack.input.Flag; const Action = zstack.input.Action; const ActionFlag = zstack.input.ActionFlag; const ActionFlags = zstack.input.ActionFlags; const Timer = struct { timer: std.time.Timer, pub fn init() !Timer { return Timer{ .timer = try std.time.Timer.start() }; } pub fn read(self: *Timer) i64 { return @intCast(i64, self.timer.read() / 1000); } pub fn sleep(self: Timer, microseconds: i64) void { if (microseconds < 0) return; std.time.sleep(@intCast(u64, microseconds * 1000)); } }; fn loop(window: var, engine: *Engine) !void { const tick_rate = zs.ms_per_tick * 1000; var timer = try Timer.init(); var total_render_time_us: i64 = 0; var total_render_frames: i64 = 0; var total_engine_time_us: i64 = 0; var total_engine_frames: i64 = 0; var total_frames: i64 = 0; var last_time = timer.read() - tick_rate; // Ensure 0-lag for first frame. var lag: i64 = 0; var average_frame: i64 = 0; // If no replays are wanted, then use a NullOutStream. // Write history, note that the writer should actually keep track of the current tick // and only write when a key change is encountered. //var w = zs.replay.Writer(std.os.File.OutStream).init("1.replay"); //w.writeheader(engine.total_ticks_raw, keys); //defer w.flush(); // On completion, if state == .GameWin, call w.finalize() else w.remove() the output. // NOTE: Engine does not handle replays at all, that is an above layer. // Two different input handlers, one for normal play, and the other which wraps any other // handler and reads from a replay file. This handler should also handle quit events. //var r = try zs.replay.v1.read(&engine.options, ReplayInputIterator); //var input_handler = r; //input_handler.readKeys(); // The input could also abstract different input types, such as joystick keyboard etc. // Fixed timestep with lag reduction. while (!engine.quit()) { const start_time = timer.read(); const elapsed = start_time - last_time; last_time = start_time; // Lag can be negative, which means the frame we are processing will be slightly // longer. This works out alright in practice so leave it. lag += (elapsed - tick_rate); const engine_start = timer.read(); const keys = window.readKeys(); engine.tick(keys); const frame_engine_time_us = timer.read() - engine_start; total_engine_time_us += frame_engine_time_us; total_engine_frames += 1; var frame_render_time_us: i64 = 0; if (engine.inDrawFrame()) { const render_start = timer.read(); try window.render(engine.*); frame_render_time_us = timer.read() - render_start; total_render_time_us += frame_render_time_us; total_render_frames += 1; } // Keep track of average frame time during execution to ensure we haven't stalled. const current_time = timer.read(); average_frame += @divTrunc((current_time - start_time) - average_frame, engine.total_ticks_raw); const tick_end = start_time + tick_rate; // The frame took too long. NOTE: We cannot display this in most cases since the render // time is capped to the refresh rate usually and thus will exceed the specified limit. // We should add a specific blit call and avoid a blocking render call if possible. This // causes the game to run slower and disrupts usually function unless the swap interval // is set to 0. if (false) { // tick_end < current_time) { std.debug.warn( "frame {} exceeded tick-rate of {}us: engine: {}us, render: {}us\n", total_frames, u64(tick_rate), frame_engine_time_us, frame_render_time_us, ); } // If a frame has taken too long, then the required sleep value will be negative. // We do not handle this case by shortening frames, instead we assume we will catch up // in subsequent frames to compensate. // // TODO: Test on a really slow machine. I would rather spend time making everything // as quick as possible than spend time thinking of ways to handle cases where we don't // run quick enough. We should be able to run sub 1-ms every tick 100%. // // Note that it will practically always be the rendering cycle that consumes excess cpu time. // Time engine, read keys and ui render portions of the loop to check what is talking // how long. // // TODO: Also check when vsync is enabled and the engine rate is under the render rate. const sleep_time = tick_end - lag - current_time; if (sleep_time > 0) { timer.sleep(sleep_time); } total_frames += 1; } // Render the final frame, this may have been missed during the main loop if we were // in between draw frames. try window.render(engine.*); // Cross-reference in-game time based on ticks to a system reference clock to confirm // long-term accuracy. const actual_elapsed = @divTrunc(timer.read(), 1000); const ingame_elapsed = engine.total_ticks_raw * zs.ms_per_tick; std.debug.warn( \\Average engine frame: {}us \\Average render frame: {}us \\Actual time elapsed: {} \\In-game time elapsed: {} \\Maximum difference: {} \\ , @divTrunc(total_engine_time_us, total_frames), @divTrunc(total_render_time_us, total_frames), actual_elapsed, ingame_elapsed, actual_elapsed - ingame_elapsed, ); } pub fn main() !void { var options = Options{}; var ui_options = zs.window.Options{}; var keybindings = zs.input.KeyBindings{}; // Read from zstack.ini file located in the same directory as the executable? // Has some issues but treating this as a portable application for now is fine. zs.config.loadFromIniFile(&options, &keybindings, &ui_options, "zstack.ini") catch |err| { std.debug.warn("failed to open ini file: {}\n", err); }; if (options.seed == null) { var buf: [4]u8 = undefined; try std.crypto.randomBytes(buf[0..]); options.seed = std.mem.readIntSliceLittle(u32, buf[0..4]); } var engine = Engine.init(options); var window = try Window.init(ui_options, keybindings); defer window.deinit(); try loop(&window, &engine); }
src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; const input_file = "input07.txt"; const Rules = std.StringHashMap([]const []const u8); fn parseRules(allocator: *Allocator, reader: anytype) !Rules { var result = Rules.init(allocator); var buf: [4 * 1024]u8 = undefined; while (try reader.readUntilDelimiterOrEof(&buf, '\n')) |line| { const line_without_dot = line[0 .. line.len - 1]; var iter = std.mem.split(line_without_dot, " contain "); const head = iter.next() orelse return error.FormatError; const tail = iter.next() orelse return error.FormatError; // parent const parent = try allocator.dupe(u8, head[0 .. head.len - 5]); // children var children = std.ArrayList([]const u8).init(allocator); if (!std.mem.eql(u8, tail, "no other bags")) { var tail_iter = std.mem.split(tail, ", "); while (tail_iter.next()) |item| { const trailing_bytes_to_remove: usize = if (std.mem.endsWith(u8, item, " bags")) 5 else if (std.mem.endsWith(u8, item, " bag")) 4 else return error.UnexpectedEnd; const color = item[std.mem.indexOfScalar(u8, item, ' ').? + 1 .. item.len - trailing_bytes_to_remove]; try children.append(try allocator.dupe(u8, color)); } } try result.put(parent, children.toOwnedSlice()); } return result; } fn freeRules(allocator: *Allocator, rules: *Rules) void { var iter = rules.iterator(); while (iter.next()) |kv| { allocator.free(kv.key); for (kv.value) |x| allocator.free(x); allocator.free(kv.value); } rules.deinit(); } test "parse rules" { const allocator = std.testing.allocator; const rules = \\light red bags contain 1 bright white bag, 2 muted yellow bags. \\dark orange bags contain 3 bright white bags, 4 muted yellow bags. \\bright white bags contain 1 shiny gold bag. \\muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. \\shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. \\dark olive bags contain 3 faded blue bags, 4 dotted black bags. \\vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. \\faded blue bags contain no other bags. \\dotted black bags contain no other bags. \\ ; var fbs = std.io.fixedBufferStream(rules); const reader = fbs.reader(); var parsed = try parseRules(allocator, reader); defer freeRules(allocator, &parsed); try testing.expectEqualSlices(u8, (parsed.get("light red").?)[0], "bright white"); try testing.expectEqualSlices(u8, (parsed.get("light red").?)[1], "muted yellow"); try testing.expectEqualSlices(u8, (parsed.get("bright white").?)[0], "shiny gold"); try testing.expectEqual(@as(usize, 0), (parsed.get("faded blue").?).len); } fn canHold(rules: Rules, target_color: []const u8, color: []const u8) bool { const children = rules.get(color).?; return blk: for (children) |child| { if (std.mem.eql(u8, child, target_color)) break :blk true; if (canHold(rules, target_color, child)) break :blk true; } else false; } fn countValidBagColors(rules: Rules, target_color: []const u8) u32 { var count: u32 = 0; var iter = rules.iterator(); while (iter.next()) |kv| { if (canHold(rules, target_color, kv.key)) count += 1; } return count; } test "count valid bag colors" { const allocator = std.testing.allocator; const rules = \\light red bags contain 1 bright white bag, 2 muted yellow bags. \\dark orange bags contain 3 bright white bags, 4 muted yellow bags. \\bright white bags contain 1 shiny gold bag. \\muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. \\shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. \\dark olive bags contain 3 faded blue bags, 4 dotted black bags. \\vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. \\faded blue bags contain no other bags. \\dotted black bags contain no other bags. \\ ; var fbs = std.io.fixedBufferStream(rules); const reader = fbs.reader(); var parsed = try parseRules(allocator, reader); defer freeRules(allocator, &parsed); try testing.expectEqual(@as(u32, 4), countValidBagColors(parsed, "shiny gold")); } pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = &gpa.allocator; var file = try std.fs.cwd().openFile(input_file, .{}); defer file.close(); const reader = file.reader(); var parsed = try parseRules(allocator, reader); defer freeRules(allocator, &parsed); std.debug.warn("valid bag colors: {}\n", .{countValidBagColors(parsed, "shiny gold")}); }
src/07.zig
const std = @import("std"); const assert = std.debug.assert; const math = std.math; const mem = std.mem; const sort = std.sort; const bits_utils = @import("./bits.zig"); const bs = @import("./bitstream.zig"); const lz = @import("./lz77.zig"); const UINT8_MAX = math.maxInt(u8); pub const expand_stat_t = enum { HWEXPAND_OK, // Expand was successful. HWEXPAND_ERR, // Error in the input data. }; fn block_sort(items: []follower_t, t: anytype, comptime lessThan: anytype) void { _ = sort.sort(t, items, {}, lessThan); } // Number of bits used to represent indices in a follower set of size n. fn num_to_follower_idx_bw(n: usize) u8 { assert(n <= 32); if (n > 16) { return 5; } if (n > 8) { return 4; } if (n > 4) { return 3; } if (n > 2) { return 2; } if (n > 0) { return 1; } return 0; } const follower_set_t: type = struct { size: u8, idx_bw: u8, followers: [32]u8, }; // Read the follower sets from is into fsets. Returns true on success. fn read_follower_sets(is: *bs.istream_t, fsets: [*]follower_set_t) bool { var i: u8 = 0; var j: u8 = 0; var n: u8 = 0; i = 255; while (i >= 0) : (i -= 1) { n = @intCast(u8, bits_utils.lsb(bs.istream_bits(is), 6)); if (n > 32) { return false; } if (!bs.istream_advance(is, 6)) { return false; } fsets[i].size = n; fsets[i].idx_bw = num_to_follower_idx_bw(n); j = 0; while (j < fsets[i].size) : (j += 1) { fsets[i].followers[j] = @truncate(u8, bs.istream_bits(is)); if (!bs.istream_advance(is, 8)) { return false; } } if (i == 0) break; } return true; } // Read the next byte from is, decoded based on prev_byte and the follower sets. // The byte is returned in *out_byte. The function returns true on success, // and false on bad data or end of input. fn read_next_byte(is: *bs.istream_t, prev_byte: u8, fsets: [*]const follower_set_t, out_byte: *u8) bool { var bits: u64 = 0; var idx_bw: u8 = 0; var follower_idx: u8 = 0; bits = bs.istream_bits(is); if (fsets[prev_byte].size == 0) { // No followers; read a literal byte. out_byte.* = @truncate(u8, bits); return bs.istream_advance(is, 8); } if (bits_utils.lsb(bits, 1) == 1) { // Don't use the follower set; read a literal byte. out_byte.* = @truncate(u8, bits >> 1); return bs.istream_advance(is, 1 + 8); } // The bits represent the index of a follower byte. idx_bw = fsets[prev_byte].idx_bw; follower_idx = @intCast(u8, bits_utils.lsb(bits >> 1, @intCast(u6, idx_bw))); if (follower_idx >= fsets[prev_byte].size) { return false; } out_byte.* = fsets[prev_byte].followers[follower_idx]; return bs.istream_advance(is, 1 + idx_bw); } fn max_len(comp_factor: u3) usize { var v_len_bits: usize = @as(usize, 8) - @intCast(usize, comp_factor); assert(comp_factor >= 1 and comp_factor <= 4); // Bits in V + extra len byte + implicit 3. return ((@as(u16, 1) << @intCast(u4, v_len_bits)) - 1) + 255 + 3; } fn max_dist(comp_factor: u3) usize { var v_dist_bits: usize = @intCast(usize, comp_factor); assert(comp_factor >= 1 and comp_factor <= 4); // Bits in V * 256 + W byte + implicit 1. return ((@as(u16, 1) << @intCast(u4, v_dist_bits)) - 1) * 256 + 255 + 1; } const DLE_BYTE = 144; // Decompress (expand) the data in src. The uncompressed data is uncomp_len // bytes long and was compressed with comp_factor. The number of input bytes // used, at most src_len, is written to *src_used on success. Output is written // to dst. pub fn hwexpand( src: [*]const u8, src_len: usize, uncomp_len: usize, comp_factor: u3, src_used: *usize, dst: [*]u8, ) expand_stat_t { var is: bs.istream_t = undefined; var fsets: [256]follower_set_t = undefined; var v_len_bits: usize = 0; var dst_pos: usize = 0; var len: usize = 0; var dist: usize = 0; var i: usize = 0; var curr_byte: u8 = 0; var v: u8 = 0; assert(comp_factor >= 1 and comp_factor <= 4); bs.istream_init(&is, src, src_len); if (!read_follower_sets(&is, &fsets)) { return expand_stat_t.HWEXPAND_ERR; } // Number of bits in V used for backref length. v_len_bits = @as(usize, 8) - @intCast(usize, comp_factor); dst_pos = 0; curr_byte = 0; // The first "previous byte" is implicitly zero. while (dst_pos < uncomp_len) { // Read a literal byte or DLE marker. if (!read_next_byte(&is, curr_byte, &fsets, &curr_byte)) { return expand_stat_t.HWEXPAND_ERR; } if (curr_byte != DLE_BYTE) { // Output a literal byte. dst[dst_pos] = curr_byte; dst_pos += 1; continue; } // Read the V byte which determines the length. if (!read_next_byte(&is, curr_byte, &fsets, &curr_byte)) { return expand_stat_t.HWEXPAND_ERR; } if (curr_byte == 0) { // Output a literal DLE byte. dst[dst_pos] = DLE_BYTE; dst_pos += 1; continue; } v = curr_byte; len = @intCast(usize, bits_utils.lsb(v, @intCast(u6, v_len_bits))); if (len == (@as(u16, 1) << @intCast(u4, v_len_bits)) - 1) { // Read an extra length byte. if (!read_next_byte(&is, curr_byte, &fsets, &curr_byte)) { return expand_stat_t.HWEXPAND_ERR; } len += curr_byte; } len += 3; // Read the W byte, which together with V gives the distance. if (!read_next_byte(&is, curr_byte, &fsets, &curr_byte)) { return expand_stat_t.HWEXPAND_ERR; } dist = @intCast(usize, (v >> @intCast(u3, v_len_bits))) * 256 + curr_byte + 1; assert(len <= max_len(comp_factor)); assert(dist <= max_dist(comp_factor)); // Output the back reference. if (bits_utils.round_up(len, 8) <= uncomp_len - dst_pos and dist <= dst_pos) { // Enough room and no implicit zeros; chunked copy. lz.lz77_output_backref64(dst, dst_pos, dist, len); dst_pos += len; } else if (len > uncomp_len - dst_pos) { // Not enough room. return expand_stat_t.HWEXPAND_ERR; } else { // Copy, handling overlap and implicit zeros. i = 0; while (i < len) : (i += 1) { if (dist > dst_pos) { dst[dst_pos] = 0; dst_pos += 1; continue; } dst[dst_pos] = dst[dst_pos - dist]; dst_pos += 1; } } } src_used.* = bs.istream_bytes_read(&is); return expand_stat_t.HWEXPAND_OK; } const RAW_BYTES_SZ = (64 * 1024); const NO_FOLLOWER_IDX = UINT8_MAX; const reduce_state_t: type = struct { os: bs.ostream_t, comp_factor: u3, prev_byte: u8, raw_bytes_flushed: bool, // Raw bytes buffer. raw_bytes: [RAW_BYTES_SZ]u8, num_raw_bytes: usize, // Map from (prev_byte,curr_byte) to follower_idx or NO_FOLLOWER_IDX. follower_idx: [256][256]u8, follower_idx_bw: [256]u8, }; const follower_t: type = struct { byte: u8, count: usize, }; fn follower_cmp(context: void, a: follower_t, b: follower_t) bool { _ = context; var l: follower_t = a; var r: follower_t = b; // Sort descending by count. if (l.count > r.count) { return true; } if (l.count < r.count) { return false; } // Break ties by sorting ascending by byte. if (l.byte < r.byte) { return true; } if (l.byte > r.byte) { return false; } assert(l.count == r.count and l.byte == r.byte); return false; } // The cost in bits for writing the follower bytes using follower set size n. fn followers_cost(followers: [*]const follower_t, n: usize) usize { var cost: usize = 0; var i: usize = 0; // Cost for storing the follower set. cost = n * 8; // Cost for follower bytes in the set. i = 0; while (i < n) : (i += 1) { cost += followers[i].count * (1 + num_to_follower_idx_bw(n)); } // Cost for follower bytes not in the set. while (i < 256) : (i += 1) { if (n == 0) { cost += followers[i].count * 8; } else { cost += followers[i].count * (1 + 8); } } return cost; } // Compute and write the follower sets based on the raw bytes buffer. fn write_follower_sets(s: *reduce_state_t) bool { var follower_count: [256][256]usize = [_][256]usize{[1]usize{0} ** 256} ** 256; var followers: [256]follower_t = undefined; var prev_byte: u8 = 0; var curr_byte: u8 = 0; var i: usize = 0; var cost: usize = 0; var min_cost: usize = 0; var min_cost_size: usize = 0; // Count followers. prev_byte = 0; i = 0; while (i < s.num_raw_bytes) : (i += 1) { curr_byte = s.raw_bytes[i]; follower_count[prev_byte][curr_byte] += 1; prev_byte = curr_byte; } curr_byte = UINT8_MAX; while (curr_byte >= 0) : (curr_byte -= 1) { // Initialize follower indices to invalid. i = 0; while (i <= UINT8_MAX) : (i += 1) { s.follower_idx[curr_byte][i] = NO_FOLLOWER_IDX; if (i == UINT8_MAX) break; } // Sort the followers for curr_byte. i = 0; while (i <= UINT8_MAX) : (i += 1) { followers[i].byte = @intCast(u8, i); followers[i].count = follower_count[curr_byte][i]; if (i == UINT8_MAX) break; // avoid i overflow } block_sort(&followers, follower_t, follower_cmp); // originaly qsort() C function replaced by block_sort for convenience // Find the follower set size with the lowest cost. min_cost_size = 0; min_cost = followers_cost(&followers, 0); i = 1; while (i <= 32) : (i += 1) { cost = followers_cost(&followers, i); if (cost < min_cost) { min_cost_size = i; min_cost = cost; } } // Save the follower indices. i = 0; while (i < min_cost_size) : (i += 1) { s.follower_idx[curr_byte][followers[i].byte] = @intCast(u8, i); } s.follower_idx_bw[curr_byte] = num_to_follower_idx_bw(min_cost_size); // Write the followers. if (!bs.ostream_write(&s.os, min_cost_size, 6)) { return false; } i = 0; while (i < min_cost_size) : (i += 1) { if (!bs.ostream_write(&s.os, followers[i].byte, 8)) { return false; } } if (curr_byte == 0) break; // avoid curr_byte underflow } return true; } fn flush_raw_bytes(s: *reduce_state_t) bool { var i: usize = 0; s.raw_bytes_flushed = true; if (!write_follower_sets(s)) { return false; } i = 0; while (i < s.num_raw_bytes) : (i += 1) { if (!write_byte(s, s.raw_bytes[i])) { return false; } } return true; } fn write_byte(s: *reduce_state_t, byte: u8) bool { var follower_idx: u8 = 0; var follower_idx_bw: u8 = 0; if (!s.raw_bytes_flushed) { // Accumulate bytes which will be used for computing the follower sets. assert(s.num_raw_bytes < RAW_BYTES_SZ); s.raw_bytes[s.num_raw_bytes] = byte; s.num_raw_bytes += 1; if (s.num_raw_bytes == RAW_BYTES_SZ) { // Write follower sets and flush the bytes. return flush_raw_bytes(s); } return true; } follower_idx = s.follower_idx[s.prev_byte][byte]; follower_idx_bw = s.follower_idx_bw[s.prev_byte]; s.prev_byte = byte; if (follower_idx != NO_FOLLOWER_IDX) { // Write (LSB-first) a 0 bit followed by the follower index. return bs.ostream_write( &s.os, @intCast(u64, follower_idx) << 1, follower_idx_bw + 1, ); } if (follower_idx_bw != 0) { // Not using the follower set. // Write (LSB-first) a 1 bit followed by the literal byte. return bs.ostream_write(&s.os, (@intCast(u64, byte) << 1) | 0x1, 9); } // No follower set; write the literal byte. return bs.ostream_write(&s.os, byte, 8); } fn lit_callback(lit: u8, aux: anytype) bool { var s: *reduce_state_t = aux; if (!write_byte(s, lit)) { return false; } if (lit == DLE_BYTE) { return write_byte(s, 0); } return true; } inline fn min(a: usize, b: usize) usize { return if (a < b) a else b; } fn backref_callback(distance: usize, length: usize, aux: anytype) bool { var s: *reduce_state_t = aux; var v_len_bits: usize = @as(usize, 8) - @intCast(usize, s.comp_factor); var v: u8 = 0; var elb: u8 = 0; var w: u8 = 0; var len: usize = 0; var dist: usize = 0; len = length; dist = distance; assert(len >= 3 and len <= max_len(s.comp_factor)); assert(dist >= 1 and dist <= max_dist(s.comp_factor)); assert(len <= dist); // "Backref shouldn't self-overlap." // The implicit part of len and dist are not encoded. len -= 3; dist -= 1; // Write the DLE marker. if (!write_byte(s, DLE_BYTE)) { return false; } // Write V. v = @intCast(u8, min(len, (@as(u16, 1) << @intCast(u4, v_len_bits)) - 1)); assert(dist / 256 <= (@as(u16, 1) << @intCast(u4, s.comp_factor)) - 1); v |= @intCast(u8, (dist / 256) << @intCast(u6, v_len_bits)); assert(v != 0); // "The byte following DLE must be non-zero." if (!write_byte(s, v)) { return false; } if (len >= (@as(u16, 1) << @intCast(u4, v_len_bits)) - 1) { // Write extra length byte. assert(len - ((@as(u16, 1) << @intCast(u4, v_len_bits)) - 1) <= UINT8_MAX); elb = @intCast(u8, len - ((@as(u16, 1) << @intCast(u4, v_len_bits)) - 1)); if (!write_byte(s, elb)) { return false; } } // Write W. w = @intCast(u8, dist % 256); if (!write_byte(s, w)) { return false; } return true; } // Compress (reduce) the data in src into dst using the specified compression // factor (1--4). The number of bytes output, at most dst_cap, is stored in // *dst_used. Returns false if there is not enough room in dst. pub fn hwreduce( src: [*]const u8, src_len: usize, comp_factor: u3, dst: [*]u8, dst_cap: usize, dst_used: *usize, ) bool { var s: reduce_state_t = undefined; bs.ostream_init(&s.os, dst, dst_cap); s.comp_factor = comp_factor; s.prev_byte = 0; s.raw_bytes_flushed = false; s.num_raw_bytes = 0; if (!lz.lz77_compress( src, src_len, max_dist(comp_factor), max_len(comp_factor), false, // allow_overlap=false, lit_callback, backref_callback, &s, )) { return false; } if (!s.raw_bytes_flushed and !flush_raw_bytes(&s)) { return false; } dst_used.* = bs.ostream_bytes_written(&s.os); return true; }
src/reduce.zig
const std = @import("std"); const napi = @import("./napi.zig"); pub usingnamespace struct { env: napi.env, const serde = @This(); pub fn init(env: napi.env) serde { return serde { .env = env }; } pub fn serialize(self: serde, v: anytype) !napi.value { const T = @TypeOf(v); const I = @typeInfo(T); if (T == type) switch (@typeInfo(v)) { .Enum => return serde.types.@"enum".serialize(self.env, v), .Void => return serde.types.@"undefined".serialize(self.env), else => @compileError("unsupported meta type: " ++ @typeInfo(v)), }; switch (I) { .Null => return serde.types.@"null".serialize(self.env), .Enum => return serde.types.@"enum".serialize(self.env, v), .Bool => return serde.types.@"bool".serialize(self.env, v), else => @compileError("unsupported type: " ++ @typeName(T)), .Void => return serde.types.@"undefined".serialize(self.env), .ErrorSet => return serde.types.@"error".serialize(self.env, v), .Int, .Float, .ComptimeInt, .ComptimeFloat => return serde.types.@"number".serialize(self.env, v), .Optional => if (v) |x| return self.serialize(x) else return serde.types.@"null".serialize(self.env), .ErrorUnion => if (v) |x| return self.serialize(x) else |x| return serde.types.@"error".serialize(self.env, x), .Union => switch (T) { else => return serde.types.@"union".serialize(self.env, v), serde.string => return serde.types.@"string".serialize(self.env, v), }, .Struct => switch (T) { else => return serde.types.@"struct".serialize(self.env, v), napi.value, napi.array, napi.string, napi.object => return napi.value.init(v.raw), }, } } pub const string = union(enum) { static: []const u8, alloced: struct { slice: []u8, alloc: std.mem.Allocator, }, pub fn from(s: anytype) string { return string { .static = std.mem.sliceAsBytes(s[0..]), }; } pub fn new(s: anytype, allocator: std.mem.Allocator) !string { return string { .alloced = .{ .alloc = allocator, .slice = if ([]u8 == @TypeOf(s)) s else try allocator.alloc(u8, s), }, }; } }; // TODO: slice, array, pointer pub const types = opaque { pub const @"null" = opaque { pub fn serialize(env: napi.env) !napi.value { var raw: napi.napi_value = undefined; try napi.safe(napi.napi_get_null, .{env.raw, &raw}); return napi.value { .raw = raw }; } }; pub const @"undefined" = opaque { pub fn serialize(env: napi.env) !napi.value { var raw: napi.napi_value = undefined; try napi.safe(napi.napi_get_undefined, .{env.raw, &raw}); return napi.value { .raw = raw }; } }; pub const @"bool" = opaque { pub fn serialize(env: napi.env, v: bool) !napi.value { var raw: napi.napi_value = undefined; try napi.safe(napi.napi_get_boolean, .{env.raw, v, &raw}); return napi.value { .raw = raw }; } pub fn deserialize(env: napi.env, v: napi.value) !bool { var raw: bool = undefined; try napi.safe(napi.napi_get_value_bool, .{env.raw, v.raw, &raw}); return raw; } }; pub const @"error" = opaque { pub fn serialize(env: napi.env, v: anyerror) !napi.value { var raw: napi.napi_value = undefined; const s = try napi.string.new(env, .latin1, @errorName(v)); try napi.safe(napi.napi_create_error, .{env.raw, null, s.raw, &raw}); return napi.value { .raw = raw }; } }; pub const @"union" = opaque { pub fn serialize(env: napi.env, v: anytype) !napi.value { const T = @TypeOf(v); const I = @typeInfo(T); const S = serde.init(env); switch (I) { else => @compileError("expected union, got: " ++ @typeName(T)), .Union => |info| { const tag = std.meta.Tag(T); const object = try napi.object.new(env); inline for (info.fields) |f| { if (@as(tag, v) == @field(tag, f.name)) { try object.set(env, f.name[0.. :0], try S.serialize(@field(v, f.name))); } } return napi.value.init(object.raw); }, } unreachable; } }; pub const @"enum" = opaque { pub fn serialize(env: napi.env, v: anytype) !napi.value { const T = @TypeOf(v); const I = @typeInfo(T); const S = serde.init(env); var raw: napi.napi_value = undefined; switch (I) { else => @compileError("expected enum, got: " ++ @typeName(T)), .Enum => return serde.types.number.serialize(env, @enumToInt(v)), .Type => switch (@typeInfo(v)) { else => @compileError("expected enum type, got: " ++ @typeName(v)), .Enum => |info| { try napi.safe(napi.napi_create_object, .{env.raw, &raw}); const o = napi.object.init(raw); inline for (info.fields) |f| { try o.set(env, f.name[0.. :0], try S.serialize(@field(v, f.name))); } }, }, } return napi.value { .raw = raw }; } }; pub const @"string" = opaque { pub fn deserialize(env: napi.env, v: napi.value, A: std.mem.Allocator) !serde.string { return try serde.string.new(try napi.string.init(v.raw).get(env, .utf8, A), A); } pub fn serialize(env: napi.env, v: serde.string) !napi.value { switch (v) { .static => return napi.value.init((try napi.string.new(env, .utf8, v.static)).raw), .alloced => |x| return napi.value.init((try napi.string.new(env, .utf8, x.slice)).raw), } } }; pub const @"struct" = opaque { pub fn serialize(env: napi.env, v: anytype) !napi.value { const T = @TypeOf(v); const I = @typeInfo(T); const S = serde.init(env); var raw: napi.napi_value = undefined; switch (I) { else => @compileError("expected struct, got: " ++ @typeName(T)), .Struct => |info| switch(info.is_tuple) { false => { try napi.safe(napi.napi_create_object, .{env.raw, &raw}); const o = napi.object.init(raw); inline for (info.fields) |f| { try o.set(env, f.name[0.. :0], try S.serialize(@field(v, f.name))); } }, true => { try napi.safe(napi.napi_create_array_with_length, .{env.raw, info.fields.len, &raw}); const a = napi.array.init(raw); inline for (info.fields) |field, offset| { try a.set(env, offset, try S.serialize(@field(v, field.name))); } }, }, } return napi.value { .raw = raw }; } }; pub const @"number" = opaque { pub fn serialize(env: napi.env, v: anytype) !napi.value { const T = @TypeOf(v); const I = @typeInfo(T); var raw: napi.napi_value = undefined; switch (I) { else => @compileError("expected number, got: " ++ @typeName(@TypeOf(v))), .ComptimeInt => try napi.safe(napi.napi_create_int64, .{env.raw, @as(i64, @as(i53, v)), &raw}), .Float, .ComptimeFloat => try napi.safe(napi.napi_create_double, .{env.raw, @as(f64, v), &raw}), .Int => |info| switch (T) { i64 => try napi.safe(napi.napi_create_bigint_int64, .{env.raw, v, &raw}), u64 => try napi.safe(napi.napi_create_bigint_uint64, .{env.raw, v, &raw}), i8, i16, i32 => try napi.safe(napi.napi_create_int32, .{env.raw, @as(i32, v), &raw}), u8, u16, u32 => try napi.safe(napi.napi_create_uint32, .{env.raw, @as(u32, v), &raw}), usize, isize => try napi.safe(napi.napi_create_int64, .{env.raw, @intCast(i64, v), &raw}), u128 => try napi.safe(napi.napi_create_bigint_words, .{env.raw, 0, 2, @ptrCast([*]const u64, &v), &raw}), i128 => try napi.safe(napi.napi_create_bigint_words, .{env.raw, @boolToInt(v <= 0), 2, @ptrCast([*]const u64, &std.math.absCast(v)), &raw}), else => { var sign = info.signedness; switch (info.bits) { else => @compileError("unsupported integer width"), 33...53 => try napi.safe(napi.napi_create_int64, .{env.raw, @as(i64, v), &raw}), 0...31 => switch (sign) { .signed => try napi.safe(napi.napi_create_int32, .{env.raw, @as(i32, v), &raw}), .unsigned => try napi.safe(napi.napi_create_uint32, .{env.raw, @as(u32, v), &raw}), }, 54...63 => switch (sign) { .signed => try napi.safe(napi.napi_create_bigint_int64, .{env.raw, @as(i64, v), &raw}), .unsigned => try napi.safe(napi.napi_create_bigint_uint64, .{env.raw, @as(u64, v), &raw}), }, } }, }, } return napi.value { .raw = raw }; } pub fn deserialize(env: napi.env, comptime T: type, v: napi.value) !T { switch (@typeInfo(T)) { else => @compileError("expected number type, got: " ++ @typeName(T)), .Float => { var raw: f64 = undefined; try napi.safe(napi.napi_get_value_double, .{env.raw, v.raw, &raw}); return if (T == f64) raw else @floatCast(T, raw); }, .Int => switch (T) { else => @compileError("unsupported integer type: " ++ @typeName(T)), i18, i16 => { var raw: i32 = undefined; try napi.safe(napi.napi_get_value_int32, .{env.raw, v.raw, &raw}); return std.math.cast(T, raw); }, u18, u16 => { var raw: u32 = undefined; try napi.safe(napi.napi_get_value_uint32, .{env.raw, v.raw, &raw}); return std.math.cast(T, raw); }, usize, isize => { var raw: i64 = undefined; try napi.safe(napi.napi_get_value_int64, .{env.raw, v.raw, &raw}); return std.math.cast(T, raw); }, u32, i32, u64, i64 => { var raw: T = undefined; try napi.safe(switch (T) { else => unreachable, i32 => napi.napi_get_value_int32, u32 => napi.napi_get_value_uint32, i64 => napi.napi_get_value_bigint_int64, u64 => napi.napi_get_value_bigint_uint64, }, .{env.raw, v.raw, &raw}); return raw; }, }, } } }; }; };
src/serde.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const nvg = @import("nanovg"); const gui = @import("../gui.zig"); const Rect = @import("../geometry.zig").Rect; pub fn Slider(comptime T: type) type { comptime std.debug.assert(T == f32); return struct { widget: gui.Widget, allocator: Allocator, value: T = 0, min_value: T = 0, max_value: T = 100, pressed: bool = false, onChangedFn: fn (*Self) void = onChanged, const Self = @This(); pub fn init(allocator: Allocator, rect: Rect(f32)) !*Self { var self = try allocator.create(Self); self.* = Self{ .widget = gui.Widget.init(allocator, rect), .allocator = allocator, }; self.widget.onMouseMoveFn = onMouseMove; self.widget.onMouseDownFn = onMouseDown; self.widget.onMouseUpFn = onMouseUp; self.widget.drawFn = draw; return self; } pub fn deinit(self: *Self) void { self.widget.deinit(); self.allocator.destroy(self); } fn onChanged(self: *Self) void { _ = self; } fn onMouseMove(widget: *gui.Widget, event: *const gui.MouseEvent) void { const self = @fieldParentPtr(Self, "widget", widget); if (self.pressed) { const rect = widget.getRect(); const x = std.math.clamp(event.x, 0, rect.w - 1) / (rect.w - 1); self.value = self.min_value + x * (self.max_value - self.min_value); self.onChangedFn(self); } } fn onMouseDown(widget: *gui.Widget, event: *const gui.MouseEvent) void { if (event.button == .left) { const self = @fieldParentPtr(Self, "widget", widget); self.pressed = true; const rect = widget.getRect(); const x = std.math.clamp(event.x, 0, rect.w - 1) / (rect.w - 1); self.value = self.min_value + x * (self.max_value - self.min_value); self.onChangedFn(self); } } fn onMouseUp(widget: *gui.Widget, event: *const gui.MouseEvent) void { if (event.button == .left) { const self = @fieldParentPtr(Self, "widget", widget); self.pressed = false; } } pub fn setValue(self: *Self, value: T) void { self.value = std.math.clamp(value, self.min_value, self.max_value); } fn draw(widget: *gui.Widget, vg: nvg) void { const self = @fieldParentPtr(Self, "widget", widget); const rect = widget.relative_rect; gui.drawPanelInset(vg, rect.x, rect.y + 0.5 * rect.h - 1, rect.w, 2, 1); const x = (self.value - self.min_value) / (self.max_value - self.min_value); drawIndicator(vg, rect.x + x * rect.w, rect.y + 0.5 * rect.h - 1); } }; } fn drawIndicator(vg: nvg, x: f32, y: f32) void { vg.beginPath(); vg.moveTo(x, y); vg.lineTo(x + 4, y - 4); vg.lineTo(x - 4, y - 4); vg.closePath(); vg.fillColor(nvg.rgb(0, 0, 0)); vg.fill(); }
src/gui/widgets/Slider.zig
const std = @import("std"); const CrossTarget = std.zig.CrossTarget; const ReleaseMode = std.builtin.Mode; const Builder = std.build.Builder; const Step = std.build.Step; pub fn build(b: *Builder) void { b.top_level_steps.shrinkRetainingCapacity(0); const mode_config = [_]?bool{ b.option(bool, "debug", "Execute tests in Debug mode"), b.option(bool, "release-safe", "Execute tests in ReleaseSafe mode"), b.option(bool, "release-fast", "Execute tests in ReleaseFast mode"), b.option(bool, "release-small", "Execute tests in ReleaseSmall mode"), }; const target: ?CrossTarget = blk: { const target_ = b.standardTargetOptions(.{}); if (b.user_input_options.contains("target")) break :blk target_; break :blk null; }; const default_mode = for (mode_config) |opt| { if (opt != null and opt.?) break false; } else true; const test_everything = b.option(bool, "test-everything", "Test on every mode and emulable target") orelse false; const test_filter = b.option([]const u8, "test-filter", "Filter which unit tests are to be executed"); var cross_tests = b.option(bool, "cross-tests", "Execute tests through qemu, wasmtime, and wine") orelse test_everything; const wasi_tests = b.option(bool, "wasi-tests", "Execute tests through wasmtime") orelse cross_tests; const qemu_tests = (b.option(bool, "qemu-tests", "Execute tests through qemu") orelse cross_tests) and std.builtin.os.tag != .windows; const wine_tests = (b.option(bool, "wine-tests", "Execute tests through wine") orelse cross_tests) and std.builtin.os.tag != .windows and (std.builtin.cpu.arch == .x86_64 or std.builtin.cpu.arch == .i386); cross_tests = wasi_tests or qemu_tests or wine_tests; var num_modes: usize = 0; var modes: [4]ReleaseMode = undefined; for ([_]ReleaseMode{ .Debug, .ReleaseSafe, .ReleaseFast, .ReleaseSmall, }) |mode, i| { const is_default = default_mode and (i == 0 or test_everything); if (mode_config[i] orelse is_default) { defer num_modes += 1; modes[num_modes] = mode; } } if (num_modes == 0 and !b.invalid_user_input) { if (test_everything) { std.debug.print("error: all build modes were manually disabled\n", .{}); } else { std.debug.print("error: unable to infer requested build mode\n", .{}); } std.process.exit(1); } const test_step = b.step("test", "Run library tests"); var test_config = TestConfig{ .b = b, .step = test_step, .modes = modes[0..num_modes], .filter = test_filter, .wasi_tests = wasi_tests, .qemu_tests = qemu_tests, .wine_tests = wine_tests, }; if (cross_tests) { if (target) |t| test_config.addTest(t, true); for ([_]std.Target.Cpu.Arch{ .x86_64, .i386, .aarch64, .arm, .riscv64, }) |arch| { if (arch.ptrBitWidth() > std.builtin.cpu.arch.ptrBitWidth()) continue; if (arch == .riscv64 and std.builtin.os.tag != .linux) continue; if (qemu_tests or arch == std.builtin.cpu.arch) test_config.addTest(.{ .cpu_arch = arch, .os_tag = std.builtin.os.tag }, false); } if (wine_tests) { const cpu_arch = std.builtin.cpu.arch; if (cpu_arch == .x86_64) test_config.addTest(.{ .cpu_arch = .x86_64, .os_tag = .windows }, false); test_config.addTest(.{ .cpu_arch = .i386, .os_tag = .windows }, false); } if (wasi_tests) test_config.addTest(.{ .cpu_arch = .wasm32, .os_tag = .wasi }, false); } else test_config.addTest(target orelse .{}, true); b.default_step = test_step; } const TestConfig = struct { b: *Builder, step: *Step, num_tests: usize = 0, modes: []const ReleaseMode, filter: ?[]const u8, wasi_tests: bool, qemu_tests: bool, wine_tests: bool, fn addTest(self: *TestConfig, target: CrossTarget, default: bool) void { const filter_arg = [_][]const u8{ if (self.filter != null) "\n filter: " else "", if (self.filter) |f| f else "", }; const target_str = target.zigTriple(self.b.allocator) catch unreachable; for (self.modes) |mode| { const log_step = self.b.addLog("unit tests\n target: {}\n mode: {}{}{}\n", .{ target_str, @tagName(mode), filter_arg[0], filter_arg[1], }); const test_step = self.b.addTest("./zlaap.zig"); test_step.setFilter(self.filter); test_step.setTarget(target); test_step.setBuildMode(mode); test_step.enable_wasmtime = default or self.wasi_tests; test_step.enable_qemu = default or self.qemu_tests; test_step.enable_wine = default or self.wine_tests; if (self.newline()) |step| self.step.dependOn(step); self.step.dependOn(&log_step.step); self.step.dependOn(&test_step.step); } } fn newline(self: *TestConfig) ?*Step { defer self.num_tests += 1; if (self.num_tests > 0) { const log_step = self.b.addLog("\n", .{}); return &log_step.step; } else return null; } };
build.zig
const MachO = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const fs = std.fs; const Module = @import("../Module.zig"); const link = @import("../link.zig"); const File = link.File; pub const base_tag: Tag = File.Tag.macho; base: File, error_flags: File.ErrorFlags = File.ErrorFlags{}, pub const TextBlock = struct { pub const empty = TextBlock{}; }; pub const SrcFn = struct { pub const empty = SrcFn{}; }; pub fn openPath(allocator: *Allocator, dir: fs.Dir, sub_path: []const u8, options: link.Options) !*File { assert(options.object_format == .macho); const file = try dir.createFile(sub_path, .{ .truncate = false, .read = true, .mode = link.determineMode(options) }); errdefer file.close(); var macho_file = try allocator.create(MachO); errdefer allocator.destroy(macho_file); macho_file.* = openFile(allocator, file, options) catch |err| switch (err) { error.IncrFailed => try createFile(allocator, file, options), else => |e| return e, }; return &macho_file.base; } /// Returns error.IncrFailed if incremental update could not be performed. fn openFile(allocator: *Allocator, file: fs.File, options: link.Options) !MachO { switch (options.output_mode) { .Exe => {}, .Obj => {}, .Lib => return error.IncrFailed, } var self: MachO = .{ .base = .{ .file = file, .tag = .macho, .options = options, .allocator = allocator, }, }; errdefer self.deinit(); // TODO implement reading the macho file return error.IncrFailed; //try self.populateMissingMetadata(); //return self; } /// Truncates the existing file contents and overwrites the contents. /// Returns an error if `file` is not already open with +read +write +seek abilities. fn createFile(allocator: *Allocator, file: fs.File, options: link.Options) !MachO { switch (options.output_mode) { .Exe => return error.TODOImplementWritingMachOExeFiles, .Obj => return error.TODOImplementWritingMachOObjFiles, .Lib => return error.TODOImplementWritingLibFiles, } } pub fn flush(self: *MachO, module: *Module) !void {} pub fn deinit(self: *MachO) void {} pub fn allocateDeclIndexes(self: *MachO, decl: *Module.Decl) !void {} pub fn updateDecl(self: *MachO, module: *Module, decl: *Module.Decl) !void {} pub fn updateDeclLineNumber(self: *MachO, module: *Module, decl: *const Module.Decl) !void {} pub fn updateDeclExports( self: *MachO, module: *Module, decl: *const Module.Decl, exports: []const *Module.Export, ) !void {} pub fn freeDecl(self: *MachO, decl: *Module.Decl) void {}
src-self-hosted/link/MachO.zig
const std = @import("std"); const Allocator = std.mem.Allocator; pub const State = struct { const Memory = std.AutoHashMap(TapeIndex, TapeElement); const Inputs = std.ArrayList(TapeElement); memory: Memory, inputs: Inputs, idx: TapeIndex = 0, inputs_idx: usize = 0, relative_base_offset: TapeElement = 0, fn init(allocator: Allocator) State { return State { .memory = Memory.init(allocator), .inputs = Inputs.init(allocator) }; } pub fn deinit(self: *State) void { self.memory.deinit(); self.inputs.deinit(); } }; const Self = @This(); pub const TapeElement = i64; pub const TapeIndex = usize; const Opcode = usize; const Tape = std.ArrayList(TapeElement); allocator: Allocator, tape: Tape, pub fn init(allocator: std.mem.Allocator, code: []const u8) !Self { var intcode = Self { .allocator = allocator, .tape = Tape.init(allocator) }; var tokens = std.mem.tokenize(u8, code, ",\n"); while (tokens.next()) |token| { try intcode.tape.append(try std.fmt.parseInt(TapeElement, token, 10)); } return intcode; } pub fn deinit(self: *Self) void { self.tape.deinit(); } pub fn newState(self: *const Self) State { return State.init(self.allocator); } pub fn run(self: *const Self, state: *State) !?TapeElement { while (true) { const op = @intCast(Opcode, self.getMemory(state, state.idx)); const output = try switch (op % 100) { 1 => self.math(state, op, std.math.add), 2 => self.math(state, op, std.math.mul), 3 => self.readInputIntoMemory(state, op), 4 => self.outputFromMemory(state, op), 5 => self.jump(state, op, true), 6 => self.jump(state, op, false), 7 => self.cmp(state, op, std.math.CompareOperator.lt), 8 => self.cmp(state, op, std.math.CompareOperator.eq), 9 => self.adj_relative_base(state, op), 99 => return null, else => unreachable }; if (output) |o| { return o; } } } fn math(self: *const Self, state: *State, opcode: Opcode, comptime alu_op: fn(comptime type, anytype, anytype)TapeElement) !?TapeElement { const p1 = self.getMemoryByOpcode(state, state.idx + 1, opcode / 100); const p2 = self.getMemoryByOpcode(state, state.idx + 2, opcode / 1000); const res = try alu_op(TapeElement, p1, p2); const dest = self.getDestByOpcode(state, state.idx + 3, opcode / 10000); _ = try state.memory.put(dest, res); state.idx += 4; return null; } fn readInputIntoMemory(self: *const Self, state: *State, opcode: Opcode) !?TapeElement { const value = state.inputs.items[state.inputs_idx]; state.inputs_idx += 1; const dest = self.getDestByOpcode(state, state.idx + 1, opcode / 100); _ = try state.memory.put(dest, value); state.idx += 2; return null; } fn outputFromMemory(self: *const Self, state: *State, opcode: Opcode) !?TapeElement { const output = self.getMemoryByOpcode(state, state.idx + 1, opcode / 100); state.idx += 2; return output; } fn jump(self: *const Self, state: *State, opcode: Opcode, nonzero: bool) !?TapeElement { const param = self.getMemoryByOpcode(state, state.idx + 1, opcode / 100); if ((param != 0) == nonzero) { state.idx = @intCast(TapeIndex, self.getMemoryByOpcode(state, state.idx + 2, opcode / 1000)); } else { state.idx += 3; } return null; } fn cmp(self: *const Self, state: *State, opcode: Opcode, operator: std.math.CompareOperator) !?TapeElement { const p1 = self.getMemoryByOpcode(state, state.idx + 1, opcode / 100); const p2 = self.getMemoryByOpcode(state, state.idx + 2, opcode / 1000); const res: TapeElement = if (std.math.compare(p1, operator, p2)) 1 else 0; const dest = self.getDestByOpcode(state, state.idx + 3, opcode / 10000); _ = try state.memory.put(dest, res); state.idx += 4; return null; } fn adj_relative_base(self: *const Self, state: *State, opcode: Opcode) !?TapeElement { const param = self.getMemoryByOpcode(state, state.idx + 1, opcode / 100); state.relative_base_offset += param; state.idx += 2; return null; } pub fn getMemory(self: *const Self, state: *const State, idx: TapeIndex) TapeElement { return state.memory.get(idx) orelse if (idx < self.tape.items.len) self.tape.items[idx] else 0; } fn getMemoryByOpcode(self: *const Self, state: *const State, idx: TapeIndex, opcode: Opcode) TapeElement { return switch (opcode % 10) { 0 => self.getMemory(state, @intCast(TapeIndex, self.getMemory(state, idx))), 1 => self.getMemory(state, idx), 2 => self.getMemory(state, @intCast(TapeIndex, self.getMemory(state, idx) + state.relative_base_offset)), else => unreachable }; } fn getDestByOpcode(self: *const Self, state: *const State, idx: TapeIndex, opcode: Opcode) TapeIndex { return @intCast(TapeIndex, switch (opcode % 10) { 0 => self.getMemory(state, idx), 2 => self.getMemory(state, idx) + state.relative_base_offset, else => unreachable }); }
src/main/zig/2019/intcode.zig
const std = @import("std"); const Options = struct { mode: std.builtin.Mode, target: std.zig.CrossTarget, fn apply(self: Options, lib: *std.build.LibExeObjStep) void { lib.setBuildMode(self.mode); lib.setTarget(self.target); } }; pub fn build(b: *std.build.Builder) void { const options = Options{ // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. .target = b.standardTargetOptions(.{}), // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. .mode = b.standardReleaseOptions(), }; const lib = b.addStaticLibrary("zCord", "src/main.zig"); lib.install(); options.apply(lib); for (packages.all) |pkg| { lib.addPackage(pkg); } const main_tests = b.addTest("src/main.zig"); options.apply(main_tests); for (packages.all) |pkg| { main_tests.addPackage(pkg); } const test_step = b.step("test", "Run library tests"); test_step.dependOn(&main_tests.step); for ([_][]const u8{ "print-bot", "reconnect-bot", "reply-bot" }) |name| { const exe = createExampleExe(b, name); options.apply(exe); test_step.dependOn(&exe.step); const run_cmd = exe.run(); const run_step = b.step( std.fmt.allocPrint(b.allocator, "example:{s}", .{name}) catch unreachable, std.fmt.allocPrint(b.allocator, "Run example {s}", .{name}) catch unreachable, ); run_step.dependOn(&run_cmd.step); } } fn createExampleExe(b: *std.build.Builder, name: []const u8) *std.build.LibExeObjStep { const filename = std.fmt.allocPrint(b.allocator, "examples/{s}.zig", .{name}) catch unreachable; const exe = b.addExecutable(name, filename); exe.addPackage(.{ .name = "zCord", .path = "src/main.zig", .dependencies = packages.all, }); return exe; } const packages = struct { const iguanaTLS = std.build.Pkg{ .name = "iguanaTLS", .path = "lib/iguanaTLS/src/main.zig", }; const hzzp = std.build.Pkg{ .name = "hzzp", .path = "lib/hzzp/src/main.zig", }; const wz = std.build.Pkg{ .name = "wz", .path = "lib/wz/src/main.zig", .dependencies = &[_]std.build.Pkg{hzzp}, }; const all = &[_]std.build.Pkg{ iguanaTLS, hzzp, wz }; };
build.zig
const Arg = @This(); const std = @import("std"); const Settings = struct { takes_value: bool, allow_empty_value: bool, pub fn initDefault() Settings { return Settings{ .takes_value = false, .allow_empty_value = false, }; } }; name: []const u8, short_name: ?u8, long_name: ?[]const u8, min_values: ?usize = null, max_values: ?usize = null, allowed_values: ?[]const []const u8, values_delimiter: ?[]const u8, settings: Settings, pub fn new(name: []const u8) Arg { return Arg{ .name = name, .short_name = null, .long_name = null, .allowed_values = null, .values_delimiter = null, .settings = Settings.initDefault(), }; } pub fn shortName(self: *Arg, short_name: u8) void { self.short_name = short_name; } pub fn setShortNameFromName(self: *Arg) void { self.shortName(self.name[0]); } pub fn longName(self: *Arg, long_name: []const u8) void { self.long_name = long_name; } pub fn setLongNameSameAsName(self: *Arg) void { self.longName(self.name); } pub fn minValues(self: *Arg, num: usize) void { self.min_values = num; self.takesValue(true); } pub fn maxValues(self: *Arg, num: usize) void { self.max_values = num; self.takesValue(true); } pub fn allowedValues(self: *Arg, values: []const []const u8) void { self.allowed_values = values; self.takesValue(true); } pub fn valuesDelimiter(self: *Arg, delimiter: []const u8) void { self.values_delimiter = delimiter; self.takesValue(true); } pub fn takesValue(self: *Arg, b: bool) void { self.settings.takes_value = b; } pub fn allowedEmptyValue(self: *Arg, b: bool) void { self.settings.allow_empty_value = b; } pub fn verifyValueInAllowedValues(self: *const Arg, value_to_check: []const u8) bool { if (self.allowed_values) |values| { for (values) |value| { if (std.mem.eql(u8, value, value_to_check)) return true; } return false; } else { return true; } } // min 1 -> 5 pub fn remainingValuesToConsume(self: *const Arg, num_consumed_values: usize) usize { const num_required_values = blk: { if (self.max_values) |n| { break :blk n; } else if (self.min_values) |n| { break :blk n; } else { break :blk 0; } }; if (num_consumed_values > num_required_values) { return 0; } else { return num_required_values - num_consumed_values; } }
src/Arg.zig
pub const CLSID_AudioFrameNativeFactory = Guid.initString("16a0a3b9-9f65-4102-9367-2cda3a4f372a"); pub const CLSID_VideoFrameNativeFactory = Guid.initString("d194386a-04e3-4814-8100-b2b0ae6d78c7"); //-------------------------------------------------------------------------------- // Section: Types (4) //-------------------------------------------------------------------------------- const IID_IAudioFrameNative_Value = Guid.initString("20be1e2e-930f-4746-9335-3c332f255093"); pub const IID_IAudioFrameNative = &IID_IAudioFrameNative_Value; pub const IAudioFrameNative = extern struct { pub const VTable = extern struct { base: IInspectable.VTable, GetData: fn( self: *const IAudioFrameNative, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInspectable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioFrameNative_GetData(self: *const T, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioFrameNative.VTable, self.vtable).GetData(@ptrCast(*const IAudioFrameNative, self), riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVideoFrameNative_Value = Guid.initString("26ba702b-314a-4620-aaf6-7a51aa58fa18"); pub const IID_IVideoFrameNative = &IID_IVideoFrameNative_Value; pub const IVideoFrameNative = extern struct { pub const VTable = extern struct { base: IInspectable.VTable, GetData: fn( self: *const IVideoFrameNative, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDevice: fn( self: *const IVideoFrameNative, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInspectable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVideoFrameNative_GetData(self: *const T, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IVideoFrameNative.VTable, self.vtable).GetData(@ptrCast(*const IVideoFrameNative, self), riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVideoFrameNative_GetDevice(self: *const T, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IVideoFrameNative.VTable, self.vtable).GetDevice(@ptrCast(*const IVideoFrameNative, self), riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAudioFrameNativeFactory_Value = Guid.initString("7bd67cf8-bf7d-43e6-af8d-b170ee0c0110"); pub const IID_IAudioFrameNativeFactory = &IID_IAudioFrameNativeFactory_Value; pub const IAudioFrameNativeFactory = extern struct { pub const VTable = extern struct { base: IInspectable.VTable, CreateFromMFSample: fn( self: *const IAudioFrameNativeFactory, data: ?*IMFSample, forceReadOnly: BOOL, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInspectable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioFrameNativeFactory_CreateFromMFSample(self: *const T, data: ?*IMFSample, forceReadOnly: BOOL, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioFrameNativeFactory.VTable, self.vtable).CreateFromMFSample(@ptrCast(*const IAudioFrameNativeFactory, self), data, forceReadOnly, riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVideoFrameNativeFactory_Value = Guid.initString("69e3693e-8e1e-4e63-ac4c-7fdc21d9731d"); pub const IID_IVideoFrameNativeFactory = &IID_IVideoFrameNativeFactory_Value; pub const IVideoFrameNativeFactory = extern struct { pub const VTable = extern struct { base: IInspectable.VTable, CreateFromMFSample: fn( self: *const IVideoFrameNativeFactory, data: ?*IMFSample, subtype: ?*const Guid, width: u32, height: u32, forceReadOnly: BOOL, minDisplayAperture: ?*const MFVideoArea, device: ?*IMFDXGIDeviceManager, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInspectable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVideoFrameNativeFactory_CreateFromMFSample(self: *const T, data: ?*IMFSample, subtype: ?*const Guid, width: u32, height: u32, forceReadOnly: BOOL, minDisplayAperture: ?*const MFVideoArea, device: ?*IMFDXGIDeviceManager, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IVideoFrameNativeFactory.VTable, self.vtable).CreateFromMFSample(@ptrCast(*const IVideoFrameNativeFactory, self), data, subtype, width, height, forceReadOnly, minDisplayAperture, device, riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (0) //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (7) //-------------------------------------------------------------------------------- const Guid = @import("../../zig.zig").Guid; const BOOL = @import("../../foundation.zig").BOOL; const HRESULT = @import("../../foundation.zig").HRESULT; const IInspectable = @import("../../system/win_rt.zig").IInspectable; const IMFDXGIDeviceManager = @import("../../media/media_foundation.zig").IMFDXGIDeviceManager; const IMFSample = @import("../../media/media_foundation.zig").IMFSample; const MFVideoArea = @import("../../media/media_foundation.zig").MFVideoArea; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/win_rt/media.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; //-------------------------------------------------------------------------------------------------- pub fn illegal_char_points(char: u8) u32 { return switch (char) { ')' => 3, ']' => 57, '}' => 1197, '>' => 25137, else => 0, }; } //-------------------------------------------------------------------------------------------------- pub fn completion_points(char: u8) u32 { return switch (char) { ')' => 1, ']' => 2, '}' => 3, '>' => 4, else => 0, }; } //-------------------------------------------------------------------------------------------------- pub fn matching_opening(char: u8) u8 { return switch (char) { ')' => '(', ']' => '[', '}' => '{', '>' => '<', else => '!', }; } //-------------------------------------------------------------------------------------------------- pub fn matching_closing(char: u8) u8 { return switch (char) { '(' => ')', '[' => ']', '{' => '}', '<' => '>', else => '!', }; } //-------------------------------------------------------------------------------------------------- pub fn part1() anyerror!void { const file = std.fs.cwd().openFile("data/day10_input.txt", .{}) catch |err| label: { std.debug.print("unable to open file: {e}\n", .{err}); const stderr = std.io.getStdErr(); break :label stderr; }; defer file.close(); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); var allocator = arena.allocator(); var completion_scores = ArrayList(u64).init(allocator); completion_scores.deinit(); var num_error: u32 = 0; var num_incomplete: u32 = 0; var error_score: u32 = 0; { var reader = std.io.bufferedReader(file.reader()); var istream = reader.reader(); var buf: [128]u8 = undefined; var stack = ArrayList(u8).init(allocator); stack.deinit(); while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| { for (line) |char| { const is_opening = (char == '{') or (char == '[') or (char == '<') or (char == '('); if (is_opening) { try stack.append(char); } else { const len = stack.items.len; if (len == 0 or (matching_opening(char) != stack.items[len - 1])) { error_score += illegal_char_points(char); num_error += 1; break; } else { _ = stack.popOrNull(); } } // reached until eol without corruption } else { if (stack.items.len != 0) { // incomplete num_incomplete += 1; var score: u64 = 0; while (stack.popOrNull()) |opening| { score *= 5; score += completion_points(matching_closing(opening)); } try completion_scores.append(score); } } // for char stack.clearRetainingCapacity(); // line finished } //while line } std.sort.sort(u64, completion_scores.items, {}, comptime std.sort.asc(u64)); const part2_final = completion_scores.items[completion_scores.items.len / 2]; std.log.info("Part 1 score: {d}", .{error_score}); std.log.info("Part 2 score: {d}", .{part2_final}); } //-------------------------------------------------------------------------------------------------- pub fn main() anyerror!void { try part1(); } //--------------------------------------------------------------------------------------------------
src/day10.zig
const builtin = @import("builtin"); const std = @import("std"); const math = std.math; const assert = std.debug.assert; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w = zwin32.base; const d3d12 = zwin32.d3d12; const dml = zwin32.directml; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import("zd3d12"); const common = @import("common"); const c = common.c; const vm = common.vectormath; const GuiRenderer = common.GuiRenderer; const enable_dx_debug = @import("build_options").enable_dx_debug; pub export const D3D12SDKVersion: u32 = 4; pub export const D3D12SDKPath: [*:0]const u8 = ".\\d3d12\\"; const content_dir = @import("build_options").content_dir; const window_name = "zig-gamedev: DirectML convolution test"; const window_width = 1800; const window_height = 900; const image_size = 1024; const filter_tensor = [_][3][3]f16{ [3][3]f16{ [3]f16{ -2.0, -2.0, 0.0 }, [3]f16{ -2.0, 6.0, 0.0 }, [3]f16{ 0.0, 0.0, 0.0 }, }, [3][3]f16{ // edge detection [3]f16{ -1.0, -1.0, -1.0 }, [3]f16{ 0.0, 0.0, 0.0 }, [3]f16{ 1.0, 1.0, 1.0 }, }, [3][3]f16{ // edge detection 2 [3]f16{ -1.0, -1.0, -1.0 }, [3]f16{ -1.0, 8.0, -1.0 }, [3]f16{ -1.0, -1.0, -1.0 }, }, }; const OperatorState = struct { cop: *dml.ICompiledOperator, dtbl: *dml.IBindingTable, info: dml.BINDING_PROPERTIES, }; const DemoState = struct { grfx: zd3d12.GraphicsContext, gui: GuiRenderer, frame_stats: common.FrameStats, dml_device: *dml.IDevice1, conv_op_state: OperatorState, temp_buffer: ?zd3d12.ResourceHandle, persistent_buffer: ?zd3d12.ResourceHandle, input_buffer: zd3d12.ResourceHandle, input_buffer_srv: d3d12.CPU_DESCRIPTOR_HANDLE, filter_buffer: zd3d12.ResourceHandle, output_buffer: zd3d12.ResourceHandle, output_buffer_srv: d3d12.CPU_DESCRIPTOR_HANDLE, dml_cmd_recorder: *dml.ICommandRecorder, texture_to_buffer_pso: zd3d12.PipelineHandle, buffer_to_texture_pso: zd3d12.PipelineHandle, draw_texture_pso: zd3d12.PipelineHandle, image_texture: zd3d12.ResourceHandle, image_texture_srv: d3d12.CPU_DESCRIPTOR_HANDLE, image_texture_uav: d3d12.CPU_DESCRIPTOR_HANDLE, }; fn init(gpa_allocator: std.mem.Allocator) DemoState { const window = common.initWindow(gpa_allocator, window_name, window_width, window_height) catch unreachable; var arena_allocator_state = std.heap.ArenaAllocator.init(gpa_allocator); defer arena_allocator_state.deinit(); const arena_allocator = arena_allocator_state.allocator(); var grfx = zd3d12.GraphicsContext.init(gpa_allocator, window); const draw_texture_pso = blk: { var pso_desc = d3d12.GRAPHICS_PIPELINE_STATE_DESC.initDefault(); pso_desc.RTVFormats[0] = .R8G8B8A8_UNORM; pso_desc.NumRenderTargets = 1; pso_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = 0xf; pso_desc.PrimitiveTopologyType = .TRIANGLE; pso_desc.DepthStencilState.DepthEnable = w.FALSE; break :blk grfx.createGraphicsShaderPipeline( arena_allocator, &pso_desc, content_dir ++ "shaders/draw_texture.vs.cso", content_dir ++ "shaders/draw_texture.ps.cso", ); }; const texture_to_buffer_pso = grfx.createComputeShaderPipeline( arena_allocator, &d3d12.COMPUTE_PIPELINE_STATE_DESC.initDefault(), content_dir ++ "shaders/texture_to_buffer.cs.cso", ); const buffer_to_texture_pso = grfx.createComputeShaderPipeline( arena_allocator, &d3d12.COMPUTE_PIPELINE_STATE_DESC.initDefault(), content_dir ++ "shaders/buffer_to_texture.cs.cso", ); var dml_device: *dml.IDevice1 = undefined; hrPanicOnFail(dml.createDevice( @ptrCast(*d3d12.IDevice, grfx.device), if (enable_dx_debug) dml.CREATE_DEVICE_FLAG_DEBUG else dml.CREATE_DEVICE_FLAG_NONE, .FL_4_1, &dml.IID_IDevice1, @ptrCast(*?*anyopaque, &dml_device), )); const input_tensor_desc = dml.TENSOR_DESC{ .Type = .BUFFER, .Desc = &dml.BUFFER_TENSOR_DESC{ .DataType = .FLOAT16, .Flags = dml.TENSOR_FLAG_NONE, .DimensionCount = 4, .Sizes = &[_]u32{ 1, 1, image_size, image_size }, .Strides = &[_]u32{ image_size * image_size, image_size, image_size, 1 }, .TotalTensorSizeInBytes = image_size * image_size * @sizeOf(f16), .GuaranteedBaseOffsetAlignment = 256, }, }; const output_tensor_desc = dml.TENSOR_DESC{ .Type = .BUFFER, .Desc = &dml.BUFFER_TENSOR_DESC{ .DataType = .FLOAT16, .Flags = dml.TENSOR_FLAG_NONE, .DimensionCount = 4, .Sizes = &[_]u32{ 1, 1, image_size - 2, image_size - 2 }, .Strides = &[_]u32{ image_size * image_size, image_size, image_size, 1 }, .TotalTensorSizeInBytes = image_size * image_size * @sizeOf(f16), .GuaranteedBaseOffsetAlignment = 256, }, }; const filter_tensor_desc = dml.TENSOR_DESC{ .Type = .BUFFER, .Desc = &dml.BUFFER_TENSOR_DESC{ .DataType = .FLOAT16, .Flags = dml.TENSOR_FLAG_NONE, .DimensionCount = 4, .Sizes = &[_]u32{ 1, 1, 3, 3 }, .Strides = null, .TotalTensorSizeInBytes = std.mem.alignForward(filter_tensor.len * filter_tensor.len * @sizeOf(f16), 32), .GuaranteedBaseOffsetAlignment = 256, }, }; const conv_op = blk: { const desc = dml.OPERATOR_DESC{ .Type = .CONVOLUTION, .Desc = &dml.CONVOLUTION_OPERATOR_DESC{ .InputTensor = &input_tensor_desc, .FilterTensor = &filter_tensor_desc, .BiasTensor = null, .OutputTensor = &output_tensor_desc, .Mode = .CONVOLUTION, .Direction = .FORWARD, .DimensionCount = 2, .Strides = &[_]u32{ 1, 1 }, .Dilations = &[_]u32{ 1, 1 }, .StartPadding = &[_]u32{ 0, 0 }, .EndPadding = &[_]u32{ 0, 0 }, .OutputPadding = &[_]u32{ 0, 0 }, .GroupCount = 1, .FusedActivation = null, }, }; var op: *dml.IOperator = undefined; hrPanicOnFail(dml_device.CreateOperator(&desc, &dml.IID_IOperator, @ptrCast(*?*anyopaque, &op))); break :blk op; }; defer _ = conv_op.Release(); const conv_cop = blk: { var cop: *dml.ICompiledOperator = undefined; hrPanicOnFail(dml_device.CompileOperator( conv_op, dml.EXECUTION_FLAG_NONE, &dml.IID_ICompiledOperator, @ptrCast(*?*anyopaque, &cop), )); break :blk cop; }; const init_op = blk: { const operators = [_]*dml.ICompiledOperator{conv_cop}; var iop: *dml.IOperatorInitializer = undefined; hrPanicOnFail(dml_device.CreateOperatorInitializer( operators.len, &operators, &dml.IID_IOperatorInitializer, @ptrCast(*?*anyopaque, &iop), )); break :blk iop; }; defer _ = init_op.Release(); const conv_info = conv_cop.GetBindingProperties(); const init_info = init_op.GetBindingProperties(); const temp_resource_size: u64 = math.max(init_info.TemporaryResourceSize, conv_info.TemporaryResourceSize); const persistent_resource_size: u64 = conv_info.PersistentResourceSize; const temp_buffer = if (temp_resource_size > 0) grfx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &blk: { var desc = d3d12.RESOURCE_DESC.initBuffer(temp_resource_size); desc.Flags = d3d12.RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; break :blk desc; }, d3d12.RESOURCE_STATE_COMMON, null, ) catch |err| hrPanic(err) else null; const persistent_buffer = if (persistent_resource_size > 0) grfx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &blk: { var desc = d3d12.RESOURCE_DESC.initBuffer(persistent_resource_size); desc.Flags = d3d12.RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; break :blk desc; }, d3d12.RESOURCE_STATE_COMMON, null, ) catch |err| hrPanic(err) else null; const input_buffer = grfx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &blk: { var desc = d3d12.RESOURCE_DESC.initBuffer(image_size * image_size * @sizeOf(f16)); desc.Flags = d3d12.RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; break :blk desc; }, d3d12.RESOURCE_STATE_UNORDERED_ACCESS, null, ) catch |err| hrPanic(err); const input_buffer_srv = grfx.allocateCpuDescriptors(.CBV_SRV_UAV, 1); grfx.device.CreateShaderResourceView( grfx.lookupResource(input_buffer).?, &d3d12.SHADER_RESOURCE_VIEW_DESC.initTypedBuffer(.R16_FLOAT, 0, image_size * image_size), input_buffer_srv, ); const input_buffer_uav = grfx.allocateCpuDescriptors(.CBV_SRV_UAV, 1); grfx.device.CreateUnorderedAccessView( grfx.lookupResource(input_buffer).?, null, &d3d12.UNORDERED_ACCESS_VIEW_DESC.initTypedBuffer(.R16_FLOAT, 0, image_size * image_size, 0), input_buffer_uav, ); const filter_buffer = grfx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &blk: { var desc = d3d12.RESOURCE_DESC.initBuffer( std.mem.alignForward(filter_tensor.len * filter_tensor.len * @sizeOf(f16), 32), ); desc.Flags = d3d12.RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; break :blk desc; }, d3d12.RESOURCE_STATE_UNORDERED_ACCESS, null, ) catch |err| hrPanic(err); const output_buffer = grfx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &blk: { var desc = d3d12.RESOURCE_DESC.initBuffer(image_size * image_size * @sizeOf(f16)); desc.Flags = d3d12.RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; break :blk desc; }, d3d12.RESOURCE_STATE_UNORDERED_ACCESS, null, ) catch |err| hrPanic(err); const output_buffer_srv = grfx.allocateCpuDescriptors(.CBV_SRV_UAV, 1); grfx.device.CreateShaderResourceView( grfx.lookupResource(output_buffer).?, &d3d12.SHADER_RESOURCE_VIEW_DESC.initTypedBuffer(.R16_FLOAT, 0, image_size * image_size), output_buffer_srv, ); const dml_cmd_recorder = blk: { var dml_cmd_recorder: *dml.ICommandRecorder = undefined; hrPanicOnFail(dml_device.CreateCommandRecorder( &dml.IID_ICommandRecorder, @ptrCast(*?*anyopaque, &dml_cmd_recorder), )); break :blk dml_cmd_recorder; }; // // Begin frame to init/upload resources to the GPU. // grfx.beginFrame(); grfx.endFrame(); grfx.beginFrame(); var gui = GuiRenderer.init(arena_allocator, &grfx, 1, content_dir); const image_texture = grfx.createAndUploadTex2dFromFile( content_dir ++ "genart_0025_5.png", .{ .num_mip_levels = 1, .texture_flags = d3d12.RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, }, ) catch |err| hrPanic(err); const image_texture_srv = grfx.allocateCpuDescriptors(.CBV_SRV_UAV, 1); const image_texture_uav = grfx.allocateCpuDescriptors(.CBV_SRV_UAV, 1); grfx.device.CreateShaderResourceView(grfx.lookupResource(image_texture).?, null, image_texture_srv); grfx.device.CreateUnorderedAccessView(grfx.lookupResource(image_texture).?, null, null, image_texture_uav); grfx.addTransitionBarrier(image_texture, d3d12.RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); grfx.addTransitionBarrier(input_buffer, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.flushResourceBarriers(); grfx.setCurrentPipeline(texture_to_buffer_pso); grfx.cmdlist.SetComputeRootDescriptorTable(0, blk: { const table = grfx.copyDescriptorsToGpuHeap(1, image_texture_srv); _ = grfx.copyDescriptorsToGpuHeap(1, input_buffer_uav); break :blk table; }); grfx.cmdlist.Dispatch((image_size + 7) / 8, (image_size + 7) / 8, 1); grfx.addTransitionBarrier(image_texture, d3d12.RESOURCE_STATE_PIXEL_SHADER_RESOURCE); grfx.addTransitionBarrier(input_buffer, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.flushResourceBarriers(); const conv_op_state = blk: { const base_descriptor = grfx.allocateGpuDescriptors(conv_info.RequiredDescriptorCount); const desc = dml.BINDING_TABLE_DESC{ .Dispatchable = @ptrCast(*dml.IDispatchable, conv_cop), .CPUDescriptorHandle = base_descriptor.cpu_handle, .GPUDescriptorHandle = base_descriptor.gpu_handle, .SizeInDescriptors = conv_info.RequiredDescriptorCount, }; var table: *dml.IBindingTable = undefined; hrPanicOnFail(dml_device.CreateBindingTable(&desc, &dml.IID_IBindingTable, @ptrCast(*?*anyopaque, &table))); break :blk .{ .cop = conv_cop, .dtbl = table, .info = conv_info, }; }; const init_dtbl = blk: { const base_descriptor = grfx.allocateGpuDescriptors(init_info.RequiredDescriptorCount + 1); const desc = dml.BINDING_TABLE_DESC{ .Dispatchable = @ptrCast(*dml.IDispatchable, init_op), .CPUDescriptorHandle = base_descriptor.cpu_handle, .GPUDescriptorHandle = base_descriptor.gpu_handle, .SizeInDescriptors = init_info.RequiredDescriptorCount, }; var table: *dml.IBindingTable = undefined; hrPanicOnFail(dml_device.CreateBindingTable(&desc, &dml.IID_IBindingTable, @ptrCast(*?*anyopaque, &table))); break :blk table; }; defer _ = init_dtbl.Release(); if (temp_buffer != null and init_info.TemporaryResourceSize > 0) { init_dtbl.BindTemporaryResource(&.{ .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(temp_buffer.?).?, .Offset = 0, .SizeInBytes = init_info.TemporaryResourceSize, }, }); } if (persistent_buffer != null) { var offset: u64 = 0; const binding0 = if (conv_info.PersistentResourceSize == 0) dml.BINDING_DESC{ .Type = .NONE, .Desc = null, } else dml.BINDING_DESC{ .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(persistent_buffer.?).?, .Offset = offset, .SizeInBytes = conv_info.PersistentResourceSize, }, }; offset += conv_info.PersistentResourceSize; init_dtbl.BindOutputs(1, &[_]dml.BINDING_DESC{binding0}); } dml_cmd_recorder.RecordDispatch( @ptrCast(*d3d12.ICommandList, grfx.cmdlist), @ptrCast(*dml.IDispatchable, init_op), init_dtbl, ); grfx.endFrame(); grfx.finishGpuCommands(); return .{ .grfx = grfx, .gui = gui, .frame_stats = common.FrameStats.init(), .dml_device = dml_device, .conv_op_state = conv_op_state, .temp_buffer = temp_buffer, .persistent_buffer = persistent_buffer, .input_buffer = input_buffer, .input_buffer_srv = input_buffer_srv, .filter_buffer = filter_buffer, .output_buffer = output_buffer, .output_buffer_srv = output_buffer_srv, .dml_cmd_recorder = dml_cmd_recorder, .draw_texture_pso = draw_texture_pso, .texture_to_buffer_pso = texture_to_buffer_pso, .buffer_to_texture_pso = buffer_to_texture_pso, .image_texture = image_texture, .image_texture_srv = image_texture_srv, .image_texture_uav = image_texture_uav, }; } fn deinit(demo: *DemoState, gpa_allocator: std.mem.Allocator) void { demo.grfx.finishGpuCommands(); _ = demo.dml_cmd_recorder.Release(); _ = demo.conv_op_state.cop.Release(); _ = demo.conv_op_state.dtbl.Release(); _ = demo.dml_device.Release(); demo.gui.deinit(&demo.grfx); demo.grfx.deinit(gpa_allocator); common.deinitWindow(gpa_allocator); demo.* = undefined; } fn update(demo: *DemoState) void { demo.frame_stats.update(demo.grfx.window, window_name); common.newImGuiFrame(demo.frame_stats.delta_time); } fn dispatchConvOperator(demo: *DemoState) void { var grfx = &demo.grfx; // Reset DML binding table. { const num_descriptors = demo.conv_op_state.info.RequiredDescriptorCount; const base_descriptor = grfx.allocateGpuDescriptors(num_descriptors); hrPanicOnFail(demo.conv_op_state.dtbl.Reset(&dml.BINDING_TABLE_DESC{ .Dispatchable = @ptrCast(*dml.IDispatchable, demo.conv_op_state.cop), .CPUDescriptorHandle = base_descriptor.cpu_handle, .GPUDescriptorHandle = base_descriptor.gpu_handle, .SizeInDescriptors = num_descriptors, })); } // If necessary, bind temporary buffer. if (demo.temp_buffer != null and demo.conv_op_state.info.TemporaryResourceSize > 0) { demo.conv_op_state.dtbl.BindTemporaryResource(&.{ .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(demo.temp_buffer.?).?, .Offset = 0, .SizeInBytes = demo.conv_op_state.info.TemporaryResourceSize, }, }); } // If necessary, bind persistent buffer. if (demo.persistent_buffer != null and demo.conv_op_state.info.PersistentResourceSize > 0) { demo.conv_op_state.dtbl.BindPersistentResource(&.{ .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(demo.persistent_buffer.?).?, .Offset = 0, .SizeInBytes = demo.conv_op_state.info.PersistentResourceSize, }, }); } // Bind input buffers. demo.conv_op_state.dtbl.BindInputs(3, &[_]dml.BINDING_DESC{ .{ // InputTensor .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(demo.input_buffer).?, .Offset = 0, .SizeInBytes = grfx.getResourceSize(demo.input_buffer), }, }, .{ // FilterTensor .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(demo.filter_buffer).?, .Offset = 0, .SizeInBytes = grfx.getResourceSize(demo.filter_buffer), }, }, .{ // BiasTensor .Type = .NONE, .Desc = null, }, }); // Bind output buffer. demo.conv_op_state.dtbl.BindOutputs(1, &[_]dml.BINDING_DESC{.{ .Type = .BUFFER, .Desc = &dml.BUFFER_BINDING{ .Buffer = grfx.lookupResource(demo.output_buffer).?, .Offset = 0, .SizeInBytes = grfx.getResourceSize(demo.output_buffer), }, }}); demo.dml_cmd_recorder.RecordDispatch( @ptrCast(*d3d12.ICommandList, grfx.cmdlist), @ptrCast(*dml.IDispatchable, demo.conv_op_state.cop), demo.conv_op_state.dtbl, ); } fn dispatchBarriers(demo: *DemoState) void { var grfx = &demo.grfx; grfx.cmdlist.ResourceBarrier( 2, &[_]d3d12.RESOURCE_BARRIER{ d3d12.RESOURCE_BARRIER.initUav(grfx.lookupResource(demo.input_buffer).?), d3d12.RESOURCE_BARRIER.initUav(grfx.lookupResource(demo.output_buffer).?), }, ); } fn draw(demo: *DemoState) void { var grfx = &demo.grfx; grfx.beginFrame(); const back_buffer = grfx.getBackBuffer(); grfx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_RENDER_TARGET); grfx.addTransitionBarrier(demo.filter_buffer, d3d12.RESOURCE_STATE_COPY_DEST); grfx.flushResourceBarriers(); // Upload the input tensor to the GPU. { const upload = grfx.allocateUploadBufferRegion(f16, 9); const kernel_index = 0; upload.cpu_slice[0] = filter_tensor[kernel_index][0][0]; upload.cpu_slice[1] = filter_tensor[kernel_index][0][1]; upload.cpu_slice[2] = filter_tensor[kernel_index][0][2]; upload.cpu_slice[3] = filter_tensor[kernel_index][1][0]; upload.cpu_slice[4] = filter_tensor[kernel_index][1][1]; upload.cpu_slice[5] = filter_tensor[kernel_index][1][2]; upload.cpu_slice[6] = filter_tensor[kernel_index][2][0]; upload.cpu_slice[7] = filter_tensor[kernel_index][2][1]; upload.cpu_slice[8] = filter_tensor[kernel_index][2][2]; grfx.cmdlist.CopyBufferRegion( grfx.lookupResource(demo.filter_buffer).?, 0, upload.buffer, upload.buffer_offset, upload.cpu_slice.len * @sizeOf(@TypeOf(upload.cpu_slice[0])), ); } grfx.addTransitionBarrier(demo.input_buffer, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.addTransitionBarrier(demo.filter_buffer, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.addTransitionBarrier(demo.output_buffer, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.flushResourceBarriers(); dispatchConvOperator(demo); dispatchBarriers(demo); grfx.cmdlist.OMSetRenderTargets( 1, &[_]d3d12.CPU_DESCRIPTOR_HANDLE{back_buffer.descriptor_handle}, w.TRUE, null, ); grfx.cmdlist.ClearRenderTargetView( back_buffer.descriptor_handle, &[4]f32{ 0.1, 0.2, 0.4, 1.0 }, 0, null, ); // // Draw input buffer. // grfx.addTransitionBarrier(demo.input_buffer, d3d12.RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); grfx.addTransitionBarrier(demo.image_texture, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.flushResourceBarriers(); grfx.setCurrentPipeline(demo.buffer_to_texture_pso); grfx.cmdlist.SetComputeRootDescriptorTable(0, blk: { const table = grfx.copyDescriptorsToGpuHeap(1, demo.input_buffer_srv); _ = grfx.copyDescriptorsToGpuHeap(1, demo.image_texture_uav); break :blk table; }); grfx.cmdlist.Dispatch((image_size + 7) / 8, (image_size + 7) / 8, 1); grfx.addTransitionBarrier(demo.image_texture, d3d12.RESOURCE_STATE_PIXEL_SHADER_RESOURCE); grfx.flushResourceBarriers(); grfx.cmdlist.RSSetViewports(1, &[_]d3d12.VIEWPORT{.{ .TopLeftX = 0.0, .TopLeftY = 0.0, .Width = @intToFloat(f32, grfx.viewport_width / 2), .Height = @intToFloat(f32, grfx.viewport_width / 2), .MinDepth = 0.0, .MaxDepth = 1.0, }}); grfx.setCurrentPipeline(demo.draw_texture_pso); grfx.cmdlist.IASetPrimitiveTopology(.TRIANGLELIST); grfx.cmdlist.SetGraphicsRootDescriptorTable(0, grfx.copyDescriptorsToGpuHeap(1, demo.image_texture_srv)); grfx.cmdlist.DrawInstanced(3, 1, 0, 0); // // Draw output buffer. // grfx.addTransitionBarrier(demo.output_buffer, d3d12.RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); grfx.addTransitionBarrier(demo.image_texture, d3d12.RESOURCE_STATE_UNORDERED_ACCESS); grfx.flushResourceBarriers(); grfx.setCurrentPipeline(demo.buffer_to_texture_pso); grfx.cmdlist.SetComputeRootDescriptorTable(0, blk: { const table = grfx.copyDescriptorsToGpuHeap(1, demo.output_buffer_srv); _ = grfx.copyDescriptorsToGpuHeap(1, demo.image_texture_uav); break :blk table; }); grfx.cmdlist.Dispatch((image_size + 7) / 8, (image_size + 7) / 8, 1); grfx.addTransitionBarrier(demo.image_texture, d3d12.RESOURCE_STATE_PIXEL_SHADER_RESOURCE); grfx.flushResourceBarriers(); grfx.cmdlist.RSSetViewports(1, &[_]d3d12.VIEWPORT{.{ .TopLeftX = @intToFloat(f32, grfx.viewport_width / 2), .TopLeftY = 0.0, .Width = @intToFloat(f32, grfx.viewport_width / 2), .Height = @intToFloat(f32, grfx.viewport_width / 2), .MinDepth = 0.0, .MaxDepth = 1.0, }}); grfx.setCurrentPipeline(demo.draw_texture_pso); grfx.cmdlist.IASetPrimitiveTopology(.TRIANGLELIST); grfx.cmdlist.SetGraphicsRootDescriptorTable(0, grfx.copyDescriptorsToGpuHeap(1, demo.image_texture_srv)); grfx.cmdlist.DrawInstanced(3, 1, 0, 0); demo.gui.draw(grfx); grfx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_PRESENT); grfx.flushResourceBarriers(); grfx.endFrame(); } pub fn main() !void { common.init(); defer common.deinit(); var gpa_allocator_state = std.heap.GeneralPurposeAllocator(.{}){}; defer { const leaked = gpa_allocator_state.deinit(); std.debug.assert(leaked == false); } const gpa_allocator = gpa_allocator_state.allocator(); var demo = init(gpa_allocator); defer deinit(&demo, gpa_allocator); while (true) { var message = std.mem.zeroes(w.user32.MSG); const has_message = w.user32.peekMessageA(&message, null, 0, 0, w.user32.PM_REMOVE) catch false; if (has_message) { _ = w.user32.translateMessage(&message); _ = w.user32.dispatchMessageA(&message); if (message.message == w.user32.WM_QUIT) { break; } } else { update(&demo); draw(&demo); } } }
samples/directml_convolution_test/src/directml_convolution_test.zig
const std = @import("std"); /// default EntityTraitsDefinition with reasonable sizes suitable for most situations pub const EntityTraits = EntityTraitsType(.medium); pub const EntityTraitsSize = enum { small, medium, large }; pub fn EntityTraitsType(comptime size: EntityTraitsSize) type { return switch (size) { .small => EntityTraitsDefinition(u16, u12, u4), .medium => EntityTraitsDefinition(u32, u20, u12), .large => EntityTraitsDefinition(u64, u32, u32), }; } fn EntityTraitsDefinition(comptime EntityType: type, comptime IndexType: type, comptime VersionType: type) type { std.debug.assert(@typeInfo(EntityType) == .Int and std.meta.Int(.unsigned, @bitSizeOf(EntityType)) == EntityType); std.debug.assert(@typeInfo(IndexType) == .Int and std.meta.Int(.unsigned, @bitSizeOf(IndexType)) == IndexType); std.debug.assert(@typeInfo(VersionType) == .Int and std.meta.Int(.unsigned, @bitSizeOf(VersionType)) == VersionType); if (@bitSizeOf(IndexType) + @bitSizeOf(VersionType) != @bitSizeOf(EntityType)) @compileError("IndexType and VersionType must sum to EntityType's bit count"); return struct { entity_type: type = EntityType, index_type: type = IndexType, version_type: type = VersionType, /// Mask to use to get the entity index number out of an identifier entity_mask: EntityType = std.math.maxInt(IndexType), /// Mask to use to get the version out of an identifier version_mask: EntityType = std.math.maxInt(VersionType), pub fn init() @This() { return @This(){}; } }; } test "entity traits" { const sm = EntityTraitsType(.small).init(); const m = EntityTraitsType(.medium).init(); const l = EntityTraitsType(.large).init(); std.testing.expectEqual(sm.entity_mask, std.math.maxInt(sm.index_type)); std.testing.expectEqual(m.entity_mask, std.math.maxInt(m.index_type)); std.testing.expectEqual(l.entity_mask, std.math.maxInt(l.index_type)); }
src/ecs/ecs/entity.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); pub const main = tools.defaultMain("2021/day02.txt", run); pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { const Vec2 = @Vector(2, i32); const ans1 = ans: { var pos = Vec2{ 0, 0 }; var it = std.mem.tokenize(u8, input, "\n\r"); while (it.next()) |line| { var delta = Vec2{ 0, 0 }; if (tools.match_pattern("forward {}", line)) |val| { delta[0] = @intCast(i32, val[0].imm); } else if (tools.match_pattern("down {}", line)) |val| { delta[1] = @intCast(i32, val[0].imm); } else if (tools.match_pattern("up {}", line)) |val| { delta[1] = @intCast(i32, -val[0].imm); } else { std.debug.print("skipping {s}\n", .{line}); } pos += delta; } break :ans @reduce(.Mul, pos); }; const ans2 = ans: { var pos = Vec2{ 0, 0 }; var aim: i32 = 0; var it = std.mem.tokenize(u8, input, "\n\r"); while (it.next()) |line| { if (tools.match_pattern("forward {}", line)) |val| { const x = @intCast(i32, val[0].imm); pos += Vec2{ x, x * aim }; } else if (tools.match_pattern("down {}", line)) |val| { aim += @intCast(i32, val[0].imm); } else if (tools.match_pattern("up {}", line)) |val| { aim -= @intCast(i32, val[0].imm); } else { std.debug.print("skipping {s}\n", .{line}); } } break :ans @reduce(.Mul, pos); }; return [_][]const u8{ try std.fmt.allocPrint(allocator, "{}", .{ans1}), try std.fmt.allocPrint(allocator, "{}", .{ans2}), }; } test { const res = try run( \\forward 5 \\down 5 \\forward 8 \\up 3 \\down 8 \\forward 2 , std.testing.allocator); defer std.testing.allocator.free(res[0]); defer std.testing.allocator.free(res[1]); try std.testing.expectEqualStrings("150", res[0]); try std.testing.expectEqualStrings("900", res[1]); }
2021/day02.zig
const std = @import("std"); const math = std.math; const common = @import("common.zig"); const BiasedFp = common.BiasedFp; const Decimal = @import("decimal.zig").Decimal; const mantissaType = common.mantissaType; const max_shift = 60; const num_powers = 19; const powers = [_]u8{ 0, 3, 6, 9, 13, 16, 19, 23, 26, 29, 33, 36, 39, 43, 46, 49, 53, 56, 59 }; pub fn getShift(n: usize) usize { return if (n < num_powers) powers[n] else max_shift; } /// Parse the significant digits and biased, binary exponent of a float. /// /// This is a fallback algorithm that uses a big-integer representation /// of the float, and therefore is considerably slower than faster /// approximations. However, it will always determine how to round /// the significant digits to the nearest machine float, allowing /// use to handle near half-way cases. /// /// Near half-way cases are halfway between two consecutive machine floats. /// For example, the float `16777217.0` has a bitwise representation of /// `100000000000000000000000 1`. Rounding to a single-precision float, /// the trailing `1` is truncated. Using round-nearest, tie-even, any /// value above `16777217.0` must be rounded up to `16777218.0`, while /// any value before or equal to `16777217.0` must be rounded down /// to `16777216.0`. These near-halfway conversions therefore may require /// a large number of digits to unambiguously determine how to round. /// /// The algorithms described here are based on "Processing Long Numbers Quickly", /// available here: <https://arxiv.org/pdf/2101.11408.pdf#section.11>. pub fn convertSlow(comptime T: type, s: []const u8) BiasedFp(T) { const MantissaT = mantissaType(T); const min_exponent = -(1 << (math.floatExponentBits(T) - 1)) + 1; const infinite_power = (1 << math.floatExponentBits(T)) - 1; const mantissa_explicit_bits = math.floatMantissaBits(T); var d = Decimal(T).parse(s); // no need to recheck underscores if (d.num_digits == 0 or d.decimal_point < Decimal(T).min_exponent) { return BiasedFp(T).zero(); } else if (d.decimal_point >= Decimal(T).max_exponent) { return BiasedFp(T).inf(T); } var exp2: i32 = 0; // Shift right toward (1/2 .. 1] while (d.decimal_point > 0) { const n = @intCast(usize, d.decimal_point); const shift = getShift(n); d.rightShift(shift); if (d.decimal_point < -Decimal(T).decimal_point_range) { return BiasedFp(T).zero(); } exp2 += @intCast(i32, shift); } // Shift left toward (1/2 .. 1] while (d.decimal_point <= 0) { const shift = blk: { if (d.decimal_point == 0) { break :blk switch (d.digits[0]) { 5...9 => break, 0, 1 => @as(usize, 2), else => 1, }; } else { const n = @intCast(usize, -d.decimal_point); break :blk getShift(n); } }; d.leftShift(shift); if (d.decimal_point > Decimal(T).decimal_point_range) { return BiasedFp(T).inf(T); } exp2 -= @intCast(i32, shift); } // We are now in the range [1/2 .. 1] but the binary format uses [1 .. 2] exp2 -= 1; while (min_exponent + 1 > exp2) { var n = @intCast(usize, (min_exponent + 1) - exp2); if (n > max_shift) { n = max_shift; } d.rightShift(n); exp2 += @intCast(i32, n); } if (exp2 - min_exponent >= infinite_power) { return BiasedFp(T).inf(T); } // Shift the decimal to the hidden bit, and then round the value // to get the high mantissa+1 bits. d.leftShift(mantissa_explicit_bits + 1); var mantissa = d.round(); if (mantissa >= (@as(MantissaT, 1) << (mantissa_explicit_bits + 1))) { // Rounding up overflowed to the carry bit, need to // shift back to the hidden bit. d.rightShift(1); exp2 += 1; mantissa = d.round(); if ((exp2 - min_exponent) >= infinite_power) { return BiasedFp(T).inf(T); } } var power2 = exp2 - min_exponent; if (mantissa < (@as(MantissaT, 1) << mantissa_explicit_bits)) { power2 -= 1; } // Zero out all the bits above the explicit mantissa bits. mantissa &= (@as(MantissaT, 1) << mantissa_explicit_bits) - 1; return .{ .f = mantissa, .e = power2 }; }
lib/std/fmt/parse_float/convert_slow.zig
const std = @import("std"); var a: *std.mem.Allocator = undefined; const stdout = std.io.getStdOut().writer(); //prepare stdout to write in // byr (Birth Year) // iyr (Issue Year) // eyr (Expiration Year) // hgt (Height) // hcl (Hair Color) // ecl (Eye Color) // pid (Passport ID) // cid (Country ID) (Optional) test "short input" { const input = \\ecl:gry pid:860033327 eyr:2020 hcl:#fffffd \\byr:1937 iyr:2017 cid:147 hgt:183cm \\ \\iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 \\hcl:#cfa07d byr:1929 \\ \\hcl:#ae17e1 iyr:2013 \\eyr:2024 \\ecl:brn pid:760753108 byr:1931 \\hgt:179cm \\ \\hcl:#cfa07d eyr:2025 pid:166559648 \\iyr:2011 ecl:brn hgt:59in ; var buf = input.*; std.testing.expect(run(&buf) == 2); } fn run(input: [:0]u8) u16 { var all_lines_it = std.mem.split(input, "\n"); var valid_passwords: u16 = 0; var correct_fields: std.meta.Vector(7, bool) = [_]bool{false} ** 7; // Vectors allows SIMD reduce. while (all_lines_it.next()) |line| { if (line.len == 0) { if (@reduce(.And, correct_fields)) { // This allows an attacker to specify fields multiple times. Not an attack surface. valid_passwords += 1; } correct_fields = [_]bool{false} ** 7; } else { var tokenizer = std.mem.tokenize(line, " "); while (tokenizer.next()) |token| { if (token.len < 4) { // Don't crash on malformed input break; } if (token[3] != ':') { break; } const _type = token[0..3]; //const value = token[4..]; // no need to parse this for now if (std.mem.eql(u8, _type, "byr")) { correct_fields[0] = true; } else if (std.mem.eql(u8, _type, "iyr")) { correct_fields[1] = true; } else if (std.mem.eql(u8, _type, "eyr")) { correct_fields[2] = true; } else if (std.mem.eql(u8, _type, "hgt")) { correct_fields[3] = true; } else if (std.mem.eql(u8, _type, "hcl")) { correct_fields[4] = true; } else if (std.mem.eql(u8, _type, "ecl")) { correct_fields[5] = true; } else if (std.mem.eql(u8, _type, "pid")) { correct_fields[6] = true; } // we don't fail on extra fields, as some passports might have them; } } } if (@reduce(.And, correct_fields)) { valid_passwords += 1; } return valid_passwords; } pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); // create memory allocator for strings defer arena.deinit(); // clear memory var arg_it = std.process.args(); _ = arg_it.skip(); // skip over exe name a = &arena.allocator; // get ref to allocator const input: [:0]u8 = try (arg_it.next(a)).?; // get the first argument const start: i128 = std.time.nanoTimestamp(); // start time const answer = run(input); // compute answer const elapsed_nano: f128 = @intToFloat(f128, std.time.nanoTimestamp() - start); const elapsed_milli: f64 = @floatCast(f64, @divFloor(elapsed_nano, 1_000_000)); try stdout.print("_duration:{d}\n{}\n", .{ elapsed_milli, answer }); // emit actual lines parsed by AOC }
day-04/part-1/lelithium.zig
const std = @import("std"); const os = std.os; const Logger = @import("logger.zig").Logger; const helpers = @import("helpers.zig"); const util = @import("util.zig"); const supervisors = @import("supervisor.zig"); const thread_commands = @import("thread_commands.zig"); const superviseProcess = supervisors.superviseProcess; const SupervisorContext = supervisors.SupervisorContext; const killService = thread_commands.killService; const KillServiceContext = thread_commands.KillServiceContext; const WatchServiceContext = thread_commands.WatchServiceContext; const watchService = thread_commands.watchService; const HeapRc = @import("rc.zig").HeapRc; const Client = @import("client.zig").Client; pub const RcClient = HeapRc(Client); pub const FdList = std.ArrayList(std.os.fd_t); pub const ServiceStateType = enum(u8) { NotRunning, Running, Restarting, Stopped, }; pub const RunningState = struct { pid: std.os.pid_t, /// File desctiptor for stdout stdout: std.os.fd_t, stderr: std.os.fd_t, /// File desctiptor for the thread that reads from stdout and writes it /// to a logfile logger_thread: std.os.fd_t, }; pub const ServiceState = union(ServiceStateType) { NotRunning: void, Running: RunningState, Restarting: struct { exit_code: u32, clock_ns: u64, sleep_ns: u64 }, Stopped: u32, }; pub const Service = struct { name: []const u8, cmdline: []const u8, state: ServiceState = ServiceState{ .NotRunning = {} }, stop_flag: bool = false, /// List of file descriptors for clients that want to /// have logs of the service fanned out to them. logger_client_fds: FdList, pub fn addLoggerClient(self: *@This(), fd: std.os.fd_t) !void { try self.logger_client_fds.append(fd); } pub fn removeLoggerClient(self: *@This(), client_fd: std.os.fd_t) void { for (self.logger_client_fds.items) |fd, idx| { if (fd == client_fd) { const fd_at_idx = self.logger_client_fds.orderedRemove(idx); std.debug.assert(fd_at_idx == client_fd); break; } } } }; pub const ServiceMap = std.StringHashMap(*Service); pub const FileLogger = Logger(std.fs.File.OutStream); pub const MessageOP = enum(u8) { ServiceStarted, ServiceExited, ServiceRestarting, }; pub const Message = union(MessageOP) { ServiceStarted: struct { name: []const u8, pid: std.os.pid_t, stdout: std.fs.File, stderr: std.fs.File, logger_thread: std.os.fd_t, }, ServiceExited: struct { name: []const u8, exit_code: u32, }, ServiceRestarting: struct { name: []const u8, exit_code: u32, clock_ts_ns: u64, sleep_ns: u64, }, }; pub const ServiceDecl = struct { name: []const u8, cmdline: []const u8, }; const BufferType = std.io.FixedBufferStream([]const u8); const FileInStream = std.io.InStream(std.fs.File, std.os.ReadError, std.fs.File.read); const FileOutStream = std.io.OutStream(std.fs.File, std.os.WriteError, std.fs.File.write); pub const MsgSerializer = std.io.Serializer( .Little, .Byte, FileOutStream, ); pub const MsgDeserializer = std.io.Deserializer( .Little, .Byte, FileInStream, ); // Caller owns the returned memory. fn deserializeSlice( allocator: *std.mem.Allocator, deserializer: anytype, comptime T: type, size: usize, ) ![]T { var value = try allocator.alloc(T, size); var i: usize = 0; while (i < size) : (i += 1) { value[i] = try deserializer.deserialize(T); } return value; } fn deserializeString(allocator: *std.mem.Allocator, deserializer: anytype) ![]u8 { const string_length = try deserializer.deserialize(u32); std.debug.assert(string_length > 0); var result = try deserializeSlice(allocator, deserializer, u8, string_length); std.debug.assert(result.len == string_length); return result; } fn serializeString(serializer: anytype, string: []const u8) !void { try serializer.serialize(@intCast(u32, string.len)); for (string) |byte| { try serializer.serialize(byte); } } pub const ClientMap = std.AutoHashMap(std.os.fd_t, *RcClient); pub const DaemonState = struct { allocator: *std.mem.Allocator, services: ServiceMap, clients: ClientMap, logger: *FileLogger, status_pipe: [2]std.os.fd_t, pub fn init(allocator: *std.mem.Allocator, logger: *FileLogger) !@This() { return DaemonState{ .allocator = allocator, .services = ServiceMap.init(allocator), .clients = ClientMap.init(allocator), .logger = logger, .status_pipe = try std.os.pipe(), }; } pub fn deinit() void { self.services.deinit(); } pub fn pushMessage(self: *@This(), message: Message) !void { var file = std.fs.File{ .handle = self.status_pipe[1] }; var stream = file.outStream(); var serializer = MsgSerializer.init(stream); const opcode = @enumToInt(@as(MessageOP, message)); try serializer.serialize(opcode); switch (message) { .ServiceStarted => |data| { try serializeString(&serializer, data.name); try serializer.serialize(data.pid); try serializer.serialize(data.stdout.handle); try serializer.serialize(data.stderr.handle); try serializer.serialize(data.logger_thread); }, .ServiceExited => |data| { try serializeString(&serializer, data.name); try serializer.serialize(data.exit_code); }, .ServiceRestarting => |data| { try serializeString(&serializer, data.name); try serializer.serialize(data.exit_code); try serializer.serialize(data.clock_ts_ns); try serializer.serialize(data.sleep_ns); }, } } fn writeService( self: @This(), stream: anytype, key: []const u8, service: *Service, ) !void { try stream.print("{},", .{key}); const state_string = switch (service.state) { .NotRunning => try stream.print("0", .{}), .Running => |data| try stream.print("1,{}", .{data.pid}), .Stopped => |code| try stream.print("2,{}", .{code}), .Restarting => |data| { // show remaining amount of ns until service restarts fully const current_clock = @intCast(i64, util.monotonicRead()); const end_ts_ns = @intCast(i64, data.clock_ns + data.sleep_ns); const remaining_ns = current_clock - end_ts_ns; try stream.print("3,{},{}", .{ data.exit_code, remaining_ns }); }, }; try stream.print(";", .{}); } pub fn writeServices(self: @This(), stream: anytype) !void { var services_it = self.services.iterator(); while (services_it.next()) |kv| { try self.writeService(stream, kv.key, kv.value); } _ = try stream.write("!"); } pub fn addService(self: *@This(), name: []const u8, service: *Service) !void { _ = try self.services.put( name, service, ); } pub fn addClient(self: *@This(), fd: std.os.fd_t, client: *RcClient) !void { std.debug.warn("add client fd={} ptr={x}\n", .{ fd, @ptrToInt(client.ptr.?) }); _ = try self.clients.put(fd, client); } fn readStatusMessage(self: *@This()) !void { var statusFile = std.fs.File{ .handle = self.status_pipe[0] }; var stream = statusFile.inStream(); var deserializer = MsgDeserializer.init(stream); const opcode = try deserializer.deserialize(u8); switch (@intToEnum(MessageOP, opcode)) { .ServiceStarted => { const service_name = try deserializeString(self.allocator, &deserializer); defer self.allocator.free(service_name); const pid = try deserializer.deserialize(std.os.pid_t); const stdout = try deserializer.deserialize(std.os.fd_t); const stderr = try deserializer.deserialize(std.os.fd_t); const logger_thread = try deserializer.deserialize(std.os.fd_t); self.logger.info( "serivce {} started on pid {} stdout={} stderr={}", .{ service_name, pid, stdout, stderr }, ); self.services.get(service_name).?.state = ServiceState{ .Running = RunningState{ .pid = pid, .stdout = stdout, .stderr = stderr, .logger_thread = logger_thread, }, }; }, .ServiceExited => { const service_name = try deserializeString(self.allocator, &deserializer); defer self.allocator.free(service_name); const exit_code = try deserializer.deserialize(u32); self.logger.info("serivce {} exited with status {}", .{ service_name, exit_code }); self.services.get(service_name).?.state = ServiceState{ .Stopped = exit_code }; }, .ServiceRestarting => { const service_name = try deserializeString(self.allocator, &deserializer); defer self.allocator.free(service_name); const exit_code = try deserializer.deserialize(u32); const clock_ns = try deserializer.deserialize(u64); const sleep_ns = try deserializer.deserialize(u64); self.logger.info("serivce {} restarting, will be back in {}ns", .{ service_name, sleep_ns }); self.services.get(service_name).?.state = ServiceState{ .Restarting = .{ .exit_code = exit_code, .clock_ns = clock_ns, .sleep_ns = sleep_ns, }, }; }, } } pub fn handleMessages(self: *@This()) !void { var sockets = PollFdList.init(self.allocator); defer sockets.deinit(); try sockets.append(os.pollfd{ .fd = self.status_pipe[0], .events = os.POLLIN, .revents = 0, }); while (true) { const available = try os.poll(sockets.items, -1); if (available == 0) { self.logger.info("timed out, retrying", .{}); continue; } for (sockets.items) |pollfd, idx| { if (pollfd.revents == 0) continue; if (pollfd.fd == self.status_pipe[0]) { // got status data to read self.readStatusMessage() catch |err| { self.logger.info("Failed to read status message: {}", .{err}); }; } } } } }; pub const OutStream = std.io.OutStream(std.fs.File, std.fs.File.WriteError, std.fs.File.write); fn readManyFromClient( state: *DaemonState, pollfd: os.pollfd, ) !void { var logger = state.logger; var allocator = state.allocator; var sock = std.fs.File{ .handle = pollfd.fd }; var in_stream = sock.inStream(); var stream: OutStream = sock.outStream(); var client: *RcClient = undefined; // reuse allocated RcClient in state, and if it doesnt exist, create // a new client. var client_opt = state.clients.get(pollfd.fd); if (client_opt) |client_from_map| { client = client_from_map; } else { // freeing of the RcClient and Client wrapped struct is done // by themselves. memory of this is managed via refcounting client = try RcClient.init(allocator); client.ptr.?.* = Client.init(pollfd.fd); // increment reference (for the main thread) _ = client.incRef(); // link fd to client inside state try state.addClient(pollfd.fd, client); } const message = try in_stream.readUntilDelimiterAlloc(allocator, '!', 512); errdefer allocator.free(message); logger.info("got msg from fd {}, {} '{}'", .{ sock.handle, message.len, message }); if (message.len == 0) { return error.Closed; } if (std.mem.eql(u8, message, "list")) { try state.writeServices(stream); } else if (std.mem.startsWith(u8, message, "start")) { var parts_it = std.mem.split(message, ";"); _ = parts_it.next(); // TODO: error handling on malformed messages const service_name = parts_it.next().?; var service_opt = state.services.get(service_name); if (service_opt) |service| { // start existing service service.stop_flag = false; // XXX: we just need to start the supervisor thread again // and point the service in memory to it // XXX: refactor the supervisor to follow the pattern of other // threaded commands. it should be easier to manage. also // use Service instead of ServiceDecl. we should // remove ServiceDecl const supervisor_thread = try std.Thread.spawn( SupervisorContext{ .state = state, .service = service }, superviseProcess, ); std.time.sleep(250 * std.time.ns_per_ms); try state.writeServices(stream); return; } // TODO maybe some refcounting magic could go here const service_cmdline = parts_it.next() orelse { try stream.print("err path needed for new service!", .{}); return; }; logger.info("got service start: {} {}", .{ service_name, service_cmdline }); var service = try allocator.create(Service); service.* = Service{ .name = service_name, .cmdline = service_cmdline, .logger_client_fds = FdList.init(state.allocator), }; logger.info("starting service {} with cmdline {}", .{ service_name, service_cmdline }); // the supervisor thread actually waits on the process in a loop // so that we can do things like exponential backoff, etc. const supervisor_thread = try std.Thread.spawn( SupervisorContext{ .state = state, .service = service }, superviseProcess, ); try state.addService(service_name, service); // TODO: remove this, make starting itself run in a thread. std.time.sleep(250 * std.time.ns_per_ms); try state.writeServices(stream); } else if (std.mem.startsWith(u8, message, "service")) { var parts_it = std.mem.split(message, ";"); _ = parts_it.next(); // TODO: error handling on malformed messages const service_name = parts_it.next().?; const service_opt = state.services.get(service_name); if (service_opt) |service| { try state.writeService(stream, service_name, service); try stream.print("!", .{}); } else { try stream.print("err unknown service!", .{}); } } else if (std.mem.startsWith(u8, message, "stop")) { var parts_it = std.mem.split(message, ";"); _ = parts_it.next(); // TODO: error handling on malformed messages const service_name = parts_it.next().?; const service_opt = state.services.get(service_name); if (service_opt) |service| { service.stop_flag = true; switch (service.state) { .Running => {}, else => { try stream.print("err service not running!", .{}); return; }, } _ = try std.Thread.spawn( KillServiceContext{ .state = state, .service = service, .client = client.incRef(), }, killService, ); } else { try stream.print("err unknown service!", .{}); } } else if (std.mem.startsWith(u8, message, "logs")) { var parts_it = std.mem.split(message, ";"); _ = parts_it.next(); // TODO: error handling on malformed messages const service_name = parts_it.next().?; const service_opt = state.services.get(service_name); if (service_opt) |service| { switch (service.state) { .Running => {}, else => { try stream.print("err service not running!", .{}); return; }, } _ = try std.Thread.spawn( WatchServiceContext{ .state = state, .service = service, .client = client.incRef(), }, watchService, ); } else { try stream.print("err unknown service!", .{}); } } } const PollFdList = std.ArrayList(os.pollfd); fn sigemptyset(set: *std.os.sigset_t) void { for (set) |*val| { val.* = 0; } } fn readFromSignalFd(allocator: *std.mem.Allocator, logger: *FileLogger, signal_fd: std.os.fd_t) !void { var buf: [@sizeOf(os.linux.signalfd_siginfo)]u8 align(8) = undefined; _ = try os.read(signal_fd, &buf); var siginfo = @ptrCast(*os.linux.signalfd_siginfo, @alignCast( @alignOf(*os.linux.signalfd_siginfo), &buf, )); var sig = siginfo.signo; if (sig != os.SIGINT and sig != os.SIGTERM) { logger.info("got signal {}, not INT ({}) or TERM ({}), ignoring", .{ sig, os.SIGINT, os.SIGTERM, }); return; } logger.info("got SIGINT or SIGTERM, stopping!", .{}); // TODO: stop all services one by one const pidpath = try helpers.getPathFor(allocator, .Pid); const sockpath = try helpers.getPathFor(allocator, .Sock); std.os.unlink(pidpath) catch |err| { logger.info("failed to delete pid file: {}", .{err}); }; std.os.unlink(sockpath) catch |err| { logger.info("failed to delete sock file: {}", .{err}); }; return error.Shutdown; } fn handleNewClient(logger: *FileLogger, server: *std.net.StreamServer, sockets: *PollFdList) void { var conn = server.accept() catch |err| { logger.info("Failed to accept: {}", .{err}); return; }; var sock = conn.file; _ = sock.write("helo!") catch |err| { logger.info("Failed to send helo: {}", .{err}); return; }; sockets.append(os.pollfd{ .fd = sock.handle, .events = os.POLLIN, .revents = 0, }) catch |err| { _ = sock.write("err out of memory!") catch |write_err| { logger.info("Failed to send message from {} in append: {}", .{ err, write_err }); }; }; return; } pub fn main(logger: *FileLogger) anyerror!void { logger.info("main!", .{}); const allocator = std.heap.page_allocator; var mask: std.os.sigset_t = undefined; sigemptyset(&mask); os.linux.sigaddset(&mask, std.os.SIGTERM); os.linux.sigaddset(&mask, std.os.SIGINT); _ = os.linux.sigprocmask(std.os.SIG_BLOCK, &mask, null); // mask[20] = 16386; const signal_fd = try os.signalfd(-1, &mask, 0); defer os.close(signal_fd); logger.info("signalfd: {}", .{signal_fd}); var server = std.net.StreamServer.init(std.net.StreamServer.Options{}); defer server.deinit(); var addr = try std.net.Address.initUnix(try helpers.getPathFor(allocator, .Sock)); try server.listen(addr); logger.info("listen done on fd={}", .{server.sockfd}); var sockets = PollFdList.init(allocator); defer sockets.deinit(); try sockets.append(os.pollfd{ .fd = server.sockfd.?, .events = os.POLLIN, .revents = 0, }); try sockets.append(os.pollfd{ .fd = signal_fd, .events = os.POLLIN, .revents = 0, }); var state = try DaemonState.init(allocator, logger); const daemon_message_thread = try std.Thread.spawn( &state, DaemonState.handleMessages, ); while (true) { var pollfds = sockets.items; logger.info("polling {} sockets...", .{pollfds.len}); const available = try os.poll(pollfds, -1); if (available == 0) { logger.info("timed out, retrying", .{}); continue; } for (pollfds) |pollfd, idx| { if (pollfd.revents == 0) continue; //if (pollfd.revents != os.POLLIN) return error.UnexpectedSocketRevents; if (pollfd.fd == server.sockfd.?) { handleNewClient(logger, &server, &sockets); } else if (pollfd.fd == signal_fd) { readFromSignalFd(state.allocator, logger, signal_fd) catch |err| { if (err == error.Shutdown) return else logger.info("failed to read from signal fd: {}\n", .{err}); }; } else { logger.info("got fd for read! fd={}", .{pollfd.fd}); readManyFromClient(&state, pollfd) catch |err| { logger.info("got error, fd={} err={}", .{ pollfd.fd, err }); // signal that the client must not be used, any other // operations on it will give error.Closed var client_opt = state.clients.get(pollfd.fd); if (client_opt) |client| { // decrease reference for main thread and mark // the fd as closed // TODO: investigate why tsusu seems to destroy itself when // we don't force-close the fd here, since everyone // else should get EndOfStream, just like us... client.ptr.?.close(); client.decRef(); _ = state.clients.remove(pollfd.fd); } _ = sockets.orderedRemove(idx); }; } } } }
src/daemon.zig
const std = @import("std"); const print = std.debug.print; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day03.txt"); fn calc(nums: []u1) usize { var total: usize = 0; for (nums) |n, i| { total += std.math.pow(usize, 2, nums.len - i - 1) * n; } return total; } fn num(str: []const u8) usize { var bits: [12]u1 = undefined; for (str) |s, i| { if (s == '0') bits[i] = 0; if (s == '1') bits[i] = 1; } return calc(&bits); } pub fn main() !void { var gamma: [12]u1 = undefined; var epsilon: [12]u1 = undefined; var items = try util.toStrSlice(data, "\n"); var i: usize = 0; while (i < 12) : (i += 1) { var count: usize = 0; for (items) |item| { if (item[i] == '0') count += 1; } if (count > items.len / 2) { gamma[i] = 0; epsilon[i] = 1; } else { gamma[i] = 1; epsilon[i] = 0; } } var g: usize = calc(&gamma); var e: usize = calc(&epsilon); i = 0; var ignore1: [1000]bool = [_]bool{false} ** 1000; var left: usize = 1000; while (i < 12) : (i += 1) { var count: usize = 0; for (items) |item, j| { if (ignore1[j]) continue; if (item[i] == '0') count += 1; } var consider: u8 = undefined; if (left % 2 == 0 and count == left / 2) { consider = '0'; } else if (count > left / 2) { consider = '1'; } else { consider = '0'; } for (items) |item, j| { if (ignore1[j]) continue; if (item[i] == consider) ignore1[j] = true; } left = 0; for (ignore1) |item, j| { if (!ignore1[j]) left += 1; } if (left == 1) break; } var idx: usize = 0; for (ignore1) |_, z| { if (!ignore1[z]) idx = z; } var ls = num(items[idx]); i = 0; var ignore2: [1000]bool = [_]bool{false} ** 1000; left = 1000; items = try util.toStrSlice(data, "\n"); while (i < 12) : (i += 1) { var count: usize = 0; for (items) |item, j| { if (ignore2[j]) continue; if (item[i] == '0') count += 1; } var consider: u8 = undefined; if (left % 2 == 0 and count == left / 2) { consider = '1'; } else if (count < left / 2) { consider = '1'; } else { consider = '0'; } for (items) |item, j| { if (ignore2[j]) continue; if (item[i] == consider) ignore2[j] = true; } left = 0; for (ignore2) |item, j| { if (!ignore2[j]) left += 1; } if (left == 1) break; } for (ignore2) |_, z| { if (!ignore2[z]) idx = z; } var oxy = num(items[idx]); // part 1 print("{d}\n", .{g * e}); // part 2 print("{d}\n", .{ls * oxy}); }
2021/src/day03.zig
const std = @import("std"); const testing = std.testing; const print = std.debug.print; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const input = @embedFile("./input.txt"); const num_numbers = 100; const num_boards = 100; const board_size = 5; pub fn main() anyerror!void { print("--- Part One ---\n", .{}); print("Result: {d}\n", .{part1()}); print("--- Part Two ---\n", .{}); print("Result: {d}\n", .{part2()}); } /// /// Bingo is the representation of a bingo with sets of numbers and boards /// const Bingo = struct { numbers: [num_numbers]u8, boards: [num_boards][num_numbers]u8, boards_sum: [num_boards]u32, rows_marks: [num_boards][board_size]u8, cols_marks: [num_boards][board_size]u8, pub fn init() Bingo { return Bingo{ .numbers = [_]u8{0} ** num_numbers, .boards = [_][num_numbers]u8{[_]u8{255} ** num_numbers} ** num_boards, .boards_sum = [_]u32{0} ** num_boards, .rows_marks = [_][board_size]u8{[_]u8{0} ** board_size} ** num_boards, .cols_marks = [_][board_size]u8{[_]u8{0} ** board_size} ** num_boards, }; } pub fn setNumber(self: *Bingo, index: usize, number: u8) void { self.numbers[index] = number; } pub fn setBoardCell(self: *Bingo, board: usize, row: u8, col: u8, number: u8) void { self.boards[board][number] = row * board_size + col; self.boards_sum[board] += number; } /// /// winnerScore marks numbers on all boards until one of them wins, returning its score /// pub fn winnerScore(self: *Bingo) u32 { for (self.numbers) |n| { return self.winnerBoardScore(n) orelse continue; } unreachable; } /// /// lastWinnerScore marks numbers on all boards until one of them wins, returning its score /// pub fn lastWinnerScore(self: *Bingo) u32 { var remaining_boards: u16 = num_boards; for (self.numbers) |n| { for (self.boards) |board, b| { if (board[n] == 255 or !self.boardWins(b, n)) { continue; } self.boards[b] = [_]u8{255} ** num_numbers; remaining_boards -= 1; if (remaining_boards == 0) { return self.boards_sum[b] * n; } } } unreachable; } fn winnerBoardScore(self: *Bingo, number: u8) ?u32 { for (self.boards) |board, b| { if (board[number] < 255 and self.boardWins(b, number)) { return self.boards_sum[b] * number; } } return null; } fn boardWins(self: *Bingo, board: usize, number: u8) bool { self.boards_sum[board] -= number; self.rows_marks[board][self.boards[board][number] / board_size] += 1; self.cols_marks[board][self.boards[board][number] % board_size] += 1; const rows_marked = self.rows_marks[board][self.boards[board][number] / board_size]; const cols_marked = self.cols_marks[board][self.boards[board][number] % board_size]; return rows_marked == board_size or cols_marked == board_size; } }; /// /// --- Part One --- /// fn part1() !u32 { var bingo = try readBingo(); return bingo.winnerScore(); } test "day04.part1" { @setEvalBranchQuota(200_000); try testing.expectEqual(49860, comptime try part1()); } /// /// --- Part Two --- /// fn part2() !u32 { var bingo = try readBingo(); return bingo.lastWinnerScore(); } test "day04.part2" { @setEvalBranchQuota(200_000); try testing.expectEqual(24628, comptime try part2()); } /// /// readBingo reads a bingo from the input /// fn readBingo() !Bingo { var bingo = Bingo.init(); var lines = std.mem.split(u8, std.mem.trimRight(u8, input, "\n"), "\n"); var numbers_iter = std.mem.split(u8, lines.next() orelse "", ","); var number_count: u8 = 0; while (numbers_iter.next()) |number| : (number_count += 1) { bingo.setNumber(number_count, try std.fmt.parseInt(u8, number, 10)); } var board_count: u8 = 0; while (lines.next()) |_| : (board_count += 1) { var r: u8 = 0; while (r < board_size) : (r += 1) { var row_str = lines.next() orelse ""; var row_iter = std.mem.split(u8, row_str, " "); var c: u8 = 0; while (row_iter.next()) |cell_str| { var cell: u8 = std.fmt.parseInt(u8, cell_str, 10) catch continue; bingo.setBoardCell(board_count, r, c, cell); c += 1; } } } return bingo; }
src/day04/day04.zig
const std = @import("std"); const utils = @import("../utils.zig"); const Atomic = std.atomic.Atomic; const Futex = std.Thread.Futex; const NtKeyedEvent = @import("keyed_event_lock.zig").NtKeyedEvent; pub const Lock = struct { pub const name = "count_lock"; state: Atomic(u64) = Atomic(u64).init(0), const unlocked = 0; const locked = 1 << 0; const waking = 1 << 1; const waiting = 1 << 2; pub fn init(self: *Lock) void { self.* = Lock{}; } pub fn deinit(self: *Lock) void { self.* = undefined; } pub fn acquire(self: *Lock) void { if (!self.acquireFast()) { self.acquireSlow(); } } inline fn acquireFast(self: *Lock) bool { return self.state.bitSet(@ctz(u64, locked), .Acquire) == 0; } noinline fn acquireSlow(self: *Lock) void { var spin: u8 = 0; var state = self.state.load(.Monotonic); while (true) { if (state & locked == 0) { if (self.acquireFast()) return; std.atomic.spinLoopHint(); state = self.state.load(.Monotonic); continue; } if (@truncate(u32, state) < waiting and spin < 100) { spin += 1; std.atomic.spinLoopHint(); state = self.state.load(.Monotonic); continue; } if (self.state.tryCompareAndSwap( state, state + waiting, .Monotonic, .Monotonic, )) |updated| { state = updated; continue; } self.wait(); spin = 0; state = self.state.fetchSub(waking, .Monotonic) - waking; } } pub fn release(self: *Lock) void { const state = self.state.fetchSub(locked, .Release); if (@truncate(u32, state) >= waiting) { self.releaseSlow(); } } noinline fn releaseSlow(self: *Lock) void { var state = self.state.load(.Monotonic); while (@truncate(u32, state) >= waiting and state & (locked | waking) == 0) { state = self.state.tryCompareAndSwap( state, state - waiting + waking, .Monotonic, .Monotonic, ) orelse return self.wake(); } } noinline fn wait(self: *Lock) void { const futex_ptr = &@ptrCast(*[2]Atomic(u32), &self.state)[1]; while (futex_ptr.swap(0, .Acquire) == 0) Futex.wait(futex_ptr, 0, null) catch unreachable; } noinline fn wake(self: *Lock) void { const futex_ptr = &@ptrCast(*[2]Atomic(u32), &self.state)[1]; futex_ptr.store(1, .Release); return Futex.wake(futex_ptr, 1); } };
locks/count_lock.zig
const debug = @import("std").debug; const Vec3 = @import("Vec3.zig").Vec3; //TODO is there some sort of better swap? fn swap(lhs: *f32, rhs: *f32) void { const temp = lhs; lhs = rhs; rhs = temp; } pub const identity = Mat4x4{}; pub const zero = Mat4x4{ .m = [4][4]f32{ [4]f32{ 0.0, 0.0, 0.0, 0.0 }, [4]f32{ 0.0, 0.0, 0.0, 0.0 }, [4]f32{ 0.0, 0.0, 0.0, 0.0 }, [4]f32{ 0.0, 0.0, 0.0, 0.0 }, }, }; pub const Mat4x4 = packed struct { m: [4][4]f32 align(4) = [4][4]f32{ [4]f32{ 1.0, 0.0, 0.0, 0.0 }, [4]f32{ 0.0, 1.0, 0.0, 0.0 }, [4]f32{ 0.0, 0.0, 1.0, 0.0 }, [4]f32{ 0.0, 0.0, 0.0, 1.0 }, }, pub fn Mul(self: *const Mat4x4, other: *const Mat4x4) Mat4x4 { var returnMat = Mat4x4{}; comptime var selfIter = 0; inline while (selfIter < 4) : (selfIter += 1) { comptime var otherIter = 0; inline while (otherIter < 4) : (otherIter += 1) { returnMat.m[selfIter][otherIter] = self.m[selfIter][0] * other.m[0][otherIter] + self.m[selfIter][1] * other.m[1][otherIter] + self.m[selfIter][2] * other.m[2][otherIter] + self.m[selfIter][3] * other.m[3][otherIter]; } } return returnMat; } pub fn Transpose(self: *const Mat4x4) Mat4x4 { return Mat4x4{ .m = [4][4]f32{ [4]f32{ self.m[0][0], self.m[1][0], self.m[2][0], self.m[3][0] }, [4]f32{ self.m[0][1], self.m[1][1], self.m[2][1], self.m[3][1] }, [4]f32{ self.m[0][2], self.m[1][2], self.m[2][2], self.m[3][2] }, [4]f32{ self.m[0][3], self.m[1][3], self.m[2][3], self.m[3][3] }, }, }; } pub fn TransposeSelf(self: *Mat4x4) void { swap(&m[0][1], &m[1][0]); swap(&m[0][2], &m[2][0]); swap(&m[0][3], &m[3][0]); swap(&m[1][2], &m[2][1]); swap(&m[1][3], &m[3][1]); swap(&m[2][3], &m[3][2]); } }; pub fn LookDirMat4x4(from: Vec3, direction: Vec3, up: Vec3) Mat4x4 { const lookAtVec = direction.Normalized(); const rightVec = up.Cross(lookAtVec).Normalized(); const lookAtMat1 = Mat4x4{ //TODO may need transposing .m = [4][4]f32{ [_]f32{ rightVec.x, rightVec.y, rightVec.z, 0.0 }, [_]f32{ up.x, up.y, up.z, 0.0 }, [_]f32{ lookAtVec.x, lookAtVec.y, lookAtVec.z, 0.0 }, [_]f32{ 0.0, 0.0, 0.0, 1.0 }, }, }; const lookAtMat2 = Mat4x4{ .m = [4][4]f32{ [_]f32{ 1.0, 0.0, 0.0, 0.0 }, [_]f32{ 0.0, 1.0, 0.0, 0.0 }, [_]f32{ 0.0, 0.0, 1.0, 0.0 }, [_]f32{ -from.x, -from.y, -from.z, 1.0 }, }, }; return lookAtMat1.Mul(&lookAtMat2); } pub fn TranslationMat4x4(translation: Vec3) Mat4x4 { var returnMat = identity; returnMat.m[0][3] = translation.x; returnMat.m[1][3] = translation.y; returnMat.m[2][3] = translation.z; return returnMat; } pub fn DebugLogMat4x4(mat: *const Mat4x4) void { for (mat.m) |row| { debug.warn("{{", .{}); for (row) |val| { debug.warn("{}, ", .{val}); } debug.warn("}},\n", .{}); } }
src/math/Mat4x4.zig
usingnamespace @import("root").preamble; const ImageRegion = lib.graphics.image_region.ImageRegion; const Color = lib.graphics.color.Color; pub const ScrollingRegion = struct { used_height: usize = 0, used_width: usize = 0, pub fn putBottom(self: *@This(), region: ImageRegion, into: ImageRegion, used_width: usize) void { if (region.width != into.width) unreachable; if (self.used_height + region.height > into.height) { // We need to scroll const to_scroll = self.used_height + region.height - into.height; // Do the scroll without invalidating into.drawImage(into.subregion(0, to_scroll, self.used_width, into.height - to_scroll), 0, 0, false); self.used_height -= to_scroll; self.used_width = std.math.max(self.used_width, used_width); // Draw the next line without invalidating into.drawImage(region.subregion(0, 0, self.used_width, region.height), 0, self.used_height, false); // Invalidate entire region into.invalidateRect(0, 0, self.used_width, into.height); } else { // Just add the line and invalidate it into.drawImage(region.subregion(0, 0, used_width, region.height), 0, self.used_height, true); self.used_width = std.math.max(self.used_width, used_width); } self.used_height += region.height; } pub fn retarget(self: *@This(), old: ImageRegion, new: ImageRegion, bg: Color) void { // Switching targets, calculate max copy size const copy_width = std.math.min(new.width, std.math.min(old.width, self.used_width)); const copy_height = std.math.min(new.height, old.height); // Clear the rest of the new region if (copy_width < new.width) new.fill(bg, copy_width, 0, new.width - copy_width, new.height, false); if (copy_height >= self.used_height) { // We're not using the entire height, just copy it over and leave current used height as is new.drawImage(old.subregion(0, 0, copy_width, copy_height), 0, 0, false); // Pad at bottom if needed if (copy_height < new.height) new.fill(bg, 0, copy_height, copy_width, new.height - copy_height, false); } else { // We want to copy the `copy_height` last pixel lines const old_copy_y_offset = old.height - copy_height; const new_copy_y_offset = new.height - copy_height; new.drawImage(old.subregion(0, old_copy_y_offset, copy_width, copy_height), 0, new_copy_y_offset, false); // Entire framebuffer is in use self.used_height = new.height; } // Pad at side if needed if (copy_width < new.width) new.fill(bg, copy_width, 0, new.width - copy_width, new.height, false); self.used_width = copy_width; // Invalidate entire new target, we've drawn to all of it new.invalidateRect(0, 0, new.width, new.height); } };
lib/graphics/scrolling_region.zig
//-------------------------------------------------------------------------------- // Section: Types (2) //-------------------------------------------------------------------------------- pub const NOTIFICATION_USER_INPUT_DATA = extern struct { Key: ?[*:0]const u16, Value: ?[*:0]const u16, }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_INotificationActivationCallback_Value = @import("../zig.zig").Guid.initString("53e31837-6600-4a81-9395-75cffe746f94"); pub const IID_INotificationActivationCallback = &IID_INotificationActivationCallback_Value; pub const INotificationActivationCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Activate: fn( self: *const INotificationActivationCallback, appUserModelId: ?[*:0]const u16, invokedArgs: ?[*:0]const u16, data: [*]const NOTIFICATION_USER_INPUT_DATA, count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INotificationActivationCallback_Activate(self: *const T, appUserModelId: ?[*:0]const u16, invokedArgs: ?[*:0]const u16, data: [*]const NOTIFICATION_USER_INPUT_DATA, count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const INotificationActivationCallback.VTable, self.vtable).Activate(@ptrCast(*const INotificationActivationCallback, self), appUserModelId, invokedArgs, data, count); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (0) //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (3) //-------------------------------------------------------------------------------- const HRESULT = @import("../foundation.zig").HRESULT; const IUnknown = @import("../system/com.zig").IUnknown; const PWSTR = @import("../foundation.zig").PWSTR; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/ui/notifications.zig
const std = @import("std"); const mem = std.mem; const utils = @import("utils.zig"); const expect = std.testing.expect; const log = std.log; pub const Item = struct { // required: type, id; no additional properties @"type": ItemType, // string -> enum id: OrdinaryVar, optionals: PropertyMap, pub fn init(alloactor: *std.mem.Allocator, _type: ItemType, id: OrdinaryVar) Item { return Item{ .@"type" = _type, .id = id, .optionals = PropertyMap.init(alloactor), }; } pub fn jsonStringify( value: @This(), options: std.json.StringifyOptions, out_stream: anytype, ) !void { try out_stream.writeByte('{'); inline for (@typeInfo(@This()).Struct.fields) |Field, field_i| { comptime { if (std.mem.eql(u8, Field.name, "optionals")) { continue; } } if (field_i != 0) try out_stream.writeByte(','); try std.json.stringify(Field.name, options, out_stream); try out_stream.writeByte(':'); try std.json.stringify(@field(value, Field.name), options, out_stream); } if (value.optionals.count() > 0) { try out_stream.writeByte(','); var iter = value.optionals.iterator(); var i: u32 = 0; while (iter.next()) |entry| : (i += 1) { if (i > 0) try out_stream.writeByte(','); try std.json.stringify(entry.key_ptr, options, out_stream); try out_stream.writeByte(':'); try std.json.stringify(entry.value_ptr, options, out_stream); } } try out_stream.writeByte('}'); } }; pub const PropertyMap = std.StringHashMap(Property); pub const ItemType = enum { article, @"article-journal", @"article-magazine", @"article-newspaper", bill, book, broadcast, chapter, classic, dataset, document, entry, @"entry-dictionary", @"entry-encyclopedia", event, figure, graphic, hearing, interview, legal_case, legislation, manuscript, map, motion_picture, musical_score, pamphlet, @"paper-conference", patent, performance, periodical, personal_communication, post, @"post-weblog", regulation, report, review, @"review-book", software, song, speech, standard, thesis, treaty, webpage, // provide jsonStringify method so std's json writer knows how to format the enum // or any custom type (uses comptime duck-typing by checking if a custom type // has the jsonStringify method; std.meta.trait.hasFn("jsonStringify")) pub fn jsonStringify( value: ItemType, options: std.json.StringifyOptions, out_stream: anytype, ) !void { try std.json.stringify(@tagName(value), options, out_stream); } }; pub const Property = union(enum) { @"citation-key": []const u8, categories: []const []const u8, language: []const u8, journalAbbreviation: []const u8, shortTitle: []const u8, author: []NameVar, chair: []NameVar, @"collection-editor": []NameVar, compiler: []NameVar, composer: []NameVar, @"container-author": []NameVar, contributor: []NameVar, curator: []NameVar, director: []NameVar, editor: []NameVar, @"editorial-director": []NameVar, @"executive-producer": []NameVar, guest: []NameVar, host: []NameVar, interviewer: []NameVar, illustrator: []NameVar, narrator: []NameVar, organizer: []NameVar, @"original-author": []NameVar, performer: []NameVar, producer: []NameVar, recipient: []NameVar, @"reviewed-author": []NameVar, @"script-writer": []NameVar, @"series-creator": []NameVar, translator: []NameVar, accessed: DateVar, @"available-date": DateVar, @"event-date": DateVar, issued: DateVar, @"original-date": DateVar, submitted: DateVar, abstract: []const u8, annote: []const u8, archive: []const u8, archive_collection: []const u8, archive_location: []const u8, @"archive-place": []const u8, authority: []const u8, @"call-number": []const u8, @"chapter-number": OrdinaryVar, @"citation-number": OrdinaryVar, @"citation-label": []const u8, @"collection-number": OrdinaryVar, @"collection-title": []const u8, @"container-title": []const u8, @"container-title-short": []const u8, dimensions: []const u8, division: []const u8, DOI: []const u8, edition: OrdinaryVar, // Deprecated - use '@"event-title' instead. Will be removed in 1.1 // event: []const u8, @"event-title": []const u8, @"event-place": []const u8, @"first-reference-note-number": OrdinaryVar, genre: []const u8, ISBN: []const u8, ISSN: []const u8, issue: OrdinaryVar, jurisdiction: []const u8, keyword: []const u8, locator: OrdinaryVar, medium: []const u8, note: []const u8, number: OrdinaryVar, @"number-of-pages": OrdinaryVar, @"number-of-volumes": OrdinaryVar, @"original-publisher": []const u8, @"original-publisher-place": []const u8, @"original-title": []const u8, page: OrdinaryVar, @"page-first": OrdinaryVar, part: OrdinaryVar, @"part-title": []const u8, PMCID: []const u8, PMID: []const u8, printing: OrdinaryVar, publisher: []const u8, @"publisher-place": []const u8, references: []const u8, @"reviewed-genre": []const u8, @"reviewed-title": []const u8, scale: []const u8, section: []const u8, source: []const u8, status: []const u8, supplement: OrdinaryVar, title: []const u8, @"title-short": []const u8, URL: []const u8, version: []const u8, volume: OrdinaryVar, @"volume-title": []const u8, @"volume-title-short": []const u8, @"year-suffix": []const u8, // TODO custom; 'js object' with arbitrary @"key-value pairs for storing additional information // we currently don't need this information // NOTE: std.json.stringify fails to stringify ObjectMap even though that's what's being used to // parse objects in the json parser? // custom: std.json.ObjectMap, }; pub const OrdinaryVar = union(enum) { string: []const u8, // float also allowed here or just ints? number: i32, }; pub const BoolLike = union(enum) { string: []const u8, number: i32, boolean: bool, }; // TODO make these smaller they're huge pub const NameVar = struct { family: ?[]const u8 = null, given: ?[]const u8 = null, @"dropping-particle": ?[]const u8 = null, @"non-dropping-particle": ?[]const u8 = null, suffix: ?[]const u8 = null, @"comma-suffix": ?BoolLike = null, @"static-ordering": ?BoolLike = null, literal: ?[]const u8 = null, @"parse-names": ?BoolLike = null, }; pub const DateVar = union(enum) { // Extended Date/Time Format (EDTF) string // https://www.loc.gov/standards/datetime/ edtf: []const u8, date: Date, pub const Date = struct { // 1-2 of 1-3 items [2][3]OrdinaryVar @"date-parts": ?[][]OrdinaryVar = null, season: ?OrdinaryVar = null, circa: ?BoolLike = null, literal: ?[]const u8 = null, raw: ?[]const u8 = null, edtf: ?[]const u8 = null, pub fn jsonStringify( value: @This(), options: std.json.StringifyOptions, out_stream: anytype, ) !void { try out_stream.writeByte('{'); // iterate over struct fields inline for (@typeInfo(@This()).Struct.fields) |Field, field_i| { if (field_i != 0) try out_stream.writeByte(','); try std.json.stringify(Field.name, options, out_stream); try out_stream.writeByte(':'); try std.json.stringify(@field(value, Field.name), options, out_stream); } try out_stream.writeByte('}'); } }; }; pub const Citation = struct { // schema: "https://resource.citationstyles.org/schema/latest/input/json/csl-citation.json" schema: []const u8, citationID: OrdinaryVar, citationItems: ?[]CitationItem = null, properties: ?struct { noteIndex: i32 } = null, }; pub const CitationItem = struct { id: OrdinaryVar, // TODO un-comment when Item can get properly stringified // itemData: ?[]Item = null, prefix: ?[]const u8 = null, suffix: ?[]const u8 = null, locator: ?[]const u8 = null, label: ?LocatorType = null, @"suppress-author": ?BoolLike = null, @"author-only": ?BoolLike = null, uris: ?[]const []const u8 = null, pub const LocatorType = enum { act, appendix, @"article-locator", book, canon, chapter, column, elocation, equation, figure, folio, issue, line, note, opus, page, paragraph, part, rule, scene, section, @"sub-verbo", supplement, table, timestamp, @"title-locator", verse, version, volume, pub fn jsonStringify( value: LocatorType, options: std.json.StringifyOptions, out_stream: anytype, ) !void { try std.json.stringify(@tagName(value), options, out_stream); } }; }; // TODO @Speed // makes more sense to store this as a map internally, even though the schema states // it is an array of Items // pub const CSLJsonMap = std.StringHashMap(Item); pub fn write_items_json(items: []Item, out_stream: anytype) !void { try out_stream.writeByte('['); const len = items.len; for (items) |item, i| { try out_stream.writeAll("{\"type\": "); try std.json.stringify(item.@"type", .{}, out_stream); try out_stream.writeAll(", "); try out_stream.writeAll("\"id\": "); try std.json.stringify(item.id, .{}, out_stream); var props_iter = item.optionals.iterator(); // const props_num = item.optionals.count(); while (props_iter.next()) |prop_entry| { try out_stream.writeAll(", "); try out_stream.writeAll("\""); try out_stream.writeAll(prop_entry.key_ptr.*); try out_stream.writeAll("\": "); try std.json.stringify(prop_entry.value_ptr, .{}, out_stream); } try out_stream.writeByte('}'); if (i != len - 1) try out_stream.writeByte(','); } try out_stream.writeByte(']'); } pub fn read_items_json(allocator: *std.mem.Allocator, input: []const u8) !CSLJsonParser.Result { var parser = CSLJsonParser.init(allocator, input); return parser.parse(); } // TODO write csl json test test "read csl json" { const allocator = std.testing.allocator; const csljson = \\[{"type": "article-journal", "id": "Ismail2007", \\"author": [{"family":"Ismail","given":"R", \\"dropping-particle":null,"non-dropping-particle":null,"suffix":null, \\"comma-suffix":null,"static-ordering":null,"literal":null,"parse-names":null}, \\{"family":"Mutanga","given":"O","parse-names":null}], \\"issued": {"date-parts":[["2007"]],"season":null,"circa":null, \\"literal":null,"raw":null,"edtf":null}, "number": "1", \\"title": "Forest health and vitality: the detection and monitoring of Pinus patula trees infected by Sirex noctilio using digital multispectral imagery", \\"DOI": "10.2989/shfj.2007.69.1.5.167", "volume": 69, "page": "39--47", \\"publisher": "Informa UK Limited", "container-title": "Southern Hemisphere Forestry Journal"}] ; const parse_result = try read_items_json(allocator, csljson[0..]); defer parse_result.arena.deinit(); const items = parse_result.items; try expect(items.len == 1); const it = items[0]; try expect(it.@"type" == .@"article-journal"); try expect(it.id == .string); try expect(mem.eql(u8, it.id.string, "Ismail2007")); const authors = it.optionals.get("author").?.author; try expect(authors.len == 2); try expect(mem.eql(u8, authors[0].family.?, "Ismail")); try expect(mem.eql(u8, authors[0].given.?, "R")); try expect(authors[0].@"dropping-particle" == null); try expect(authors[0].@"non-dropping-particle" == null); try expect(authors[0].suffix == null); try expect(authors[0].@"comma-suffix" == null); try expect(authors[0].@"static-ordering" == null); try expect(authors[0].literal == null); try expect(authors[0].@"parse-names" == null); const issued = it.optionals.get("issued").?.issued.date.@"date-parts".?; try expect(issued.len == 1); try expect(issued[0].len == 1); try expect(mem.eql(u8, issued[0][0].string, "2007")); const number = it.optionals.get("number").?.number; try expect(mem.eql(u8, number.string, "1")); const title = it.optionals.get("title").?.title; try expect(mem.eql(u8, title, "Forest health and vitality: the detection and monitoring of Pinus patula trees infected by Sirex noctilio using digital multispectral imagery")); const doi = it.optionals.get("DOI").?.DOI; try expect(mem.eql(u8, doi, "10.2989/shfj.2007.69.1.5.167")); const volume = it.optionals.get("volume").?.volume; try expect(volume.number == 69); const page = it.optionals.get("page").?.page; try expect(mem.eql(u8, page.string, "39--47")); const publisher = it.optionals.get("publisher").?.publisher; try expect(mem.eql(u8, publisher, "Informa UK Limited")); const container_title = it.optionals.get("container-title").?.@"container-title"; try expect(mem.eql(u8, container_title, "Southern Hemisphere Forestry Journal")); } pub const CSLJsonParser = struct { stream: std.json.TokenStream, arena: std.heap.ArenaAllocator, items: std.ArrayList(Item), state: State, current: u32, input: []const u8, const State = enum { begin, items_start, item_begin, item_end, expect_id, expect_type, after_field_value, end, }; pub const Error = error { UnexpectedToken, ParserFinished, ParserNotFinished, UnknownItemType, UnknownProperty, }; pub const Result = struct { arena: std.heap.ArenaAllocator, items: []Item, }; pub fn init(allocator: *std.mem.Allocator, input: []const u8) CSLJsonParser { var parser = CSLJsonParser{ .stream = std.json.TokenStream.init(input), .arena = std.heap.ArenaAllocator.init(allocator), .items = undefined, .current = undefined, .input = input, .state = .begin, }; return parser; } pub fn parse(self: *@This()) !Result { // NOTE: can't be initialized in init since the address of the arena.allocator // will change self.items = std.ArrayList(Item).init(&self.arena.allocator); while (try self.stream.next()) |token| { try self.feed(token); } switch (self.state) { .end => return Result{ .arena = self.arena, .items = self.items.toOwnedSlice() }, else => return Error.ParserNotFinished, } } fn feed(self: *@This(), token: std.json.Token) !void { // []NameVar (only arr) // []const u8 // []const []const u8 (only categories) // DateVar // OrdinaryVar switch (self.state) { .begin => { switch (token) { .ArrayBegin => self.state = .items_start, else => return Error.UnexpectedToken, } }, .items_start, .item_end => { switch (token) { .ObjectBegin => { self.state = .item_begin; const item: *Item = try self.items.addOne(); // init PropertyMap item.optionals = PropertyMap.init(&self.arena.allocator); self.current = @intCast(u32, self.items.items.len) - 1; }, .ArrayEnd => self.state = .end, else => return Error.UnexpectedToken, } }, .item_begin, .after_field_value => { switch (token) { .String => |str| { // assume that the field name doesn't contain escapes const current_field = str.slice(self.input, self.stream.i - 1); if (mem.eql(u8, "id", current_field)) { self.state = .expect_id; } else if (mem.eql(u8, "type", current_field)) { self.state = .expect_type; } else { // we have to call this here directly otherwise (if we wait to be // fed the token) the tokenstream will have advanced beyond the start // of the obj/value already try self.parse_property(current_field); self.state = .after_field_value; } }, .ObjectEnd => self.state = .item_end, else => return Error.UnexpectedToken, } }, .expect_id => { switch (token) { .String => |str| { const slice = str.slice(self.input, self.stream.i - 1); self.items.items[self.current].id = .{ .string = try self.copy_string(str, slice) }; }, .Number => |num| { if (!num.is_integer) { return Error.UnexpectedToken; } const slice = num.slice(self.input, self.stream.i - 1); const parsed = std.fmt.parseInt(i32, slice, 10) catch return Error.UnexpectedToken; self.items.items[self.current].id = .{ .number = parsed }; }, else => return Error.UnexpectedToken, } self.state = .after_field_value; }, .expect_type => { switch (token) { .String => |str| { const slice = str.slice(self.input, self.stream.i - 1); const mb_item_type = std.meta.stringToEnum(ItemType, slice); if (mb_item_type) |item_type| { self.items.items[self.current].@"type" = item_type; } else { log.err("Unknown CSL-JSON item type: {s}\n", .{ slice }); return Error.UnknownItemType; } self.state = .after_field_value; }, else => return Error.UnexpectedToken, } }, .end => return Error.ParserFinished, } } // copies the string from a json string token wihout backslashes fn copy_string( self: *@This(), str: std.meta.TagPayload(std.json.Token, .String), slice: []const u8 ) ![]const u8 { if (str.escapes == .Some) { var strbuf = try std.ArrayList(u8).initCapacity( &self.arena.allocator, str.decodedLength()); var escaped = false; for (slice) |b| { if (escaped) { escaped = false; } else if (b == '\\') { escaped = true; continue; } strbuf.appendAssumeCapacity(b); } return strbuf.toOwnedSlice(); } else { return mem.dupe(&self.arena.allocator, u8, slice); } } fn parse_property(self: *@This(), prop_name: []const u8) !void { // json.parse for Propery needs alot of comptime backward branches @setEvalBranchQuota(3000); // let json.parse handle parsing the Propery tagged union // NOTE: we have to use stringToEnum and then switch on the tag // and call json.parse to parse the proper type directly // since json.parse will just parse the first matching union type // so e.g. citation-key and language will always end up as citation-key const prop_kind = std.meta.stringToEnum( std.meta.Tag(Property), prop_name) orelse return Error.UnknownProperty; // @Compiler / @stdlib meta.TagPayload and @unionInit only work with comptime // known values, would be really practical if there were runtime variants // of these for getting the payload of a tag at runtime and the initializing // the union with the active tag and payload at runtime as well // TODO? // const PayloadType = std.meta.TagPayload(Property, prop_kind); // const payload = std.json.parse( // PayloadType, &self.stream, // .{ .allocator = &self.arena.allocator, // .allow_trailing_data = true } // ) catch |err| { // log.err("Could not parse property for field: {s} due to err {s}\n", // .{ prop_name, err }); // return Error.UnknownProperty; // }; // std.debug.print("putting {s}\n", .{ @tagName(prop_kind) }); // try props.put(current_field, @unionInit(Property, @tagName(prop_kind), payload)); // @Compiler type has to be comptime known and there is no runtime type information??? var prop: Property = undefined; // switch on tag so we know which payload type we have to parse then set prop using // json.parse's result switch (prop_kind) { .@"citation-key", .language, .journalAbbreviation, .shortTitle, .abstract, .annote, .archive, .archive_collection, .archive_location, .@"archive-place", .authority, .@"call-number", .@"citation-label", .@"collection-title", .@"container-title", .@"container-title-short", .dimensions, .division, .DOI, // Deprecated - use '@"event-title' instead. Will be removed in 1.1 // event: []const u8, .@"event-title", .@"event-place", .genre, .ISBN, .ISSN, .jurisdiction, .keyword, .medium, .note, .@"original-publisher", .@"original-publisher-place", .@"original-title", .@"part-title", .PMCID, .PMID, .publisher, .@"publisher-place", .references, .@"reviewed-genre", .@"reviewed-title", .scale, .section, .source, .status, .title, .@"title-short", .URL, .version, .@"volume-title", .@"volume-title-short", .@"year-suffix", => { // []const u8, const payload = std.json.parse( []const u8, &self.stream, .{ .allocator = &self.arena.allocator, .allow_trailing_data = true } ) catch |err| { log.err("Could not parse property for field: {s} due to err {s}\n", .{ prop_name, err }); return Error.UnknownProperty; }; prop = utils.unionInitTagged(Property, prop_kind, []const u8, payload); }, .categories => { // []const []const u8, const payload = std.json.parse( []const []const u8, &self.stream, .{ .allocator = &self.arena.allocator, .allow_trailing_data = true } ) catch |err| { log.err("Could not parse property for field: {s} due to err {s}\n", .{ prop_name, err }); return Error.UnknownProperty; }; prop = utils.unionInitTagged(Property, prop_kind, []const []const u8, payload); }, .author, .chair, .@"collection-editor", .compiler, .composer, .@"container-author", .contributor, .curator, .director, .editor, .@"editorial-director", .@"executive-producer", .guest, .host, .interviewer, .illustrator, .narrator, .organizer, .@"original-author", .performer, .producer, .recipient, .@"reviewed-author", .@"script-writer", .@"series-creator", .translator => { // []NameVar const payload = std.json.parse( []NameVar, &self.stream, .{ .allocator = &self.arena.allocator, .allow_trailing_data = true } ) catch |err| { log.err("Could not parse property for field: {s} due to err {s}\n", .{ prop_name, err }); return Error.UnknownProperty; }; prop = utils.unionInitTagged(Property, prop_kind, []NameVar, payload); }, .accessed, .@"available-date", .@"event-date", .issued, .@"original-date", .submitted => { // DateVar const payload = std.json.parse( DateVar, &self.stream, .{ .allocator = &self.arena.allocator, .allow_trailing_data = true } ) catch |err| { log.err("Could not parse property for field: {s} due to err {s}\n", .{ prop_name, err }); return Error.UnknownProperty; }; prop = utils.unionInitTagged(Property, prop_kind, DateVar, payload); }, .@"chapter-number", .@"citation-number", .@"collection-number", .edition, .@"first-reference-note-number", .issue, .locator, .number, .@"number-of-pages", .@"number-of-volumes", .page, .@"page-first", .part, .printing, .supplement, .volume, => { // OrdinaryVar const payload = std.json.parse( OrdinaryVar, &self.stream, .{ .allocator = &self.arena.allocator, .allow_trailing_data = true } ) catch |err| { log.err("Could not parse property for field: {s} due to err {s}\n", .{ prop_name, err }); return Error.UnknownProperty; }; prop = utils.unionInitTagged(Property, prop_kind, OrdinaryVar, payload); }, } // NOTE: important to take the address here otherwise we copy the // PropertyMap and the state gets reset when exiting this function var props = &self.items.items[self.current].optionals; // add to PropertyMap // NOTE: the hashmap implementation only stores the slice, but not the underlying // u8 buffer, so we have to dupe it here, otherwise the memory will be invalid // when the csl_json input slice gets free'd try props.put(try self.arena.allocator.dupe(u8, prop_name), prop); } };
src/csl_json.zig
const std = @import("std"); const build_options = @import("build_options"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const fmt = std.fmt; const fs = std.fs; const io = std.io; const mem = std.mem; const process = std.process; const c = @cImport({ @cInclude("systemd/sd-bus.h"); }); const sys_class_path = "/sys/class"; const default_class = "backlight"; const default_name = "intel_backlight"; const PathError = error{ NoBacklightDirsFound, NoBrightnessFileFound, NoMaxBrightnessFileFound, }; const ArgError = error{ MissingSetOption, MissingAction, InvalidAction, InvalidSetOption, InvalidSetActionValue, }; const Args = struct { exe: []const u8, action: ?[]const u8, action_option: ?[]const u8, option_option: ?[]const u8, }; var allocator: Allocator = undefined; pub fn main() !void { // Using arena allocator, no need to dealloc anything var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); allocator = arena.allocator(); const class = default_class; const path = try std.fs.path.join(allocator, &.{ sys_class_path, class }); const name = try findBrightnessPath(path, default_name); var args = try parseArgs(); return performAction(args, class, name); } fn parseArgs() !Args { var args_iter = process.args(); var exe = (try args_iter.next(allocator)).?; var parsed_args = Args{ .exe = exe, .action = null, .action_option = null, .option_option = null, }; var level: u23 = 1; while (try args_iter.next(allocator)) |arg| { if (level == 1) { parsed_args.action = arg; level += 1; } else if (level == 2) { parsed_args.action_option = arg; level += 1; } else if (level == 3) { parsed_args.option_option = arg; level += 1; } else if (level > 3) { break; } } if (level == 1) { usage(exe); return ArgError.MissingAction; } return parsed_args; } fn usage(exe: []const u8) void { @setEvalBranchQuota(1500); const str = \\{s} <action> [action-options] \\ \\ Actions: \\ get: Display current brightness \\ set: Update the brightness \\ debug: Display backlight information \\ help: Display this \\ \\ Set options: \\ inc X: Increase brightness by X% \\ dec X: Decrease brightness by X% \\ max: Set brightness to maximum \\ min: Set brightness to minimum \\ ; std.debug.print(str, .{exe}); } /// Checks if name is present in path, if not, returns the first entry /// (lexicographically sorted) fn findBrightnessPath(path: []const u8, name: []const u8) ![]const u8 { var dir = try fs.cwd().openDir(path, .{ .iterate = true }); defer dir.close(); if (dir.openDir(name, .{})) |*default_dir| { default_dir.close(); return name; } else |_| { var result: ?[]const u8 = null; var iterator = dir.iterate(); while (try iterator.next()) |entry| { if (result) |candidate| { if (std.mem.order(u8, candidate, entry.name) == .lt) { result = try allocator.dupe(u8, entry.name); } } else { result = try allocator.dupe(u8, entry.name); } } return if (result) |first| first else error.NoBacklightDirsFound; } } fn performAction(args: Args, class: []const u8, name: []const u8) !void { const exe = args.exe; const action = args.action.?; const brightness_path = try std.fs.path.join(allocator, &.{ sys_class_path, class, name, "brightness" }); const max_path = try std.fs.path.join(allocator, &.{ sys_class_path, class, name, "max_brightness" }); if (mem.eql(u8, action, "get")) { try printFile(brightness_path); } else if (mem.eql(u8, action, "debug")) { // TODO: find a more ergonomic print setup try printString("Backlight path: "); try printString(brightness_path); try printString("\nBrightness: "); try printFile(brightness_path); try printString("Max Brightness: "); try printFile(max_path); } else if (mem.eql(u8, action, "set")) { const option = args.action_option; const percent = args.option_option; if (option == null and percent == null) { usage(exe); return ArgError.InvalidSetOption; } else if (mem.eql(u8, option.?, "min")) { try setBrightness(class, name, 0); } else if (mem.eql(u8, option.?, "max")) { const max = try readFile(max_path); try setBrightness(class, name, max); } else if (mem.eql(u8, option.?, "inc") or mem.eql(u8, option.?, "dec")) { const max = try readFile(max_path); const curr = try readFile(brightness_path); const new_brightness = try calcPercent(curr, max, percent.?, option.?); try setBrightness(class, name, new_brightness); } else { usage(exe); return ArgError.InvalidSetOption; } } else { usage(exe); return ArgError.InvalidAction; } } fn printFile(path: []const u8) !void { var file = fs.cwd().openFile(path, .{}) catch |err| { std.debug.print("Cannot open {s} with read permissions.\n", .{path}); return err; }; defer file.close(); const stdout = io.getStdOut().writer(); var buf: [4096]u8 = undefined; while (true) { const bytes_read = file.read(buf[0..]) catch |err| { std.debug.print("Unable to read file {s}\n", .{path}); return err; }; if (bytes_read == 0) { break; } stdout.writeAll(buf[0..bytes_read]) catch |err| { std.debug.print("Unable to write to stdout\n", .{}); return err; }; } } fn printString(msg: []const u8) !void { const stdout = io.getStdOut().writer(); stdout.writeAll(msg) catch |err| { std.debug.print("Unable to write to stdout\n", .{}); return err; }; } fn calcPercent(curr: u32, max: u32, percent: []const u8, action: []const u8) !u32 { if (percent[0] == '-') { return ArgError.InvalidSetActionValue; } const percent_value = try fmt.parseInt(u32, percent, 10); const delta = max * percent_value / 100; const new_value = if (mem.eql(u8, action, "inc")) curr + delta else if (mem.eql(u8, action, "dec")) curr - delta else return ArgError.InvalidSetActionValue; const safe_value = if (new_value > max) max else if (new_value < 0) 0 else new_value; return safe_value; } fn writeFile(path: []const u8, value: u32) !void { var file = fs.cwd().openFile(path, .{ .write = true }) catch |err| { std.debug.print("Cannot open {s} with write permissions.\n", .{path}); return err; }; defer file.close(); file.writer().print("{}", .{value}) catch |err| { std.debug.print("Cannot write to {s}.\n", .{path}); return err; }; } fn readFile(path: []const u8) !u32 { var file = fs.cwd().openFile(path, .{}) catch |err| { std.debug.print("Cannot open {s} with read permissions.\n", .{path}); return err; }; defer file.close(); var buf: [128]u8 = undefined; const bytes_read = try file.read(&buf); const trimmed = std.mem.trimRight(u8, buf[0..bytes_read], "\n"); return std.fmt.parseInt(u32, trimmed, 10); } const setBrightness = if (build_options.logind) setBrightnessWithLogind else setBrightnessWithSysfs; fn setBrightnessWithSysfs(class: []const u8, name: []const u8, value: u32) !void { const brightness_path = try std.fs.path.join(allocator, &.{ sys_class_path, class, name, "brightness" }); try writeFile(brightness_path, value); } fn setBrightnessWithLogind(class: []const u8, name: []const u8, value: u32) !void { var bus: ?*c.sd_bus = null; if (c.sd_bus_default_system(&bus) < 0) { return error.DBusConnectError; } defer _ = c.sd_bus_unref(bus); if (c.sd_bus_call_method( bus, "org.freedesktop.login1", "/org/freedesktop/login1/session/auto", "org.freedesktop.login1.Session", "SetBrightness", null, null, "ssu", (try allocator.dupeZ(u8, class)).ptr, (try allocator.dupeZ(u8, name)).ptr, value, ) < 0) { return error.DBusMethodCallError; } }
src/main.zig
const std = @import("std"); const mem = std.mem; const wl = @import("wayland").server.wl; const util = @import("../util.zig"); const server = &@import("../main.zig").server; const Error = @import("../command.zig").Error; const Seat = @import("../Seat.zig"); pub fn outputLayout( allocator: *std.mem.Allocator, seat: *Seat, args: []const [:0]const u8, out: *?[]const u8, ) Error!void { if (args.len < 2) return Error.NotEnoughArguments; if (args.len > 2) return Error.TooManyArguments; const output = seat.focused_output; output.layout_namespace = try util.gpa.dupe(u8, args[1]); output.handleLayoutNamespaceChange(); } pub fn defaultLayout( allocator: *std.mem.Allocator, seat: *Seat, args: []const [:0]const u8, out: *?[]const u8, ) Error!void { if (args.len < 2) return Error.NotEnoughArguments; if (args.len > 2) return Error.TooManyArguments; const old_default_layout_namespace = server.config.default_layout_namespace; server.config.default_layout_namespace = try util.gpa.dupe(u8, args[1]); util.gpa.free(old_default_layout_namespace); var it = server.root.all_outputs.first; while (it) |node| : (it = node.next) { const output = node.data; if (output.layout_namespace == null) output.handleLayoutNamespaceChange(); } } /// riverctl send-layout-cmd rivertile "mod-main-count 1" /// riverctl send-layout-cmd rivertile "mod-main-factor -0.1" /// riverctl send-layout-cmd rivertile "main-location top" pub fn sendLayoutCmd( allocator: *std.mem.Allocator, seat: *Seat, args: []const [:0]const u8, out: *?[]const u8, ) Error!void { if (args.len < 3) return Error.NotEnoughArguments; if (args.len > 3) return Error.TooManyArguments; const output = seat.focused_output; const target_namespace = args[1]; var it = output.layouts.first; const layout = while (it) |node| : (it = node.next) { const layout = &node.data; if (mem.eql(u8, layout.namespace, target_namespace)) break layout; } else return; layout.layout.sendUserCommand(args[2]); output.arrangeViews(); }
source/river-0.1.0/river/command/layout.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day07.txt"); // Type of fuel calculation to use for finding alignment positions. const FuelCalculation = enum { // Fuel cost is the equal to the distance moved Linear, // Fuel cost is the geometric summation of all terms between 1 and the distance moved. GeometricSum, }; // Find the fuel cost of the alignment position with the lowest fuel cost, given the current positions. // Fuel usage will be calculated according to the given algorithm. pub fn findEasiestAlignmentPosition(positions: []const u32, fuel_calculation: FuelCalculation) !u32 { const min = util.sliceMin(u32, positions); const max = util.sliceMax(u32, positions); var minFuel: u32 = std.math.maxInt(u32); var i: u32 = min; cur_align_pos: while (i <= max) : (i += 1) { var fuel: u32 = 0; for (positions) |pos| { const move_distance = util.absCast(@intCast(i32, pos) - @intCast(i32, i)); fuel += switch (fuel_calculation) { .Linear => move_distance, .GeometricSum => util.geometricSummation(move_distance), }; if (fuel >= minFuel) continue :cur_align_pos; } minFuel = fuel; } return minFuel; } pub fn main() !void { defer { const leaks = util.gpa_impl.deinit(); std.debug.assert(!leaks); } var positions = util.List(u32).init(util.gpa); defer positions.deinit(); // Parse initial list of positions var it = util.tokenize(u8, data, ","); while (it.next()) |num_data| { try positions.append(util.parseInt(u32, num_data, 10) catch { return error.InvalidInput; }); } if (positions.items.len == 0) return error.InvalidInput; // Part 1 const align_pt1 = try findEasiestAlignmentPosition(positions.items, .Linear); util.print("Part 1: Alignment with least fuel is: {d}.\n", .{align_pt1}); // Part 2 const align_pt2 = try findEasiestAlignmentPosition(positions.items, .GeometricSum); util.print("Part 2: Alignment with least fuel is: {d}.\n", .{align_pt2}); }
src/day07.zig
const std = @import("std"); const mem = std.mem; const meta = std.meta; usingnamespace @import("../frame.zig"); usingnamespace @import("../primitive_types.zig"); const testing = @import("../testing.zig"); /// STARTUP is sent to a node to initialize a connection. /// /// Described in the protocol spec at §4.1.1. pub const StartupFrame = struct { const Self = @This(); cql_version: CQLVersion, compression: ?CompressionAlgorithm, pub fn write(self: Self, pw: *PrimitiveWriter) !void { var buf: [16]u8 = undefined; const cql_version = try self.cql_version.print(&buf); if (self.compression) |c| { // Always 2 keys _ = try pw.startStringMap(2); _ = try pw.writeString("CQL_VERSION"); _ = try pw.writeString(cql_version); _ = try pw.writeString("COMPRESSION"); switch (c) { .LZ4 => _ = try pw.writeString("lz4"), .Snappy => _ = try pw.writeString("snappy"), } } else { // Always 1 key _ = try pw.startStringMap(1); _ = try pw.writeString("CQL_VERSION"); _ = try pw.writeString(cql_version); } } pub fn read(allocator: *mem.Allocator, pr: *PrimitiveReader) !Self { var frame = Self{ .cql_version = undefined, .compression = null, }; const map = try pr.readStringMap(allocator); // CQL_VERSION is mandatory and the only version supported is 3.0.0 right now. if (map.getEntry("CQL_VERSION")) |entry| { if (!mem.eql(u8, "3.0.0", entry.value)) { return error.InvalidCQLVersion; } frame.cql_version = try CQLVersion.fromString(entry.value); } else { return error.InvalidCQLVersion; } if (map.getEntry("COMPRESSION")) |entry| { if (mem.eql(u8, entry.value, "lz4")) { frame.compression = CompressionAlgorithm.LZ4; } else if (mem.eql(u8, entry.value, "snappy")) { frame.compression = CompressionAlgorithm.Snappy; } else { return error.InvalidCompression; } } return frame; } }; test "startup frame" { var arena = testing.arenaAllocator(); defer arena.deinit(); // read const exp = "\x04\x00\x00\x00\x01\x00\x00\x00\x16\x00\x01\x00\x0b\x43\x51\x4c\x5f\x56\x45\x52\x53\x49\x4f\x4e\x00\x05\x33\x2e\x30\x2e\x30"; const raw_frame = try testing.readRawFrame(&arena.allocator, exp); checkHeader(Opcode.Startup, exp.len, raw_frame.header); var pr = PrimitiveReader.init(); pr.reset(raw_frame.body); const frame = try StartupFrame.read(&arena.allocator, &pr); testing.expectEqual(CQLVersion{ .major = 3, .minor = 0, .patch = 0 }, frame.cql_version); testing.expect(frame.compression == null); // write testing.expectSameRawFrame(frame, raw_frame.header, exp); }
src/frames/startup.zig
const pc_keyboard = @import("../../pc_keyboard.zig"); const us104 = @import("us104.zig"); pub fn mapKeycode(keycode: pc_keyboard.KeyCode, modifiers: pc_keyboard.Modifiers, handle_ctrl: pc_keyboard.HandleControl) pc_keyboard.DecodedKey { switch (keycode) { .BackTick => { if (modifiers.isShifted()) { return .{ .Unicode = "`" }; } else { return .{ .Unicode = "@" }; } }, .Escape => return pc_keyboard.DecodedKey{ .Unicode = "\x1B" }, .Key2 => { if (modifiers.isShifted()) { return .{ .Unicode = "\"" }; } else { return .{ .Unicode = "2" }; } }, .Key6 => { if (modifiers.isShifted()) { return .{ .Unicode = "&" }; } else { return .{ .Unicode = "6" }; } }, .Key7 => { if (modifiers.isShifted()) { return .{ .Unicode = "'" }; } else { return .{ .Unicode = "7" }; } }, .Key8 => { if (modifiers.isShifted()) { return .{ .Unicode = "(" }; } else { return .{ .Unicode = "8" }; } }, .Key9 => { if (modifiers.isShifted()) { return .{ .Unicode = ")" }; } else { return .{ .Unicode = "9" }; } }, .Key0 => { if (modifiers.isShifted()) { return .{ .Unicode = " " }; } else { return .{ .Unicode = "0" }; } }, .Minus => { if (modifiers.isShifted()) { return .{ .Unicode = "=" }; } else { return .{ .Unicode = "-" }; } }, .Equals => { if (modifiers.isShifted()) { return .{ .Unicode = "+" }; } else { return .{ .Unicode = ";" }; } }, .SemiColon => { if (modifiers.isShifted()) { return .{ .Unicode = "*" }; } else { return .{ .Unicode = ":" }; } }, .Quote => { if (modifiers.isShifted()) { return .{ .Unicode = "~" }; } else { return .{ .Unicode = "^" }; } }, else => return us104.mapKeycode(keycode, modifiers, handle_ctrl), } } comptime { @import("std").testing.refAllDecls(@This()); }
src/keycode/layouts/jis109.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const compiler = @import("./compiler.zig"); const _value = @import("./value.zig"); const _vm = @import("./vm.zig"); const VM = _vm.VM; const Value = _value.Value; pub const OpCode = enum(u8) { OP_CONSTANT, OP_NULL, OP_VOID, OP_TRUE, OP_FALSE, OP_POP, OP_COPY, OP_DEFINE_GLOBAL, OP_GET_GLOBAL, OP_SET_GLOBAL, OP_GET_LOCAL, OP_SET_LOCAL, OP_GET_UPVALUE, OP_SET_UPVALUE, OP_GET_SUBSCRIPT, OP_SET_SUBSCRIPT, OP_GET_SUPER, OP_EQUAL, OP_IS, OP_GREATER, OP_LESS, OP_ADD, OP_SUBTRACT, OP_MULTIPLY, OP_DIVIDE, OP_MOD, // OP_BAND, // OP_BOR, // OP_XOR, OP_SHL, OP_SHR, OP_NULL_OR, OP_UNWRAP, OP_NOT, OP_NEGATE, OP_SWAP, OP_JUMP, OP_JUMP_IF_FALSE, OP_LOOP, OP_FOREACH, OP_CALL, OP_INVOKE, OP_SUPER_INVOKE, OP_CLOSURE, OP_CLOSE_UPVALUE, OP_THROW, OP_RETURN, OP_CLASS, OP_OBJECT, OP_INSTANCE, OP_INHERIT, OP_METHOD, OP_PROPERTY, OP_GET_PROPERTY, OP_SET_PROPERTY, OP_ENUM, OP_ENUM_CASE, OP_GET_ENUM_CASE, OP_GET_ENUM_CASE_VALUE, OP_LIST, OP_LIST_APPEND, OP_MAP, OP_SET_MAP, OP_EXPORT, OP_IMPORT, OP_TO_STRING, OP_PRINT, }; /// A chunk of code to execute pub const Chunk = struct { const Self = @This(); pub const max_constants: u24 = 16777215; /// List of opcodes to execute code: std.ArrayList(u32), /// List of lines lines: std.ArrayList(usize), /// List of constants defined in this chunk constants: std.ArrayList(Value), // TODO: correlate opcodes and line number in source code pub fn init(allocator: Allocator) Self { return Self{ .code = std.ArrayList(u32).init(allocator), .constants = std.ArrayList(Value).init(allocator), .lines = std.ArrayList(usize).init(allocator), }; } pub fn deinit(self: *Self) void { self.code.deinit(); self.constants.deinit(); self.lines.deinit(); } pub fn write(self: *Self, code: u32, line: usize) !void { _ = try self.code.append(code); _ = try self.lines.append(line); } pub fn addConstant(self: *Self, vm: ?*VM, value: Value) !u24 { if (vm) |uvm| uvm.push(value); try self.constants.append(value); if (vm) |uvm| _ = uvm.pop(); return @intCast(u24, self.constants.items.len - 1); } };
src/chunk.zig
const std = @import("../../std.zig"); const builtin = @import("builtin"); const windows = std.os.windows; const mem = std.mem; const testing = std.testing; const expect = testing.expect; fn testRemoveDotDirs(str: []const u8, expected: []const u8) !void { const mutable = try testing.allocator.dupe(u8, str); defer testing.allocator.free(mutable); const actual = mutable[0..try windows.removeDotDirsSanitized(u8, mutable)]; try testing.expect(mem.eql(u8, actual, expected)); } fn testRemoveDotDirsError(err: anyerror, str: []const u8) !void { const mutable = try testing.allocator.dupe(u8, str); defer testing.allocator.free(mutable); try testing.expectError(err, windows.removeDotDirsSanitized(u8, mutable)); } test "removeDotDirs" { try testRemoveDotDirs("", ""); try testRemoveDotDirs(".", ""); try testRemoveDotDirs(".\\", ""); try testRemoveDotDirs(".\\.", ""); try testRemoveDotDirs(".\\.\\", ""); try testRemoveDotDirs(".\\.\\.", ""); try testRemoveDotDirs("a", "a"); try testRemoveDotDirs("a\\", "a\\"); try testRemoveDotDirs("a\\b", "a\\b"); try testRemoveDotDirs("a\\.", "a\\"); try testRemoveDotDirs("a\\b\\.", "a\\b\\"); try testRemoveDotDirs("a\\.\\b", "a\\b"); try testRemoveDotDirs(".a", ".a"); try testRemoveDotDirs(".a\\", ".a\\"); try testRemoveDotDirs(".a\\.b", ".a\\.b"); try testRemoveDotDirs(".a\\.", ".a\\"); try testRemoveDotDirs(".a\\.\\.", ".a\\"); try testRemoveDotDirs(".a\\.\\.\\.b", ".a\\.b"); try testRemoveDotDirs(".a\\.\\.\\.b\\", ".a\\.b\\"); try testRemoveDotDirsError(error.TooManyParentDirs, ".."); try testRemoveDotDirsError(error.TooManyParentDirs, "..\\"); try testRemoveDotDirsError(error.TooManyParentDirs, ".\\..\\"); try testRemoveDotDirsError(error.TooManyParentDirs, ".\\.\\..\\"); try testRemoveDotDirs("a\\..", ""); try testRemoveDotDirs("a\\..\\", ""); try testRemoveDotDirs("a\\..\\.", ""); try testRemoveDotDirs("a\\..\\.\\", ""); try testRemoveDotDirs("a\\..\\.\\.", ""); try testRemoveDotDirsError(error.TooManyParentDirs, "a\\..\\.\\.\\.."); try testRemoveDotDirs("a\\..\\.\\.\\b", "b"); try testRemoveDotDirs("a\\..\\.\\.\\b\\", "b\\"); try testRemoveDotDirs("a\\..\\.\\.\\b\\.", "b\\"); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\", "b\\"); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..", ""); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..\\", ""); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..\\.", ""); try testRemoveDotDirsError(error.TooManyParentDirs, "a\\..\\.\\.\\b\\.\\..\\.\\.."); try testRemoveDotDirs("a\\b\\..\\", "a\\"); try testRemoveDotDirs("a\\b\\..\\c", "a\\c"); }
lib/std/os/windows/test.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; const AtomicOrder = builtin.AtomicOrder; test "cmpxchg" { var x: i32 = 1234; if (@cmpxchgWeak(i32, &x, 99, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) |x1| { expect(x1 == 1234); } else { @panic("cmpxchg should have failed"); } while (@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) |x1| { expect(x1 == 1234); } expect(x == 5678); expect(@cmpxchgStrong(i32, &x, 5678, 42, AtomicOrder.SeqCst, AtomicOrder.SeqCst) == null); expect(x == 42); } test "fence" { var x: i32 = 1234; @fence(AtomicOrder.SeqCst); x = 5678; } test "atomicrmw and atomicload" { var data: u8 = 200; testAtomicRmw(&data); expect(data == 42); testAtomicLoad(&data); } fn testAtomicRmw(ptr: *u8) void { const prev_value = @atomicRmw(u8, ptr, AtomicRmwOp.Xchg, 42, AtomicOrder.SeqCst); expect(prev_value == 200); comptime { var x: i32 = 1234; const y: i32 = 12345; expect(@atomicLoad(i32, &x, AtomicOrder.SeqCst) == 1234); expect(@atomicLoad(i32, &y, AtomicOrder.SeqCst) == 12345); } } fn testAtomicLoad(ptr: *u8) void { const x = @atomicLoad(u8, ptr, AtomicOrder.SeqCst); expect(x == 42); } test "cmpxchg with ptr" { var data1: i32 = 1234; var data2: i32 = 5678; var data3: i32 = 9101; var x: *i32 = &data1; if (@cmpxchgWeak(*i32, &x, &data2, &data3, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) |x1| { expect(x1 == &data1); } else { @panic("cmpxchg should have failed"); } while (@cmpxchgWeak(*i32, &x, &data1, &data3, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) |x1| { expect(x1 == &data1); } expect(x == &data3); expect(@cmpxchgStrong(*i32, &x, &data3, &data2, AtomicOrder.SeqCst, AtomicOrder.SeqCst) == null); expect(x == &data2); } // TODO this test is disabled until this issue is resolved: // https://github.com/ziglang/zig/issues/2883 // otherwise cross compiling will result in: // lld: error: undefined symbol: __sync_val_compare_and_swap_16 //test "128-bit cmpxchg" { // var x: u128 align(16) = 1234; // TODO: https://github.com/ziglang/zig/issues/2987 // if (@cmpxchgWeak(u128, &x, 99, 5678, .SeqCst, .SeqCst)) |x1| { // expect(x1 == 1234); // } else { // @panic("cmpxchg should have failed"); // } // // while (@cmpxchgWeak(u128, &x, 1234, 5678, .SeqCst, .SeqCst)) |x1| { // expect(x1 == 1234); // } // expect(x == 5678); // // expect(@cmpxchgStrong(u128, &x, 5678, 42, .SeqCst, .SeqCst) == null); // expect(x == 42); //} test "cmpxchg with ignored result" { var x: i32 = 1234; var ptr = &x; _ = @cmpxchgStrong(i32, &x, 1234, 5678, .Monotonic, .Monotonic); expectEqual(@as(i32, 5678), x); } var a_global_variable = @as(u32, 1234); test "cmpxchg on a global variable" { _ = @cmpxchgWeak(u32, &a_global_variable, 1234, 42, .Acquire, .Monotonic); expectEqual(@as(u32, 42), a_global_variable); } test "atomic load and rmw with enum" { const Value = enum(u8) { a, b, c, }; var x = Value.a; expect(@atomicLoad(Value, &x, .SeqCst) != .b); _ = @atomicRmw(Value, &x, .Xchg, .c, .SeqCst); expect(@atomicLoad(Value, &x, .SeqCst) == .c); expect(@atomicLoad(Value, &x, .SeqCst) != .a); expect(@atomicLoad(Value, &x, .SeqCst) != .b); } test "atomic store" { var x: u32 = 0; @atomicStore(u32, &x, 1, .SeqCst); expect(@atomicLoad(u32, &x, .SeqCst) == 1); @atomicStore(u32, &x, 12345678, .SeqCst); expect(@atomicLoad(u32, &x, .SeqCst) == 12345678); } test "atomic store comptime" { comptime testAtomicStore(); testAtomicStore(); } fn testAtomicStore() void { var x: u32 = 0; @atomicStore(u32, &x, 1, .SeqCst); expect(@atomicLoad(u32, &x, .SeqCst) == 1); @atomicStore(u32, &x, 12345678, .SeqCst); expect(@atomicLoad(u32, &x, .SeqCst) == 12345678); }
test/stage1/behavior/atomics.zig
//! This API non-allocating, non-fallible, and thread-safe. //! The tradeoff is that users of this API must provide the storage //! for each `Progress.Node`. //! //! Initialize the struct directly, overriding these fields as desired: //! * `refresh_rate_ms` //! * `initial_delay_ms` const std = @import("std"); const windows = std.os.windows; const testing = std.testing; const assert = std.debug.assert; const Progress = @This(); /// `null` if the current node (and its children) should /// not print on update() terminal: ?std.fs.File = undefined, /// Whether the terminal supports ANSI escape codes. supports_ansi_escape_codes: bool = false, root: Node = undefined, /// Keeps track of how much time has passed since the beginning. /// Used to compare with `initial_delay_ms` and `refresh_rate_ms`. timer: std.time.Timer = undefined, /// When the previous refresh was written to the terminal. /// Used to compare with `refresh_rate_ms`. prev_refresh_timestamp: u64 = undefined, /// This buffer represents the maximum number of bytes written to the terminal /// with each refresh. output_buffer: [100]u8 = undefined, /// How many nanoseconds between writing updates to the terminal. refresh_rate_ns: u64 = 50 * std.time.ns_per_ms, /// How many nanoseconds to keep the output hidden initial_delay_ns: u64 = 500 * std.time.ns_per_ms, done: bool = true, /// Protects the `refresh` function, as well as `node.recently_updated_child`. /// Without this, callsites would call `Node.end` and then free `Node` memory /// while it was still being accessed by the `refresh` function. update_lock: std.Thread.Mutex = .{}, /// Keeps track of how many columns in the terminal have been output, so that /// we can move the cursor back later. columns_written: usize = undefined, /// Represents one unit of progress. Each node can have children nodes, or /// one can use integers with `update`. pub const Node = struct { context: *Progress, parent: ?*Node, name: []const u8, /// Must be handled atomically to be thread-safe. recently_updated_child: ?*Node = null, /// Must be handled atomically to be thread-safe. 0 means null. unprotected_estimated_total_items: usize, /// Must be handled atomically to be thread-safe. unprotected_completed_items: usize, /// Create a new child progress node. Thread-safe. /// Call `Node.end` when done. /// TODO solve https://github.com/ziglang/zig/issues/2765 and then change this /// API to set `self.parent.recently_updated_child` with the return value. /// Until that is fixed you probably want to call `activate` on the return value. /// Passing 0 for `estimated_total_items` means unknown. pub fn start(self: *Node, name: []const u8, estimated_total_items: usize) Node { return Node{ .context = self.context, .parent = self, .name = name, .unprotected_estimated_total_items = estimated_total_items, .unprotected_completed_items = 0, }; } /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe. pub fn completeOne(self: *Node) void { self.activate(); _ = @atomicRmw(usize, &self.unprotected_completed_items, .Add, 1, .Monotonic); self.context.maybeRefresh(); } /// Finish a started `Node`. Thread-safe. pub fn end(self: *Node) void { self.context.maybeRefresh(); if (self.parent) |parent| { { const held = self.context.update_lock.acquire(); defer held.release(); _ = @cmpxchgStrong(?*Node, &parent.recently_updated_child, self, null, .Monotonic, .Monotonic); } parent.completeOne(); } else { self.context.done = true; self.context.refresh(); } } /// Tell the parent node that this node is actively being worked on. Thread-safe. pub fn activate(self: *Node) void { if (self.parent) |parent| { @atomicStore(?*Node, &parent.recently_updated_child, self, .Release); } } /// Thread-safe. 0 means unknown. pub fn setEstimatedTotalItems(self: *Node, count: usize) void { @atomicStore(usize, &self.unprotected_estimated_total_items, count, .Monotonic); } /// Thread-safe. pub fn setCompletedItems(self: *Node, completed_items: usize) void { @atomicStore(usize, &self.unprotected_completed_items, completed_items, .Monotonic); } }; /// Create a new progress node. /// Call `Node.end` when done. /// TODO solve https://github.com/ziglang/zig/issues/2765 and then change this /// API to return Progress rather than accept it as a parameter. /// `estimated_total_items` value of 0 means unknown. pub fn start(self: *Progress, name: []const u8, estimated_total_items: usize) !*Node { const stderr = std.io.getStdErr(); self.terminal = null; if (stderr.supportsAnsiEscapeCodes()) { self.terminal = stderr; self.supports_ansi_escape_codes = true; } else if (std.builtin.os.tag == .windows and stderr.isTty()) { self.terminal = stderr; } self.root = Node{ .context = self, .parent = null, .name = name, .unprotected_estimated_total_items = estimated_total_items, .unprotected_completed_items = 0, }; self.columns_written = 0; self.prev_refresh_timestamp = 0; self.timer = try std.time.Timer.start(); self.done = false; return &self.root; } /// Updates the terminal if enough time has passed since last update. Thread-safe. pub fn maybeRefresh(self: *Progress) void { const now = self.timer.read(); if (now < self.initial_delay_ns) return; const held = self.update_lock.tryAcquire() orelse return; defer held.release(); // TODO I have observed this to happen sometimes. I think we need to follow Rust's // lead and guarantee monotonically increasing times in the std lib itself. if (now < self.prev_refresh_timestamp) return; if (now - self.prev_refresh_timestamp < self.refresh_rate_ns) return; return self.refreshWithHeldLock(); } /// Updates the terminal and resets `self.next_refresh_timestamp`. Thread-safe. pub fn refresh(self: *Progress) void { const held = self.update_lock.tryAcquire() orelse return; defer held.release(); return self.refreshWithHeldLock(); } fn refreshWithHeldLock(self: *Progress) void { const file = self.terminal orelse return; const prev_columns_written = self.columns_written; var end: usize = 0; if (self.columns_written > 0) { // restore the cursor position by moving the cursor // `columns_written` cells to the left, then clear the rest of the // line if (self.supports_ansi_escape_codes) { end += (std.fmt.bufPrint(self.output_buffer[end..], "\x1b[{d}D", .{self.columns_written}) catch unreachable).len; end += (std.fmt.bufPrint(self.output_buffer[end..], "\x1b[0K", .{}) catch unreachable).len; } else if (std.builtin.os.tag == .windows) winapi: { var info: windows.CONSOLE_SCREEN_BUFFER_INFO = undefined; if (windows.kernel32.GetConsoleScreenBufferInfo(file.handle, &info) != windows.TRUE) unreachable; var cursor_pos = windows.COORD{ .X = info.dwCursorPosition.X - @intCast(windows.SHORT, self.columns_written), .Y = info.dwCursorPosition.Y, }; if (cursor_pos.X < 0) cursor_pos.X = 0; const fill_chars = @intCast(windows.DWORD, info.dwSize.X - cursor_pos.X); var written: windows.DWORD = undefined; if (windows.kernel32.FillConsoleOutputAttribute( file.handle, info.wAttributes, fill_chars, cursor_pos, &written, ) != windows.TRUE) { // Stop trying to write to this file. self.terminal = null; break :winapi; } if (windows.kernel32.FillConsoleOutputCharacterA( file.handle, ' ', fill_chars, cursor_pos, &written, ) != windows.TRUE) unreachable; if (windows.kernel32.SetConsoleCursorPosition(file.handle, cursor_pos) != windows.TRUE) unreachable; } else unreachable; self.columns_written = 0; } if (!self.done) { var need_ellipse = false; var maybe_node: ?*Node = &self.root; while (maybe_node) |node| { if (need_ellipse) { self.bufWrite(&end, "... ", .{}); } need_ellipse = false; const eti = @atomicLoad(usize, &node.unprotected_estimated_total_items, .Monotonic); const completed_items = @atomicLoad(usize, &node.unprotected_completed_items, .Monotonic); if (node.name.len != 0 or eti > 0) { if (node.name.len != 0) { self.bufWrite(&end, "{s}", .{node.name}); need_ellipse = true; } if (eti > 0) { if (need_ellipse) self.bufWrite(&end, " ", .{}); self.bufWrite(&end, "[{d}/{d}] ", .{ completed_items + 1, eti }); need_ellipse = false; } else if (completed_items != 0) { if (need_ellipse) self.bufWrite(&end, " ", .{}); self.bufWrite(&end, "[{d}] ", .{completed_items + 1}); need_ellipse = false; } } maybe_node = @atomicLoad(?*Node, &node.recently_updated_child, .Acquire); } if (need_ellipse) { self.bufWrite(&end, "... ", .{}); } } _ = file.write(self.output_buffer[0..end]) catch |e| { // Stop trying to write to this file once it errors. self.terminal = null; }; self.prev_refresh_timestamp = self.timer.read(); } pub fn log(self: *Progress, comptime format: []const u8, args: anytype) void { const file = self.terminal orelse return; self.refresh(); file.writer().print(format, args) catch { self.terminal = null; return; }; self.columns_written = 0; } fn bufWrite(self: *Progress, end: *usize, comptime format: []const u8, args: anytype) void { if (std.fmt.bufPrint(self.output_buffer[end.*..], format, args)) |written| { const amt = written.len; end.* += amt; self.columns_written += amt; } else |err| switch (err) { error.NoSpaceLeft => { self.columns_written += self.output_buffer.len - end.*; end.* = self.output_buffer.len; }, } const bytes_needed_for_esc_codes_at_end = if (std.builtin.os.tag == .windows) 0 else 11; const max_end = self.output_buffer.len - bytes_needed_for_esc_codes_at_end; if (end.* > max_end) { const suffix = "... "; self.columns_written = self.columns_written - (end.* - max_end) + suffix.len; std.mem.copy(u8, self.output_buffer[max_end..], suffix); end.* = max_end + suffix.len; } } test "basic functionality" { var disable = true; if (disable) { // This test is disabled because it uses time.sleep() and is therefore slow. It also // prints bogus progress data to stderr. return error.SkipZigTest; } var progress = Progress{}; const root_node = try progress.start("", 100); defer root_node.end(); const sub_task_names = [_][]const u8{ "reticulating splines", "adjusting shoes", "climbing towers", "pouring juice", }; var next_sub_task: usize = 0; var i: usize = 0; while (i < 100) : (i += 1) { var node = root_node.start(sub_task_names[next_sub_task], 5); node.activate(); next_sub_task = (next_sub_task + 1) % sub_task_names.len; node.completeOne(); std.time.sleep(5 * std.time.ns_per_ms); node.completeOne(); node.completeOne(); std.time.sleep(5 * std.time.ns_per_ms); node.completeOne(); node.completeOne(); std.time.sleep(5 * std.time.ns_per_ms); node.end(); std.time.sleep(5 * std.time.ns_per_ms); } { var node = root_node.start("this is a really long name designed to activate the truncation code. let's find out if it works", 0); node.activate(); std.time.sleep(10 * std.time.ns_per_ms); progress.refresh(); std.time.sleep(10 * std.time.ns_per_ms); node.end(); } }
lib/std/Progress.zig
const std = @import("std"); const assert = std.debug.assert; const stivale = @import("header.zig"); const log = std.log.scoped(.stivale2); const kernel = @import("../../../../kernel.zig"); const x86_64 = @import("../../../x86_64.zig"); pub const Struct = stivale.Struct; pub const Error = error{ memory_map, higher_half_direct_map, kernel_file, pmrs, rsdp, smp, }; pub fn process_bootloader_information(stivale2_struct: *Struct) Error!void { kernel.sections_in_memory = try process_pmrs(stivale2_struct); log.debug("Process sections in memory", .{}); kernel.file = try process_kernel_file(stivale2_struct); log.debug("Process kernel file in memory", .{}); kernel.cpus = try process_smp(stivale2_struct); log.debug("Process SMP info", .{}); } pub fn find(comptime StructT: type, stivale2_struct: *Struct) ?*align(1) StructT { var tag_opt = get_tag_from_physical(kernel.Physical.Address.new(stivale2_struct.tags)); while (tag_opt) |tag| { if (tag.identifier == StructT.id) { return @ptrCast(*align(1) StructT, tag); } tag_opt = get_tag_from_physical(kernel.Physical.Address.new(tag.next)); } return null; } fn get_tag_from_physical(physical_address: kernel.Physical.Address) ?*align(1) stivale.Tag { return if (kernel.Virtual.initialized) physical_address.access_higher_half(?*align(1) stivale.Tag) else physical_address.access_identity(?*align(1) stivale.Tag); } pub fn process_memory_map(stivale2_struct: *Struct) Error!kernel.Physical.Memory.Map { const memory_map_struct = find(Struct.MemoryMap, stivale2_struct) orelse return Error.memory_map; const memory_map_entries = memory_map_struct.memmap()[0..memory_map_struct.entry_count]; var result = kernel.Physical.Memory.Map{ .usable = &[_]kernel.Physical.Memory.Map.Entry{}, .reclaimable = &[_]kernel.Physical.Memory.Map.Entry{}, .framebuffer = &[_]kernel.Physical.Memory.Region{}, .kernel_and_modules = &[_]kernel.Physical.Memory.Region{}, .reserved = &[_]kernel.Physical.Memory.Region{}, }; // First, it is required to find a spot in memory big enough to host all the memory map entries in a architecture-independent and bootloader-independent way. This is the host entry const host_entry = blk: { for (memory_map_entries) |*entry| { if (entry.type == .usable) { const bitset = kernel.Physical.Memory.Map.Entry.get_bitset_from_address_and_size(kernel.Physical.Address.new(entry.address), entry.size); const bitset_size = bitset.len * @sizeOf(kernel.Physical.Memory.Map.Entry.BitsetBaseType); // INFO: this is separated since the bitset needs to be in a different page than the memory map const bitset_page_count = kernel.bytes_to_pages(bitset_size, false); // Allocate a bit more memory than needed just in case const memory_map_allocation_size = memory_map_struct.entry_count * @sizeOf(kernel.Physical.Memory.Map.Entry); const memory_map_page_count = kernel.bytes_to_pages(memory_map_allocation_size, false); const total_allocated_page_count = bitset_page_count + memory_map_page_count; const total_allocation_size = kernel.arch.page_size * total_allocated_page_count; kernel.assert(@src(), entry.size > total_allocation_size); result.usable = @intToPtr([*]kernel.Physical.Memory.Map.Entry, entry.address + kernel.align_forward(bitset_size, kernel.arch.page_size))[0..1]; var block = &result.usable[0]; block.* = kernel.Physical.Memory.Map.Entry{ .descriptor = kernel.Physical.Memory.Region{ .address = kernel.Physical.Address.new(entry.address), .size = entry.size, }, .allocated_size = total_allocation_size, .type = .usable, }; block.setup_bitset(); break :blk block; } } @panic("There is no memory map entry big enough to store the memory map entries"); }; // The counter starts with one because we have already filled the memory map with the host entry for (memory_map_entries) |*entry| { if (entry.type == .usable) { if (entry.address == host_entry.descriptor.address.value) continue; const index = result.usable.len; result.usable.len += 1; var result_entry = &result.usable[index]; result_entry.* = kernel.Physical.Memory.Map.Entry{ .descriptor = kernel.Physical.Memory.Region{ .address = kernel.Physical.Address.new(entry.address), .size = entry.size, }, .allocated_size = 0, .type = .usable, }; const bitset = result_entry.get_bitset(); const bitset_size = bitset.len * @sizeOf(kernel.Physical.Memory.Map.Entry.BitsetBaseType); result_entry.allocated_size = kernel.align_forward(bitset_size, kernel.arch.page_size); result_entry.setup_bitset(); } } result.reclaimable.ptr = @intToPtr(@TypeOf(result.reclaimable.ptr), @ptrToInt(result.usable.ptr) + (@sizeOf(kernel.Physical.Memory.Map.Entry) * result.usable.len)); for (memory_map_entries) |*entry| { if (entry.type == .bootloader_reclaimable) { const index = result.reclaimable.len; result.reclaimable.len += 1; var result_entry = &result.reclaimable[index]; result_entry.* = kernel.Physical.Memory.Map.Entry{ .descriptor = kernel.Physical.Memory.Region{ .address = kernel.Physical.Address.new(entry.address), .size = entry.size, }, .allocated_size = 0, .type = .reclaimable, }; // Don't use the bitset here because it would imply using memory that may not be usable at the moment of writing the bitset to this region } } result.framebuffer.ptr = @intToPtr(@TypeOf(result.framebuffer.ptr), @ptrToInt(result.reclaimable.ptr) + (@sizeOf(kernel.Physical.Memory.Map.Entry) * result.reclaimable.len)); for (memory_map_entries) |*entry| { if (entry.type == .framebuffer) { const index = result.framebuffer.len; result.framebuffer.len += 1; var result_entry = &result.framebuffer[index]; result_entry.* = kernel.Physical.Memory.Region{ .address = kernel.Physical.Address.new(entry.address), .size = entry.size, }; // Don't use the bitset here because it would imply using memory that may not be usable at the moment of writing the bitset to this region } } result.kernel_and_modules.ptr = @intToPtr(@TypeOf(result.kernel_and_modules.ptr), @ptrToInt(result.framebuffer.ptr) + (@sizeOf(kernel.Physical.Memory.Region) * result.framebuffer.len)); for (memory_map_entries) |*entry| { if (entry.type == .kernel_and_modules) { const index = result.kernel_and_modules.len; result.kernel_and_modules.len += 1; var result_entry = &result.kernel_and_modules[index]; result_entry.* = kernel.Physical.Memory.Region{ .address = kernel.Physical.Address.new(entry.address), .size = entry.size, }; // Don't use the bitset here because it would imply using memory that may not be usable at the moment of writing the bitset to this region } } kernel.assert(@src(), result.kernel_and_modules.len == 1); result.reserved.ptr = @intToPtr(@TypeOf(result.reserved.ptr), @ptrToInt(result.kernel_and_modules.ptr) + (@sizeOf(kernel.Physical.Memory.Region) * result.kernel_and_modules.len)); for (memory_map_entries) |*entry| { if (entry.type == .reserved) { const index = result.reserved.len; result.reserved.len += 1; var result_entry = &result.reserved[index]; result_entry.* = kernel.Physical.Memory.Region{ .address = kernel.Physical.Address.new(entry.address), .size = entry.size, }; // Don't use the bitset here because it would imply using memory that may not be usable at the moment of writing the bitset to this region } } log.debug("Memory map initialized", .{}); return result; } pub fn process_higher_half_direct_map(stivale2_struct: *Struct) Error!kernel.Virtual.Address { const hhdm_struct = find(Struct.HHDM, stivale2_struct) orelse return Error.higher_half_direct_map; log.debug("HHDM: 0x{x}", .{hhdm_struct.addr}); return kernel.Virtual.Address.new(hhdm_struct.addr); } pub fn process_pmrs(stivale2_struct: *Struct) Error![]kernel.Virtual.Memory.RegionWithPermissions { log.debug("Here", .{}); const pmrs_struct = find(stivale.Struct.PMRs, stivale2_struct) orelse return Error.pmrs; log.debug("PMRS struct: 0x{x}", .{@ptrToInt(pmrs_struct)}); const pmrs = pmrs_struct.pmrs()[0..pmrs_struct.entry_count]; if (pmrs.len == 0) return Error.pmrs; log.debug("past this", .{}); kernel.assert(@src(), kernel.Virtual.initialized); const kernel_section_allocation_size = kernel.align_forward(@sizeOf(kernel.Virtual.Memory.RegionWithPermissions) * pmrs.len, kernel.arch.page_size); const kernel_section_allocation = kernel.address_space.allocate(kernel_section_allocation_size) orelse return Error.pmrs; const kernel_sections = kernel_section_allocation.access([*]kernel.Virtual.Memory.RegionWithPermissions)[0..pmrs.len]; for (pmrs) |pmr, i| { const kernel_section = &kernel_sections[i]; kernel_section.descriptor.address = kernel.Virtual.Address.new(pmr.address); kernel_section.descriptor.size = pmr.size; const permissions = pmr.permissions; kernel_section.read = permissions & (1 << stivale.Struct.PMRs.PMR.readable) != 0; kernel_section.write = permissions & (1 << stivale.Struct.PMRs.PMR.writable) != 0; kernel_section.execute = permissions & (1 << stivale.Struct.PMRs.PMR.executable) != 0; } return kernel_sections; } pub fn get_pmrs(stivale2_struct: *Struct) []Struct.PMRs.PMR { const pmrs_struct = find(stivale.Struct.PMRs, stivale2_struct) orelse unreachable; const pmrs = pmrs_struct.pmrs()[0..pmrs_struct.entry_count]; return pmrs; } /// This procedure copies the kernel file in a region which is usable and whose allocationcan be registered in the physical allocator bitset pub fn process_kernel_file(stivale2_struct: *Struct) Error!kernel.File { kernel.assert(@src(), kernel.Virtual.initialized); const kernel_file = find(stivale.Struct.KernelFileV2, stivale2_struct) orelse return Error.kernel_file; const file_address = kernel.Physical.Address.new(kernel_file.kernel_file); const file_size = kernel_file.kernel_size; const allocation = kernel.address_space.allocate(kernel.align_forward(file_size, kernel.arch.page_size)) orelse return Error.kernel_file; const dst = allocation.access([*]u8)[0..file_size]; const src = file_address.access_higher_half([*]u8)[0..file_size]; log.debug("Copying kernel file to (0x{x}, 0x{x})", .{ @ptrToInt(dst.ptr), @ptrToInt(dst.ptr) + dst.len }); kernel.copy(u8, dst, src); return kernel.File{ .address = allocation, .size = file_size, }; } pub fn process_rsdp(stivale2_struct: *Struct) Error!kernel.Physical.Address { const rsdp_struct = find(stivale.Struct.RSDP, stivale2_struct) orelse return Error.rsdp; const rsdp = rsdp_struct.rsdp; log.debug("RSDP struct: 0x{x}", .{rsdp}); const rsdp_address = kernel.Physical.Address.new(rsdp); return rsdp_address; } pub fn process_smp(stivale2_struct: *Struct) Error![]kernel.arch.CPU { kernel.assert(@src(), kernel.Virtual.initialized); const smp_struct = find(stivale.Struct.SMP, stivale2_struct) orelse return Error.smp; log.debug("SMP struct: {}", .{smp_struct}); const page_count = kernel.bytes_to_pages(smp_struct.cpu_count * @sizeOf(kernel.arch.CPU), false); const allocation = kernel.Physical.Memory.allocate_pages(page_count) orelse return Error.smp; const cpus = allocation.access_higher_half([*]kernel.arch.CPU)[0..smp_struct.cpu_count]; const smps = smp_struct.smp_info()[0..smp_struct.cpu_count]; kernel.assert(@src(), smps[0].lapic_id == smp_struct.bsp_lapic_id); cpus[0].is_bootstrap = true; for (smps) |smp, cpu_index| { const cpu = &cpus[cpu_index]; cpu.lapic_id = smp.lapic_id; } return cpus; }
src/kernel/arch/x86_64/limine/stivale2/stivale2.zig
usingnamespace @import("common.zig"); pub const Camera = struct { transform: Transform, aspect: f32, fov: f32, near: f32, far: f32, pub fn viewProjection(self: Camera) Float4x4 { const model_matrix = self.transform.toMatrix(); const forward = f4tof3(model_matrix.rows[2]); const view = lookForward(self.transform.position, forward, .{0, 1, 0}); const proj = perspective(self.fov, self.aspect, self.near, self.far); return mulmf44(proj, view); } }; pub const EditorCameraState = packed struct { const Self = @This(); moving_forward: bool = false, moving_backward: bool = false, moving_left: bool = false, moving_right: bool = false, moving_up: bool = false, moving_down: bool = false, __pad0: u26 = 0, pub fn set(self: *Self, flags: Self) void { self.* = @bitCast(Self, @bitCast(u32, self.*) | @bitCast(u32, flags)); } pub fn unset(self: *Self, flags: Self) void { self.* = @bitCast(Self, @bitCast(u32, self.*) & ~@bitCast(u32, flags)); } pub fn isMoving(self: Self) bool { return @bitCast(u32, self) != 0; } }; pub const EditorCameraController = struct { const Self = @This(); speed: f32, state: EditorCameraState = .{}, total_mouse_dx: i32 = 0, total_mouse_dy: i32 = 0, pub fn newFrame(self: *Self) void { self.total_mouse_dx = 0; self.total_mouse_dy = 0; } pub fn handleEvent(editor: *Self, event: sdl.Event) void { switch (event.type) { .KEYDOWN, .KEYUP => { const keysym = event.key.keysym; var state_delta: EditorCameraState = .{}; switch (keysym.scancode) { .W => state_delta.moving_forward = true, .A => state_delta.moving_left = true, .S => state_delta.moving_backward = true, .D => state_delta.moving_right = true, else => {}, } switch (event.type) { .KEYDOWN => editor.state.set(state_delta), .KEYUP => editor.state.unset(state_delta), else => unreachable, } }, .MOUSEMOTION => { const mouse_motion = &event.motion; const button_state = mouse_motion.state; if (button_state != 0) { editor.total_mouse_dx += mouse_motion.xrel; editor.total_mouse_dy += mouse_motion.yrel; } }, else => {}, } } pub fn updateCamera(editor: *const Self, delta_time_seconds: f32, cam: *Camera) void { if (editor.state.isMoving()) { const mat = cam.transform.toMatrix(); const right = f4tof3(mat.rows[0]); const up = f4tof3(mat.rows[1]); const forward = f4tof3(mat.rows[2]); const delta_speed = @splat(3, editor.speed * delta_time_seconds); var velocity: VFloat3 = VFloat3{0, 0, 0}; if (editor.state.moving_forward) { velocity -= forward * delta_speed; } if (editor.state.moving_backward) { velocity += forward * delta_speed; } if (editor.state.moving_left) { velocity -= right * delta_speed; } if (editor.state.moving_right) { velocity += right * delta_speed; } cam.transform.translate(velocity); } const pixel_angle = 0.00095; cam.transform.rotation[1] -= @intToFloat(f32, editor.total_mouse_dx) * pixel_angle; cam.transform.rotation[0] += @intToFloat(f32, editor.total_mouse_dy) * pixel_angle; const limit = std.math.pi / 2.0 * 0.99; cam.transform.rotation[0] = std.math.clamp(cam.transform.rotation[0], -limit, limit); } };
src/camera.zig
const std = @import("std"); const c = @cImport(@cInclude("rocksdb/c.h")); const testing = std.testing; const o = @import("ops.zig"); pub const root_key = ".root"; pub const node_key_prefix = "@1:"; const default_db_dir = "./db"; pub const RocksDataBbase = DB(RocksDB); pub fn DB(comptime T: type) type { return struct { const Self = @This(); db: T, pub fn init(dir: ?[]const u8) !Self { var ctx: Self = undefined; ctx.db = try T.init(dir); return ctx; } pub fn deinit(self: Self) void { self.db.deinit(); } pub fn put(self: Self, key: []const u8, val: []const u8) void { self.db.put(key, val); } pub fn clear(self: Self) void { self.db.clear(); } pub fn commit(self: Self) !void { try self.db.commit(); } pub fn read(self: Self, key: []const u8, w: anytype) !usize { return try self.db.read(key, w); } pub fn destroy(self: Self, dir: ?[]const u8) void { self.db.destroy(dir); } pub fn createSnapshot(self: Self) ?*const c.rocksdb_snapshot_t { return self.db.createSnapshot(); } pub fn releaseSnapshot(self: Self, snapshot: ?* const c.rocksdb_snapshot_t) void { self.db.releaseSnapshot(snapshot); } pub fn readSnapshot(self: Self, snapshot: ?*const c.rocksdb_snapshot_t, key: []const u8, w: anytype) !usize { return self.db.readSnapshot(snapshot, key, w); } }; } pub const RocksDB = struct { db: ?*c.rocksdb_t, batch: ?*c.rocksdb_writebatch_t, pub fn init(dir: ?[]const u8) !RocksDB { var rockdb: RocksDB = undefined; const opts = c.rocksdb_options_create(); defer c.rocksdb_options_destroy(opts); c.rocksdb_options_optimize_level_style_compaction(opts, @boolToInt(false)); c.rocksdb_options_set_create_if_missing(opts, @boolToInt(true)); c.rocksdb_options_set_max_write_buffer_number(opts, 100_000); // c.rocksdb_options_set_level0_slowdown_writes_trigger(opts, 16); // c.rocksdb_options_set_level0_file_num_compaction_trigger(opts, 16); c.rocksdb_options_set_soft_pending_compaction_bytes_limit(opts, 50_000_000); c.rocksdb_options_set_hard_pending_compaction_bytes_limit(opts, 100_000_000); c.rocksdb_options_set_max_background_flushes(opts, 4); c.rocksdb_options_set_max_background_compactions(opts, 8); // c.rocksdb_options_set_level_compaction_dynamic_level_bytes(opts, @boolToInt(true)); // c.rocksdb_options_set_bytes_per_sync(opts, 1048576); // bloom filter option // https://github.com/facebook/rocksdb/wiki/RocksDB-Bloom-Filter const block_ops = c.rocksdb_block_based_options_create(); const bloom = c.rocksdb_filterpolicy_create_bloom_full(10); c.rocksdb_block_based_options_set_filter_policy(block_ops, bloom); c.rocksdb_block_based_options_set_cache_index_and_filter_blocks(block_ops, @boolToInt(true)); // const lru = c.rocksdb_cache_create_lru(10_000); // c.rocksdb_block_based_options_set_block_cache(block_ops, lru); // c.rocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache(block_ops, @boolToInt(true)); // c.rocksdb_block_based_options_set_block_size(block_ops, 16 * 1024); c.rocksdb_options_set_block_based_table_factory(opts, block_ops); var err: ?[*:0]u8 = null; const name = if (dir) |d| @ptrCast([*:0]const u8, d) else default_db_dir; rockdb.db = c.rocksdb_open(opts, @ptrCast([*:0]const u8, name), &err); if (err) |message| { std.debug.print("failed to open rockdb, {}\n", .{std.mem.spanZ(message)}); return error.FaildOpen; } // create batch rockdb.batch = c.rocksdb_writebatch_create(); return rockdb; } pub fn deinit(self: RocksDB) void { c.rocksdb_writebatch_destroy(self.batch); c.rocksdb_close(self.db); } pub fn put(self: RocksDB, key: []const u8, val: []const u8) void { c.rocksdb_writebatch_put(self.batch, @ptrCast([*]const u8, key), key.len, @ptrCast([*]const u8, val), val.len); } pub fn clear(self: RocksDB) void { c.rocksdb_writebatch_clear(self.batch); } pub fn commit(self: RocksDB) !void { c.rocksdb_writebatch_set_save_point(self.batch); const write_opts = c.rocksdb_writeoptions_create(); c.rocksdb_writeoptions_disable_WAL(write_opts, @boolToInt(true)); c.rocksdb_writeoptions_set_no_slowdown(write_opts, @boolToInt(true)); var err: ?[*:0]u8 = null; c.rocksdb_write(self.db, write_opts, self.batch, &err); if (err) |message| { std.debug.print("faild to commit to rockdb, {}\n", .{std.mem.spanZ(message)}); return error.FaildCommit; } } pub fn read(self: RocksDB, key: []const u8, w: anytype) !usize { const read_opts = c.rocksdb_readoptions_create(); defer c.rocksdb_readoptions_destroy(read_opts); var read_len: usize = undefined; var err: ?[*:0]u8 = null; const c_key = @ptrCast([*:0]const u8, key); var read_ptr = c.rocksdb_get(self.db, read_opts, c_key, key.len, &read_len, &err); if (err) |message| { std.debug.print("faild to read from rockdb, {}\n", .{std.mem.spanZ(message)}); return error.FailedRead; } if (read_len == 0) return 0; defer std.c.free(read_ptr); try w.writeAll(read_ptr[0..read_len]); return read_len; } pub fn destroy(self: RocksDB, dir: ?[]const u8) void { const opts = c.rocksdb_options_create(); var err: ?[*:0]u8 = null; const name = if (dir) |d| @ptrCast([*:0]const u8, d) else default_db_dir; c.rocksdb_destroy_db(opts, name, &err); if (err) |message| { std.debug.print("faild to destroy rockdb, {}\n", .{std.mem.spanZ(message)}); } } pub fn createSnapshot(self: RocksDB) ?*const c.rocksdb_snapshot_t { return c.rocksdb_create_snapshot(self.db); } pub fn releaseSnapshot(self: RocksDB, snapshot: ?*const c.rocksdb_snapshot_t) void { c.rocksdb_release_snapshot(self.db, snapshot); } pub fn readSnapshot(self: RocksDB, snapshot: ?*const c.rocksdb_snapshot_t, key: []const u8, w: anytype) !usize { const read_opts = c.rocksdb_readoptions_create(); defer c.rocksdb_readoptions_destroy(read_opts); c.rocksdb_readoptions_set_snapshot(read_opts, snapshot); var read_len: usize = undefined; var err: ?[*:0]u8 = null; const c_key = @ptrCast([*:0]const u8, key); var read_ptr = c.rocksdb_get(self.db, read_opts, c_key, key.len, &read_len, &err); if (err) |message| { std.debug.print("faild to read from rockdb, {}\n", .{std.mem.spanZ(message)}); return error.FailedRead; } if (read_len == 0) return 0; defer std.c.free(read_ptr); try w.writeAll(read_ptr[0..read_len]); return read_len; } }; test "init" { var db = try DB(RocksDB).init("dbtest"); defer db.destroy("dbtest"); defer db.deinit(); var key = "testkey"; var value = "testvalue"; db.put(key, value); try db.commit(); var buf: [1024]u8 = undefined; var fbs = std.io.fixedBufferStream(&buf); _ = try db.read(key, fbs.writer()); testing.expectEqualSlices(u8, fbs.getWritten(), value); } test "snapshot" { var buf: [1024]u8 = undefined; var fbs = std.io.fixedBufferStream(&buf); var db = try DB(RocksDB).init("dbtest"); defer db.destroy("dbtest"); defer db.deinit(); // commit first value var key = "snapshotkey"; var value1 = "first"; db.put(key, value1); try db.commit(); // take snapshot const snapshot = db.createSnapshot(); defer db.releaseSnapshot(snapshot); // commit second value db.clear(); var value2 = "second"; db.put(key, value2); try db.commit(); _ = try db.readSnapshot(snapshot, key, fbs.writer()); testing.expectEqualSlices(u8, fbs.getWritten(), value1); fbs.reset(); _ = try db.read(key, fbs.writer()); testing.expectEqualSlices(u8, fbs.getWritten(), value2); }
src/db.zig
const std = @import("std"); const yaml = @import("yaml"); const c = @cImport({ @cInclude("yaml.h"); }); const u = @import("./index.zig"); // // const Array = []const []const u8; pub const Stream = struct { docs: []const Document, }; pub const Document = struct { mapping: Mapping, }; pub const Item = union(enum) { event: Token, kv: Key, mapping: Mapping, sequence: Sequence, document: Document, string: []const u8, stream: Stream, pub fn format(self: Item, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void { _ = fmt; _ = options; try writer.writeAll("Item{"); switch (self) { .event => { try std.fmt.format(writer, "{s}", .{@tagName(self.event.type)}); }, .kv, .document, .stream => { unreachable; }, .mapping => { try std.fmt.format(writer, "{}", .{self.mapping}); }, .sequence => { try writer.writeAll("[ "); for (self.sequence) |it| { try std.fmt.format(writer, "{}, ", .{it}); } try writer.writeAll("]"); }, .string => { try std.fmt.format(writer, "{s}", .{self.string}); }, } try writer.writeAll("}"); } }; pub const Sequence = []const Item; pub const Key = struct { key: []const u8, value: Value, }; pub const Value = union(enum) { string: []const u8, mapping: Mapping, sequence: Sequence, pub fn format(self: Value, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void { _ = fmt; _ = options; try writer.writeAll("Value{"); switch (self) { .string => { try std.fmt.format(writer, "{s}", .{self.string}); }, .mapping => { try std.fmt.format(writer, "{}", .{self.mapping}); }, .sequence => { try writer.writeAll("[ "); for (self.sequence) |it| { try std.fmt.format(writer, "{}, ", .{it}); } try writer.writeAll("]"); }, } try writer.writeAll("}"); } }; pub const Mapping = struct { items: []const Key, pub fn get(self: Mapping, k: []const u8) ?Value { for (self.items) |item| { if (std.mem.eql(u8, item.key, k)) { return item.value; } } return null; } pub fn get_string(self: Mapping, k: []const u8) []const u8 { return if (self.get(k)) |v| v.string else ""; } pub fn get_string_array(self: Mapping, alloc: *std.mem.Allocator, k: []const u8) ![][]const u8 { const list = &std.ArrayList([]const u8).init(alloc); defer list.deinit(); if (self.get(k)) |val| { if (val == .sequence) { for (val.sequence) |item| { if (item != .string) { continue; } try list.append(item.string); } } } return list.toOwnedSlice(); } pub fn format(self: Mapping, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void { _ = fmt; _ = options; try writer.writeAll("{ "); for (self.items) |it| { try std.fmt.format(writer, "{s}: ", .{it.key}); try std.fmt.format(writer, "{}, ", .{it.value}); } try writer.writeAll("}"); } }; pub const Token = c.yaml_event_t; pub const TokenList = []const Token; // // pub fn parse(alloc: *std.mem.Allocator, input: []const u8) !Document { var parser: c.yaml_parser_t = undefined; _ = c.yaml_parser_initialize(&parser); const lines = try u.split(input, "\n"); _ = c.yaml_parser_set_input_string(&parser, input.ptr, input.len); const all_events = &std.ArrayList(Token).init(alloc); var event: Token = undefined; while (true) { const p = c.yaml_parser_parse(&parser, &event); if (p == 0) { break; } const et = event.type; try all_events.append(event); c.yaml_event_delete(&event); if (et == c.YAML_STREAM_END_EVENT) { break; } } c.yaml_parser_delete(&parser); const p = &Parser{ .alloc = alloc, .tokens = all_events.items, .lines = lines, .index = 0, }; const stream = try p.parse(); return stream.docs[0]; } pub const Parser = struct { alloc: *std.mem.Allocator, tokens: TokenList, lines: Array, index: usize, pub fn parse(self: *Parser) !Stream { const item = try parse_item(self, null); return item.stream; } fn next(self: *Parser) ?Token { if (self.index >= self.tokens.len) { return null; } defer self.index += 1; return self.tokens[self.index]; } }; pub const Error = std.mem.Allocator.Error || error{YamlUnexpectedToken}; fn parse_item(p: *Parser, start: ?Token) Error!Item { const tok = start orelse p.next(); return switch (tok.?.type) { c.YAML_STREAM_START_EVENT => Item{ .stream = try parse_stream(p) }, c.YAML_DOCUMENT_START_EVENT => Item{ .document = try parse_document(p) }, c.YAML_MAPPING_START_EVENT => Item{ .mapping = try parse_mapping(p) }, c.YAML_SEQUENCE_START_EVENT => Item{ .sequence = try parse_sequence(p) }, c.YAML_SCALAR_EVENT => Item{ .string = get_event_string(tok.?, p.lines) }, else => unreachable, }; } fn parse_stream(p: *Parser) Error!Stream { const res = &std.ArrayList(Document).init(p.alloc); defer res.deinit(); while (true) { const tok = p.next(); if (tok.?.type == c.YAML_STREAM_END_EVENT) { return Stream{ .docs = res.toOwnedSlice() }; } if (tok.?.type != c.YAML_DOCUMENT_START_EVENT) { return error.YamlUnexpectedToken; } const item = try parse_item(p, tok); try res.append(item.document); } } fn parse_document(p: *Parser) Error!Document { const tok = p.next(); if (tok.?.type != c.YAML_MAPPING_START_EVENT) { return error.YamlUnexpectedToken; } const item = try parse_item(p, tok); if (p.next().?.type != c.YAML_DOCUMENT_END_EVENT) { return error.YamlUnexpectedToken; } return Document{ .mapping = item.mapping }; } fn parse_mapping(p: *Parser) Error!Mapping { const res = &std.ArrayList(Key).init(p.alloc); defer res.deinit(); while (true) { const tok = p.next(); if (tok.?.type == c.YAML_MAPPING_END_EVENT) { return Mapping{ .items = res.toOwnedSlice() }; } if (tok.?.type != c.YAML_SCALAR_EVENT) { return error.YamlUnexpectedToken; } try res.append(Key{ .key = get_event_string(tok.?, p.lines), .value = try parse_value(p), }); } } fn parse_value(p: *Parser) Error!Value { const item = try parse_item(p, null); return switch (item) { .mapping => |x| Value{ .mapping = x }, .sequence => |x| Value{ .sequence = x }, .string => |x| Value{ .string = x }, else => unreachable, }; } fn parse_sequence(p: *Parser) Error!Sequence { const res = &std.ArrayList(Item).init(p.alloc); defer res.deinit(); while (true) { const tok = p.next(); if (tok.?.type == c.YAML_SEQUENCE_END_EVENT) { return res.toOwnedSlice(); } try res.append(try parse_item(p, tok)); } } fn get_event_string(event: Token, lines: Array) []const u8 { const sm = event.start_mark; const em = event.end_mark; return lines[sm.line][sm.column..em.column]; }
src/util/yaml.zig
const std = @import("std"); const vkgen = @import("generator/index.zig"); const Step = std.build.Step; const Builder = std.build.Builder; pub const ResourceGenStep = struct { step: Step, shader_step: *vkgen.ShaderCompileStep, builder: *Builder, package: std.build.Pkg, output_file: std.build.GeneratedFile, resources: std.ArrayList(u8), pub fn init(builder: *Builder, out: []const u8) *ResourceGenStep { const self = builder.allocator.create(ResourceGenStep) catch unreachable; const full_out_path = std.fs.path.join(builder.allocator, &[_][]const u8{ builder.build_root, builder.cache_root, out, }) catch unreachable; self.* = .{ .step = Step.init(.custom, "resources", builder.allocator, make), .shader_step = vkgen.ShaderCompileStep.init(builder, &[_][]const u8{ "glslc", "--target-env=vulkan1.2" }, "shaders"), .builder = builder, .package = .{ .name = "resources", .source = .{ .generated = &self.output_file }, .dependencies = null, }, .output_file = .{ .step = &self.step, .path = full_out_path, }, .resources = std.ArrayList(u8).init(builder.allocator), }; self.step.dependOn(&self.shader_step.step); return self; } fn renderPath(path: []const u8, writer: anytype) void { const separators = &[_]u8{ std.fs.path.sep_windows, std.fs.path.sep_posix }; var i: usize = 0; while (std.mem.indexOfAnyPos(u8, path, i, separators)) |j| { writer.writeAll(path[i..j]) catch unreachable; switch (std.fs.path.sep) { std.fs.path.sep_windows => writer.writeAll("\\\\") catch unreachable, std.fs.path.sep_posix => writer.writeByte(std.fs.path.sep_posix) catch unreachable, else => unreachable, } i = j + 1; } writer.writeAll(path[i..]) catch unreachable; } pub fn addShader(self: *ResourceGenStep, name: []const u8, source: []const u8) void { const shader_out_path = self.shader_step.add(source); var writer = self.resources.writer(); writer.print("pub const {s} = @embedFile(\"", .{name}) catch unreachable; renderPath(shader_out_path, writer); writer.writeAll("\");\n") catch unreachable; } fn make(step: *Step) !void { const self = @fieldParentPtr(ResourceGenStep, "step", step); const cwd = std.fs.cwd(); const dir = std.fs.path.dirname(self.output_file.path.?).?; try cwd.makePath(dir); try cwd.writeFile(self.output_file.path.?, self.resources.items); } }; pub fn build(b: *Builder) void { var test_step = b.step("test", "Run all the tests"); test_step.dependOn(&b.addTest("generator/index.zig").step); const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const generator_exe = b.addExecutable("vulkan-zig-generator", "generator/main.zig"); generator_exe.setTarget(target); generator_exe.setBuildMode(mode); generator_exe.install(); const triangle_exe = b.addExecutable("triangle", "examples/triangle.zig"); triangle_exe.setTarget(target); triangle_exe.setBuildMode(mode); triangle_exe.install(); triangle_exe.linkLibC(); triangle_exe.linkSystemLibrary("glfw"); const vk_xml_path = b.option([]const u8, "vulkan-registry", "Override the path to the Vulkan registry") orelse "examples/vk.xml"; const gen = vkgen.VkGenerateStep.init(b, vk_xml_path, "vk.zig"); triangle_exe.addPackage(gen.package); const res = ResourceGenStep.init(b, "resources.zig"); res.addShader("triangle_vert", "examples/shaders/triangle.vert"); res.addShader("triangle_frag", "examples/shaders/triangle.frag"); triangle_exe.addPackage(res.package); const triangle_run_cmd = triangle_exe.run(); triangle_run_cmd.step.dependOn(b.getInstallStep()); const triangle_run_step = b.step("run-triangle", "Run the triangle example"); triangle_run_step.dependOn(&triangle_run_cmd.step); }
build.zig
const uefi = @import("std").os.uefi; const Event = uefi.Event; const Guid = uefi.Guid; /// Character input devices, e.g. Keyboard pub const SimpleTextInputExProtocol = extern struct { _reset: extern fn (*const SimpleTextInputExProtocol, bool) usize, _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize, wait_for_key_ex: Event, _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) usize, _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize, _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize, /// Resets the input device hardware. pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) usize { return self._reset(self, verify); } /// Reads the next keystroke from the input device. pub fn readKeyStrokeEx(self: *const SimpleTextInputExProtocol, key_data: *KeyData) usize { return self._read_key_stroke_ex(self, key_data); } /// Set certain state for the input device. pub fn setState(self: *const SimpleTextInputExProtocol, state: *const u8) usize { return self._set_state(self, state); } /// Register a notification function for a particular keystroke for the input device. pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: extern fn (*const KeyData) usize, handle: **c_void) usize { return self._register_key_notify(self, key_data, notify, handle); } /// Remove the notification that was previously registered. pub fn unregisterKeyNotify(self: *const SimpleTextInputExProtocol, handle: *const c_void) usize { return self._unregister_key_notify(self, handle); } pub const guid align(8) = Guid{ .time_low = 0xdd9e7534, .time_mid = 0x7762, .time_high_and_version = 0x4698, .clock_seq_high_and_reserved = 0x8c, .clock_seq_low = 0x14, .node = [_]u8{ 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa }, }; }; pub const KeyData = extern struct { key: InputKey = undefined, key_state: KeyState = undefined, }; pub const KeyState = extern struct { key_shift_state: packed struct { right_shift_pressed: bool, left_shift_pressed: bool, right_control_pressed: bool, left_control_pressed: bool, right_alt_pressed: bool, left_alt_pressed: bool, right_logo_pressed: bool, left_logo_pressed: bool, menu_key_pressed: bool, sys_req_pressed: bool, _pad1: u21, shift_state_valid: bool, }, key_toggle_state: packed struct { scroll_lock_active: bool, num_lock_active: bool, caps_lock_active: bool, _pad1: u3, key_state_exposed: bool, toggle_state_valid: bool, }, }; pub const InputKey = extern struct { scan_code: u16, unicode_char: u16, };
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig
const std = @import("std"); const heap = @import("../heap.zig"); const uart = @import("../uart.zig"); const interpreter = @import("../interpreter.zig"); const example_tasks = @import("./example_tasks.zig"); const Frame = @import("./Frame.zig"); const debug = @import("build_options").log_vm; pub fn step(frame: *Frame.List.Node) void { var t = &frame.data; // this shouldn't happen unless we return from a state where // all tasks were waiting if (t.waiting) { interpreter.schedule(); return; } if (t.notifs.items.len > 0) { const notification = t.notifs.orderedRemove(0); t.stack[t.sp] = @intCast(u8, t.ip); t.sp += 1; switch (notification) { .uart_data => |char| { t.stack[t.sp] = char; t.sp += 1; }, } t.ip = t.handlers[@enumToInt(notification)] orelse unreachable; } const inst = t.program[t.ip]; defer { if (inst != .jump and inst != .jez) t.ip += 1; } if (comptime debug) uart.print("{}: executing {}\n", .{ t, t.program[t.ip] }); switch (t.program[t.ip]) { .noop => {}, .jump => { t.sp -= 1; t.ip = t.stack[t.sp]; }, .push_const => |val| { t.stack[t.sp] = val; t.sp += 1; }, .push_const_vec => |val| { for (t.stack[t.sp .. t.sp + val.len]) |*b, i| b.* = val[i]; t.sp += @intCast(u8, val.len); }, .push_acc => { t.stack[t.sp] = t.acc; t.sp += 1; }, .pop => { t.sp -= 1; t.acc = t.stack[t.sp]; }, .jez => { t.sp -= 1; const addr = t.stack[t.sp]; if (t.acc == 0) { t.ip = addr; } else { t.ip += 1; } }, .sub => { t.sp -= 2; t.acc = t.stack[t.sp] - t.stack[t.sp + 1]; }, .add => { t.sp -= 2; t.acc = t.stack[t.sp] + t.stack[t.sp + 1]; }, .yield => { interpreter.schedule(); }, .exec => |command| { switch (command) { .log => |len| { t.sp -= len; uart.print("task {}: {}\n", .{ t.id, t.stack[t.sp .. t.sp + len] }); }, .subscribe => |data| { t.handlers[@enumToInt(data.kind)] = data.address; }, .set_waiting => |val| { t.waiting = val; }, } }, .exit => { if (comptime debug) uart.print("exited: {}\n", .{t}); interpreter.destroyTask(frame); interpreter.schedule(); }, } }
src/interpreter/vm.zig
const std = @import("std"); const zs = @import("zstack.zig"); const Piece = zs.Piece; const Block = zs.Block; const BitSet = zs.BitSet; const VirtualKey = zs.input.VirtualKey; const Actions = zs.input.Actions; const FixedQueue = zs.FixedQueue; pub const Engine = struct { pub const State = enum { /// When "READY" is displayed. Ready, /// When "GO" is displayed. Go, /// When piece has nothing beneath it. Falling, /// When piece has hit top of stack/floor. Landed, /// When waiting for new piece to spawn after previous piece is placed. Are, /// When a new piece needs to be spawned. Occurs instantly. NewPiece, /// When a line clear is occurring. ClearLines, /// User-specified quit action. Quit, /// User lost (topped out). GameOver, /// User restarts. Restart, }; pub const Statistics = struct { lines_cleared: usize, blocks_placed: usize, pub fn init() Statistics { return Statistics{ .lines_cleared = 0, .blocks_placed = 0, }; } }; state: State, // The well is the main field where all pieces are dropped in to. We provide an upper-bound // on the height and width so we can have fixed memory for it. well: [zs.max_well_height][zs.max_well_width]?Block, // The current piece contains the x, y, theta and current raw blocks it occupies. To rotate // the piece a rotation system must be used. piece: ?Piece, // TODO: Play around with having a multiple hold piece queue. Use a ring buffer, but allow // entries to be null to suit. hold_piece: ?Piece.Id, // Preview pieces have a fixed upper bound. Note that this is the viewable preview pieces. const PreviewQueue = FixedQueue(Piece.Id, zs.max_preview_count); preview_pieces: PreviewQueue, randomizer: zs.Randomizer, rotation_system: zs.RotationSystem, total_ticks_raw: i64, hold_available: bool, generic_counter: u32, /// Keys pressed this frame keys: BitSet(VirtualKey), /// How many ticks have elapsed with DAS applied das_counter: i32, are_counter: u32, stats: Statistics, // This contains a lot of the main functionality, for example well_width, well_height etc. options: zs.Options, pub fn init(options: zs.Options) Engine { // TODO: Caller must set seed if not set. Don't want os specific stuff here. std.debug.assert(options.seed != null); var engine = Engine{ .state = .Ready, .well = [_][zs.max_well_width]?Block{([_]?Block{null} ** zs.max_well_width)} ** zs.max_well_height, .piece = null, .hold_piece = null, .preview_pieces = PreviewQueue.init(options.preview_piece_count), .randomizer = zs.Randomizer.init(options.randomizer, options.seed.?), .rotation_system = zs.RotationSystem.init(options.rotation_system), .total_ticks_raw = 0, .hold_available = true, .generic_counter = 0, .keys = BitSet(VirtualKey).init(), .das_counter = 0, .are_counter = 0, .stats = Statistics.init(), .options = options, }; // Queue up initial preview pieces var i: usize = 0; while (i < options.preview_piece_count) : (i += 1) { engine.preview_pieces.insert(engine.randomizer.next()); } return engine; } pub fn quit(self: Engine) bool { return switch (self.state) { .Quit => true, else => false, }; } // Various statistics. // Returns true if the hold was successful. fn holdPiece(e: *Engine) bool { if (!e.hold_available) { return false; } if (e.hold_piece) |hold| { e.hold_piece = e.piece.?.id; e.piece = Piece.init(e.*, hold, @intCast(i8, e.options.well_width / 2 - 1), 1, .R0); } else { e.nextPiece(); e.hold_piece = e.piece.?.id; } e.hold_available = false; return true; } fn nextPiece(e: *Engine) void { e.piece = Piece.init(e.*, e.nextPreviewPiece(), @intCast(i8, e.options.well_width / 2 - 1), 1, .R0); e.hold_available = true; } fn nextPreviewPiece(e: *Engine) Piece.Id { return e.preview_pieces.take(e.randomizer.next()); } fn clearLines(e: *Engine) u8 { var found: u64 = 0; var filled: u8 = 0; var y: usize = 0; while (y < e.options.well_height) : (y += 1) { next_row: { var x: usize = 0; while (x < e.options.well_width) : (x += 1) { if (e.well[y][x] == null) { break :next_row; } } found |= 1; filled += 1; } found <<= 1; } found >>= 1; // Shift and replace fill rows. var dst = e.options.well_height - 1; var src = dst; while (src >= 0) : ({ src -= 1; found >>= 1; }) { if (found & 1 != 0) { continue; } if (src != dst) { // TODO: Cannot copy like this? std.mem.copy(?Block, e.well[dst][0..e.options.well_width], e.well[src][0..e.options.well_width]); } // TODO: Handle dst being negative cleaner. if (dst == 0 or src == 0) { break; } dst -= 1; } var i: usize = 0; while (i < filled) : (i += 1) { std.mem.set(?Block, e.well[dst][0..], null); } return filled; } fn rotatePiece(e: *Engine, rotation: zs.Rotation) bool { return e.rotation_system.rotate(e.*, &e.piece.?, rotation); } fn isOccupied(e: Engine, x: i8, y: i8) bool { if (x < 0 or x >= @intCast(i8, e.options.well_width) or y < 0 or y >= @intCast(i8, e.options.well_height)) { return true; } return e.well[@intCast(u8, y)][@intCast(u8, x)] != null; } fn isCollision(e: Engine, id: Piece.Id, x: i8, y: i8, theta: Piece.Theta) bool { const blocks = e.rotation_system.blocks(id, theta); for (blocks) |b| { if (isOccupied(e, x + @intCast(i8, b.x), y + @intCast(i8, b.y))) { return true; } } return false; } fn applyPieceGravity(e: *Engine, gravity: zs.uq8p24) void { var p = &e.piece.?; p.y_actual = p.y_actual.add(gravity); p.y = @intCast(i8, p.y_actual.whole()); // if we overshoot bottom of field, fix to lowest possible y and enter locking phase. if (@intCast(i8, p.y_actual.whole()) >= p.y_hard_drop) { p.y_actual = zs.uq8p24.init(@intCast(u8, p.y_hard_drop), 0); p.y = p.y_hard_drop; e.state = .Landed; } else { // If falling reset lock timer. // TODO: Handle elsewhere? if (e.options.lock_style == .Step or e.options.lock_style == .Move and @intCast(i8, p.y_actual.whole()) > p.y) { p.lock_timer = 0; } p.y = @intCast(i8, p.y_actual.whole()); e.state = .Falling; } } // Lock the current piece to the playing field. fn lockPiece(e: *Engine) void { const p = e.piece.?; const blocks = e.rotation_system.blocks(p.id, p.theta); for (blocks) |b| { e.well[@intCast(u8, p.y_hard_drop + @intCast(i8, b.y))][@intCast(u8, p.x + @intCast(i8, b.x))] = Block{ .id = p.id }; } // TODO: Handle finesse e.stats.blocks_placed += 1; } fn inDrawFrame(e: Engine) bool { // TODO: Handle first quit/restart frame, only show on the one frame return (@mod(e.total_ticks_raw, zs.ticks_per_draw_frame) == 0) or (switch (e.state) { .Quit => true, else => false, }); } // TODO: Make the first input a bit more responsive on first click. A bit clunky. fn virtualKeysToActions(e: *Engine, keys: BitSet(VirtualKey)) Actions { var actions = Actions.init(); const last_tick_keys = e.keys; e.keys = keys; actions.keys = keys; actions.new_keys = BitSet(VirtualKey).initRaw(keys.raw & ~last_tick_keys.raw); const i_das_delay = @intCast(i32, zs.ticks(e.options.das_delay_ms)); const i_das_speed = @intCast(i32, zs.ticks(e.options.das_speed_ms)); if (keys.get(.Left)) { if (e.das_counter > -i_das_delay) { if (e.das_counter >= 0) { e.das_counter = -1; actions.movement = -1; } else { e.das_counter -= 1; } } else { if (i_das_speed != 0) { e.das_counter -= i_das_speed - 1; actions.movement = -1; } else { actions.movement = -@intCast(i8, e.options.well_width); } } } else if (keys.get(.Right)) { if (e.das_counter < i_das_delay) { if (e.das_counter <= 0) { e.das_counter = 1; actions.movement = 1; } else { e.das_counter += 1; } } else { if (i_das_speed != 0) { e.das_counter += i_das_speed - 1; actions.movement = 1; } else { actions.movement = @intCast(i8, e.options.well_width); } } } else { e.das_counter = 0; } // NOTE: Gravity is not additive. That is, soft drop does not add to the base gravity // but replaces it. // TODO: If base gravity is greater than soft drop don't replace. const soft_drop_keys = if (e.options.one_shot_soft_drop) &actions.new_keys else &actions.keys; if (soft_drop_keys.get(.Down)) { // Example: 96ms per full cell move means we move tick_rate / 96 per tick. // = 4/96 = 0.0417 cells per tick at 4ms per tick. actions.gravity = zs.uq8p24.initFraction(zs.ms_per_tick, e.options.soft_drop_gravity_ms_per_cell); } else { actions.gravity = zs.uq8p24.initFraction(zs.ms_per_tick, e.options.gravity_ms_per_cell); } if (actions.new_keys.get(.Right) or actions.new_keys.get(.Left)) { actions.extra.set(.FinesseMove); } if (actions.new_keys.get(.RotateLeft)) { actions.rotation = zs.Rotation.AntiClockwise; actions.extra.set(.FinesseRotate); } if (actions.new_keys.get(.RotateRight)) { actions.rotation = zs.Rotation.Clockwise; actions.extra.set(.FinesseRotate); } if (actions.new_keys.get(.RotateHalf)) { actions.rotation = zs.Rotation.Half; actions.extra.set(.FinesseRotate); } if (actions.new_keys.get(.Hold)) { actions.extra.set(.Hold); } // TODO: Don't repeat this, not handling new keys correctly. if (actions.new_keys.get(.Up)) { actions.gravity = zs.uq8p24.init(e.options.well_height, 0); actions.extra.set(.HardDrop); actions.extra.set(.Lock); } if (actions.keys.get(.Quit)) { actions.extra.set(.Quit); } if (actions.keys.get(.Restart)) { actions.extra.set(.Restart); } return actions; } // Note that the game can tick at varying speeds. All configuration options are rounded up to the // nearest tick so if a configuration option is not specified as a multiple of the tick rate, odd // things will likely occur. // // Most testing occurs with a tick rate of 8ms which is ~120fps. The draw cycle is independent of // the internal tick rate but will occur at a fixed multiple of them. pub fn tick(e: *Engine, i: BitSet(VirtualKey)) void { var actions = e.virtualKeysToActions(i); e.total_ticks_raw += 1; if (actions.extra.get(.Restart)) { e.state = .Restart; } if (actions.extra.get(.Quit)) { e.state = .Quit; } switch (e.state) { .Ready, .Go => { // Ready, go has slightly different hold mechanics than normal. Since we do not have // a piece, we need to copy directly from the next queue to the hold piece instead of // copying between the current piece. Further, we can optionally hold as many time as // we want and may need to discard the existing hold piece. if (e.hold_available and actions.extra.get(.Hold)) { e.hold_piece = nextPreviewPiece(e); if (!e.options.infinite_ready_go_hold) { e.hold_available = false; } } if (e.generic_counter == zs.ticks(e.options.ready_phase_length_ms)) { e.state = .Go; } if (e.generic_counter == zs.ticks(e.options.ready_phase_length_ms + e.options.go_phase_length_ms)) { // TODO: New Piece needs to be instant? e.state = .NewPiece; } e.generic_counter += 1; }, .Are => { // TODO: The well should not be cleared until the ARE action is performed. // Don't clear here. Do Are -> ClearLines -> NewPiece instead. if (e.options.are_cancellable and actions.new_keys.raw != 0) { e.are_counter = 0; e.state = .NewPiece; } else { e.are_counter += 1; if (e.are_counter > zs.ticks(e.options.are_delay_ms)) { e.are_counter = 0; e.state = .NewPiece; } } }, .NewPiece => { nextPiece(e); // Apply IHS/IRS before top-out condition is checked. //if (e.irs != .None) { // e.rotatePiece(e.irs); //} //if (e.ihs) { // e.holdPiece(); //} //e.irs = .None; //e.ihs = false; const p = e.piece.?; if (e.isCollision(p.id, p.x, p.y, p.theta)) { e.piece = null; // Don't display piece on board e.state = .GameOver; } else { e.state = .Falling; } }, // TODO: Input feels a bit janky in certain points. .Falling, .Landed => { var p = &e.piece.?; e.applyPieceGravity(actions.gravity); // Handle locking prior to all movement. This is much more natural as applying movement // after locking is to occur feels wrong. if (actions.extra.get(.HardDrop) or ((p.lock_timer >= zs.ticks(e.options.lock_delay_ms) and e.state == .Landed))) { // TODO: Assert we are on bottom of field lockPiece(e); e.state = .ClearLines; return; } if (actions.extra.get(.Hold)) { _ = holdPiece(e); } if (actions.rotation) |rotation| { _ = e.rotatePiece(rotation); } // Left movement is prioritized over right moment. var mv = actions.movement; while (mv < 0) : (mv += 1) { if (!isCollision(e.*, p.id, p.x - 1, p.y, p.theta)) { p.x -= 1; } } while (mv > 0) : (mv -= 1) { if (!isCollision(e.*, p.id, p.x + 1, p.y, p.theta)) { p.x += 1; } } // TODO: Handle this better. p.y_hard_drop = Piece.yHardDrop(e.*, p.id, p.x, p.y, p.theta); if (e.state == .Landed) { p.lock_timer += 1; } else { // TODO: Don't reset lock delay like this, this should be handled elsewhere // and take into account floorkick limits etc. p.lock_timer = 0; } }, .ClearLines => { e.stats.lines_cleared += clearLines(e); if (e.stats.lines_cleared < e.options.goal) { e.state = .Are; } else { e.state = .GameOver; e.piece = null; } }, .GameOver, .Quit, .Restart => {}, } } };
src/engine.zig
const __lshrdi3 = @import("shift.zig").__lshrdi3; const testing = @import("std").testing; fn test__lshrdi3(a: i64, b: i32, expected: u64) void { const x = __lshrdi3(a, b); testing.expectEqual(@bitCast(i64, expected), x); } test "lshrdi3" { test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 0, 0x123456789ABCDEF); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 1, 0x91A2B3C4D5E6F7); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 2, 0x48D159E26AF37B); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 3, 0x2468ACF13579BD); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 4, 0x123456789ABCDE); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 28, 0x12345678); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 29, 0x91A2B3C); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 30, 0x48D159E); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 31, 0x2468ACF); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 32, 0x1234567); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 33, 0x91A2B3); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 34, 0x48D159); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 35, 0x2468AC); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 36, 0x123456); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 60, 0); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 61, 0); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 62, 0); test__lshrdi3(@bitCast(i64, @as(u64, 0x0123456789ABCDEF)), 63, 0); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 0, 0xFEDCBA9876543210); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 1, 0x7F6E5D4C3B2A1908); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 2, 0x3FB72EA61D950C84); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 3, 0x1FDB97530ECA8642); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 4, 0xFEDCBA987654321); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 28, 0xFEDCBA987); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 29, 0x7F6E5D4C3); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 30, 0x3FB72EA61); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 31, 0x1FDB97530); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 32, 0xFEDCBA98); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 33, 0x7F6E5D4C); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 34, 0x3FB72EA6); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 35, 0x1FDB9753); test__lshrdi3(@bitCast(i64, @as(u64, 0xFEDCBA9876543210)), 36, 0xFEDCBA9); test__lshrdi3(@bitCast(i64, @as(u64, 0xAEDCBA9876543210)), 60, 0xA); test__lshrdi3(@bitCast(i64, @as(u64, 0xAEDCBA9876543210)), 61, 0x5); test__lshrdi3(@bitCast(i64, @as(u64, 0xAEDCBA9876543210)), 62, 0x2); test__lshrdi3(@bitCast(i64, @as(u64, 0xAEDCBA9876543210)), 63, 0x1); }
lib/std/special/compiler_rt/lshrdi3_test.zig
const std = @import("std"); const util = @import("util.zig"); const Tokenizer = @import("token.zig").Tokenizer; const Token = @import("token.zig").Token; const StateMachine = @import("state_machine.zig").StateMachine; const ZValue = @import("data.zig").ZValue; const ZExpr = @import("data.zig").ZExpr; const ZExprArg = @import("data.zig").ZExprArg; const ConcatItem = @import("data.zig").ConcatItem; const ConcatList = @import("data.zig").ConcatList; const ZMacro = @import("data.zig").ZMacro; const StackElem = @import("data.zig").StackElem; const reduce = @import("data.zig").reduce; const MacroValidator = struct { const Self = @This(); current_param: ?[]const u8 = null, param_counts: ?std.StringArrayHashMap(usize) = null, pub fn deinit(self: *Self) void { if (self.param_counts) |*counts| { counts.deinit(); } self.param_counts = null; } pub fn validate(self: Self) !void { if (self.param_counts) |param_counts| { var iter = param_counts.iterator(); while (iter.next()) |entry| { if (entry.value_ptr.* == 0) { return error.UnusedMacroParamter; } } } } }; pub const Zomb = struct { arena: std.heap.ArenaAllocator, map: std.StringArrayHashMap(ZValue), pub fn deinit(self: @This()) void { self.arena.deinit(); } }; pub const Parser = struct { const Self = @This(); arena: std.heap.ArenaAllocator, input: []const u8 = undefined, tokenizer: Tokenizer, state_machine: StateMachine = StateMachine{}, stack: std.ArrayList(StackElem) = undefined, macro_validator: ?MacroValidator = null, macros: std.StringArrayHashMap(ZMacro) = undefined, token: ?Token = null, pub fn init(input_: []const u8, alloc_: std.mem.Allocator) Self { return Self{ .arena = std.heap.ArenaAllocator.init(alloc_), .input = input_, .tokenizer = Tokenizer.init(input_), }; } pub fn deinit(self: *Self) void { self.arena.deinit(); } fn consumeAtTopLevel(self: *Self, allocator_: std.mem.Allocator) !void { if (self.macro_validator) |*macro_validator| { // std.debug.print("...consuming macro declaration...\n", .{}); defer macro_validator.deinit(); try macro_validator.validate(); const c_list = self.stack.pop().CList; const params = self.stack.pop().ParamMap; const key = self.stack.pop().Key; try self.macros.putNoClobber(key, .{ .parameters = params, .value = c_list }); } if (self.stack.items.len > 1) { // std.debug.print("...consuming top-level object...\n", .{}); const c_list = self.stack.pop().CList; defer c_list.deinit(); const key = self.stack.pop().Key; var top_level_obj = &self.stack.items[self.stack.items.len - 1].TopLevelObject; var value: ZValue = undefined; _ = try reduce(allocator_, c_list, &value, true, null, .{ .macros = self.macros }); try top_level_obj.putNoClobber(key, value); } } pub fn parse(self: *Self, allocator_: std.mem.Allocator) !Zomb { // initialize some temporary memory we need for parsing self.stack = std.ArrayList(StackElem).init(self.arena.allocator()); self.macros = std.StringArrayHashMap(ZMacro).init(self.arena.allocator()); // this arena will be given to the caller so they can clean up the memory we allocate for the ZOMB types var out_arena = std.heap.ArenaAllocator.init(allocator_); errdefer out_arena.deinit(); // add the implicit top-level object to our type stack try self.stack.append(.{ .TopLevelObject = std.StringArrayHashMap(ZValue).init(out_arena.allocator()) }); errdefer { if (self.token) |token| { std.debug.print("Last Token = {}\n", .{token}); } } var count: usize = 0; var done = false; while (!done) { count += 1; try self.log(count, "Pre-Step"); try self.step(); if (self.state_machine.state == .Decl) { try self.log(count, "Pre-Decl Consume"); try self.consumeAtTopLevel(out_arena.allocator()); } done = self.token == null and self.stack.items.len == 1; } return Zomb{ .arena = out_arena, .map = self.stack.pop().TopLevelObject, }; } /// Process the current token based on the current state, transition to the /// next state, and update the current token if necessary. pub fn step(self: *Self) !void { if (self.token == null) { self.token = try self.tokenizer.next(); } // comments are ignored everywhere - make sure to get the next token as well if (self.token != null and self.token.?.token_type == .Comment) { self.token = try self.tokenizer.next(); return; } // states where stack consumption occurs do not need a token, and in the case that we're at // the end of the file, this processing still needs to be handled, so we do so now switch (self.state_machine.state) { .ValueConcat => { // consume the value we just parsed const c_item = self.stack.pop().CItem; var c_list = &self.stack.items[self.stack.items.len - 1].CList; try c_list.*.append(c_item); }, .ConsumeObjectEntry => { const c_list = self.stack.pop().CList; errdefer c_list.deinit(); const key = self.stack.pop().Key; var obj = &self.stack.items[self.stack.items.len - 1].CItem.Object; try obj.*.putNoClobber(key, c_list); }, .ConsumeArrayItem => { const c_list = self.stack.pop().CList; errdefer c_list.deinit(); var arr = &self.stack.items[self.stack.items.len - 1].CItem.Array; try arr.*.append(c_list); }, .ConsumeMacroDeclParam => { const param = self.stack.pop().MacroDeclParam; var param_map = &self.stack.items[self.stack.items.len - 1].ParamMap; try param_map.*.?.putNoClobber(param, null); }, .ConsumeMacroDeclDefaultParam => { const param_default = self.stack.pop().CList; const param = self.stack.pop().MacroDeclParam; var param_map = &self.stack.items[self.stack.items.len - 1].ParamMap; try param_map.*.?.putNoClobber(param, param_default); }, .ConsumeMacroExprArgsOrBatchList => { const top = self.stack.pop(); var expr = &self.stack.items[self.stack.items.len - 1].CItem.Expression; switch (top) { .ExprArgList => |expr_arg_list| { defer expr_arg_list.deinit(); try expr.*.setArgs(self.arena.allocator(), expr_arg_list, self.macros); }, .BSet => |batch_set| { expr.*.batch_args_list = batch_set; }, else => return error.UnexpectedStackElemDuringMacroExprArgsOrBatchListConsumption, } }, .ConsumeMacroExprBatchArgsList => { const batch = self.stack.pop().BSet; var expr = &self.stack.items[self.stack.items.len - 1].CItem.Expression; expr.*.batch_args_list = batch; }, .ConsumeMacroExprArg => { const arg = self.stack.pop(); var expr_args = &self.stack.items[self.stack.items.len - 1].ExprArgList; switch (arg) { .CList => |c_list| { errdefer c_list.deinit(); try expr_args.*.append(.{ .CList = c_list }); }, .Placeholder => try expr_args.*.append(.BatchPlaceholder), else => return error.UnexpectedStackElemDuringMacroExprArgConsumption, } }, .ConsumeMacroExprBatchArgs => { const batch_args = self.stack.pop().CItem.Array; var batch = &self.stack.items[self.stack.items.len - 1].BSet; try batch.*.append(batch_args); }, else => {}, } // to continue on, we must have a token if (self.token == null) { try self.state_machine.transition(.None); return; } // get the token slice for convenience const token_slice = try self.token.?.slice(self.input); var keep_token = false; // process the current token based on our current state switch (self.state_machine.state) { .Decl => { self.macro_validator = null; keep_token = true; }, .Equals => {}, // handled in .ValueEnter .ValueEnter => { // don't add the CList for an empty array or a batch placeholder if (self.token.?.token_type != .CloseSquare and self.token.?.token_type != .Question) { try self.stack.append(.{ .CList = ConcatList.init(self.arena.allocator()) }); } keep_token = true; }, .Value => { switch (self.token.?.token_type) { .String, .RawString => try self.stack.append(.{ .CItem = .{ .String = token_slice } }), .MacroParamKey => { if (self.macro_validator) |*macro_validator| { if (macro_validator.current_param != null) { return error.UseOfParameterAsDefaultValue; } if (macro_validator.param_counts.?.getPtr(token_slice)) |p| { p.* += 1; // count the usage of this parameter } else { return error.InvalidParameterUse; } try self.stack.append(.{ .CItem = .{ .Parameter = token_slice } }); } else { return error.MacroParamKeyUsedOutsideMacroDecl; } }, .Question => try self.stack.append(.Placeholder), .MacroKey, .OpenCurly, .OpenSquare, .CloseSquare => keep_token = true, else => {}, } }, .ValueConcat => if (self.token.?.token_type != .Plus) { keep_token = true; }, // Objects .ObjectBegin => { try self.stack.append(.{ .CItem = .{ .Object = std.StringArrayHashMap(ConcatList).init(self.arena.allocator()) } }); }, .Key => switch (self.token.?.token_type) { .String => try self.stack.append(.{ .Key = token_slice }), else => keep_token = true, }, .ConsumeObjectEntry => keep_token = true, .ObjectEnd => if (self.token.?.token_type == .String) { keep_token = true; }, // Arrays .ArrayBegin => { try self.stack.append(.{ .CItem = .{ .Array = std.ArrayList(ConcatList).init(self.arena.allocator()) } }); }, .ConsumeArrayItem => { keep_token = true; }, .ArrayEnd => if (self.token.?.token_type != .CloseSquare) { keep_token = true; }, // Macro Declaration .MacroDeclKey => { if (self.macros.contains(token_slice)) { return error.DuplicateMacroName; } try self.stack.append(.{ .Key = token_slice }); self.macro_validator = MacroValidator{}; }, .MacroDeclOptionalParams => switch (self.token.?.token_type) { .OpenParen => { try self.stack.append(.{ .ParamMap = std.StringArrayHashMap(?ConcatList).init(self.arena.allocator()) }); self.macro_validator.?.param_counts = std.StringArrayHashMap(usize).init(self.arena.allocator()); }, else => try self.stack.append(.{ .ParamMap = null }), }, .MacroDeclParam => switch (self.token.?.token_type) { .String => { try self.stack.append(.{ .MacroDeclParam = token_slice }); try self.macro_validator.?.param_counts.?.putNoClobber(token_slice, 0); self.macro_validator.?.current_param = token_slice; }, .CloseParen => keep_token = true, else => {}, }, .MacroDeclParamOptionalDefaultValue => switch (self.token.?.token_type) { .String, .CloseParen => { self.macro_validator.?.current_param = null; keep_token = true; }, else => {}, }, .ConsumeMacroDeclParam, .ConsumeMacroDeclDefaultParam => keep_token = true, .MacroDeclParamsEnd => { self.macro_validator.?.current_param = null; if (self.token.?.token_type == .CloseParen) { if (self.macro_validator.?.param_counts.?.count() == 0) { return error.EmptyMacroDeclParams; } } }, // Macro Expression .MacroExprKey => { if (!self.macros.contains(token_slice)) { return error.MacroNotYetDeclared; } try self.stack.append(.{ .CItem = .{ .Expression = .{ .key = token_slice } } }); }, .MacroExprOptionalArgsOrAccessors, .MacroExprOptionalAccessors => { if (self.token.?.token_type == .MacroAccessor) { var expr = &self.stack.items[self.stack.items.len - 1].CItem.Expression; expr.*.accessors = std.ArrayList([]const u8).init(self.arena.allocator()); } keep_token = true; }, .ConsumeMacroExprArgsOrBatchList => { keep_token = true; }, .MacroExprAccessors => switch (self.token.?.token_type) { .MacroAccessor => { var expr = &self.stack.items[self.stack.items.len - 1].CItem.Expression; try expr.*.accessors.?.append(token_slice); }, else => keep_token = true, }, .MacroExprOptionalBatch => if (self.token.?.token_type != .Percent) { keep_token = true; }, .ConsumeMacroExprBatchArgsList => { keep_token = true; }, // Macro Expression Arguments .MacroExprArgsBegin => { try self.stack.append(.{ .ExprArgList = std.ArrayList(ZExprArg).init(self.arena.allocator()) }); }, .ConsumeMacroExprArg => { keep_token = true; }, .MacroExprArgsEnd => if (self.token.?.token_type != .CloseParen) { keep_token = true; }, // Macro Expression Batch Arguments .MacroExprBatchListBegin => { try self.stack.append(.{ .BSet = std.ArrayList(std.ArrayList(ConcatList)).init(self.arena.allocator()) }); }, .MacroExprBatchArgsBegin => keep_token = true, .ConsumeMacroExprBatchArgs => { keep_token = true; }, .MacroExprBatchListEnd => if (self.token.?.token_type != .CloseSquare) { keep_token = true; }, } // transition to the next state try self.state_machine.transition(self.token.?.token_type); // get a new token if necessary - we must do this _after_ the state machine transition if (!keep_token) { if (util.DEBUG) std.debug.print("getting new token...\n", .{}); self.token = try self.tokenizer.next(); } } // TODO: This is for prototyping only -- remove before release pub fn log(self: Self, count_: usize, tag_: []const u8) !void { if (!util.DEBUG) return; const held = std.debug.getStderrMutex().acquire(); defer held.release(); const stderr = std.io.getStdErr().writer(); try stderr.print( \\ \\=====[[ {s} {} ]]===== \\ , .{ tag_, count_ } ); if (self.token) |token| { try token.log(stderr, self.input); } else { try stderr.writeAll("----[Token]----\nnull\n"); } // try self.tokenizer.log(stderr); try self.state_machine.log(stderr); try stderr.writeAll("----[Macros]----\n"); var iter = self.macros.iterator(); while (iter.next()) |entry| { try stderr.print("{s} = {struct}", .{entry.key_ptr.*, entry.value_ptr.*}); } try stderr.writeAll("----[Parse Stack]----\n"); for (self.stack.items) |stack_elem| { try stderr.print("{union}", .{stack_elem}); } try stderr.writeAll("\n"); } }; //============================================================================== // // // // Testing //============================================================================== const testing = std.testing; const StringReader = @import("string_reader.zig").StringReader; const StringParser = Parser(StringReader, 32); fn parseTestInput(input_: []const u8) !Zomb { if (util.DEBUG) { std.debug.print( \\ \\----[Test Input]---- \\{s} \\ , .{ input_ } ); } var parser = Parser.init(input_, testing.allocator); defer parser.deinit(); return try parser.parse(testing.allocator); } fn doZValueStringTest(expected_: []const u8, actual_: ZValue) !void { try testing.expect(actual_ == .String); try testing.expectEqualStrings(expected_, actual_.String.items); } test "bare string value" { const input = "hi = value"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("value", hi); } test "empty quoted string value" { const input = "hi = \"\""; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("", hi); } test "quoted string value" { const input = "hi = \"value\""; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("value", hi); } test "empty raw string value" { const input = "hi = \\\\"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("", hi); } test "one line raw string value" { const input = "hi = \\\\value"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("value", hi); } test "two line raw string value" { const input = \\hi = \\one \\ \\two ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("one\ntwo", hi); } test "raw string value with empty newline in the middle" { const input = \\hi = \\one \\ \\ \\ \\two ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("one\n\ntwo", hi); } test "bare string concatenation" { const input = "hi = one + two + three"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("onetwothree", hi); } test "quoted string concatenation" { const input = \\hi = "one " + "two " + "three" ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("one two three", hi); } test "raw string concatenation" { const input = \\hi = \\part one \\ \\ \\ + \\part two ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("part one\npart two", hi); } test "general string concatenation" { const input = \\hi = bare_string + "quoted string" + \\raw \\ \\string ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("bare_stringquoted stringraw\nstring", hi); } test "quoted key" { const input = \\"quoted key" = value ; const z = try parseTestInput(input); defer z.deinit(); const value = z.map.get("quoted key") orelse return error.KeyNotFound; try doZValueStringTest("value", value); } test "empty object value" { const input = "hi = {}"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Object); try testing.expectEqual(@as(usize, 0), hi.Object.count()); } test "basic object value" { const input = \\hi = { \\ a = hello \\ b = goodbye \\} ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Object); const a = hi.Object.get("a") orelse return error.KeyNotFound; try doZValueStringTest("hello", a); const b = hi.Object.get("b") orelse return error.KeyNotFound; try doZValueStringTest("goodbye", b); } test "nested object value" { const input = \\hi = { \\ a = { \\ b = value \\ } \\} ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Object); const a = hi.Object.get("a") orelse return error.KeyNotFound; try testing.expect(a == .Object); const b = a.Object.get("b") orelse return error.KeyNotFound; try doZValueStringTest("value", b); } // TODO: object + object concatenation test "empty array value" { const input = "hi = []"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Array); try testing.expectEqual(@as(usize, 0), hi.Array.items.len); } test "basic array value" { const input = "hi = [ a b c ]"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Array); try testing.expectEqual(@as(usize, 3), hi.Array.items.len); try doZValueStringTest("a", hi.Array.items[0]); try doZValueStringTest("b", hi.Array.items[1]); try doZValueStringTest("c", hi.Array.items[2]); } test "nested array value" { const input = \\hi = [ \\ [ a b c ] \\] ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Array); try testing.expectEqual(@as(usize, 1), hi.Array.items.len); const inner = hi.Array.items[0]; try testing.expect(inner == .Array); try testing.expectEqual(@as(usize, 3), inner.Array.items.len); try doZValueStringTest("a", inner.Array.items[0]); try doZValueStringTest("b", inner.Array.items[1]); try doZValueStringTest("c", inner.Array.items[2]); } // TODO: array + array concatenation test "array in an object" { const input = \\hi = { \\ a = [ 1 2 3 ] \\} ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Object); const a = hi.Object.get("a") orelse return error.KeyNotFound; try testing.expect(a == .Array); try testing.expectEqual(@as(usize, 3), a.Array.items.len); try doZValueStringTest("1", a.Array.items[0]); try doZValueStringTest("2", a.Array.items[1]); try doZValueStringTest("3", a.Array.items[2]); } test "object in an array" { const input = "hi = [ { a = b c = d } ]"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Array); try testing.expectEqual(@as(usize, 1), hi.Array.items.len); const item = hi.Array.items[0]; try testing.expect(item == .Object); const a = item.Object.get("a") orelse return error.KeyNotFound; try doZValueStringTest("b", a); const c = item.Object.get("c") orelse return error.KeyNotFound; try doZValueStringTest("d", c); } test "empty array in object" { const input = "hi = { a = [] }"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Object); const a = hi.Object.get("a") orelse return error.KeyNotFound; try testing.expect(a == .Array); try testing.expectEqual(@as(usize, 0), a.Array.items.len); } test "empty object in array" { const input = "hi = [{}]"; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Array); try testing.expectEqual(@as(usize, 1), hi.Array.items.len); try testing.expect(hi.Array.items[0] == .Object); try testing.expectEqual(@as(usize, 0), hi.Array.items[0].Object.count()); } // TODO: empty Zomb.map test "macro - bare string value" { const input = \\$key = hello \\hi = $key ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("hello", hi); } test "macro - object value" { const input = \\$key = { \\ a = hello \\} \\hi = $key ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Object); const a = hi.Object.get("a") orelse return error.KeyNotFound; try doZValueStringTest("hello", a); } test "macro - array value" { const input = \\$key = [ a b c ] \\hi = $key ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try testing.expect(hi == .Array); try testing.expectEqual(@as(usize, 3), hi.Array.items.len); try doZValueStringTest("a", hi.Array.items[0]); try doZValueStringTest("b", hi.Array.items[1]); try doZValueStringTest("c", hi.Array.items[2]); } test "macro - one level object accessor" { const input = \\$key = { \\ a = hello \\} \\hi = $key.a ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("hello", hi); } test "macro - one level array accessor" { const input = \\$key = [ hello goodbye okay ] \\hi = $key.1 ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("goodbye", hi); } test "macro - object in object accessor" { const input = \\$key = { \\ a = { \\ b = hello } } \\hi = $key.a.b ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("hello", hi); } test "macro - array in array accessor" { const input = \\$key = [ a [ b ] ] \\hi = $key.1.0 ; const z = try parseTestInput(input); defer z.deinit(); const hi = z.map.get("hi") orelse return error.KeyNotFound; try doZValueStringTest("b", hi); } test "macro - macro expression in macro declaration" { const input = \\$color(alpha, omega) = { \\ black = #000000 + %alpha \\ red = #ff0000 + %alpha + %omega \\} \\$colorize(scope, alpha) = { \\ scope = %scope \\ color = $color(%alpha, $color(X, X).red).black \\} \\colorized = $colorize("hello world", 0F) ; const z = try parseTestInput(input); defer z.deinit(); const colorized = z.map.get("colorized") orelse return error.KeyNotFound; try testing.expect(colorized == .Object); const scope = colorized.Object.get("scope") orelse return error.KeyNotFound; try doZValueStringTest("hello world", scope); const color = colorized.Object.get("color") orelse return error.KeyNotFound; try doZValueStringTest("#0000000F", color); } test "macro batching with default parameter" { const input = \\$color = { \\ black = #000000 \\ red = #ff0000 \\} \\$colorize(scope, color, alpha = ff) = { \\ scope = %scope \\ settings = { foreground = %color + %alpha } \\} \\ \\tokenColors = \\ $colorize(?, $color.black, ?) % [ \\ [ "editor.background" 55 ] \\ [ "editor.border" 66 ] \\ ] + \\ $colorize(?, $color.red) % [ \\ [ "editor.foreground" ] \\ [ "editor.highlightBorder" ] \\ ] ; const z = try parseTestInput(input); defer z.deinit(); const token_colors = z.map.get("tokenColors") orelse return error.KeyNotFound; try testing.expect(token_colors == .Array); try testing.expectEqual(@as(usize, 4), token_colors.Array.items.len); for (token_colors.Array.items) |colorized, i| { try testing.expect(colorized == .Object); const scope = colorized.Object.get("scope") orelse return error.KeyNotFound; var expected = switch (i) { 0 => "editor.background", 1 => "editor.border", 2 => "editor.foreground", 3 => "editor.highlightBorder", else => return error.InvalidIndex, }; try doZValueStringTest(expected, scope); const settings = colorized.Object.get("settings") orelse return error.KeyNotFound; try testing.expect(settings == .Object); const foreground = settings.Object.get("foreground") orelse return error.KeyNotFound; expected = switch (i) { 0 => "#00000055", 1 => "#00000066", 2 => "#ff0000ff", 3 => "#ff0000ff", else => return error.InvalidIndex, }; try doZValueStringTest(expected, foreground); } }
src/parse.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day12.txt"); pub fn main() anyerror!void { var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa_impl.deinit(); const gpa = gpa_impl.allocator(); return main_with_allocator(gpa); } pub fn main_with_allocator(allocator: Allocator) anyerror!void { var map = try parse(allocator, data[0..]); defer deinit_map(&map); print("Part 1: {d}\n", .{try part1(allocator, map)}); print("Part 2: {d}\n", .{try part2(allocator, map)}); } const Map = std.StringHashMap(std.ArrayList([]const u8)); fn deinit_map(map: *Map) void { var it = map.valueIterator(); while (it.next()) |v| { v.deinit(); } map.deinit(); } fn parse(allocator: Allocator, input: []const u8) !Map { var lines = std.mem.tokenize(u8, input, "\n"); var out = Map.init(allocator); while (lines.next()) |line| { var points = std.mem.tokenize(u8, line, "-"); const a = points.next().?; const b = points.next().?; try put_append(&out, a, b); try put_append(&out, b, a); } return out; } fn put_append(map: *Map, key: []const u8, val: []const u8) !void { if (map.getPtr(key)) |ptr| { try ptr.append(val); } else { var entries = std.ArrayList([]const u8).init(map.allocator); try entries.append(val); try map.put(key, entries); } } const Frame = struct { current: []const u8, next_idx: usize, max_small_cave: usize, }; fn count_paths(allocator: Allocator, map: Map, max_small_cave: usize) !usize { var frames = std.ArrayList(Frame).init(allocator); defer frames.deinit(); try frames.append(Frame{ .current = "end", .next_idx = 0, .max_small_cave = max_small_cave, }); var paths: usize = 0; while (frames.items.len > 0) { var frame = &frames.items[frames.items.len - 1]; const current = frame.current; const nexts = map.get(current).?; // Check if we done visiting the current frame if (frame.next_idx == nexts.items.len) { _ = frames.pop(); continue; } const next = nexts.items[frame.next_idx]; frame.next_idx += 1; if (std.mem.eql(u8, next, "start")) { // no way forward paths += 1; } else if (std.mem.eql(u8, next, "end")) { // Reaching the end } else if (std.ascii.isUpper(next[0])) { // Big cave try frames.append(Frame{ .current = next, .next_idx = 0, .max_small_cave = frame.max_small_cave, }); } else { // Small cave const visited_count = count(next, frames.items); if (visited_count < frame.max_small_cave) { try frames.append(Frame{ .current = next, .next_idx = 0, .max_small_cave = if (visited_count > 0) 1 else frame.max_small_cave, }); } } } return paths; } fn count(item: []const u8, frames: []Frame) usize { var out: usize = 0; for (frames) |frame| { if (std.mem.eql(u8, item, frame.current)) out += 1; } return out; } fn part1(allocator: Allocator, map: Map) !usize { return count_paths(allocator, map, 1); } fn part2(allocator: Allocator, map: Map) !usize { return count_paths(allocator, map, 2); } test "paths small" { const input = \\start-A \\start-b \\A-c \\A-b \\b-d \\A-end \\b-end ; const allocator = std.testing.allocator; var map = try parse(allocator, input[0..]); defer deinit_map(&map); try std.testing.expectEqual(@as(usize, 10), try part1(allocator, map)); try std.testing.expectEqual(@as(usize, 36), try part2(allocator, map)); } test "paths medium" { const input = \\dc-end \\HN-start \\start-kj \\dc-start \\dc-HN \\LN-dc \\HN-end \\kj-sa \\kj-HN \\kj-dc ; const allocator = std.testing.allocator; var map = try parse(allocator, input[0..]); defer deinit_map(&map); try std.testing.expectEqual(@as(usize, 19), try part1(allocator, map)); try std.testing.expectEqual(@as(usize, 103), try part2(allocator, map)); } test "paths large" { const input = \\fs-end \\he-DX \\fs-he \\start-DX \\pj-DX \\end-zg \\zg-sl \\zg-pj \\pj-he \\RW-he \\fs-DX \\pj-RW \\zg-RW \\start-pj \\he-WI \\zg-he \\pj-fs \\start-RW ; const allocator = std.testing.allocator; var map = try parse(allocator, input[0..]); defer deinit_map(&map); try std.testing.expectEqual(@as(usize, 226), try part1(allocator, map)); try std.testing.expectEqual(@as(usize, 3509), try part2(allocator, map)); }
src/day12.zig
const std = @import("std"); const Mutex = std.Mutex; const Keypad = @import("keypad.zig").Keypad; /// The starting address in memory space, /// anything before this is storage and reserved memory const start_address = 0x200; /// Starting address of where the fonts are located in the memory const font_start_address = 0x50; /// Video height in pixels const height = 32; /// Video width in pixels const width = 64; /// The supported Font Set of 8Chip pub const font_set = &[_]u8{ 0xF0, 0x90, 0x90, 0x90, 0xF0, // 0 0x20, 0x60, 0x20, 0x20, 0x70, // 1 0xF0, 0x10, 0xF0, 0x80, 0xF0, // 2 0xF0, 0x10, 0xF0, 0x10, 0xF0, // 3 0x90, 0x90, 0xF0, 0x10, 0x10, // 4 0xF0, 0x80, 0xF0, 0x10, 0xF0, // 5 0xF0, 0x80, 0xF0, 0x90, 0xF0, // 6 0xF0, 0x10, 0x20, 0x40, 0x40, // 7 0xF0, 0x90, 0xF0, 0x90, 0xF0, // 8 0xF0, 0x90, 0xF0, 0x10, 0xF0, // 9 0xF0, 0x90, 0xF0, 0x90, 0x90, // A 0xE0, 0x90, 0xE0, 0x90, 0xE0, // B 0xF0, 0x80, 0x80, 0x80, 0xF0, // C 0xE0, 0x90, 0x90, 0x90, 0xE0, // D 0xF0, 0x80, 0xF0, 0x80, 0xF0, // E 0xF0, 0x80, 0xF0, 0x80, 0x80, // F }; /// Callback function that can be used to update the frame /// of a display, such as a GUI or Terminal UI. pub const UpdateFrameFn = fn ([]u1) void; /// Cpu is the 8Chip implementation, it contains the memory, /// opcodes and handles the cycle. Video output can be accessed /// directly, but is not thread-safe currently. pub const Cpu = struct { /// memory of the cpu, that is segmented into 3 parts: /// 1. 0x00-0x1FF reserved memory for interpreter /// 2. 0x050-0x0A0 storage space /// 3. 0x200-0xFFF instructors from ROM at 0x200, after that is free memory: [4096]u8 = [_]u8{0} ** 4096, /// 8-chip registry, contains V0 to VF, has calues between 0x00 to 0xFF registers: [16]u8, /// Special register to store memory addreses for use in operations index_register: u16, /// The program counter that stores which operation to run next pc: u16, /// The CPU stack that keeps track of the order of execution stack: [16]u16, /// The stack pointer keeps track of where we are in the stack sp: u8 = 0, /// Timer for delay, decrements until 0 and remains 0 delay_timer: u8, /// Timer used for emitting sound, decrements to 0. Anything non-zero emits a sound sound_timer: u8, /// keypad input keys keypad: Keypad, /// The pixels to write a sprite to video: Video, /// generates random numbers for our opcode at 0xC000 random: std.rand.DefaultPrng, /// should stop is an atomic boolean used to shutdown the Cpu should_stop: std.atomic.Int(u1), /// beepFn is the callback function that is triggered when emitting a sound beepFn: ?fn () void, /// The pixel buffer to write the sprites to pub const Video = struct { data: [width * height]u1, updateFrame: ?UpdateFrameFn, /// Calls the updateFrame function using its own data as frame fn update(self: *Video) void { if (self.updateFrame) |updateFrame| { updateFrame(self.data[0..]); } } }; /// Currently the implementation allows to set the delay and sound timers. /// By default, both are set to 0. pub const Config = struct { /// Delayer timer is decremented by 1 in each cpu cycle delay_timer: u8 = 0, /// Sound timer which is decremented by 1 in each cpu cycle sound_timer: u8 = 0, /// Callback function that can be set to trigger sound effects each cycle /// default is null audio_callback: ?fn () void = null, /// Callback function that passes the current video frame /// This function is triggered when a draw opcode is executed video_callback: ?UpdateFrameFn = null, }; /// Creates a new Cpu while setting the default fields /// `delay` sets the `delay_timer` field if not null, else 0. pub fn init(config: Config) Cpu { // seed for our random bytes const seed = @intCast(u64, std.time.milliTimestamp()); // create our new cpu and set the program counter to 0x200 var cpu = Cpu{ .registers = [_]u8{0} ** 16, .index_register = 0, .pc = start_address, .stack = [_]u16{0} ** 16, .delay_timer = config.delay_timer, .sound_timer = config.sound_timer, .keypad = Keypad{ .mutex = Mutex.init(), }, .video = Video{ .data = [_]u1{0} ** width ** height, .updateFrame = config.video_callback, }, .random = std.rand.DefaultPrng.init(seed), .should_stop = std.atomic.Int(u1).init(0), .beepFn = config.audio_callback, }; // load the font set into cpu's memory for (font_set) |f, i| { cpu.memory[font_start_address + i] = f; } return cpu; } /// Resets the Cpu to all zero values /// This means that to the ROM must be loaded again /// to be able to start it. /// If the CPU was initialized with timers, /// they must be set explicitly on the cpu object pub fn reset(self: *Cpu) void { // first stop the cpu // will most likely still receive an UnknownOp error self.stop(); self.registers = [_]u8{0} ** 16; self.index_register = 0; self.pc = start_address; self.video.data = [_]u1{0} ** width ** height; self.should_stop = std.atomic.Int(u1).init(0); self.memory = [_]u8{0} ** 4096; self.stack = [_]u16{0} ** 16; self.sp = 0; // load the font set into cpu's memory for (font_set) |f, i| { self.memory[font_start_address + i] = f; } // Call update so listener can update frame buffer // with empty data and clear its screen for example. self.video.update(); } // Starts the CPU cycle and runs the currently loaded rom pub fn run(self: *Cpu) !void { // set to 0 incase stop() was called self.should_stop.set(0); var last_time = std.time.milliTimestamp(); // run 60 cycles per second const refresh_rate = 60; // frame time in milliseconds const frame_time = 1000 / refresh_rate; while (self.should_stop.get() == 0) { // timing const current_time = std.time.milliTimestamp(); const delta = current_time - last_time; if (delta > self.delay_timer) { last_time = current_time; if (delta < frame_time) { // sleep expects nano seconds so multiply by 1 mill to go from milli to nanoseconds const sleep_time: u64 = @bitCast(u64, frame_time - delta) * 1000000; std.time.sleep(sleep_time); } try self.cycle(); } } } /// Stops the Cpu pub fn stop(self: *Cpu) void { self.should_stop.set(1); } /// Returns true if the cpu is currently running, /// note that this will also return true if the cpu was never started pub fn running(self: *Cpu) bool { return self.should_stop.get() == 0; } /// Utility function that loads a ROM file's data and then loads it into the CPU's memory /// The memory allocated and returned by this is owned by the caller pub fn loadRom(self: *Cpu, allocator: *std.mem.Allocator, file_path: []const u8) ![]u8 { var file: std.fs.File = try std.fs.cwd().openFile(file_path, .{}); defer file.close(); const size = try file.getEndPos(); var buffer = try allocator.alloc(u8, size); _ = try file.read(buffer); self.loadBytes(buffer); return buffer; } /// Loads data into the CPU's memory starting at `start_address` (0x200) pub fn loadBytes(self: *Cpu, data: []const u8) void { for (data) |b, i| { self.memory[start_address + i] = b; } } /// Returns the next opcode based on the memory's byte located at program counter /// and program counter + 1 pub fn fetchOpcode(self: Cpu) u16 { return @shlExact(@intCast(u16, self.memory[self.pc]), 8) | self.memory[self.pc + 1]; } /// Executes one cycle on the CPU pub fn cycle(self: *Cpu) !void { // get the next opcode const opcode = self.fetchOpcode(); // executes the opcode on the cpu try self.dispatch(opcode); if (self.delay_timer > 0) { self.delay_timer -= 1; } if (self.sound_timer > 0) { self.sound_timer -= 1; if (self.beepFn) |playSound| { playSound(); } } } /// Executes the given opcode pub fn dispatch(self: *Cpu, opcode: u16) !void { // increase program counter for each dispatch self.pc += 2; switch (opcode & 0xF000) { 0x0000 => switch (opcode) { 0x00E0 => { // clear the screen self.video.data = [_]u1{0} ** width ** height; }, 0x00EE => { self.sp -= 1; self.pc = self.stack[self.sp]; }, else => return error.UnknownOpcode, }, 0x1000 => self.pc = opcode & 0x0FFF, 0x2000 => { self.stack[self.sp] = self.pc; self.sp += 1; self.pc = opcode & 0x0FFF; }, // skip the following instructions if vx and kk are equal 0x3000 => { const vx = (opcode & 0x0F00) >> 8; if (self.registers[vx] == @truncate(u8, opcode)) { self.pc += 2; } }, 0x4000 => { const vx = (opcode & 0x0F00) >> 8; if (self.registers[vx] != @truncate(u8, opcode)) { self.pc += 2; } }, 0x5000 => { const vx = (opcode & 0x0F00) >> 8; const vy = (opcode & 0x00F0) >> 4; if (self.registers[vx] == self.registers[vy]) { self.pc += 2; } }, 0x6000 => { const vx = (opcode & 0x0F00) >> 8; self.registers[vx] = @truncate(u8, opcode); }, 0x7000 => { const vx = (opcode & 0x0F00) >> 8; const kk = @truncate(u8, opcode); _ = (@addWithOverflow(u8, self.registers[vx], kk, &self.registers[vx])); }, 0x8000 => { const x = (opcode & 0x0F00) >> 8; const y = @intCast(u8, (opcode & 0x00F0) >> 4); switch (opcode & 0x000F) { 0x0000 => self.registers[x] = self.registers[y], 0x0001 => self.registers[x] |= self.registers[y], 0x0002 => self.registers[x] &= self.registers[y], 0x0003 => self.registers[x] ^= self.registers[y], 0x0004 => { var sum: u8 = undefined; if (@addWithOverflow(u8, self.registers[x], self.registers[y], &sum)) { self.registers[0xF] = 1; } else { self.registers[0xF] = 0; } self.registers[x] = sum; }, 0x0005 => { var sub: u8 = undefined; if (@subWithOverflow(u8, self.registers[x], self.registers[y], &sub)) { self.registers[0xF] = 0; } else { self.registers[0xF] = 1; } self.registers[x] = sub; }, 0x0006 => { self.registers[0xF] = self.registers[x] & 0x1; self.registers[x] >>= 1; }, 0x0007 => { var sub: u8 = undefined; if (@subWithOverflow(u8, self.registers[y], self.registers[x], &sub)) { self.registers[0xF] = 0; } else { self.registers[0xF] = 1; } self.registers[x] = sub; }, 0x000E => { self.registers[0xF] = (self.registers[x] & 0x80) >> 7; self.registers[x] <<= 1; }, else => return error.UnknownOpcode, } }, 0x9000 => { const vx = (opcode & 0x0F00) >> 8; const vy = (opcode & 0x00F0) >> 4; if (self.registers[vx] != self.registers[vy]) { self.pc += 2; } }, // Set I = nnn 0xA000 => self.index_register = opcode & 0x0FFF, // Jump to location nnn + V0 0xB000 => self.pc = self.registers[0] + (opcode & 0x0FFF), // set Vx to random byte AND kk 0xC000 => { const vx = (opcode & 0x0F00) >> 8; self.registers[vx] = self.random.random.int(u8) & @truncate(u8, opcode); }, 0xD000 => { // Display n-byte sprite starting at memory location I at (Vx, Vy), // set VF to 1 if sprite and pixel are on // Apply wrapping if going beyond screen boundaries const x = self.registers[(opcode & 0x0F00) >> 8]; const y = self.registers[(opcode & 0x00F0) >> 4]; const n = opcode & 0x000F; self.registers[0xF] = 0x0; var row: usize = 0; while (row < n) : (row += 1) { const sprite_byte: u8 = self.memory[self.index_register + row]; var col: u8 = 0; while (col < 8) : (col += 1) { const sprite_pixel = sprite_byte >> @intCast(u3, (7 - col)) & 0x01; var screen_pixel = &self.video.data[((y + row) % height) * width + ((x + col) % width)]; // Sprite pixel is on if (sprite_pixel == 0x1) { // screen pixel is also on if (screen_pixel.* == 0x1) { self.registers[0xF] = 0x1; } screen_pixel.* ^= 0x1; } } } self.video.update(); }, // keypad opcodes 0xE000 => { const x = (opcode & 0x0F00) >> 8; const key = self.registers[x]; switch (opcode & 0x00FF) { 0x9E => { if (self.keypad.isDown(key)) { self.pc += 2; } }, 0xA1 => { if (!self.keypad.isDown(key)) { self.pc += 2; } }, else => return error.UnknownOpcode, } }, 0xF000 => { const x = (opcode & 0x0F00) >> 8; switch (opcode & 0x00FF) { 0x07 => self.registers[x] = self.delay_timer, 0x0A => { self.pc -= 2; for (self.keypad.keys) |k, i| { if (k == 0x1) { self.registers[x] = @intCast(u8, i); self.pc += 2; } } }, 0x15 => self.delay_timer = self.registers[x], 0x18 => self.sound_timer = self.registers[x], 0x1E => self.index_register += self.registers[x], 0x29 => self.index_register = self.registers[x] * 5, 0x33 => { self.memory[self.index_register] = self.registers[x] / 100; self.memory[self.index_register + 1] = (self.registers[x] / 10) % 10; self.memory[self.index_register + 2] = (self.registers[x] % 100) % 10; }, 0x55 => { // Copy registry data into memory std.mem.copy( u8, self.memory[self.index_register .. self.index_register + x + 1], self.registers[0 .. x + 1], ); }, 0x65 => { // Copy memory data into registry std.mem.copy( u8, self.registers[0 .. x + 1], self.memory[self.index_register .. self.index_register + x + 1], ); }, else => { return error.UnknownOpcode; }, } }, else => return error.UnknownOpcode, } } };
src/cpu.zig
const std = @import("std"); const mem = std.mem; const debug = std.debug; const assert = debug.assert; usingnamespace @import("../include/psptypes.zig"); usingnamespace @import("../include/pspsysmem.zig"); usingnamespace @import("../include/psploadexec.zig"); const Allocator = mem.Allocator; // This Allocator is a very basic allocator for the PSP // It uses the PSP's kernel to allocate and free memory // This may not be 100% correct for alignment pub const PSPAllocator = struct { allocator: Allocator, //Initialize and send back an allocator object pub fn init() PSPAllocator { return PSPAllocator{ .allocator = Allocator{ .allocFn = psp_realloc, .resizeFn = psp_shrink, }, }; } //Our Allocator fn psp_realloc(allocator: *Allocator, len: usize, alignment: u29, len_align: u29, ra: usize) std.mem.Allocator.Error![]u8 { //Assume alignment is less than double aligns assert(len > 0); assert(alignment <= @alignOf(c_longdouble)); //If not allocated - allocate! if (len > 0) { //Gets a block of memory var id: SceUID = sceKernelAllocPartitionMemory(2, "block", @enumToInt(PspSysMemBlockTypes.MemLow), len + @sizeOf(SceUID), null); if (id < 0) { //TODO: Handle error cases that aren't out of memory... return Allocator.Error.OutOfMemory; } //Get the head address var ptr = @ptrCast([*]u32, @alignCast(4, sceKernelGetBlockHeadAddr(id))); //Store our ID to free @ptrCast(*c_int, ptr).* = id; //Convert and return var ptr2 = @ptrCast([*]u8, ptr); ptr2 += @sizeOf(SceUID); return ptr2[0..len]; } return Allocator.Error.OutOfMemory; } //Our de-allocator fn psp_shrink(allocator: *Allocator, buf_unaligned: []u8, buf_align: u29, new_size: usize, len_align: u29, return_address: usize) std.mem.Allocator.Error!usize { //Get ptr var ptr = @ptrCast([*]u8, buf_unaligned); //Go back to our ID ptr -= @sizeOf(SceUID); var id = @ptrCast(*c_int, @alignCast(4, ptr)).*; //Free the ID var s = sceKernelFreePartitionMemory(id); //Return 0 return 0; } };
src/psp/utils/allocator.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const testing = std.testing; const input = @embedFile("./input.txt"); pub fn main() anyerror!void { print("Day 2: Dive!\n", .{}); print("Part 1: {d}\n", .{part1()}); print("Part 2: {d}\n", .{part2()}); } const Point = packed struct { x: i32 = 0, y: i32 = 0, }; pub fn add(a: Point, b: Point) Point { return Point{ .x = a.x + b.x, .y = a.y + b.y, }; } pub fn equals(a: []const u8, b: []const u8) bool { return std.mem.eql(u8, a, b); } /// /// --- Part One --- /// fn part1() !i32 { var position = Point{ .x = 0, .y = 0 }; var lines = std.mem.split(u8, std.mem.trimRight(u8, input, "\n"), "\n"); while (lines.next()) |line| { var movement: Point = Point{}; var command = std.mem.split(u8, line, " "); var dir = command.next() orelse ""; var quantity = try std.fmt.parseInt(i32, command.next() orelse "0", 10); if (equals(dir, "up")) { movement = Point{ .y = -quantity }; } else if (equals(dir, "down")) { movement = Point{ .y = quantity }; } else if (equals(dir, "forward")) { movement = Point{ .x = quantity }; } else { print("Don't know direction: {s}", .{dir}); } position = add(position, movement); } // print("Distance: {d}m, depth: {d}m\n", .{ position.x, position.y }); return position.x * position.y; } test "day02.part1" { @setEvalBranchQuota(200_000); try testing.expectEqual(1451208, comptime try part1()); } /// /// --- Part Two --- /// fn part2() !i32 { var position = Point{ .x = 0, .y = 0 }; var lines = std.mem.split(u8, std.mem.trimRight(u8, input, "\n"), "\n"); var aim: i32 = 0; while (lines.next()) |line| { var movement: Point = Point{}; var command = std.mem.split(u8, line, " "); var dir = command.next() orelse ""; var quantity = try std.fmt.parseInt(i32, command.next() orelse "0", 10); if (equals(dir, "up")) { aim -= quantity; } else if (equals(dir, "down")) { aim += quantity; } else if (equals(dir, "forward")) { movement = Point{ .x = quantity, .y = aim * quantity }; } else { print("Don't know direction: {s}", .{dir}); } position = add(position, movement); } // print("Distance: {d}m, depth: {d}m\n", .{ position.x, position.y }); return position.x * position.y; } test "day02.part2" { @setEvalBranchQuota(200_000); try testing.expectEqual(1620141160, comptime try part2()); }
src/day02/day02.zig
const std = @import("std"); const ziget = @import("ziget"); const stories_url = "https://hacker-news.firebaseio.com/v0/topstories.json"; const item_base_url = "https://hacker-news.firebaseio.com/v0/item"; const stories_limit = 500; const Story = struct { // by: []u8 = "", // descendants: u32 = 0, id: u32 = 0, // kids: []u32, // score: u32 = 0, // time: u32 = 0, title: ?[]u8 = null, // type: u8[] = "", url: ?[]u8 = null, number: u32 = 0, fetched: bool = false, }; var stdout_lock = std.Thread.Mutex.AtomicMutex{}; fn print(comptime fmt: []const u8, args: anytype) void { var hold = stdout_lock.acquire(); defer hold.release(); const stdout = std.io.getStdOut().writer(); stdout.print(fmt, args) catch unreachable; } fn no_op(_: []const u8) void {} const Shared = struct { ids: []const u32, cursor_ids: u32, lock: std.Thread.Mutex.AtomicMutex, allocator: *std.mem.Allocator, }; fn fetch_worker(sh: *Shared) void { var allocator = sh.allocator; while (true) { var i: u32 = undefined; { var lock = sh.lock.acquire(); defer lock.release(); i = sh.cursor_ids; if (i >= sh.ids.len) { break; } sh.cursor_ids += 1; } var story = Story{ .number = i + 1, .id = sh.ids[i], }; const raw_url = std.fmt.allocPrint( allocator, "{s}/{d}.json?print=pretty", .{ item_base_url, sh.ids[i] }, ) catch |err| { print("error: {any}\n", .{err}); continue; }; defer allocator.free(raw_url); const url = ziget.url.parseUrl(raw_url) catch |err| { print("error: {any}\n", .{err}); continue; }; var downloadState = ziget.request.DownloadState.init(); const options = ziget.request.DownloadOptions{ .flags = 0, .allocator = allocator, .maxRedirects = 0, .forwardBufferSize = 8192, .maxHttpResponseHeaders = 8192, .onHttpRequest = no_op, .onHttpResponse = no_op, }; var text = std.ArrayList(u8).init(allocator); defer text.deinit(); ziget.request.download(url, text.writer(), options, &downloadState) catch |err| { print("error: {any}\n", .{err}); continue; }; // Parse json var stream = std.json.TokenStream.init(text.items); var fetched_story = std.json.parse(Story, &stream, .{ .allocator = allocator, .ignore_unknown_fields = true, }) catch |err| { print("error: {any}\n", .{err}); continue; }; defer { std.json.parseFree(Story, fetched_story, .{ .allocator = allocator, .ignore_unknown_fields = true, }); } story.title = fetched_story.title; story.url = fetched_story.url; story.fetched = true; print( \\ [{d}/{d}] id: {d} \\ title: {s} \\ url: {s} \\ \\ , .{ story.number, sh.ids.len, story.id, story.title, story.url, }); } } pub fn main() anyerror!void { const allocator = std.heap.page_allocator; // const allocator = std.heap.c_allocator; var limit: usize = stories_limit; var num_threads: usize = 10; var args = try std.process.argsAlloc(allocator); defer allocator.free(args); if (args.len > 1) { var arg_str = args[1]; var stream = std.json.TokenStream.init(arg_str); var arg_int = try std.json.parse(u32, &stream, .{}); if (arg_int >= 0) { limit = arg_int; } } if (args.len > 2) { var arg_str = args[2]; var stream = std.json.TokenStream.init(arg_str); var arg_int = try std.json.parse(u32, &stream, .{}); if (arg_int >= 0) { num_threads = arg_int; } } const url = try ziget.url.parseUrl(stories_url); const options = ziget.request.DownloadOptions{ .flags = 0, .allocator = allocator, .maxRedirects = 0, .forwardBufferSize = 8192, .maxHttpResponseHeaders = 8192, .onHttpRequest = no_op, .onHttpResponse = no_op, }; var downloadState = ziget.request.DownloadState.init(); var text = std.ArrayList(u8).init(allocator); defer text.deinit(); try ziget.request.download(url, text.writer(), options, &downloadState); // Parse json var stream = std.json.TokenStream.init(text.items); const ids = try std.json.parse([]u32, &stream, .{ .allocator = allocator }); defer std.json.parseFree([]u32, ids, .{ .allocator = allocator, .ignore_unknown_fields = true, }); if (limit > ids.len) { limit = ids.len; } if (num_threads > limit) { num_threads = limit; } var threads = std.ArrayList(*std.Thread).init(allocator); defer threads.deinit(); try threads.ensureCapacity(num_threads); var sh = &Shared{ .lock = std.Thread.Mutex.AtomicMutex{}, .ids = ids[0..limit], .cursor_ids = 0, .allocator = allocator, }; { var i: usize = 0; while (i < num_threads) : (i += 1) { var thread: *std.Thread = try std.Thread.spawn(fetch_worker, sh); try threads.append(thread); } } // wait for threads done { var i: usize = 0; while (i < num_threads) : (i += 1) { threads.items[i].*.wait(); } } print("end\n", .{}); }
zig_fhn_ziget_iguana/src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const App = @import("app"); const glfw = @import("glfw"); const gpu = @import("gpu"); const util = @import("util.zig"); const c = @import("c.zig").c; const Engine = @import("Engine.zig"); const Options = Engine.Options; /// Default GLFW error handling callback fn glfwErrorCallback(error_code: glfw.Error, description: [:0]const u8) void { std.debug.print("glfw: {}: {s}\n", .{ error_code, description }); } fn init(allocator: Allocator, options: Options) !Engine { const backend_type = try util.detectBackendType(allocator); glfw.setErrorCallback(glfwErrorCallback); try glfw.init(.{}); // Create the test window and discover adapters using it (esp. for OpenGL) var hints = util.glfwWindowHintsForBackend(backend_type); hints.cocoa_retina_framebuffer = true; const window = try glfw.Window.create( options.width, options.height, options.title, null, null, hints, ); const backend_procs = c.machDawnNativeGetProcs(); c.dawnProcSetProcs(backend_procs); const instance = c.machDawnNativeInstance_init(); var native_instance = gpu.NativeInstance.wrap(c.machDawnNativeInstance_get(instance).?); // Discover e.g. OpenGL adapters. try util.discoverAdapters(instance, window, backend_type); // Request an adapter. // // TODO: It would be nice if we could use gpu_interface.waitForAdapter here, however the webgpu.h // API does not yet have a way to specify what type of backend you want (vulkan, opengl, etc.) // In theory, I suppose we shouldn't need to and Dawn should just pick the best adapter - but in // practice if Vulkan is not supported today waitForAdapter/requestAdapter merely generates an error. // // const gpu_interface = native_instance.interface(); // const backend_adapter = switch (gpu_interface.waitForAdapter(&.{ // .power_preference = .high_performance, // })) { // .adapter => |v| v, // .err => |err| { // std.debug.print("mach: failed to get adapter: error={} {s}\n", .{ err.code, err.message }); // std.process.exit(1); // }, // }; const adapters = c.machDawnNativeInstance_getAdapters(instance); var dawn_adapter: ?c.MachDawnNativeAdapter = null; var i: usize = 0; while (i < c.machDawnNativeAdapters_length(adapters)) : (i += 1) { const adapter = c.machDawnNativeAdapters_index(adapters, i); const properties = c.machDawnNativeAdapter_getProperties(adapter); const found_backend_type = @intToEnum(gpu.Adapter.BackendType, c.machDawnNativeAdapterProperties_getBackendType(properties)); if (found_backend_type == backend_type) { dawn_adapter = adapter; break; } } if (dawn_adapter == null) { std.debug.print("mach: no matching adapter found for {s}", .{@tagName(backend_type)}); std.debug.print("-> maybe try GPU_BACKEND=opengl ?\n", .{}); std.process.exit(1); } std.debug.assert(dawn_adapter != null); const backend_adapter = gpu.NativeInstance.fromWGPUAdapter(c.machDawnNativeAdapter_get(dawn_adapter.?).?); // Print which adapter we are going to use. const props = backend_adapter.properties; std.debug.print("mach: found {s} backend on {s} adapter: {s}, {s}\n", .{ gpu.Adapter.backendTypeName(props.backend_type), gpu.Adapter.typeName(props.adapter_type), props.name, props.driver_description, }); const device = switch (backend_adapter.waitForDevice(&.{ .required_features = options.required_features, .required_limits = options.required_limits, })) { .device => |v| v, .err => |err| { // TODO: return a proper error type std.debug.print("mach: failed to get device: error={} {s}\n", .{ err.code, err.message }); std.process.exit(1); }, }; var framebuffer_size = try window.getFramebufferSize(); // If targeting OpenGL, we can't use the newer WGPUSurface API. Instead, we need to use the // older Dawn-specific API. https://bugs.chromium.org/p/dawn/issues/detail?id=269&q=surface&can=2 const use_legacy_api = backend_type == .opengl or backend_type == .opengles; var descriptor: gpu.SwapChain.Descriptor = undefined; var swap_chain: ?gpu.SwapChain = null; var swap_chain_format: gpu.Texture.Format = undefined; var surface: ?gpu.Surface = null; if (!use_legacy_api) { swap_chain_format = .bgra8_unorm; descriptor = .{ .label = "basic swap chain", .usage = .{ .render_attachment = true }, .format = swap_chain_format, .width = framebuffer_size.width, .height = framebuffer_size.height, .present_mode = switch (options.vsync) { .none => .immediate, .double => .fifo, .triple => .mailbox, }, .implementation = 0, }; surface = util.createSurfaceForWindow( &native_instance, window, comptime util.detectGLFWOptions(), ); } else { const binding = c.machUtilsCreateBinding(@enumToInt(backend_type), @ptrCast(*c.GLFWwindow, window.handle), @ptrCast(c.WGPUDevice, device.ptr)); if (binding == null) { @panic("failed to create Dawn backend binding"); } descriptor = std.mem.zeroes(gpu.SwapChain.Descriptor); descriptor.implementation = c.machUtilsBackendBinding_getSwapChainImplementation(binding); swap_chain = device.nativeCreateSwapChain(null, &descriptor); swap_chain_format = @intToEnum(gpu.Texture.Format, @intCast(u32, c.machUtilsBackendBinding_getPreferredSwapChainTextureFormat(binding))); swap_chain.?.configure( swap_chain_format, .{ .render_attachment = true }, framebuffer_size.width, framebuffer_size.height, ); } device.setUncapturedErrorCallback(&util.printUnhandledErrorCallback); return Engine{ .allocator = allocator, .timer = try std.time.Timer.start(), .core = .{ .internal = .{ .window = window, } }, .gpu_driver = .{ .device = device, .backend_type = backend_type, .native_instance = native_instance, .surface = surface, .swap_chain = swap_chain, .swap_chain_format = swap_chain_format, .current_desc = descriptor, .target_desc = descriptor, }, }; } // TODO: check signatures comptime { if (!@hasDecl(App, "init")) @compileError("App must export 'pub fn init(app: *App, engine: *mach.Engine) !void'"); if (!@hasDecl(App, "deinit")) @compileError("App must export 'pub fn deinit(app: *App, engine: *mach.Engine) void'"); if (!@hasDecl(App, "update")) @compileError("App must export 'pub fn update(app: *App, engine: *mach.Engine) !bool'"); } pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); const options = if (@hasDecl(App, "options")) App.options else Options{}; var engine = try init(allocator, options); var app: App = undefined; try app.init(&engine); defer app.deinit(&engine); const window = engine.core.internal.window; while (!window.shouldClose()) { try glfw.pollEvents(); engine.delta_time_ns = engine.timer.lap(); engine.delta_time = @intToFloat(f64, engine.delta_time_ns) / @intToFloat(f64, std.time.ns_per_s); var framebuffer_size = try window.getFramebufferSize(); engine.gpu_driver.target_desc.width = framebuffer_size.width; engine.gpu_driver.target_desc.height = framebuffer_size.height; if (engine.gpu_driver.swap_chain == null or !engine.gpu_driver.current_desc.equal(&engine.gpu_driver.target_desc)) { const use_legacy_api = engine.gpu_driver.surface == null; if (!use_legacy_api) { engine.gpu_driver.swap_chain = engine.gpu_driver.device.nativeCreateSwapChain(engine.gpu_driver.surface, &engine.gpu_driver.target_desc); } else engine.gpu_driver.swap_chain.?.configure( engine.gpu_driver.swap_chain_format, .{ .render_attachment = true }, engine.gpu_driver.target_desc.width, engine.gpu_driver.target_desc.height, ); if (@hasDecl(App, "resize")) { try app.resize(&engine, engine.gpu_driver.target_desc.width, engine.gpu_driver.target_desc.height); } engine.gpu_driver.current_desc = engine.gpu_driver.target_desc; } const success = try app.update(&engine); if (!success) break; } }
src/entry_native.zig