Merge pull request #11276 from AdmiralCurtiss/texture-filter-options

Core: Add option to force linear texture filtering.
This commit is contained in:
JMC47 2022-12-09 01:13:42 -05:00 committed by GitHub
commit d250e69ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 186 additions and 51 deletions

View File

@ -107,8 +107,8 @@ const Info<bool> GFX_MODS_ENABLE{{System::GFX, "Settings", "EnableMods"}, false}
// Graphics.Enhancements // Graphics.Enhancements
const Info<bool> GFX_ENHANCE_FORCE_FILTERING{{System::GFX, "Enhancements", "ForceFiltering"}, const Info<TextureFilteringMode> GFX_ENHANCE_FORCE_TEXTURE_FILTERING{
false}; {System::GFX, "Enhancements", "ForceTextureFiltering"}, TextureFilteringMode::Default};
const Info<int> GFX_ENHANCE_MAX_ANISOTROPY{{System::GFX, "Enhancements", "MaxAnisotropy"}, 0}; const Info<int> GFX_ENHANCE_MAX_ANISOTROPY{{System::GFX, "Enhancements", "MaxAnisotropy"}, 0};
const Info<std::string> GFX_ENHANCE_POST_SHADER{ const Info<std::string> GFX_ENHANCE_POST_SHADER{
{System::GFX, "Enhancements", "PostProcessingShader"}, ""}; {System::GFX, "Enhancements", "PostProcessingShader"}, ""};

View File

@ -10,6 +10,7 @@
enum class AspectMode : int; enum class AspectMode : int;
enum class ShaderCompilationMode : int; enum class ShaderCompilationMode : int;
enum class StereoMode : int; enum class StereoMode : int;
enum class TextureFilteringMode : int;
enum class TriState : int; enum class TriState : int;
namespace Config namespace Config
@ -92,7 +93,7 @@ extern const Info<bool> GFX_MODS_ENABLE;
// Graphics.Enhancements // Graphics.Enhancements
extern const Info<bool> GFX_ENHANCE_FORCE_FILTERING; extern const Info<TextureFilteringMode> GFX_ENHANCE_FORCE_TEXTURE_FILTERING;
extern const Info<int> GFX_ENHANCE_MAX_ANISOTROPY; // NOTE - this is x in (1 << x) extern const Info<int> GFX_ENHANCE_MAX_ANISOTROPY; // NOTE - this is x in (1 << x)
extern const Info<std::string> GFX_ENHANCE_POST_SHADER; extern const Info<std::string> GFX_ENHANCE_POST_SHADER;
extern const Info<bool> GFX_ENHANCE_FORCE_TRUE_COLOR; extern const Info<bool> GFX_ENHANCE_FORCE_TRUE_COLOR;

View File

@ -104,7 +104,7 @@ public:
layer->Set(Config::GFX_FAST_DEPTH_CALC, m_settings.fast_depth_calc); layer->Set(Config::GFX_FAST_DEPTH_CALC, m_settings.fast_depth_calc);
layer->Set(Config::GFX_ENABLE_PIXEL_LIGHTING, m_settings.enable_pixel_lighting); layer->Set(Config::GFX_ENABLE_PIXEL_LIGHTING, m_settings.enable_pixel_lighting);
layer->Set(Config::GFX_WIDESCREEN_HACK, m_settings.widescreen_hack); layer->Set(Config::GFX_WIDESCREEN_HACK, m_settings.widescreen_hack);
layer->Set(Config::GFX_ENHANCE_FORCE_FILTERING, m_settings.force_filtering); layer->Set(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING, m_settings.force_texture_filtering);
layer->Set(Config::GFX_ENHANCE_MAX_ANISOTROPY, m_settings.max_anisotropy); layer->Set(Config::GFX_ENHANCE_MAX_ANISOTROPY, m_settings.max_anisotropy);
layer->Set(Config::GFX_ENHANCE_FORCE_TRUE_COLOR, m_settings.force_true_color); layer->Set(Config::GFX_ENHANCE_FORCE_TRUE_COLOR, m_settings.force_true_color);
layer->Set(Config::GFX_ENHANCE_DISABLE_COPY_FILTER, m_settings.disable_copy_filter); layer->Set(Config::GFX_ENHANCE_DISABLE_COPY_FILTER, m_settings.disable_copy_filter);

View File

@ -872,7 +872,7 @@ void NetPlayClient::OnStartGame(sf::Packet& packet)
packet >> m_net_settings.fast_depth_calc; packet >> m_net_settings.fast_depth_calc;
packet >> m_net_settings.enable_pixel_lighting; packet >> m_net_settings.enable_pixel_lighting;
packet >> m_net_settings.widescreen_hack; packet >> m_net_settings.widescreen_hack;
packet >> m_net_settings.force_filtering; packet >> m_net_settings.force_texture_filtering;
packet >> m_net_settings.max_anisotropy; packet >> m_net_settings.max_anisotropy;
packet >> m_net_settings.force_true_color; packet >> m_net_settings.force_true_color;
packet >> m_net_settings.disable_copy_filter; packet >> m_net_settings.disable_copy_filter;

View File

@ -13,6 +13,7 @@
#include "Core/HW/EXI/EXI.h" #include "Core/HW/EXI/EXI.h"
#include "Core/HW/EXI/EXI_Device.h" #include "Core/HW/EXI/EXI_Device.h"
#include "Core/HW/Sram.h" #include "Core/HW/Sram.h"
#include "VideoCommon/VideoConfig.h"
namespace DiscIO namespace DiscIO
{ {
@ -82,7 +83,7 @@ struct NetSettings
bool fast_depth_calc = false; bool fast_depth_calc = false;
bool enable_pixel_lighting = false; bool enable_pixel_lighting = false;
bool widescreen_hack = false; bool widescreen_hack = false;
bool force_filtering = false; TextureFilteringMode force_texture_filtering = TextureFilteringMode::Default;
int max_anisotropy = 0; int max_anisotropy = 0;
bool force_true_color = false; bool force_true_color = false;
bool disable_copy_filter = false; bool disable_copy_filter = false;

View File

@ -1336,7 +1336,7 @@ bool NetPlayServer::SetupNetSettings()
settings.fast_depth_calc = Config::Get(Config::GFX_FAST_DEPTH_CALC); settings.fast_depth_calc = Config::Get(Config::GFX_FAST_DEPTH_CALC);
settings.enable_pixel_lighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING); settings.enable_pixel_lighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING);
settings.widescreen_hack = Config::Get(Config::GFX_WIDESCREEN_HACK); settings.widescreen_hack = Config::Get(Config::GFX_WIDESCREEN_HACK);
settings.force_filtering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING); settings.force_texture_filtering = Config::Get(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING);
settings.max_anisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY); settings.max_anisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
settings.force_true_color = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR); settings.force_true_color = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);
settings.disable_copy_filter = Config::Get(Config::GFX_ENHANCE_DISABLE_COPY_FILTER); settings.disable_copy_filter = Config::Get(Config::GFX_ENHANCE_DISABLE_COPY_FILTER);
@ -1539,7 +1539,7 @@ bool NetPlayServer::StartGame()
spac << m_settings.fast_depth_calc; spac << m_settings.fast_depth_calc;
spac << m_settings.enable_pixel_lighting; spac << m_settings.enable_pixel_lighting;
spac << m_settings.widescreen_hack; spac << m_settings.widescreen_hack;
spac << m_settings.force_filtering; spac << m_settings.force_texture_filtering;
spac << m_settings.max_anisotropy; spac << m_settings.max_anisotropy;
spac << m_settings.force_true_color; spac << m_settings.force_true_color;
spac << m_settings.disable_copy_filter; spac << m_settings.disable_copy_filter;

View File

@ -16,6 +16,7 @@
#include "DolphinQt/Config/Graphics/GraphicsBool.h" #include "DolphinQt/Config/Graphics/GraphicsBool.h"
#include "DolphinQt/Config/Graphics/GraphicsChoice.h" #include "DolphinQt/Config/Graphics/GraphicsChoice.h"
#include "DolphinQt/Config/Graphics/GraphicsRadio.h"
#include "DolphinQt/Config/Graphics/GraphicsSlider.h" #include "DolphinQt/Config/Graphics/GraphicsSlider.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Config/Graphics/PostProcessingConfigWindow.h" #include "DolphinQt/Config/Graphics/PostProcessingConfigWindow.h"
@ -39,6 +40,18 @@ EnhancementsWidget::EnhancementsWidget(GraphicsWindow* parent) : m_block_save(fa
[this](const QString& backend) { LoadSettings(); }); [this](const QString& backend) { LoadSettings(); });
} }
constexpr int TEXTURE_FILTERING_DEFAULT = 0;
constexpr int TEXTURE_FILTERING_ANISO_2X = 1;
constexpr int TEXTURE_FILTERING_ANISO_4X = 2;
constexpr int TEXTURE_FILTERING_ANISO_8X = 3;
constexpr int TEXTURE_FILTERING_ANISO_16X = 4;
constexpr int TEXTURE_FILTERING_FORCE_NEAREST = 5;
constexpr int TEXTURE_FILTERING_FORCE_LINEAR = 6;
constexpr int TEXTURE_FILTERING_FORCE_LINEAR_ANISO_2X = 7;
constexpr int TEXTURE_FILTERING_FORCE_LINEAR_ANISO_4X = 8;
constexpr int TEXTURE_FILTERING_FORCE_LINEAR_ANISO_8X = 9;
constexpr int TEXTURE_FILTERING_FORCE_LINEAR_ANISO_16X = 10;
void EnhancementsWidget::CreateWidgets() void EnhancementsWidget::CreateWidgets()
{ {
auto* main_layout = new QVBoxLayout; auto* main_layout = new QVBoxLayout;
@ -73,16 +86,30 @@ void EnhancementsWidget::CreateWidgets()
m_ir_combo->setMaxVisibleItems(visible_resolution_option_count); m_ir_combo->setMaxVisibleItems(visible_resolution_option_count);
m_aa_combo = new ToolTipComboBox(); m_aa_combo = new ToolTipComboBox();
m_af_combo = new GraphicsChoice({tr("1x"), tr("2x"), tr("4x"), tr("8x"), tr("16x")},
Config::GFX_ENHANCE_MAX_ANISOTROPY); m_texture_filtering_combo = new ToolTipComboBox();
m_texture_filtering_combo->addItem(tr("Default"), TEXTURE_FILTERING_DEFAULT);
m_texture_filtering_combo->addItem(tr("2x Anisotropic"), TEXTURE_FILTERING_ANISO_2X);
m_texture_filtering_combo->addItem(tr("4x Anisotropic"), TEXTURE_FILTERING_ANISO_4X);
m_texture_filtering_combo->addItem(tr("8x Anisotropic"), TEXTURE_FILTERING_ANISO_8X);
m_texture_filtering_combo->addItem(tr("16x Anisotropic"), TEXTURE_FILTERING_ANISO_16X);
m_texture_filtering_combo->addItem(tr("Force Nearest"), TEXTURE_FILTERING_FORCE_NEAREST);
m_texture_filtering_combo->addItem(tr("Force Linear"), TEXTURE_FILTERING_FORCE_LINEAR);
m_texture_filtering_combo->addItem(tr("Force Linear and 2x Anisotropic"),
TEXTURE_FILTERING_FORCE_LINEAR_ANISO_2X);
m_texture_filtering_combo->addItem(tr("Force Linear and 4x Anisotropic"),
TEXTURE_FILTERING_FORCE_LINEAR_ANISO_4X);
m_texture_filtering_combo->addItem(tr("Force Linear and 8x Anisotropic"),
TEXTURE_FILTERING_FORCE_LINEAR_ANISO_8X);
m_texture_filtering_combo->addItem(tr("Force Linear and 16x Anisotropic"),
TEXTURE_FILTERING_FORCE_LINEAR_ANISO_16X);
m_pp_effect = new ToolTipComboBox(); m_pp_effect = new ToolTipComboBox();
m_configure_pp_effect = new NonDefaultQPushButton(tr("Configure")); m_configure_pp_effect = new NonDefaultQPushButton(tr("Configure"));
m_scaled_efb_copy = new GraphicsBool(tr("Scaled EFB Copy"), Config::GFX_HACK_COPY_EFB_SCALED); m_scaled_efb_copy = new GraphicsBool(tr("Scaled EFB Copy"), Config::GFX_HACK_COPY_EFB_SCALED);
m_per_pixel_lighting = m_per_pixel_lighting =
new GraphicsBool(tr("Per-Pixel Lighting"), Config::GFX_ENABLE_PIXEL_LIGHTING); new GraphicsBool(tr("Per-Pixel Lighting"), Config::GFX_ENABLE_PIXEL_LIGHTING);
m_force_texture_filtering =
new GraphicsBool(tr("Force Texture Filtering"), Config::GFX_ENHANCE_FORCE_FILTERING);
m_widescreen_hack = new GraphicsBool(tr("Widescreen Hack"), Config::GFX_WIDESCREEN_HACK); m_widescreen_hack = new GraphicsBool(tr("Widescreen Hack"), Config::GFX_WIDESCREEN_HACK);
m_disable_fog = new GraphicsBool(tr("Disable Fog"), Config::GFX_DISABLE_FOG); m_disable_fog = new GraphicsBool(tr("Disable Fog"), Config::GFX_DISABLE_FOG);
m_force_24bit_color = m_force_24bit_color =
@ -92,25 +119,38 @@ void EnhancementsWidget::CreateWidgets()
m_arbitrary_mipmap_detection = new GraphicsBool(tr("Arbitrary Mipmap Detection"), m_arbitrary_mipmap_detection = new GraphicsBool(tr("Arbitrary Mipmap Detection"),
Config::GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION); Config::GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION);
enhancements_layout->addWidget(new QLabel(tr("Internal Resolution:")), 0, 0); int row = 0;
enhancements_layout->addWidget(m_ir_combo, 0, 1, 1, -1); enhancements_layout->addWidget(new QLabel(tr("Internal Resolution:")), row, 0);
enhancements_layout->addWidget(new QLabel(tr("Anti-Aliasing:")), 1, 0); enhancements_layout->addWidget(m_ir_combo, row, 1, 1, -1);
enhancements_layout->addWidget(m_aa_combo, 1, 1, 1, -1); ++row;
enhancements_layout->addWidget(new QLabel(tr("Anisotropic Filtering:")), 2, 0);
enhancements_layout->addWidget(m_af_combo, 2, 1, 1, -1);
enhancements_layout->addWidget(new QLabel(tr("Post-Processing Effect:")), 4, 0); enhancements_layout->addWidget(new QLabel(tr("Anti-Aliasing:")), row, 0);
enhancements_layout->addWidget(m_pp_effect, 4, 1); enhancements_layout->addWidget(m_aa_combo, row, 1, 1, -1);
enhancements_layout->addWidget(m_configure_pp_effect, 4, 2); ++row;
enhancements_layout->addWidget(m_scaled_efb_copy, 5, 0); enhancements_layout->addWidget(new QLabel(tr("Texture Filtering:")), row, 0);
enhancements_layout->addWidget(m_per_pixel_lighting, 5, 1); enhancements_layout->addWidget(m_texture_filtering_combo, row, 1, 1, -1);
enhancements_layout->addWidget(m_force_texture_filtering, 6, 0); ++row;
enhancements_layout->addWidget(m_widescreen_hack, 6, 1);
enhancements_layout->addWidget(m_disable_fog, 7, 0); enhancements_layout->addWidget(new QLabel(tr("Post-Processing Effect:")), row, 0);
enhancements_layout->addWidget(m_force_24bit_color, 7, 1); enhancements_layout->addWidget(m_pp_effect, row, 1);
enhancements_layout->addWidget(m_disable_copy_filter, 8, 0); enhancements_layout->addWidget(m_configure_pp_effect, row, 2);
enhancements_layout->addWidget(m_arbitrary_mipmap_detection, 8, 1); ++row;
enhancements_layout->addWidget(m_scaled_efb_copy, row, 0);
enhancements_layout->addWidget(m_per_pixel_lighting, row, 1, 1, -1);
++row;
enhancements_layout->addWidget(m_widescreen_hack, row, 0);
enhancements_layout->addWidget(m_force_24bit_color, row, 1, 1, -1);
++row;
enhancements_layout->addWidget(m_disable_fog, row, 0);
enhancements_layout->addWidget(m_arbitrary_mipmap_detection, row, 1, 1, -1);
++row;
enhancements_layout->addWidget(m_disable_copy_filter, row, 0);
++row;
// Stereoscopy // Stereoscopy
auto* stereoscopy_box = new QGroupBox(tr("Stereoscopy")); auto* stereoscopy_box = new QGroupBox(tr("Stereoscopy"));
@ -144,6 +184,8 @@ void EnhancementsWidget::ConnectWidgets()
{ {
connect(m_aa_combo, qOverload<int>(&QComboBox::currentIndexChanged), connect(m_aa_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_texture_filtering_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged), connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] { connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
@ -218,8 +260,11 @@ void EnhancementsWidget::LoadSettings()
m_block_save = true; m_block_save = true;
// Anti-Aliasing // Anti-Aliasing
int aa_selection = Config::Get(Config::GFX_MSAA); const int aa_selection = Config::Get(Config::GFX_MSAA);
bool ssaa = Config::Get(Config::GFX_SSAA); const bool ssaa = Config::Get(Config::GFX_SSAA);
const int aniso = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
const TextureFilteringMode tex_filter_mode =
Config::Get(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING);
m_aa_combo->clear(); m_aa_combo->clear();
for (const auto& option : VideoUtils::GetAvailableAntialiasingModes(m_msaa_modes)) for (const auto& option : VideoUtils::GetAvailableAntialiasingModes(m_msaa_modes))
@ -229,6 +274,25 @@ void EnhancementsWidget::LoadSettings()
QString::fromStdString(std::to_string(aa_selection) + "x " + (ssaa ? "SSAA" : "MSAA"))); QString::fromStdString(std::to_string(aa_selection) + "x " + (ssaa ? "SSAA" : "MSAA")));
m_aa_combo->setEnabled(m_aa_combo->count() > 1); m_aa_combo->setEnabled(m_aa_combo->count() > 1);
switch (tex_filter_mode)
{
case TextureFilteringMode::Default:
if (aniso >= 0 && aniso <= 4)
m_texture_filtering_combo->setCurrentIndex(aniso);
else
m_texture_filtering_combo->setCurrentIndex(TEXTURE_FILTERING_DEFAULT);
break;
case TextureFilteringMode::Nearest:
m_texture_filtering_combo->setCurrentIndex(TEXTURE_FILTERING_FORCE_NEAREST);
break;
case TextureFilteringMode::Linear:
if (aniso >= 0 && aniso <= 4)
m_texture_filtering_combo->setCurrentIndex(TEXTURE_FILTERING_FORCE_LINEAR + aniso);
else
m_texture_filtering_combo->setCurrentIndex(TEXTURE_FILTERING_FORCE_LINEAR);
break;
}
// Post Processing Shader // Post Processing Shader
LoadPPShaders(); LoadPPShaders();
@ -264,6 +328,66 @@ void EnhancementsWidget::SaveSettings()
Config::SetBaseOrCurrent(Config::GFX_SSAA, is_ssaa); Config::SetBaseOrCurrent(Config::GFX_SSAA, is_ssaa);
const int texture_filtering_selection = m_texture_filtering_combo->currentData().toInt();
switch (texture_filtering_selection)
{
case TEXTURE_FILTERING_DEFAULT:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 0);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Default);
break;
case TEXTURE_FILTERING_ANISO_2X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 1);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Default);
break;
case TEXTURE_FILTERING_ANISO_4X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 2);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Default);
break;
case TEXTURE_FILTERING_ANISO_8X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 3);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Default);
break;
case TEXTURE_FILTERING_ANISO_16X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 4);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Default);
break;
case TEXTURE_FILTERING_FORCE_NEAREST:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 0);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Nearest);
break;
case TEXTURE_FILTERING_FORCE_LINEAR:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 0);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Linear);
break;
case TEXTURE_FILTERING_FORCE_LINEAR_ANISO_2X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 1);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Linear);
break;
case TEXTURE_FILTERING_FORCE_LINEAR_ANISO_4X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 2);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Linear);
break;
case TEXTURE_FILTERING_FORCE_LINEAR_ANISO_8X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 3);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Linear);
break;
case TEXTURE_FILTERING_FORCE_LINEAR_ANISO_16X:
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_MAX_ANISOTROPY, 4);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
TextureFilteringMode::Linear);
break;
}
const bool anaglyph = g_Config.stereo_mode == StereoMode::Anaglyph; const bool anaglyph = g_Config.stereo_mode == StereoMode::Anaglyph;
const bool passive = g_Config.stereo_mode == StereoMode::Passive; const bool passive = g_Config.stereo_mode == StereoMode::Passive;
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER, Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER,
@ -300,10 +424,12 @@ void EnhancementsWidget::AddDescriptions()
"geometry anti-aliasing and also applies anti-aliasing to lighting, shader " "geometry anti-aliasing and also applies anti-aliasing to lighting, shader "
"effects, and textures.<br><br><dolphin_emphasis>If unsure, select " "effects, and textures.<br><br><dolphin_emphasis>If unsure, select "
"None.</dolphin_emphasis>"); "None.</dolphin_emphasis>");
static const char TR_ANISOTROPIC_FILTERING_DESCRIPTION[] = QT_TR_NOOP( static const char TR_FORCE_TEXTURE_FILTERING_DESCRIPTION[] = QT_TR_NOOP(
"Enables anisotropic filtering, which enhances the visual quality of textures that " "Adjust the texture filtering. Anisotropic filtering enhances the visual quality of textures "
"are at oblique viewing angles.<br><br>Might cause issues in a small " "that are at oblique viewing angles. Force Nearest and Force Linear override the texture "
"number of games.<br><br><dolphin_emphasis>If unsure, select 1x.</dolphin_emphasis>"); "scaling filter selected by the game.<br><br>Any option except 'Default' will alter the look "
"of the game's textures and might cause issues in a small number of "
"games.<br><br><dolphin_emphasis>If unsure, select 'Default'.</dolphin_emphasis>");
static const char TR_POSTPROCESSING_DESCRIPTION[] = static const char TR_POSTPROCESSING_DESCRIPTION[] =
QT_TR_NOOP("Applies a post-processing effect after rendering a frame.<br><br " QT_TR_NOOP("Applies a post-processing effect after rendering a frame.<br><br "
"/><dolphin_emphasis>If unsure, select (off).</dolphin_emphasis>"); "/><dolphin_emphasis>If unsure, select (off).</dolphin_emphasis>");
@ -352,11 +478,6 @@ void EnhancementsWidget::AddDescriptions()
"quality by reducing color banding.<br><br>Has no impact on performance and causes " "quality by reducing color banding.<br><br>Has no impact on performance and causes "
"few graphical issues.<br><br><dolphin_emphasis>If unsure, leave this " "few graphical issues.<br><br><dolphin_emphasis>If unsure, leave this "
"checked.</dolphin_emphasis>"); "checked.</dolphin_emphasis>");
static const char TR_FORCE_TEXTURE_FILTERING_DESCRIPTION[] =
QT_TR_NOOP("Filters all textures, including any that the game explicitly set as "
"unfiltered.<br><br>May improve quality of certain textures in some games, but "
"will cause issues in others.<br><br><dolphin_emphasis>If unsure, leave this "
"unchecked.</dolphin_emphasis>");
static const char TR_DISABLE_COPY_FILTER_DESCRIPTION[] = QT_TR_NOOP( static const char TR_DISABLE_COPY_FILTER_DESCRIPTION[] = QT_TR_NOOP(
"Disables the blending of adjacent rows when copying the EFB. This is known in " "Disables the blending of adjacent rows when copying the EFB. This is known in "
"some games as \"deflickering\" or \"smoothing\".<br><br>Disabling the filter has no " "some games as \"deflickering\" or \"smoothing\".<br><br>Disabling the filter has no "
@ -378,8 +499,8 @@ void EnhancementsWidget::AddDescriptions()
m_aa_combo->SetTitle(tr("Anti-Aliasing")); m_aa_combo->SetTitle(tr("Anti-Aliasing"));
m_aa_combo->SetDescription(tr(TR_ANTIALIAS_DESCRIPTION)); m_aa_combo->SetDescription(tr(TR_ANTIALIAS_DESCRIPTION));
m_af_combo->SetTitle(tr("Anisotropic Filtering")); m_texture_filtering_combo->SetTitle(tr("Texture Filtering"));
m_af_combo->SetDescription(tr(TR_ANISOTROPIC_FILTERING_DESCRIPTION)); m_texture_filtering_combo->SetDescription(tr(TR_FORCE_TEXTURE_FILTERING_DESCRIPTION));
m_pp_effect->SetTitle(tr("Post-Processing Effect")); m_pp_effect->SetTitle(tr("Post-Processing Effect"));
m_pp_effect->SetDescription(tr(TR_POSTPROCESSING_DESCRIPTION)); m_pp_effect->SetDescription(tr(TR_POSTPROCESSING_DESCRIPTION));
@ -394,8 +515,6 @@ void EnhancementsWidget::AddDescriptions()
m_force_24bit_color->SetDescription(tr(TR_FORCE_24BIT_DESCRIPTION)); m_force_24bit_color->SetDescription(tr(TR_FORCE_24BIT_DESCRIPTION));
m_force_texture_filtering->SetDescription(tr(TR_FORCE_TEXTURE_FILTERING_DESCRIPTION));
m_disable_copy_filter->SetDescription(tr(TR_DISABLE_COPY_FILTER_DESCRIPTION)); m_disable_copy_filter->SetDescription(tr(TR_DISABLE_COPY_FILTER_DESCRIPTION));
m_arbitrary_mipmap_detection->SetDescription(tr(TR_ARBITRARY_MIPMAP_DETECTION_DESCRIPTION)); m_arbitrary_mipmap_detection->SetDescription(tr(TR_ARBITRARY_MIPMAP_DETECTION_DESCRIPTION));

View File

@ -3,6 +3,8 @@
#pragma once #pragma once
#include <array>
#include "DolphinQt/Config/Graphics/GraphicsWidget.h" #include "DolphinQt/Config/Graphics/GraphicsWidget.h"
class GraphicsBool; class GraphicsBool;
@ -34,12 +36,11 @@ private:
// Enhancements // Enhancements
GraphicsChoice* m_ir_combo; GraphicsChoice* m_ir_combo;
ToolTipComboBox* m_aa_combo; ToolTipComboBox* m_aa_combo;
GraphicsChoice* m_af_combo; ToolTipComboBox* m_texture_filtering_combo;
ToolTipComboBox* m_pp_effect; ToolTipComboBox* m_pp_effect;
QPushButton* m_configure_pp_effect; QPushButton* m_configure_pp_effect;
GraphicsBool* m_scaled_efb_copy; GraphicsBool* m_scaled_efb_copy;
GraphicsBool* m_per_pixel_lighting; GraphicsBool* m_per_pixel_lighting;
GraphicsBool* m_force_texture_filtering;
GraphicsBool* m_widescreen_hack; GraphicsBool* m_widescreen_hack;
GraphicsBool* m_disable_fog; GraphicsBool* m_disable_fog;
GraphicsBool* m_force_24bit_color; GraphicsBool* m_force_24bit_color;

View File

@ -480,7 +480,7 @@ void Renderer::CheckForConfigChanges()
const u32 old_multisamples = g_ActiveConfig.iMultisamples; const u32 old_multisamples = g_ActiveConfig.iMultisamples;
const int old_anisotropy = g_ActiveConfig.iMaxAnisotropy; const int old_anisotropy = g_ActiveConfig.iMaxAnisotropy;
const int old_efb_access_tile_size = g_ActiveConfig.iEFBAccessTileSize; const int old_efb_access_tile_size = g_ActiveConfig.iEFBAccessTileSize;
const bool old_force_filtering = g_ActiveConfig.bForceFiltering; const auto old_texture_filtering_mode = g_ActiveConfig.texture_filtering_mode;
const bool old_vsync = g_ActiveConfig.bVSyncActive; const bool old_vsync = g_ActiveConfig.bVSyncActive;
const bool old_bbox = g_ActiveConfig.bBBoxEnable; const bool old_bbox = g_ActiveConfig.bBBoxEnable;
const u32 old_game_mod_changes = const u32 old_game_mod_changes =
@ -533,7 +533,7 @@ void Renderer::CheckForConfigChanges()
changed_bits |= CONFIG_CHANGE_BIT_MULTISAMPLES; changed_bits |= CONFIG_CHANGE_BIT_MULTISAMPLES;
if (old_anisotropy != g_ActiveConfig.iMaxAnisotropy) if (old_anisotropy != g_ActiveConfig.iMaxAnisotropy)
changed_bits |= CONFIG_CHANGE_BIT_ANISOTROPY; changed_bits |= CONFIG_CHANGE_BIT_ANISOTROPY;
if (old_force_filtering != g_ActiveConfig.bForceFiltering) if (old_texture_filtering_mode != g_ActiveConfig.texture_filtering_mode)
changed_bits |= CONFIG_CHANGE_BIT_FORCE_TEXTURE_FILTERING; changed_bits |= CONFIG_CHANGE_BIT_FORCE_TEXTURE_FILTERING;
if (old_vsync != g_ActiveConfig.bVSyncActive) if (old_vsync != g_ActiveConfig.bVSyncActive)
changed_bits |= CONFIG_CHANGE_BIT_VSYNC; changed_bits |= CONFIG_CHANGE_BIT_VSYNC;

View File

@ -1001,7 +1001,13 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
state.Generate(bpmem, index); state.Generate(bpmem, index);
// Force texture filtering config option. // Force texture filtering config option.
if (g_ActiveConfig.bForceFiltering) if (g_ActiveConfig.texture_filtering_mode == TextureFilteringMode::Nearest)
{
state.tm0.min_filter = FilterMode::Near;
state.tm0.mag_filter = FilterMode::Near;
state.tm0.mipmap_filter = FilterMode::Near;
}
else if (g_ActiveConfig.texture_filtering_mode == TextureFilteringMode::Linear)
{ {
state.tm0.min_filter = FilterMode::Linear; state.tm0.min_filter = FilterMode::Linear;
state.tm0.mag_filter = FilterMode::Linear; state.tm0.mag_filter = FilterMode::Linear;

View File

@ -111,7 +111,7 @@ void VideoConfig::Refresh()
iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS); iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS);
iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS); iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS);
bForceFiltering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING); texture_filtering_mode = Config::Get(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING);
iMaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY); iMaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER); sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR); bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);

View File

@ -45,6 +45,13 @@ enum class ShaderCompilationMode : int
AsynchronousSkipRendering AsynchronousSkipRendering
}; };
enum class TextureFilteringMode : int
{
Default,
Nearest,
Linear,
};
enum class TriState : int enum class TriState : int
{ {
Off, Off,
@ -72,7 +79,7 @@ struct VideoConfig final
u32 iMultisamples = 0; u32 iMultisamples = 0;
bool bSSAA = false; bool bSSAA = false;
int iEFBScale = 0; int iEFBScale = 0;
bool bForceFiltering = false; TextureFilteringMode texture_filtering_mode = TextureFilteringMode::Default;
int iMaxAnisotropy = 0; int iMaxAnisotropy = 0;
std::string sPostProcessingShader; std::string sPostProcessingShader;
bool bForceTrueColor = false; bool bForceTrueColor = false;