Skip to content

Commit c747cc5

Browse files
Group stress test examples (bevyengine#4289)
# Objective - Several examples are useful for qualitative tests of Bevy's performance - By contrast, these are less useful for learning material: they are often relatively complex and have large amounts of setup and are performance optimized. ## Solution - Move bevymark, many_sprites and many_cubes into the new stress_tests example folder - Move contributors into the games folder: unlike the remaining examples in the 2d folder, it is not focused on demonstrating a clear feature.
1 parent e8cd2fc commit c747cc5

File tree

9 files changed

+52
-49
lines changed

9 files changed

+52
-49
lines changed

Cargo.toml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,6 @@ name = "hello_world"
127127
path = "examples/hello_world.rs"
128128

129129
# 2D Rendering
130-
[[example]]
131-
name = "contributors"
132-
path = "examples/2d/contributors.rs"
133-
134-
[[example]]
135-
name = "many_sprites"
136-
path = "examples/2d/many_sprites.rs"
137-
138130
[[example]]
139131
name = "move_sprite"
140132
path = "examples/2d/move_sprite.rs"
@@ -188,10 +180,6 @@ path = "examples/3d/lighting.rs"
188180
name = "load_gltf"
189181
path = "examples/3d/load_gltf.rs"
190182

191-
[[example]]
192-
name = "many_cubes"
193-
path = "examples/3d/many_cubes.rs"
194-
195183
[[example]]
196184
name = "msaa"
197185
path = "examples/3d/msaa.rs"
@@ -414,15 +402,19 @@ path = "examples/ecs/timers.rs"
414402
# Games
415403
[[example]]
416404
name = "alien_cake_addict"
417-
path = "examples/game/alien_cake_addict.rs"
405+
path = "examples/games/alien_cake_addict.rs"
418406

419407
[[example]]
420408
name = "breakout"
421-
path = "examples/game/breakout.rs"
409+
path = "examples/games/breakout.rs"
410+
411+
[[example]]
412+
name = "contributors"
413+
path = "examples/games/contributors.rs"
422414

423415
[[example]]
424416
name = "game_menu"
425-
path = "examples/game/game_menu.rs"
417+
path = "examples/games/game_menu.rs"
426418

427419
# Input
428420
[[example]]
@@ -524,10 +516,29 @@ path = "examples/shader/animate_shader.rs"
524516
name = "compute_shader_game_of_life"
525517
path = "examples/shader/compute_shader_game_of_life.rs"
526518

527-
# Tools
519+
# Stress tests
520+
528521
[[example]]
529522
name = "bevymark"
530-
path = "examples/tools/bevymark.rs"
523+
path = "examples/stress_tests/bevymark.rs"
524+
525+
[[example]]
526+
name = "many_cubes"
527+
path = "examples/stress_tests/many_cubes.rs"
528+
529+
[[example]]
530+
name = "many_lights"
531+
path = "examples/stress_tests/many_lights.rs"
532+
533+
[[example]]
534+
name = "many_sprites"
535+
path = "examples/stress_tests/many_sprites.rs"
536+
537+
[[example]]
538+
name = "transform_hierarchy"
539+
path = "examples/stress_tests/transform_hierarchy.rs"
540+
541+
# Tools
531542

532543
[[example]]
533544
name = "scene_viewer"
@@ -614,12 +625,3 @@ icon = "@mipmap/ic_launcher"
614625
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
615626
min_sdk_version = 16
616627
target_sdk_version = 29
617-
618-
# Stress Tests
619-
[[example]]
620-
name = "many_lights"
621-
path = "examples/stress_tests/many_lights.rs"
622-
623-
[[example]]
624-
name = "transform_hierarchy"
625-
path = "examples/stress_tests/transform_hierarchy.rs"

examples/README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ git checkout v0.4.0
5151
- [Reflection](#reflection)
5252
- [Scene](#scene)
5353
- [Shaders](#shaders)
54+
- [Stress Tests](#stress-tests)
5455
- [Tests](#tests)
5556
- [Tools](#tools)
5657
- [Transforms](#transforms)
@@ -67,7 +68,7 @@ git checkout v0.4.0
6768
- [WASM](#wasm)
6869
- [Setup](#setup-2)
6970
- [Build & Run](#build--run-2)
70-
- [Stress Tests](#stress-tests)
71+
- [Loading Assets](#loading-assets)
7172

7273
# The Bare Minimum
7374

@@ -85,8 +86,6 @@ Example | File | Description
8586

8687
Example | File | Description
8788
--- | --- | ---
88-
`contributors` | [`2d/contributors.rs`](./2d/contributors.rs) | Displays each contributor as a bouncy bevy-ball!
89-
`many_sprites` | [`2d/many_sprites.rs`](./2d/many_sprites.rs) | Displays many sprites in a grid arragement! Used for performance testing.
9089
`move_sprite` | [`2d/move_sprite.rs`](./2d/move_sprite.rs) | Changes the transform of a sprite.
9190
`mesh2d` | [`2d/mesh2d.rs`](./2d/mesh2d.rs) | Renders a 2d mesh
9291
`mesh2d_manual` | [`2d/mesh2d_manual.rs`](./2d/mesh2d_manual.rs) | Renders a custom mesh "manually" with "mid-level" renderer apis.
@@ -105,7 +104,6 @@ Example | File | Description
105104
`3d_scene` | [`3d/3d_scene.rs`](./3d/3d_scene.rs) | Simple 3D scene with basic shapes and lighting
106105
`lighting` | [`3d/lighting.rs`](./3d/lighting.rs) | Illustrates various lighting options in a simple scene
107106
`load_gltf` | [`3d/load_gltf.rs`](./3d/load_gltf.rs) | Loads and renders a gltf file as a scene
108-
`many_cubes` | [`3d/many_cubes.rs`](./3d/many_cubes.rs) | Simple benchmark to test per-entity draw overhead
109107
`msaa` | [`3d/msaa.rs`](./3d/msaa.rs) | Configures MSAA (Multi-Sample Anti-Aliasing) for smoother edges
110108
`orthographic` | [`3d/orthographic.rs`](./3d/orthographic.rs) | Shows how to create a 3D orthographic view (for isometric-look games or CAD applications)
111109
`parenting` | [`3d/parenting.rs`](./3d/parenting.rs) | Demonstrates parent->child relationships and relative transformations
@@ -199,9 +197,10 @@ Example | File | Description
199197

200198
Example | File | Description
201199
--- | --- | ---
202-
`alien_cake_addict` | [`game/alien_cake_addict.rs`](./game/alien_cake_addict.rs) | Eat the cakes. Eat them all. An example 3D game
203-
`breakout` | [`game/breakout.rs`](./game/breakout.rs) | An implementation of the classic game "Breakout"
204-
`game_menu` | [`game/game_menu.rs`](./game/game_menu.rs) | A simple game menu
200+
`alien_cake_addict` | [`games/alien_cake_addict.rs`](./games/alien_cake_addict.rs) | Eat the cakes. Eat them all. An example 3D game
201+
`breakout` | [`games/breakout.rs`](./games/breakout.rs) | An implementation of the classic game "Breakout"
202+
`contributors` | [`games/contributors.rs`](./games/contributors.rs) | Displays each contributor as a bouncy bevy-ball!
203+
`game_menu` | [`games/game_menu.rs`](./games/game_menu.rs) | A simple game menu
205204

206205
## Input
207206

@@ -247,6 +246,24 @@ Example | File | Description
247246
`compute_shader_game_of_life` | [`shader/compute_shader_game_of_life.rs`](./shader/compute_shader_game_of_life.rs) | A compute shader simulating Conway's Game of Life
248247
`shader_defs` | [`shader/shader_defs.rs`](./shader/shader_defs.rs) | Demonstrates creating a custom material that uses "shaders defs" (a tool to selectively toggle parts of a shader)
249248

249+
## Stress Tests
250+
251+
These examples are used to test the performance and stability of various parts of the engine in an isolated way.
252+
253+
Due to the focus on performance it's recommended to run the stress tests in release mode:
254+
255+
```sh
256+
cargo run --release --example <example name>
257+
```
258+
259+
Example | File | Description
260+
--- | --- | ---
261+
`bevymark` | [`stress_tests/bevymark.rs`](./stress_tests/bevymark.rs) | A heavy sprite rendering workload to benchmark your system with Bevy
262+
`many_cubes` | [`stress_tests/many_cubes.rs`](./stress_tests/many_cubes.rs) | Simple benchmark to test per-entity draw overhead
263+
`many_lights` | [`stress_tests/many_lights.rs`](./stress_tests/many_lights.rs) | Simple benchmark to test rendering many point lights. Run with `WGPU_SETTINGS_PRIO=webgl2` to restrict to uniform buffers and max 256 lights.
264+
`many_sprites` | [`stress_tests/many_sprites.rs`](./stress_tests/many_sprites.rs) | Displays many sprites in a grid arragement! Used for performance testing.
265+
`transform_hierarchy.rs` | [`stress_tests/transform_hierarchy.rs`](./stress_tests/transform_hierarchy.rs) | Various test cases for hierarchy and transform propagation performance
266+
250267
## Tests
251268

252269
Example | File | Description
@@ -257,7 +274,6 @@ Example | File | Description
257274

258275
Example | File | Description
259276
--- | --- | ---
260-
`bevymark` | [`tools/bevymark.rs`](./tools/bevymark.rs) | A heavy sprite rendering workload to benchmark your system with Bevy
261277
`scene_viewer` | [`tools/scene_viewer.rs`](./tools/scene_viewer.rs) | A simple way to view glTF models with Bevy. Just run `cargo run --release --example scene_viewer -- /path/to/model.gltf#Scene0`, replacing the path as appropriate. With no arguments it will load the FieldHelmet glTF model from the repository assets subdirectory.
262278

263279
## Transforms
@@ -431,18 +447,3 @@ ruby -run -ehttpd examples/wasm
431447
To load assets, they need to be available in the folder examples/wasm/assets. Cloning this
432448
repository will set it up as a symlink on Linux and macOS, but you will need to manually move
433449
the assets on Windows.
434-
435-
# Stress Tests
436-
437-
These examples are used to test the performance and stability of various parts of the engine in an isolated way.
438-
439-
Due to the focus on performance it's recommended to run the stress tests in release mode:
440-
441-
```sh
442-
cargo run --release --example <example name>
443-
```
444-
445-
Example | File | Description
446-
--- | --- | ---
447-
`many_lights` | [`stress_tests/many_lights.rs`](./stress_tests/many_lights.rs) | Simple benchmark to test rendering many point lights. Run with `WGPU_SETTINGS_PRIO=webgl2` to restrict to uniform buffers and max 256 lights.
448-
`transform_hierarchy.rs` | [`stress_tests/transform_hierarchy.rs`](./stress_tests/transform_hierarchy.rs) | Various test cases for hierarchy and transform propagation performance

0 commit comments

Comments
 (0)