mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-22 21:02:46 +00:00
Fix Disk shader cache when accurate multiplication is off (#5711)
* renderer_opengl.cpp: fix sanitize_mul check for disk shader cache
* Partially revert "Band-aid solution for 'Disk Shader Cache' (#5188)"
This reverts commit 2e0ce86c9e
.
* Disable `disk_shader_cache` checkbox when `hw_renderer` is off
This commit is contained in:
parent
82aedb9900
commit
842031a2eb
|
@ -23,25 +23,19 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
connect(ui->toggle_hw_renderer, &QCheckBox::toggled, this, [this] {
|
connect(ui->toggle_hw_renderer, &QCheckBox::toggled, this, [this] {
|
||||||
auto checked = ui->toggle_hw_renderer->isChecked();
|
auto checked = ui->toggle_hw_renderer->isChecked();
|
||||||
ui->hw_renderer_group->setEnabled(checked);
|
ui->hw_renderer_group->setEnabled(checked);
|
||||||
|
ui->toggle_disk_shader_cache->setEnabled(checked && ui->toggle_hw_shader->isChecked());
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
ui->toggle_disk_shader_cache->setEnabled(ui->toggle_hw_renderer->isChecked() &&
|
||||||
|
ui->toggle_hw_shader->isChecked());
|
||||||
|
|
||||||
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] {
|
connect(ui->toggle_hw_shader, &QCheckBox::toggled, this, [this] {
|
||||||
ui->toggle_disk_shader_cache->setEnabled(ui->toggle_hw_shader->isChecked() &&
|
auto checked = ui->toggle_hw_shader->isChecked();
|
||||||
ui->toggle_accurate_mul->isChecked());
|
ui->hw_shader_group->setEnabled(checked);
|
||||||
if (!ui->toggle_disk_shader_cache->isEnabled())
|
ui->toggle_disk_shader_cache->setEnabled(checked);
|
||||||
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) {
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="toggle_disk_shader_cache">
|
<widget class="QCheckBox" name="toggle_disk_shader_cache">
|
||||||
<property name="toolTip">
|
<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>
|
<string><html><head/><body><p>Reduce stuttering by storing and loading generated shaders to disk.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Disk Shader Cache</string>
|
<string>Use Disk Shader Cache</string>
|
||||||
|
|
|
@ -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.shaders_accurate_mul ||
|
if (!Settings::values.use_hw_shader || !Settings::values.use_disk_shader_cache ||
|
||||||
!Settings::values.use_disk_shader_cache || !has_title_id) {
|
!has_title_id) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
tried_to_load = true;
|
tried_to_load = true;
|
||||||
|
|
|
@ -496,7 +496,8 @@ void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading,
|
||||||
|
|
||||||
if (dump != dump_map.end() && decomp != decompiled_map.end()) {
|
if (dump != dump_map.end() && decomp != decompiled_map.end()) {
|
||||||
// Only load this shader if its sanitize_mul setting matches
|
// Only load this shader if its sanitize_mul setting matches
|
||||||
if (decomp->second.sanitize_mul == VideoCore::g_hw_shader_accurate_mul) {
|
if (raw.GetProgramType() == ProgramType::VS &&
|
||||||
|
decomp->second.sanitize_mul != VideoCore::g_hw_shader_accurate_mul) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +618,6 @@ void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading,
|
||||||
if (precompiled_cache_altered) {
|
if (precompiled_cache_altered) {
|
||||||
disk_cache.SaveVirtualPrecompiledFile();
|
disk_cache.SaveVirtualPrecompiledFile();
|
||||||
}
|
}
|
||||||
} // namespace OpenGL
|
}
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
|
Loading…
Reference in a new issue