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:
authorDalai Felinto <dfelinto@gmail.com>2011-12-02 01:46:10 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-12-02 01:46:10 +0400
commit4db4a0933f8cef74a27561fa26e79ceab9021d67 (patch)
treedc641c5e8b4ab74fbdd51b13d6b115be2b7d5142 /intern/cycles/kernel/svm
parentb7db2587fb839ff8586ca377c8cc93175e38f470 (diff)
SeparateRGB and CombineRGB nodes for Cycles materials
reviewed and approved by Brecht my first OpenCL code \o/
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r--intern/cycles/kernel/svm/svm.h7
-rw-r--r--intern/cycles/kernel/svm/svm_sepcomb_rgb.h38
-rw-r--r--intern/cycles/kernel/svm/svm_types.h4
3 files changed, 48 insertions, 1 deletions
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index 2615272691c..3073aefc272 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -134,6 +134,7 @@ CCL_NAMESPACE_END
#include "svm_wave.h"
#include "svm_math.h"
#include "svm_mix.h"
+#include "svm_sepcomb_rgb.h"
#include "svm_musgrave.h"
#include "svm_sky.h"
#include "svm_tex_coord.h"
@@ -254,6 +255,12 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
case NODE_MIX:
svm_node_mix(kg, sd, stack, node.y, node.z, node.w, &offset);
break;
+ case NODE_SEPARATE_RGB:
+ svm_node_separate_rgb(sd, stack, node.y, node.z, node.w);
+ break;
+ case NODE_COMBINE_RGB:
+ svm_node_combine_rgb(sd, stack, node.y, node.z, node.w);
+ break;
case NODE_ATTR:
svm_node_attr(kg, sd, stack, node);
break;
diff --git a/intern/cycles/kernel/svm/svm_sepcomb_rgb.h b/intern/cycles/kernel/svm/svm_sepcomb_rgb.h
new file mode 100644
index 00000000000..5d3afef5566
--- /dev/null
+++ b/intern/cycles/kernel/svm/svm_sepcomb_rgb.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+CCL_NAMESPACE_BEGIN
+
+__device void svm_node_combine_rgb(ShaderData *sd, float *stack, uint in_offset, uint color_index, uint out_offset)
+{
+ float color = stack_load_float(stack, in_offset);
+
+ if (stack_valid(out_offset))
+ stack_store_float(stack, out_offset+color_index, color);
+}
+
+__device void svm_node_separate_rgb(ShaderData *sd, float *stack, uint icolor_offset, uint color_index, uint out_offset)
+{
+ float3 color = stack_load_float3(stack, icolor_offset);
+
+ if (stack_valid(out_offset))
+ stack_store_float(stack, out_offset, color[color_index]);
+}
+
+CCL_NAMESPACE_END
+
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 071477a83c7..cde5e662fa7 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -79,7 +79,9 @@ typedef enum NodeType {
NODE_TEX_ENVIRONMENT = 4600,
NODE_CLOSURE_HOLDOUT = 4700,
NODE_LAYER_WEIGHT = 4800,
- NODE_CLOSURE_VOLUME = 4900
+ NODE_CLOSURE_VOLUME = 4900,
+ NODE_SEPARATE_RGB = 5000,
+ NODE_COMBINE_RGB = 5100
} NodeType;
typedef enum NodeAttributeType {