Current UiStack based extraction potentially leads to poor batching
Open
A-Rendering
A-UI
C-Performance
S-Needs-Design
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 4d 8m
- Merged PRs (30d)
- 147
Description
## Bevy version
a3baf2ae869611a84cf1bc062c498ea08128cbd9
## What you did
`cargo run --profile stress-test --features trace_tracy --example many_buttons`
## What went wrong
Issuing 24,000+ draw calls when it could be issuing 3.
The construction of `UiStack` forces siblings of a similar depth in the hierarchy to be non-adjacent if any of them have children. This also forces their descendants to not be adjacent, which is breaking large scale batching.
https://github.com/bevyengine/bevy/blob/a3baf2ae869611a84cf1bc062c498ea08128cbd9/crates/bevy_ui/src/stack.rs#L93-L102
Contributor guide
Assessment
This issue has not been assessed yet.