Host: Avoid leaving GPU state unbound after represent

This commit is contained in:
Stenzek 2023-08-24 18:03:14 +10:00
parent d750e4d417
commit 08acc3144c
2 changed files with 4 additions and 7 deletions

View File

@ -3,6 +3,7 @@
#include "host.h" #include "host.h"
#include "fullscreen_ui.h" #include "fullscreen_ui.h"
#include "gpu.h"
#include "imgui_overlays.h" #include "imgui_overlays.h"
#include "shader_cache_version.h" #include "shader_cache_version.h"
#include "system.h" #include "system.h"
@ -490,6 +491,9 @@ void Host::RenderDisplay(bool skip_present)
g_gpu_device->Render(skip_present); g_gpu_device->Render(skip_present);
ImGuiManager::NewFrame(); ImGuiManager::NewFrame();
if (g_gpu)
g_gpu->RestoreGraphicsAPIState();
} }
void Host::InvalidateDisplay() void Host::InvalidateDisplay()

View File

@ -1167,7 +1167,6 @@ bool System::LoadState(const char* filename)
ResetPerformanceCounters(); ResetPerformanceCounters();
ResetThrottler(); ResetThrottler();
Host::RenderDisplay(false); Host::RenderDisplay(false);
g_gpu->RestoreGraphicsAPIState();
Log_VerbosePrintf("Loading state took %.2f msec", load_timer.GetTimeMilliseconds()); Log_VerbosePrintf("Loading state took %.2f msec", load_timer.GetTimeMilliseconds());
return true; return true;
} }
@ -1832,8 +1831,6 @@ void System::FrameDone()
s_accumulated_gpu_time += g_gpu_device->GetAndResetAccumulatedGPUTime(); s_accumulated_gpu_time += g_gpu_device->GetAndResetAccumulatedGPUTime();
s_presents_since_last_update++; s_presents_since_last_update++;
} }
g_gpu->RestoreGraphicsAPIState();
} }
else if (current_time >= s_next_frame_time) else if (current_time >= s_next_frame_time)
{ {
@ -2184,8 +2181,6 @@ void System::InternalReset()
if (IsShutdown()) if (IsShutdown())
return; return;
g_gpu->RestoreGraphicsAPIState();
CPU::Reset(); CPU::Reset();
CPU::CodeCache::Flush(); CPU::CodeCache::Flush();
if (g_settings.gpu_pgxp_enable) if (g_settings.gpu_pgxp_enable)
@ -3918,8 +3913,6 @@ void System::DoRewind()
s_next_frame_time += s_frame_period; s_next_frame_time += s_frame_period;
Host::RenderDisplay(false); Host::RenderDisplay(false);
g_gpu->RestoreGraphicsAPIState();
Host::PumpMessagesOnCPUThread(); Host::PumpMessagesOnCPUThread();
Throttle(); Throttle();