From 64b336805eb54e586b62cc5fb47566ac7ec68e60 Mon Sep 17 00:00:00 2001 From: Margen67 Date: Thu, 16 Dec 2021 13:57:56 -0800 Subject: [PATCH] Add vsync_interval option --- src/xenia/gpu/gpu_flags.cc | 3 +++ src/xenia/gpu/gpu_flags.h | 2 ++ src/xenia/gpu/graphics_system.cc | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/gpu_flags.cc b/src/xenia/gpu/gpu_flags.cc index 1510eeec0..ce7ac9bcc 100644 --- a/src/xenia/gpu/gpu_flags.cc +++ b/src/xenia/gpu/gpu_flags.cc @@ -20,6 +20,9 @@ DEFINE_path( DEFINE_bool(vsync, true, "Enable VSYNC.", "GPU"); +DEFINE_uint64(vsync_interval, 16, + "VSYNC interval. Value is frametime in milliseconds.", "GPU"); + DEFINE_bool( gpu_allow_invalid_fetch_constants, false, "Allow texture and vertex fetch constants with invalid type - generally " diff --git a/src/xenia/gpu/gpu_flags.h b/src/xenia/gpu/gpu_flags.h index 5ae64b76e..2a675f5a1 100644 --- a/src/xenia/gpu/gpu_flags.h +++ b/src/xenia/gpu/gpu_flags.h @@ -18,6 +18,8 @@ DECLARE_path(dump_shaders); DECLARE_bool(vsync); +DECLARE_uint64(vsync_interval); + DECLARE_bool(gpu_allow_invalid_fetch_constants); DECLARE_bool(half_pixel_offset); diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index b5470fd0a..b49b9925a 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -7,6 +7,8 @@ ****************************************************************************** */ +#include + #include "xenia/gpu/graphics_system.h" #include @@ -98,7 +100,8 @@ X_STATUS GraphicsSystem::Setup(cpu::Processor* processor, vsync_worker_running_ = true; vsync_worker_thread_ = kernel::object_ref( new kernel::XHostThread(kernel_state_, 128 * 1024, 0, [this]() { - uint64_t vsync_duration = cvars::vsync ? 16 : 1; + uint64_t vsync_duration = + cvars::vsync ? std::max(5, cvars::vsync_interval) : 1; uint64_t last_frame_time = Clock::QueryGuestTickCount(); while (vsync_worker_running_) { uint64_t current_time = Clock::QueryGuestTickCount();