+// Implicit uniforms:
+// uniform sampler2D PREFIX(dither_tex);
+// uniform vec2 PREFIX(tc_scale);
+// uniform float PREFIX(round_fac), PREFIX(inv_round_fac);
+
+#if YCBCR_ALSO_OUTPUT_RGBA
+
+// There are two values to dither; otherwise, exactly the same as the algorithm below
+// (so comments are not duplicated).
+
+vec4[2] FUNCNAME(vec2 tc) {
+ vec4[2] result = INPUT(tc);
+ float d = tex2D(PREFIX(dither_tex), tc * PREFIX(tc_scale)).x;
+ result[0].rgb += vec3(d);
+ result[1].rgb += vec3(d);
+
+#if NEED_EXPLICIT_ROUND
+ result[0] = round(result[0] * vec4(PREFIX(round_fac))) * vec4(PREFIX(inv_round_fac));
+ result[1] = round(result[1] * vec4(PREFIX(round_fac))) * vec4(PREFIX(inv_round_fac));
+#endif
+
+ return result;
+}
+
+#else