Skip to content
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

Re-generate code to fix build on ARM Macs #77

Closed
wants to merge 3 commits into from

Conversation

CyanBlob
Copy link

@CyanBlob CyanBlob commented Oct 8, 2023

Updating the glam and bevy versions and then re-generating generate.rs fixes #70. This issue seems to ultimately stem from bitshifter/glam-rs#296.

This should be tested on x86 platforms before merging to ensure compatibility wasn't broken.

A better solution will be to eventually generate different code for each platform via cross-compilation.

@makspll
Copy link
Owner

makspll commented Oct 11, 2023

Hi, yes once aarch64 targets get SIMD support in glam this will disappear, however that seems to require nightly rust to run together with the core-simd feature!

Thanks for the PR!

Changing these signatures does seem to fix this on arm64 however it breaks again on x86, I guess this is the other side of the problem.

A full fix will need to somehow work on both, probably need a bit of logic in the macro code along the lines of:

  • According to the expected signature am I generating an A type vector (Vec4A, BVec4A etc) on a platform with no simd support?
  • if so before returning, convert using the From trait to an A type vector

However I am not sure this generalizes to all the cases where these vectors are used. Glam is quite confusing, It contains both replacement Vec4 versions for different platforms depending on simd support (the issue we're facing) but also replacement BVec4A and such types which do not use simd instructions on non-simd platforms.

To be honest this seems like a portability issue in glam itself to me. If you rely on an A vector being returned on x86 in your code, this will break on non simd platforms. I think maybe the best fix for now will indeed be generating alternative .rs files depending on simd support, but then removing that once the issue in glam is fixed.

@makspll
Copy link
Owner

makspll commented Oct 12, 2023

Currently working on trying to generate alternative simd files but cross is playing up: cross-rs/cross#1341

@makspll
Copy link
Owner

makspll commented Mar 28, 2024

Already fixed on main

@makspll makspll closed this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatible types when compiling on Arm64
2 participants