Skip to content

Update to Glam 0.30.1 and adopt nostd-libm feature #18474

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

Closed
wants to merge 2 commits into from

Conversation

bushrat011899
Copy link
Contributor

Objective

Solution

  • Update to Glam 0.30.1 which includes a new nostd-libm feature
  • Expose and offer a similar feature in bevy_math
  • Enable bevy_math/nostd-libm in bevy_internal
  • Remove feature gates on bevy_math, bevy_transform, and bevy_input in bevy_internal (reverting to pre-0.16 behaviour)

Testing

  • CI

Notes

This causes bevy to always include libm as a dependency, but it is a very small and high quality one from the Rust language team themselves. Crucially, the libm and std features can both override the use of nostd-libm, still giving users total control over which implementation they wish to use in both Glam and bevy_math. I believe the singular forced dependency is worth it for the increased functionality that default-features = false Bevy can provide.

For users who cannot accept that dependency, you can depend directly on Bevy's sub-crates instead, which is generally recommended for enthusiast users anyway.

@bushrat011899 bushrat011899 added D-Trivial Nice and easy! A great choice to get started with Bevy C-Dependencies A change to the crates that Bevy depends on A-Math Fundamental domain-agnostic mathematical operations X-Contentious There are nontrivial implications that should be thought through S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 22, 2025
@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Mar 22, 2025
Copy link
Contributor

@andriyDev andriyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but CI is dead...

@bushrat011899
Copy link
Contributor Author

This has significant overlap with #18047 (I should've done more research before opening this PR!) I'll coordinate on that PR first and see if the possible blocker on encase can be resolved. If not, this may need to wait for 0.17

@bushrat011899 bushrat011899 added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 22, 2025
@mockersf mockersf removed this from the 0.16 milestone Mar 22, 2025
@mockersf
Copy link
Member

probably not for the 0.16, as updating glam comes with other crates to update that are not ready

@bushrat011899
Copy link
Contributor Author

Since there are two alternate approaches (either upgrade to 0.30 and then add this feature, or get Glam to release a 0.29.3 with the feature backported) I'm going to close this PR while we see which option presents itself!

github-merge-queue bot pushed a commit that referenced this pull request Mar 31, 2025
# Objective

- Fixes #18397
- Supersedes #18474
- Simplifies 0.16 migration

## Solution

- Upgrade to Glam 0.29.3, which has backported the `nostd-libm` feature.
- Expose a similar feature in `bevy_math` and enable it in
`bevy_internal`, allowing `bevy_math`, `bevy_input`, and
`bevy_transform` to be unconditional dependencies again.

## Testing

- CI

---

## Notes

- This includes `libm` as a dependency, but this was already the case in
the common scenario where `rand` or many other features were enabled.
Considering `libm` is an official Rust crate, it's a very low-risk
dependency to unconditionally include.
- For users who do not want `libm` included, simply import Bevy's
subcrates directly, since `bevy_math/nostd-libm` will not be enabled.
- I know we are _very_ late in the RC cycle for 0.16, but this has a
substantial impact on the usability of `bevy` that I consider worth
including.
mockersf pushed a commit that referenced this pull request Mar 31, 2025
- Fixes #18397
- Supersedes #18474
- Simplifies 0.16 migration

- Upgrade to Glam 0.29.3, which has backported the `nostd-libm` feature.
- Expose a similar feature in `bevy_math` and enable it in
`bevy_internal`, allowing `bevy_math`, `bevy_input`, and
`bevy_transform` to be unconditional dependencies again.

- CI

---

- This includes `libm` as a dependency, but this was already the case in
the common scenario where `rand` or many other features were enabled.
Considering `libm` is an official Rust crate, it's a very low-risk
dependency to unconditionally include.
- For users who do not want `libm` included, simply import Bevy's
subcrates directly, since `bevy_math/nostd-libm` will not be enabled.
- I know we are _very_ late in the RC cycle for 0.16, but this has a
substantial impact on the usability of `bevy` that I consider worth
including.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Dependencies A change to the crates that Bevy depends on D-Trivial Nice and easy! A great choice to get started with Bevy S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bevy_input is now optional, but there's no way to enable it
4 participants