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

@ -218,7 +218,7 @@ bool MainWindow::createDisplay(bool fullscreen, bool render_to_main)
g_emu_thread->connectDisplaySignals(m_display_widget);
if (!g_host_display->CreateDevice(wi.value()))
if (!g_host_display->CreateDevice(wi.value(), System::ShouldUseVSync()))
{
QMessageBox::critical(this, tr("Error"), tr("Failed to create host display device context."));
destroyDisplayWidget(true);

View File

@ -754,18 +754,12 @@ bool EmuThread::acquireHostDisplay(RenderAPI api)
m_is_exclusive_fullscreen = g_host_display->IsFullscreen();
if (m_run_fullscreen_ui)
if (m_run_fullscreen_ui && !FullscreenUI::Initialize())
{
if (!FullscreenUI::Initialize())
{
Log_ErrorPrint("Failed to initialize fullscreen UI");
releaseHostDisplay();
m_run_fullscreen_ui = false;
return false;
}
// start with vsync on
g_host_display->SetVSync(true);
Log_ErrorPrint("Failed to initialize fullscreen UI");
releaseHostDisplay();
m_run_fullscreen_ui = false;
return false;
}
return true;
@ -1439,7 +1433,11 @@ void EmuThread::run()
m_event_loop->processEvents(QEventLoop::AllEvents);
CommonHost::PumpMessagesOnCPUThread();
if (g_host_display)
{
renderDisplay(false);
if (!g_host_display->IsVsyncEnabled())
g_host_display->ThrottlePresentation();
}
}
}