diff options
Diffstat (limited to 'Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp index 57a7eb634f..276a75d9da 100644 --- a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp @@ -41,11 +41,11 @@ EnhancementsWidget::EnhancementsWidget(GraphicsPane* gfx_pane) // BackendChanged is called by parent on window creation. connect(gfx_pane, &GraphicsPane::BackendChanged, this, &EnhancementsWidget::OnBackendChanged); connect(gfx_pane, &GraphicsPane::UseFastTextureSamplingChanged, this, [this] { - m_texture_filtering_combo->setEnabled(ReadSetting(Config::GFX_HACK_FAST_TEXTURE_SAMPLING)); - }); - connect(gfx_pane, &GraphicsPane::UseGPUTextureDecodingChanged, this, [this] { - m_arbitrary_mipmap_detection->setEnabled(!ReadSetting(Config::GFX_ENABLE_GPU_TEXTURE_DECODING)); + m_texture_filtering_combo->setEnabled( + Get(m_game_layer, Config::GFX_HACK_FAST_TEXTURE_SAMPLING)); }); + connect(m_arbitrary_mipmap_detection, &QCheckBox::toggled, gfx_pane, + [gfx_pane] { emit gfx_pane->UpdateGPUTextureDecoding(); }); } constexpr int ANISO_1x = std::to_underlying(AnisotropicFilteringMode::Force1x); @@ -82,8 +82,8 @@ void EnhancementsWidget::CreateWidgets() // If the current scale is greater than the max scale in the ini, add sufficient options so that // when the settings are saved we don't lose the user-modified value from the ini. - const int max_efb_scale = - std::max(ReadSetting(Config::GFX_EFB_SCALE), ReadSetting(Config::GFX_MAX_EFB_SCALE)); + const int max_efb_scale = std::max(Get(m_game_layer, Config::GFX_EFB_SCALE), + Get(m_game_layer, Config::GFX_MAX_EFB_SCALE)); for (int scale = static_cast<int>(resolution_options.size()); scale <= max_efb_scale; scale++) { const QString scale_text = QString::number(scale); @@ -129,7 +129,7 @@ void EnhancementsWidget::CreateWidgets() m_texture_filtering_combo->Add(tr("Force Linear and 16x Anisotropic"), ANISO_16X, FILTERING_LINEAR); m_texture_filtering_combo->Refresh(); - m_texture_filtering_combo->setEnabled(ReadSetting(Config::GFX_HACK_FAST_TEXTURE_SAMPLING)); + m_texture_filtering_combo->setEnabled(Get(m_game_layer, Config::GFX_HACK_FAST_TEXTURE_SAMPLING)); m_output_resampling_combo = new ConfigChoice( {tr("Default"), tr("Bilinear"), tr("Bicubic: B-Spline"), tr("Bicubic: Mitchell-Netravali"), @@ -162,7 +162,8 @@ void EnhancementsWidget::CreateWidgets() m_arbitrary_mipmap_detection = new ConfigBool(tr("Arbitrary Mipmap Detection"), Config::GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION, m_game_layer); - m_arbitrary_mipmap_detection->setEnabled(!ReadSetting(Config::GFX_ENABLE_GPU_TEXTURE_DECODING)); + m_arbitrary_mipmap_detection->setEnabled( + !Get(m_game_layer, Config::GFX_ENABLE_GPU_TEXTURE_DECODING)); m_hdr = new ConfigBool(tr("HDR Post-Processing"), Config::GFX_ENHANCE_HDR_OUTPUT, m_game_layer); int row = 0; @@ -241,7 +242,7 @@ void EnhancementsWidget::CreateWidgets() m_3d_depth_value->setText(QString::asprintf("%.0f", m_3d_depth->GetValue())); m_3d_convergence_value->setText(QString::asprintf("%.2f", m_3d_convergence->GetValue())); - auto current_stereo_mode = ReadSetting(Config::GFX_STEREO_MODE); + auto current_stereo_mode = Get(m_game_layer, Config::GFX_STEREO_MODE); if (current_stereo_mode != StereoMode::SBS && current_stereo_mode != StereoMode::TAB) m_3d_per_eye_resolution->hide(); @@ -254,8 +255,8 @@ void EnhancementsWidget::CreateWidgets() void EnhancementsWidget::ConnectWidgets() { - connect(m_3d_mode, &QComboBox::currentIndexChanged, [this] { - auto current_stereo_mode = ReadSetting(Config::GFX_STEREO_MODE); + connect(m_3d_mode, &QComboBox::currentIndexChanged, this, [this] { + auto current_stereo_mode = Get(m_game_layer, Config::GFX_STEREO_MODE); LoadPostProcessingShaders(); if (current_stereo_mode == StereoMode::SBS || current_stereo_mode == StereoMode::TAB) @@ -279,18 +280,9 @@ void EnhancementsWidget::ConnectWidgets() }); } -template <typename T> -T EnhancementsWidget::ReadSetting(const Config::Info<T>& setting) const -{ - if (m_game_layer != nullptr) - return m_game_layer->Get(setting); - else - return Config::Get(setting); -} - void EnhancementsWidget::LoadPostProcessingShaders() { - auto stereo_mode = ReadSetting(Config::GFX_STEREO_MODE); + auto stereo_mode = Get(m_game_layer, Config::GFX_STEREO_MODE); const QSignalBlocker blocker(m_post_processing_effect); m_post_processing_effect->clear(); @@ -307,7 +299,7 @@ void EnhancementsWidget::LoadPostProcessingShaders() if (stereo_mode != StereoMode::Anaglyph && stereo_mode != StereoMode::Passive) m_post_processing_effect->addItem(tr("(off)"), QStringLiteral("")); - auto selected_shader = ReadSetting(Config::GFX_ENHANCE_POST_SHADER); + auto selected_shader = Get(m_game_layer, Config::GFX_ENHANCE_POST_SHADER); bool found = false; @@ -337,7 +329,8 @@ void EnhancementsWidget::LoadPostProcessingShaders() m_post_processing_effect->setCurrentIndex(index); // Save forced shader, but avoid forcing an option into a game ini layer. - if (m_game_layer == nullptr && ReadSetting(Config::GFX_ENHANCE_POST_SHADER) != selected_shader) + if (m_game_layer == nullptr && + Get(m_game_layer, Config::GFX_ENHANCE_POST_SHADER) != selected_shader) Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER, selected_shader); } @@ -380,7 +373,7 @@ void EnhancementsWidget::OnBackendChanged() void EnhancementsWidget::ShaderChanged() { - auto shader = ReadSetting(Config::GFX_ENHANCE_POST_SHADER); + auto shader = Get(m_game_layer, Config::GFX_ENHANCE_POST_SHADER); if (shader == "(off)" || shader == "") { @@ -406,18 +399,6 @@ void EnhancementsWidget::ShaderChanged() } } -void EnhancementsWidget::OnConfigChanged() -{ - // Only used for the GameConfigWidget. Bypasses graphics window signals and backend info due to it - // being global. - m_texture_filtering_combo->setEnabled(ReadSetting(Config::GFX_HACK_FAST_TEXTURE_SAMPLING)); - m_arbitrary_mipmap_detection->setEnabled(!ReadSetting(Config::GFX_ENABLE_GPU_TEXTURE_DECODING)); - UpdateAntialiasingOptions(); - - // Needs to update after deleting a key for 3d settings. - LoadPostProcessingShaders(); -} - void EnhancementsWidget::UpdateAntialiasingOptions() { const QSignalBlocker blocker(m_antialiasing_combo); @@ -570,9 +551,9 @@ void EnhancementsWidget::AddDescriptions() "effects.<br><br>May have false positives that result in blurry textures at increased " "internal " "resolution, such as in games that use very low resolution mipmaps. Disabling this can also " - "reduce stutter in games that frequently load new textures.<br><br>This setting is disabled " - "when GPU Texture Decoding is enabled.<br><br><dolphin_emphasis>If unsure, leave this " - "unchecked.</dolphin_emphasis>"); + "reduce stutter in games that frequently load new textures.<br><br>If this setting is " + "enabled, GPU Texture Decoding will be disabled.<br><br><dolphin_emphasis>If " + "unsure, leave this unchecked.</dolphin_emphasis>"); static const char TR_HDR_DESCRIPTION[] = QT_TR_NOOP( "Enables scRGB HDR output (if supported by your graphics backend and monitor)." " Fullscreen might be required." @@ -637,7 +618,7 @@ void EnhancementsWidget::ConfigureColorCorrection() void EnhancementsWidget::ConfigurePostProcessingShader() { - const std::string shader = ReadSetting(Config::GFX_ENHANCE_POST_SHADER); + const std::string shader = Get(m_game_layer, Config::GFX_ENHANCE_POST_SHADER); PostProcessingConfigWindow dialog(this, shader); dialog.exec(); } |
