From d03459819c17beac3806ed2a03060773502b2779 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 30 Aug 2024 19:52:09 -0700 Subject: [PATCH 1/2] add build.zig.zon file Integrate with tooling and makes the package size smaller. --- build.zig.zon | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 build.zig.zon diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..16732a7 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,11 @@ +.{ + .name = "vulkan", + .version = "0.0.0", + .minimum_zig_version = "0.14.0-dev.1359+e9a00ba7f", + .paths = .{ + "build.zig", + "LICENSE", + "README.md", + "src", + }, +} From 28c14dcf37715be5c6de391cbfd394152969bd35 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 30 Aug 2024 19:55:03 -0700 Subject: [PATCH 2/2] update in response to `std.builtin.Type` field renames --- src/vulkan/render.zig | 18 +++++++++--------- test/ref_all_decls.zig | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/vulkan/render.zig b/src/vulkan/render.zig index 9709c82..0091320 100644 --- a/src/vulkan/render.zig +++ b/src/vulkan/render.zig @@ -28,7 +28,7 @@ const preamble = \\ .C; \\pub fn FlagsMixin(comptime FlagsType: type) type { \\ return struct { - \\ pub const IntType = @typeInfo(FlagsType).Struct.backing_integer.?; + \\ pub const IntType = @typeInfo(FlagsType).@"struct".backing_integer.?; \\ pub fn toInt(self: FlagsType) IntType { \\ return @bitCast(self); \\ } @@ -1259,7 +1259,7 @@ fn Renderer(comptime WriterType: type) type { \\ pub fn merge(lhs: CommandFlags, rhs: CommandFlags) CommandFlags { \\ var result: CommandFlags = .{}; \\ @setEvalBranchQuota(10_000); - \\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| { + \\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| { \\ @field(result, field.name) = @field(lhs, field.name) or @field(rhs, field.name); \\ } \\ return result; @@ -1267,7 +1267,7 @@ fn Renderer(comptime WriterType: type) type { \\ pub fn intersect(lhs: CommandFlags, rhs: CommandFlags) CommandFlags { \\ var result: CommandFlags = .{}; \\ @setEvalBranchQuota(10_000); - \\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| { + \\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| { \\ @field(result, field.name) = @field(lhs, field.name) and @field(rhs, field.name); \\ } \\ return result; @@ -1275,7 +1275,7 @@ fn Renderer(comptime WriterType: type) type { \\ pub fn complement(self: CommandFlags) CommandFlags { \\ var result: CommandFlags = .{}; \\ @setEvalBranchQuota(10_000); - \\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| { + \\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| { \\ @field(result, field.name) = !@field(self, field.name); \\ } \\ return result; @@ -1283,14 +1283,14 @@ fn Renderer(comptime WriterType: type) type { \\ pub fn subtract(lhs: CommandFlags, rhs: CommandFlags) CommandFlags { \\ var result: CommandFlags = .{}; \\ @setEvalBranchQuota(10_000); - \\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| { + \\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| { \\ @field(result, field.name) = @field(lhs, field.name) and !@field(rhs, field.name); \\ } \\ return result; \\ } \\ pub fn contains(lhs: CommandFlags, rhs: CommandFlags) bool { \\ @setEvalBranchQuota(10_000); - \\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| { + \\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| { \\ if (!@field(lhs, field.name) and @field(rhs, field.name)) { \\ return false; \\ } @@ -1404,14 +1404,14 @@ fn Renderer(comptime WriterType: type) type { \\ const Type = std.builtin.Type; \\ const fields_len = fields_len: {{ \\ var fields_len: u32 = 0; - \\ for (@typeInfo({0s}CommandFlags).Struct.fields) |field| {{ + \\ for (@typeInfo({0s}CommandFlags).@"struct".fields) |field| {{ \\ fields_len += @intCast(@intFromBool(@field(commands, field.name))); \\ }} \\ break :fields_len fields_len; \\ }}; \\ var fields: [fields_len]Type.StructField = undefined; \\ var i: usize = 0; - \\ for (@typeInfo({0s}CommandFlags).Struct.fields) |field| {{ + \\ for (@typeInfo({0s}CommandFlags).@"struct".fields) |field| {{ \\ if (@field(commands, field.name)) {{ \\ const field_tag = std.enums.nameCast(std.meta.FieldEnum({0s}CommandFlags), field.name); \\ const PfnType = {0s}CommandFlags.CmdType(field_tag); @@ -1426,7 +1426,7 @@ fn Renderer(comptime WriterType: type) type { \\ }} \\ }} \\ break :blk @Type(.{{ - \\ .Struct = .{{ + \\ .@"struct" = .{{ \\ .layout = .auto, \\ .fields = &fields, \\ .decls = &[_]std.builtin.Type.Declaration{{}}, diff --git a/test/ref_all_decls.zig b/test/ref_all_decls.zig index bcfecba..870b391 100644 --- a/test/ref_all_decls.zig +++ b/test/ref_all_decls.zig @@ -99,13 +99,13 @@ comptime { fn reallyRefAllDecls(comptime T: type) void { switch (@typeInfo(T)) { - .Struct, .Union => { + .@"struct", .@"union" => { reallyRefAllContainerDecls(T); inline for (std.meta.fields(T)) |field| { reallyRefAllDecls(field.type); } }, - .Enum, .Opaque => { + .@"enum", .@"opaque" => { reallyRefAllContainerDecls(T); }, else => {},