GPU: Make perspective-correct color interpolation toggleable

This commit is contained in:
Connor McLaughlin
2022-10-03 20:03:30 +10:00
parent 6af5a2486c
commit 971bba07d6
20 changed files with 145 additions and 80 deletions

View File

@ -16,14 +16,10 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.resolutionScale, "GPU", "ResolutionScale", 1);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.trueColor, "GPU", "TrueColor", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.scaledDithering, "GPU", "ScaledDithering", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.disableInterlacing, "GPU", "DisableInterlacing",
true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.forceNTSCTimings, "GPU", "ForceNTSCTimings",
false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.force43For24Bit, "Display", "Force4_3For24Bit",
false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chromaSmoothingFor24Bit, "GPU",
"ChromaSmoothing24Bit", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.disableInterlacing, "GPU", "DisableInterlacing", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.forceNTSCTimings, "GPU", "ForceNTSCTimings", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.force43For24Bit, "Display", "Force4_3For24Bit", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chromaSmoothingFor24Bit, "GPU", "ChromaSmoothing24Bit", false);
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.textureFiltering, "GPU", "TextureFilter",
&Settings::ParseTextureFilterName, &Settings::GetTextureFilterName,
Settings::DEFAULT_GPU_TEXTURE_FILTER);
@ -33,11 +29,10 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpEnable, "GPU", "PGXPEnable", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpCulling, "GPU", "PGXPCulling", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpTextureCorrection, "GPU",
"PGXPTextureCorrection", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpTextureCorrection, "GPU", "PGXPTextureCorrection", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpColorCorrection, "GPU", "PGXPColorCorrection", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpDepthBuffer, "GPU", "PGXPDepthBuffer", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpPreserveProjPrecision, "GPU",
"PGXPPreserveProjFP", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpPreserveProjPrecision, "GPU", "PGXPPreserveProjFP", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpCPU, "GPU", "PGXPCPU", false);
connect(m_ui.resolutionScale, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
@ -46,6 +41,7 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi
updateScaledDitheringEnabled();
connect(m_ui.pgxpEnable, &QCheckBox::stateChanged, this, &EnhancementSettingsWidget::updatePGXPSettingsEnabled);
connect(m_ui.pgxpTextureCorrection, &QCheckBox::stateChanged, this, &EnhancementSettingsWidget::updatePGXPSettingsEnabled);
updatePGXPSettingsEnabled();
dialog->registerWidgetHelp(
@ -86,7 +82,8 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi
m_ui.textureFiltering, tr("Texture Filtering"),
qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(GPUTextureFilter::Nearest)),
tr("Smooths out the blockiness of magnified textures on 3D object by using filtering. <br>Will have a "
"greater effect on higher resolution scales. Only applies to the hardware renderers. <br>The JINC2 and especially xBR filtering modes are very demanding, and may not be worth the speed penalty."));
"greater effect on higher resolution scales. Only applies to the hardware renderers. <br>The JINC2 and "
"especially xBR filtering modes are very demanding, and may not be worth the speed penalty."));
dialog->registerWidgetHelp(
m_ui.widescreenHack, tr("Widescreen Hack"), tr("Unchecked"),
tr("Scales vertex positions in screen-space to a widescreen aspect ratio, essentially "
@ -104,9 +101,13 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi
dialog->registerWidgetHelp(m_ui.pgxpCulling, tr("Culling Correction"), tr("Checked"),
tr("Increases the precision of polygon culling, reducing the number of holes in geometry. "
"Requires geometry correction enabled."));
dialog->registerWidgetHelp(m_ui.pgxpTextureCorrection, tr("Texture Correction"), tr("Checked"),
tr("Uses perspective-correct interpolation for texture coordinates and colors, "
"straightening out warped textures. Requires geometry correction enabled."));
dialog->registerWidgetHelp(m_ui.pgxpTextureCorrection, tr("Perspective Correct Textures"), tr("Checked"),
tr("Uses perspective-correct interpolation for texture coordinates, straightening out "
"warped textures. Requires geometry correction enabled."));
dialog->registerWidgetHelp(
m_ui.pgxpColorCorrection, tr("Perspective Correct Colors"), tr("Unchecked"),
tr("Uses perspective-correct interpolation for vertex colors, which can improve visuals in some games, but cause "
"rendering errors in others. Requires geometry correction enabled."));
dialog->registerWidgetHelp(
m_ui.pgxpDepthBuffer, tr("Depth Buffer (Low Compatibility)"), tr("Unchecked"),
tr("Attempts to reduce polygon Z-fighting by testing pixels against the depth values from PGXP. Low compatibility, "
@ -142,9 +143,11 @@ void EnhancementSettingsWidget::setupAdditionalUi()
void EnhancementSettingsWidget::updatePGXPSettingsEnabled()
{
const bool enabled = m_ui.pgxpEnable->isChecked();
const bool enabled = m_dialog->getEffectiveBoolValue("GPU", "PGXPEnable", false);
const bool tc_enabled = enabled && m_dialog->getEffectiveBoolValue("GPU", "PGXPTextureCorrection", true);
m_ui.pgxpCulling->setEnabled(enabled);
m_ui.pgxpTextureCorrection->setEnabled(enabled);
m_ui.pgxpColorCorrection->setEnabled(tc_enabled);
m_ui.pgxpDepthBuffer->setEnabled(enabled);
m_ui.pgxpPreserveProjPrecision->setEnabled(enabled);
m_ui.pgxpCPU->setEnabled(enabled);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>448</width>
<height>720</height>
<height>516</height>
</rect>
</property>
<property name="windowTitle">
@ -76,7 +76,7 @@
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="useSoftwareRendererForReadbacks">
<property name="text">
<string>Software Renderer Readbacks (run in parallel for VRAM->CPU transfers)</string>
<string>Software Renderer Readbacks (run in parallel for VRAM-&gt;CPU transfers)</string>
</property>
</widget>
</item>
@ -126,13 +126,6 @@
<string>PGXP (Precision Geometry Transform Pipeline)</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="pgxpEnable">
<property name="text">
<string>Geometry Correction</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="pgxpCulling">
<property name="text">
@ -143,28 +136,42 @@
<item row="1" column="0">
<widget class="QCheckBox" name="pgxpTextureCorrection">
<property name="text">
<string>Texture Correction</string>
<string>Perspective Correct Textures</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="pgxpPreserveProjPrecision">
<item row="0" column="0">
<widget class="QCheckBox" name="pgxpEnable">
<property name="text">
<string>Preserve Projection Precision</string>
<string>Geometry Correction</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QCheckBox" name="pgxpCPU">
<property name="text">
<string>CPU Mode (Very Slow)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="pgxpDepthBuffer">
<property name="text">
<string>Depth Buffer (Low Compatibility)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="pgxpCPU">
<item row="2" column="0">
<widget class="QCheckBox" name="pgxpPreserveProjPrecision">
<property name="text">
<string>CPU Mode (Very Slow)</string>
<string>Preserve Projection Precision</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="pgxpColorCorrection">
<property name="text">
<string>Perspective Correct Colors</string>
</property>
</widget>
</item>