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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2022-01-31 17:41:42 +0300
committerJeroen Bakker <jeroen@blender.org>2022-01-31 17:43:13 +0300
commit9578fe30682360e7b9554afd8d23cceed55c70bd (patch)
tree6fa6e3a5f11ce42ba2613cd6039821d71fad1fac /source/blender/gpu
parent2216699c6468f381344ea211626c30ac810ee0e3 (diff)
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.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_text_frag.glsl2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl1
-rw-r--r--source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh1
7 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl
index 4d887a37807..1ec84598bf1 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl
@@ -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;
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
index de555cc5706..f374913a32c 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl
@@ -1,3 +1,5 @@
+#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
+
#ifndef USE_GPU_SHADER_CREATE_INFO
in vec4 finalColor;
out vec4 fragColor;
diff --git a/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl b/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl
index 74341701fb0..7d69cba5017 100644
--- a/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl
@@ -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;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
index 1675de3d567..28a716104f1 100644
--- a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl
@@ -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;
diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
index 1456bd0c732..c339d3cbabb 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
@@ -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;
diff --git a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
index b4a75cc489b..0510848e4d4 100644
--- a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
@@ -1,3 +1,4 @@
+#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl)
#ifndef USE_GPU_SHADER_CREATE_INFO
uniform vec4 color;
diff --git a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
index 3af49b56ab1..e9154bcaeda 100644
--- a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
@@ -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");