Skip to content

Commit

Permalink
Bump version to 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
castholm committed May 6, 2024
1 parent 53b64ae commit 9eb0e23
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 23 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ The only Zig OpenGL binding generator you need.

## Installation and usage

zigglgen requires a recent-ish master build of the Zig compiler. The oldest known supported version is
`0.12.0-dev.2063+804cee3b9` (identical to [`2024.1.0-mach`](https://machengine.org/about/nominated-zig/#202410-mach)),
but more recent versions may also work.
zigglgen officially supports the following versions of the Zig compiler:

- `0.12.0-dev.3180+83e578a18`/[`2024.3.0-mach`](https://machengine.org/about/nominated-zig/#202410-mach)
- `0.12.0`
- master (last tested with `0.13.0-dev.73+db890dbae`)

Older or more recent versions of the compiler are not guaranteed to be compatible.

1\. Run `zig fetch` to add the zigglgen package to your `build.zig.zon` manifest:

```sh
zig fetch https://github.com/castholm/zigglgen/releases/download/v0.2.1/zigglgen.tar.gz --save
zig fetch https://github.com/castholm/zigglgen/releases/download/v0.2.2/zigglgen.tar.gz --save
```

2\. Generate a set of OpenGL bindings in your `build.zig` build script:
Expand Down
8 changes: 4 additions & 4 deletions zigglgen-example/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
.version = "0.0.0",
.dependencies = .{
.@"mach-glfw" = .{
.url = "https://pkg.machengine.org/mach-glfw/63da35e57c3695a787b927e69e4140eb74ffc234.tar.gz",
.hash = "1220fda87b59df6353864651cdd3943f1159d8d517a45cd67bed493fe6c0a0c78c17",
.url = "https://pkg.machengine.org/mach-glfw/42fe7ee494d36bee8a82c1563c291d8314a41823.tar.gz",
.hash = "1220a72c54b4a3674a1e5a907ac6ea33d1868681f187f5a07f3cfb562ff7cf2c63e0",
},
.zigglgen = .{
.url = "https://github.com/castholm/zigglgen/releases/download/v0.2.1/zigglgen.tar.gz",
.hash = "122059d1ff6787eedb40771eabb0f04d04fe299bd1bae7b216c4a9d894719c2a148a",
.url = "https://github.com/castholm/zigglgen/releases/download/v0.2.2/zigglgen.tar.gz",
.hash = "1220b0b1d61dfe8a244a3928b20cfa596e252656cca90120c26661898986ce3d1f82",
},
},
.paths = .{
Expand Down
8 changes: 4 additions & 4 deletions zigglgen-example/gles3.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Bindings for OpenGL ES 3.0 generated by zigglgen.

// OpenGL XML API Registry revision: 3530768138c5ba3dfbb2c43c830493f632f7ea33
// zigglgen version: 0.2.1
// OpenGL XML API Registry revision: 4265ce1a6e40abdab98f5f2e11365b59f5ef04bc
// zigglgen version: 0.2.2

// Example usage:
//
Expand Down Expand Up @@ -1765,7 +1765,7 @@ pub const ProcTable = struct {
switch (@typeInfo(field_info.type)) {
.Pointer => |ptr_info| switch (@typeInfo(ptr_info.child)) {
.Fn => {
success &= @intFromBool(procs.initCommand(loader, field_info.name ++ ""));
success &= @intFromBool(procs.initCommand(loader, field_info.name));
},
else => comptime unreachable,
},
Expand Down Expand Up @@ -1818,7 +1818,7 @@ pub const ProcTable = struct {

fn initExtension(procs: *ProcTable, comptime name: [:0]const u8) bool {
var count: c_int = 0;
procs.GetIntegerv(NUM_EXTENSIONS, @ptrCast(&count));
procs.GetIntegerv(NUM_EXTENSIONS, (&count)[0..1]);
if (count < 0) return false;
var i: c_uint = 0;
while (i < @as(c_uint, @intCast(count))) : (i += 1) {
Expand Down
22 changes: 20 additions & 2 deletions zigglgen/api_registry.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file was generated by 'updateApiRegistry.ps1'.
// OpenGL XML API Registry revision: 3530768138c5ba3dfbb2c43c830493f632f7ea33
// OpenGL XML API Registry revision: 4265ce1a6e40abdab98f5f2e11365b59f5ef04bc

pub const revision = "3530768138c5ba3dfbb2c43c830493f632f7ea33";
pub const revision = "4265ce1a6e40abdab98f5f2e11365b59f5ef04bc";

pub const Type = struct {
name: Name,
Expand Down Expand Up @@ -5072,6 +5072,7 @@ pub const Constant = struct {
TEXTURE_BUFFER_SIZE,
TEXTURE_BUFFER_SIZE_EXT,
TEXTURE_BUFFER_SIZE_OES,
TEXTURE_CBCR_DEGAMMA_QCOM,
TEXTURE_CLIPMAP_CENTER_SGIX,
TEXTURE_CLIPMAP_DEPTH_SGIX,
TEXTURE_CLIPMAP_FRAME_SGIX,
Expand Down Expand Up @@ -5330,6 +5331,7 @@ pub const Constant = struct {
TEXTURE_WRAP_R_OES,
TEXTURE_WRAP_S,
TEXTURE_WRAP_T,
TEXTURE_Y_DEGAMMA_QCOM,
TEXTURE0,
TEXTURE0_ARB,
TEXTURE1,
Expand Down Expand Up @@ -7870,6 +7872,7 @@ pub const Command = struct {
NamedFramebufferTextureFaceEXT,
NamedFramebufferTextureLayer,
NamedFramebufferTextureLayerEXT,
NamedFramebufferTextureMultiviewOVR,
NamedProgramLocalParameter4dEXT,
NamedProgramLocalParameter4dvEXT,
NamedProgramLocalParameter4fEXT,
Expand Down Expand Up @@ -15315,6 +15318,7 @@ pub const constants = [_]Constant{
.{ .name = .TEXTURE_BUFFER_SIZE, .value = 37278 },
.{ .name = .TEXTURE_BUFFER_SIZE_EXT, .value = 37278 },
.{ .name = .TEXTURE_BUFFER_SIZE_OES, .value = 37278 },
.{ .name = .TEXTURE_CBCR_DEGAMMA_QCOM, .value = 38673 },
.{ .name = .TEXTURE_CLIPMAP_CENTER_SGIX, .value = 33137 },
.{ .name = .TEXTURE_CLIPMAP_DEPTH_SGIX, .value = 33142 },
.{ .name = .TEXTURE_CLIPMAP_FRAME_SGIX, .value = 33138 },
Expand Down Expand Up @@ -15573,6 +15577,7 @@ pub const constants = [_]Constant{
.{ .name = .TEXTURE_WRAP_R_OES, .value = 32882 },
.{ .name = .TEXTURE_WRAP_S, .value = 10242 },
.{ .name = .TEXTURE_WRAP_T, .value = 10243 },
.{ .name = .TEXTURE_Y_DEGAMMA_QCOM, .value = 38672 },
.{ .name = .TEXTURE0, .value = 33984 },
.{ .name = .TEXTURE0_ARB, .value = 33984 },
.{ .name = .TEXTURE1, .value = 33985 },
Expand Down Expand Up @@ -33124,6 +33129,18 @@ pub const commands = [_]Command{
},
.return_type_expr = &.{.void},
},
.{
.name = .NamedFramebufferTextureMultiviewOVR,
.params = &.{
.{ .name = "framebuffer", .type_expr = &.{.{ .type = .uint }} },
.{ .name = "attachment", .type_expr = &.{.{ .type = .@"enum" }} },
.{ .name = "texture", .type_expr = &.{.{ .type = .uint }} },
.{ .name = "level", .type_expr = &.{.{ .type = .int }} },
.{ .name = "baseViewIndex", .type_expr = &.{.{ .type = .int }} },
.{ .name = "numViews", .type_expr = &.{.{ .type = .sizei }} },
},
.return_type_expr = &.{.void},
},
.{
.name = .NamedProgramLocalParameter4dEXT,
.params = &.{
Expand Down Expand Up @@ -65104,6 +65121,7 @@ pub const extensions = [_]Extension{
.{ .name = .{ .constant = .MAX_VIEWS_OVR } },
.{ .name = .{ .constant = .FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR } },
.{ .name = .{ .command = .FramebufferTextureMultiviewOVR } },
.{ .name = .{ .command = .NamedFramebufferTextureMultiviewOVR } },
},
},
.{
Expand Down
1 change: 1 addition & 0 deletions zigglgen/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub fn generateBindingsSourceFile(b: *std.Build, options: GeneratorOptions) std.
return output;
}

// TODO 2024.5.0-mach: Replace with 'b.dependencyFromBuildZig'.
fn thisDependency(b: *std.Build, args: anytype) *std.Build.Dependency {
find_dep: {
const all_pkgs = @import("root").dependencies.packages;
Expand Down
2 changes: 1 addition & 1 deletion zigglgen/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "zigglgen",
.version = "0.2.1",
.version = "0.2.2",
.minimum_zig_version = "0.12.0-dev",
.paths = .{
"LICENSE.md",
Expand Down
11 changes: 4 additions & 7 deletions zigglgen/generator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ fn renderCode(
\\//! Bindings for {[api_pretty]s} {[version_major]d}.{[version_minor]d}{[sp_profile_pretty]s} generated by zigglgen.
\\
\\// OpenGL XML API Registry revision: {[registry_revision]s}
\\// zigglgen version: 0.2.1
\\// zigglgen version: 0.2.2
\\
\\// Example usage:
\\//
Expand Down Expand Up @@ -626,9 +626,7 @@ fn renderCode(
\\ switch (@typeInfo(field_info.type)) {
\\ .Pointer => |ptr_info| switch (@typeInfo(ptr_info.child)) {
\\ .Fn => {
// TODO 2024.3.0-mach
//\\ success &= @intFromBool(procs.initCommand(loader, field_info.name));
\\ success &= @intFromBool(procs.initCommand(loader, field_info.name ++ ""));
\\ success &= @intFromBool(procs.initCommand(loader, field_info.name));
\\ },
\\ else => comptime unreachable,
\\ },
Expand Down Expand Up @@ -734,9 +732,7 @@ fn renderCode(
// under the Core profile.
try writer.writeAll(
\\ var count: c_int = 0;
// TODO 2024.3.0-mach
//\\ procs.GetIntegerv(NUM_EXTENSIONS, (&count)[0..1]);
\\ procs.GetIntegerv(NUM_EXTENSIONS, @ptrCast(&count));
\\ procs.GetIntegerv(NUM_EXTENSIONS, (&count)[0..1]);
\\ if (count < 0) return false;
\\ var i: c_uint = 0;
\\ while (i < @as(c_uint, @intCast(count))) : (i += 1) {
Expand Down Expand Up @@ -795,6 +791,7 @@ fn renderCode(
);
}

// TODO 2024.5.0-mach: Remove 'formatDeclId' and audit uses of 'fmtId'.
const fmtId = std.zig.fmtId;

fn fmtDeclId(bytes: []const u8) std.fmt.Formatter(formatDeclId) {
Expand Down
2 changes: 1 addition & 1 deletion zigglgen/generator_options.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file was generated by 'updateApiRegistry.ps1'.
// OpenGL XML API Registry revision: 3530768138c5ba3dfbb2c43c830493f632f7ea33
// OpenGL XML API Registry revision: 4265ce1a6e40abdab98f5f2e11365b59f5ef04bc

pub const Api = enum { gl, gles, glsc };

Expand Down

0 comments on commit 9eb0e23

Please sign in to comment.