From 10de915ae0f76d1ffe7d9246f3a26bd3f9a7ef41 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 16 Jan 2025 21:39:03 +1000 Subject: [PATCH] System: Remove 'sync_to_host_with_vsync' Disabling the throttler with threaded rendering just leads to the CPU thread pushing multiple frames, and getting backpressured from the GPU thread. In other words, input lag. --- src/core/system.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index e71776320..eedfe27df 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -259,7 +259,6 @@ struct ALIGN_TO_CACHE_LINE StateVars bool can_sync_to_host = false; bool syncing_to_host = false; - bool syncing_to_host_with_vsync = false; bool fast_forward_enabled = false; bool turbo_enabled = false; @@ -2185,7 +2184,7 @@ bool System::GetFramePresentationParameters(GPUBackendFramePresentationParameter const bool skip_this_frame = ((is_duplicate_frame || (!s_state.optimal_frame_pacing && current_time > s_state.next_frame_time && s_state.skipped_frame_count < MAX_SKIPPED_TIMEOUT_FRAME_COUNT)) && - !s_state.syncing_to_host_with_vsync && !IsExecutionInterrupted()); + !IsExecutionInterrupted()); const bool should_allow_present_skip = IsRunningAtNonStandardSpeed(); frame->update_performance_counters = !is_duplicate_frame; frame->present_frame = !skip_this_frame; @@ -3441,7 +3440,7 @@ float System::GetTargetSpeed() float System::GetAudioNominalRate() { - return (s_state.throttler_enabled || s_state.syncing_to_host_with_vsync) ? s_state.target_speed : 1.0f; + return s_state.throttler_enabled ? s_state.target_speed : 1.0f; } void System::AccumulatePreFrameSleepTime(Timer::Value current_time) @@ -3512,7 +3511,6 @@ void System::UpdateSpeedLimiterState() s_state.pre_frame_sleep = s_state.optimal_frame_pacing && g_settings.display_pre_frame_sleep; s_state.can_sync_to_host = false; s_state.syncing_to_host = false; - s_state.syncing_to_host_with_vsync = false; if (g_settings.sync_to_host_refresh_rate) { @@ -3526,17 +3524,7 @@ void System::UpdateSpeedLimiterState() s_state.syncing_to_host = (s_state.can_sync_to_host && g_settings.sync_to_host_refresh_rate && s_state.target_speed == 1.0f); if (s_state.syncing_to_host) - { s_state.target_speed = ratio; - - // When syncing to host and using vsync, we don't need to sleep. - s_state.syncing_to_host_with_vsync = g_settings.display_vsync; - if (s_state.syncing_to_host_with_vsync) - { - INFO_LOG("Using host vsync for throttling."); - s_state.throttler_enabled = false; - } - } } } @@ -3581,8 +3569,7 @@ void System::UpdateDisplayVSync() const GPUVSyncMode vsync_mode = GetEffectiveVSyncMode(); const bool allow_present_throttle = ShouldAllowPresentThrottle(); - VERBOSE_LOG("VSync: {}{}{}", GPUDevice::VSyncModeToString(vsync_mode), - s_state.syncing_to_host_with_vsync ? " (for throttling)" : "", + VERBOSE_LOG("VSync: {}{}", GPUDevice::VSyncModeToString(vsync_mode), allow_present_throttle ? " (present throttle allowed)" : ""); GPUThread::SetVSync(vsync_mode, allow_present_throttle);