Files
lunarwm/assets/linear_srgb.fs
Slendi f74937bb6a Initial commit
Signed-off-by: Slendi <slendi@socopon.com>
2025-10-01 20:29:18 +03:00

19 lines
451 B
GLSL

precision mediump float;
varying vec2 fragTexCoord;
varying vec4 fragColor;
uniform sampler2D texture0;
vec3 srgb_to_linear(vec3 c) {
bvec3 cutoff = lessThanEqual(c, vec3(0.04045));
vec3 low = c / 12.92;
vec3 high = pow((c + 0.055) / 1.055, vec3(2.4));
return mix(high, low, vec3(cutoff));
}
void main() {
vec4 c = texture2D(texture0, fragTexCoord) * fragColor;
c.rgb = srgb_to_linear(c.rgb); // decode to linear
gl_FragColor = c;
}