demotool/test/fx-bloom/downsample.f.glsl
Emmanuel BENOîT 68d01ca42e Shaders - Relative paths
Shaders are no longer found under /shaders in the project; they can be
anywhere. In addition, paths for both (program) instructions in the
script and include directives in shader source code are relative to the
file which contains them.
2017-12-29 11:33:15 +01:00

20 lines
675 B
GLSL

#version 450 core
//! type fragment
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform vec2 u_OutputSize;
layout( location = 2 ) uniform int u_SourceLOD;
layout( location = 0 ) out vec3 color;
void main( void )
{
const vec2 c = gl_FragCoord.xy;
color = ( .25 * (
textureLod( u_InputTexture , ( c + vec2( .5 , .5 ) ) / u_OutputSize , u_SourceLOD )
+ textureLod( u_InputTexture , ( c + vec2(-.5 , .5 ) ) / u_OutputSize , u_SourceLOD )
+ textureLod( u_InputTexture , ( c + vec2( .5 ,-.5 ) ) / u_OutputSize , u_SourceLOD )
+ textureLod( u_InputTexture , ( c + vec2(-.5 ,-.5 ) ) / u_OutputSize , u_SourceLOD )
) ).rgb;
}