]> git.sesse.net Git - movit/blob - flat_input.frag
Add some asserts to EffectChain::execute_phase, so that we do not inadvertedly insert...
[movit] / flat_input.frag
1 // Implicit uniforms:
2 // uniform sampler2D PREFIX(tex);
3
4 vec4 FUNCNAME(vec2 tc) {
5         // OpenGL's origin is bottom-left, but most graphics software assumes
6         // a top-left origin. Thus, for inputs that come from the user,
7         // we flip the y coordinate.
8         tc.y = 1.0 - tc.y;
9
10         vec4 pixel = tex2D(PREFIX(tex), tc);
11
12         // These two are #defined to 0 or 1 in flat_input.cpp.
13 #if FIXUP_SWAP_RB
14         pixel.rb = pixel.br;
15 #endif
16 #if FIXUP_RED_TO_GRAYSCALE
17         pixel.gb = pixel.rr;
18 #endif
19         return pixel;
20 }
21
22 #undef FIXUP_SWAP_RB
23 #undef FIXUP_RED_TO_GRAYSCALE