Qt/EnhancementsWidget: Combine texture filtering and anisotropic filtering.
This commit is contained in:
parent
ff2cc4d02b
commit
1d199f4664
|
@ -40,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;
|
||||||
|
@ -74,11 +86,23 @@ 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 =
|
m_texture_filtering_combo->addItem(tr("Default"), TEXTURE_FILTERING_DEFAULT);
|
||||||
new GraphicsChoice({tr("Default"), tr("Force Nearest"), tr("Force Linear")},
|
m_texture_filtering_combo->addItem(tr("2x Anisotropic"), TEXTURE_FILTERING_ANISO_2X);
|
||||||
Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING);
|
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"));
|
||||||
|
@ -104,10 +128,6 @@ void EnhancementsWidget::CreateWidgets()
|
||||||
enhancements_layout->addWidget(m_aa_combo, row, 1, 1, -1);
|
enhancements_layout->addWidget(m_aa_combo, row, 1, 1, -1);
|
||||||
++row;
|
++row;
|
||||||
|
|
||||||
enhancements_layout->addWidget(new QLabel(tr("Anisotropic Filtering:")), row, 0);
|
|
||||||
enhancements_layout->addWidget(m_af_combo, row, 1, 1, -1);
|
|
||||||
++row;
|
|
||||||
|
|
||||||
enhancements_layout->addWidget(new QLabel(tr("Texture Filtering:")), row, 0);
|
enhancements_layout->addWidget(new QLabel(tr("Texture Filtering:")), row, 0);
|
||||||
enhancements_layout->addWidget(m_texture_filtering_combo, row, 1, 1, -1);
|
enhancements_layout->addWidget(m_texture_filtering_combo, row, 1, 1, -1);
|
||||||
++row;
|
++row;
|
||||||
|
@ -164,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] {
|
||||||
|
@ -238,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))
|
||||||
|
@ -249,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();
|
||||||
|
|
||||||
|
@ -284,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,
|
||||||
|
@ -320,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>");
|
||||||
|
@ -372,10 +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(
|
|
||||||
"Override the texture scaling filter selected by the game.<br><br>Any option "
|
|
||||||
"except 'Default' will alter the look of the game's textures and may cause "
|
|
||||||
"issues.<br><br><dolphin_emphasis>If unsure, leave this on 'Default'.</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 "
|
||||||
|
@ -397,9 +499,6 @@ 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_af_combo->SetDescription(tr(TR_ANISOTROPIC_FILTERING_DESCRIPTION));
|
|
||||||
|
|
||||||
m_texture_filtering_combo->SetTitle(tr("Texture Filtering"));
|
m_texture_filtering_combo->SetTitle(tr("Texture Filtering"));
|
||||||
m_texture_filtering_combo->SetDescription(tr(TR_FORCE_TEXTURE_FILTERING_DESCRIPTION));
|
m_texture_filtering_combo->SetDescription(tr(TR_FORCE_TEXTURE_FILTERING_DESCRIPTION));
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,7 @@ 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;
|
||||||
GraphicsChoice* 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;
|
||||||
|
|
Loading…
Reference in New Issue