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:
parent
1bb20571b1
commit
2e0ce86c9e
8 changed files with 37 additions and 23 deletions
|
@ -119,7 +119,7 @@ void Config::ReadValues() {
|
||||||
sdl2_config->GetBoolean("Renderer", "separable_shader", false);
|
sdl2_config->GetBoolean("Renderer", "separable_shader", false);
|
||||||
#endif
|
#endif
|
||||||
Settings::values.shaders_accurate_mul =
|
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.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
|
||||||
Settings::values.resolution_factor =
|
Settings::values.resolution_factor =
|
||||||
static_cast<u16>(sdl2_config->GetInteger("Renderer", "resolution_factor", 1));
|
static_cast<u16>(sdl2_config->GetInteger("Renderer", "resolution_factor", 1));
|
||||||
|
|
|
@ -115,7 +115,7 @@ use_hw_shader =
|
||||||
separable_shader =
|
separable_shader =
|
||||||
|
|
||||||
# Whether to use accurate multiplication in hardware shaders
|
# 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 =
|
shaders_accurate_mul =
|
||||||
|
|
||||||
# Whether to use the Just-In-Time (JIT) compiler for shader emulation
|
# Whether to use the Just-In-Time (JIT) compiler for shader emulation
|
||||||
|
|
|
@ -284,8 +284,6 @@ void Config::ReadUtilityValues() {
|
||||||
ReadSetting(QStringLiteral("custom_textures"), false).toBool();
|
ReadSetting(QStringLiteral("custom_textures"), false).toBool();
|
||||||
Settings::values.preload_textures =
|
Settings::values.preload_textures =
|
||||||
ReadSetting(QStringLiteral("preload_textures"), false).toBool();
|
ReadSetting(QStringLiteral("preload_textures"), false).toBool();
|
||||||
Settings::values.use_disk_shader_cache =
|
|
||||||
ReadSetting(QStringLiteral("use_disk_shader_cache"), true).toBool();
|
|
||||||
|
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
@ -478,8 +476,10 @@ void Config::ReadRendererValues() {
|
||||||
ReadSetting(QStringLiteral("separable_shader"), false).toBool();
|
ReadSetting(QStringLiteral("separable_shader"), false).toBool();
|
||||||
#endif
|
#endif
|
||||||
Settings::values.shaders_accurate_mul =
|
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_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.use_vsync_new = ReadSetting(QStringLiteral("use_vsync_new"), true).toBool();
|
||||||
Settings::values.resolution_factor =
|
Settings::values.resolution_factor =
|
||||||
static_cast<u16>(ReadSetting(QStringLiteral("resolution_factor"), 1).toInt());
|
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("dump_textures"), Settings::values.dump_textures, false);
|
||||||
WriteSetting(QStringLiteral("custom_textures"), Settings::values.custom_textures, false);
|
WriteSetting(QStringLiteral("custom_textures"), Settings::values.custom_textures, false);
|
||||||
WriteSetting(QStringLiteral("preload_textures"), Settings::values.preload_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();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
@ -981,8 +979,10 @@ void Config::SaveRendererValues() {
|
||||||
WriteSetting(QStringLiteral("use_separable_shader"), Settings::values.separable_shader, false);
|
WriteSetting(QStringLiteral("use_separable_shader"), Settings::values.separable_shader, false);
|
||||||
#endif
|
#endif
|
||||||
WriteSetting(QStringLiteral("shaders_accurate_mul"), Settings::values.shaders_accurate_mul,
|
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_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("use_vsync_new"), Settings::values.use_vsync_new, true);
|
||||||
WriteSetting(QStringLiteral("resolution_factor"), Settings::values.resolution_factor, 1);
|
WriteSetting(QStringLiteral("resolution_factor"), Settings::values.resolution_factor, 1);
|
||||||
WriteSetting(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100);
|
WriteSetting(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100);
|
||||||
|
|
|
@ -47,8 +47,6 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
|
||||||
if (!ui->toggle_preload_textures->isEnabled())
|
if (!ui->toggle_preload_textures->isEnabled())
|
||||||
ui->toggle_preload_textures->setChecked(false);
|
ui->toggle_preload_textures->setChecked(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
ui->toggle_disk_shader_cache->setEnabled(Settings::values.use_hw_shader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureEnhancements::SetConfiguration() {
|
void ConfigureEnhancements::SetConfiguration() {
|
||||||
|
@ -66,8 +64,6 @@ void ConfigureEnhancements::SetConfiguration() {
|
||||||
}
|
}
|
||||||
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
|
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
|
||||||
ui->swap_screen->setChecked(Settings::values.swap_screen);
|
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->upright_screen->setChecked(Settings::values.upright_screen);
|
||||||
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures);
|
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures);
|
||||||
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures);
|
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures);
|
||||||
|
@ -117,8 +113,6 @@ void ConfigureEnhancements::ApplyConfiguration() {
|
||||||
Settings::values.layout_option =
|
Settings::values.layout_option =
|
||||||
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
|
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
|
||||||
Settings::values.swap_screen = ui->swap_screen->isChecked();
|
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.upright_screen = ui->upright_screen->isChecked();
|
||||||
Settings::values.dump_textures = ui->toggle_dump_textures->isChecked();
|
Settings::values.dump_textures = ui->toggle_dump_textures->isChecked();
|
||||||
Settings::values.custom_textures = ui->toggle_custom_textures->isChecked();
|
Settings::values.custom_textures = ui->toggle_custom_textures->isChecked();
|
||||||
|
|
|
@ -290,13 +290,6 @@
|
||||||
<string>Utility</string>
|
<string>Utility</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<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>
|
<item>
|
||||||
<widget class="QCheckBox" name="toggle_custom_textures">
|
<widget class="QCheckBox" name="toggle_custom_textures">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
|
|
@ -27,6 +27,21 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
|
|
||||||
ui->hw_shader_group->setEnabled(ui->toggle_hw_shader->isChecked());
|
ui->hw_shader_group->setEnabled(ui->toggle_hw_shader->isChecked());
|
||||||
connect(ui->toggle_hw_shader, &QCheckBox::toggled, ui->hw_shader_group, &QWidget::setEnabled);
|
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__
|
#ifdef __APPLE__
|
||||||
connect(ui->toggle_hw_shader, &QCheckBox::stateChanged, this, [this](int state) {
|
connect(ui->toggle_hw_shader, &QCheckBox::stateChanged, this, [this](int state) {
|
||||||
if (state == Qt::Checked) {
|
if (state == Qt::Checked) {
|
||||||
|
@ -58,6 +73,7 @@ void ConfigureGraphics::SetConfiguration() {
|
||||||
ui->toggle_separable_shader->setChecked(Settings::values.separable_shader);
|
ui->toggle_separable_shader->setChecked(Settings::values.separable_shader);
|
||||||
ui->toggle_accurate_mul->setChecked(Settings::values.shaders_accurate_mul);
|
ui->toggle_accurate_mul->setChecked(Settings::values.shaders_accurate_mul);
|
||||||
ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
|
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);
|
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.separable_shader = ui->toggle_separable_shader->isChecked();
|
||||||
Settings::values.shaders_accurate_mul = ui->toggle_accurate_mul->isChecked();
|
Settings::values.shaders_accurate_mul = ui->toggle_accurate_mul->isChecked();
|
||||||
Settings::values.use_shader_jit = ui->toggle_shader_jit->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();
|
Settings::values.use_vsync_new = ui->toggle_vsync_new->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,16 @@
|
||||||
<string>Advanced</string>
|
<string>Advanced</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toggle_disk_shader_cache">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Reduce stuttering by storing and loading generated shaders to disk.</p><p>It cannot be used without Enable Hardware Shader or Accurate Multiplication.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Use Disk Shader Cache</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="toggle_vsync_new">
|
<widget class="QCheckBox" name="toggle_vsync_new">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
|
|
@ -106,8 +106,8 @@ ShaderDiskCache::ShaderDiskCache(bool separable) : separable{separable} {}
|
||||||
|
|
||||||
std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable() {
|
std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable() {
|
||||||
const bool has_title_id = GetProgramID() != 0;
|
const bool has_title_id = GetProgramID() != 0;
|
||||||
if (!Settings::values.use_hw_shader || !Settings::values.use_disk_shader_cache ||
|
if (!Settings::values.use_hw_shader || !Settings::values.shaders_accurate_mul ||
|
||||||
!has_title_id) {
|
!Settings::values.use_disk_shader_cache || !has_title_id) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
tried_to_load = true;
|
tried_to_load = true;
|
||||||
|
|
Loading…
Reference in a new issue