Fix T95341: BGL renders incorrect color

Missing include statements of the gpu_shader_colorspace_lib.glsl in
various shaders ignored the target texture color space.
This commit is contained in:
Jeroen Bakker 2022-01-31 15:41:42 +01:00
parent 2216699c64
commit 9578fe3068
7 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,5 @@
#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
#ifndef USE_GPU_SHADER_CREATE_INFO
noperspective in vec4 finalColor;
out vec4 fragColor;

View File

@ -1,3 +1,5 @@
#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
#ifndef USE_GPU_SHADER_CREATE_INFO
in vec4 finalColor;
out vec4 fragColor;

View File

@ -6,13 +6,13 @@
uniform bool srgbTarget = false;
#endif
vec4 blender_srgb_to_framebuffer_space(vec4 color)
vec4 blender_srgb_to_framebuffer_space(vec4 col)
{
if (srgbTarget) {
vec3 c = max(color.rgb, vec3(0.0));
vec3 c = max(col.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));
col.rgb = mix(c1, c2, step(vec3(0.04045), c));
}
return color;
return col;
}

View File

@ -1,3 +1,5 @@
#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
#ifndef USE_GPU_SHADER_CREATE_INFO
flat in vec4 finalColor;
out vec4 fragColor;

View File

@ -1,3 +1,5 @@
#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
#ifndef USE_GPU_SHADER_CREATE_INFO
flat in vec4 color_flat;
noperspective in vec2 texCoord_interp;

View File

@ -1,3 +1,4 @@
#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
#ifndef USE_GPU_SHADER_CREATE_INFO
uniform vec4 color;

View File

@ -24,4 +24,5 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space)
.push_constant(Type::BOOL, "srgbTarget")
.define("blender_srgb_to_framebuffer_space(a) a");