Use the Continuous
update mode in stress tests when unfocused (#11652)
# Objective - When running any of the stress tests, the refresh rate is currently capped to 60hz because of the `ReactiveLowPower` default used when the window is not in focus. Since stress tests should run as fast as possible (and as such vsync is disabled for all of them), it makes sense to always run them in `Continuous` mode. This is especially useful to avoid capturing non-representative frame times when recording a Tracy frame. ## Solution - Always use the `Continuous` update mode in stress tests.
This commit is contained in:
parent
b1a2d342af
commit
e3cf5f8fb2
@ -15,6 +15,7 @@ use bevy::{
|
|||||||
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
||||||
utils::Duration,
|
utils::Duration,
|
||||||
window::{PresentMode, WindowResolution},
|
window::{PresentMode, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
|
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
|
||||||
|
|
||||||
@ -115,6 +116,10 @@ fn main() {
|
|||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.insert_resource(args)
|
.insert_resource(args)
|
||||||
.insert_resource(BevyCounter {
|
.insert_resource(BevyCounter {
|
||||||
count: 0,
|
count: 0,
|
||||||
|
@ -11,6 +11,7 @@ use bevy::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
render::camera::Camera,
|
render::camera::Camera,
|
||||||
window::{PresentMode, WindowResolution},
|
window::{PresentMode, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
@ -33,6 +34,10 @@ fn main() {
|
|||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
|
@ -4,6 +4,7 @@ use bevy::{
|
|||||||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
const FONT_SIZE: f32 = 7.0;
|
const FONT_SIZE: f32 = 7.0;
|
||||||
@ -62,6 +63,10 @@ fn main() {
|
|||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.add_systems(Update, button_system);
|
.add_systems(Update, button_system);
|
||||||
|
|
||||||
if args.grid {
|
if args.grid {
|
||||||
|
@ -20,6 +20,7 @@ use bevy::{
|
|||||||
render_resource::{Extent3d, TextureDimension, TextureFormat},
|
render_resource::{Extent3d, TextureDimension, TextureFormat},
|
||||||
},
|
},
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
|
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
|
||||||
|
|
||||||
@ -86,6 +87,10 @@ fn main() {
|
|||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.insert_resource(args)
|
.insert_resource(args)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, (move_camera, print_mesh_count))
|
.add_systems(Update, (move_camera, print_mesh_count))
|
||||||
|
@ -10,6 +10,7 @@ use bevy::{
|
|||||||
pbr::CascadeShadowConfigBuilder,
|
pbr::CascadeShadowConfigBuilder,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(FromArgs, Resource)]
|
#[derive(FromArgs, Resource)]
|
||||||
@ -54,6 +55,10 @@ fn main() {
|
|||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.insert_resource(Foxes {
|
.insert_resource(Foxes {
|
||||||
count: args.count,
|
count: args.count,
|
||||||
speed: 2.0,
|
speed: 2.0,
|
||||||
|
@ -4,6 +4,7 @@ use bevy::{
|
|||||||
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
|
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
window::{PresentMode, WindowResolution},
|
window::{PresentMode, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SYSTEM_COUNT: u32 = 10;
|
const SYSTEM_COUNT: u32 = 10;
|
||||||
@ -22,6 +23,10 @@ fn main() {
|
|||||||
}),
|
}),
|
||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.insert_resource(Config {
|
.insert_resource(Config {
|
||||||
line_count: 50_000,
|
line_count: 50_000,
|
||||||
fancy: false,
|
fancy: false,
|
||||||
|
@ -10,6 +10,7 @@ use bevy::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
text::{BreakLineOn, Text2dBounds},
|
text::{BreakLineOn, Text2dBounds},
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -26,6 +27,10 @@ fn main() {
|
|||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.add_systems(Startup, setup);
|
.add_systems(Startup, setup);
|
||||||
|
|
||||||
if std::env::args().any(|arg| arg == "recompute-text") {
|
if std::env::args().any(|arg| arg == "recompute-text") {
|
||||||
|
@ -10,6 +10,7 @@ use bevy::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
render::{camera::ScalingMode, Render, RenderApp, RenderSet},
|
render::{camera::ScalingMode, Render, RenderApp, RenderSet},
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
@ -30,6 +31,10 @@ fn main() {
|
|||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
LogVisibleLights,
|
LogVisibleLights,
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, (move_camera, print_light_count))
|
.add_systems(Update, (move_camera, print_light_count))
|
||||||
.run();
|
.run();
|
||||||
|
@ -11,6 +11,7 @@ use bevy::{
|
|||||||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
@ -41,6 +42,10 @@ fn main() {
|
|||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
|
@ -7,6 +7,7 @@ use bevy::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
text::{BreakLineOn, Text2dBounds},
|
text::{BreakLineOn, Text2dBounds},
|
||||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||||
|
winit::{UpdateMode, WinitSettings},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -24,6 +25,10 @@ fn main() {
|
|||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
LogDiagnosticsPlugin::default(),
|
LogDiagnosticsPlugin::default(),
|
||||||
))
|
))
|
||||||
|
.insert_resource(WinitSettings {
|
||||||
|
focused_mode: UpdateMode::Continuous,
|
||||||
|
unfocused_mode: UpdateMode::Continuous,
|
||||||
|
})
|
||||||
.add_systems(Startup, spawn)
|
.add_systems(Startup, spawn)
|
||||||
.add_systems(Update, update_text_bounds)
|
.add_systems(Update, update_text_bounds)
|
||||||
.run();
|
.run();
|
||||||
|
Loading…
Reference in New Issue
Block a user