Brightness/Contrast Node for Cycles
[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_IMAGE = 1000,
48         NODE_TEX_SKY = 1100,
49         NODE_GEOMETRY = 1200,
50         NODE_LIGHT_PATH = 1300,
51         NODE_VALUE_F = 1400,
52         NODE_VALUE_V = 1500,
53         NODE_MIX = 1600,
54         NODE_ATTR = 1700,
55         NODE_CONVERT = 1900,
56         NODE_FRESNEL = 2000,
57         NODE_EMISSION_WEIGHT = 2100,
58         NODE_TEX_GRADIENT = 2200,
59         NODE_TEX_VORONOI = 2300,
60         NODE_TEX_MUSGRAVE = 2400,
61         NODE_TEX_WAVE = 2500,
62         NODE_TEX_MAGIC = 2600,
63         NODE_TEX_NOISE = 3000,
64         NODE_SHADER_JUMP = 3100,
65         NODE_SET_DISPLACEMENT = 3200,
66         NODE_GEOMETRY_BUMP_DX = 3300,
67         NODE_GEOMETRY_BUMP_DY = 3400,
68         NODE_SET_BUMP = 3500,
69         NODE_MATH = 3600,
70         NODE_VECTOR_MATH = 3700,
71         NODE_MAPPING = 3800,
72         NODE_TEX_COORD = 3900,
73         NODE_TEX_COORD_BUMP_DX = 4000,
74         NODE_TEX_COORD_BUMP_DY = 4100,
75         NODE_ADD_CLOSURE = 4200,
76         NODE_EMISSION_SET_WEIGHT_TOTAL = 4300,
77         NODE_ATTR_BUMP_DX = 4400,
78         NODE_ATTR_BUMP_DY = 4500,
79         NODE_TEX_ENVIRONMENT = 4600,
80         NODE_CLOSURE_HOLDOUT = 4700,
81         NODE_LAYER_WEIGHT = 4800,
82         NODE_CLOSURE_VOLUME = 4900,
83         NODE_SEPARATE_RGB = 5000,
84         NODE_COMBINE_RGB = 5100,
85         NODE_HSV = 5200,
86         NODE_CAMERA = 5300,
87         NODE_INVERT = 5400,
88         NODE_NORMAL = 5500,
89         NODE_GAMMA = 5600,
90         NODE_TEX_CHECKER = 5700,
91         NODE_BRIGHTCONTRAST = 5800
92 } NodeType;
93
94 typedef enum NodeAttributeType {
95         NODE_ATTR_FLOAT = 0,
96         NODE_ATTR_FLOAT3
97 } NodeAttributeType;
98
99 typedef enum NodeGeometry {
100         NODE_GEOM_P = 0,
101         NODE_GEOM_N,
102         NODE_GEOM_T,
103         NODE_GEOM_I,
104         NODE_GEOM_Ng,
105         NODE_GEOM_uv
106 } NodeGeometry;
107
108 typedef enum NodeLightPath {
109         NODE_LP_camera = 0,
110         NODE_LP_shadow,
111         NODE_LP_diffuse,
112         NODE_LP_glossy,
113         NODE_LP_singular,
114         NODE_LP_reflection,
115         NODE_LP_transmission,
116         NODE_LP_backfacing
117 } NodeLightPath;
118
119 typedef enum NodeTexCoord {
120         NODE_TEXCO_OBJECT,
121         NODE_TEXCO_CAMERA,
122         NODE_TEXCO_WINDOW,
123         NODE_TEXCO_REFLECTION
124 } NodeTexCoord;
125
126 typedef enum NodeMix {
127         NODE_MIX_BLEND = 0,
128         NODE_MIX_ADD,
129         NODE_MIX_MUL,
130         NODE_MIX_SUB,
131         NODE_MIX_SCREEN,
132         NODE_MIX_DIV,
133         NODE_MIX_DIFF,
134         NODE_MIX_DARK,
135         NODE_MIX_LIGHT,
136         NODE_MIX_OVERLAY,
137         NODE_MIX_DODGE,
138         NODE_MIX_BURN,
139         NODE_MIX_HUE,
140         NODE_MIX_SAT,
141         NODE_MIX_VAL,
142         NODE_MIX_COLOR,
143         NODE_MIX_SOFT,
144         NODE_MIX_LINEAR
145 } NodeMix;
146
147 typedef enum NodeMath {
148         NODE_MATH_ADD,
149         NODE_MATH_SUBTRACT,
150         NODE_MATH_MULTIPLY,
151         NODE_MATH_DIVIDE,
152         NODE_MATH_SINE,
153         NODE_MATH_COSINE,
154         NODE_MATH_TANGENT,
155         NODE_MATH_ARCSINE,
156         NODE_MATH_ARCCOSINE,
157         NODE_MATH_ARCTANGENT,
158         NODE_MATH_POWER,
159         NODE_MATH_LOGARITHM,
160         NODE_MATH_MINIMUM,
161         NODE_MATH_MAXIMUM,
162         NODE_MATH_ROUND,
163         NODE_MATH_LESS_THAN,
164         NODE_MATH_GREATER_THAN
165 } NodeMath;
166
167 typedef enum NodeVectorMath {
168         NODE_VECTOR_MATH_ADD,
169         NODE_VECTOR_MATH_SUBTRACT,
170         NODE_VECTOR_MATH_AVERAGE,
171         NODE_VECTOR_MATH_DOT_PRODUCT,
172         NODE_VECTOR_MATH_CROSS_PRODUCT,
173         NODE_VECTOR_MATH_NORMALIZE
174 } NodeVectorMath;
175
176 typedef enum NodeConvert {
177         NODE_CONVERT_FV,
178         NODE_CONVERT_CF,
179         NODE_CONVERT_VF
180 } NodeConvert;
181
182 typedef enum NodeDistanceMetric {
183         NODE_VORONOI_DISTANCE_SQUARED,
184         NODE_VORONOI_ACTUAL_DISTANCE,
185         NODE_VORONOI_MANHATTAN,
186         NODE_VORONOI_CHEBYCHEV,
187         NODE_VORONOI_MINKOVSKY_H,
188         NODE_VORONOI_MINKOVSKY_4,
189         NODE_VORONOI_MINKOVSKY
190 } NodeDistanceMetric;
191
192 typedef enum NodeNoiseBasis {
193         NODE_NOISE_PERLIN,
194         NODE_NOISE_VORONOI_F1,
195         NODE_NOISE_VORONOI_F2,
196         NODE_NOISE_VORONOI_F3,
197         NODE_NOISE_VORONOI_F4,
198         NODE_NOISE_VORONOI_F2_F1,
199         NODE_NOISE_VORONOI_CRACKLE,
200         NODE_NOISE_CELL_NOISE
201 } NodeNoiseBasis;
202
203 typedef enum NodeWaveType {
204         NODE_WAVE_SINE,
205         NODE_WAVE_SAW,
206         NODE_WAVE_TRI
207 } NodeWaveType;
208
209 typedef enum NodeMusgraveType {
210         NODE_MUSGRAVE_MULTIFRACTAL,
211         NODE_MUSGRAVE_FBM,
212         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
213         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
214         NODE_MUSGRAVE_HETERO_TERRAIN
215 } NodeMusgraveType;
216
217 typedef enum NodeWoodType {
218         NODE_WAVE_BANDS,
219         NODE_WAVE_RINGS
220 } NodeWoodType;
221
222 typedef enum NodeBlendType {
223         NODE_BLEND_LINEAR,
224         NODE_BLEND_QUADRATIC,
225         NODE_BLEND_EASING,
226         NODE_BLEND_DIAGONAL,
227         NODE_BLEND_RADIAL,
228         NODE_BLEND_QUADRATIC_SPHERE,
229         NODE_BLEND_SPHERICAL
230 } NodeBlendType;
231
232 typedef enum NodeBlendAxis {
233         NODE_BLEND_HORIZONTAL,
234         NODE_BLEND_VERTICAL
235 } NodeBlendAxis;
236
237 typedef enum NodeMarbleType {
238         NODE_MARBLE_SOFT,
239         NODE_MARBLE_SHARP,
240         NODE_MARBLE_SHARPER
241 } NodeMarbleType;
242
243 typedef enum NodeStucciType {
244         NODE_STUCCI_PLASTIC,
245         NODE_STUCCI_WALL_IN,
246         NODE_STUCCI_WALL_OUT
247 } NodeStucciType;
248
249 typedef enum NodeVoronoiColoring {
250         NODE_VORONOI_INTENSITY,
251         NODE_VORONOI_CELLS
252 } NodeVoronoiColoring;
253
254 typedef enum NodeBlendWeightType {
255         NODE_LAYER_WEIGHT_FRESNEL,
256         NODE_LAYER_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_OREN_NAYAR_ID,
271         CLOSURE_BSDF_TRANSLUCENT_ID,
272         CLOSURE_BSDF_REFLECTION_ID,
273         CLOSURE_BSDF_REFRACTION_ID,
274         CLOSURE_BSDF_GLASS_ID,
275         CLOSURE_BSDF_TRANSPARENT_ID,
276         CLOSURE_BSDF_MICROFACET_GGX_ID,
277         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
278         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
279         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
280         CLOSURE_BSDF_WARD_ID,
281         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
282         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
283         CLOSURE_BSDF_WESTIN_SHEEN_ID,
284
285         CLOSURE_BSSRDF_CUBIC_ID,
286         CLOSURE_EMISSION_ID,
287         CLOSURE_DEBUG_ID,
288         CLOSURE_BACKGROUND_ID,
289         CLOSURE_HOLDOUT_ID,
290         CLOSURE_SUBSURFACE_ID,
291
292         CLOSURE_VOLUME_ID,
293         CLOSURE_VOLUME_TRANSPARENT_ID,
294         CLOSURE_VOLUME_ISOTROPIC_ID,
295
296         NBUILTIN_CLOSURES
297 } ClosureType;
298
299 /* watch this, being lazy with memory usage */
300 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
301 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
302 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
303 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
304 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
305
306 CCL_NAMESPACE_END
307
308 #endif /*  __SVM_TYPES_H__ */
309