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