Chain together vertex shaders, like with fragment shaders.
[movit] / gamma_expansion_effect_srgb.frag
1 // Expand sRGB gamma curve.
2
3 #if 0
4
5 // if we have the lut
6 uniform sampler1D PREFIX(srgb_tex);
7
8 vec4 FUNCNAME(vec2 tc) {
9         vec4 x = LAST_INPUT(tc);
10
11         x.r = texture1D(PREFIX(srgb_tex), x.r).x;
12         x.g = texture1D(PREFIX(srgb_tex), x.g).x;
13         x.b = texture1D(PREFIX(srgb_tex), x.b).x;
14
15         return x;
16 }
17
18 #else
19
20 // use arithmetic (slow)
21 vec4 FUNCNAME(vec2 tc) {
22         vec4 x = LAST_INPUT(tc);
23
24         vec3 a = x.rgb * vec3(1.0/12.92); 
25         vec3 b = pow((x.rgb + vec3(0.055)) * vec3(1.0/1.055), vec3(2.4));
26         vec3 f = vec3(greaterThan(x.rgb, vec3(0.04045)));
27
28         return vec4(mix(a, b, f), x.a); 
29 }
30  
31 #endif