Skip to content

Commit

Permalink
Merge pull request #157 from andrewrk/master
Browse files Browse the repository at this point in the history
update for latest zig
  • Loading branch information
Snektron authored Sep 1, 2024
2 parents 18f38ef + 28c14dc commit f7b21d0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
11 changes: 11 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -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",
},
}
18 changes: 9 additions & 9 deletions src/vulkan/render.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
\\ }
Expand Down Expand Up @@ -1259,38 +1259,38 @@ 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;
\\ }
\\ 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;
\\ }
\\ 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;
\\ }
\\ 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;
\\ }
Expand Down Expand Up @@ -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);
Expand All @@ -1426,7 +1426,7 @@ fn Renderer(comptime WriterType: type) type {
\\ }}
\\ }}
\\ break :blk @Type(.{{
\\ .Struct = .{{
\\ .@"struct" = .{{
\\ .layout = .auto,
\\ .fields = &fields,
\\ .decls = &[_]std.builtin.Type.Declaration{{}},
Expand Down
4 changes: 2 additions & 2 deletions test/ref_all_decls.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {},
Expand Down

0 comments on commit f7b21d0

Please sign in to comment.