System: Combine VRR and Optimal Frame Pacing

GSync/FreeSync display users should:
 - DISABLE VSync.
 - ENABLE Optimal Frame Pacing.
This commit is contained in:
Stenzek
2024-04-11 21:26:50 +10:00
parent 2ad67ad3ee
commit 88270771da
26 changed files with 224 additions and 289 deletions

View File

@ -92,6 +92,7 @@ static void SetResourcesDirectory();
static bool SetDataDirectory();
static bool SetCriticalFolders();
static void SetDefaultSettings(SettingsInterface& si, bool system, bool controller);
static void MigrateSettings();
static void SaveSettings();
static bool RunSetupWizard();
static std::string GetResourcePath(std::string_view name, bool allow_override);
@ -379,6 +380,7 @@ bool QtHost::InitializeConfig(std::string settings_filename)
EmuFolders::LoadConfig(*s_base_settings_interface.get());
EmuFolders::EnsureFoldersExist();
MigrateSettings();
// We need to create the console window early, otherwise it appears behind the main window.
if (!Log::IsConsoleOutputEnabled() &&
@ -596,6 +598,21 @@ void QtHost::SetDefaultSettings(SettingsInterface& si, bool system, bool control
}
}
void QtHost::MigrateSettings()
{
SmallString value;
if (s_base_settings_interface->GetStringValue("Display", "SyncMode", &value))
{
s_base_settings_interface->SetBoolValue("Display", "VSync", (value == "VSync" || value == "VSyncRelaxed"));
s_base_settings_interface->SetBoolValue(
"Display", "OptimalFramePacing",
(value == "VRR" || s_base_settings_interface->GetBoolValue("Display", "DisplayAllFrames", false)));
s_base_settings_interface->DeleteValue("Display", "SyncMode");
s_base_settings_interface->DeleteValue("Display", "DisplayAllFrames");
s_base_settings_interface->Save();
}
}
bool EmuThread::shouldRenderToMain() const
{
return !Host::GetBoolSettingValue("Main", "RenderToSeparateWindow", false) && !QtHost::InNoGUIMode();
@ -1551,7 +1568,7 @@ void EmuThread::run()
if (g_gpu_device)
{
System::PresentDisplay(false);
if (!g_gpu_device->IsVSyncActive())
if (!g_gpu_device->IsVSyncEnabled())
g_gpu_device->ThrottlePresentation();
}
}