Added performance warning when running stress test examples in debug mode (#5029)

# Objective

Fixes #5028

## Solution
Used #[cfg(debug_assertions)] to display a warning when running examples under stress_tests in debug mode
This commit is contained in:
Troels Jessen 2022-07-13 19:13:46 +00:00
parent 6c06fc5b7c
commit b3d15153f3
8 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# Stress tests
These examples are used to stress test Bevy's performance in various ways. These should be run with the --release argument to cargo or equivalent optimization, otherwise they will be very slow.

View file

@ -90,6 +90,8 @@ struct BirdTexture(Handle<Image>);
struct StatsText;
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
warn!(include_str!("warning_string.txt"));
let texture = asset_server.load("branding/icon.png");
commands.spawn_bundle(Camera2dBundle::default());

View file

@ -37,6 +37,8 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
warn!(include_str!("warning_string.txt"));
const WIDTH: usize = 200;
const HEIGHT: usize = 200;
let mesh = meshes.add(Mesh::from(shape::Cube { size: 1.0 }));

View file

@ -73,6 +73,8 @@ fn setup(
mut materials: ResMut<Assets<StandardMaterial>>,
foxes: Res<Foxes>,
) {
warn!(include_str!("warning_string.txt"));
// Insert a resource with the current scene information
commands.insert_resource(Animations(vec![
asset_server.load("models/animated/Fox.glb#Animation2"),

View file

@ -35,6 +35,8 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
warn!(include_str!("warning_string.txt"));
const LIGHT_RADIUS: f32 = 0.3;
const LIGHT_INTENSITY: f32 = 5.0;
const RADIUS: f32 = 50.0;

View file

@ -33,6 +33,8 @@ fn main() {
}
fn setup(mut commands: Commands, assets: Res<AssetServer>) {
warn!(include_str!("warning_string.txt"));
let mut rng = rand::thread_rng();
let tile_size = Vec2::splat(64.0);

View file

@ -257,7 +257,10 @@ fn set_translation(translation: &mut Vec3, a: f32) {
}
fn setup(mut commands: Commands, cfg: Res<Cfg>) {
warn!(include_str!("warning_string.txt"));
let mut cam = Camera2dBundle::default();
cam.transform.translation.z = 100.0;
commands.spawn_bundle(cam);

View file

@ -0,0 +1 @@
This is a stress test used to push Bevy to its limit and debug performance issues. It is not representative of an actual game. It must be run in release mode using --release or it will be very slow.