Skip to content

chore: update glam to 0.33.2#24814

Open
alisterd51 wants to merge 1 commit into
bevyengine:mainfrom
alisterd51:glam
Open

chore: update glam to 0.33.2#24814
alisterd51 wants to merge 1 commit into
bevyengine:mainfrom
alisterd51:glam

Conversation

@alisterd51

@alisterd51 alisterd51 commented Jun 30, 2026

Copy link
Copy Markdown

Objective

  • Upgrade glam to 0.33.2 to simplify upgrading crates that depend on bevy, glam, and glamx

Solution

  • Upstream update for hexasphere; use of glam's new float-types and integer-types features

Testing

  • Did you test these changes? Just cargo check, as my PC doesn't have enough RAM to run the other tests

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@alisterd51 alisterd51 marked this pull request as draft June 30, 2026 11:39
@alisterd51 alisterd51 force-pushed the glam branch 3 times, most recently from ca70f38 to 4402b22 Compare June 30, 2026 12:28
@alisterd51 alisterd51 changed the title chore: update glam to 0.33.1 chore: update glam to 0.33.2 Jun 30, 2026
@alisterd51 alisterd51 marked this pull request as ready for review June 30, 2026 13:00
@kfc35 kfc35 added C-Dependencies A change to the crates that Bevy depends on S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jun 30, 2026
Comment thread crates/bevy_math/src/lib.rs Outdated
pub use compass::{CompassOctant, CompassQuadrant};
pub use direction::*;
pub use float_ord::*;
pub use glam::camera;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi there, I'm the author of glam. One thing I was thinking with this change was that engines like bevy only need to use the view and proj methods that are relevant to their project (e.g. bevy is right handed and uses directx style projection matrices). Similarly they don't need to re-export methods that aren't relevant to users of the engine. The way I was thinking this could be used in bevy would be to do (replacing pub use glam::* at the bottom of the file):

pub use glam::prelude::*; // exports all glam types but not the camera module
pub use glam::camera::rh::proj::directx as proj; // just the projection methods that bevy might use - this could be even more targeted to only the methods bevy currently uses.

Obviously it's up to bevy to decide what's best for their project and users, I thought I'd give some of the rational and intent for these changes in glam.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you for the suggestions, I've just applied them. I'm open to any further feedback to improve this PR.

Comment thread crates/bevy_reflect/Cargo.toml Outdated
glam = { version = "0.32.0", default-features = false, features = [
glam = { version = "0.33.2", default-features = false, features = [
"serde",
"all-types",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The breaking change in 0.33 is that you can opt out of compiling all types in glam. By default f32 types are always compiled but everything else is optional. On my machine just f32 takes ~0.81s to compile and all-types takes ~4.19s. So there is decent build time saving if you don't need all of the other types.

In bevy there are a couple of considerations; bevy_reflect exposes all of the glam types except for size-types. Also bevy re-exports all glam types so potentially removing them might break user code that depends on them (which raises a question if bevy-math should enable all-types so that they're re-exported). If bevy was interested in disabling types that aren't actively used you might want to consider adding feature flags so user who want them to enable them. That said users can use glam directly if they want these but I assume most bevy users use glam types via bevy_math. For that reason it's not something that you might want to necessarily change for this PR but I thought I'd mention it as something that may want to be considered at some stage.

If you did want to minimise the types compiled by bevy this could be tightened in bevy_reflect to float-types and integer-types here instead of all-types (effectively dropping size-types as bevy doesn't use these anywhere).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, I've added your suggestion. Anyway, I think this PR is already a breaking change and won't be in Bevy before 0.20. The compile time improvement is definitely welcome!

@alisterd51 alisterd51 force-pushed the glam branch 3 times, most recently from cdb32a2 to d84a289 Compare July 4, 2026 08:47
@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 10, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 10, 2026
@alisterd51

Copy link
Copy Markdown
Author

I just rebased to include this fix: #24943, which fixes the merge queue CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Dependencies A change to the crates that Bevy depends on D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants