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.
This commit is contained in:
lightningterror 2022-01-27 08:16:58 +01:00
parent 3b691da8d1
commit bf2613ee49
1 changed files with 6 additions and 2 deletions

View File

@ -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: