You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
0.20.0 (glam 0.33.12), macOS arm64 (Metal). Works on 0.19.1, which used a different glam.
What went wrong
With glam's scalar-math feature enabled anywhere in the dependency graph, 3D rendering fails on the first frame:
model_only_mesh_bind_group: Binding size 168 of Buffer is less than minimum 176
In our case it is enabled indirectly: rapier3d-f64enhanced-determinism → parry3d-f64 → glamx/scalar-math → glam/scalar-math. Bevy 0.20 is on glam 0.33 as well, so Cargo feature unification turns it on for Bevy too, and Vec4 becomes 4-byte instead of 16-byte aligned. A crate can't opt out of a unified feature, so any app that pulls in rapier/parry with enhanced-determinism hits this.
Likely cause
MeshUniform derives ShaderType; its WGSL/encase layout is 176 bytes, and the bind-group layout uses that (GpuArrayBuffer::<MeshUniform>::binding_layout, bevy_pbr/src/render/mesh_bindings.rs). The instance buffer is sized from Rust's size_of::<T>() instead (UninitBufferVec, bevy_render/src/render_resource/buffer_vec.rs, item_size: size_of::<T>()), which is 168 under scalar-math. The two agree only with SIMD alignment.
Suggested fix
Size UninitBufferVec/RawBufferVec items for ShaderType data from T::min_size(), as BufferVec already does. Or at least add a compile-time check that size_of::<T>() == T::min_size(), so the mismatch fails loudly.
Repro
Seen in a full app; a minimal repro is not yet built. The expected minimal case is a 0.20 app spawning one Mesh3d + MeshMaterial3d<StandardMaterial> and a Camera3d, with glam = { version = "0.33", features = ["scalar-math"] } added to [dependencies].
Activity
fix UninitBufferVec to use shader's size for each entry instead of Ru… (
fix UninitBufferVec to use shader's size for each entry instead of Ru… (
fix UninitBufferVec to use shader's size for each entry instead of Ru… (
render: backport bevyengine/bevy#26090 to the Bevy fork
fix UninitBufferVec to use shader's size for each entry instead of Ru… (