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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-06 23:58:48 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-06 23:58:48 +0400
commit64467e3ffa250233b25d14d1b46927c54780eefd (patch)
treea43be71e61ca08fdf7156dea2e85c9802276ee49 /source/blender/nodes
parent1c6c3ead4f689d1b282ceec2b2756438abc0e11c (diff)
Fixes related to #33087:
* Fix GLSL memory leak in the (vector) math node. * Fix GLSL math node pow behavior for negative values, same as was done for C.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c17
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c17
2 files changed, 22 insertions, 12 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index 1c2b0c3e7b3..adfb823147b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -225,8 +225,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
case 13:
case 15:
case 16:
- GPU_stack_link(mat, names[node->custom1], NULL, out,
- GPU_socket(&in[0]), GPU_socket(&in[1]));
+ GPU_stack_link(mat, names[node->custom1], in, out);
break;
case 4:
case 5:
@@ -235,10 +234,16 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
case 8:
case 9:
case 14:
- if (in[0].hasinput || !in[1].hasinput)
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
- else
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
+ if (in[0].hasinput || !in[1].hasinput) {
+ /* use only first item and terminator */
+ GPUNodeStack tmp_in[2] = {in[0], in[2]};
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
+ else {
+ /* use only second item and terminator */
+ GPUNodeStack tmp_in[2] = {in[1], in[2]};
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
break;
default:
return 0;
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 2d9f1903c5b..d57c1da2f91 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -114,14 +114,19 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
case 2:
case 3:
case 4:
- GPU_stack_link(mat, names[node->custom1], NULL, out,
- GPU_socket(&in[0]), GPU_socket(&in[1]));
+ GPU_stack_link(mat, names[node->custom1], in, out);
break;
case 5:
- if (in[0].hasinput || !in[1].hasinput)
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
- else
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
+ if (in[0].hasinput || !in[1].hasinput) {
+ /* use only first item and terminator */
+ GPUNodeStack tmp_in[2] = {in[0], in[2]};
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
+ else {
+ /* use only second item and terminator */
+ GPUNodeStack tmp_in[2] = {in[1], in[2]};
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
break;
default:
return 0;