]> git.tdb.fi Git - libs/gl.git/blob - demos/forestpond/data/water_variance_y.glsl
Shader fixes in the forest pond demo
[libs/gl.git] / demos / forestpond / data / water_variance_y.glsl
1 #pragma MSP stage(compute)
2 layout(local_size_x=8, local_size_y=8) in;
3
4 uniform sampler2D variance_in;
5 layout(r16f) uniform image2D variance_out;
6
7 void main()
8 {
9         ivec2 coord = ivec2(gl_GlobalInvocationID.xy)+ivec2(1, 4);
10         float variance = 0.0;
11         for(int i=-3; i<=3; ++i)
12                 variance += texelFetch(variance_in, coord+ivec2(0, i), 0).x;
13         imageStore(variance_out, coord, vec4(variance/7.0, 0.0, 0.0, 0.0));
14 }