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
17 vec4 tex2D(sampler2D s, vec2 coord)
19 return texture(s, coord);
22 void cs_output(uvec2 coord, vec4 val)
24 cs_output(ivec2(coord), val);
27 void cs_output(ivec2 coord, vec4 val)
29 // Run the value through any preprocessing steps we might have.
31 val = CS_POSTPROC(vec2(0.0, 0.0));
33 #if SQUARE_ROOT_TRANSFORMATION
34 // Make sure we don't give negative values to sqrt.
35 val.rgb = sqrt(max(val.rgb, 0.0));
39 coord.y = imageSize(tex_outbuf).y - coord.y - 1;
42 imageStore(tex_outbuf, coord, val);