cycles separateRGB: fix for cuda kernel building.
authorDalai Felinto <dfelinto@gmail.com>
Fri, 2 Dec 2011 07:13:48 +0000 (07:13 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 2 Dec 2011 07:13:48 +0000 (07:13 +0000)
Array indexing doesn't work there.

I'm yet to setup my CUDA computer, in the meantime this proved to work (tested by Daniel Salazar).
If I found other ways of doing it I get back to that.

intern/cycles/kernel/svm/svm_sepcomb_rgb.h

index 5d3afef55666e7b39851e3b40a03d78010fd54ff..4e23221e3cd84a396aae694de293089d6a01da12 100644 (file)
@@ -30,8 +30,14 @@ __device void svm_node_separate_rgb(ShaderData *sd, float *stack, uint icolor_of
 {
        float3 color = stack_load_float3(stack, icolor_offset);
 
-       if (stack_valid(out_offset))
-               stack_store_float(stack, out_offset, color[color_index]); 
+       if (stack_valid(out_offset)) {
+               if (color_index == 0)
+                       stack_store_float(stack, out_offset, color.x);
+               else if (color_index == 1)
+                       stack_store_float(stack, out_offset, color.y);
+               else
+                       stack_store_float(stack, out_offset, color.z);
+       }
 }
 
 CCL_NAMESPACE_END