From 3a4b27b086a85fc66b0da14c9034da6350725ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 22 Oct 2024 11:59:41 +0200 Subject: [PATCH] Fix some more presentation issues --- Common/GPU/Vulkan/VulkanRenderManager.cpp | 2 ++ GPU/Software/SoftGpu.cpp | 5 +++++ GPU/Software/SoftGpu.h | 1 + UI/ControlMappingScreen.cpp | 2 +- UI/DevScreens.cpp | 2 ++ UI/EmuScreen.cpp | 9 +++++++-- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 0cc646433b..b774d4123d 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -370,6 +370,8 @@ void VulkanRenderManager::StartThreads() { // Called from main thread. void VulkanRenderManager::StopThreads() { + // Make sure we don't have an open render pass. + EndCurRenderStep(); // Not sure this is a sensible check - should be ok even if not. // _dbg_assert_(steps_.empty()); diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index e6526fa089..e2513a8462 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -657,6 +657,11 @@ void SoftGPU::CopyDisplayToOutput(bool reallyDirty) { MarkDirty(displayFramebuf_, displayStride_, 272, displayFormat_, SoftGPUVRAMDirty::CLEAR); } +void SoftGPU::BeginHostFrame() { + GPUCommon::BeginHostFrame(); + presentation_->BeginFrame(); +} + bool SoftGPU::PresentedThisFrame() const { return presentation_->PresentedThisFrame(); } diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index 870aa95810..5ecd94db4e 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -209,6 +209,7 @@ public: typedef void (SoftGPU::*CmdFunc)(u32 op, u32 diff); + void BeginHostFrame() override; bool PresentedThisFrame() const override; protected: diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index c92091ec21..acd1abcffe 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -343,7 +343,7 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams ¶ms) { } void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) { - if (result == DR_OK && std::string(dialog->tag()) == "listpopup") { + if (result == DR_OK && !strcmp(dialog->tag(), "listpopup")) { UI::ListPopupScreen *popup = (UI::ListPopupScreen *)dialog; KeyMap::AutoConfForPad(popup->GetChoiceString()); } diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 607c5cd80a..ea8612c5de 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -384,6 +384,8 @@ LogLevelScreen::LogLevelScreen(std::string_view title) : ListPopupScreen(title) list.push_back(logLevelList[i]); } adaptor_ = UI::StringVectorListAdaptor(list, -1); + + // CreateViews takes care of, well, that. } void LogLevelScreen::OnCompleted(DialogResult result) { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index d91f97c04b..62d1059a2b 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1281,14 +1281,16 @@ bool EmuScreen::checkPowerDown() { } if (coreState == CORE_POWERDOWN && !PSP_IsIniting() && !PSP_IsRebooting()) { + bool shutdown = false; if (PSP_IsInited()) { PSP_Shutdown(); + shutdown = true; } INFO_LOG(Log::System, "SELF-POWERDOWN!"); screenManager()->switchScreen(new MainScreen()); bootPending_ = false; invalid_ = true; - return true; + return shutdown; } return false; } @@ -1513,6 +1515,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) { draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_NoFrame"); draw->SetViewport(viewport); draw->SetScissorRect(0, 0, g_display.pixel_xres, g_display.pixel_yres); + framebufferBound = true; } Draw::BackendState state = draw->GetCurrentBackendState(); @@ -1533,7 +1536,9 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) { } // NOTE: We don't check for powerdown if we're not the top screen. - checkPowerDown(); + if (checkPowerDown()) { + draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_PowerDown"); + } if (hasVisibleUI()) { draw->SetViewport(viewport);