diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-23 15:44:47 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-23 15:44:47 +0400 |
commit | b518197db7fd63f878c4360312c47f15b61f780a (patch) | |
tree | 549cce367abb6a3e8b1949b897dc82f8024501d6 /source | |
parent | 38a76aff8b166e8bfedbea532e909fa881d7da10 (diff) |
Correction to recent fix for shader nodes -- image could be not loaded yet
when tree is being executed. This could lead to nor initialized color space
for the image.
Solved by insuring image buffer is loaded before checking for whether color
conversion is needed.
Diffstat (limited to 'source')
5 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 12f23e832c7..0653956e113 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -62,8 +62,6 @@ void IMB_colormanagement_check_is_data(struct ImBuf *ibuf, const char *name); void IMB_colormanagement_assign_float_colorspace(struct ImBuf *ibuf, const char *name); void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name); -int IMB_colormanagement_colorspace_is_data(const char *name); - /* ** Color space transformation functions ** */ void IMB_colormanagement_transform(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, int predivide); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 8cd2a707dd3..ff474d85a8c 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1113,13 +1113,6 @@ void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name) ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; } -int IMB_colormanagement_colorspace_is_data(const char *name) -{ - ColorSpace *colorspace = colormanage_colorspace_get_named(name); - - return colorspace->is_data; -} - /*********************** Threaded display buffer transform routines *************************/ typedef struct DisplayBufferThread { diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index 8c3f243169f..08a3b47af91 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -75,8 +75,9 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod ret = GPU_stack_link(mat, "node_tex_environment", in, out, GPU_image(ima, iuser, ncd)); if (ret) { - if (GPU_material_do_color_management(mat) && - IMB_colormanagement_colorspace_is_data(ima->colorspace_settings.name) == FALSE) + ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser); + if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 && + GPU_material_do_color_management(mat)) { GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link); } 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 342e06ff050..82d4e501cb8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -75,8 +75,9 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack ret = GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, ncd)); if (ret) { - if (GPU_material_do_color_management(mat) && - IMB_colormanagement_colorspace_is_data(ima->colorspace_settings.name) == FALSE) + ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser); + if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 && + GPU_material_do_color_management(mat)) { GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link); } diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c index b39f0e62fa9..6d1b3ff6dba 100644 --- a/source/blender/nodes/shader/nodes/node_shader_texture.c +++ b/source/blender/nodes/shader/nodes/node_shader_texture.c @@ -128,8 +128,9 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G int ret = GPU_stack_link(mat, "texture_image", in, out, texlink); if (ret) { - if (GPU_material_do_color_management(mat) && - IMB_colormanagement_colorspace_is_data(tex->ima->colorspace_settings.name) == FALSE) + ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser); + if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) ==0 && + GPU_material_do_color_management(mat)) { GPU_link(mat, "srgb_to_linearrgb", out[1].link, &out[1].link); } |