Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 181 additions & 16 deletions pcsx2-qt/Settings/GraphicsDisplaySettingsTab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="cropLabel">
<item row="2" column="0">
<widget class="QLabel" name="fmvAspectRatioLabel">
<property name="text">
<string>Crop:</string>
<string>FMV Aspect Ratio Override:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="aspectRatioLabel">
<item row="8" column="0">
<widget class="QLabel" name="cropLabel">
<property name="text">
<string>Aspect Ratio:</string>
<string>Crop:</string>
</property>
<property name="buddy">
<cstring>aspectRatio</cstring>
Expand Down Expand Up @@ -277,16 +277,10 @@
</item>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="stretchY">
<property name="suffix">
<string extracomment="Percentage sign that shows next to a value. You might want to add a space before if your language requires it.">%</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>300</number>
<item row="5" column="0">
<widget class="QLabel" name="billinearLabel">
<property name="text">
<string>Bilinear Filtering:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -387,6 +381,177 @@
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="interlacingLabel">
<property name="text">
<string>Deinterlacing:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="fsModeLabel">
<property name="text">
<string>Fullscreen Mode:</string>
</property>
</widget>
</item>
<item row="10" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0" colspan="2">
<layout class="QGridLayout" name="displayGridLayout">
<item row="1" column="1">
<widget class="QCheckBox" name="integerScaling">
<property name="text">
<string>Integer Scaling</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="widescreenPatches">
<property name="text">
<string>Apply Widescreen Patches</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="noInterlacingPatches">
<property name="text">
<string>Apply No-Interlacing Patches</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="PCRTCAntiBlur">
<property name="text">
<string>Anti-Blur</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="DisableInterlaceOffset">
<property name="text">
<string>Disable Interlace Offset</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="PCRTCOffsets">
<property name="text">
<string>Screen Offsets</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="PCRTCOverscan">
<property name="text">
<string>Show Overscan</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="stretchY">
<property name="suffix">
<string extracomment="Percentage sign that shows next to a value. You might want to add a space before if your language requires it.">%</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="fullscreenModes"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="aspectRatio">
<item>
<property name="text">
<string>Fit to Window / Fullscreen</string>
</property>
</item>
<item>
<property name="text">
<string>Auto Standard (4:3 Interlaced / 3:2 Progressive)</string>
</property>
</item>
<item>
<property name="text">
<string>Standard (4:3)</string>
</property>
</item>
<item>
<property name="text">
<string>Widescreen (16:9)</string>
</property>
</item>
<item>
<property name="text">
<string>Native/Full (10:7)</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="verticalStretchLabel">
<property name="text">
<string>Vertical Stretch:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="aspectRatioLabel">
<property name="text">
<string>Aspect Ratio:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="AdaptiveDeinterlacingSensitivityLabel">
<property name="text">
<string>Adaptive Deinterlacing Sensitivity</string>
</property>
<property name="buddy">
<cstring>AdaptiveDeinterlacingSensitivity</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="AdaptiveDeinterlacingSensitivity">
<item>
<property name="text">
<string>Low</string>
</property>
</item>
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<tabstops>
Expand Down
6 changes: 6 additions & 0 deletions pcsx2-qt/Settings/GraphicsSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* settings_dialog,
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_display.fmvAspectRatio, "EmuCore/GS", "FMVAspectRatioSwitch",
Pcsx2Config::GSOptions::FMVAspectRatioSwitchNames, FMVAspectRatioSwitchType::Off);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_display.interlacing, "EmuCore/GS", "deinterlace_mode", DEFAULT_INTERLACE_MODE);
SettingWidgetBinder::BindWidgetToIntSetting(
sif, m_display.AdaptiveDeinterlacingSensitivity, "EmuCore/GS", "MADMode", static_cast<int>(GSMADMode::Default));
SettingWidgetBinder::BindWidgetToIntSetting(
sif, m_display.bilinearFiltering, "EmuCore/GS", "linear_present_mode", static_cast<int>(GSPostBilinearMode::BilinearSmooth));
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_display.widescreenPatches, "EmuCore", "EnableWideScreenPatches", false);
Expand Down Expand Up @@ -441,6 +443,10 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* settings_dialog,
dialog()->registerWidgetHelp(m_display.disableInterlaceOffset, tr("Disable Interlace Offset"), tr("Unchecked"),
tr("Disables interlacing offset which may reduce blurring in some situations."));

dialog()->registerWidgetHelp(m_display.AdaptiveDeinterlacingSensitivity, tr("Adaptive Deinterlacing Sensitivity"), tr("Default"),
tr("Changes the adaptive deinterlacing algorithm's sensitivity to recent, localized motion around pixels.<br>"
"Higher sensitivity makes the algorithm more responsive to changes in pixel color."));

dialog()->registerWidgetHelp(m_display.bilinearFiltering, tr("Bilinear Filtering"), tr("Bilinear (Smooth)"),
tr("Enables bilinear post processing filter. Smooths the overall picture as it is displayed on the screen. Corrects "
"positioning between pixels."));
Expand Down
8 changes: 8 additions & 0 deletions pcsx2/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,13 @@ enum class GSInterlaceMode : u8
Count
};

enum class GSMADMode : u8
{
Low,
Default,
High,
};

enum class GSPostBilinearMode : u8
{
Off,
Expand Down Expand Up @@ -801,6 +808,7 @@ struct Pcsx2Config
AspectRatioType AspectRatio = DEFAULT_ASPECT_RATIO;
FMVAspectRatioSwitchType FMVAspectRatioSwitch = FMVAspectRatioSwitchType::Off;
GSInterlaceMode InterlaceMode = DEFAULT_INTERLACE_MODE;
GSMADMode MADMode = GSMADMode::Default;
GSPostBilinearMode LinearPresent = GSPostBilinearMode::BilinearSmooth;

float StretchY = 100.0f;
Expand Down
32 changes: 24 additions & 8 deletions pcsx2/GS/Renderers/Common/GSDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
float offset = yoffset * static_cast<float>(field);
offset = GSConfig.DisableInterlaceOffset ? 0.0f : offset;

auto do_interlace = [this](GSTexture* sTex, GSTexture* dTex, ShaderInterlace shader, bool linear, float yoffset, int bufIdx) {
auto do_interlace = [this](GSTexture* sTex, GSTexture* dTex, ShaderInterlace shader, bool linear, float yoffset, int bufIdx, float sensitivity) {
const GSVector2i ds_i = dTex->GetSize();
const GSVector2 ds = GSVector2(static_cast<float>(ds_i.x), static_cast<float>(ds_i.y));

Expand All @@ -806,7 +806,7 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
}

const InterlaceConstantBuffer cb = {
GSVector4(static_cast<float>(bufIdx), 1.0f / ds.y, ds.y, MAD_SENSITIVITY)
GSVector4(static_cast<float>(bufIdx), 1.0f / ds.y, ds.y, sensitivity)
};

GL_PUSH("DoInterlace %dx%d Shader:%d Linear:%d", ds_i.x, ds_i.y, static_cast<int>(shader), linear);
Expand All @@ -817,33 +817,49 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
{
case 0: // Weave
ResizeRenderTarget(&m_weavebob, ds.x, ds.y, true, false);
do_interlace(m_merge, m_weavebob, ShaderInterlace::WEAVE, false, offset, field);
do_interlace(m_merge, m_weavebob, ShaderInterlace::WEAVE, false, offset, field, 0.0f);
m_current = m_weavebob;
break;
case 1: // Bob
// Field is reversed here as we are countering the bounce.
ResizeRenderTarget(&m_weavebob, ds.x, ds.y, true, false);
do_interlace(m_merge, m_weavebob, ShaderInterlace::BOB, true, yoffset * (1 - field), 0);
do_interlace(m_merge, m_weavebob, ShaderInterlace::BOB, true, yoffset * (1 - field), 0, 0.0f);
m_current = m_weavebob;
break;
case 2: // Blend
ResizeRenderTarget(&m_weavebob, ds.x, ds.y, true, false);
do_interlace(m_merge, m_weavebob, ShaderInterlace::WEAVE, false, offset, field);
do_interlace(m_merge, m_weavebob, ShaderInterlace::WEAVE, false, offset, field, 0.0f);
ResizeRenderTarget(&m_blend, ds.x, ds.y, true, false);
do_interlace(m_weavebob, m_blend, ShaderInterlace::BLEND, false, 0, 0);
do_interlace(m_weavebob, m_blend, ShaderInterlace::BLEND, false, 0, 0, 0.0f);
m_current = m_blend;
break;
case 3: // FastMAD Motion Adaptive Deinterlacing
{
float sensitivity = DEFAULT_MAD_SENSITIVITY;

switch (GSConfig.MADMode)
{
case GSMADMode::Low:
sensitivity = LOW_MAD_SENSITIVITY;
break;
case GSMADMode::High:
sensitivity = HIGH_MAD_SENSITIVITY;
break;
default:
break;
}

bufIdx++;
bufIdx &= ~1;
bufIdx |= field;
bufIdx &= 3;
ResizeRenderTarget(&m_mad, ds.x, ds.y * 2.0f, true, false);
do_interlace(m_merge, m_mad, ShaderInterlace::MAD_BUFFER, false, offset, bufIdx);
do_interlace(m_merge, m_mad, ShaderInterlace::MAD_BUFFER, false, offset, bufIdx, sensitivity);
ResizeRenderTarget(&m_weavebob, ds.x, ds.y, true, false);
do_interlace(m_mad, m_weavebob, ShaderInterlace::MAD_RECONSTRUCT, false, 0, bufIdx);
do_interlace(m_mad, m_weavebob, ShaderInterlace::MAD_RECONSTRUCT, false, 0, bufIdx, sensitivity);
m_current = m_weavebob;
break;
}
default:
m_current = m_merge;
break;
Expand Down
4 changes: 3 additions & 1 deletion pcsx2/GS/Renderers/Common/GSDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,9 @@ class GSDevice : public GSAlignedClass<32>

protected:
static constexpr int NUM_INTERLACE_SHADERS = 5;
static constexpr float MAD_SENSITIVITY = 0.08f;
static constexpr float LOW_MAD_SENSITIVITY = 0.08f;
static constexpr float DEFAULT_MAD_SENSITIVITY = 0.02f;
static constexpr float HIGH_MAD_SENSITIVITY = 0.0035f;
static constexpr u32 MAX_POOLED_TARGETS = 300;
static constexpr u32 MAX_TARGET_AGE = 20;
static constexpr u32 MAX_POOLED_TEXTURES = 300;
Expand Down
Loading