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