diff --git a/Data/Sys/GameSettings/DAX.ini b/Data/Sys/GameSettings/DAX.ini index a6e6b366cf..6fea79b0a9 100644 --- a/Data/Sys/GameSettings/DAX.ini +++ b/Data/Sys/GameSettings/DAX.ini @@ -15,8 +15,3 @@ EFBEmulateFormatChanges = True [Video_Enhancements] ArbitraryMipmapDetection = True - -[Video_Settings] -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False diff --git a/Data/Sys/GameSettings/GMS.ini b/Data/Sys/GameSettings/GMS.ini index 162644b033..a03c122b36 100644 --- a/Data/Sys/GameSettings/GMS.ini +++ b/Data/Sys/GameSettings/GMS.ini @@ -21,10 +21,5 @@ MissingColorValue = 0x00000000 ForceTextureFiltering = 0 ArbitraryMipmapDetection = True -[Video_Settings] -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False - [Video_Stereoscopy] StereoConvergence = 732 diff --git a/Data/Sys/GameSettings/GZ2.ini b/Data/Sys/GameSettings/GZ2.ini index 9261767b41..b592e7f328 100644 --- a/Data/Sys/GameSettings/GZ2.ini +++ b/Data/Sys/GameSettings/GZ2.ini @@ -10,7 +10,7 @@ # Add action replay cheats here. [Video_Hacks] -# The game logic itself is ignoring VI interrupts +# The game logic itself is ignoring VI interrupts # and keeps updating shadow video registers. # Because of this, it is incompatible with VISkip. @@ -23,9 +23,5 @@ VISkip = False CPUCull = True -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False - [Video_Enhancements] ArbitraryMipmapDetection = True diff --git a/Data/Sys/GameSettings/GZL.ini b/Data/Sys/GameSettings/GZL.ini index 5ffac0d340..4203954e72 100644 --- a/Data/Sys/GameSettings/GZL.ini +++ b/Data/Sys/GameSettings/GZL.ini @@ -13,7 +13,7 @@ EFBAccessEnable = True EFBToTextureEnable = False -# The game logic itself is ignoring VI interrupts +# The game logic itself is ignoring VI interrupts # and keeps updating shadow video registers. # Because of this, it is incompatible with VISkip. @@ -24,8 +24,3 @@ ArbitraryMipmapDetection = True [Video_Stereoscopy] StereoConvergence = 115 - -[Video_Settings] -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False diff --git a/Data/Sys/GameSettings/RMG.ini b/Data/Sys/GameSettings/RMG.ini index 3f49e2923a..226987654a 100644 --- a/Data/Sys/GameSettings/RMG.ini +++ b/Data/Sys/GameSettings/RMG.ini @@ -14,8 +14,3 @@ EFBAccessDeferInvalidation = True [Video_Enhancements] ArbitraryMipmapDetection = True - -[Video_Settings] -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False diff --git a/Data/Sys/GameSettings/RZD.ini b/Data/Sys/GameSettings/RZD.ini index 6a46bbdba0..72eb0cf0f3 100644 --- a/Data/Sys/GameSettings/RZD.ini +++ b/Data/Sys/GameSettings/RZD.ini @@ -11,7 +11,7 @@ [Video_Hacks] EFBAccessEnable = True -# The game logic itself is ignoring VI interrupts +# The game logic itself is ignoring VI interrupts # and keeps updating shadow video registers. # Because of this, it is incompatible with VISkip. @@ -24,9 +24,5 @@ VISkip = False CPUCull = True -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False - [Video_Enhancements] ArbitraryMipmapDetection = True diff --git a/Data/Sys/GameSettings/SB4.ini b/Data/Sys/GameSettings/SB4.ini index a224a6cec7..0305e9c610 100644 --- a/Data/Sys/GameSettings/SB4.ini +++ b/Data/Sys/GameSettings/SB4.ini @@ -17,8 +17,3 @@ ArbitraryMipmapDetection = True [Video_Stereoscopy] StereoConvergence = 929 - -[Video_Settings] -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False diff --git a/Data/Sys/GameSettings/SOU.ini b/Data/Sys/GameSettings/SOU.ini index 90cffabe7b..0b7baaeea1 100644 --- a/Data/Sys/GameSettings/SOU.ini +++ b/Data/Sys/GameSettings/SOU.ini @@ -13,8 +13,3 @@ EFBEmulateFormatChanges = True [Video_Enhancements] ArbitraryMipmapDetection = True - -[Video_Settings] -# Allow the ArbitraryMipmapDetection setting to take effect. - -EnableGPUTextureDecoding = False diff --git a/Source/Core/Common/Config/Config.h b/Source/Core/Common/Config/Config.h index d8a2a9a691..1a32203ea5 100644 --- a/Source/Core/Common/Config/Config.h +++ b/Source/Core/Common/Config/Config.h @@ -61,6 +61,14 @@ T Get(LayerType layer, const Info& info) return GetLayer(layer)->Get(info); } +template +T Get(const Layer* game_layer, const Info& setting) +{ + if (game_layer != nullptr) + return game_layer->Get(setting); + return Get(setting); +} + template T Get(const Info& info) { diff --git a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp index 98089e6d3d..8e127f454b 100644 --- a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp @@ -33,7 +33,7 @@ AdvancedWidget::AdvancedWidget(GraphicsPane* gfx_pane) : m_game_layer{gfx_pane-> connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); }); - connect(m_manual_texture_sampling, &QCheckBox::toggled, + connect(m_manual_texture_sampling, &QCheckBox::toggled, gfx_pane, [gfx_pane] { emit gfx_pane->UseFastTextureSamplingChanged(); }); OnBackendChanged(); 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(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 -T EnhancementsWidget::ReadSetting(const Config::Info& 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.

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.

This setting is disabled " - "when GPU Texture Decoding is enabled.

If unsure, leave this " - "unchecked."); + "reduce stutter in games that frequently load new textures.

If this setting is " + "enabled, GPU Texture Decoding will be disabled.

If " + "unsure, leave this unchecked."); 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(); } diff --git a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.h b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.h index 6309c6af0e..02205f526f 100644 --- a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.h +++ b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.h @@ -29,9 +29,6 @@ public: explicit EnhancementsWidget(GraphicsPane* gfx_pane); private: - template - T ReadSetting(const Config::Info& setting) const; - void CreateWidgets(); void ConnectWidgets(); void AddDescriptions(); @@ -40,7 +37,6 @@ private: void UpdateAntialiasingOptions(); void LoadPostProcessingShaders(); void ShaderChanged(); - void OnConfigChanged(); void ConfigureColorCorrection(); void ConfigurePostProcessingShader(); diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsPane.h b/Source/Core/DolphinQt/Config/Graphics/GraphicsPane.h index ffc55600ca..37ed7f8435 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GraphicsPane.h +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsPane.h @@ -23,7 +23,7 @@ public: signals: void BackendChanged(const QString& backend); void UseFastTextureSamplingChanged(); - void UseGPUTextureDecodingChanged(); + void UpdateGPUTextureDecoding(); private: void CreateMainLayout(); diff --git a/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp index 6d1108774a..61df287dbb 100644 --- a/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp @@ -27,8 +27,10 @@ HacksWidget::HacksWidget(GraphicsPane* gfx_pane) : m_game_layer{gfx_pane->GetCon connect(gfx_pane, &GraphicsPane::BackendChanged, this, &HacksWidget::OnBackendChanged); OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND))); - connect(m_gpu_texture_decoding, &QCheckBox::toggled, - [gfx_pane] { emit gfx_pane->UseGPUTextureDecodingChanged(); }); + connect(gfx_pane, &GraphicsPane::UpdateGPUTextureDecoding, this, [this] { + m_gpu_texture_decoding->setEnabled( + !Get(m_game_layer, Config::GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION)); + }); } void HacksWidget::CreateWidgets() @@ -214,8 +216,8 @@ void HacksWidget::AddDescriptions() static const char TR_GPU_DECODING_DESCRIPTION[] = QT_TR_NOOP( "Enables texture decoding using the GPU instead of the CPU.

This may result in " "performance gains in some scenarios, or on systems where the CPU is the " - "bottleneck.

If this setting is enabled, Arbitrary Mipmap Detection will be " - "disabled.

" + "bottleneck.

This setting is disabled when Arbitrary Mipmap Detection is " + "enabled.

" "If unsure, leave this unchecked."); static const char TR_FAST_DEPTH_CALC_DESCRIPTION[] = QT_TR_NOOP( "Uses a less accurate algorithm to calculate depth values.

Causes issues in a few " diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 3f82e3afe7..2d0ab116a1 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -364,7 +364,8 @@ struct VideoConfig final } bool UseGPUTextureDecoding() const { - return g_backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding; + return g_backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding && + !bArbitraryMipmapDetection; } bool UseVertexRounding() const { return bVertexRounding && iEFBScale != 1; } bool ManualTextureSamplingWithCustomTextureSizes() const