HostDisplay: Manually throttle fullscreen UI presentation

Fixes flickering screen in fullscreen with Vulkan.
This commit is contained in:
Connor McLaughlin
2022-12-04 14:05:57 +10:00
parent eafa4fb1a3
commit 7d3ac98cc6
19 changed files with 81 additions and 58 deletions

View File

@ -640,6 +640,8 @@ void NoGUIHost::CPUThreadMainLoop()
Host::PumpMessagesOnCPUThread();
Host::RenderDisplay(false);
if (!g_host_display->IsVsyncEnabled())
g_host_display->ThrottlePresentation();
}
}
@ -654,7 +656,7 @@ bool NoGUIHost::AcquireHostDisplay(RenderAPI api)
if (wi.has_value())
{
g_host_display = Host::CreateDisplayForAPI(api);
if (g_host_display && !g_host_display->CreateDevice(wi.value()))
if (g_host_display && !g_host_display->CreateDevice(wi.value(), System::ShouldUseVSync()))
g_host_display.reset();
}
@ -675,8 +677,8 @@ bool NoGUIHost::AcquireHostDisplay(RenderAPI api)
return false;
}
if (!g_host_display->MakeCurrent() || !g_host_display->SetupDevice() ||
!ImGuiManager::Initialize() || !CommonHost::CreateHostDisplayResources())
if (!g_host_display->MakeCurrent() || !g_host_display->SetupDevice() || !ImGuiManager::Initialize() ||
!CommonHost::CreateHostDisplayResources())
{
ImGuiManager::Shutdown();
CommonHost::ReleaseHostDisplayResources();