mirror of https://github.com/PCSX2/pcsx2.git
GS-metal: Add clr3 case for blend mix 2.
When Cs*(Alpha + 1) overflows compensate with adjusting Alpha output for Cd*Alpha.
This commit is contained in:
parent
a3ecf0b0bd
commit
af9353298c
|
@ -881,9 +881,8 @@ struct PSMain
|
|||
|
||||
if (PS_CLR_HW == 1)
|
||||
{
|
||||
// Replace Af with As so we can do proper compensation for Alpha.
|
||||
if (PS_BLEND_C == 2)
|
||||
As_rgba = float4(cb.alpha_fix);
|
||||
// As or Af
|
||||
As_rgba.rgb = float3(C);
|
||||
// Subtract 1 for alpha to compensate for the changed equation,
|
||||
// if c.rgb > 255.0f then we further need to adjust alpha accordingly,
|
||||
// we pick the lowest overflow from all colors because it's the safest,
|
||||
|
@ -902,6 +901,16 @@ struct PSMain
|
|||
float color_compensate = 1.f * (C + 1.f);
|
||||
Color.rgb -= float3(color_compensate);
|
||||
}
|
||||
else if (PS_CLR_HW == 3)
|
||||
{
|
||||
// As, Ad or Af clamped.
|
||||
As_rgba.rgb = float3(C_clamped);
|
||||
// Cs*(Alpha + 1) might overflow, if it does then adjust alpha value
|
||||
// that is sent on second output to compensate.
|
||||
float3 overflow_check = (Color.rgb - float3(255.f)) / 255.f;
|
||||
float3 alpha_compensate = max(float3(0.f), overflow_check);
|
||||
As_rgba.rgb -= alpha_compensate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue