summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2020-07-11 17:25:49 +0200
committerMerryMage <MerryMage@users.noreply.github.com>2020-07-11 17:38:38 +0200
commit505aa3a4c1eb2384ab5a46aecf6431db239b74e3 (patch)
tree8576d3b825f7cd85122b857f5b10c6f9eae1b87e /src
parentconfiguration: Add settings to enable/disable specific CPU optimizations (diff)
downloadyuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.tar
yuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.tar.gz
yuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.tar.bz2
yuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.tar.lz
yuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.tar.xz
yuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.tar.zst
yuzu-505aa3a4c1eb2384ab5a46aecf6431db239b74e3.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp48
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp48
-rw-r--r--src/core/settings.h7
-rw-r--r--src/yuzu/configuration/config.cpp6
-rw-r--r--src/yuzu/configuration/configure_cpu.cpp22
-rw-r--r--src/yuzu/configuration/configure_cpu.h2
-rw-r--r--src/yuzu/configuration/configure_cpu.ui48
7 files changed, 135 insertions, 46 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index 369a081cd..443ca72eb 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -143,29 +143,31 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable&
config.wall_clock_cntpct = uses_wall_clock;
// Safe optimizations
- if (!Settings::values.cpuopt_page_tables) {
- config.page_table = nullptr;
- }
- if (!Settings::values.cpuopt_block_linking) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking;
- }
- if (!Settings::values.cpuopt_return_stack_buffer) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer;
- }
- if (!Settings::values.cpuopt_fast_dispatcher) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch;
- }
- if (!Settings::values.cpuopt_context_elimination) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination;
- }
- if (!Settings::values.cpuopt_const_prop) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp;
- }
- if (!Settings::values.cpuopt_misc_ir) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt;
- }
- if (!Settings::values.cpuopt_reduce_misalign_checks) {
- config.only_detect_misalignment_via_page_table_on_page_boundary = false;
+ if (Settings::values.cpu_accuracy != Settings::CPUAccuracy::Accurate) {
+ if (!Settings::values.cpuopt_page_tables) {
+ config.page_table = nullptr;
+ }
+ if (!Settings::values.cpuopt_block_linking) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking;
+ }
+ if (!Settings::values.cpuopt_return_stack_buffer) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer;
+ }
+ if (!Settings::values.cpuopt_fast_dispatcher) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch;
+ }
+ if (!Settings::values.cpuopt_context_elimination) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination;
+ }
+ if (!Settings::values.cpuopt_const_prop) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp;
+ }
+ if (!Settings::values.cpuopt_misc_ir) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt;
+ }
+ if (!Settings::values.cpuopt_reduce_misalign_checks) {
+ config.only_detect_misalignment_via_page_table_on_page_boundary = false;
+ }
}
return std::make_unique<Dynarmic::A32::Jit>(config);
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index e208a4aa7..a63a04a25 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -195,29 +195,31 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable&
config.wall_clock_cntpct = uses_wall_clock;
// Safe optimizations
- if (!Settings::values.cpuopt_page_tables) {
- config.page_table = nullptr;
- }
- if (!Settings::values.cpuopt_block_linking) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking;
- }
- if (!Settings::values.cpuopt_return_stack_buffer) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer;
- }
- if (!Settings::values.cpuopt_fast_dispatcher) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch;
- }
- if (!Settings::values.cpuopt_context_elimination) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination;
- }
- if (!Settings::values.cpuopt_const_prop) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp;
- }
- if (!Settings::values.cpuopt_misc_ir) {
- config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt;
- }
- if (!Settings::values.cpuopt_reduce_misalign_checks) {
- config.only_detect_misalignment_via_page_table_on_page_boundary = false;
+ if (Settings::values.cpu_accuracy != Settings::CPUAccuracy::Accurate) {
+ if (!Settings::values.cpuopt_page_tables) {
+ config.page_table = nullptr;
+ }
+ if (!Settings::values.cpuopt_block_linking) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking;
+ }
+ if (!Settings::values.cpuopt_return_stack_buffer) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer;
+ }
+ if (!Settings::values.cpuopt_fast_dispatcher) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch;
+ }
+ if (!Settings::values.cpuopt_context_elimination) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination;
+ }
+ if (!Settings::values.cpuopt_const_prop) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp;
+ }
+ if (!Settings::values.cpuopt_misc_ir) {
+ config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt;
+ }
+ if (!Settings::values.cpuopt_reduce_misalign_checks) {
+ config.only_detect_misalignment_via_page_table_on_page_boundary = false;
+ }
}
return std::make_shared<Dynarmic::A64::Jit>(config);
diff --git a/src/core/settings.h b/src/core/settings.h
index c081c083f..b3451a704 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -382,6 +382,11 @@ enum class GPUAccuracy : u32 {
Extreme = 2,
};
+enum class CPUAccuracy {
+ Accurate = 0,
+ DebugMode = 1,
+};
+
extern bool configuring_global;
template <typename Type>
@@ -428,6 +433,8 @@ struct Values {
Setting<bool> use_multi_core;
// Cpu
+ CPUAccuracy cpu_accuracy;
+
bool cpuopt_page_tables;
bool cpuopt_block_linking;
bool cpuopt_return_stack_buffer;
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index f28e345a5..430e78e5f 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -635,6 +635,9 @@ void Config::ReadCpuValues() {
qt_config->beginGroup(QStringLiteral("Cpu"));
if (global) {
+ Settings::values.cpu_accuracy = static_cast<Settings::CPUAccuracy>(
+ ReadSetting(QStringLiteral("cpu_accuracy"), 0).toInt());
+
Settings::values.cpuopt_page_tables =
ReadSetting(QStringLiteral("cpuopt_page_tables"), true).toBool();
Settings::values.cpuopt_block_linking =
@@ -1125,6 +1128,9 @@ void Config::SaveCpuValues() {
qt_config->beginGroup(QStringLiteral("Cpu"));
if (global) {
+ WriteSetting(QStringLiteral("cpu_accuracy"),
+ static_cast<int>(Settings::values.cpu_accuracy), 0);
+
WriteSetting(QStringLiteral("cpuopt_page_tables"), Settings::values.cpuopt_page_tables,
true);
WriteSetting(QStringLiteral("cpuopt_block_linking"), Settings::values.cpuopt_block_linking,
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp
index 28e010b6b..4fc392a7e 100644
--- a/src/yuzu/configuration/configure_cpu.cpp
+++ b/src/yuzu/configuration/configure_cpu.cpp
@@ -15,6 +15,9 @@ ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::Config
ui->setupUi(this);
SetConfiguration();
+
+ connect(ui->accuracy, qOverload<int>(&QComboBox::currentIndexChanged), this,
+ &ConfigureCpu::UpdateGroups);
}
ConfigureCpu::~ConfigureCpu() = default;
@@ -22,6 +25,10 @@ ConfigureCpu::~ConfigureCpu() = default;
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));
+ UpdateGroups(static_cast<int>(Settings::values.cpu_accuracy));
+
ui->cpuopt_page_tables->setEnabled(runtime_lock);
ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables);
ui->cpuopt_block_linking->setEnabled(runtime_lock);
@@ -40,7 +47,22 @@ void ConfigureCpu::SetConfiguration() {
ui->cpuopt_reduce_misalign_checks->setChecked(Settings::values.cpuopt_reduce_misalign_checks);
}
+void ConfigureCpu::UpdateGroups(int index) {
+ switch (index) {
+ case 0:
+ default:
+ ui->group_safe->setVisible(false);
+ break;
+ case 1:
+ ui->group_safe->setVisible(true);
+ break;
+ }
+}
+
void ConfigureCpu::ApplyConfiguration() {
+ Settings::values.cpu_accuracy =
+ static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex());
+
Settings::values.cpuopt_page_tables = ui->cpuopt_page_tables->isChecked();
Settings::values.cpuopt_block_linking = ui->cpuopt_block_linking->isChecked();
Settings::values.cpuopt_return_stack_buffer = ui->cpuopt_return_stack_buffer->isChecked();
diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h
index a4c6e5f20..cf55980b0 100644
--- a/src/yuzu/configuration/configure_cpu.h
+++ b/src/yuzu/configuration/configure_cpu.h
@@ -25,6 +25,8 @@ private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
+ void UpdateGroups(int index);
+
void SetConfiguration();
std::unique_ptr<Ui::ConfigureCpu> ui;
diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui
index d04cfb2d5..27bd4aa42 100644
--- a/src/yuzu/configuration/configure_cpu.ui
+++ b/src/yuzu/configuration/configure_cpu.ui
@@ -19,6 +19,54 @@
<item>
<widget class="QGroupBox">
<property name="title">
+ <string>General</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel">
+ <property name="text">
+ <string>Accuracy:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="accuracy">
+ <item>
+ <property name="text">
+ <string>Accurate</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debugging Mode (Debugging ONLY)</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel">
+ <property name="wordWrap">
+ <bool>1</bool>
+ </property>
+ <property name="text">
+ <string>We recommend setting accuracy to "Accurate".</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QGroupBox" name="group_safe">
+ <property name="title">
<string>Safe CPU Optimizations</string>
</property>
<layout class="QVBoxLayout">