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.
This commit is contained in:
Rob Parrett 2023-11-09 15:05:32 -07:00 committed by GitHub
parent e75c2f8b16
commit cbadc31d19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 9 deletions

View file

@ -10,7 +10,7 @@ use bevy::{
math::Quat, math::Quat,
prelude::*, prelude::*,
render::camera::Camera, render::camera::Camera,
window::PresentMode, window::{PresentMode, WindowResolution},
}; };
use rand::Rng; use rand::Rng;
@ -26,6 +26,8 @@ fn main() {
DefaultPlugins.set(WindowPlugin { DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window { primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()

View file

@ -3,7 +3,7 @@ use argh::FromArgs;
use bevy::{ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*, prelude::*,
window::{PresentMode, WindowPlugin}, window::{PresentMode, WindowPlugin, WindowResolution},
}; };
const FONT_SIZE: f32 = 7.0; const FONT_SIZE: f32 = 7.0;
@ -49,6 +49,7 @@ fn main() {
DefaultPlugins.set(WindowPlugin { DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window { primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()

View file

@ -9,7 +9,7 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
pbr::CascadeShadowConfigBuilder, pbr::CascadeShadowConfigBuilder,
prelude::*, prelude::*,
window::{PresentMode, WindowPlugin}, window::{PresentMode, WindowPlugin, WindowResolution},
}; };
#[derive(FromArgs, Resource)] #[derive(FromArgs, Resource)]
@ -41,6 +41,8 @@ fn main() {
primary_window: Some(Window { primary_window: Some(Window {
title: "🦊🦊🦊 Many Foxes! 🦊🦊🦊".into(), title: "🦊🦊🦊 Many Foxes! 🦊🦊🦊".into(),
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()

View file

@ -3,7 +3,7 @@ use std::f32::consts::TAU;
use bevy::{ use bevy::{
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}, diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
prelude::*, prelude::*,
window::PresentMode, window::{PresentMode, WindowResolution},
}; };
const SYSTEM_COUNT: u32 = 10; const SYSTEM_COUNT: u32 = 10;
@ -15,6 +15,7 @@ fn main() {
primary_window: Some(Window { primary_window: Some(Window {
title: "Many Debug Lines".to_string(), title: "Many Debug Lines".to_string(),
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()

View file

@ -9,7 +9,7 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*, prelude::*,
text::{BreakLineOn, Text2dBounds}, text::{BreakLineOn, Text2dBounds},
window::{PresentMode, WindowPlugin}, window::{PresentMode, WindowPlugin, WindowResolution},
}; };
fn main() { fn main() {
@ -18,6 +18,7 @@ fn main() {
DefaultPlugins.set(WindowPlugin { DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window { primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()

View file

@ -9,7 +9,7 @@ use bevy::{
pbr::{ExtractedPointLight, GlobalLightMeta}, pbr::{ExtractedPointLight, GlobalLightMeta},
prelude::*, prelude::*,
render::{camera::ScalingMode, Render, RenderApp, RenderSet}, render::{camera::ScalingMode, Render, RenderApp, RenderSet},
window::{PresentMode, WindowPlugin}, window::{PresentMode, WindowPlugin, WindowResolution},
}; };
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
@ -18,7 +18,8 @@ fn main() {
.add_plugins(( .add_plugins((
DefaultPlugins.set(WindowPlugin { DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window { 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(), title: "many_lights".into(),
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
..default() ..default()

View file

@ -10,7 +10,7 @@
use bevy::{ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*, prelude::*,
window::{PresentMode, WindowPlugin}, window::{PresentMode, WindowPlugin, WindowResolution},
}; };
use rand::Rng; use rand::Rng;
@ -34,6 +34,8 @@ fn main() {
DefaultPlugins.set(WindowPlugin { DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window { primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()

View file

@ -6,7 +6,7 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*, prelude::*,
text::{BreakLineOn, Text2dBounds}, text::{BreakLineOn, Text2dBounds},
window::{PresentMode, WindowPlugin}, window::{PresentMode, WindowPlugin, WindowResolution},
}; };
fn main() { fn main() {
@ -15,6 +15,8 @@ fn main() {
DefaultPlugins.set(WindowPlugin { DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window { primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
resolution: WindowResolution::new(1920.0, 1080.0)
.with_scale_factor_override(1.0),
..default() ..default()
}), }),
..default() ..default()