From 816ee9e54503de0723b46e3d07d45ea2ff7eaa4c Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 18 Feb 2022 15:35:55 +0100 Subject: [PATCH] GS-hw: Prefer sw blend for clr_blend1_2 on ultra blending. Opengl/Vulkan: Prefer sw blend over hw for clr_blend1_2 on ultra blending, doing hw is less accurate and will introduce rounding issues. Direct3D11: Prefer sw blend over hw for clr_blend1_2 only when primitives don't overlap. --- pcsx2/GS/Renderers/HW/GSRendererNew.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp index 3d6e4d6be8..f6cf244690 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp @@ -579,7 +579,7 @@ void GSRendererNew::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER) // BLEND_C_CLR1 with Ad, BLEND_C_CLR3 Cs > 0.5f will require sw blend. // BLEND_C_CLR1 with As/F, BLEND_C_CLR2_AF, BLEND_C_CLR2_AS can be done in hw. const bool clr_blend = !!(blend_flag & (BLEND_C_CLR1 | BLEND_C_CLR2_AF | BLEND_C_CLR2_AS | BLEND_C_CLR3)); - const bool clr_blend1_2 = (blend_flag & (BLEND_C_CLR1 | BLEND_C_CLR2_AF | BLEND_C_CLR2_AS)) + bool clr_blend1_2 = (blend_flag & (BLEND_C_CLR1 | BLEND_C_CLR2_AF | BLEND_C_CLR2_AS)) && (ALPHA.C != 1) // Make sure it isn't an Ad case && !m_env.PABE.PABE // No PABE as it will require sw blending. && (m_env.COLCLAMP.CLAMP) // Let's add a colclamp check too, hw blend will clamp to 0-1. @@ -604,6 +604,7 @@ void GSRendererNew::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER) switch (GSConfig.AccurateBlendingUnit) { case AccBlendLevel::Ultra: + clr_blend1_2 = false; sw_blending |= true; [[fallthrough]]; case AccBlendLevel::Full: @@ -644,7 +645,11 @@ void GSRendererNew::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER) switch (GSConfig.AccurateBlendingUnit) { case AccBlendLevel::Ultra: - sw_blending |= (m_prim_overlap == PRIM_OVERLAP_NO); + if (m_prim_overlap == PRIM_OVERLAP_NO) + { + clr_blend1_2 = false; + sw_blending |= true; + } [[fallthrough]]; case AccBlendLevel::Full: sw_blending |= ((ALPHA.C == 1 || (blend_mix && (alpha_c2_high_one || alpha_c0_high_max_one))) && (m_prim_overlap == PRIM_OVERLAP_NO));