]> git.sesse.net Git - movit/blob - dither_effect.frag
Remove sandbox_effect from coverage.
[movit] / dither_effect.frag
1 uniform sampler2D PREFIX(dither_tex);
2 uniform vec2 PREFIX(tc_scale);
3 uniform float PREFIX(round_fac), PREFIX(inv_round_fac);
4
5 vec4 FUNCNAME(vec2 tc) {
6         // We also choose to dither alpha, just in case.
7         // Maybe it should in theory have a separate dither,
8         // but I doubt it matters much.
9         vec4 result = INPUT(tc) + texture2D(PREFIX(dither_tex), tc * PREFIX(tc_scale)).xxxx;
10
11         // NEED_EXPLICIT_ROUND will be #defined to 1 if the GPU has inaccurate
12         // fp32 -> int8 framebuffer rounding, and 0 otherwise.
13 #if NEED_EXPLICIT_ROUND
14         result = round(result * vec4(PREFIX(round_fac))) * vec4(PREFIX(inv_round_fac));
15 #endif
16
17         return result;
18 }