mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-23 17:05:37 +00:00
general: Make CPU accuracy and related a Settings::Setting
Required to make CPU accuracy and unsafe settings available to use as a per-game setting.
This commit is contained in:
parent
904584e4ba
commit
e169fdad4f
|
@ -42,7 +42,7 @@ void LogSettings() {
|
|||
log_setting("System_RegionIndex", values.region_index.GetValue());
|
||||
log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue());
|
||||
log_setting("Core_UseMultiCore", values.use_multi_core.GetValue());
|
||||
log_setting("CPU_Accuracy", values.cpu_accuracy);
|
||||
log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue());
|
||||
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
|
||||
log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue());
|
||||
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
|
||||
|
|
|
@ -115,7 +115,7 @@ struct Values {
|
|||
Setting<bool> use_multi_core;
|
||||
|
||||
// Cpu
|
||||
CPUAccuracy cpu_accuracy;
|
||||
Setting<CPUAccuracy> cpu_accuracy;
|
||||
|
||||
bool cpuopt_page_tables;
|
||||
bool cpuopt_block_linking;
|
||||
|
@ -126,9 +126,9 @@ struct Values {
|
|||
bool cpuopt_misc_ir;
|
||||
bool cpuopt_reduce_misalign_checks;
|
||||
|
||||
bool cpuopt_unsafe_unfuse_fma;
|
||||
bool cpuopt_unsafe_reduce_fp_error;
|
||||
bool cpuopt_unsafe_inaccurate_nan;
|
||||
Setting<bool> cpuopt_unsafe_unfuse_fma;
|
||||
Setting<bool> cpuopt_unsafe_reduce_fp_error;
|
||||
Setting<bool> cpuopt_unsafe_inaccurate_nan;
|
||||
|
||||
// Renderer
|
||||
Setting<RendererBackend> renderer_backend;
|
||||
|
|
|
@ -142,7 +142,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
|
|||
config.far_code_offset = 256 * 1024 * 1024;
|
||||
|
||||
// Safe optimizations
|
||||
if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) {
|
||||
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
|
||||
if (!Settings::values.cpuopt_page_tables) {
|
||||
config.page_table = nullptr;
|
||||
}
|
||||
|
@ -170,15 +170,15 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
|
|||
}
|
||||
|
||||
// Unsafe optimizations
|
||||
if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::Unsafe) {
|
||||
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) {
|
||||
config.unsafe_optimizations = true;
|
||||
if (Settings::values.cpuopt_unsafe_unfuse_fma) {
|
||||
if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) {
|
||||
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
|
||||
}
|
||||
if (Settings::values.cpuopt_unsafe_reduce_fp_error) {
|
||||
if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) {
|
||||
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
|
||||
}
|
||||
if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
|
||||
if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) {
|
||||
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
|
|||
config.far_code_offset = 256 * 1024 * 1024;
|
||||
|
||||
// Safe optimizations
|
||||
if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) {
|
||||
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
|
||||
if (!Settings::values.cpuopt_page_tables) {
|
||||
config.page_table = nullptr;
|
||||
}
|
||||
|
@ -210,15 +210,15 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
|
|||
}
|
||||
|
||||
// Unsafe optimizations
|
||||
if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::Unsafe) {
|
||||
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) {
|
||||
config.unsafe_optimizations = true;
|
||||
if (Settings::values.cpuopt_unsafe_unfuse_fma) {
|
||||
if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) {
|
||||
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
|
||||
}
|
||||
if (Settings::values.cpuopt_unsafe_reduce_fp_error) {
|
||||
if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) {
|
||||
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
|
||||
}
|
||||
if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
|
||||
if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) {
|
||||
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -737,8 +737,7 @@ void Config::ReadCpuValues() {
|
|||
qt_config->beginGroup(QStringLiteral("Cpu"));
|
||||
|
||||
if (global) {
|
||||
Settings::values.cpu_accuracy = static_cast<Settings::CPUAccuracy>(
|
||||
ReadSetting(QStringLiteral("cpu_accuracy"), 0).toInt());
|
||||
ReadSettingGlobal(Settings::values.cpu_accuracy, QStringLiteral("cpu_accuracy"), 0);
|
||||
|
||||
Settings::values.cpuopt_page_tables =
|
||||
ReadSetting(QStringLiteral("cpuopt_page_tables"), true).toBool();
|
||||
|
@ -757,12 +756,12 @@ void Config::ReadCpuValues() {
|
|||
Settings::values.cpuopt_reduce_misalign_checks =
|
||||
ReadSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), true).toBool();
|
||||
|
||||
Settings::values.cpuopt_unsafe_unfuse_fma =
|
||||
ReadSetting(QStringLiteral("cpuopt_unsafe_unfuse_fma"), true).toBool();
|
||||
Settings::values.cpuopt_unsafe_reduce_fp_error =
|
||||
ReadSetting(QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true).toBool();
|
||||
Settings::values.cpuopt_unsafe_inaccurate_nan =
|
||||
ReadSetting(QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true).toBool();
|
||||
ReadSettingGlobal(Settings::values.cpuopt_unsafe_unfuse_fma,
|
||||
QStringLiteral("cpuopt_unsafe_unfuse_fma"), true);
|
||||
ReadSettingGlobal(Settings::values.cpuopt_unsafe_reduce_fp_error,
|
||||
QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true);
|
||||
ReadSettingGlobal(Settings::values.cpuopt_unsafe_inaccurate_nan,
|
||||
QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true);
|
||||
}
|
||||
|
||||
qt_config->endGroup();
|
||||
|
@ -1314,8 +1313,10 @@ void Config::SaveCpuValues() {
|
|||
qt_config->beginGroup(QStringLiteral("Cpu"));
|
||||
|
||||
if (global) {
|
||||
WriteSetting(QStringLiteral("cpu_accuracy"),
|
||||
static_cast<int>(Settings::values.cpu_accuracy), 0);
|
||||
WriteSettingGlobal(QStringLiteral("cpu_accuracy"),
|
||||
static_cast<u32>(Settings::values.cpu_accuracy.GetValue(global)),
|
||||
Settings::values.renderer_backend.UsingGlobal(),
|
||||
static_cast<u32>(Settings::CPUAccuracy::Accurate));
|
||||
|
||||
WriteSetting(QStringLiteral("cpuopt_page_tables"), Settings::values.cpuopt_page_tables,
|
||||
true);
|
||||
|
@ -1332,12 +1333,12 @@ void Config::SaveCpuValues() {
|
|||
WriteSetting(QStringLiteral("cpuopt_reduce_misalign_checks"),
|
||||
Settings::values.cpuopt_reduce_misalign_checks, true);
|
||||
|
||||
WriteSetting(QStringLiteral("cpuopt_unsafe_unfuse_fma"),
|
||||
Settings::values.cpuopt_unsafe_unfuse_fma, true);
|
||||
WriteSetting(QStringLiteral("cpuopt_unsafe_reduce_fp_error"),
|
||||
Settings::values.cpuopt_unsafe_reduce_fp_error, true);
|
||||
WriteSetting(QStringLiteral("cpuopt_unsafe_inaccurate_nan"),
|
||||
Settings::values.cpuopt_unsafe_inaccurate_nan, true);
|
||||
WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_unfuse_fma"),
|
||||
Settings::values.cpuopt_unsafe_unfuse_fma, true);
|
||||
WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_reduce_fp_error"),
|
||||
Settings::values.cpuopt_unsafe_reduce_fp_error, true);
|
||||
WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_inaccurate_nan"),
|
||||
Settings::values.cpuopt_unsafe_inaccurate_nan, true);
|
||||
}
|
||||
|
||||
qt_config->endGroup();
|
||||
|
|
|
@ -132,5 +132,6 @@ private:
|
|||
};
|
||||
|
||||
// These metatype declarations cannot be in common/settings.h because core is devoid of QT
|
||||
Q_DECLARE_METATYPE(Settings::CPUAccuracy);
|
||||
Q_DECLARE_METATYPE(Settings::RendererBackend);
|
||||
Q_DECLARE_METATYPE(Settings::GPUAccuracy);
|
||||
|
|
|
@ -29,15 +29,17 @@ void ConfigureCpu::SetConfiguration() {
|
|||
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
||||
|
||||
ui->accuracy->setEnabled(runtime_lock);
|
||||
ui->accuracy->setCurrentIndex(static_cast<int>(Settings::values.cpu_accuracy));
|
||||
UpdateGroup(static_cast<int>(Settings::values.cpu_accuracy));
|
||||
ui->accuracy->setCurrentIndex(static_cast<int>(Settings::values.cpu_accuracy.GetValue()));
|
||||
UpdateGroup(static_cast<int>(Settings::values.cpu_accuracy.GetValue()));
|
||||
|
||||
ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock);
|
||||
ui->cpuopt_unsafe_unfuse_fma->setChecked(Settings::values.cpuopt_unsafe_unfuse_fma);
|
||||
ui->cpuopt_unsafe_unfuse_fma->setChecked(Settings::values.cpuopt_unsafe_unfuse_fma.GetValue());
|
||||
ui->cpuopt_unsafe_reduce_fp_error->setEnabled(runtime_lock);
|
||||
ui->cpuopt_unsafe_reduce_fp_error->setChecked(Settings::values.cpuopt_unsafe_reduce_fp_error);
|
||||
ui->cpuopt_unsafe_reduce_fp_error->setChecked(
|
||||
Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue());
|
||||
ui->cpuopt_unsafe_inaccurate_nan->setEnabled(runtime_lock);
|
||||
ui->cpuopt_unsafe_inaccurate_nan->setChecked(Settings::values.cpuopt_unsafe_inaccurate_nan);
|
||||
ui->cpuopt_unsafe_inaccurate_nan->setChecked(
|
||||
Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue());
|
||||
}
|
||||
|
||||
void ConfigureCpu::AccuracyUpdated(int index) {
|
||||
|
@ -59,11 +61,13 @@ void ConfigureCpu::UpdateGroup(int index) {
|
|||
}
|
||||
|
||||
void ConfigureCpu::ApplyConfiguration() {
|
||||
Settings::values.cpu_accuracy =
|
||||
static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex());
|
||||
Settings::values.cpuopt_unsafe_unfuse_fma = ui->cpuopt_unsafe_unfuse_fma->isChecked();
|
||||
Settings::values.cpuopt_unsafe_reduce_fp_error = ui->cpuopt_unsafe_reduce_fp_error->isChecked();
|
||||
Settings::values.cpuopt_unsafe_inaccurate_nan = ui->cpuopt_unsafe_inaccurate_nan->isChecked();
|
||||
Settings::values.cpu_accuracy.SetValue(
|
||||
static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex()));
|
||||
Settings::values.cpuopt_unsafe_unfuse_fma.SetValue(ui->cpuopt_unsafe_unfuse_fma->isChecked());
|
||||
Settings::values.cpuopt_unsafe_reduce_fp_error.SetValue(
|
||||
ui->cpuopt_unsafe_reduce_fp_error->isChecked());
|
||||
Settings::values.cpuopt_unsafe_inaccurate_nan.SetValue(
|
||||
ui->cpuopt_unsafe_inaccurate_nan->isChecked());
|
||||
}
|
||||
|
||||
void ConfigureCpu::changeEvent(QEvent* event) {
|
||||
|
|
Loading…
Reference in a new issue