GS-hw: Enable pabe bit only when sw blending is enabled.

Minor optimization.
This commit is contained in:
lightningterror 2021-07-04 02:33:00 +02:00
parent c77e0a3a56
commit 1630805fd8
2 changed files with 31 additions and 23 deletions

View File

@ -453,22 +453,6 @@ void GSRendererDX11::EmulateBlending()
return;
m_om_bsel.abe = 1;
if (m_env.PABE.PABE)
{
if (ALPHA.A == 0 && ALPHA.B == 1 && ALPHA.C == 0 && ALPHA.D == 1)
{
// this works because with PABE alpha blending is on when alpha >= 0x80, but since the pixel shader
// cannot output anything over 0x80 (== 1.0) blending with 0x80 or turning it off gives the same result
m_om_bsel.abe = 0;
}
// Breath of Fire Dragon Quarter, Strawberry Shortcake, Super Robot Wars, Cartoon Network Racing.
// fprintf(stderr, "%d: PABE mode ENABLED\n", s_n);
m_ps_sel.pabe = 1;
}
m_om_bsel.blend_index = uint8(((ALPHA.A * 3 + ALPHA.B) * 3 + ALPHA.C) * 3 + ALPHA.D);
const int blend_flag = m_dev->GetBlendFlags(m_om_bsel.blend_index);
@ -513,6 +497,25 @@ void GSRendererDX11::EmulateBlending()
}
}
// Per pixel alpha blending
if (m_env.PABE.PABE)
{
// Breath of Fire Dragon Quarter, Strawberry Shortcake, Super Robot Wars, Cartoon Network Racing.
if (ALPHA.A == 0 && ALPHA.B == 1 && ALPHA.C == 0 && ALPHA.D == 1)
{
// this works because with PABE alpha blending is on when alpha >= 0x80, but since the pixel shader
// cannot output anything over 0x80 (== 1.0) blending with 0x80 or turning it off gives the same result
m_om_bsel.abe = 0;
}
if (sw_blending)
{
// fprintf(stderr, "%d: PABE mode ENABLED\n", s_n);
m_ps_sel.pabe = 1;
}
}
/*fprintf(stderr, "%d: BLEND_INFO: %d/%d/%d/%d. Clamp:%d. Prim:%d number %d (sw %d)\n",
s_n, ALPHA.A, ALPHA.B, ALPHA.C, ALPHA.D, m_env.COLCLAMP.CLAMP, m_vt.m_primclass, m_vertex.next, sw_blending);*/

View File

@ -474,13 +474,6 @@ void GSRendererOGL::EmulateBlending(bool& DATE_GL42, bool& DATE_GL45)
return;
}
if (m_env.PABE.PABE)
{
// Breath of Fire Dragon Quarter, Strawberry Shortcake, Super Robot Wars, Cartoon Network Racing.
GL_INS("PABE mode ENABLED");
m_ps_sel.pabe = 1;
}
// Compute the blending equation to detect special case
const uint8 blend_index = uint8(((ALPHA.A * 3 + ALPHA.B) * 3 + ALPHA.C) * 3 + ALPHA.D);
const int blend_flag = m_dev->GetBlendFlags(blend_index);
@ -561,6 +554,18 @@ void GSRendererOGL::EmulateBlending(bool& DATE_GL42, bool& DATE_GL45)
}
}
// Per pixel alpha blending
if (m_env.PABE.PABE)
{
// Breath of Fire Dragon Quarter, Strawberry Shortcake, Super Robot Wars, Cartoon Network Racing.
if (sw_blending)
{
GL_INS("PABE mode ENABLED");
m_ps_sel.pabe = 1;
}
}
// 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).