1 // GLSL is pickier than the C++ preprocessor in if-testing for undefined
2 // tokens; do some fixups here to keep it happy.
4 #ifndef SQUARE_ROOT_TRANSFORMATION
5 #define SQUARE_ROOT_TRANSFORMATION 0
13 vec4 tex2D(sampler2D s, vec2 coord)
15 return texture(s, coord);
18 void cs_output(uvec2 coord, vec4 val)
20 cs_output(ivec2(coord), val);
23 void cs_output(ivec2 coord, vec4 val)
25 // Run the value through any preprocessing steps we might have.
27 val = CS_POSTPROC(vec2(0.0, 0.0));
29 #if SQUARE_ROOT_TRANSFORMATION
30 // Make sure we don't give negative values to sqrt.
31 val.rgb = sqrt(max(val.rgb, 0.0));
33 imageStore(outbuf, coord, val);