Qt: Move MSAA to advanced settings

This commit is contained in:
Connor McLaughlin 2021-08-26 21:11:58 +10:00
parent a8dea21725
commit 4ef5f434be
4 changed files with 50 additions and 54 deletions

View file

@ -138,6 +138,36 @@ static void setChoiceTweakOption(QTableWidget* table, int row, T value)
cb->setCurrentIndex(static_cast<int>(value));
}
static void addMSAATweakOption(QtHostInterface* host_interface, QTableWidget* table, const QString& name)
{
const int row = table->rowCount();
table->insertRow(row);
QTableWidgetItem* name_item = new QTableWidgetItem(name);
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
table->setItem(row, 0, name_item);
QComboBox* msaa = new QComboBox(table);
QtUtils::FillComboBoxWithMSAAModes(msaa);
const QVariant current_msaa_mode(QtUtils::GetMSAAModeValue(
static_cast<uint>(QtHostInterface::GetInstance()->GetIntSettingValue("GPU", "Multisamples", 1)),
QtHostInterface::GetInstance()->GetBoolSettingValue("GPU", "PerSampleShading", false)));
const int current_msaa_index = msaa->findData(current_msaa_mode);
if (current_msaa_index >= 0)
msaa->setCurrentIndex(current_msaa_index);
msaa->connect(msaa, QOverload<int>::of(&QComboBox::currentIndexChanged), [msaa](int index) {
uint multisamples;
bool ssaa;
QtUtils::DecodeMSAAModeValue(msaa->itemData(index), &multisamples, &ssaa);
QtHostInterface::GetInstance()->SetIntSettingValue("GPU", "Multisamples", static_cast<int>(multisamples));
QtHostInterface::GetInstance()->SetBoolSettingValue("GPU", "PerSampleShading", ssaa);
QtHostInterface::GetInstance()->applySettings(false);
});
table->setCellWidget(row, 1, msaa);
}
AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog)
: QWidget(parent), m_host_interface(host_interface)
{
@ -172,6 +202,8 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface,
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000,
0);
addMSAATweakOption(host_interface, m_ui.tweakOptionTable, tr("Multisample Antialiasing"));
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Vertex Cache"), "GPU", "PGXPVertexCache",
false);
addFloatRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Geometry Tolerance"), "GPU",
@ -247,25 +279,26 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
setBooleanTweakOption(m_ui.tweakOptionTable, 1, true);
setBooleanTweakOption(m_ui.tweakOptionTable, 2, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 3, 0);
setBooleanTweakOption(m_ui.tweakOptionTable, 4, false);
setFloatRangeTweakOption(m_ui.tweakOptionTable, 5, -1.0f);
setFloatRangeTweakOption(m_ui.tweakOptionTable, 6, Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD);
setBooleanTweakOption(m_ui.tweakOptionTable, 7, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 8, true);
setChoiceTweakOption(m_ui.tweakOptionTable, 9, Settings::DEFAULT_CPU_FASTMEM_MODE);
setBooleanTweakOption(m_ui.tweakOptionTable, 10, false);
setChoiceTweakOption(m_ui.tweakOptionTable, 4, 0);
setBooleanTweakOption(m_ui.tweakOptionTable, 5, false);
setFloatRangeTweakOption(m_ui.tweakOptionTable, 6, -1.0f);
setFloatRangeTweakOption(m_ui.tweakOptionTable, 7, Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD);
setBooleanTweakOption(m_ui.tweakOptionTable, 8, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 9, true);
setChoiceTweakOption(m_ui.tweakOptionTable, 10, Settings::DEFAULT_CPU_FASTMEM_MODE);
setBooleanTweakOption(m_ui.tweakOptionTable, 11, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 12, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 13, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 14, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 15, Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
setIntRangeTweakOption(m_ui.tweakOptionTable, 16, Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
setIntRangeTweakOption(m_ui.tweakOptionTable, 17, static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS));
setIntRangeTweakOption(m_ui.tweakOptionTable, 18, static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS));
setIntRangeTweakOption(m_ui.tweakOptionTable, 19, static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE));
setIntRangeTweakOption(m_ui.tweakOptionTable, 20, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
setBooleanTweakOption(m_ui.tweakOptionTable, 21, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 22, true);
setBooleanTweakOption(m_ui.tweakOptionTable, 23, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 15, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 16, Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
setIntRangeTweakOption(m_ui.tweakOptionTable, 17, Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
setIntRangeTweakOption(m_ui.tweakOptionTable, 18, static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS));
setIntRangeTweakOption(m_ui.tweakOptionTable, 19, static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS));
setIntRangeTweakOption(m_ui.tweakOptionTable, 20, static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE));
setIntRangeTweakOption(m_ui.tweakOptionTable, 21, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
setBooleanTweakOption(m_ui.tweakOptionTable, 22, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 23, true);
setBooleanTweakOption(m_ui.tweakOptionTable, 24, false);
}
setBooleanTweakOption(m_ui.tweakOptionTable, 25, false);
}

View file

@ -47,9 +47,6 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(QtHostInterface* host_inter
connect(m_ui.pgxpEnable, &QCheckBox::stateChanged, this, &EnhancementSettingsWidget::updatePGXPSettingsEnabled);
updatePGXPSettingsEnabled();
connect(m_ui.msaaMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&EnhancementSettingsWidget::msaaModeChanged);
dialog->registerWidgetHelp(
m_ui.disableInterlacing, tr("Disable Interlacing (force progressive render/scan)"), tr("Unchecked"),
tr(
@ -61,11 +58,6 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(QtHostInterface* host_inter
tr("Setting this beyond 1x will enhance the resolution of rendered 3D polygons and lines. Only applies "
"to the hardware backends. <br>This option is usually safe, with most games looking fine at "
"higher resolutions. Higher resolutions require a more powerful GPU."));
dialog->registerWidgetHelp(
m_ui.msaaMode, tr("Multisample Antialiasing"), tr("Disabled"),
tr("Uses multisample antialiasing for rendering 3D objects. Can smooth out jagged edges on polygons at a lower "
"cost to performance compared to increasing the resolution scale, but may be more likely to cause rendering "
"errors in some games. Only applies to the hardware backends."));
dialog->registerWidgetHelp(
m_ui.trueColor, tr("True Color Rendering (24-bit, disables dithering)"), tr("Unchecked"),
tr("Forces the precision of colours output to the console's framebuffer to use the full 8 bits of precision per "
@ -139,14 +131,6 @@ void EnhancementSettingsWidget::updateScaledDitheringEnabled()
void EnhancementSettingsWidget::setupAdditionalUi()
{
QtUtils::FillComboBoxWithResolutionScales(m_ui.resolutionScale);
QtUtils::FillComboBoxWithMSAAModes(m_ui.msaaMode);
const QVariant current_msaa_mode(
QtUtils::GetMSAAModeValue(static_cast<uint>(m_host_interface->GetIntSettingValue("GPU", "Multisamples", 1)),
m_host_interface->GetBoolSettingValue("GPU", "PerSampleShading", false)));
const int current_msaa_index = m_ui.msaaMode->findData(current_msaa_mode);
if (current_msaa_index >= 0)
m_ui.msaaMode->setCurrentIndex(current_msaa_index);
for (u32 i = 0; i < static_cast<u32>(GPUTextureFilter::Count); i++)
{
@ -164,13 +148,3 @@ void EnhancementSettingsWidget::updatePGXPSettingsEnabled()
m_ui.pgxpPreserveProjPrecision->setEnabled(enabled);
m_ui.pgxpCPU->setEnabled(enabled);
}
void EnhancementSettingsWidget::msaaModeChanged(int index)
{
uint multisamples;
bool ssaa;
QtUtils::DecodeMSAAModeValue(m_ui.msaaMode->itemData(index), &multisamples, &ssaa);
m_host_interface->SetIntSettingValue("GPU", "Multisamples", static_cast<int>(multisamples));
m_host_interface->SetBoolSettingValue("GPU", "PerSampleShading", ssaa);
m_host_interface->applySettings(false);
}

View file

@ -18,7 +18,6 @@ public:
private Q_SLOTS:
void updateScaledDitheringEnabled();
void updatePGXPSettingsEnabled();
void msaaModeChanged(int index);
private:
void setupAdditionalUi();

View file

@ -80,16 +80,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Multisample Antialiasing:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="msaaMode"/>
</item>
</layout>
</widget>
</item>