Fix crash on meshes with morphs + skins + motion blur when not using storage buffers (#20076)

## Objective

Fixes #20058

## Solution

Fix the `dynamic_offsets` array being too small if a mesh has morphs and
skins and motion blur, and the renderer isn't using storage buffers
(i.e. WebGL2). The bug was introduced in #13572.

## Testing

- Minimal repro: https://github.com/M4tsuri/bevy_reproduce.
- Also examples `animated_mesh`, `morph_targets`,
`test_invalid_skinned_meshes`.
- As far as I can tell Bevy doesn't have any examples or tests that can
repro the problem combination.

Tested with WebGL and native, Win10/Chrome/Nvidia.
This commit is contained in:
Greeble 2025-07-11 06:00:42 +01:00 committed by GitHub
parent 0d6c591491
commit f8680135ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3016,7 +3016,7 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshBindGroup<I> {
);
};
let mut dynamic_offsets: [u32; 3] = Default::default();
let mut dynamic_offsets: [u32; 5] = Default::default();
let mut offset_count = 0;
if let PhaseItemExtraIndex::DynamicOffset(dynamic_offset) = item.extra_index() {
dynamic_offsets[offset_count] = dynamic_offset;