GS: Compute luminance in shader for FXAA

Fixes FXAA being broken after b706c25b68.

Will be slightly difference since this is using the BT.709 coefficients
instead of CCIR 601 - but it matches the non-gather codepath now.
This commit is contained in:
Connor McLaughlin 2022-12-12 13:10:02 +10:00 committed by refractionpcsx2
parent 5c952fbbd6
commit 066cf42338
1 changed files with 8 additions and 5 deletions

View File

@ -55,19 +55,22 @@ static constexpr sampler MAIN_SAMPLER(coord::normalized, address::clamp_to_edge,
[FXAA CODE SECTION]
------------------------------------------------------------------------------*/
// We don't use gather4 for alpha/luminance because it would require an additional
// pass to compute the values, which would be slower than the extra shader loads.
#if (SHADER_MODEL >= 0x500)
#define FXAA_HLSL_5 1
#define FXAA_GATHER4_ALPHA 1
#define FXAA_GATHER4_ALPHA 0
#elif (SHADER_MODEL >= 0x400)
#define FXAA_HLSL_4 1
#define FXAA_GATHER4_ALPHA 0
#elif (FXAA_GLSL_130 == 1 || FXAA_GLSL_VK == 1)
#define FXAA_GATHER4_ALPHA 1
#define FXAA_GATHER4_ALPHA 0
#elif defined(__METAL_VERSION__)
#define FXAA_GATHER4_ALPHA 1
#define FXAA_GATHER4_ALPHA 0
#endif
#if (FXAA_HLSL_5 == 1)
@ -526,7 +529,7 @@ void main()
color = PreGammaPass(color);
color = FxaaPass(color, PSin_t);
SV_Target0 = color;
SV_Target0 = float4(color.rgb, 1.0);
}
#elif (SHADER_MODEL >= 0x400)
@ -539,7 +542,7 @@ PS_OUTPUT ps_main(VS_OUTPUT input)
color = PreGammaPass(color);
color = FxaaPass(color, input.t);
output.c = color;
output.c = float4(color.rgb, 1.0);
return output;
}