summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VideoBackendBase.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-07-25 13:50:57 +1000
committerGitHub <noreply@github.com>2019-07-25 13:50:57 +1000
commitac9912bad3ad35b1ef27151ba724a3424c110acc (patch)
tree3f6873682f9c6f2570ed0123be82475cc62873d4 /Source/Core/VideoCommon/VideoBackendBase.cpp
parentd82e0e0761aa8cf08048aed64011f0edf5d967a8 (diff)
parent2d4d61e967baa460fa45abd4fd6bccfb12fe3cac (diff)
Merge pull request #6321 from stenzek/efb-savestates
Support saving EFB and texture cache in save states
Diffstat (limited to 'Source/Core/VideoCommon/VideoBackendBase.cpp')
-rw-r--r--Source/Core/VideoCommon/VideoBackendBase.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp
index aa4cd8f6dd..8ee7eb1202 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.cpp
+++ b/Source/Core/VideoCommon/VideoBackendBase.cpp
@@ -40,6 +40,7 @@
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
@@ -236,41 +237,22 @@ void VideoBackendBase::PopulateBackendInfo()
g_Config.Refresh();
}
-// Run from the CPU thread
void VideoBackendBase::DoState(PointerWrap& p)
{
- bool software = false;
- p.Do(software);
-
- if (p.GetMode() == PointerWrap::MODE_READ && software == true)
- {
- // change mode to abort load of incompatible save state.
- p.SetMode(PointerWrap::MODE_VERIFY);
- }
-
- VideoCommon_DoState(p);
- p.DoMarker("VideoCommon");
-
- // Refresh state.
- if (p.GetMode() == PointerWrap::MODE_READ)
+ if (!SConfig::GetInstance().bCPUThread)
{
- m_invalid = true;
-
- // Clear all caches that touch RAM
- // (? these don't appear to touch any emulation state that gets saved. moved to on load only.)
- VertexLoaderManager::MarkAllDirty();
+ VideoCommon_DoState(p);
+ return;
}
-}
-void VideoBackendBase::CheckInvalidState()
-{
- if (m_invalid)
- {
- m_invalid = false;
+ AsyncRequests::Event ev = {};
+ ev.do_save_state.p = &p;
+ ev.type = AsyncRequests::Event::DO_SAVE_STATE;
+ AsyncRequests::GetInstance()->PushEvent(ev, true);
- BPReload();
- g_texture_cache->Invalidate();
- }
+ // Let the GPU thread sleep after loading the state, so we're not spinning if paused after loading
+ // a state. The next GP burst will wake it up again.
+ Fifo::GpuMaySleep();
}
void VideoBackendBase::InitializeShared()
@@ -282,8 +264,6 @@ void VideoBackendBase::InitializeShared()
// do not initialize again for the config window
m_initialized = true;
- m_invalid = false;
-
CommandProcessor::Init();
Fifo::Init();
OpcodeDecoder::Init();