2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2021-12-10 02:22:16 +00:00
|
|
|
#include "VideoCommon/VideoState.h"
|
|
|
|
|
2016-01-17 21:54:31 +00:00
|
|
|
#include <cstring>
|
|
|
|
|
2014-07-30 00:55:07 +00:00
|
|
|
#include "Common/ChunkFile.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/BPMemory.h"
|
|
|
|
#include "VideoCommon/CPMemory.h"
|
2014-12-14 20:23:13 +00:00
|
|
|
#include "VideoCommon/CommandProcessor.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/Fifo.h"
|
2019-06-29 11:05:30 +00:00
|
|
|
#include "VideoCommon/FramebufferManager.h"
|
2014-12-14 20:23:13 +00:00
|
|
|
#include "VideoCommon/GeometryShaderManager.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/PixelEngine.h"
|
|
|
|
#include "VideoCommon/PixelShaderManager.h"
|
2019-06-29 09:27:53 +00:00
|
|
|
#include "VideoCommon/RenderBase.h"
|
2021-10-10 02:49:59 +00:00
|
|
|
#include "VideoCommon/TMEM.h"
|
2019-06-29 09:27:53 +00:00
|
|
|
#include "VideoCommon/TextureCacheBase.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/TextureDecoder.h"
|
|
|
|
#include "VideoCommon/VertexManagerBase.h"
|
|
|
|
#include "VideoCommon/VertexShaderManager.h"
|
2014-02-19 01:27:20 +00:00
|
|
|
#include "VideoCommon/XFMemory.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2016-01-12 21:46:44 +00:00
|
|
|
void VideoCommon_DoState(PointerWrap& p)
|
2008-10-25 15:53:43 +00:00
|
|
|
{
|
2019-06-29 09:27:53 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2008-08-30 16:05:32 +00:00
|
|
|
// BP Memory
|
2009-06-22 09:31:30 +00:00
|
|
|
p.Do(bpmem);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("BP Memory");
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2008-08-30 16:05:32 +00:00
|
|
|
// CP Memory
|
2012-01-01 21:52:31 +00:00
|
|
|
DoCPState(p);
|
|
|
|
|
|
|
|
// XF Memory
|
2015-09-29 16:35:30 +00:00
|
|
|
p.Do(xfmem);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("XF Memory");
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2008-08-30 16:05:32 +00:00
|
|
|
// Texture decoder
|
2016-01-12 21:44:58 +00:00
|
|
|
p.DoArray(texMem);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("texMem");
|
2009-10-10 21:19:39 +00:00
|
|
|
|
2021-10-10 02:49:59 +00:00
|
|
|
// TMEM
|
|
|
|
TMEM::DoState(p);
|
|
|
|
p.DoMarker("TMEM");
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// FIFO
|
2009-10-10 21:19:39 +00:00
|
|
|
Fifo::DoState(p);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("Fifo");
|
|
|
|
|
|
|
|
CommandProcessor::DoState(p);
|
|
|
|
p.DoMarker("CommandProcessor");
|
2012-01-01 20:46:02 +00:00
|
|
|
|
|
|
|
PixelEngine::DoState(p);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("PixelEngine");
|
|
|
|
|
2012-01-01 20:46:02 +00:00
|
|
|
// the old way of replaying current bpmem as writes to push side effects to pixel shader manager
|
|
|
|
// doesn't really work.
|
|
|
|
PixelShaderManager::DoState(p);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("PixelShaderManager");
|
2012-01-01 20:46:02 +00:00
|
|
|
|
2014-12-14 20:23:13 +00:00
|
|
|
VertexShaderManager::DoState(p);
|
|
|
|
p.DoMarker("VertexShaderManager");
|
|
|
|
|
2015-11-01 21:54:41 +00:00
|
|
|
GeometryShaderManager::DoState(p);
|
2012-01-04 08:42:22 +00:00
|
|
|
p.DoMarker("GeometryShaderManager");
|
|
|
|
|
2016-08-22 03:02:37 +00:00
|
|
|
g_vertex_manager->DoState(p);
|
2014-09-14 16:52:51 +00:00
|
|
|
p.DoMarker("VertexManager");
|
|
|
|
|
2019-06-29 11:05:30 +00:00
|
|
|
g_framebuffer_manager->DoState(p);
|
|
|
|
p.DoMarker("FramebufferManager");
|
|
|
|
|
2019-06-29 09:27:53 +00:00
|
|
|
g_texture_cache->DoState(p);
|
|
|
|
p.DoMarker("TextureCache");
|
|
|
|
|
|
|
|
g_renderer->DoState(p);
|
|
|
|
p.DoMarker("Renderer");
|
|
|
|
|
|
|
|
// Refresh state.
|
|
|
|
if (p.GetMode() == PointerWrap::MODE_READ)
|
|
|
|
{
|
|
|
|
// Inform backend of new state from registers.
|
|
|
|
BPReload();
|
|
|
|
}
|
2008-08-30 16:05:32 +00:00
|
|
|
}
|