demotool/test/shaders/fxaa.f.glsl

44 lines
1.3 KiB
GLSL

#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 chunks/fxaa-3.11.glsl
layout( location = 0 ) uniform sampler2D u_Input;
layout( location = 1 ) uniform vec4 u_Viewport;
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 )
{
vec2 coords = gl_FragCoord.xy - u_Viewport.xy;
o_Color = FxaaPixelShader(
( coords / u_Viewport.zw ) , // pos (vec2)
vec4( 0 ) , // unused (vec4)
u_Input , // input texture
u_Input , // (unused) input texture
u_Input , // (unused) input texture
vec2( 1 ) / u_Viewport.zw , // 1/resolution (vec2)
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)
}