Fix part of #27944: color managment discrepancy in GLSL materials with nodes.
[blender.git] / source / blender / gpu / intern / gpu_material.c
index 806c70d841fd5c07c929399a94226a526e86e71a..274884000dbbc8314f92db764c4819e2572bcb50 100644 (file)
@@ -1371,9 +1371,6 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
                mat->obcolalpha = 1;
                GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined);
        }
-
-       if(gpu_do_color_management(mat))
-               GPU_link(mat, "linearrgb_to_srgb", shr->combined, &shr->combined);
 }
 
 static GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma)
@@ -1408,6 +1405,10 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
                GPU_material_output_link(mat, outlink);
        }
 
+       if(gpu_do_color_management(mat))
+               if(mat->outlink)
+                       GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink);
+
        /*if(!GPU_material_construct_end(mat)) {
                GPU_material_free(mat);
                mat= NULL;