Qt/Graphics: Add ubershader options

This commit is contained in:
spycrab 2018-02-10 13:11:18 +01:00
parent fa91d74e2c
commit 7c99f10152
3 changed files with 44 additions and 10 deletions

View File

@ -62,6 +62,11 @@ void EnhancementsWidget::CreateWidgets()
m_aa_combo = new QComboBox(); m_aa_combo = new QComboBox();
m_af_combo = new GraphicsChoice({tr("1x"), tr("2x"), tr("4x"), tr("8x"), tr("16x")}, m_af_combo = new GraphicsChoice({tr("1x"), tr("2x"), tr("4x"), tr("8x"), tr("16x")},
Config::GFX_ENHANCE_MAX_ANISOTROPY); Config::GFX_ENHANCE_MAX_ANISOTROPY);
m_ubershader_combo = new QComboBox;
for (const auto& option : {tr("Disabled"), tr("Hybrid"), tr("Exclusive")})
m_ubershader_combo->addItem(option);
m_pp_effect = new QComboBox(); m_pp_effect = new QComboBox();
m_configure_pp_effect = new QPushButton(tr("Configure")); m_configure_pp_effect = new QPushButton(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);
@ -80,16 +85,20 @@ void EnhancementsWidget::CreateWidgets()
enhancements_layout->addWidget(m_aa_combo, 1, 1, 1, -1); enhancements_layout->addWidget(m_aa_combo, 1, 1, 1, -1);
enhancements_layout->addWidget(new QLabel(tr("Anisotropic Filtering:")), 2, 0); enhancements_layout->addWidget(new QLabel(tr("Anisotropic Filtering:")), 2, 0);
enhancements_layout->addWidget(m_af_combo, 2, 1, 1, -1); enhancements_layout->addWidget(m_af_combo, 2, 1, 1, -1);
enhancements_layout->addWidget(new QLabel(tr("Post-Processing Effect:")), 3, 0);
enhancements_layout->addWidget(m_pp_effect, 3, 1);
enhancements_layout->addWidget(m_configure_pp_effect, 3, 2);
enhancements_layout->addWidget(m_scaled_efb_copy, 4, 0); enhancements_layout->addWidget(new QLabel(tr("Ubershaders:")), 3, 0);
enhancements_layout->addWidget(m_per_pixel_lighting, 4, 1); enhancements_layout->addWidget(m_ubershader_combo, 3, 1, 1, -1);
enhancements_layout->addWidget(m_force_texture_filtering, 5, 0);
enhancements_layout->addWidget(m_widescreen_hack, 5, 1); enhancements_layout->addWidget(new QLabel(tr("Post-Processing Effect:")), 4, 0);
enhancements_layout->addWidget(m_disable_fog, 6, 0); enhancements_layout->addWidget(m_pp_effect, 4, 1);
enhancements_layout->addWidget(m_force_24bit_color, 6, 1); enhancements_layout->addWidget(m_configure_pp_effect, 4, 2);
enhancements_layout->addWidget(m_scaled_efb_copy, 5, 0);
enhancements_layout->addWidget(m_per_pixel_lighting, 5, 1);
enhancements_layout->addWidget(m_force_texture_filtering, 6, 0);
enhancements_layout->addWidget(m_widescreen_hack, 6, 1);
enhancements_layout->addWidget(m_disable_fog, 7, 0);
enhancements_layout->addWidget(m_force_24bit_color, 7, 1);
// Stereoscopy // Stereoscopy
auto* stereoscopy_box = new QGroupBox(tr("Stereoscopy")); auto* stereoscopy_box = new QGroupBox(tr("Stereoscopy"));
@ -122,6 +131,9 @@ void EnhancementsWidget::ConnectWidgets()
{ {
connect(m_aa_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_aa_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_ubershader_combo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -144,6 +156,13 @@ 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);
if (Config::GetBase(Config::GFX_DISABLE_SPECIALIZED_SHADERS))
m_ubershader_combo->setCurrentIndex(2);
else if (Config::GetBase(Config::GFX_BACKGROUND_SHADER_COMPILING))
m_ubershader_combo->setCurrentIndex(1);
else
m_ubershader_combo->setCurrentIndex(0);
// Post Processing Shader // Post Processing Shader
std::vector<std::string> shaders = std::vector<std::string> shaders =
g_Config.stereo_mode == StereoMode::Anaglyph ? g_Config.stereo_mode == StereoMode::Anaglyph ?
@ -201,6 +220,10 @@ void EnhancementsWidget::SaveSettings()
Config::SetBaseOrCurrent(Config::GFX_SSAA, is_ssaa); Config::SetBaseOrCurrent(Config::GFX_SSAA, is_ssaa);
int us_value = m_ubershader_combo->currentIndex();
Config::SetBaseOrCurrent(Config::GFX_BACKGROUND_SHADER_COMPILING, us_value == 1);
Config::SetBaseOrCurrent(Config::GFX_DISABLE_SPECIALIZED_SHADERS, us_value == 2);
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER, Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER,
m_pp_effect->currentText().toStdString()); m_pp_effect->currentText().toStdString());
@ -235,6 +258,15 @@ void EnhancementsWidget::AddDescriptions()
"Enable anisotropic filtering.\nEnhances visual quality of textures that are at oblique " "Enable anisotropic filtering.\nEnhances visual quality of textures that are at oblique "
"viewing angles.\nMight cause issues in a small number of games.\n\nIf unsure, select 1x."); "viewing angles.\nMight cause issues in a small number of games.\n\nIf unsure, select 1x.");
static const char* TR_UBERSHADER_DESCRIPTION =
QT_TR_NOOP("Disabled: Ubershaders are never used. Stuttering will occur during shader "
"compilation, but GPU demands are low. Recommended for low-end hardware.\n\n"
"Hybrid: Ubershaders will be used to prevent stuttering during shader "
"compilation, but traditional shaders will be used when they will not cause "
"stuttering. Balances performance and smoothness.\n\n"
"Exclusive: Ubershaders will always be used. Only recommended for high-end "
"systems.");
static const char* TR_POSTPROCESSING_DESCRIPTION = QT_TR_NOOP( static const char* TR_POSTPROCESSING_DESCRIPTION = QT_TR_NOOP(
"Apply a post-processing effect after finishing a frame.\n\nIf unsure, select (off)."); "Apply a post-processing effect after finishing a frame.\n\nIf unsure, select (off).");
@ -286,6 +318,7 @@ void EnhancementsWidget::AddDescriptions()
AddDescription(m_ir_combo, TR_INTERNAL_RESOLUTION_DESCRIPTION); AddDescription(m_ir_combo, TR_INTERNAL_RESOLUTION_DESCRIPTION);
AddDescription(m_aa_combo, TR_ANTIALIAS_DESCRIPTION); AddDescription(m_aa_combo, TR_ANTIALIAS_DESCRIPTION);
AddDescription(m_af_combo, TR_ANISOTROPIC_FILTERING_DESCRIPTION); AddDescription(m_af_combo, TR_ANISOTROPIC_FILTERING_DESCRIPTION);
AddDescription(m_ubershader_combo, TR_UBERSHADER_DESCRIPTION);
AddDescription(m_pp_effect, TR_POSTPROCESSING_DESCRIPTION); AddDescription(m_pp_effect, TR_POSTPROCESSING_DESCRIPTION);
AddDescription(m_scaled_efb_copy, TR_SCALED_EFB_COPY_DESCRIPTION); AddDescription(m_scaled_efb_copy, TR_SCALED_EFB_COPY_DESCRIPTION);
AddDescription(m_per_pixel_lighting, TR_PER_PIXEL_LIGHTING_DESCRIPTION); AddDescription(m_per_pixel_lighting, TR_PER_PIXEL_LIGHTING_DESCRIPTION);

View File

@ -30,6 +30,7 @@ private:
QComboBox* m_ir_combo; QComboBox* m_ir_combo;
QComboBox* m_aa_combo; QComboBox* m_aa_combo;
QComboBox* m_af_combo; QComboBox* m_af_combo;
QComboBox* m_ubershader_combo;
QComboBox* m_pp_effect; QComboBox* m_pp_effect;
QPushButton* m_configure_pp_effect; QPushButton* m_configure_pp_effect;
QCheckBox* m_scaled_efb_copy; QCheckBox* m_scaled_efb_copy;

View File

@ -42,7 +42,7 @@ void GraphicsWindow::CreateMainLayout()
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok); m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
description_box->setLayout(description_layout); description_box->setLayout(description_layout);
description_box->setMinimumHeight(205); description_box->setMinimumHeight(230);
m_description->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_description->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_description->setWordWrap(true); m_description->setWordWrap(true);