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 postprocessing steps we might have.
30 // Note that we need to give in the actual coordinates, since the
31 // effect could have multiple (non-compute) inputs, and would also
32 // be allowed to make effects based on the texture coordinate alone.
34 val = CS_POSTPROC(NORMALIZE_TEXTURE_COORDS(coord));
36 #if SQUARE_ROOT_TRANSFORMATION
37 // Make sure we don't give negative values to sqrt.
38 val.rgb = sqrt(max(val.rgb, 0.0));
42 coord.y = imageSize(tex_outbuf).y - coord.y - 1;
45 imageStore(tex_outbuf, coord, val);