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:
authorThomas Dinges <blender@dingto.org>2014-06-14 14:28:49 +0400
committerThomas Dinges <blender@dingto.org>2014-06-14 14:29:15 +0400
commit0c1b4c35cdf5e8d1c9f3a8dfb990813f914fda59 (patch)
tree3f4a699c887bccd577aa8f4eb97379296e7642e3 /intern/cycles/kernel/svm
parent8ccf9993cfb87ff2646fbc8107d752c18540a1d5 (diff)
Code cleanup: Avoid duplicate functions for vector combination/separation in SVM.
Differential Revision: https://developer.blender.org/D597
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r--intern/cycles/kernel/svm/svm.h17
-rw-r--r--intern/cycles/kernel/svm/svm_sepcomb_rgb.h42
-rw-r--r--intern/cycles/kernel/svm/svm_sepcomb_vector.h (renamed from intern/cycles/kernel/svm/svm_sepcomb_xyz.h)6
-rw-r--r--intern/cycles/kernel/svm/svm_types.h6
4 files changed, 11 insertions, 60 deletions
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index acdc5183e18..d6663aae9db 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -167,9 +167,8 @@ CCL_NAMESPACE_END
#include "svm_math.h"
#include "svm_mix.h"
#include "svm_ramp.h"
-#include "svm_sepcomb_rgb.h"
#include "svm_sepcomb_hsv.h"
-#include "svm_sepcomb_xyz.h"
+#include "svm_sepcomb_vector.h"
#include "svm_musgrave.h"
#include "svm_sky.h"
#include "svm_tex_coord.h"
@@ -328,17 +327,11 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, Shade
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);
+ case NODE_SEPARATE_VECTOR:
+ svm_node_separate_vector(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_SEPARATE_XYZ:
- svm_node_separate_xyz(sd, stack, node.y, node.z, node.w);
- break;
- case NODE_COMBINE_XYZ:
- svm_node_combine_xyz(sd, stack, node.y, node.z, node.w);
+ case NODE_COMBINE_VECTOR:
+ svm_node_combine_vector(sd, stack, node.y, node.z, node.w);
break;
case NODE_SEPARATE_HSV:
svm_node_separate_hsv(kg, sd, stack, node.y, node.z, node.w, &offset);
diff --git a/intern/cycles/kernel/svm/svm_sepcomb_rgb.h b/intern/cycles/kernel/svm/svm_sepcomb_rgb.h
deleted file mode 100644
index 34c4449ecdb..00000000000
--- a/intern/cycles/kernel/svm/svm_sepcomb_rgb.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011-2013 Blender Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-CCL_NAMESPACE_BEGIN
-
-ccl_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);
-}
-
-ccl_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)) {
- 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
-
diff --git a/intern/cycles/kernel/svm/svm_sepcomb_xyz.h b/intern/cycles/kernel/svm/svm_sepcomb_vector.h
index f9f966451fd..c8e7e34f87d 100644
--- a/intern/cycles/kernel/svm/svm_sepcomb_xyz.h
+++ b/intern/cycles/kernel/svm/svm_sepcomb_vector.h
@@ -16,7 +16,9 @@
CCL_NAMESPACE_BEGIN
-ccl_device void svm_node_combine_xyz(ShaderData *sd, float *stack, uint in_offset, uint vector_index, uint out_offset)
+/* Vector combine / separate, used for the RGB and XYZ nodes */
+
+ccl_device void svm_node_combine_vector(ShaderData *sd, float *stack, uint in_offset, uint vector_index, uint out_offset)
{
float vector = stack_load_float(stack, in_offset);
@@ -24,7 +26,7 @@ ccl_device void svm_node_combine_xyz(ShaderData *sd, float *stack, uint in_offse
stack_store_float(stack, out_offset+vector_index, vector);
}
-ccl_device void svm_node_separate_xyz(ShaderData *sd, float *stack, uint ivector_offset, uint vector_index, uint out_offset)
+ccl_device void svm_node_separate_vector(ShaderData *sd, float *stack, uint ivector_offset, uint vector_index, uint out_offset)
{
float3 vector = stack_load_float3(stack, ivector_offset);
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 29a0d264237..20c799e1805 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -78,10 +78,8 @@ typedef enum NodeType {
NODE_CLOSURE_HOLDOUT,
NODE_LAYER_WEIGHT,
NODE_CLOSURE_VOLUME,
- NODE_SEPARATE_RGB,
- NODE_COMBINE_RGB,
- NODE_SEPARATE_XYZ,
- NODE_COMBINE_XYZ,
+ NODE_SEPARATE_VECTOR,
+ NODE_COMBINE_VECTOR,
NODE_SEPARATE_HSV,
NODE_COMBINE_HSV,
NODE_HSV,