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"
|
2022-11-27 12:50:50 +00:00
|
|
|
#include "Core/System.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/BPMemory.h"
|
2023-01-28 02:13:49 +00:00
|
|
|
#include "VideoCommon/BPStructs.h"
|
2023-01-31 04:29:16 +00:00
|
|
|
#include "VideoCommon/BoundingBox.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#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"
|
2023-01-31 04:26:46 +00:00
|
|
|
#include "VideoCommon/FrameDumper.h"
|
2023-01-31 04:29:16 +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"
|
2023-01-31 04:26:46 +00:00
|
|
|
#include "VideoCommon/Present.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"
|
2022-10-07 19:25:04 +00:00
|
|
|
#include "VideoCommon/VertexLoaderManager.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/VertexManagerBase.h"
|
|
|
|
#include "VideoCommon/VertexShaderManager.h"
|
2023-01-31 04:58:54 +00:00
|
|
|
#include "VideoCommon/Widescreen.h"
|
2014-02-19 01:27:20 +00:00
|
|
|
#include "VideoCommon/XFMemory.h"
|
2023-11-25 22:23:54 +00:00
|
|
|
#include "VideoCommon/XFStateManager.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);
|
|
|
|
|
2022-05-18 05:29:05 +00:00
|
|
|
if (p.IsReadMode() && software == true)
|
2019-06-29 09:27:53 +00:00
|
|
|
{
|
|
|
|
// change mode to abort load of incompatible save state.
|
2022-05-18 05:29:05 +00:00
|
|
|
p.SetVerifyMode();
|
2019-06-29 09:27:53 +00:00
|
|
|
}
|
|
|
|
|
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
|
2022-10-07 19:25:04 +00:00
|
|
|
// We don't save g_preprocess_cp_state separately because the GPU should be
|
|
|
|
// synced around state save/load.
|
|
|
|
p.Do(g_main_cp_state);
|
|
|
|
p.DoMarker("CP Memory");
|
|
|
|
if (p.IsReadMode())
|
|
|
|
CopyPreprocessCPStateFromMain();
|
2012-01-01 21:52:31 +00:00
|
|
|
|
|
|
|
// 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
|
2024-04-13 16:29:52 +00:00
|
|
|
p.DoArray(s_tex_mem);
|
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
|
2022-12-09 19:01:25 +00:00
|
|
|
auto& system = Core::System::GetInstance();
|
|
|
|
system.GetFifo().DoState(p);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("Fifo");
|
|
|
|
|
2022-11-27 12:50:50 +00:00
|
|
|
auto& command_processor = system.GetCommandProcessor();
|
|
|
|
command_processor.DoState(p);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("CommandProcessor");
|
2012-01-01 20:46:02 +00:00
|
|
|
|
2022-12-10 15:35:07 +00:00
|
|
|
system.GetPixelEngine().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.
|
2022-12-27 16:42:02 +00:00
|
|
|
system.GetPixelShaderManager().DoState(p);
|
2012-01-01 21:52:31 +00:00
|
|
|
p.DoMarker("PixelShaderManager");
|
2012-01-01 20:46:02 +00:00
|
|
|
|
2022-12-28 14:38:46 +00:00
|
|
|
system.GetVertexShaderManager().DoState(p);
|
2014-12-14 20:23:13 +00:00
|
|
|
p.DoMarker("VertexShaderManager");
|
|
|
|
|
2022-12-29 14:27:48 +00:00
|
|
|
system.GetGeometryShaderManager().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");
|
|
|
|
|
2023-01-31 04:26:46 +00:00
|
|
|
g_presenter->DoState(p);
|
|
|
|
g_frame_dumper->DoState(p);
|
|
|
|
p.DoMarker("Presenter");
|
|
|
|
|
|
|
|
g_bounding_box->DoState(p);
|
|
|
|
p.DoMarker("Bounding Box");
|
|
|
|
|
2023-01-31 04:58:54 +00:00
|
|
|
g_widescreen->DoState(p);
|
|
|
|
p.DoMarker("Widescreen");
|
|
|
|
|
2023-11-25 22:23:54 +00:00
|
|
|
system.GetXFStateManager().DoState(p);
|
|
|
|
p.DoMarker("XFStateManager");
|
|
|
|
|
2019-06-29 09:27:53 +00:00
|
|
|
// Refresh state.
|
2022-05-18 05:29:05 +00:00
|
|
|
if (p.IsReadMode())
|
2019-06-29 09:27:53 +00:00
|
|
|
{
|
|
|
|
// Inform backend of new state from registers.
|
|
|
|
BPReload();
|
2022-10-07 19:25:04 +00:00
|
|
|
VertexLoaderManager::MarkAllDirty();
|
2019-06-29 09:27:53 +00:00
|
|
|
}
|
2008-08-30 16:05:32 +00:00
|
|
|
}
|