Skip to content

Commit

Permalink
Group stress test examples (bevyengine#4289)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
alice-i-cecile committed Apr 10, 2022
1 parent e8cd2fc commit c747cc5
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 49 deletions.
54 changes: 28 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ name = "hello_world"
path = "examples/hello_world.rs"

# 2D Rendering
[[example]]
name = "contributors"
path = "examples/2d/contributors.rs"

[[example]]
name = "many_sprites"
path = "examples/2d/many_sprites.rs"

[[example]]
name = "move_sprite"
path = "examples/2d/move_sprite.rs"
Expand Down Expand Up @@ -188,10 +180,6 @@ path = "examples/3d/lighting.rs"
name = "load_gltf"
path = "examples/3d/load_gltf.rs"

[[example]]
name = "many_cubes"
path = "examples/3d/many_cubes.rs"

[[example]]
name = "msaa"
path = "examples/3d/msaa.rs"
Expand Down Expand Up @@ -414,15 +402,19 @@ path = "examples/ecs/timers.rs"
# Games
[[example]]
name = "alien_cake_addict"
path = "examples/game/alien_cake_addict.rs"
path = "examples/games/alien_cake_addict.rs"

[[example]]
name = "breakout"
path = "examples/game/breakout.rs"
path = "examples/games/breakout.rs"

[[example]]
name = "contributors"
path = "examples/games/contributors.rs"

[[example]]
name = "game_menu"
path = "examples/game/game_menu.rs"
path = "examples/games/game_menu.rs"

# Input
[[example]]
Expand Down Expand Up @@ -524,10 +516,29 @@ path = "examples/shader/animate_shader.rs"
name = "compute_shader_game_of_life"
path = "examples/shader/compute_shader_game_of_life.rs"

# Tools
# Stress tests

[[example]]
name = "bevymark"
path = "examples/tools/bevymark.rs"
path = "examples/stress_tests/bevymark.rs"

[[example]]
name = "many_cubes"
path = "examples/stress_tests/many_cubes.rs"

[[example]]
name = "many_lights"
path = "examples/stress_tests/many_lights.rs"

[[example]]
name = "many_sprites"
path = "examples/stress_tests/many_sprites.rs"

[[example]]
name = "transform_hierarchy"
path = "examples/stress_tests/transform_hierarchy.rs"

# Tools

[[example]]
name = "scene_viewer"
Expand Down Expand Up @@ -614,12 +625,3 @@ icon = "@mipmap/ic_launcher"
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
min_sdk_version = 16
target_sdk_version = 29

# Stress Tests
[[example]]
name = "many_lights"
path = "examples/stress_tests/many_lights.rs"

[[example]]
name = "transform_hierarchy"
path = "examples/stress_tests/transform_hierarchy.rs"
47 changes: 24 additions & 23 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ git checkout v0.4.0
- [Reflection](#reflection)
- [Scene](#scene)
- [Shaders](#shaders)
- [Stress Tests](#stress-tests)
- [Tests](#tests)
- [Tools](#tools)
- [Transforms](#transforms)
Expand All @@ -67,7 +68,7 @@ git checkout v0.4.0
- [WASM](#wasm)
- [Setup](#setup-2)
- [Build & Run](#build--run-2)
- [Stress Tests](#stress-tests)
- [Loading Assets](#loading-assets)

# The Bare Minimum

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

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

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

## Input

Expand Down Expand Up @@ -247,6 +246,24 @@ Example | File | Description
`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
`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)

## Stress Tests

These examples are used to test the performance and stability of various parts of the engine in an isolated way.

Due to the focus on performance it's recommended to run the stress tests in release mode:

```sh
cargo run --release --example <example name>
```

Example | File | Description
--- | --- | ---
`bevymark` | [`stress_tests/bevymark.rs`](./stress_tests/bevymark.rs) | A heavy sprite rendering workload to benchmark your system with Bevy
`many_cubes` | [`stress_tests/many_cubes.rs`](./stress_tests/many_cubes.rs) | Simple benchmark to test per-entity draw overhead
`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.
`many_sprites` | [`stress_tests/many_sprites.rs`](./stress_tests/many_sprites.rs) | Displays many sprites in a grid arragement! Used for performance testing.
`transform_hierarchy.rs` | [`stress_tests/transform_hierarchy.rs`](./stress_tests/transform_hierarchy.rs) | Various test cases for hierarchy and transform propagation performance

## Tests

Example | File | Description
Expand All @@ -257,7 +274,6 @@ Example | File | Description

Example | File | Description
--- | --- | ---
`bevymark` | [`tools/bevymark.rs`](./tools/bevymark.rs) | A heavy sprite rendering workload to benchmark your system with Bevy
`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.

## Transforms
Expand Down Expand Up @@ -431,18 +447,3 @@ ruby -run -ehttpd examples/wasm
To load assets, they need to be available in the folder examples/wasm/assets. Cloning this
repository will set it up as a symlink on Linux and macOS, but you will need to manually move
the assets on Windows.

# Stress Tests

These examples are used to test the performance and stability of various parts of the engine in an isolated way.

Due to the focus on performance it's recommended to run the stress tests in release mode:

```sh
cargo run --release --example <example name>
```

Example | File | Description
--- | --- | ---
`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.
`transform_hierarchy.rs` | [`stress_tests/transform_hierarchy.rs`](./stress_tests/transform_hierarchy.rs) | Various test cases for hierarchy and transform propagation performance
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c747cc5

Please sign in to comment.