glad
glad copied to clipboard
Zig generator
Working on resolving #307.
- [x] Properly handle
mx
- [x] Handle all needed types
- [x] Handle enumerations
- [x] Handle function definitions
- [x] Handle loading
I've currently copied from the Rust generator and am just modifying that as Zig is very similar.
How do I test whether a pointer should be a single pointer or a multipointer? For example, currently I get an error on gl.GenBuffers
because it's defined to accept a *u32
instead of a [*]u32
.
type.is_pointer
is actually not a boolean (as you'd expect), it contains the "pointer depth": https://github.com/Dav1dde/glad/blob/glad2/glad/parse.py#L1181
is_array
is similar and contains the array length
That's not idiomatic.
On February 7, 2021 2:27:25 AM PST, David Herberth [email protected] wrote:
type.is_pointer
is actually not a boolean (as you'd expect), it contains the "pointer depth": https://github.com/Dav1dde/glad/blob/glad2/glad/parse.py#L1181
is_array
is similar and contains the array length-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/Dav1dde/glad/pull/311#issuecomment-774649650
type.is_pointer
is actually not a boolean (as you'd expect), it contains the "pointer depth": https://github.com/Dav1dde/glad/blob/glad2/glad/parse.py#L1181
is_array
is similar and contains the array length
Yes, I understand that, and that is working properly. I'm talking about how Zig has a difference between single element pointers and multi-element pointers, which is a different concept from pointer depth: https://ziglang.org/documentation/master/#Pointers
Do the same things that exist in the Vulkan sepc exists in the GL spec?
Live coded with a friend to fix the pointer issues. Also, we've split the generation into subcategories like C does, so that we can have type safety that works better with Zig's typechecker.
I am fairly certain this is ready for review.
Also, is there anything in the xml that describes whether or not a pointer can be 0? Zig pointers that can or can't be zero are actually different types.
Never mind. Seems we're still running into issues with certain kinds of pointers. Not ready for review.
Ok @Sirius902 actually tested the generated code with an existing project this time and it works well. Should be complete for a proper review and ready for merging.
It seems that GLAD is generating files with Windows newlines (CRLF). Zig prefers LF. How can we make GLAD always generate with LF?
Glad does generate LF for C and Rust.
Closed because of inactivity and can be developped externally as plugin.