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