From cbadc31d19e1d40841969ac503d49b3fff030f57 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Thu, 9 Nov 2023 15:05:32 -0700 Subject: [PATCH] Use a consistent scale factor and resolution in stress tests (#10474) # Objective Related to #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 #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. --- examples/stress_tests/many_animated_sprites.rs | 4 +++- examples/stress_tests/many_buttons.rs | 3 ++- examples/stress_tests/many_foxes.rs | 4 +++- examples/stress_tests/many_gizmos.rs | 3 ++- examples/stress_tests/many_glyphs.rs | 3 ++- examples/stress_tests/many_lights.rs | 5 +++-- examples/stress_tests/many_sprites.rs | 4 +++- examples/stress_tests/text_pipeline.rs | 4 +++- 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/examples/stress_tests/many_animated_sprites.rs b/examples/stress_tests/many_animated_sprites.rs index 9e8962473036d..ec5b3d7953905 100644 --- a/examples/stress_tests/many_animated_sprites.rs +++ b/examples/stress_tests/many_animated_sprites.rs @@ -10,7 +10,7 @@ use bevy::{ math::Quat, prelude::*, render::camera::Camera, - window::PresentMode, + window::{PresentMode, WindowResolution}, }; use rand::Rng; @@ -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() diff --git a/examples/stress_tests/many_buttons.rs b/examples/stress_tests/many_buttons.rs index d7c8533c37a07..3521a92f7d183 100644 --- a/examples/stress_tests/many_buttons.rs +++ b/examples/stress_tests/many_buttons.rs @@ -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; @@ -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() diff --git a/examples/stress_tests/many_foxes.rs b/examples/stress_tests/many_foxes.rs index 367b437cfbbe7..bef3cab8a2f0f 100644 --- a/examples/stress_tests/many_foxes.rs +++ b/examples/stress_tests/many_foxes.rs @@ -9,7 +9,7 @@ use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, pbr::CascadeShadowConfigBuilder, prelude::*, - window::{PresentMode, WindowPlugin}, + window::{PresentMode, WindowPlugin, WindowResolution}, }; #[derive(FromArgs, Resource)] @@ -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() diff --git a/examples/stress_tests/many_gizmos.rs b/examples/stress_tests/many_gizmos.rs index f0a72f451e2db..018423991595d 100644 --- a/examples/stress_tests/many_gizmos.rs +++ b/examples/stress_tests/many_gizmos.rs @@ -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; @@ -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() diff --git a/examples/stress_tests/many_glyphs.rs b/examples/stress_tests/many_glyphs.rs index d4b18507cd1a9..f0427ee79133e 100644 --- a/examples/stress_tests/many_glyphs.rs +++ b/examples/stress_tests/many_glyphs.rs @@ -9,7 +9,7 @@ use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, text::{BreakLineOn, Text2dBounds}, - window::{PresentMode, WindowPlugin}, + window::{PresentMode, WindowPlugin, WindowResolution}, }; fn main() { @@ -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() diff --git a/examples/stress_tests/many_lights.rs b/examples/stress_tests/many_lights.rs index b42d1b42cc9c5..a64680a25b3f6 100644 --- a/examples/stress_tests/many_lights.rs +++ b/examples/stress_tests/many_lights.rs @@ -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}; @@ -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() diff --git a/examples/stress_tests/many_sprites.rs b/examples/stress_tests/many_sprites.rs index ab539af1b9c95..a357fbba057e2 100644 --- a/examples/stress_tests/many_sprites.rs +++ b/examples/stress_tests/many_sprites.rs @@ -10,7 +10,7 @@ use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, - window::{PresentMode, WindowPlugin}, + window::{PresentMode, WindowPlugin, WindowResolution}, }; use rand::Rng; @@ -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() diff --git a/examples/stress_tests/text_pipeline.rs b/examples/stress_tests/text_pipeline.rs index da31326005486..c4781294a4dab 100644 --- a/examples/stress_tests/text_pipeline.rs +++ b/examples/stress_tests/text_pipeline.rs @@ -6,7 +6,7 @@ use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, text::{BreakLineOn, Text2dBounds}, - window::{PresentMode, WindowPlugin}, + window::{PresentMode, WindowPlugin, WindowResolution}, }; fn main() { @@ -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()