diff --git a/backends/vulkan/glsl_shader.frag b/backends/vulkan/glsl_shader.frag index ce7e6f72b25d..70e4e2e536cf 100644 --- a/backends/vulkan/glsl_shader.frag +++ b/backends/vulkan/glsl_shader.frag @@ -8,7 +8,16 @@ layout(location = 0) in struct { vec2 UV; } In; +vec4 to_linear(vec4 sRGB) +{ + bvec3 cutoff = lessThan(sRGB.rgb, vec3(0.04045)); + vec3 higher = pow((sRGB.rgb + vec3(0.055)) / vec3(1.055), vec3(2.4)); + vec3 lower = sRGB.rgb / vec3(12.92); + + return vec4(mix(higher, lower, cutoff), sRGB.a); +} + void main() { - fColor = In.Color * texture(sTexture, In.UV.st); + fColor = to_linear(In.Color) * to_linear(texture(sTexture, In.UV.st)); }