22 lines
572 B
GLSL
22 lines
572 B
GLSL
/* SPDX-FileCopyrightText: 2020-2022 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/* Undefine the macro that avoids compilation errors. */
|
|
#undef blender_srgb_to_framebuffer_space
|
|
|
|
#ifndef USE_GPU_SHADER_CREATE_INFO
|
|
uniform bool srgbTarget = false;
|
|
#endif
|
|
|
|
vec4 blender_srgb_to_framebuffer_space(vec4 in_color)
|
|
{
|
|
if (srgbTarget) {
|
|
vec3 c = max(in_color.rgb, vec3(0.0));
|
|
vec3 c1 = c * (1.0 / 12.92);
|
|
vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
|
|
in_color.rgb = mix(c1, c2, step(vec3(0.04045), c));
|
|
}
|
|
return in_color;
|
|
}
|