2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* 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
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* 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
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SVM_H__
|
|
|
|
#define __SVM_H__
|
|
|
|
|
|
|
|
/* Shader Virtual Machine
|
|
|
|
*
|
|
|
|
* A shader is a list of nodes to be executed. These are simply read one after
|
|
|
|
* the other and executed, using an node counter. Each node and it's associated
|
|
|
|
* data is encoded as one or more uint4's in a 1D texture. If the data is larger
|
|
|
|
* than an uint4, the node can increase the node counter to compensate for this.
|
|
|
|
* Floats are encoded as int and then converted to float again.
|
|
|
|
*
|
|
|
|
* Nodes write their output into a stack. All stack data in the stack is
|
|
|
|
* floats, since it's all factors, colors and vectors. The stack will be stored
|
|
|
|
* in local memory on the GPU, as it would take too many register and indexes in
|
|
|
|
* ways not known at compile time. This seems the only solution even though it
|
|
|
|
* may be slow, with two positive factors. If the same shader is being executed,
|
|
|
|
* memory access will be coalesced, and on fermi cards, memory will actually be
|
|
|
|
* cached.
|
|
|
|
*
|
|
|
|
* The result of shader execution will be a single closure. This means the
|
|
|
|
* closure type, associated label, data and weight. Sampling from multiple
|
|
|
|
* closures is supported through the mix closure node, the logic for that is
|
|
|
|
* mostly taken care of in the SVM compiler.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "svm_types.h"
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/* Stack */
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline float3 stack_load_float3(float *stack, uint a)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
kernel_assert(a+2 < SVM_STACK_SIZE);
|
|
|
|
|
|
|
|
return make_float3(stack[a+0], stack[a+1], stack[a+2]);
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void stack_store_float3(float *stack, uint a, float3 f)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
kernel_assert(a+2 < SVM_STACK_SIZE);
|
|
|
|
|
|
|
|
stack[a+0] = f.x;
|
|
|
|
stack[a+1] = f.y;
|
|
|
|
stack[a+2] = f.z;
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline float stack_load_float(float *stack, uint a)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
kernel_assert(a < SVM_STACK_SIZE);
|
|
|
|
|
|
|
|
return stack[a];
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline float stack_load_float_default(float *stack, uint a, uint value)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2013-06-07 16:06:17 +00:00
|
|
|
return (a == (uint)SVM_STACK_INVALID)? __uint_as_float(value): stack_load_float(stack, a);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void stack_store_float(float *stack, uint a, float f)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
kernel_assert(a < SVM_STACK_SIZE);
|
|
|
|
|
|
|
|
stack[a] = f;
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline int stack_load_int(float *stack, uint a)
|
2012-10-20 13:11:45 +00:00
|
|
|
{
|
|
|
|
kernel_assert(a < SVM_STACK_SIZE);
|
|
|
|
|
|
|
|
return __float_as_int(stack[a]);
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline float stack_load_int_default(float *stack, uint a, uint value)
|
2012-10-20 13:11:45 +00:00
|
|
|
{
|
|
|
|
return (a == (uint)SVM_STACK_INVALID)? (int)value: stack_load_int(stack, a);
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void stack_store_int(float *stack, uint a, int i)
|
2012-10-20 13:11:45 +00:00
|
|
|
{
|
|
|
|
kernel_assert(a < SVM_STACK_SIZE);
|
|
|
|
|
|
|
|
stack[a] = __int_as_float(i);
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline bool stack_valid(uint a)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
return a != (uint)SVM_STACK_INVALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Reading Nodes */
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline uint4 read_node(KernelGlobals *kg, int *offset)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
uint4 node = kernel_tex_fetch(__svm_nodes, *offset);
|
|
|
|
(*offset)++;
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline float4 read_node_float(KernelGlobals *kg, int *offset)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
uint4 node = kernel_tex_fetch(__svm_nodes, *offset);
|
2013-06-07 16:06:17 +00:00
|
|
|
float4 f = make_float4(__uint_as_float(node.x), __uint_as_float(node.y), __uint_as_float(node.z), __uint_as_float(node.w));
|
2011-04-27 11:58:34 +00:00
|
|
|
(*offset)++;
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline float4 fetch_node_float(KernelGlobals *kg, int offset)
|
2012-03-26 12:45:14 +00:00
|
|
|
{
|
|
|
|
uint4 node = kernel_tex_fetch(__svm_nodes, offset);
|
2013-06-07 16:06:17 +00:00
|
|
|
return make_float4(__uint_as_float(node.x), __uint_as_float(node.y), __uint_as_float(node.z), __uint_as_float(node.w));
|
2012-03-26 12:45:14 +00:00
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void decode_node_uchar4(uint i, uint *x, uint *y, uint *z, uint *w)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
if(x) *x = (i & 0xFF);
|
|
|
|
if(y) *y = ((i >> 8) & 0xFF);
|
|
|
|
if(z) *z = ((i >> 16) & 0xFF);
|
|
|
|
if(w) *w = ((i >> 24) & 0xFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
/* Nodes */
|
|
|
|
|
|
|
|
#include "svm_noise.h"
|
|
|
|
#include "svm_texture.h"
|
|
|
|
|
|
|
|
#include "svm_attribute.h"
|
2011-11-06 21:05:58 +00:00
|
|
|
#include "svm_gradient.h"
|
2013-06-15 23:47:09 +00:00
|
|
|
#include "svm_blackbody.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_closure.h"
|
2011-11-06 21:05:58 +00:00
|
|
|
#include "svm_noisetex.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_convert.h"
|
|
|
|
#include "svm_displace.h"
|
|
|
|
#include "svm_fresnel.h"
|
2013-05-20 15:58:37 +00:00
|
|
|
#include "svm_wireframe.h"
|
2013-06-09 20:46:22 +00:00
|
|
|
#include "svm_wavelength.h"
|
2011-12-02 20:36:13 +00:00
|
|
|
#include "svm_camera.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_geometry.h"
|
2011-12-02 16:57:37 +00:00
|
|
|
#include "svm_hsv.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_image.h"
|
2011-12-16 20:35:06 +00:00
|
|
|
#include "svm_gamma.h"
|
2012-01-24 16:32:31 +00:00
|
|
|
#include "svm_brightness.h"
|
2011-12-03 23:05:35 +00:00
|
|
|
#include "svm_invert.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_light_path.h"
|
|
|
|
#include "svm_magic.h"
|
|
|
|
#include "svm_mapping.h"
|
2011-12-16 18:15:07 +00:00
|
|
|
#include "svm_normal.h"
|
2011-11-06 21:05:58 +00:00
|
|
|
#include "svm_wave.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_math.h"
|
|
|
|
#include "svm_mix.h"
|
2012-03-26 12:45:14 +00:00
|
|
|
#include "svm_ramp.h"
|
2013-07-03 23:46:56 +00:00
|
|
|
#include "svm_sepcomb_hsv.h"
|
2014-06-14 10:28:49 +00:00
|
|
|
#include "svm_sepcomb_vector.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "svm_musgrave.h"
|
|
|
|
#include "svm_sky.h"
|
|
|
|
#include "svm_tex_coord.h"
|
|
|
|
#include "svm_value.h"
|
|
|
|
#include "svm_voronoi.h"
|
2012-01-08 14:55:43 +00:00
|
|
|
#include "svm_checker.h"
|
2012-09-04 13:29:07 +00:00
|
|
|
#include "svm_brick.h"
|
2013-06-23 17:51:08 +00:00
|
|
|
#include "svm_vector_transform.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/* Main Interpreter Loop */
|
|
|
|
|
2014-04-21 13:53:20 +00:00
|
|
|
ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderType type, int path_flag)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
float stack[SVM_STACK_SIZE];
|
2011-09-27 20:37:24 +00:00
|
|
|
int offset = sd->shader & SHADER_MASK;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
while(1) {
|
|
|
|
uint4 node = read_node(kg, &offset);
|
|
|
|
|
2011-08-29 17:17:40 +00:00
|
|
|
switch(node.x) {
|
|
|
|
case NODE_SHADER_JUMP: {
|
2011-10-12 23:03:12 +00:00
|
|
|
if(type == SHADER_TYPE_SURFACE) offset = node.y;
|
|
|
|
else if(type == SHADER_TYPE_VOLUME) offset = node.z;
|
2011-08-29 17:17:40 +00:00
|
|
|
else if(type == SHADER_TYPE_DISPLACEMENT) offset = node.w;
|
|
|
|
else return;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case NODE_CLOSURE_BSDF:
|
2014-04-21 13:53:20 +00:00
|
|
|
svm_node_closure_bsdf(kg, sd, stack, node, path_flag, &offset);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_CLOSURE_EMISSION:
|
2011-09-12 13:13:56 +00:00
|
|
|
svm_node_closure_emission(sd, stack, node);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_CLOSURE_BACKGROUND:
|
2011-10-19 00:13:41 +00:00
|
|
|
svm_node_closure_background(sd, stack, node);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_CLOSURE_HOLDOUT:
|
2011-09-12 13:13:56 +00:00
|
|
|
svm_node_closure_holdout(sd, stack, node);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-11-06 19:59:02 +00:00
|
|
|
case NODE_CLOSURE_AMBIENT_OCCLUSION:
|
|
|
|
svm_node_closure_ambient_occlusion(sd, stack, node);
|
|
|
|
break;
|
2011-09-27 20:03:16 +00:00
|
|
|
case NODE_CLOSURE_VOLUME:
|
|
|
|
svm_node_closure_volume(kg, sd, stack, node, path_flag);
|
|
|
|
break;
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_CLOSURE_SET_WEIGHT:
|
|
|
|
svm_node_closure_set_weight(sd, node.y, node.z, node.w);
|
|
|
|
break;
|
|
|
|
case NODE_CLOSURE_WEIGHT:
|
|
|
|
svm_node_closure_weight(sd, stack, node.y);
|
|
|
|
break;
|
|
|
|
case NODE_EMISSION_WEIGHT:
|
|
|
|
svm_node_emission_weight(kg, sd, stack, node);
|
|
|
|
break;
|
|
|
|
case NODE_MIX_CLOSURE:
|
2014-04-21 13:53:20 +00:00
|
|
|
svm_node_mix_closure(sd, stack, node);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2014-04-18 11:40:30 +00:00
|
|
|
case NODE_JUMP_IF_ZERO:
|
|
|
|
if(stack_load_float(stack, node.z) == 0.0f)
|
|
|
|
offset += node.y;
|
|
|
|
break;
|
|
|
|
case NODE_JUMP_IF_ONE:
|
|
|
|
if(stack_load_float(stack, node.z) == 1.0f)
|
|
|
|
offset += node.y;
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#ifdef __IMAGE_TEXTURES__
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_TEX_IMAGE:
|
|
|
|
svm_node_tex_image(kg, sd, stack, node);
|
|
|
|
break;
|
2012-09-04 13:29:07 +00:00
|
|
|
case NODE_TEX_IMAGE_BOX:
|
|
|
|
svm_node_tex_image_box(kg, sd, stack, node);
|
|
|
|
break;
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_TEX_ENVIRONMENT:
|
|
|
|
svm_node_tex_environment(kg, sd, stack, node);
|
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __PROCEDURAL_TEXTURES__
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_TEX_SKY:
|
2013-08-28 14:11:28 +00:00
|
|
|
svm_node_tex_sky(kg, sd, stack, node, &offset);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2011-11-06 21:05:58 +00:00
|
|
|
case NODE_TEX_GRADIENT:
|
|
|
|
svm_node_tex_gradient(sd, stack, node);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2011-11-06 21:05:58 +00:00
|
|
|
case NODE_TEX_NOISE:
|
|
|
|
svm_node_tex_noise(kg, sd, stack, node, &offset);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_TEX_VORONOI:
|
|
|
|
svm_node_tex_voronoi(kg, sd, stack, node, &offset);
|
|
|
|
break;
|
|
|
|
case NODE_TEX_MUSGRAVE:
|
|
|
|
svm_node_tex_musgrave(kg, sd, stack, node, &offset);
|
|
|
|
break;
|
2011-11-06 21:05:58 +00:00
|
|
|
case NODE_TEX_WAVE:
|
|
|
|
svm_node_tex_wave(kg, sd, stack, node, &offset);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_TEX_MAGIC:
|
2011-11-06 21:05:58 +00:00
|
|
|
svm_node_tex_magic(kg, sd, stack, node, &offset);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-01-08 14:55:43 +00:00
|
|
|
case NODE_TEX_CHECKER:
|
2013-05-20 00:26:48 +00:00
|
|
|
svm_node_tex_checker(kg, sd, stack, node);
|
2012-01-08 14:55:43 +00:00
|
|
|
break;
|
2012-09-04 13:29:07 +00:00
|
|
|
case NODE_TEX_BRICK:
|
|
|
|
svm_node_tex_brick(kg, sd, stack, node, &offset);
|
|
|
|
break;
|
2011-04-27 11:58:34 +00:00
|
|
|
#endif
|
2011-12-02 20:36:13 +00:00
|
|
|
case NODE_CAMERA:
|
|
|
|
svm_node_camera(kg, sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_GEOMETRY:
|
2012-10-10 13:02:20 +00:00
|
|
|
svm_node_geometry(kg, sd, stack, node.y, node.z);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#ifdef __EXTRA_NODES__
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_GEOMETRY_BUMP_DX:
|
2012-10-10 13:02:20 +00:00
|
|
|
svm_node_geometry_bump_dx(kg, sd, stack, node.y, node.z);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_GEOMETRY_BUMP_DY:
|
2012-10-10 13:02:20 +00:00
|
|
|
svm_node_geometry_bump_dy(kg, sd, stack, node.y, node.z);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_LIGHT_PATH:
|
|
|
|
svm_node_light_path(sd, stack, node.y, node.z, path_flag);
|
|
|
|
break;
|
2012-05-21 12:52:28 +00:00
|
|
|
case NODE_OBJECT_INFO:
|
|
|
|
svm_node_object_info(kg, sd, stack, node.y, node.z);
|
2012-06-08 16:17:57 +00:00
|
|
|
break;
|
|
|
|
case NODE_PARTICLE_INFO:
|
|
|
|
svm_node_particle_info(kg, sd, stack, node.y, node.z);
|
2012-05-21 12:52:28 +00:00
|
|
|
break;
|
2012-12-28 14:21:30 +00:00
|
|
|
#ifdef __HAIR__
|
|
|
|
case NODE_HAIR_INFO:
|
|
|
|
svm_node_hair_info(kg, sd, stack, node.y, node.z);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2012-05-13 12:32:44 +00:00
|
|
|
#endif
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_CONVERT:
|
|
|
|
svm_node_convert(sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
|
|
|
case NODE_VALUE_F:
|
|
|
|
svm_node_value_f(kg, sd, stack, node.y, node.z);
|
|
|
|
break;
|
|
|
|
case NODE_VALUE_V:
|
|
|
|
svm_node_value_v(kg, sd, stack, node.y, &offset);
|
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#ifdef __EXTRA_NODES__
|
2011-12-03 23:05:35 +00:00
|
|
|
case NODE_INVERT:
|
|
|
|
svm_node_invert(sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
2011-12-16 20:35:06 +00:00
|
|
|
case NODE_GAMMA:
|
|
|
|
svm_node_gamma(sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
2012-01-24 16:32:31 +00:00
|
|
|
case NODE_BRIGHTCONTRAST:
|
|
|
|
svm_node_brightness(sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_MIX:
|
|
|
|
svm_node_mix(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
2014-06-14 10:28:49 +00:00
|
|
|
case NODE_SEPARATE_VECTOR:
|
|
|
|
svm_node_separate_vector(sd, stack, node.y, node.z, node.w);
|
2011-12-01 21:46:10 +00:00
|
|
|
break;
|
2014-06-14 10:28:49 +00:00
|
|
|
case NODE_COMBINE_VECTOR:
|
|
|
|
svm_node_combine_vector(sd, stack, node.y, node.z, node.w);
|
2014-06-13 19:44:48 +00:00
|
|
|
break;
|
2013-07-03 23:46:56 +00:00
|
|
|
case NODE_SEPARATE_HSV:
|
|
|
|
svm_node_separate_hsv(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
|
|
|
case NODE_COMBINE_HSV:
|
|
|
|
svm_node_combine_hsv(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
2011-12-02 16:57:37 +00:00
|
|
|
case NODE_HSV:
|
|
|
|
svm_node_hsv(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#endif
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_ATTR:
|
|
|
|
svm_node_attr(kg, sd, stack, node);
|
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#ifdef __EXTRA_NODES__
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_ATTR_BUMP_DX:
|
|
|
|
svm_node_attr_bump_dx(kg, sd, stack, node);
|
|
|
|
break;
|
|
|
|
case NODE_ATTR_BUMP_DY:
|
|
|
|
svm_node_attr_bump_dy(kg, sd, stack, node);
|
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#endif
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_FRESNEL:
|
|
|
|
svm_node_fresnel(sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
2011-11-06 21:05:58 +00:00
|
|
|
case NODE_LAYER_WEIGHT:
|
|
|
|
svm_node_layer_weight(sd, stack, node);
|
2011-09-16 13:14:02 +00:00
|
|
|
break;
|
2013-06-14 14:29:00 +00:00
|
|
|
#ifdef __EXTRA_NODES__
|
2013-05-20 15:58:37 +00:00
|
|
|
case NODE_WIREFRAME:
|
|
|
|
svm_node_wireframe(kg, sd, stack, node.y, node.z, node.w);
|
|
|
|
break;
|
2013-06-09 20:46:22 +00:00
|
|
|
case NODE_WAVELENGTH:
|
|
|
|
svm_node_wavelength(sd, stack, node.y, node.z);
|
|
|
|
break;
|
2013-06-15 23:47:09 +00:00
|
|
|
case NODE_BLACKBODY:
|
|
|
|
svm_node_blackbody(kg, sd, stack, node.y, node.z);
|
|
|
|
break;
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_SET_DISPLACEMENT:
|
|
|
|
svm_node_set_displacement(sd, stack, node.y);
|
|
|
|
break;
|
|
|
|
case NODE_SET_BUMP:
|
2012-10-10 15:56:43 +00:00
|
|
|
svm_node_set_bump(kg, sd, stack, node);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_MATH:
|
|
|
|
svm_node_math(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
|
|
|
case NODE_VECTOR_MATH:
|
|
|
|
svm_node_vector_math(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
2013-06-23 17:51:08 +00:00
|
|
|
case NODE_VECTOR_TRANSFORM:
|
|
|
|
svm_node_vector_transform(kg, sd, stack, node);
|
|
|
|
break;
|
2011-12-16 18:15:07 +00:00
|
|
|
case NODE_NORMAL:
|
|
|
|
svm_node_normal(kg, sd, stack, node.y, node.z, node.w, &offset);
|
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#endif
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_MAPPING:
|
|
|
|
svm_node_mapping(kg, sd, stack, node.y, node.z, &offset);
|
|
|
|
break;
|
2012-05-07 20:24:38 +00:00
|
|
|
case NODE_MIN_MAX:
|
|
|
|
svm_node_min_max(kg, sd, stack, node.y, node.z, &offset);
|
|
|
|
break;
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_TEX_COORD:
|
2013-06-08 10:51:33 +00:00
|
|
|
svm_node_tex_coord(kg, sd, path_flag, stack, node.y, node.z);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-05-13 12:32:44 +00:00
|
|
|
#ifdef __EXTRA_NODES__
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_TEX_COORD_BUMP_DX:
|
2013-06-08 10:51:33 +00:00
|
|
|
svm_node_tex_coord_bump_dx(kg, sd, path_flag, stack, node.y, node.z);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
|
|
|
case NODE_TEX_COORD_BUMP_DY:
|
2013-06-08 10:51:33 +00:00
|
|
|
svm_node_tex_coord_bump_dy(kg, sd, path_flag, stack, node.y, node.z);
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-10-10 15:56:43 +00:00
|
|
|
case NODE_CLOSURE_SET_NORMAL:
|
|
|
|
svm_node_set_normal(kg, sd, stack, node.y, node.z );
|
2011-08-29 17:17:40 +00:00
|
|
|
break;
|
2012-03-26 12:45:14 +00:00
|
|
|
case NODE_RGB_RAMP:
|
|
|
|
svm_node_rgb_ramp(kg, sd, stack, node, &offset);
|
|
|
|
break;
|
|
|
|
case NODE_RGB_CURVES:
|
|
|
|
svm_node_rgb_curves(kg, sd, stack, node, &offset);
|
|
|
|
break;
|
2012-12-11 14:39:37 +00:00
|
|
|
case NODE_VECTOR_CURVES:
|
|
|
|
svm_node_vector_curves(kg, sd, stack, node, &offset);
|
|
|
|
break;
|
2012-05-07 20:24:38 +00:00
|
|
|
case NODE_LIGHT_FALLOFF:
|
|
|
|
svm_node_light_falloff(sd, stack, node);
|
|
|
|
break;
|
2012-11-30 07:27:17 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __ANISOTROPIC__
|
2012-11-06 19:59:02 +00:00
|
|
|
case NODE_TANGENT:
|
|
|
|
svm_node_tangent(kg, sd, stack, node);
|
|
|
|
break;
|
2012-11-30 07:27:17 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __NORMAL_MAP__
|
2012-11-06 19:59:02 +00:00
|
|
|
case NODE_NORMAL_MAP:
|
|
|
|
svm_node_normal_map(kg, sd, stack, node);
|
|
|
|
break;
|
2012-10-10 15:56:43 +00:00
|
|
|
#endif
|
2011-08-29 17:17:40 +00:00
|
|
|
case NODE_END:
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif /* __SVM_H__ */
|
|
|
|
|