]> git.sesse.net Git - movit/blobdiff - gamma_expansion_effect.frag
Fix an issue where a (cached) shader program could be used from multiple
[movit] / gamma_expansion_effect.frag
index 359b026450c916f52d9f486bac11c2f6dcff3b71..b8e3581f53772107880d9b90b68981a95e9f35d9 100644 (file)
@@ -1,8 +1,9 @@
 // Expand gamma curve.
 
-uniform float PREFIX(linear_scale);
-uniform float PREFIX(c0), PREFIX(c1), PREFIX(c2), PREFIX(c3), PREFIX(c4);
-uniform float PREFIX(beta);
+// Implicit uniforms:
+// uniform float PREFIX(linear_scale);
+// uniform float PREFIX(c)[5];
+// uniform float PREFIX(beta);
 
 vec4 FUNCNAME(vec2 tc) {
        vec4 x = INPUT(tc);
@@ -10,7 +11,7 @@ vec4 FUNCNAME(vec2 tc) {
        vec3 a = x.rgb * PREFIX(linear_scale);
 
        // Fourth-order polynomial approximation to pow(). See the .cpp file for details.
-       vec3 b = PREFIX(c0) + (PREFIX(c1) + (PREFIX(c2) + (PREFIX(c3) + PREFIX(c4) * x.rgb) * x.rgb) * x.rgb) * x.rgb;
+       vec3 b = PREFIX(c[0]) + (PREFIX(c[1]) + (PREFIX(c[2]) + (PREFIX(c[3]) + PREFIX(c[4]) * x.rgb) * x.rgb) * x.rgb) * x.rgb;
 
        vec3 f = vec3(greaterThan(x.rgb, vec3(PREFIX(beta))));
        x = vec4(mix(a, b, f), x.a);