gamma correction in post when there's no sRGB framebuffer and simple shader compositi...
[vrfileman] / sdr / post.p.glsl
diff --git a/sdr/post.p.glsl b/sdr/post.p.glsl
new file mode 100644 (file)
index 0000000..562d79a
--- /dev/null
@@ -0,0 +1,24 @@
+uniform sampler2D tex;
+
+#ifndef set_pixel
+#define set_pixel set_pixel_linear
+#endif
+
+void set_pixel_linear(vec3 c)
+{
+       gl_FragColor.rgb = c;
+       gl_FragColor.a = 1.0;
+}
+
+void set_pixel_srgb(vec3 c)
+{
+       gl_FragColor.rgb = pow(c, vec3(1.0 / 2.2));
+       gl_FragColor.a = 1.0;
+}
+
+void main()
+{
+       vec3 texel = texture2D(tex, gl_TexCoord[0].st).rgb;
+
+       set_pixel(texel);
+}