Use calibration for preview

This commit is contained in:
Martijn Braam
2023-07-23 16:29:59 +02:00
parent 6e3f592b08
commit e9681e1eea
7 changed files with 112 additions and 23 deletions

View File

@@ -4,6 +4,7 @@ precision highp float;
uniform sampler2D texture;
uniform mat3 color_matrix;
uniform float inv_gamma;
#ifdef BITS_10
uniform float row_length;
uniform float padding_ratio;
@@ -62,13 +63,13 @@ main()
// should be an uniform
vec3 corrected = color - 0.02;
#if defined(COLORSPACE_RAW)
/*
// Fast SRGB estimate. See https://mimosa-pudica.net/fast-gamma/
vec3 srgb_color =
vec3 gamma_color =
(vec3(1.138) * inversesqrt(corrected) - vec3(0.138)) * corrected;
*/
color = color * color_matrix;
gl_FragColor = vec4(srgb_color, 1);
#elif defined(COLORSPACE_SRGB)
gl_FragColor = vec4(color, 1);
#endif
vec3 gamma_color = pow(color, vec3(inv_gamma));
gl_FragColor = vec4(gamma_color, 1);
}