From deb9693f6a902a6bf5eb7eddbab110ed4e35caae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 21 Oct 2026 07:24:56 +0200 Subject: [PATCH] EmuScreen: Restart after a failed savestate load before drawing the frame The restart shut the GPU down after PrepareCopyDisplayToOutput had bound its pipelines in the open backbuffer pass, which trips the pipelinesToCheck_ assert in VulkanRenderManager::CheckNothingPending. The failed load already stops the frame from running, so nothing is lost by restarting first. Co-Authored-By: Claude Opus 5.5 (1M context) --- UI/EmuScreen.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index c2fec82550..a56906e7df 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1781,6 +1781,25 @@ ScreenRenderFlags EmuScreen::RunEmulation(bool skipBufferEffects) { // We process savestates before running the frame. SaveState::Process(); + // A savestate that failed to load halfway leaves a reset as the only option. Do it before the frame + // draws anything: the GPU can't shut down while its pipelines are bound in the open backbuffer pass. + if (SaveState::PollRestartNeeded() && !bootPending_) { + Achievements::UnloadGame(); + PSP_Shutdown(true); + + // Restart the boot process + bootPending_ = true; + bootIsReset_ = true; + RecreateViews(); + _dbg_assert_(coreState == CORE_POWERDOWN); + if (!PSP_InitStart(PSP_CoreParameter())) { + bootPending_ = false; + WARN_LOG(Log::Loader, "Error resetting"); + screenManager()->switchScreen(new MainScreen()); + } + return flags; + } + if (gpu) { gpu->BeginHostFrame(displayLayoutConfig); } @@ -1858,22 +1877,6 @@ ScreenRenderFlags EmuScreen::RunEmulation(bool skipBufferEffects) { draw->BindFramebufferAsRenderTarget(nullptr, {RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR}, "BackBuffer"); } } - - if (SaveState::PollRestartNeeded() && !bootPending_) { - Achievements::UnloadGame(); - PSP_Shutdown(true); - - // Restart the boot process - bootPending_ = true; - bootIsReset_ = true; - RecreateViews(); - _dbg_assert_(coreState == CORE_POWERDOWN); - if (!PSP_InitStart(PSP_CoreParameter())) { - bootPending_ = false; - WARN_LOG(Log::Loader, "Error resetting"); - screenManager()->switchScreen(new MainScreen()); - } - } } if (frameStep_) {