From 73df4e4abf7628d32e9b4a8947b0ce323ff551fd Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 30 Dec 2021 15:26:44 +1000 Subject: [PATCH] GS: Only swap DATE_GL42 with DATE_GL45 when full barriers are used Saves the expensive draw splitting/barriers when mixed software blending is used. --- pcsx2/GS/Renderers/HW/GSRendererNew.cpp | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp index a5fbdf0688..0e0180f8b5 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp @@ -661,20 +661,6 @@ void GSRendererNew::EmulateBlending(bool& DATE_GL42, bool& DATE_GL45) } } - // GL42 interact very badly with sw blending. GL42 uses the primitiveID to find the primitive - // that write the bad alpha value. Sw blending will force the draw to run primitive by primitive - // (therefore primitiveID will be constant to 1). - // Switch DATE_GL42 with DATE_GL45 in such cases to ensure accuracy. - // No mix of COLCLIP + sw blend + DATE_GL42, neither sw fbmask + DATE_GL42. - // Note: Do the swap after colclip to avoid adding extra conditions. - if (sw_blending && DATE_GL42) - { - GL_PERF("DATE: Swap DATE_GL42 with DATE_GL45"); - m_conf.require_full_barrier = true; - DATE_GL42 = false; - DATE_GL45 = true; - } - // For stat to optimize accurate option #if 0 GL_INS("BLEND_INFO: %d/%d/%d/%d. Clamp:%d. Prim:%d number %d (drawlist %d) (sw %d)", @@ -758,6 +744,20 @@ void GSRendererNew::EmulateBlending(bool& DATE_GL42, bool& DATE_GL45) m_conf.blend = {blend_index, ALPHA.FIX, ALPHA.C == 2, false, false}; } } + + // GL42 interact very badly with sw blending. GL42 uses the primitiveID to find the primitive + // that write the bad alpha value. Sw blending will force the draw to run primitive by primitive + // (therefore primitiveID will be constant to 1). + // Switch DATE_GL42 with DATE_GL45 in such cases to ensure accuracy. + // No mix of COLCLIP + sw blend + DATE_GL42, neither sw fbmask + DATE_GL42. + // Note: Do the swap in the end, saves the expensive draw splitting/barriers when mixed software blending is used. + if (sw_blending && DATE_GL42 && m_conf.require_full_barrier) + { + GL_PERF("DATE: Swap DATE_GL42 with DATE_GL45"); + m_conf.require_full_barrier = true; + DATE_GL42 = false; + DATE_GL45 = true; + } } void GSRendererNew::EmulateTextureSampler(const GSTextureCache::Source* tex)