-
Notifications
You must be signed in to change notification settings - Fork 1
A lot of the bindings for SDL GPU are broken #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Tthat's a straight up mistake on my part. I apologize. The process of binding ended up being much more manual than I would have liked and without usage code for some APIs, I was guessing without tests, and seem to have made some mistakes. There has been an update to replace I appreciate your forthcoming PR for fixes! <3 As for renaming symbols, using Futhark etc—I intentionally elided using Futhark, and not renaming any symbols (except where impossible to avoid, as noted in the README) because renaming things makes it harder for someone to use the official SDL docs with this binding, harder to translate example code from C to Nim, harder to bring their knowledge of the library to another language, etc. That said, I think it's great if you want to make a Futhark-based, automated version of the binding in its own nimble package. There are a couple nimble packages for SDL2, and a couple for SDL3—there's an alternative to mine that is more opinionated and high-level for example: https://nimble.directory/pkg/nsdl3 I too have been following the SDL "please make some IR for generating bindings" discussion, but I don't think we'll get something like it for a long while. So far, for my manual version updates, I've just diffed the new release SDL headers against the ones I wrote the latest binding against to find changes and additions. As an aside: When you get an SDL_GPU example running, I would appreciate a PR for that as well if you don't mind! The official SDL3 examples collection doesn't have one, and it would be nice to provide here if possible. |
No worries at all. Happy to help maintain and improve these bindings with you. I did manage to get that basic example running, will aim to make that PR at some point today (along with updates for those functions). For future work, as I play around and test things I'll be helping update incrementally. |
@transmutrix PR #7 with added example and bindings updates. |
A lot of the bindings for SDL GPU are broken. I've been working on getting a full example running and have been facing constant battles with the types.
For example https://wiki.libsdl.org/SDL3/SDL_GPUColorTargetInfo illustrates the 'texture' field having a pointer to a GPUTexture. In the bindings we have a 'ptr GPUTexture' which would seem correct, except the GPUTexture is already a pointer, and this would result in double pointer.
In some cases the 'ptr GPUTexture' is fine as a double pointer is expected, for example in https://wiki.libsdl.org/SDL3/SDL_WaitAndAcquireGPUSwapchainTexture there is a double pointer to the 'swapchaintexture' field.
Aside from this, I also see inconsistencies where we're using 'int' instead of 'int32' (or cint) and things like that.
I've been making some updates and will create a PR soon. Likely tonight.
However, I do think that we should update the bindings entirely and do it in a more programmatic fashion like with Futhark https://github.com/PMunch/futhark. Not only will creating the bindings be easier and more accurate, but we can do things like remove the "SDL" prefixes from the types and function signatures. On top of that, it would make it super easy to update the bindings for the latest version.
Totally up to you of course. I can just see this being a pain in the ass when trying to update versions in the future.
There are discussions being had to create an XML specification where developers can create code generators to create bindings like what we see with https://github.com/nimgl/opengl but that's all there is right now- talk. Futhark is a good second place IMO.
The text was updated successfully, but these errors were encountered: