System: Move present skip check to core
This commit is contained in:
parent
de21ff250c
commit
c7e8233b7b
|
@ -124,7 +124,7 @@ public:
|
|||
u32 width, u32 height, void* out_data, u32 out_data_stride) = 0;
|
||||
|
||||
/// Returns false if the window was completely occluded.
|
||||
virtual bool Render() = 0;
|
||||
virtual bool Render(bool skip_present) = 0;
|
||||
|
||||
/// Renders the display with postprocessing to the specified image.
|
||||
virtual bool RenderScreenshot(u32 width, u32 height, std::vector<u32>* out_pixels, u32* out_stride,
|
||||
|
@ -318,6 +318,6 @@ void ReleaseHostDisplay();
|
|||
//void EndPresentFrame();
|
||||
|
||||
/// Provided by the host; renders the display.
|
||||
void RenderDisplay();
|
||||
void RenderDisplay(bool skip_present);
|
||||
void InvalidateDisplay();
|
||||
} // namespace Host
|
||||
|
|
|
@ -996,7 +996,7 @@ bool System::LoadState(const char* filename)
|
|||
|
||||
ResetPerformanceCounters();
|
||||
ResetThrottler();
|
||||
Host::RenderDisplay();
|
||||
Host::RenderDisplay(false);
|
||||
Log_VerbosePrintf("Loading state took %.2f msec", load_timer.GetTimeMilliseconds());
|
||||
return true;
|
||||
}
|
||||
|
@ -1463,7 +1463,7 @@ void System::Execute()
|
|||
PauseSystem(true);
|
||||
}
|
||||
|
||||
Host::RenderDisplay();
|
||||
Host::RenderDisplay(g_host_display->ShouldSkipDisplayingFrame());
|
||||
|
||||
System::UpdatePerformanceCounters();
|
||||
|
||||
|
@ -1502,7 +1502,7 @@ void System::RecreateSystem()
|
|||
|
||||
ResetPerformanceCounters();
|
||||
ResetThrottler();
|
||||
Host::RenderDisplay();
|
||||
Host::RenderDisplay(false);
|
||||
|
||||
if (was_paused)
|
||||
PauseSystem(true);
|
||||
|
|
|
@ -502,7 +502,7 @@ void EmuThread::bootSystem(std::shared_ptr<SystemBootParameters> params)
|
|||
return;
|
||||
|
||||
// force a frame to be drawn to repaint the window
|
||||
renderDisplay();
|
||||
renderDisplay(false);
|
||||
}
|
||||
|
||||
void EmuThread::bootOrLoadState(std::string path)
|
||||
|
@ -626,7 +626,7 @@ void EmuThread::onDisplayWindowResized(int width, int height)
|
|||
|
||||
// force redraw if we're paused
|
||||
if (!System::IsRunning() && !FullscreenUI::HasActiveWindow())
|
||||
renderDisplay();
|
||||
renderDisplay(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,7 +641,7 @@ void EmuThread::redrawDisplayWindow()
|
|||
if (!g_host_display || System::IsShutdown())
|
||||
return;
|
||||
|
||||
renderDisplay();
|
||||
renderDisplay(false);
|
||||
}
|
||||
|
||||
void EmuThread::toggleFullscreen()
|
||||
|
@ -875,7 +875,7 @@ void Host::OnSystemPaused()
|
|||
|
||||
emit g_emu_thread->systemPaused();
|
||||
g_emu_thread->startBackgroundControllerPollTimer();
|
||||
g_emu_thread->renderDisplay();
|
||||
g_emu_thread->renderDisplay(false);
|
||||
}
|
||||
|
||||
void Host::OnSystemResumed()
|
||||
|
@ -1244,7 +1244,7 @@ void EmuThread::singleStepCPU()
|
|||
return;
|
||||
|
||||
System::SingleStepCPU();
|
||||
renderDisplay();
|
||||
renderDisplay(false);
|
||||
}
|
||||
|
||||
void EmuThread::dumpRAM(const QString& filename)
|
||||
|
@ -1444,7 +1444,7 @@ void EmuThread::run()
|
|||
continue;
|
||||
}
|
||||
|
||||
renderDisplay();
|
||||
renderDisplay(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1458,27 +1458,32 @@ void EmuThread::run()
|
|||
moveToThread(m_ui_thread);
|
||||
}
|
||||
|
||||
void EmuThread::renderDisplay()
|
||||
void EmuThread::renderDisplay(bool skip_present)
|
||||
{
|
||||
// acquire for IO.MousePos.
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
|
||||
FullscreenUI::Render();
|
||||
ImGuiManager::RenderOverlays();
|
||||
ImGuiManager::RenderOSD();
|
||||
ImGuiManager::RenderDebugWindows();
|
||||
g_host_display->Render();
|
||||
if (!skip_present)
|
||||
{
|
||||
FullscreenUI::Render();
|
||||
ImGuiManager::RenderOverlays();
|
||||
ImGuiManager::RenderOSD();
|
||||
ImGuiManager::RenderDebugWindows();
|
||||
}
|
||||
|
||||
g_host_display->Render(skip_present);
|
||||
|
||||
ImGuiManager::NewFrame();
|
||||
}
|
||||
|
||||
void Host::InvalidateDisplay()
|
||||
{
|
||||
g_emu_thread->renderDisplay();
|
||||
g_emu_thread->renderDisplay(false);
|
||||
}
|
||||
|
||||
void Host::RenderDisplay()
|
||||
void Host::RenderDisplay(bool skip_present)
|
||||
{
|
||||
g_emu_thread->renderDisplay();
|
||||
g_emu_thread->renderDisplay(skip_present);
|
||||
}
|
||||
|
||||
void EmuThread::wakeThread()
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
bool acquireHostDisplay(HostDisplay::RenderAPI api);
|
||||
void connectDisplaySignals(DisplayWidget* widget);
|
||||
void releaseHostDisplay();
|
||||
void renderDisplay();
|
||||
void renderDisplay(bool skip_present);
|
||||
|
||||
void startBackgroundControllerPollTimer();
|
||||
void stopBackgroundControllerPollTimer();
|
||||
|
|
|
@ -394,7 +394,7 @@ void Host::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/,
|
|||
ImGui::End();
|
||||
|
||||
ImGui::EndFrame();
|
||||
g_host_display->Render();
|
||||
g_host_display->Render(false);
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
|
||||
|
|
|
@ -745,9 +745,9 @@ bool D3D11HostDisplay::UpdateImGuiFontTexture()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool D3D11HostDisplay::Render()
|
||||
bool D3D11HostDisplay::Render(bool skip_present)
|
||||
{
|
||||
if (ShouldSkipDisplayingFrame() || !m_swap_chain)
|
||||
if (skip_present || !m_swap_chain)
|
||||
{
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
void SetVSync(bool enabled) override;
|
||||
|
||||
bool Render() override;
|
||||
bool Render(bool skip_present) override;
|
||||
bool RenderScreenshot(u32 width, u32 height, std::vector<u32>* out_pixels, u32* out_stride,
|
||||
HostDisplayPixelFormat* out_format) override;
|
||||
|
||||
|
|
|
@ -650,9 +650,9 @@ bool D3D12HostDisplay::UpdateImGuiFontTexture()
|
|||
return ImGui_ImplDX12_CreateFontsTexture();
|
||||
}
|
||||
|
||||
bool D3D12HostDisplay::Render()
|
||||
bool D3D12HostDisplay::Render(bool skip_present)
|
||||
{
|
||||
if (ShouldSkipDisplayingFrame() || !m_swap_chain)
|
||||
if (skip_present || !m_swap_chain)
|
||||
{
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
virtual void SetVSync(bool enabled) override;
|
||||
|
||||
virtual bool Render() override;
|
||||
virtual bool Render(bool skip_present) override;
|
||||
virtual bool RenderScreenshot(u32 width, u32 height, std::vector<u32>* out_pixels, u32* out_stride,
|
||||
HostDisplayPixelFormat* out_format) override;
|
||||
|
||||
|
|
|
@ -738,9 +738,9 @@ void OpenGLHostDisplay::DestroyResources()
|
|||
m_display_program.Destroy();
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::Render()
|
||||
bool OpenGLHostDisplay::Render(bool skip_present)
|
||||
{
|
||||
if (ShouldSkipDisplayingFrame())
|
||||
if (skip_present || m_window_info.type == WindowInfo::Type::Surfaceless)
|
||||
{
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
void SetVSync(bool enabled) override;
|
||||
|
||||
bool Render() override;
|
||||
bool Render(bool skip_present) override;
|
||||
bool RenderScreenshot(u32 width, u32 height, std::vector<u32>* out_pixels, u32* out_stride,
|
||||
HostDisplayPixelFormat* out_format) override;
|
||||
|
||||
|
|
|
@ -572,9 +572,9 @@ bool VulkanHostDisplay::DoneRenderContextCurrent()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool VulkanHostDisplay::Render()
|
||||
bool VulkanHostDisplay::Render(bool skip_present)
|
||||
{
|
||||
if (ShouldSkipDisplayingFrame() || !m_swap_chain)
|
||||
if (skip_present || !m_swap_chain)
|
||||
{
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
void SetVSync(bool enabled) override;
|
||||
|
||||
bool Render() override;
|
||||
bool Render(bool skip_present) override;
|
||||
bool RenderScreenshot(u32 width, u32 height, std::vector<u32>* out_pixels, u32* out_stride,
|
||||
HostDisplayPixelFormat* out_format) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue