bevy/examples/stress_tests
Nico Burns b995827013
Have a separate implicit viewport node per root node + make viewport node Display::Grid (#9637)
# Objective

Make `bevy_ui` "root" nodes more intuitive to use/style by:
- Removing the implicit flexbox styling (such as stretch alignment) that
is applied to them, and replacing it with more intuitive CSS Grid
styling (notably with stretch alignment disabled in both axes).
- Making root nodes layout independently of each other. Instead of there
being a single implicit "viewport" node that all root nodes are children
of, there is now an implicit "viewport" node *per root node*. And layout
of each tree is computed separately.

## Solution

- Remove the global implicit viewport node, and instead create an
implicit viewport node for each user-specified root node.
- Keep track of both the user-specified root nodes and the implicit
viewport nodes in a separate `Vec`.
- Use the window's size as the `available_space` parameter to
`Taffy.compute_layout` rather than setting it on the implicit viewport
node (and set the viewport to `height: 100%; width: 100%` to make this
"just work").

---

## Changelog

- Bevy UI now lays out root nodes independently of each other in
separate layout contexts.
- The implicit viewport node (which contains each user-specified root
node) is now `Display::Grid` with `align_items` and `justify_items` both
set to `Start`.

## Migration Guide

- Bevy UI now lays out root nodes independently of each other in
separate layout contexts. If you were relying on your root nodes being
able to affect each other's layouts, then you may need to wrap them in a
single root node.
- The implicit viewport node (which contains each user-specified root
node) is now `Display::Grid` with `align_items` and `justify_items` both
set to `Start`. You may need to add `height: Val::Percent(100.)` to your
root nodes if you were previously relying on being implicitly set.
2023-09-19 15:14:46 +00:00
..
bevymark.rs Enhance bevymark (#9674) 2023-09-02 19:16:44 +00:00
many_animated_sprites.rs Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
many_buttons.rs Have a separate implicit viewport node per root node + make viewport node Display::Grid (#9637) 2023-09-19 15:14:46 +00:00
many_cubes.rs Enhance bevymark (#9674) 2023-09-02 19:16:44 +00:00
many_foxes.rs API updates to the AnimationPlayer (#9002) 2023-08-28 16:43:04 +00:00
many_gizmos.rs Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
many_glyphs.rs Have a separate implicit viewport node per root node + make viewport node Display::Grid (#9637) 2023-09-19 15:14:46 +00:00
many_lights.rs Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
many_sprites.rs Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
README.md Add a stress test profile (#6901) 2022-12-20 15:59:41 +00:00
text_pipeline.rs use AutoNoVsync in stress tests (#9229) 2023-07-21 20:15:13 +00:00
transform_hierarchy.rs Remove some old references to CoreSet (#9833) 2023-09-18 01:07:11 +00:00
warning_string.txt Added performance warning when running stress test examples in debug mode (#5029) 2022-07-13 19:13:46 +00:00

Stress tests

These examples are used to stress test Bevy's performance in various ways. These should be run with the "stress-test" profile to accurately represent performance in production, otherwise they will run in cargo's default "dev" profile which is very slow.

Example Command

cargo run --profile stress-test --example <EXAMPLE>