summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Fifo.cpp
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2014-09-06 17:26:40 -0400
committercomex <comexk@gmail.com>2014-09-28 21:34:31 -0400
commit3a2048ea570b428ea34adbfea6b71280e1ae5cc0 (patch)
treef5d4207a6b17c315c46af6e4bedf48ddea46efb2 /Source/Core/VideoCommon/Fifo.cpp
parent65af90669bd5f9e02bbaa994d51d5c83d147b868 (diff)
Add a central variable g_want_determinism which controls whether to try to make things deterministic.
It now affects the GPU determinism mode as well as some miscellaneous things that were calling IsNetPlayRunning. Probably incomplete. Notably, this can change while paused, if the user starts recording a movie. The movie code appears to have been missing locking between setting g_playMode and doing other things, which probably had a small chance of causing crashes or even desynced movies; fix that with PauseAndLock. The next commit will add a hidden config variable to override GPU determinism mode.
Diffstat (limited to 'Source/Core/VideoCommon/Fifo.cpp')
-rw-r--r--Source/Core/VideoCommon/Fifo.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp
index 87764ec85c..a47438c41e 100644
--- a/Source/Core/VideoCommon/Fifo.cpp
+++ b/Source/Core/VideoCommon/Fifo.cpp
@@ -11,13 +11,16 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
+#include "Core/NetPlayProto.h"
#include "Core/HW/Memmap.h"
#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/CPMemory.h"
#include "VideoCommon/DataReader.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VideoConfig.h"
bool g_bSkipCurrentFrame = false;
@@ -31,7 +34,7 @@ static u8 s_fifo_aux_data[FIFO_SIZE];
static u8* s_fifo_aux_write_ptr;
static u8* s_fifo_aux_read_ptr;
-bool g_use_deterministic_gpu_thread = true; // XXX
+bool g_use_deterministic_gpu_thread;
// STATE_TO_SAVE
static std::mutex s_video_buffer_lock;
@@ -413,3 +416,26 @@ void RunGpu()
}
CommandProcessor::SetCPStatusFromGPU();
}
+
+void Fifo_UpdateWantDeterminism(bool want)
+{
+ // We are paused (or not running at all yet) and have m_csHWVidOccupied, so
+ // it should be safe to change this.
+ g_use_deterministic_gpu_thread = want && SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
+
+ // Hack: For now movies are an exception to this being on (but not
+ // to wanting determinism in general). Once vertex arrays are
+ // fixed, there should be no reason to want this off for movies by
+ // default, so this can be removed.
+ if (NetPlay::IsNetPlayRunning())
+ g_use_deterministic_gpu_thread = false;
+
+ if (g_use_deterministic_gpu_thread)
+ {
+ // These haven't been updated in non-deterministic mode.
+ s_video_buffer_seen_ptr = g_video_buffer_pp_read_ptr = g_video_buffer_read_ptr;
+ CopyPreprocessCPStateFromMain();
+ VertexLoaderManager::MarkAllDirty();
+ }
+
+}