Skip to content

Commit 5cb7abf

Browse files
GS/GL: Make sure we always insert a barrier when tex is rt/ds.
1 parent 7561f7e commit 5cb7abf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,10 +2726,14 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
27262726
// 2. Fullscreen sprite writes gray, rta hw blend blends based on dst alpha.
27272727
// On Nvidia, 2 seems to not pick up the data written by 1 unless we add a second barrier.
27282728
// Pretty sure GL is supposed to guarantee that the blend unit is coherent with previous pixel write out, so calling this a bug.
2729+
bool broken_blend_coherency_barrier = false;
27292730
if (m_bugs.broken_blend_coherency)
2730-
rt_hazard_barrier |= (psel.ps.IsFeedbackLoopRT() || psel.ps.blend_c == 1) && GLState::rt == config.rt;
2731+
broken_blend_coherency_barrier = (psel.ps.IsFeedbackLoopRT() || psel.ps.blend_c == 1) && GLState::rt == config.rt;
27312732
if (config.require_one_barrier || !m_features.texture_barrier)
2733+
{
27322734
rt_hazard_barrier = false; // Already in place or not available
2735+
broken_blend_coherency_barrier = false;
2736+
}
27332737

27342738
// additional non-pipeline config stuff
27352739
const bool point_size_enabled = config.vs.point_size;
@@ -2821,7 +2825,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
28212825
}
28222826

28232827
// Be careful of the rt already being bound and the blend using the RT without a barrier.
2824-
if (fb_optimization_needs_barrier && rt_hazard_barrier)
2828+
if ((fb_optimization_needs_barrier && broken_blend_coherency_barrier) || rt_hazard_barrier)
28252829
{
28262830
// Ensure all depth writes are finished before sampling
28272831
GL_INS("GL: Texture barrier to flush depth or rt before reading");

0 commit comments

Comments
 (0)