demotool/test/fx-fxaa/fxaa.f.glsl

45 lines
1.2 KiB
Text
Raw Normal View History

2017-10-05 18:35:35 +02:00
#version 450 core
//! type fragment
#define FXAA_PC 1
#define FXAA_GLSL_130 1
#define FXAA_FAST_PIXEL_OFFSET 1
#define FXAA_GATHER4_ALPHA 1
#define FXAA_QUALITY__PRESET 39
//! include fxaa-3.11.glsl
2017-10-05 18:35:35 +02:00
layout( location = 0 ) uniform sampler2D u_Input;
2017-11-15 23:09:52 +01:00
layout( location = 1 ) uniform vec4 u_Viewport;
2017-10-05 18:35:35 +02:00
layout( location = 2 ) uniform vec3 u_Parameters;
#define uSPQuality (u_Parameters.x)
#define uEdgeThreshold (u_Parameters.y)
#define uEdgeThresholdMin (u_Parameters.z)
layout( location = 0 ) out vec4 o_Color;
void main( void )
{
2017-11-15 23:09:52 +01:00
vec2 coords = gl_FragCoord.xy - u_Viewport.xy;
2017-10-05 18:35:35 +02:00
o_Color = FxaaPixelShader(
2017-11-15 23:09:52 +01:00
( coords / u_Viewport.zw ) , // pos (vec2)
2017-10-05 18:35:35 +02:00
vec4( 0 ) , // unused (vec4)
u_Input , // input texture
u_Input , // (unused) input texture
u_Input , // (unused) input texture
2017-11-15 23:09:52 +01:00
vec2( 1 ) / u_Viewport.zw , // 1/resolution (vec2)
2017-10-05 18:35:35 +02:00
vec4( 0 ) , // unused (vec4)
vec4( 0 ) , // unused (vec4)
vec4( 0 ) , // unused (vec4)
uSPQuality , // sub-pixel quality (float in [0;1])
uEdgeThreshold , // edge threshold (float, [.063;.333], lower = better)
uEdgeThresholdMin , // edge threshold min (float, [0.0312;0.0833],
// higher = better)
0 , // unused (float)
0 , // unused (float)
0 , // unused (float)
vec4( 0 ) ); // unused (vec4)
}