]> git.sesse.net Git - movit/blob - footer.comp
Minor improvement to a test name.
[movit] / footer.comp
1 // GLSL is pickier than the C++ preprocessor in if-testing for undefined
2 // tokens; do some fixups here to keep it happy.
3
4 #ifndef SQUARE_ROOT_TRANSFORMATION
5 #define SQUARE_ROOT_TRANSFORMATION 0
6 #endif
7
8 void main()
9 {
10         INPUT();
11 }
12
13 vec4 tex2D(sampler2D s, vec2 coord)
14 {
15         return texture(s, coord);
16 }
17
18 void cs_output(uvec2 coord, vec4 val)
19 {
20         cs_output(ivec2(coord), val);
21 }
22
23 void cs_output(ivec2 coord, vec4 val)
24 {
25         // Run the value through any preprocessing steps we might have.
26         CS_OUTPUT_VAL = val;
27         val = CS_POSTPROC(vec2(0.0, 0.0));
28
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));
32 #endif
33         imageStore(outbuf, coord, val);
34 }