-
Notifications
You must be signed in to change notification settings - Fork 107
Support imgui related abi #1129
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
Interesting. It would expect the C abi incompatibility to crash your program when it is hit, not use a different background color. Fixing this abi incompatibility is not something that I can just do in a few hours. I have been planning to do a complete overhaul of the abi handling code in cg_clif to use the same abi calculation as cg_llvm. This requires some refactorings on the rustc side though. I have already started this about a month ago, but was busy with midterm exams for the past few weeks. Now that they are over I plan to continue on this soon. |
It surprised me a lot too! I have no idea how it doesn't crash. Two imgui windows are missing however a lot of things work as expected, I guess it just stops rendering at some point and a half finished ui appears.
I expected that the ByValPair would just me some small layer over the ByVal, but I guess abi is more complicated. 😁 |
The x86_64 SystemV abi likes to aggressively pack structs into a small amount of registers. For example
Thanks a lot! |
@Uriopass Can you try the |
Looks like it works! 🎉 The incremental compile also takes one second less when adding a print to my main (from 8.7s to 7.8s). Also, does the cargo.sh script use the linker provided in the The audio is heavily distorted though. I'm not sure if it has to do with abi (from cpal ?) or some weird rodio concurrency things. Actual (cranelift built): I might investigate a bit more the day I want audio working with cranelift 😁 |
Yes, it is just a thin wrapper around cargo that uses cg_clif instead of rustc and adds a
Does it print any warnings to stdout like buffer under run? If so that would indicate that it is simply to slow with feeding new audio input to alsa. This may be due to the global lock I use to emulate atomics. In that case I would expect it to be more of a stuttering with clearly recognizable parts in between the pauses though. If that isn't the problem it may be helpful to make a smaller reproducing example. Maybe it also happens with one of the rodio or cpal example? |
Huh??? |
I thought I had my config misconfigured but... no with [target.x86_64-unknown-linux-gnu]
rustflags = ["-Clink-arg=-fuse-ld=lld"]
with
Maybe the target I'm using is wrong?
No prints at all, I'll see if I can replicate with cpal examples. |
Can you show executed rustc command for the final executable for both cases with cg_clif? (You can pass |
~/.cargo/config commented out:
with ~/.cargo/config: (identical to previous)
With prefix:
|
|
Replacing this line in config.sh:56 export RUSTFLAGS=$linker" "$RUSTFLAGS with if [ ! -z $linker ]; then
export RUSTFLAGS=$linker" "$RUSTFLAGS
fi did the trick for me :) |
Couldn't reproduce the audio issue :/ I'm using a lot of atomics though so I guess it might help if they were native some day. |
Cranelift is currently moving towards a new backend framework. The new x86_64 backend supports atomic instructions, but the old one doesn't. I moved cg_clif to the new backend by default a few days ago, but I want to preserve compatibility with the old backend for a while just in case a serious problem shows up. Once I remove support for the old backend I will switch to native atomic instructions. |
When trying to compile imgui-rs using cranelift, the build succeeds however there are some heavy artefacts.
Screen of the artefacts in my game, left: expected, right: actual:

However when building, the only warnings are:
(x32)
It seems like implementing ByValPair should do the trick, but I'm not sure what it would implicate.
The text was updated successfully, but these errors were encountered: