Host: Reset imgui state when there's no frame to present

Prevents things getting into a messed up state internally where several
frames are buffered.
This commit is contained in:
Connor McLaughlin 2022-05-16 22:43:01 +10:00 committed by refractionpcsx2
parent a163c90f2b
commit 437b6f3f0e
2 changed files with 19 additions and 2 deletions

View File

@ -716,7 +716,15 @@ void Host::ReleaseHostDisplay()
bool Host::BeginPresentFrame(bool frame_skip) bool Host::BeginPresentFrame(bool frame_skip)
{ {
return s_host_display->BeginPresent(frame_skip); if (!s_host_display->BeginPresent(frame_skip))
{
// if we're skipping a frame, we need to reset imgui's state, since
// we won't be calling EndPresentFrame().
ImGuiManager::NewFrame();
return false;
}
return true;
} }
void Host::EndPresentFrame() void Host::EndPresentFrame()

View File

@ -153,7 +153,16 @@ HostDisplay* Host::GetHostDisplay()
bool Host::BeginPresentFrame(bool frame_skip) bool Host::BeginPresentFrame(bool frame_skip)
{ {
CheckForGSWindowResize(); CheckForGSWindowResize();
return s_host_display->BeginPresent(frame_skip);
if (!s_host_display->BeginPresent(frame_skip))
{
// if we're skipping a frame, we need to reset imgui's state, since
// we won't be calling EndPresentFrame().
ImGuiManager::NewFrame();
return false;
}
return true;
} }
void Host::EndPresentFrame() void Host::EndPresentFrame()