Frontend: Reset/restore GPU state before saving screenshot

Fixes driver crashes in Vulkan.
This commit is contained in:
Connor McLaughlin
2020-06-27 02:22:52 +10:00
parent b94de1924d
commit 58b0e6859a
2 changed files with 10 additions and 4 deletions

View File

@ -1947,7 +1947,11 @@ bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, b
filename = auto_filename.c_str();
}
if (!m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio))
m_system->GetGPU()->ResetGraphicsAPIState();
const bool screenshot_saved =
m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio);
m_system->GetGPU()->RestoreGraphicsAPIState();
if (!screenshot_saved)
{
AddFormattedOSDMessage(10.0f, "Failed to save screenshot to '%s'", filename);
return false;