summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/CPMemory.cpp
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2014-09-28 21:59:27 -0400
committercomex <comexk@gmail.com>2014-09-28 21:59:27 -0400
commitfbabc03b3f684d57cc25bd8b86c0b1d30a237bb8 (patch)
tree64695c3c67d9f975b7e1c7835e0e405620a562e9 /Source/Core/VideoCommon/CPMemory.cpp
parent431fb4d82a9fa9597df3c35c27e55714ff3e27c0 (diff)
parent6c0a68d50765c24a205f7133205b54c26ae1bbfb (diff)
Merge pull request #885 from comex/gpu-determinism
GPU determinism (apparently it is ready for merge)
Diffstat (limited to 'Source/Core/VideoCommon/CPMemory.cpp')
-rw-r--r--Source/Core/VideoCommon/CPMemory.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp
index 752063065b..739a3e66e3 100644
--- a/Source/Core/VideoCommon/CPMemory.cpp
+++ b/Source/Core/VideoCommon/CPMemory.cpp
@@ -2,17 +2,32 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "VideoCommon/CPMemory.h"
// CP state
u8 *cached_arraybases[16];
-// STATE_TO_SAVE
-u32 arraybases[16];
-u32 arraystrides[16];
-TMatrixIndexA MatrixIndexA;
-TMatrixIndexB MatrixIndexB;
-TVtxDesc g_VtxDesc;
-// Most games only use the first VtxAttr and simply reconfigure it all the time as needed.
-VAT g_VtxAttr[8];
+CPState g_main_cp_state;
+CPState g_preprocess_cp_state;
+
+void DoCPState(PointerWrap& p)
+{
+ // We don't save g_preprocess_cp_state separately because the GPU should be
+ // synced around state save/load.
+ p.DoArray(g_main_cp_state.array_bases, 16);
+ p.DoArray(g_main_cp_state.array_strides, 16);
+ p.Do(g_main_cp_state.matrix_index_a);
+ p.Do(g_main_cp_state.matrix_index_b);
+ p.Do(g_main_cp_state.vtx_desc.Hex);
+ p.DoArray(g_main_cp_state.vtx_attr, 8);
+ p.DoMarker("CP Memory");
+ if (p.mode == PointerWrap::MODE_READ)
+ CopyPreprocessCPStateFromMain();
+}
+
+void CopyPreprocessCPStateFromMain()
+{
+ memcpy(&g_preprocess_cp_state, &g_main_cp_state, sizeof(CPState));
+}