Config: Port GPUDeterminismMode setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 01:08:56 +01:00
parent 68688e7903
commit d98c6b0b1d
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
7 changed files with 34 additions and 41 deletions

View File

@ -80,7 +80,6 @@ private:
int iSyncGpuMinDistance = 0;
float fSyncGpuOverclock = 0;
bool bFastDiscSpeed = false;
std::string m_strGPUDeterminismMode;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
@ -99,7 +98,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
iSyncGpuMinDistance = config.iSyncGpuMinDistance;
fSyncGpuOverclock = config.fSyncGpuOverclock;
bFastDiscSpeed = config.bFastDiscSpeed;
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
for (int i = 0; i != MAX_BBMOTES; ++i)
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
@ -152,25 +150,10 @@ void ConfigCache::RestoreConfig(SConfig* config)
if (bSetEXIDevice[i])
config->m_EXIDevice[i] = m_EXIDevice[i];
}
config->m_strGPUDeterminismMode = m_strGPUDeterminismMode;
}
static ConfigCache config_cache;
static GPUDeterminismMode ParseGPUDeterminismMode(const std::string& mode)
{
if (mode == "auto")
return GPUDeterminismMode::Auto;
if (mode == "none")
return GPUDeterminismMode::Disabled;
if (mode == "fake-completion")
return GPUDeterminismMode::FakeCompletion;
NOTICE_LOG_FMT(BOOT, "Unknown GPU determinism mode {}", mode);
return GPUDeterminismMode::Auto;
}
// Boot the ISO or file
bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
{
@ -200,8 +183,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
core_section->Get("GPUDeterminismMode", &StartUp.m_strGPUDeterminismMode,
StartUp.m_strGPUDeterminismMode);
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
@ -241,8 +222,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
}
}
StartUp.m_GPUDeterminismMode = ParseGPUDeterminismMode(StartUp.m_strGPUDeterminismMode);
// Movie settings
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
{

View File

@ -10,6 +10,7 @@
#include "AudioCommon/AudioCommon.h"
#include "Common/CommonPaths.h"
#include "Common/Config/Config.h"
#include "Common/Logging/Log.h"
#include "Common/MathUtil.h"
#include "Common/StringUtil.h"
#include "Common/Version.h"
@ -118,8 +119,24 @@ const Info<u32> MAIN_MEM1_SIZE{{System::Main, "Core", "MEM1Size"}, Memory::MEM1_
const Info<u32> MAIN_MEM2_SIZE{{System::Main, "Core", "MEM2Size"}, Memory::MEM2_SIZE_RETAIL};
const Info<std::string> MAIN_GFX_BACKEND{{System::Main, "Core", "GFXBackend"},
VideoBackendBase::GetDefaultBackendName()};
const Info<std::string> MAIN_GPU_DETERMINISM_MODE{{System::Main, "Core", "GPUDeterminismMode"},
"auto"};
GPUDeterminismMode GetGPUDeterminismMode()
{
auto mode = Config::Get(Config::MAIN_GPU_DETERMINISM_MODE);
if (mode == "auto")
return GPUDeterminismMode::Auto;
if (mode == "none")
return GPUDeterminismMode::Disabled;
if (mode == "fake-completion")
return GPUDeterminismMode::FakeCompletion;
NOTICE_LOG_FMT(CORE, "Unknown GPU determinism mode {}", mode);
return GPUDeterminismMode::Auto;
}
const Info<std::string> MAIN_PERF_MAP_DIR{{System::Main, "Core", "PerfMapDir"}, ""};
const Info<bool> MAIN_CUSTOM_RTC_ENABLE{{System::Main, "Core", "EnableCustomRTC"}, false};
// Default to seconds between 1.1.1970 and 1.1.2000

View File

@ -93,7 +93,18 @@ extern const Info<u32> MAIN_MEM1_SIZE;
extern const Info<u32> MAIN_MEM2_SIZE;
// Should really be part of System::GFX, but again, we're stuck with past mistakes.
extern const Info<std::string> MAIN_GFX_BACKEND;
enum class GPUDeterminismMode
{
Auto,
Disabled,
// This is currently the only mode. There will probably be at least
// one more at some point.
FakeCompletion,
};
extern const Info<std::string> MAIN_GPU_DETERMINISM_MODE;
GPUDeterminismMode GetGPUDeterminismMode();
extern const Info<std::string> MAIN_PERF_MAP_DIR;
extern const Info<bool> MAIN_CUSTOM_RTC_ENABLE;
extern const Info<u32> MAIN_CUSTOM_RTC_VALUE;

View File

@ -99,6 +99,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::GetInfoForSimulateKonga(3).GetLocation(),
&Config::MAIN_EMULATION_SPEED.GetLocation(),
&Config::MAIN_PERF_MAP_DIR.GetLocation(),
&Config::MAIN_GPU_DETERMINISM_MODE.GetLocation(),
// UI.General

View File

@ -120,7 +120,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface);
core->Set("MMU", bMMU);
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
}
void SConfig::LoadSettings()
@ -163,7 +162,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
core->Get("DisableICache", &bDisableICache, false);
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
}
void SConfig::ResetRunningGameMetadata()

View File

@ -47,15 +47,6 @@ enum SIDevices : int;
struct BootParameters;
enum class GPUDeterminismMode
{
Auto,
Disabled,
// This is currently the only mode. There will probably be at least
// one more at some point.
FakeCompletion,
};
struct SConfig
{
// Wii Devices
@ -94,11 +85,6 @@ struct SConfig
DiscIO::Region m_region;
std::string m_strGPUDeterminismMode;
// set based on the string version
GPUDeterminismMode m_GPUDeterminismMode;
// files
std::string m_strBootROM;
std::string m_strSRAM;

View File

@ -14,6 +14,7 @@
#include "Common/MemoryUtil.h"
#include "Common/MsgHandler.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/HW/Memmap.h"
@ -509,15 +510,15 @@ void UpdateWantDeterminism(bool want)
// it should be safe to change this.
const SConfig& param = SConfig::GetInstance();
bool gpu_thread = false;
switch (param.m_GPUDeterminismMode)
switch (Config::GetGPUDeterminismMode())
{
case GPUDeterminismMode::Auto:
case Config::GPUDeterminismMode::Auto:
gpu_thread = want;
break;
case GPUDeterminismMode::Disabled:
case Config::GPUDeterminismMode::Disabled:
gpu_thread = false;
break;
case GPUDeterminismMode::FakeCompletion:
case Config::GPUDeterminismMode::FakeCompletion:
gpu_thread = true;
break;
}