Skip to content

Commit 6beb463

Browse files
committed
Cleanup many sprites stress tests (#7436)
Since the new renderer, no frustum culling is applied to 2d components (be it Sprite or Mesh2d), the stress_tests docs is therefore misleading and should be updated. Furthermore, the `many_animated_sprites` example, unlike `many_sprites` kept vsync enabled, making the stress test less useful than it could be. We now disable vsync for `many_animated_sprites`. Also, `many_animated_sprites` didn't have the stress_tests warning message, instead, it had a paragraph in the module doc. I replaced the module doc paragraph by the warning message, to be more in line with other examples. ## Solution - Remove the paragraph about frustum culling in the `many_sprites` and `many_animated_sprites` stress tests
1 parent 69fc8c6 commit 6beb463

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

examples/stress_tests/many_animated_sprites.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Renders a lot of animated sprites to allow performance testing.
22
//!
3-
//! It sets up many animated sprites in different sizes and rotations, and at different scales in the world,
4-
//! and moves the camera over them to see how well frustum culling works.
3+
//! It sets up many animated sprites in different sizes and rotations,
4+
//! and at different scales in the world, and moves the camera over them.
55
//!
6-
//! To measure performance realistically, be sure to run this in release mode.
7-
//! `cargo run --example many_animated_sprites --release`
6+
//! Having sprites out of the camera's field of view should also help stress
7+
//! test any future potential 2d frustum culling implementation.
88
99
use std::time::Duration;
1010

@@ -13,6 +13,7 @@ use bevy::{
1313
math::Quat,
1414
prelude::*,
1515
render::camera::Camera,
16+
window::PresentMode,
1617
};
1718

1819
use rand::Rng;
@@ -24,7 +25,13 @@ fn main() {
2425
// Since this is also used as a benchmark, we want it to display performance data.
2526
.add_plugin(LogDiagnosticsPlugin::default())
2627
.add_plugin(FrameTimeDiagnosticsPlugin::default())
27-
.add_plugins(DefaultPlugins)
28+
.add_plugins(DefaultPlugins.set(WindowPlugin {
29+
primary_window: Some(Window {
30+
present_mode: PresentMode::AutoNoVsync,
31+
..default()
32+
}),
33+
..default()
34+
}))
2835
.add_startup_system(setup)
2936
.add_system(animate_sprite)
3037
.add_system(print_sprite_count)
@@ -37,6 +44,8 @@ fn setup(
3744
assets: Res<AssetServer>,
3845
mut texture_atlases: ResMut<Assets<TextureAtlas>>,
3946
) {
47+
warn!(include_str!("warning_string.txt"));
48+
4049
let mut rng = rand::thread_rng();
4150

4251
let tile_size = Vec2::splat(64.0);

examples/stress_tests/many_sprites.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
//! Renders a lot of sprites to allow performance testing.
22
//! See <https://github.com/bevyengine/bevy/pull/1492>
33
//!
4-
//! It sets up many sprites in different sizes and rotations, and at different scales in the world,
5-
//! and moves the camera over them to see how well frustum culling works.
4+
//! It sets up many animated sprites in different sizes and rotations,
5+
//! and at different scales in the world, and moves the camera over them.
6+
//!
7+
//! Having sprites out of the camera's field of view should also help stress
8+
//! test any future potential 2d frustum culling implementation.
69
//!
710
//! Add the `--colored` arg to run with color tinted sprites. This will cause the sprites to be rendered
811
//! in multiple batches, reducing performance but useful for testing.

0 commit comments

Comments
 (0)