Merge branch 'master' into epoxy
[movit] / blur_effect.frag
1 // A simple un.directional blur.
2 // DIRECTION_VERTICAL will be #defined to 1 if we are doing a vertical blur,
3 // 0 otherwise.
4
5 #define NUM_TAPS 16
6
7 uniform vec2 PREFIX(samples)[NUM_TAPS + 1];
8
9 vec4 FUNCNAME(vec2 tc) {
10         vec4 sum = vec4(PREFIX(samples)[0].y) * INPUT(tc);
11         for (int i = 1; i < NUM_TAPS + 1; ++i) {
12                 vec2 sample = PREFIX(samples)[i];
13                 vec2 sample1_tc = tc, sample2_tc = tc;
14 #if DIRECTION_VERTICAL
15                 sample1_tc.y -= sample.x;
16                 sample2_tc.y += sample.x;
17 #else
18                 sample1_tc.x -= sample.x;
19                 sample2_tc.x += sample.x;
20 #endif
21                 sum += vec4(sample.y) * (INPUT(sample1_tc) + INPUT(sample2_tc));
22         }
23         return sum;
24 }