[Bf-blender-cvs] [95a42ccf1c0] master: Fix T64762: incorrect textures for non-color images with an alpha channel

Brecht Van Lommel noreply at git.blender.org
Sat May 18 13:01:38 CEST 2019


Commit: 95a42ccf1c0fb7dff618bf99a1a6389f597479a5
Author: Brecht Van Lommel
Date:   Sat May 18 12:51:48 2019 +0200
Branches: master
https://developer.blender.org/rB95a42ccf1c0fb7dff618bf99a1a6389f597479a5

Fix T64762: incorrect textures for non-color images with an alpha channel

===================================================================

M	source/blender/imbuf/IMB_colormanagement.h
M	source/blender/imbuf/intern/colormanagement.c
M	source/blender/nodes/shader/node_shader_util.h
M	source/blender/nodes/shader/nodes/node_shader_tex_image.c

===================================================================

diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index e683d38a0aa..a27945cc369 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -61,6 +61,7 @@ const char *IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf);
 bool IMB_colormanagement_space_is_data(struct ColorSpace *colorspace);
 bool IMB_colormanagement_space_is_scene_linear(struct ColorSpace *colorspace);
 bool IMB_colormanagement_space_is_srgb(struct ColorSpace *colorspace);
+bool IMB_colormanagement_space_name_is_data(const char *name);
 
 BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3]);
 BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char[3]);
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index b460d268d38..ba0f10446a1 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1381,6 +1381,12 @@ bool IMB_colormanagement_space_is_srgb(ColorSpace *colorspace)
   return (colorspace && colorspace->info.is_srgb);
 }
 
+bool IMB_colormanagement_space_name_is_data(const char *name)
+{
+  ColorSpace *colorspace = colormanage_colorspace_get_named(name);
+  return (colorspace && colorspace->is_data);
+}
+
 /*********************** Threaded display buffer transform routines *************************/
 
 typedef struct DisplayBufferThread {
diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h
index 165ada05a56..a3c553b983b 100644
--- a/source/blender/nodes/shader/node_shader_util.h
+++ b/source/blender/nodes/shader/node_shader_util.h
@@ -60,8 +60,7 @@
 
 #include "BLT_translation.h"
 
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
+#include "IMB_colormanagement.h"
 
 #include "RE_pipeline.h"
 #include "RE_shader_ext.h"
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index 924714e561a..a9183cd10ef 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -180,7 +180,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
   }
 
   if (out[0].hasoutput) {
-    if (out[1].hasoutput) {
+    if (out[1].hasoutput &&
+        !IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) {
       GPU_link(mat, "tex_color_alpha_unpremultiply", out[0].link, &out[0].link);
     }
     else {



More information about the Bf-blender-cvs mailing list