GS/HW: Make sure we don't multiply Cs if Ad is corrected.

Another potential to avoid copies.
This commit is contained in:
lightningterror 2024-02-24 22:26:55 +01:00
parent 71376ff4e6
commit 58628b8dd3
4 changed files with 4 additions and 4 deletions

View File

@ -930,7 +930,7 @@ void ps_blend(inout float4 Color, inout float4 As_rgba, float2 pos_xy)
Color.rgb = max((float3)0.0f, (Alpha - (float3)1.0f));
Color.rgb *= (float3)255.0f;
}
else if (PS_BLEND_HW == 3)
else if (PS_BLEND_HW == 3 && PS_RTA_CORRECTION == 0)
{
// Needed for Cs*Ad, Cs*Ad + Cd, Cd - Cs*Ad
// Multiply Color.rgb by (255/128) to compensate for wrong Ad/255 value when rgb are below 128.

View File

@ -910,7 +910,7 @@ float As = As_rgba.a;
Color.rgb = max(vec3(0.0f), (Alpha - vec3(1.0f)));
Color.rgb *= vec3(255.0f);
#elif PS_BLEND_HW == 3
#elif PS_BLEND_HW == 3 && PS_RTA_CORRECTION == 0
// Needed for Cs*Ad, Cs*Ad + Cd, Cd - Cs*Ad
// Multiply Color.rgb by (255/128) to compensate for wrong Ad/255 value when rgb are below 128.
// When any color channel is higher than 128 then adjust the compensation automatically

View File

@ -1163,7 +1163,7 @@ void ps_blend(inout vec4 Color, inout vec4 As_rgba)
Color.rgb = max(vec3(0.0f), (Alpha - vec3(1.0f)));
Color.rgb *= vec3(255.0f);
#elif PS_BLEND_HW == 3
#elif PS_BLEND_HW == 3 && PS_RTA_CORRECTION == 0
// Needed for Cs*Ad, Cs*Ad + Cd, Cd - Cs*Ad
// Multiply Color.rgb by (255/128) to compensate for wrong Ad/255 value when rgb are below 128.
// When any color channel is higher than 128 then adjust the compensation automatically

View File

@ -991,7 +991,7 @@ struct PSMain
float Alpha = PS_BLEND_C == 2 ? cb.alpha_fix : As;
Color.rgb = saturate(Alpha - 1.f) * 255.f;
}
else if (PS_BLEND_HW == 3)
else if (PS_BLEND_HW == 3 && PS_RTA_CORRECTION == 0)
{
// Needed for Cs*Ad, Cs*Ad + Cd, Cd - Cs*Ad
// Multiply Color.rgb by (255/128) to compensate for wrong Ad/255 value when rgb are below 128.