Skip to content

Commit deb38ea

Browse files
GS: Move new Draw Buffering to a UI option
1 parent 78baa73 commit deb38ea

11 files changed

Lines changed: 43 additions & 1 deletion

pcsx2-qt/Settings/GraphicsHardwareFixesSettingsTab.ui

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,14 @@
270270
</widget>
271271
</item>
272272
<item row="7" column="0" colspan="2">
273-
<layout class="QGridLayout" name="hwFixesLayout">
273+
<layout class="QGridLayout" name="hwFixesLayout">
274+
<item row="4" column="1">
275+
<widget class="QCheckBox" name="drawBuffering">
276+
<property name="text">
277+
<string>Draw Buffering</string>
278+
</property>
279+
</widget>
280+
</item>
274281
<item row="4" column="0">
275282
<widget class="QCheckBox" name="estimateTextureRegion">
276283
<property name="text">

pcsx2-qt/Settings/GraphicsSettingsWidget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* settings_dialog,
152152
sif, m_fixes.limit24BitDepth, "EmuCore/GS", "UserHacks_Limit24BitDepth", static_cast<int>(GSLimit24BitDepth::Disabled));
153153
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_fixes.readTCOnClose, "EmuCore/GS", "UserHacks_ReadTCOnClose", false);
154154
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_fixes.estimateTextureRegion, "EmuCore/GS", "UserHacks_EstimateTextureRegion", false);
155+
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_fixes.drawBuffering, "EmuCore/GS", "UserHacks_DrawBuffering", false);
155156
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_fixes.gpuPaletteConversion, "EmuCore/GS", "paltex", false);
156157
connect(m_fixes.cpuSpriteRenderBW, &QComboBox::currentIndexChanged, this,
157158
&GraphicsSettingsWidget::onCPUSpriteRenderBWChanged);
@@ -610,6 +611,9 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* settings_dialog,
610611

611612
dialog()->registerWidgetHelp(m_fixes.estimateTextureRegion, tr("Estimate Texture Region"), tr("Unchecked"),
612613
tr("Attempts to reduce the texture size when games do not set it themselves (e.g. Snowblind games)."));
614+
615+
dialog()->registerWidgetHelp(m_fixes.drawBuffering, tr("Draw Buffering"), tr("Unchecked"),
616+
tr("Attempts to reduce draw calls in games which do heavy context switching for blending purposes."));
613617
}
614618

615619
// Upscaling Fixes tab

pcsx2/Config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ struct Pcsx2Config
804804
UserHacks_ForceEvenSpritePosition : 1,
805805
UserHacks_NativePaletteDraw : 1,
806806
UserHacks_EstimateTextureRegion : 1,
807+
UserHacks_DrawBuffering : 1,
807808
FXAA : 1,
808809
ShadeBoost : 1,
809810
DumpGSData : 1,

pcsx2/Docs/GameIndex.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ The clamp modes are also numerically based.
174174
* cpuSpriteRenderBW [Value between `0` to `10`] {Disabled, 1 (64), 2 (128), 3 (192), 4 (256), 5 (320), 6 (384), 7 (448), 8 (512), 9 (576), 10 (640)} Default: Off (`0`)
175175
* cpuSpriteRenderLevel [`0` or `1` or `2`] {Sprites only, Sprites/Triangles, Blended Sprites/Triangles} Default: Off unless cpuSpriteRenderBW has value other than Off then it is 'Sprites only' (`0`)
176176
* estimateTextureRegion [`0` or `1`] {Off, On} Default: Off (`0`)
177+
* drawBuffering [`0` or `1`] {Off, On} Default: Off (`0`)
177178
* getSkipCount {`GSC` with suffix } {None unless specific game GSC} Default: Disabled (`0`) unless valid variable name (ex. GSC_PolyphonyDigitalGames, GSC_UrbanReign, ...)
178179
* gpuPaletteConversion [`0` or `1`] {Off, On} Default: Off (`0`)
179180
* gpuTargetCLUT [`0` or `1` or `2`] {Disabled, Enabled (Exact Match), Enabled (Check Inside Target)} Default: Disabled (`0`)

pcsx2/Docs/gamedb-schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@
203203
"type": "integer",
204204
"minimum": 0,
205205
"maximum": 1
206+
},
207+
"drawBuffering": {
208+
"type": "integer",
209+
"minimum": 0,
210+
"maximum": 1
206211
},
207212
"PCRTCOffsets": {
208213
"type": "integer",

pcsx2/GS/GSState.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,9 @@ void GSState::PushBuffer()
512512

513513
bool GSState::CanBufferNewDraw()
514514
{
515+
if (!GSConfig.UserHacks_DrawBuffering)
516+
return false;
517+
515518
GSDrawingContext& cur_context = m_env.CTXT[m_env.PRIM.CTXT];
516519
GSDrawingContext& base_context = m_env_buffers[0].m_env.CTXT[m_env_buffers[0].m_env.PRIM.CTXT];
517520

@@ -5712,6 +5715,9 @@ __forceinline void GSState::HandleAutoFlush()
57125715

57135716
bool GSState::CheckOverlapVerts(u32 n)
57145717
{
5718+
if (!GSConfig.UserHacks_DrawBuffering)
5719+
return false;
5720+
57155721
if (m_recent_buffer_switch && ((m_vertex->tail + 1) - m_vertex->head) == n)
57165722
{
57175723
m_recent_buffer_switch = false;

pcsx2/GameDatabase.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ static const char* s_gs_hw_fix_names[] = {
375375
"bilinearUpscale",
376376
"nativePaletteDraw",
377377
"estimateTextureRegion",
378+
"drawBuffering",
378379
"PCRTCOffsets",
379380
"PCRTCOverscan",
380381
"trilinearFiltering",
@@ -617,6 +618,9 @@ bool GameDatabaseSchema::GameEntry::configMatchesHWFix(const Pcsx2Config::GSOpti
617618
case GSHWFixId::EstimateTextureRegion:
618619
return (static_cast<int>(config.UserHacks_EstimateTextureRegion) == value);
619620

621+
case GSHWFixId::DrawBuffering:
622+
return (static_cast<int>(config.UserHacks_DrawBuffering) == value);
623+
620624
case GSHWFixId::PCRTCOffsets:
621625
return (static_cast<int>(config.PCRTCOffsets) == value);
622626

@@ -783,6 +787,10 @@ void GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
783787
config.UserHacks_EstimateTextureRegion = (value > 0);
784788
break;
785789

790+
case GSHWFixId::DrawBuffering:
791+
config.UserHacks_DrawBuffering = (value > 0);
792+
break;
793+
786794
case GSHWFixId::PCRTCOffsets:
787795
config.PCRTCOffsets = (value > 0);
788796
break;

pcsx2/GameDatabase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace GameDatabaseSchema
6060
BilinearUpscale,
6161
NativePaletteDraw,
6262
EstimateTextureRegion,
63+
DrawBuffering,
6364
PCRTCOffsets,
6465
PCRTCOverscan,
6566

pcsx2/ImGui/ImGuiOverlays.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,8 @@ __ri void ImGuiManager::DrawSettingsOverlay(float scale, float margin, float spa
893893
APPEND("PLFD ");
894894
if (GSConfig.UserHacks_EstimateTextureRegion)
895895
APPEND("ETR ");
896+
if (GSConfig.UserHacks_DrawBuffering)
897+
APPEND("DRWB");
896898
if (GSConfig.HWSpinGPUForReadbacks)
897899
APPEND("RBSG ");
898900
if (GSConfig.HWSpinCPUForReadbacks)

pcsx2/Pcsx2Config.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
996996
SettingsWrapIntEnumEx(UserHacks_TextureInsideRt, "UserHacks_TextureInsideRt");
997997
SettingsWrapIntEnumEx(UserHacks_Limit24BitDepth, "UserHacks_Limit24BitDepth");
998998
SettingsWrapBitBoolEx(UserHacks_EstimateTextureRegion, "UserHacks_EstimateTextureRegion");
999+
SettingsWrapBitBoolEx(UserHacks_DrawBuffering, "UserHacks_DrawBuffering");
9991000
SettingsWrapBitBoolEx(FXAA, "fxaa");
10001001
SettingsWrapBitBool(ShadeBoost);
10011002
SettingsWrapBitBoolEx(DumpGSData, "DumpGSData");
@@ -1130,6 +1131,7 @@ void Pcsx2Config::GSOptions::MaskUserHacks()
11301131
UserHacks_TextureInsideRt = GSTextureInRtMode::Disabled;
11311132
UserHacks_Limit24BitDepth = GSLimit24BitDepth::Disabled;
11321133
UserHacks_EstimateTextureRegion = false;
1134+
UserHacks_DrawBuffering = false;
11331135
UserHacks_TCOffsetX = 0;
11341136
UserHacks_TCOffsetY = 0;
11351137
UserHacks_CPUSpriteRenderBW = 0;

0 commit comments

Comments
 (0)