From bf2613ee498ce84ac26448f6d98f90affb057fe4 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Thu, 27 Jan 2022 08:16:58 +0100 Subject: [PATCH] GS-hw: Adjust how clr_blend is handled based on blend level on d3d11. Blend level High and lower: Prefer clr_blend. Blend level Full, prefer clr_blend when ALPHA.C != 1, otherwise sw when primitives don't overlap. Blend level Ultra, remains the same but we can probably prefer clr_blend when alpha again is As or F, let's play it safe and leave it as it is for now. --- pcsx2/GS/Renderers/HW/GSRendererNew.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp index deac1fac8d..9cfc263dcd 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp @@ -588,6 +588,10 @@ void GSRendererNew::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER) } else { + // Blend can be done on hw. As and F cases should be accurate. + // BLEND_C_CLR1 with Ad, BLEND_C_CLR4 Cs > 0.5f will require sw blend. + // BLEND_C_CLR1 with As/F, BLEND_C_CLR2_AF, BLEND_C_CLR3_AS can be done in hw. + const bool clr_blend = !!(blend_flag & (BLEND_C_CLR1 | BLEND_C_CLR2_AF | BLEND_C_CLR3_AS | BLEND_C_CLR4)); // Exclude triangles, breaks mgs3 on ultra blending. const bool no_overlap_no_triangles = (m_prim_overlap == PRIM_OVERLAP_NO) && (m_vt.m_primclass != GS_TRIANGLE_CLASS); // FBMASK already reads the fb so it is safe to enable sw blend when there is no overlap. @@ -599,10 +603,10 @@ void GSRendererNew::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER) sw_blending |= no_overlap_no_triangles; [[fallthrough]]; case AccBlendLevel::Full: - sw_blending |= (blend_mix && (alpha_c2_high_one || alpha_c0_high_max_one) && no_overlap_no_triangles); + sw_blending |= ((ALPHA.C == 1 || (blend_mix && (alpha_c2_high_one || alpha_c0_high_max_one))) && no_overlap_no_triangles); [[fallthrough]]; case AccBlendLevel::High: - sw_blending |= (!blend_mix && no_overlap_no_triangles); + sw_blending |= (!(clr_blend || blend_mix) && no_overlap_no_triangles); [[fallthrough]]; case AccBlendLevel::Medium: case AccBlendLevel::Basic: