[Bf-blender-cvs] [f16bca72123] master: Fix T71480: crash with Eevee image texture node and clipping

Brecht Van Lommel noreply at git.blender.org
Sun Dec 8 18:50:58 CET 2019


Commit: f16bca72123b279a7c1e395abb75fb4032150391
Author: Brecht Van Lommel
Date:   Sun Dec 8 18:31:01 2019 +0100
Branches: master
https://developer.blender.org/rBf16bca72123b279a7c1e395abb75fb4032150391

Fix T71480: crash with Eevee image texture node and clipping

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

M	source/blender/nodes/shader/nodes/node_shader_tex_image.c

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

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 a6dfb2636fc..c81f4f9853f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -126,6 +126,12 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
   switch (tex->projection) {
     case SHD_PROJ_FLAT:
       if (do_texco_clip) {
+        /* This seems redundant, but is required to ensure the texco link
+         * is not freed by GPU_link, as it is still needed for GPU_stack_link.
+         * Intermediate links like this can only be used once and are then
+         * freed immediately, but if we make it the output link of a set_rgb
+         * node it will be kept and can be used multiple times. */
+        GPU_link(mat, "set_rgb", *texco, texco);
         GPU_link(mat, "set_rgb", *texco, &input_coords);
       }
       if (do_texco_extend) {
@@ -151,6 +157,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
       GPU_link(mat, "point_texco_remap_square", *texco, texco);
       GPU_link(mat, "point_map_to_sphere", *texco, texco);
       if (do_texco_clip) {
+        /* See SHD_PROJ_FLAT for explanation. */
+        GPU_link(mat, "set_rgb", *texco, texco);
         GPU_link(mat, "set_rgb", *texco, &input_coords);
       }
       if (do_texco_extend) {
@@ -163,6 +171,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
       GPU_link(mat, "point_texco_remap_square", *texco, texco);
       GPU_link(mat, "point_map_to_tube", *texco, texco);
       if (do_texco_clip) {
+        /* See SHD_PROJ_FLAT for explanation. */
+        GPU_link(mat, "set_rgb", *texco, texco);
         GPU_link(mat, "set_rgb", *texco, &input_coords);
       }
       if (do_texco_extend) {



More information about the Bf-blender-cvs mailing list