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) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-21 07:24:56 +02:00
1 parent 23a5f317bd
commit deb9693f6a
1 file changed
+19 -16
+19 -16
View File
@@ -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_) {