Skip to content

Commit

Permalink
Use a consistent scale factor and resolution in stress tests (bevyeng…
Browse files Browse the repository at this point in the history
…ine#10474)

# Objective

Related to bevyengine#10472.

Not having a hardcoded scale factor makes comparing results from these
stress tests difficult.

Contributors using high dpi screens may be rendering 4x as many pixels
as others (or more). Stress tests may have different behavior when moved
from one monitor in a dual setup to another. At very high resolutions,
different parts of the engine / hardware are being stressed.

1080p is also a far more common resolution for gaming.

## Solution

Use a consistent 1080p with `scale_factor_override: 1.0` everywhere.

In bevyengine#9903, this sort of change was added specifically to `bevymark` and
`many_cubes` but it makes sense to do it everywhere.

## Discussion

- Maybe we should have a command line option, environment variable, or
`CI_TESTING_CONFIG` option for 1080p / 1440p / 4k.

- Will these look odd (small text?) when screenshotted and shown in the
example showcase? The aspect ratio is the same, but they will be
downscaled from 1080p instead of ~720p.

- Maybe there are other window properties that should be consistent
across stress tests. e.g. `resizable: false`.

- Should we add a `stress_test_window(title)` helper or something?

- Bevymark (pre-10472) was intentionally 800x600 to match "bunnymark", I
believe. I don't personally think this is very important.
  • Loading branch information
rparrett authored Nov 9, 2023
1 parent e75c2f8 commit cbadc31
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion examples/stress_tests/many_animated_sprites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bevy::{
math::Quat,
prelude::*,
render::camera::Camera,
window::PresentMode,
window::{PresentMode, WindowResolution},
};

use rand::Rng;
Expand All @@ -26,6 +26,8 @@ fn main() {
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down
3 changes: 2 additions & 1 deletion examples/stress_tests/many_buttons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use argh::FromArgs;
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
window::{PresentMode, WindowPlugin},
window::{PresentMode, WindowPlugin, WindowResolution},
};

const FONT_SIZE: f32 = 7.0;
Expand Down Expand Up @@ -49,6 +49,7 @@ fn main() {
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down
4 changes: 3 additions & 1 deletion examples/stress_tests/many_foxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
pbr::CascadeShadowConfigBuilder,
prelude::*,
window::{PresentMode, WindowPlugin},
window::{PresentMode, WindowPlugin, WindowResolution},
};

#[derive(FromArgs, Resource)]
Expand Down Expand Up @@ -41,6 +41,8 @@ fn main() {
primary_window: Some(Window {
title: "🦊🦊🦊 Many Foxes! 🦊🦊🦊".into(),
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down
3 changes: 2 additions & 1 deletion examples/stress_tests/many_gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::f32::consts::TAU;
use bevy::{
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
prelude::*,
window::PresentMode,
window::{PresentMode, WindowResolution},
};

const SYSTEM_COUNT: u32 = 10;
Expand All @@ -15,6 +15,7 @@ fn main() {
primary_window: Some(Window {
title: "Many Debug Lines".to_string(),
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down
3 changes: 2 additions & 1 deletion examples/stress_tests/many_glyphs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
text::{BreakLineOn, Text2dBounds},
window::{PresentMode, WindowPlugin},
window::{PresentMode, WindowPlugin, WindowResolution},
};

fn main() {
Expand All @@ -18,6 +18,7 @@ fn main() {
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down
5 changes: 3 additions & 2 deletions examples/stress_tests/many_lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bevy::{
pbr::{ExtractedPointLight, GlobalLightMeta},
prelude::*,
render::{camera::ScalingMode, Render, RenderApp, RenderSet},
window::{PresentMode, WindowPlugin},
window::{PresentMode, WindowPlugin, WindowResolution},
};
use rand::{thread_rng, Rng};

Expand All @@ -18,7 +18,8 @@ fn main() {
.add_plugins((
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
resolution: (1024.0, 768.0).into(),
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
title: "many_lights".into(),
present_mode: PresentMode::AutoNoVsync,
..default()
Expand Down
4 changes: 3 additions & 1 deletion examples/stress_tests/many_sprites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
window::{PresentMode, WindowPlugin},
window::{PresentMode, WindowPlugin, WindowResolution},
};

use rand::Rng;
Expand All @@ -34,6 +34,8 @@ fn main() {
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down
4 changes: 3 additions & 1 deletion examples/stress_tests/text_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
text::{BreakLineOn, Text2dBounds},
window::{PresentMode, WindowPlugin},
window::{PresentMode, WindowPlugin, WindowResolution},
};

fn main() {
Expand All @@ -15,6 +15,8 @@ fn main() {
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default()
}),
..default()
Expand Down

0 comments on commit cbadc31

Please sign in to comment.