-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Added 32-bit support. #361
Conversation
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-361 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Unfortunately can't check
target_pointer_width
in codegen (it only sees your host width, not target) so that check has to be after codegen.
Do you know why that is? godot-codegen
is a normal Rust crate... the only special thing is that it's a build-dependency, not a regular one.
Also, which rustc target did you use? I wonder how we can best try to reproduce it in CI... 🤔
godot-ffi/src/opaque.rs
Outdated
@@ -11,7 +11,8 @@ | |||
/// | |||
/// Note: due to `align(8)` and not `packed` repr, this type may be bigger than `N` bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment would need to be updated:
/// Note: due to `align(8)` and not `packed` repr, this type may be bigger than `N` bytes | |
/// Note: due to `align(4)`/ `align(8)` and not `packed` repr, this type may be bigger than `N` bytes |
It's just a byproduct of how it works. It's unfortunate but the only other way is adding a feature cfg but that would feel clunky on the user side. |
let build_config: [&'static str; 2] = { | ||
if cfg!(feature = "double-precision") { | ||
["double_32", "double_64"] | ||
} else { | ||
["float_32", "float_64"] | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explanation!
Could you maybe add that link with a short explanation above this snippet? That way, the design decision is documented and people don't wonder why 32/64 is not already determined at this point (like me) 🙂
rustfmt would need to be fixed as well, otherwise looks good! Please amend your existing commit if possible. I still need to think about how to run 32-bit config in CI. What's the name of your target (the triple format)? |
Forgot to do the cargo fmt, so yeah oops. Also, I don't see any clippy things from anything I touched too tho there seem to be some floating around. As for targets I'm just on windows atm so all I can really test is native windows or if it compiles in WSL. So, |
Thanks! Small request:
Could you squash your commits into one? |
Thank you! 🚀 |
For issue #347
Main two things are causing it to pull and output both the 32 and 64 bit versions of float/double in the codegen. Unfortunately can't check
target_pointer_width
in codegen (it only sees your host width, not target) so that check has to be after codegen.Also, need to change the align on Opaque for pointer casting. AFAIK this should be complete besides tests.