Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gpu_shader_colorspace_lib.glsl « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aae659516bb9cd405055600d998d4bfd7c85569c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

/* Undefine the macro that avoids compilation errors. */
#undef blender_srgb_to_framebuffer_space

uniform bool srgbTarget = false;

vec4 blender_srgb_to_framebuffer_space(vec4 color)
{
  if (srgbTarget) {
    vec3 c = max(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));
    color.rgb = mix(c1, c2, step(vec3(0.04045), c));
  }
  return color;
}