citra-emu
/
citra
Archived
1
0
Fork 0

Band-aid solution for 'Disk Shader Cache' (#5188)

* Enable 'Accurate Multiplication' by default.

* Move 'Disk Shader Cache' to the 'Advanced' tab

* Prevent enabling 'Disk Shader Cache' when 'Enable Hardware Shader' or 'Accurate Multiplication' is disabled.

* Do not load 'Disk Shader Cache' when 'Accurate Multiplication' is disabled.

* Add a tooltip for 'Disk Shader Cache'.
This commit is contained in:
tywald 2020-11-06 19:07:59 +01:00 committed by GitHub
parent 1bb20571b1
commit 2e0ce86c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 23 deletions

View File

@ -119,7 +119,7 @@ void Config::ReadValues() {
sdl2_config->GetBoolean("Renderer", "separable_shader", false);
#endif
Settings::values.shaders_accurate_mul =
sdl2_config->GetBoolean("Renderer", "shaders_accurate_mul", false);
sdl2_config->GetBoolean("Renderer", "shaders_accurate_mul", true);
Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
Settings::values.resolution_factor =
static_cast<u16>(sdl2_config->GetInteger("Renderer", "resolution_factor", 1));

View File

@ -115,7 +115,7 @@ use_hw_shader =
separable_shader =
# Whether to use accurate multiplication in hardware shaders
# 0: Off (Default. Faster, but causes issues in some games) 1: On (Slower, but correct)
# 0: Off (Faster, but causes issues in some games) 1: On (Default. Slower, but correct)
shaders_accurate_mul =
# Whether to use the Just-In-Time (JIT) compiler for shader emulation

View File

@ -284,8 +284,6 @@ void Config::ReadUtilityValues() {
ReadSetting(QStringLiteral("custom_textures"), false).toBool();
Settings::values.preload_textures =
ReadSetting(QStringLiteral("preload_textures"), false).toBool();
Settings::values.use_disk_shader_cache =
ReadSetting(QStringLiteral("use_disk_shader_cache"), true).toBool();
qt_config->endGroup();
}
@ -478,8 +476,10 @@ void Config::ReadRendererValues() {
ReadSetting(QStringLiteral("separable_shader"), false).toBool();
#endif
Settings::values.shaders_accurate_mul =
ReadSetting(QStringLiteral("shaders_accurate_mul"), false).toBool();
ReadSetting(QStringLiteral("shaders_accurate_mul"), true).toBool();
Settings::values.use_shader_jit = ReadSetting(QStringLiteral("use_shader_jit"), true).toBool();
Settings::values.use_disk_shader_cache =
ReadSetting(QStringLiteral("use_disk_shader_cache"), true).toBool();
Settings::values.use_vsync_new = ReadSetting(QStringLiteral("use_vsync_new"), true).toBool();
Settings::values.resolution_factor =
static_cast<u16>(ReadSetting(QStringLiteral("resolution_factor"), 1).toInt());
@ -834,8 +834,6 @@ void Config::SaveUtilityValues() {
WriteSetting(QStringLiteral("dump_textures"), Settings::values.dump_textures, false);
WriteSetting(QStringLiteral("custom_textures"), Settings::values.custom_textures, false);
WriteSetting(QStringLiteral("preload_textures"), Settings::values.preload_textures, false);
WriteSetting(QStringLiteral("use_disk_shader_cache"), Settings::values.use_disk_shader_cache,
true);
qt_config->endGroup();
}
@ -981,8 +979,10 @@ void Config::SaveRendererValues() {
WriteSetting(QStringLiteral("use_separable_shader"), Settings::values.separable_shader, false);
#endif
WriteSetting(QStringLiteral("shaders_accurate_mul"), Settings::values.shaders_accurate_mul,
false);
true);
WriteSetting(QStringLiteral("use_shader_jit"), Settings::values.use_shader_jit, true);
WriteSetting(QStringLiteral("use_disk_shader_cache"), Settings::values.use_disk_shader_cache,
true);
WriteSetting(QStringLiteral("use_vsync_new"), Settings::values.use_vsync_new, true);
WriteSetting(QStringLiteral("resolution_factor"), Settings::values.resolution_factor, 1);
WriteSetting(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100);

View File

@ -47,8 +47,6 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
if (!ui->toggle_preload_textures->isEnabled())
ui->toggle_preload_textures->setChecked(false);
});
ui->toggle_disk_shader_cache->setEnabled(Settings::values.use_hw_shader);
}
void ConfigureEnhancements::SetConfiguration() {
@ -66,8 +64,6 @@ void ConfigureEnhancements::SetConfiguration() {
}
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
ui->swap_screen->setChecked(Settings::values.swap_screen);
ui->toggle_disk_shader_cache->setChecked(Settings::values.use_hw_shader &&
Settings::values.use_disk_shader_cache);
ui->upright_screen->setChecked(Settings::values.upright_screen);
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures);
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures);
@ -117,8 +113,6 @@ void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.layout_option =
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
Settings::values.swap_screen = ui->swap_screen->isChecked();
Settings::values.use_disk_shader_cache =
Settings::values.use_hw_shader && ui->toggle_disk_shader_cache->isChecked();
Settings::values.upright_screen = ui->upright_screen->isChecked();
Settings::values.dump_textures = ui->toggle_dump_textures->isChecked();
Settings::values.custom_textures = ui->toggle_custom_textures->isChecked();

View File

@ -290,13 +290,6 @@
<string>Utility</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="toggle_disk_shader_cache">
<property name="text">
<string>Use Disk Shader Cache</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_custom_textures">
<property name="toolTip">

View File

@ -27,6 +27,21 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
ui->hw_shader_group->setEnabled(ui->toggle_hw_shader->isChecked());
connect(ui->toggle_hw_shader, &QCheckBox::toggled, ui->hw_shader_group, &QWidget::setEnabled);
ui->toggle_disk_shader_cache->setEnabled(ui->toggle_hw_shader->isChecked() &&
ui->toggle_accurate_mul->isChecked());
connect(ui->toggle_hw_shader, &QCheckBox::toggled, this, [this] {
ui->toggle_disk_shader_cache->setEnabled(ui->toggle_hw_shader->isChecked() &&
ui->toggle_accurate_mul->isChecked());
if (!ui->toggle_disk_shader_cache->isEnabled())
ui->toggle_disk_shader_cache->setChecked(false);
});
connect(ui->toggle_accurate_mul, &QCheckBox::toggled, this, [this] {
ui->toggle_disk_shader_cache->setEnabled(ui->toggle_accurate_mul->isChecked());
if (!ui->toggle_disk_shader_cache->isEnabled())
ui->toggle_disk_shader_cache->setChecked(false);
});
#ifdef __APPLE__
connect(ui->toggle_hw_shader, &QCheckBox::stateChanged, this, [this](int state) {
if (state == Qt::Checked) {
@ -58,6 +73,7 @@ void ConfigureGraphics::SetConfiguration() {
ui->toggle_separable_shader->setChecked(Settings::values.separable_shader);
ui->toggle_accurate_mul->setChecked(Settings::values.shaders_accurate_mul);
ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
ui->toggle_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache);
ui->toggle_vsync_new->setChecked(Settings::values.use_vsync_new);
}
@ -67,6 +83,7 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.separable_shader = ui->toggle_separable_shader->isChecked();
Settings::values.shaders_accurate_mul = ui->toggle_accurate_mul->isChecked();
Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
Settings::values.use_disk_shader_cache = ui->toggle_disk_shader_cache->isChecked();
Settings::values.use_vsync_new = ui->toggle_vsync_new->isChecked();
}

View File

@ -118,6 +118,16 @@
<string>Advanced</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="toggle_disk_shader_cache">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reduce stuttering by storing and loading generated shaders to disk.&lt;/p&gt;&lt;p&gt;It cannot be used without Enable Hardware Shader or Accurate Multiplication.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use Disk Shader Cache</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_vsync_new">
<property name="toolTip">

View File

@ -106,8 +106,8 @@ ShaderDiskCache::ShaderDiskCache(bool separable) : separable{separable} {}
std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable() {
const bool has_title_id = GetProgramID() != 0;
if (!Settings::values.use_hw_shader || !Settings::values.use_disk_shader_cache ||
!has_title_id) {
if (!Settings::values.use_hw_shader || !Settings::values.shaders_accurate_mul ||
!Settings::values.use_disk_shader_cache || !has_title_id) {
return std::nullopt;
}
tried_to_load = true;