Cycles: svn merge -r41225:41232 ^/trunk/blender
[blender.git] / intern / cycles / kernel / svm / svm_types.h
1 /*
2  * Copyright 2011, Blender Foundation.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef __SVM_TYPES_H__
20 #define __SVM_TYPES_H__
21
22 CCL_NAMESPACE_BEGIN
23
24 /* Stack */
25
26 /* SVM stack has a fixed size */
27 #define SVM_STACK_SIZE 64
28 /* SVM stack offsets with this value indicate that it's not on the stack */
29 #define SVM_STACK_INVALID 255 
30
31 /* Nodes */
32
33 /* note that we do not simply use 0, 1, 2, .. as values for these. this works
34  * around an obscure CUDA bug that happens when compiling for fermi. why it
35  * happens i have no idea, but consecutive values are problematic, maybe it
36  * generates an incorrect jump table. */
37
38 typedef enum NodeType {
39         NODE_END = 0,
40         NODE_CLOSURE_BSDF = 100,
41         NODE_CLOSURE_EMISSION = 200,
42         NODE_CLOSURE_BACKGROUND = 300,
43         NODE_CLOSURE_SET_WEIGHT = 400,
44         NODE_CLOSURE_WEIGHT = 500,
45         NODE_MIX_CLOSURE = 600,
46         NODE_JUMP = 700,
47         NODE_TEX_NOISE_F = 800,
48         NODE_TEX_NOISE_V = 900,
49         NODE_TEX_IMAGE = 1000,
50         NODE_TEX_SKY = 1100,
51         NODE_GEOMETRY = 1200,
52         NODE_LIGHT_PATH = 1300,
53         NODE_VALUE_F = 1400,
54         NODE_VALUE_V = 1500,
55         NODE_MIX = 1600,
56         NODE_ATTR = 1700,
57         NODE_CONVERT = 1900,
58         NODE_FRESNEL = 2000,
59         NODE_EMISSION_WEIGHT = 2100,
60         NODE_TEX_BLEND = 2200,
61         NODE_TEX_VORONOI = 2300,
62         NODE_TEX_MUSGRAVE = 2400,
63         NODE_TEX_MARBLE = 2500,
64         NODE_TEX_MAGIC = 2600,
65         NODE_TEX_STUCCI = 2700,
66         NODE_TEX_DISTORTED_NOISE = 2800,
67         NODE_TEX_WOOD = 2900,
68         NODE_TEX_CLOUDS = 3000,
69         NODE_SHADER_JUMP = 3100,
70         NODE_SET_DISPLACEMENT = 3200,
71         NODE_GEOMETRY_BUMP_DX = 3300,
72         NODE_GEOMETRY_BUMP_DY = 3400,
73         NODE_SET_BUMP = 3500,
74         NODE_MATH = 3600,
75         NODE_VECTOR_MATH = 3700,
76         NODE_MAPPING = 3800,
77         NODE_TEX_COORD = 3900,
78         NODE_TEX_COORD_BUMP_DX = 4000,
79         NODE_TEX_COORD_BUMP_DY = 4100,
80         NODE_ADD_CLOSURE = 4200,
81         NODE_EMISSION_SET_WEIGHT_TOTAL = 4300,
82         NODE_ATTR_BUMP_DX = 4400,
83         NODE_ATTR_BUMP_DY = 4500,
84         NODE_TEX_ENVIRONMENT = 4600,
85         NODE_CLOSURE_HOLDOUT = 4700,
86         NODE_BLEND_WEIGHT = 4800,
87         NODE_CLOSURE_VOLUME = 4900
88 } NodeType;
89
90 typedef enum NodeAttributeType {
91         NODE_ATTR_FLOAT = 0,
92         NODE_ATTR_FLOAT3
93 } NodeAttributeType;
94
95 typedef enum NodeGeometry {
96         NODE_GEOM_P = 0,
97         NODE_GEOM_N,
98         NODE_GEOM_T,
99         NODE_GEOM_I,
100         NODE_GEOM_Ng,
101         NODE_GEOM_uv
102 } NodeGeometry;
103
104 typedef enum NodeLightPath {
105         NODE_LP_camera = 0,
106         NODE_LP_shadow,
107         NODE_LP_diffuse,
108         NODE_LP_glossy,
109         NODE_LP_singular,
110         NODE_LP_reflection,
111         NODE_LP_transmission,
112         NODE_LP_backfacing
113 } NodeLightPath;
114
115 typedef enum NodeTexCoord {
116         NODE_TEXCO_OBJECT,
117         NODE_TEXCO_CAMERA,
118         NODE_TEXCO_WINDOW,
119         NODE_TEXCO_REFLECTION
120 } NodeTexCoord;
121
122 typedef enum NodeMix {
123         NODE_MIX_BLEND = 0,
124         NODE_MIX_ADD,
125         NODE_MIX_MUL,
126         NODE_MIX_SUB,
127         NODE_MIX_SCREEN,
128         NODE_MIX_DIV,
129         NODE_MIX_DIFF,
130         NODE_MIX_DARK,
131         NODE_MIX_LIGHT,
132         NODE_MIX_OVERLAY,
133         NODE_MIX_DODGE,
134         NODE_MIX_BURN,
135         NODE_MIX_HUE,
136         NODE_MIX_SAT,
137         NODE_MIX_VAL,
138         NODE_MIX_COLOR,
139         NODE_MIX_SOFT,
140         NODE_MIX_LINEAR
141 } NodeMix;
142
143 typedef enum NodeMath {
144         NODE_MATH_ADD,
145         NODE_MATH_SUBTRACT,
146         NODE_MATH_MULTIPLY,
147         NODE_MATH_DIVIDE,
148         NODE_MATH_SINE,
149         NODE_MATH_COSINE,
150         NODE_MATH_TANGENT,
151         NODE_MATH_ARCSINE,
152         NODE_MATH_ARCCOSINE,
153         NODE_MATH_ARCTANGENT,
154         NODE_MATH_POWER,
155         NODE_MATH_LOGARITHM,
156         NODE_MATH_MINIMUM,
157         NODE_MATH_MAXIMUM,
158         NODE_MATH_ROUND,
159         NODE_MATH_LESS_THAN,
160         NODE_MATH_GREATER_THAN
161 } NodeMath;
162
163 typedef enum NodeVectorMath {
164         NODE_VECTOR_MATH_ADD,
165         NODE_VECTOR_MATH_SUBTRACT,
166         NODE_VECTOR_MATH_AVERAGE,
167         NODE_VECTOR_MATH_DOT_PRODUCT,
168         NODE_VECTOR_MATH_CROSS_PRODUCT,
169         NODE_VECTOR_MATH_NORMALIZE
170 } NodeVectorMath;
171
172 typedef enum NodeConvert {
173         NODE_CONVERT_FV,
174         NODE_CONVERT_CF,
175         NODE_CONVERT_VF
176 } NodeConvert;
177
178 typedef enum NodeDistanceMetric {
179         NODE_VORONOI_DISTANCE_SQUARED,
180         NODE_VORONOI_ACTUAL_DISTANCE,
181         NODE_VORONOI_MANHATTAN,
182         NODE_VORONOI_CHEBYCHEV,
183         NODE_VORONOI_MINKOVSKY_H,
184         NODE_VORONOI_MINKOVSKY_4,
185         NODE_VORONOI_MINKOVSKY
186 } NodeDistanceMetric;
187
188 typedef enum NodeNoiseBasis {
189         NODE_NOISE_PERLIN,
190         NODE_NOISE_VORONOI_F1,
191         NODE_NOISE_VORONOI_F2,
192         NODE_NOISE_VORONOI_F3,
193         NODE_NOISE_VORONOI_F4,
194         NODE_NOISE_VORONOI_F2_F1,
195         NODE_NOISE_VORONOI_CRACKLE,
196         NODE_NOISE_CELL_NOISE
197 } NodeNoiseBasis;
198
199 typedef enum NodeWaveType {
200         NODE_WAVE_SINE,
201         NODE_WAVE_SAW,
202         NODE_WAVE_TRI
203 } NodeWaveType;
204
205 typedef enum NodeMusgraveType {
206         NODE_MUSGRAVE_MULTIFRACTAL,
207         NODE_MUSGRAVE_FBM,
208         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
209         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
210         NODE_MUSGRAVE_HETERO_TERRAIN
211 } NodeMusgraveType;
212
213 typedef enum NodeWoodType {
214         NODE_WOOD_BANDS,
215         NODE_WOOD_RINGS,
216         NODE_WOOD_BAND_NOISE,
217         NODE_WOOD_RING_NOISE
218 } NodeWoodType;
219
220 typedef enum NodeBlendType {
221         NODE_BLEND_LINEAR,
222         NODE_BLEND_QUADRATIC,
223         NODE_BLEND_EASING,
224         NODE_BLEND_DIAGONAL,
225         NODE_BLEND_RADIAL,
226         NODE_BLEND_QUADRATIC_SPHERE,
227         NODE_BLEND_SPHERICAL
228 } NodeBlendType;
229
230 typedef enum NodeBlendAxis {
231         NODE_BLEND_HORIZONTAL,
232         NODE_BLEND_VERTICAL
233 } NodeBlendAxis;
234
235 typedef enum NodeMarbleType {
236         NODE_MARBLE_SOFT,
237         NODE_MARBLE_SHARP,
238         NODE_MARBLE_SHARPER
239 } NodeMarbleType;
240
241 typedef enum NodeStucciType {
242         NODE_STUCCI_PLASTIC,
243         NODE_STUCCI_WALL_IN,
244         NODE_STUCCI_WALL_OUT
245 } NodeStucciType;
246
247 typedef enum NodeVoronoiColoring {
248         NODE_VORONOI_INTENSITY,
249         NODE_VORONOI_POSITION,
250         NODE_VORONOI_POSITION_OUTLINE,
251         NODE_VORONOI_POSITION_OUTLINE_INTENSITY
252 } NodeVoronoiColoring;
253
254 typedef enum NodeBlendWeightType {
255         NODE_BLEND_WEIGHT_FRESNEL,
256         NODE_BLEND_WEIGHT_FACING
257 } NodeBlendWeightType;
258
259 typedef enum ShaderType {
260         SHADER_TYPE_SURFACE,
261         SHADER_TYPE_VOLUME,
262         SHADER_TYPE_DISPLACEMENT
263 } ShaderType;
264
265 /* Closure */
266
267 typedef enum ClosureType {
268         CLOSURE_BSDF_ID,
269         CLOSURE_BSDF_DIFFUSE_ID,
270         CLOSURE_BSDF_TRANSLUCENT_ID,
271         CLOSURE_BSDF_REFLECTION_ID,
272         CLOSURE_BSDF_REFRACTION_ID,
273         CLOSURE_BSDF_GLASS_ID,
274         CLOSURE_BSDF_TRANSPARENT_ID,
275         CLOSURE_BSDF_MICROFACET_GGX_ID,
276         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
277         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
278         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
279         CLOSURE_BSDF_WARD_ID,
280         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
281         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
282         CLOSURE_BSDF_WESTIN_SHEEN_ID,
283
284         CLOSURE_BSSRDF_CUBIC_ID,
285         CLOSURE_EMISSION_ID,
286         CLOSURE_DEBUG_ID,
287         CLOSURE_BACKGROUND_ID,
288         CLOSURE_HOLDOUT_ID,
289         CLOSURE_SUBSURFACE_ID,
290
291         CLOSURE_VOLUME_ID,
292         CLOSURE_VOLUME_TRANSPARENT_ID,
293         CLOSURE_VOLUME_ISOTROPIC_ID,
294
295         NBUILTIN_CLOSURES
296 } ClosureType;
297
298 /* watch this, being lazy with memory usage */
299 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
300 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
301 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
302 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
303 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
304
305 CCL_NAMESPACE_END
306
307 #endif /*  __SVM_TYPES_H__ */
308