Disable Vsync for stress tests. (#5187)

# Objective

Currently stress tests are vsynced. This is undesirable for a stress test, as you want to run them with uncapped framerates.

## Solution

Ensure all stress tests are using PresentMode::Immediate if they render anything.
This commit is contained in:
Elabajaba 2022-07-03 20:17:27 +00:00
parent 33f9b3940d
commit 72e7358636
4 changed files with 14 additions and 1 deletions

View File

@ -14,10 +14,15 @@ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
math::{DVec2, DVec3}, math::{DVec2, DVec3},
prelude::*, prelude::*,
window::PresentMode,
}; };
fn main() { fn main() {
App::new() App::new()
.insert_resource(WindowDescriptor {
present_mode: PresentMode::Immediate,
..default()
})
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_plugin(FrameTimeDiagnosticsPlugin::default()) .add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(LogDiagnosticsPlugin::default()) .add_plugin(LogDiagnosticsPlugin::default())

View File

@ -4,6 +4,7 @@
use bevy::{ use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*, prelude::*,
window::PresentMode,
}; };
struct Foxes { struct Foxes {
@ -16,6 +17,7 @@ fn main() {
App::new() App::new()
.insert_resource(WindowDescriptor { .insert_resource(WindowDescriptor {
title: "🦊🦊🦊 Many Foxes! 🦊🦊🦊".to_string(), title: "🦊🦊🦊 Many Foxes! 🦊🦊🦊".to_string(),
present_mode: PresentMode::Immediate,
..default() ..default()
}) })
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)

View File

@ -7,6 +7,7 @@ use bevy::{
pbr::{ExtractedPointLight, GlobalLightMeta}, pbr::{ExtractedPointLight, GlobalLightMeta},
prelude::*, prelude::*,
render::{camera::ScalingMode, RenderApp, RenderStage}, render::{camera::ScalingMode, RenderApp, RenderStage},
window::PresentMode,
}; };
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
@ -16,7 +17,7 @@ fn main() {
width: 1024.0, width: 1024.0,
height: 768.0, height: 768.0,
title: "many_lights".to_string(), title: "many_lights".to_string(),
present_mode: bevy::window::PresentMode::Immediate, present_mode: PresentMode::Immediate,
..default() ..default()
}) })
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)

View File

@ -9,6 +9,7 @@ use bevy::{
math::Quat, math::Quat,
prelude::*, prelude::*,
render::camera::Camera, render::camera::Camera,
window::PresentMode,
}; };
use rand::Rng; use rand::Rng;
@ -17,6 +18,10 @@ const CAMERA_SPEED: f32 = 1000.0;
fn main() { fn main() {
App::new() App::new()
.insert_resource(WindowDescriptor {
present_mode: PresentMode::Immediate,
..default()
})
// Since this is also used as a benchmark, we want it to display performance data. // Since this is also used as a benchmark, we want it to display performance data.
.add_plugin(LogDiagnosticsPlugin::default()) .add_plugin(LogDiagnosticsPlugin::default())
.add_plugin(FrameTimeDiagnosticsPlugin::default()) .add_plugin(FrameTimeDiagnosticsPlugin::default())