Redundant copies of MeshUniform
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
Since https://github.com/bevyengine/bevy/pull/9685, each instance of `batch_and_prepare_render_phase` will append a copy of `MeshUniform` to the `GpuArrayBuffer` resource for each entity x phase. For 2 cameras, each with 3 phases (shadow, prepass, main pass), that's 6 total copies per entity... Additionally, each `batch_and_prepare_render_phase` cannot run in parallel with each other due to `ResMut`.
This was kind of intended as it makes it easy for each draw to find the correct MeshUniform in the shader, but it does have the above downsides.
Contributor guide
Research direction
Start by tracing batch_and_prepare_render_phase and the GpuArrayBuffer resource, then inspect how MeshUniform is located by each draw in the shader. Compare the per-entity, per-phase copies across cameras and phases, and determine whether the intended lookup behavior can be preserved while removing the redundant work and allowing these phases to run in parallel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100