Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clipping rects in ui_layout_system #16732

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Dec 9, 2024

Objective

Perform UI clipping updates during the walk to update the rest of the layout properties.

Solution

  • Removed update_clipping_system and renamed the update module to update_target_cameras.
  • Migrated the queries and clipping update logic from update_clipping_systems to the update_uinode_geometry_recursive function in the layout module.
  • Nodes with Display::None set and their descendants don't need a full update, so added a second function to layout called hide_uinodes_recursive that just walks down the tree and sets the node sizes to zero.

Results

cargo run --example many_buttons --release --features "bevy/trace_tracy"
tracy-clip-in-update

Yellow is this PR, red is main.

The layout for many_buttons is very shallow and I'd expect most Bevy UI apps will see larger improvements in layout performance (but at the same time they'll have probably use less nodes so the absolute gains will be smaller).

cargo run --example many_buttons --release --features "bevy/trace_tracy" -- --display-none
mb-none

@ickshonpe
Copy link
Contributor Author

ickshonpe commented Dec 9, 2024

I'll do some benchmarks a bit later this evening. Typically it seems to only be a ~10% improvement overall but something like a modal UI with a very deep tree that uses Display::None to hide the inactive elements you would see very large improvements.

@alice-i-cecile alice-i-cecile added C-Performance A change motivated by improving speed, memory usage or compile times A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 9, 2024
@BenjaminBrienen BenjaminBrienen added the D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes label Dec 25, 2024
@BenjaminBrienen BenjaminBrienen added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 22, 2025
@ickshonpe ickshonpe added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Performance A change motivated by improving speed, memory usage or compile times D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants