mirror of https://github.com/PCSX2/pcsx2.git
GS-hw: Cleanup BLEND_C_CLR blend flags.
Rename BLEND_C_CLR to BLEND_HW_CLR. Merge CLR2_AF and CLR2_AS to CLR2, don't need to be separate as we rely on PS_BLEND_C in shader.
This commit is contained in:
parent
ab17c3693f
commit
674b13fb3f
|
@ -596,8 +596,8 @@ const std::array<HWBlend, 3*3*3*3> GSDevice::m_blendMap =
|
|||
{ BLEND_ACCU , OP_ADD , SRC1_ALPHA , CONST_ONE} , //?0201: (Cs - 0)*As + Cd ==> Cs*As + Cd
|
||||
{ BLEND_NO_REC , OP_ADD , SRC1_ALPHA , CONST_ZERO} , // 0202: (Cs - 0)*As + 0 ==> Cs*As
|
||||
{ BLEND_A_MAX , OP_ADD , CONST_ONE , CONST_ZERO} , //*0210: (Cs - 0)*Ad + Cs ==> Cs*(Ad + 1)
|
||||
{ BLEND_C_CLR3 , OP_ADD , DST_ALPHA , CONST_ONE} , // 0211: (Cs - 0)*Ad + Cd ==> Cs*Ad + Cd
|
||||
{ BLEND_C_CLR3 , OP_ADD , DST_ALPHA , CONST_ZERO} , // 0212: (Cs - 0)*Ad + 0 ==> Cs*Ad
|
||||
{ BLEND_HW_CLR3 , OP_ADD , DST_ALPHA , CONST_ONE} , // 0211: (Cs - 0)*Ad + Cd ==> Cs*Ad + Cd
|
||||
{ BLEND_HW_CLR3 , OP_ADD , DST_ALPHA , CONST_ZERO} , // 0212: (Cs - 0)*Ad + 0 ==> Cs*Ad
|
||||
{ BLEND_NO_REC | BLEND_A_MAX , OP_ADD , CONST_ONE , CONST_ZERO} , //*0220: (Cs - 0)*F + Cs ==> Cs*(F + 1)
|
||||
{ BLEND_ACCU , OP_ADD , CONST_COLOR , CONST_ONE} , //?0221: (Cs - 0)*F + Cd ==> Cs*F + Cd
|
||||
{ BLEND_NO_REC , OP_ADD , CONST_COLOR , CONST_ZERO} , // 0222: (Cs - 0)*F + 0 ==> Cs*F
|
||||
|
@ -620,19 +620,19 @@ const std::array<HWBlend, 3*3*3*3> GSDevice::m_blendMap =
|
|||
{ BLEND_CD , OP_ADD , CONST_ZERO , CONST_ONE} , // 1121: (Cd - Cd)*F + Cd ==> Cd
|
||||
{ BLEND_NO_REC , OP_ADD , CONST_ZERO , CONST_ZERO} , // 1122: (Cd - Cd)*F + 0 ==> 0
|
||||
{ 0 , OP_ADD , CONST_ONE , SRC1_ALPHA} , // 1200: (Cd - 0)*As + Cs ==> Cs + Cd*As
|
||||
{ BLEND_C_CLR1 , OP_ADD , DST_COLOR , SRC1_ALPHA} , //#1201: (Cd - 0)*As + Cd ==> Cd*(1 + As)
|
||||
{ BLEND_C_CLR2_AS , OP_ADD , DST_COLOR , SRC1_ALPHA} , // 1202: (Cd - 0)*As + 0 ==> Cd*As
|
||||
{ BLEND_HW_CLR1 , OP_ADD , DST_COLOR , SRC1_ALPHA} , //#1201: (Cd - 0)*As + Cd ==> Cd*(1 + As)
|
||||
{ BLEND_HW_CLR2 , OP_ADD , DST_COLOR , SRC1_ALPHA} , // 1202: (Cd - 0)*As + 0 ==> Cd*As
|
||||
{ 0 , OP_ADD , CONST_ONE , DST_ALPHA} , // 1210: (Cd - 0)*Ad + Cs ==> Cs + Cd*Ad
|
||||
{ BLEND_C_CLR1 , OP_ADD , DST_COLOR , DST_ALPHA} , //#1211: (Cd - 0)*Ad + Cd ==> Cd*(1 + Ad)
|
||||
{ BLEND_HW_CLR1 , OP_ADD , DST_COLOR , DST_ALPHA} , //#1211: (Cd - 0)*Ad + Cd ==> Cd*(1 + Ad)
|
||||
{ 0 , OP_ADD , CONST_ZERO , DST_ALPHA} , // 1212: (Cd - 0)*Ad + 0 ==> Cd*Ad
|
||||
{ 0 , OP_ADD , CONST_ONE , CONST_COLOR} , // 1220: (Cd - 0)*F + Cs ==> Cs + Cd*F
|
||||
{ BLEND_C_CLR1 , OP_ADD , DST_COLOR , CONST_COLOR} , //#1221: (Cd - 0)*F + Cd ==> Cd*(1 + F)
|
||||
{ BLEND_C_CLR2_AF , OP_ADD , DST_COLOR , CONST_COLOR} , // 1222: (Cd - 0)*F + 0 ==> Cd*F
|
||||
{ BLEND_HW_CLR1 , OP_ADD , DST_COLOR , CONST_COLOR} , //#1221: (Cd - 0)*F + Cd ==> Cd*(1 + F)
|
||||
{ BLEND_HW_CLR2 , OP_ADD , DST_COLOR , CONST_COLOR} , // 1222: (Cd - 0)*F + 0 ==> Cd*F
|
||||
{ BLEND_NO_REC , OP_ADD , INV_SRC1_ALPHA , CONST_ZERO} , // 2000: (0 - Cs)*As + Cs ==> Cs*(1 - As)
|
||||
{ BLEND_ACCU , OP_REV_SUBTRACT , SRC1_ALPHA , CONST_ONE} , //?2001: (0 - Cs)*As + Cd ==> Cd - Cs*As
|
||||
{ BLEND_NO_REC , OP_REV_SUBTRACT , SRC1_ALPHA , CONST_ZERO} , // 2002: (0 - Cs)*As + 0 ==> 0 - Cs*As
|
||||
{ 0 , OP_ADD , INV_DST_ALPHA , CONST_ZERO} , // 2010: (0 - Cs)*Ad + Cs ==> Cs*(1 - Ad)
|
||||
{ BLEND_C_CLR3 , OP_REV_SUBTRACT , DST_ALPHA , CONST_ONE} , // 2011: (0 - Cs)*Ad + Cd ==> Cd - Cs*Ad
|
||||
{ BLEND_HW_CLR3 , OP_REV_SUBTRACT , DST_ALPHA , CONST_ONE} , // 2011: (0 - Cs)*Ad + Cd ==> Cd - Cs*Ad
|
||||
{ 0 , OP_REV_SUBTRACT , DST_ALPHA , CONST_ZERO} , // 2012: (0 - Cs)*Ad + 0 ==> 0 - Cs*Ad
|
||||
{ BLEND_NO_REC , OP_ADD , INV_CONST_COLOR , CONST_ZERO} , // 2020: (0 - Cs)*F + Cs ==> Cs*(1 - F)
|
||||
{ BLEND_ACCU , OP_REV_SUBTRACT , CONST_COLOR , CONST_ONE} , //?2021: (0 - Cs)*F + Cd ==> Cd - Cs*F
|
||||
|
|
|
@ -198,18 +198,17 @@ public:
|
|||
|
||||
enum HWBlendFlags
|
||||
{
|
||||
// A couple of flag to determine the blending behavior
|
||||
BLEND_CD = 0x1, // Output is Cd, hw blend can handle it
|
||||
BLEND_C_CLR1 = 0x2, // Clear color blending (use directly the destination color as blending factor)
|
||||
BLEND_C_CLR2_AF = 0x4, // Clear color blending (use directly the destination color as blending factor)
|
||||
BLEND_C_CLR2_AS = 0x8, // Clear color blending (use directly the destination color as blending factor)
|
||||
BLEND_C_CLR3 = 0x10, // Multiply Cs by (255/128) to compensate for wrong Ad/255 value, should be Ad/128
|
||||
BLEND_MIX1 = 0x20, // Mix of hw and sw, do Cs*F or Cs*As in shader
|
||||
BLEND_MIX2 = 0x40, // Mix of hw and sw, do Cs*(As + 1) or Cs*(F + 1) in shader
|
||||
BLEND_MIX3 = 0x80, // Mix of hw and sw, do Cs*(1 - As) or Cs*(1 - F) in shader
|
||||
BLEND_ACCU = 0x100, // Allow to use a mix of SW and HW blending to keep the best of the 2 worlds
|
||||
BLEND_NO_REC = 0x200, // Doesn't require sampling of the RT as a texture
|
||||
BLEND_A_MAX = 0x400, // Impossible blending uses coeff bigger than 1
|
||||
// Flags to determine blending behavior
|
||||
BLEND_CD = 0x1, // Output is Cd, hw blend can handle it
|
||||
BLEND_HW_CLR1 = 0x2, // Clear color blending (use directly the destination color as blending factor)
|
||||
BLEND_HW_CLR2 = 0x4, // Clear color blending (use directly the destination color as blending factor)
|
||||
BLEND_HW_CLR3 = 0x8, // Multiply Cs by (255/128) to compensate for wrong Ad/255 value, should be Ad/128
|
||||
BLEND_MIX1 = 0x10, // Mix of hw and sw, do Cs*F or Cs*As in shader
|
||||
BLEND_MIX2 = 0x20, // Mix of hw and sw, do Cs*(As + 1) or Cs*(F + 1) in shader
|
||||
BLEND_MIX3 = 0x40, // Mix of hw and sw, do Cs*(1 - As) or Cs*(1 - F) in shader
|
||||
BLEND_ACCU = 0x80, // Allow to use a mix of SW and HW blending to keep the best of the 2 worlds
|
||||
BLEND_NO_REC = 0x100, // Doesn't require sampling of the RT as a texture
|
||||
BLEND_A_MAX = 0x200, // Impossible blending uses coeff bigger than 1
|
||||
};
|
||||
|
||||
// Determines the HW blend function for DX11/OGL
|
||||
|
|
|
@ -2803,10 +2803,10 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
|
|||
const bool one_barrier = m_conf.require_one_barrier || blend_ad_alpha_masked;
|
||||
|
||||
// Blend can be done on hw. As and F cases should be accurate.
|
||||
// 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));
|
||||
bool clr_blend1_2 = (blend_flag & (BLEND_C_CLR1 | BLEND_C_CLR2_AF | BLEND_C_CLR2_AS)) && (m_conf.ps.blend_c != 1) // Make sure it isn't an Ad case
|
||||
// BLEND_HW_CLR1 with Ad, BLEND_HW_CLR3 Cs > 0.5f will require sw blend.
|
||||
// BLEND_HW_CLR1 with As/F and BLEND_HW_CLR2 can be done in hw.
|
||||
const bool clr_blend = !!(blend_flag & (BLEND_HW_CLR1 | BLEND_HW_CLR2 | BLEND_HW_CLR3));
|
||||
bool clr_blend1_2 = (blend_flag & (BLEND_HW_CLR1 | BLEND_HW_CLR2)) && (m_conf.ps.blend_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.
|
||||
&& !(one_barrier || m_conf.require_full_barrier); // Also don't run if there are barriers present.
|
||||
|
@ -3195,14 +3195,14 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
|
|||
m_conf.ps.blend_d = 0;
|
||||
|
||||
// Care for hw blend value, 6 is for hw/sw, sw blending used.
|
||||
if (blend_flag & BLEND_C_CLR1)
|
||||
if (blend_flag & BLEND_HW_CLR1)
|
||||
{
|
||||
if (blend_ad_alpha_masked)
|
||||
m_conf.ps.blend_hw = 5;
|
||||
else
|
||||
m_conf.ps.blend_hw = 1;
|
||||
}
|
||||
else if (blend_flag & (BLEND_C_CLR2_AS | BLEND_C_CLR2_AF))
|
||||
else if (blend_flag & (BLEND_HW_CLR2))
|
||||
{
|
||||
if (blend_ad_alpha_masked)
|
||||
{
|
||||
|
@ -3216,7 +3216,7 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
|
|||
m_conf.ps.blend_hw = 2;
|
||||
}
|
||||
}
|
||||
else if (blend_flag & BLEND_C_CLR3)
|
||||
else if (blend_flag & BLEND_HW_CLR3)
|
||||
{
|
||||
m_conf.ps.blend_hw = 3;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue