mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user