]> git.sesse.net Git - movit/blob - fft_pass_effect.frag
Add some precision statements to make GLES slightly happier.
[movit] / fft_pass_effect.frag
1 // DIRECTION_VERTICAL will be #defined to 1 if we are doing a vertical FFT,
2 // and 0 otherwise.
3
4 uniform float PREFIX(num_repeats);
5 uniform sampler2D PREFIX(support_tex);
6
7 vec4 FUNCNAME(vec2 tc) {
8 #if DIRECTION_VERTICAL
9         vec4 support = texture2D(PREFIX(support_tex), vec2(tc.y * PREFIX(num_repeats), 0.0));
10         vec4 c1 = INPUT(vec2(tc.x, tc.y + support.x));
11         vec4 c2 = INPUT(vec2(tc.x, tc.y + support.y));
12 #else
13         vec4 support = texture2D(PREFIX(support_tex), vec2(tc.x * PREFIX(num_repeats), 0.0));
14         vec4 c1 = INPUT(vec2(tc.x + support.x, tc.y));
15         vec4 c2 = INPUT(vec2(tc.x + support.y, tc.y));
16 #endif
17         // Two complex additions and multiplications in parallel; essentially
18         //
19         //   result.xy = c1.xy + twiddle * c2.xy
20         //   result.zw = c1.zw + twiddle * c2.zw
21         //
22         // where * is complex multiplication.
23         return c1 + support.z * c2 + support.w * vec4(-c2.y, c2.x, -c2.w, c2.z);
24 }