Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.name = .zopengl,
.version = "0.6.0-dev",
.fingerprint = 0xf50d3c53cf67ebe7,
.minimum_zig_version = "0.14.0",
.minimum_zig_version = "0.16.0",
.paths = .{
"build.zig",
"build.zig.zon",
Expand Down
32 changes: 16 additions & 16 deletions src/wrapper.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ const meta = struct {
const num_fields = countFields: {
var count: comptime_int = 0;
for (Enums) |Subset| {
for (std.meta.fields(Subset)) |_| count += 1;
count += @typeInfo(Subset).@"enum".fields.len;
}
break :countFields count;
};
comptime var fields: [num_fields]std.builtin.Type.EnumField = .{undefined} ** num_fields;
comptime var names: [num_fields][]const u8 = undefined;
comptime var values: [num_fields]tag_type = undefined;
comptime var i = 0;
for (Enums) |Subset| {
const subset_info = @typeInfo(Subset).@"enum";
assert(subset_info.tag_type == tag_type);
for (subset_info.fields) |field| {
assert(i < fields.len);
fields[i] = field;
inline for (Enums) |Subset| {
const info = @typeInfo(Subset).@"enum";
inline for (info.fields) |field| {
names[i] = field.name;
values[i] = field.value;
i += 1;
}
}
return @Type(.{ .@"enum" = .{
.tag_type = tag_type,
.fields = &fields,
.decls = &.{},
.is_exhaustive = true,
} });
return @Enum(
tag_type,
.exhaustive,
&names,
&values,
);
}
};

Expand Down Expand Up @@ -3835,7 +3835,7 @@ pub fn Wrap(comptime bindings: anytype) type {

pub fn getError() Error {
const res = bindings.getError();
return std.meta.intToEnum(Error, res) catch onInvalid: {
return std.enums.fromInt(Error, res) orelse onInvalid: {
log.warn("getError returned unexpected value {}", .{res});
break :onInvalid .no_error;
};
Expand Down Expand Up @@ -6928,7 +6928,7 @@ pub fn Wrap(comptime bindings: anytype) type {
// pub var checkFramebufferStatus: *const fn (target: Enum) callconv(.c) Enum = undefined;
pub fn checkFramebufferStatus(target: FramebufferTarget) FramebufferStatus {
const res = bindings.checkFramebufferStatus(@intFromEnum(target));
return std.meta.intToEnum(FramebufferStatus, res) catch onInvalid: {
return std.enums.fromInt(FramebufferStatus, res) orelse onInvalid: {
log.warn("checkFramebufferStatus returned unexpected value {}", .{res});
break :onInvalid .complete;
};
Expand Down
4 changes: 3 additions & 1 deletion src/zopengl.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const build_options = @import("build_options");

comptime {
@setEvalBranchQuota(20_000);
_ = std.testing.refAllDeclsRecursive(@This());
_ = std.testing.refAllDecls(@This());
Comment on lines 8 to +9

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this equivalent, we probably want _ = std.testing.refAllDecls(bindings); and _ = std.testing.refAllDecls(wrapper)); here too.

_ = std.testing.refAllDecls(bindings);
_ = std.testing.refAllDecls(wrapper);
}

pub const bindings = @import("bindings.zig");
Expand Down
Loading