Blender  V2.93
kernel_types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __KERNEL_TYPES_H__
18 #define __KERNEL_TYPES_H__
19 
20 #if !defined(__KERNEL_GPU__) && defined(WITH_EMBREE)
21 # include <embree3/rtcore.h>
22 # include <embree3/rtcore_scene.h>
23 # define __EMBREE__
24 #endif
25 
26 #include "kernel/kernel_math.h"
27 #include "kernel/svm/svm_types.h"
29 
30 #ifndef __KERNEL_GPU__
31 # define __KERNEL_CPU__
32 #endif
33 
34 /* TODO(sergey): This is only to make it possible to include this header
35  * from outside of the kernel. but this could be done somewhat cleaner?
36  */
37 #ifndef ccl_addr_space
38 # define ccl_addr_space
39 #endif
40 
42 
43 /* Constants */
44 #define OBJECT_MOTION_PASS_SIZE 2
45 #define FILTER_TABLE_SIZE 1024
46 #define RAMP_TABLE_SIZE 256
47 #define SHUTTER_TABLE_SIZE 256
48 
49 #define BSSRDF_MIN_RADIUS 1e-8f
50 #define BSSRDF_MAX_HITS 4
51 #define BSSRDF_MAX_BOUNCES 256
52 #define LOCAL_MAX_HITS 4
53 
54 #define VOLUME_BOUNDS_MAX 1024
55 
56 #define BECKMANN_TABLE_SIZE 256
57 
58 #define SHADER_NONE (~0)
59 #define OBJECT_NONE (~0)
60 #define PRIM_NONE (~0)
61 #define LAMP_NONE (~0)
62 #define ID_NONE (0.0f)
63 
64 #define VOLUME_STACK_SIZE 32
65 
66 /* Split kernel constants */
67 #define WORK_POOL_SIZE_GPU 64
68 #define WORK_POOL_SIZE_CPU 1
69 #ifdef __KERNEL_GPU__
70 # define WORK_POOL_SIZE WORK_POOL_SIZE_GPU
71 #else
72 # define WORK_POOL_SIZE WORK_POOL_SIZE_CPU
73 #endif
74 
75 #define SHADER_SORT_BLOCK_SIZE 2048
76 
77 #ifdef __KERNEL_OPENCL__
78 # define SHADER_SORT_LOCAL_SIZE 64
79 #elif defined(__KERNEL_CUDA__)
80 # define SHADER_SORT_LOCAL_SIZE 32
81 #else
82 # define SHADER_SORT_LOCAL_SIZE 1
83 #endif
84 
85 /* Kernel features */
86 #define __SOBOL__
87 #define __DPDU__
88 #define __BACKGROUND__
89 #define __CAUSTICS_TRICKS__
90 #define __VISIBILITY_FLAG__
91 #define __RAY_DIFFERENTIALS__
92 #define __CAMERA_CLIPPING__
93 #define __INTERSECTION_REFINE__
94 #define __CLAMP_SAMPLE__
95 #define __PATCH_EVAL__
96 #define __SHADOW_TRICKS__
97 #define __DENOISING_FEATURES__
98 #define __SHADER_RAYTRACE__
99 #define __AO__
100 #define __PASSES__
101 #define __HAIR__
102 #define __SVM__
103 #define __EMISSION__
104 #define __HOLDOUT__
105 #define __MULTI_CLOSURE__
106 #define __TRANSPARENT_SHADOWS__
107 #define __BACKGROUND_MIS__
108 #define __LAMP_MIS__
109 #define __CAMERA_MOTION__
110 #define __OBJECT_MOTION__
111 #define __BAKING__
112 #define __PRINCIPLED__
113 #define __SUBSURFACE__
114 #define __VOLUME__
115 #define __VOLUME_SCATTER__
116 #define __CMJ__
117 #define __SHADOW_RECORD_ALL__
118 #define __BRANCHED_PATH__
119 
120 /* Device specific features */
121 #ifdef __KERNEL_CPU__
122 # ifdef WITH_OSL
123 # define __OSL__
124 # endif
125 # define __VOLUME_DECOUPLED__
126 # define __VOLUME_RECORD_ALL__
127 #endif /* __KERNEL_CPU__ */
128 
129 #ifdef __KERNEL_CUDA__
130 # ifdef __SPLIT_KERNEL__
131 # undef __BRANCHED_PATH__
132 # endif
133 #endif /* __KERNEL_CUDA__ */
134 
135 #ifdef __KERNEL_OPTIX__
136 # undef __BAKING__
137 # undef __BRANCHED_PATH__
138 #endif /* __KERNEL_OPTIX__ */
139 
140 #ifdef __KERNEL_OPENCL__
141 #endif /* __KERNEL_OPENCL__ */
142 
143 /* Scene-based selective features compilation. */
144 #ifdef __NO_CAMERA_MOTION__
145 # undef __CAMERA_MOTION__
146 #endif
147 #ifdef __NO_OBJECT_MOTION__
148 # undef __OBJECT_MOTION__
149 #endif
150 #ifdef __NO_HAIR__
151 # undef __HAIR__
152 #endif
153 #ifdef __NO_VOLUME__
154 # undef __VOLUME__
155 # undef __VOLUME_SCATTER__
156 #endif
157 #ifdef __NO_SUBSURFACE__
158 # undef __SUBSURFACE__
159 #endif
160 #ifdef __NO_BAKING__
161 # undef __BAKING__
162 #endif
163 #ifdef __NO_BRANCHED_PATH__
164 # undef __BRANCHED_PATH__
165 #endif
166 #ifdef __NO_PATCH_EVAL__
167 # undef __PATCH_EVAL__
168 #endif
169 #ifdef __NO_TRANSPARENT__
170 # undef __TRANSPARENT_SHADOWS__
171 #endif
172 #ifdef __NO_SHADOW_TRICKS__
173 # undef __SHADOW_TRICKS__
174 #endif
175 #ifdef __NO_PRINCIPLED__
176 # undef __PRINCIPLED__
177 #endif
178 #ifdef __NO_DENOISING__
179 # undef __DENOISING_FEATURES__
180 #endif
181 #ifdef __NO_SHADER_RAYTRACE__
182 # undef __SHADER_RAYTRACE__
183 #endif
184 
185 /* Features that enable others */
186 #ifdef WITH_CYCLES_DEBUG
187 # define __KERNEL_DEBUG__
188 #endif
189 
190 #if defined(__SUBSURFACE__) || defined(__SHADER_RAYTRACE__)
191 # define __BVH_LOCAL__
192 #endif
193 
194 /* Shader Evaluation */
195 
196 typedef enum ShaderEvalType {
199  /* bake types */
200  SHADER_EVAL_BAKE, /* no real shade, it's used in the code to
201  * differentiate the type of shader eval from the above
202  */
203  /* data passes */
213 
214  /* light passes */
221 
222  /* extra */
225 
226 /* Path Tracing
227  * note we need to keep the u/v pairs at even values */
228 
236  PRNG_UNUSED_1 = 6, /* for some reason (6, 7) is a bad sobol pattern */
237  PRNG_UNUSED_2 = 7, /* with a low number of samples (< 64) */
239 
249 
250  PRNG_BEVEL_U = 6, /* reuse volume dimension, correlation won't harm */
252 };
253 
258 
260 };
261 
262 /* these flags values correspond to raytypes in osl.cpp, so keep them in sync! */
263 
265  /* Ray visibility. */
266  PATH_RAY_CAMERA = (1 << 0),
267  PATH_RAY_REFLECT = (1 << 1),
268  PATH_RAY_TRANSMIT = (1 << 2),
269  PATH_RAY_DIFFUSE = (1 << 3),
270  PATH_RAY_GLOSSY = (1 << 4),
271  PATH_RAY_SINGULAR = (1 << 5),
273 
274  /* Shadow ray visibility. */
285 
286  /* Unused, free to reuse. */
287  PATH_RAY_UNUSED = (1 << 11),
288 
289  /* Ray visibility for volume scattering. */
291 
292  /* Special flag to tag unaligned BVH nodes. */
294 
295  PATH_RAY_ALL_VISIBILITY = ((1 << 14) - 1),
296 
297  /* Don't apply multiple importance sampling weights to emission from
298  * lamp or surface hits, because they were not direct light sampled. */
299  PATH_RAY_MIS_SKIP = (1 << 14),
300  /* Diffuse bounce earlier in the path, skip SSS to improve performance
301  * and avoid branching twice with disk sampling SSS. */
303  /* Single pass has been written. */
305  /* Ray is behind a shadow catcher .*/
307  /* Store shadow data for shadow catcher or denoising. */
309  /* Zero background alpha, for camera or transparent glass rays. */
311  /* Terminate ray immediately at next bounce. */
313  /* Ray is to be terminated, but continue with transparent bounces and
314  * emission as long as we encounter them. This is required to make the
315  * MIS between direct and indirect light rays match, as shadow rays go
316  * through transparent surfaces to reach emission too. */
318  /* Ray is to be terminated. */
320  /* Path and shader is being evaluated for direct lighting emission. */
321  PATH_RAY_EMISSION = (1 << 22)
322 };
323 
324 /* Closure Label */
325 
326 typedef enum ClosureLabel {
337 
338 /* Render Passes */
339 
340 #define PASS_NAME_JOIN(a, b) a##_##b
341 #define PASSMASK(pass) (1 << ((PASS_NAME_JOIN(PASS, pass)) % 32))
342 
343 #define PASSMASK_COMPONENT(comp) \
344  (PASSMASK(PASS_NAME_JOIN(comp, DIRECT)) | PASSMASK(PASS_NAME_JOIN(comp, INDIRECT)) | \
345  PASSMASK(PASS_NAME_JOIN(comp, COLOR)))
346 
347 typedef enum PassType {
349 
350  /* Main passes */
359 #ifdef __KERNEL_DEBUG__
360  PASS_BVH_TRAVERSED_NODES,
361  PASS_BVH_TRAVERSED_INSTANCES,
362  PASS_BVH_INTERSECTIONS,
363  PASS_RAY_BOUNCES,
364 #endif
372 
373  PASS_MIST = 32,
378  PASS_LIGHT, /* no real pass, used to force use_light_pass */
390  /* No Scatter color since it's tricky to define what it would even mean. */
392 
397 
398 #define PASS_ANY (~0)
399 
400 typedef enum CryptomatteType {
402  CRYPT_OBJECT = (1 << 0),
403  CRYPT_MATERIAL = (1 << 1),
404  CRYPT_ASSET = (1 << 2),
405  CRYPT_ACCURATE = (1 << 3),
407 
408 typedef enum DenoisingPassOffsets {
420 
428 
433 
434 typedef enum eBakePassFilter {
436  BAKE_FILTER_DIRECT = (1 << 0),
438  BAKE_FILTER_COLOR = (1 << 2),
440  BAKE_FILTER_GLOSSY = (1 << 4),
443  BAKE_FILTER_AO = (1 << 7),
445 
446 typedef enum BakePassFilterCombos {
457 
458 typedef enum DenoiseFlag {
467 
468 #ifdef __KERNEL_DEBUG__
469 /* NOTE: This is a runtime-only struct, alignment is not
470  * really important here.
471  */
472 typedef struct DebugData {
473  int num_bvh_traversed_nodes;
474  int num_bvh_traversed_instances;
475  int num_bvh_intersections;
476  int num_ray_bounces;
477 } DebugData;
478 #endif
479 
481 #ifdef __PASSES__
486 
488 #endif
490 
491 typedef ccl_addr_space struct PathRadiance {
492 #ifdef __PASSES__
494 #endif
495 
496  float transparent;
498 #ifdef __PASSES__
501 
504 
508 
513 
518 
520  float mist;
521 #endif
522 
523  struct PathRadianceState state;
524 
525 #ifdef __SHADOW_TRICKS__
526  /* Total light reachable across the path, ignoring shadow blocked queries. */
528  /* Total light reachable across the path with shadow blocked queries
529  * applied here.
530  *
531  * Dividing this figure by path_total will give estimate of shadow pass.
532  */
534 
535  /* Color of the background on which shadow is alpha-overed. */
537 
538  /* Path radiance sum and throughput at the moment when ray hits shadow
539  * catcher object.
540  */
542 
543  /* Accumulated transparency along the path after shadow catcher bounce. */
545 
546  /* Indicate if any shadow catcher data is set. */
548 #endif
549 
550 #ifdef __DENOISING_FEATURES__
554 #endif /* __DENOISING_FEATURES__ */
555 
556 #ifdef __KERNEL_DEBUG__
557  DebugData debug_data;
558 #endif /* __KERNEL_DEBUG__ */
560 
561 typedef struct BsdfEval {
562 #ifdef __PASSES__
564 #endif
565 
567 #ifdef __PASSES__
572 #endif
573 #ifdef __SHADOW_TRICKS__
575 #endif
577 
578 /* Shader Flag */
579 
580 typedef enum ShaderFlag {
581  SHADER_SMOOTH_NORMAL = (1 << 31),
582  SHADER_CAST_SHADOW = (1 << 30),
583  SHADER_AREA_LIGHT = (1 << 29),
584  SHADER_USE_MIS = (1 << 28),
592 
596 
597 /* Light Type */
598 
599 typedef enum LightType {
607 
608 /* Camera Type */
609 
611 
612 /* Panorama Type */
613 
619 
621 };
622 
623 /* Differential */
624 
625 typedef struct differential3 {
629 
630 typedef struct differential {
631  float dx;
632  float dy;
634 
635 /* Ray */
636 
637 typedef struct Ray {
638 /* TODO(sergey): This is only needed because current AMD
639  * compiler has hard time building the kernel with this
640  * reshuffle. And at the same time reshuffle will cause
641  * less optimal CPU code in certain places.
642  *
643  * We'll get rid of this nasty exception once AMD compiler
644  * is fixed.
645  */
646 #ifndef __KERNEL_OPENCL_AMD__
647  float3 P; /* origin */
648  float3 D; /* direction */
649  float t; /* length of the ray */
650  float time; /* time (for motion blur) */
651 #else
652  float t; /* length of the ray */
653  float time; /* time (for motion blur) */
654  float3 P; /* origin */
655  float3 D; /* direction */
656 #endif
657 
658 #ifdef __RAY_DIFFERENTIALS__
661 #endif
662 } Ray;
663 
664 /* Intersection */
665 
666 typedef struct Intersection {
667 #ifdef __EMBREE__
668  float3 Ng;
669 #endif
670  float t, u, v;
671  int prim;
672  int object;
673  int type;
674 
675 #ifdef __KERNEL_DEBUG__
676  int num_traversed_nodes;
677  int num_traversed_instances;
678  int num_intersections;
679 #endif
681 
682 /* Primitives */
683 
684 typedef enum PrimitiveType {
686  PRIMITIVE_TRIANGLE = (1 << 0),
692  /* Lamp primitive is not included below on purpose,
693  * since it is no real traceable primitive.
694  */
695  PRIMITIVE_LAMP = (1 << 6),
696 
703 
704  /* Total number of different traceable primitives.
705  * NOTE: This is an actual value, not a bitflag.
706  */
709 
710 #define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_TOTAL) | (type))
711 #define PRIMITIVE_UNPACK_SEGMENT(type) (type >> PRIMITIVE_NUM_TOTAL)
712 
713 typedef enum CurveShapeType {
716 
719 
720 /* Attributes */
721 
722 typedef enum AttributePrimitive {
725 
728 
729 typedef enum AttributeElement {
732  ATTR_ELEMENT_MESH = (1 << 1),
733  ATTR_ELEMENT_FACE = (1 << 2),
738  ATTR_ELEMENT_CURVE = (1 << 7),
741  ATTR_ELEMENT_VOXEL = (1 << 10)
743 
744 typedef enum AttributeStandard {
772 
773  ATTR_STD_NOT_FOUND = ~0
775 
776 typedef enum AttributeFlag {
777  ATTR_FINAL_SIZE = (1 << 0),
778  ATTR_SUBDIVIDED = (1 << 1),
780 
781 typedef struct AttributeDescriptor {
784  uint flags; /* see enum AttributeFlag */
785  int offset;
787 
788 /* Closure data */
789 
790 #ifdef __MULTI_CLOSURE__
791 # ifdef __SPLIT_KERNEL__
792 # define MAX_CLOSURE 1
793 # else
794 # ifndef __MAX_CLOSURE__
795 # define MAX_CLOSURE 64
796 # else
797 # define MAX_CLOSURE __MAX_CLOSURE__
798 # endif
799 # endif
800 #else
801 # define MAX_CLOSURE 1
802 #endif
803 
804 /* This struct is the base class for all closures. The common members are
805  * duplicated in all derived classes since we don't have C++ in the kernel
806  * yet, and because it lets us lay out the members to minimize padding. The
807  * weight member is located at the beginning of the struct for this reason.
808  *
809  * ShaderClosure has a fixed size, and any extra space must be allocated
810  * with closure_alloc_extra().
811  *
812  * We pad the struct to align to 16 bytes. All shader closures are assumed
813  * to fit in this struct size. CPU sizes are a bit larger because float3 is
814  * padded to be 16 bytes, while it's only 12 bytes on the GPU. */
815 
816 #define SHADER_CLOSURE_BASE \
817  float3 weight; \
818  ClosureType type; \
819  float sample_weight; \
820  float3 N
821 
823 {
825 
826 #ifdef __KERNEL_CPU__
827  float pad[2];
828 #endif
829  float data[10];
830 }
832 
833 /* Shader Data
834  *
835  * Main shader state at a point on the surface or in a volume. All coordinates
836  * are in world space.
837  */
838 
840  /* Runtime flags. */
841 
842  /* Set when ray hits backside of surface. */
843  SD_BACKFACING = (1 << 0),
844  /* Shader has non-zero emission. */
845  SD_EMISSION = (1 << 1),
846  /* Shader has BSDF closure. */
847  SD_BSDF = (1 << 2),
848  /* Shader has non-singular BSDF closure. */
849  SD_BSDF_HAS_EVAL = (1 << 3),
850  /* Shader has BSSRDF closure. */
851  SD_BSSRDF = (1 << 4),
852  /* Shader has holdout closure. */
853  SD_HOLDOUT = (1 << 5),
854  /* Shader has non-zero volume extinction. */
855  SD_EXTINCTION = (1 << 6),
856  /* Shader has have volume phase (scatter) closure. */
857  SD_SCATTER = (1 << 7),
858  /* Shader has transparent closure. */
859  SD_TRANSPARENT = (1 << 9),
860  /* BSDF requires LCG for evaluation. */
861  SD_BSDF_NEEDS_LCG = (1 << 10),
862 
865 
866  /* Shader flags. */
867 
868  /* direct light sample */
869  SD_USE_MIS = (1 << 16),
870  /* Has transparent shadow. */
872  /* Has volume shader. */
873  SD_HAS_VOLUME = (1 << 18),
874  /* Has only volume shader, no surface. */
875  SD_HAS_ONLY_VOLUME = (1 << 19),
876  /* Has heterogeneous volume. */
878  /* BSSRDF normal uses bump. */
879  SD_HAS_BSSRDF_BUMP = (1 << 21),
880  /* Use equiangular volume sampling */
882  /* Use multiple importance volume sampling. */
883  SD_VOLUME_MIS = (1 << 23),
884  /* Use cubic interpolation for voxels. */
885  SD_VOLUME_CUBIC = (1 << 24),
886  /* Has data connected to the displacement input or uses bump map. */
887  SD_HAS_BUMP = (1 << 25),
888  /* Has true displacement. */
889  SD_HAS_DISPLACEMENT = (1 << 26),
890  /* Has constant emission (value stored in __shaders) */
892  /* Needs to access attributes for volume rendering */
894 
899 };
900 
901 /* Object flags. */
903  /* Holdout for camera rays. */
905  /* Has object motion blur. */
906  SD_OBJECT_MOTION = (1 << 1),
907  /* Vertices have transform applied. */
909  /* Vertices have negative scale applied. */
911  /* Object has a volume shader. */
913  /* Object intersects AABB of an object with volume shader. */
915  /* Has position for motion vertices. */
917  /* object is used to catch shadows */
919  /* object has volume attributes */
921 
926 };
927 
928 typedef ccl_addr_space struct ccl_align(16) ShaderData
929 {
930  /* position */
931  float3 P;
932  /* smooth normal for shading */
933  float3 N;
934  /* true geometric normal */
935  float3 Ng;
936  /* view/incoming direction */
937  float3 I;
938  /* shader id */
939  int shader;
940  /* booleans describing shader, see ShaderDataFlag */
941  int flag;
942  /* booleans describing object of the shader, see ShaderDataObjectFlag */
943  int object_flag;
944 
945  /* primitive id if there is one, ~0 otherwise */
946  int prim;
947 
948  /* combined type and curve segment for hair */
949  int type;
950 
951  /* parametric coordinates
952  * - barycentric weights for triangles */
953  float u;
954  float v;
955  /* object id if there is one, ~0 otherwise */
956  int object;
957  /* lamp id if there is one, ~0 otherwise */
958  int lamp;
959 
960  /* motion blur sample time */
961  float time;
962 
963  /* length of the ray being shaded */
964  float ray_length;
965 
966 #ifdef __RAY_DIFFERENTIALS__
967  /* differential of P. these are orthogonal to Ng, not N */
968  differential3 dP;
969  /* differential of I */
970  differential3 dI;
971  /* differential of u, v */
972  differential du;
973  differential dv;
974 #endif
975 #ifdef __DPDU__
976  /* differential of P w.r.t. parametric coordinates. note that dPdu is
977  * not readily suitable as a tangent for shading on triangles. */
978  float3 dPdu;
979  float3 dPdv;
980 #endif
981 
982 #ifdef __OBJECT_MOTION__
983  /* object <-> world space transformations, cached to avoid
984  * re-interpolating them constantly for shading */
985  Transform ob_tfm;
986  Transform ob_itfm;
987 #endif
988 
989  /* ray start position, only set for backgrounds */
990  float3 ray_P;
991  differential3 ray_dP;
992 
993 #ifdef __OSL__
994  struct KernelGlobals *osl_globals;
995  struct PathState *osl_path_state;
996 #endif
997 
998  /* LCG state for closures that require additional random numbers. */
999  uint lcg_state;
1000 
1001  /* Closure data, we store a fixed array of closures */
1002  int num_closure;
1003  int num_closure_left;
1004  float randb_closure;
1005  float3 svm_closure_weight;
1006 
1007  /* Closure weights summed directly, so we can evaluate
1008  * emission and shadow transparency with MAX_CLOSURE 0. */
1009  float3 closure_emission_background;
1010  float3 closure_transparent_extinction;
1011 
1012  /* At the end so we can adjust size in ShaderDataTinyStorage. */
1013  struct ShaderClosure closure[MAX_CLOSURE];
1014 }
1016 
1017 /* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
1018  * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1020 {
1021  char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * MAX_CLOSURE];
1022 }
1024 #define AS_SHADER_DATA(shader_data_tiny_storage) ((ShaderData *)shader_data_tiny_storage)
1025 
1026 /* Path State */
1027 
1028 #ifdef __VOLUME__
1029 typedef struct VolumeStack {
1030  int object;
1031  int shader;
1033 #endif
1034 
1035 typedef struct PathState {
1036  /* see enum PathRayFlag */
1037  int flag;
1038 
1039  /* random number generator state */
1040  uint rng_hash; /* per pixel hash */
1041  int rng_offset; /* dimension offset */
1042  int sample; /* path sample number */
1043  int num_samples; /* total number of times this path will be sampled */
1044  float branch_factor; /* number of branches in indirect paths */
1045 
1046  /* bounce counting */
1047  int bounce;
1052 
1053 #ifdef __DENOISING_FEATURES__
1056 #endif /* __DENOISING_FEATURES__ */
1057 
1058  /* multiple importance sampling */
1059  float min_ray_pdf; /* smallest bounce pdf over entire path up to now */
1060  float ray_pdf; /* last bounce pdf */
1061 #ifdef __LAMP_MIS__
1062  float ray_t; /* accumulated distance through transparent surfaces */
1063 #endif
1064 
1065  /* volume rendering */
1066 #ifdef __VOLUME__
1070 #endif
1072 
1073 #ifdef __VOLUME__
1074 typedef struct VolumeState {
1075 # ifdef __SPLIT_KERNEL__
1076 # else
1078 # endif
1080 #endif
1081 
1082 /* Struct to gather multiple nearby intersections. */
1083 typedef struct LocalIntersection {
1086 
1091 
1092 /* Subsurface */
1093 
1094 /* Struct to gather SSS indirect rays and delay tracing them. */
1095 typedef struct SubsurfaceIndirectRays {
1097 
1099 
1100  struct Ray rays[BSSRDF_MAX_HITS];
1104 static_assert(BSSRDF_MAX_HITS <= LOCAL_MAX_HITS, "BSSRDF hits too high.");
1105 
1106 /* Constant Kernel Data
1107  *
1108  * These structs are passed from CPU to various devices, and the struct layout
1109  * must match exactly. Structs are padded to ensure 16 byte alignment, and we
1110  * do not use float3 because its size may not be the same on all devices. */
1111 
1112 typedef struct KernelCamera {
1113  /* type */
1114  int type;
1115 
1116  /* panorama */
1121 
1122  /* stereo */
1127 
1128  /* matrices */
1131 
1132  /* differentials */
1133  float4 dx;
1134  float4 dy;
1135 
1136  /* depth of field */
1138  float blades;
1141 
1142  /* motion blur */
1145 
1146  /* clipping */
1147  float nearclip;
1148  float cliplength;
1149 
1150  /* sensor size */
1153 
1154  /* render size */
1155  float width, height;
1157 
1158  /* anamorphic lens bokeh */
1160 
1162 
1163  /* more matrices */
1171 
1172  /* Stores changes in the projection matrix. Use for camera zoom motion
1173  * blur and motion pass output for perspective camera. */
1176 
1177  /* Transforms for motion pass. */
1180 
1182 
1183  /* Rolling shutter */
1186 
1187  int pad;
1190 
1191 typedef struct KernelFilm {
1192  float exposure;
1194 
1198 
1203 
1205  int pass_uv;
1208 
1212 
1217 
1222 
1225  int pass_ao;
1227 
1234 
1237 
1239  float mist_start;
1242 
1246 
1251  int pad1, pad2, pad3;
1252 
1253  /* XYZ to rendering color space transform. float4 instead of float3 to
1254  * ensure consistent padding/alignment across devices. */
1255  float4 xyz_to_r;
1256  float4 xyz_to_g;
1257  float4 xyz_to_b;
1258  float4 rgb_to_y;
1259 
1262  int pad;
1263 
1264 #ifdef __KERNEL_DEBUG__
1265  int pass_bvh_traversed_nodes;
1266  int pass_bvh_traversed_instances;
1267  int pass_bvh_intersections;
1268  int pass_ray_bounces;
1269 #endif
1270 
1271  /* viewport rendering options */
1277 
1278  int pad4, pad5, pad6;
1281 
1282 typedef struct KernelBackground {
1283  /* only shader index */
1289 
1290  /* ambient occlusion */
1291  float ao_factor;
1294 
1295  /* portal sampling */
1299 
1300  /* sun sampling */
1301  float sun_weight;
1302  /* xyz store direction, w the angle. float4 instead of float3 is used
1303  * to ensure consistent padding/alignment across devices. */
1304  float4 sun;
1305 
1306  /* map sampling */
1307  float map_weight;
1310 
1311  int use_mis;
1314 
1315 typedef struct KernelIntegrator {
1316  /* emission */
1322  float pdf_lights;
1324 
1325  /* bounces */
1328 
1333 
1335 
1336  /* transparent */
1340 
1341  /* caustics */
1345 
1346  /* seed */
1347  int seed;
1348 
1349  /* clamp */
1352 
1353  /* branched path */
1364 
1365  /* mis */
1367 
1368  /* sampler */
1375 
1376  /* volume render */
1381 
1383 
1385 
1386  int pad1, pad2;
1389 
1390 typedef enum KernelBVHLayout {
1392 
1393  BVH_LAYOUT_BVH2 = (1 << 0),
1394  BVH_LAYOUT_EMBREE = (1 << 1),
1395  BVH_LAYOUT_OPTIX = (1 << 2),
1398 
1399  /* Default BVH layout to use for CPU. */
1403 
1404 typedef struct KernelBVH {
1405  /* Own BVH */
1406  int root;
1412 
1413  /* Custom BVH */
1414 #ifdef __KERNEL_OPTIX__
1415  OptixTraversableHandle scene;
1416 #else
1417 # ifdef __EMBREE__
1418  RTCScene scene;
1419 # ifndef __KERNEL_64_BIT__
1420  int pad2;
1421 # endif
1422 # else
1423  int scene, pad2;
1424 # endif
1425 #endif
1428 
1429 typedef struct KernelTables {
1431  int pad1, pad2, pad3;
1434 
1435 typedef struct KernelBake {
1438  int type;
1442 
1443 typedef struct KernelData {
1453 
1454 /* Kernel data structures. */
1455 
1456 typedef struct KernelObject {
1459 
1461  float pass_id;
1463  float color[3];
1465 
1467  float dupli_uv[2];
1468 
1469  int numkeys;
1472 
1476 
1479 
1481  float pad1, pad2, pad3;
1484 
1485 typedef struct KernelSpotLight {
1486  float radius;
1487  float invarea;
1488  float spot_angle;
1490  float dir[3];
1491  float pad;
1493 
1494 /* PointLight is SpotLight with only radius and invarea being used. */
1495 
1496 typedef struct KernelAreaLight {
1497  float axisu[3];
1498  float invarea;
1499  float axisv[3];
1500  float tan_spread;
1501  float dir[3];
1504 
1505 typedef struct KernelDistantLight {
1506  float radius;
1507  float cosangle;
1508  float invarea;
1509  float pad;
1511 
1512 typedef struct KernelLight {
1513  int type;
1514  float co[3];
1516  int samples;
1518  float random;
1519  float strength[3];
1520  float pad1;
1523  union {
1527  };
1530 
1531 typedef struct KernelLightDistribution {
1532  float totarea;
1533  int prim;
1534  union {
1535  struct {
1539  struct {
1540  float pad;
1541  float size;
1542  } lamp;
1543  };
1546 
1547 typedef struct KernelParticle {
1548  int index;
1549  float age;
1550  float lifetime;
1551  float size;
1552  float4 rotation;
1553  /* Only xyz are used of the following. float4 instead of float3 are used
1554  * to ensure consistent padding/alignment across devices. */
1555  float4 location;
1556  float4 velocity;
1560 
1561 typedef struct KernelShader {
1564  int flags;
1565  int pass_id;
1566  int pad2, pad3;
1569 
1570 /* Declarations required for split kernel */
1571 
1572 /* Macro for queues */
1573 /* Value marking queue's empty slot */
1574 #define QUEUE_EMPTY_SLOT -1
1575 
1576 /*
1577  * Queue 1 - Active rays
1578  * Queue 2 - Background queue
1579  * Queue 3 - Shadow ray cast kernel - AO
1580  * Queue 4 - Shadow ray cast kernel - direct lighting
1581  */
1582 
1583 /* Queue names */
1585  /* All active rays and regenerated rays are enqueued here. */
1587 
1588  /* All
1589  * 1. Background-hit rays,
1590  * 2. Rays that has exited path-iteration but needs to update output buffer
1591  * 3. Rays to be regenerated
1592  * are enqueued here.
1593  */
1595 
1596  /* All rays for which a shadow ray should be cast to determine radiance
1597  * contribution for AO are enqueued here.
1598  */
1600 
1601  /* All rays for which a shadow ray should be cast to determine radiance
1602  * contributing for direct lighting are enqueued here.
1603  */
1605 
1606  /* Rays sorted according to shader->id */
1608 
1609 #ifdef __BRANCHED_PATH__
1610  /* All rays moving to next iteration of the indirect loop for light */
1612  /* Queue of all inactive rays. These are candidates for sharing work of indirect loops */
1614 # ifdef __VOLUME__
1615  /* All rays moving to next iteration of the indirect loop for volumes */
1617 # endif
1618 # ifdef __SUBSURFACE__
1619  /* All rays moving to next iteration of the indirect loop for subsurface */
1621 # endif
1622 #endif /* __BRANCHED_PATH__ */
1623 
1624  NUM_QUEUES
1625 };
1626 
1627 /* We use RAY_STATE_MASK to get ray_state */
1628 #define RAY_STATE_MASK 0x0F
1629 #define RAY_FLAG_MASK 0xF0
1630 enum RayState {
1632  /* Denotes ray is actively involved in path-iteration. */
1634  /* Denotes ray has completed processing all samples and is inactive. */
1636  /* Denotes ray has exited path-iteration and needs to update output buffer. */
1638  /* Denotes ray needs to skip most surface shader work. */
1640  /* Denotes ray has hit background */
1642  /* Denotes ray has to be regenerated */
1644  /* Denotes ray has been regenerated */
1646  /* Denotes ray is moving to next iteration of the branched indirect loop */
1650 
1651  /* Ray flags */
1652 
1653  /* Flags to denote that the ray is currently evaluating the branched indirect loop */
1659 
1660  /* Ray is evaluating an iteration of an indirect loop for another thread */
1662 };
1663 
1664 #define ASSIGN_RAY_STATE(ray_state, ray_index, state) \
1665  (ray_state[ray_index] = ((ray_state[ray_index] & RAY_FLAG_MASK) | state))
1666 #define IS_STATE(ray_state, ray_index, state) \
1667  ((ray_index) != QUEUE_EMPTY_SLOT && ((ray_state)[(ray_index)] & RAY_STATE_MASK) == (state))
1668 #define ADD_RAY_FLAG(ray_state, ray_index, flag) \
1669  (ray_state[ray_index] = (ray_state[ray_index] | flag))
1670 #define REMOVE_RAY_FLAG(ray_state, ray_index, flag) \
1671  (ray_state[ray_index] = (ray_state[ray_index] & (~flag)))
1672 #define IS_FLAG(ray_state, ray_index, flag) (ray_state[ray_index] & flag)
1673 
1674 /* Patches */
1675 
1676 #define PATCH_MAX_CONTROL_VERTS 16
1677 
1678 /* Patch map node flags */
1679 
1680 #define PATCH_MAP_NODE_IS_SET (1 << 30)
1681 #define PATCH_MAP_NODE_IS_LEAF (1u << 31)
1682 #define PATCH_MAP_NODE_INDEX_MASK (~(PATCH_MAP_NODE_IS_SET | PATCH_MAP_NODE_IS_LEAF))
1683 
1684 /* Work Tiles */
1685 
1686 typedef struct WorkTile {
1687  uint x, y, w, h;
1688 
1691 
1692  int offset;
1694 
1697 
1698 /* Pre-computed sample table sizes for PMJ02 sampler. */
1699 #define NUM_PMJ_SAMPLES (64 * 64)
1700 #define NUM_PMJ_PATTERNS 48
1701 
1703 
1704 #endif /* __KERNEL_TYPES_H__ */
unsigned int uint
Definition: BLI_sys_types.h:83
eBakePassFilter
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
ATTR_WARN_UNUSED_RESULT const BMVert * v
double time
Light lamp
#define ccl_global
#define CCL_NAMESPACE_END
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)
struct KernelBackground KernelBackground
struct KernelIntegrator KernelIntegrator
struct WorkTile WorkTile
struct KernelDistantLight KernelDistantLight
struct KernelFilm KernelFilm
struct KernelParticle KernelParticle
struct differential differential
struct LocalIntersection LocalIntersection
struct KernelTables KernelTables
ShaderDataFlag
Definition: kernel_types.h:839
@ SD_VOLUME_MIS
Definition: kernel_types.h:883
@ SD_CLOSURE_FLAGS
Definition: kernel_types.h:863
@ SD_HAS_TRANSPARENT_SHADOW
Definition: kernel_types.h:871
@ SD_BSDF_HAS_EVAL
Definition: kernel_types.h:849
@ SD_VOLUME_EQUIANGULAR
Definition: kernel_types.h:881
@ SD_SHADER_FLAGS
Definition: kernel_types.h:895
@ SD_HAS_BUMP
Definition: kernel_types.h:887
@ SD_HAS_CONSTANT_EMISSION
Definition: kernel_types.h:891
@ SD_HAS_DISPLACEMENT
Definition: kernel_types.h:889
@ SD_BACKFACING
Definition: kernel_types.h:843
@ SD_BSSRDF
Definition: kernel_types.h:851
@ SD_BSDF_NEEDS_LCG
Definition: kernel_types.h:861
@ SD_HAS_BSSRDF_BUMP
Definition: kernel_types.h:879
@ SD_HAS_ONLY_VOLUME
Definition: kernel_types.h:875
@ SD_EXTINCTION
Definition: kernel_types.h:855
@ SD_BSDF
Definition: kernel_types.h:847
@ SD_VOLUME_CUBIC
Definition: kernel_types.h:885
@ SD_HAS_VOLUME
Definition: kernel_types.h:873
@ SD_USE_MIS
Definition: kernel_types.h:869
@ SD_NEED_VOLUME_ATTRIBUTES
Definition: kernel_types.h:893
@ SD_SCATTER
Definition: kernel_types.h:857
@ SD_TRANSPARENT
Definition: kernel_types.h:859
@ SD_HETEROGENEOUS_VOLUME
Definition: kernel_types.h:877
@ SD_HOLDOUT
Definition: kernel_types.h:853
@ SD_EMISSION
Definition: kernel_types.h:845
struct AttributeDescriptor AttributeDescriptor
PrimitiveType
Definition: kernel_types.h:684
@ PRIMITIVE_LAMP
Definition: kernel_types.h:695
@ PRIMITIVE_MOTION_CURVE_RIBBON
Definition: kernel_types.h:691
@ PRIMITIVE_ALL
Definition: kernel_types.h:702
@ PRIMITIVE_NUM_TOTAL
Definition: kernel_types.h:707
@ PRIMITIVE_MOTION_TRIANGLE
Definition: kernel_types.h:687
@ PRIMITIVE_NONE
Definition: kernel_types.h:685
@ PRIMITIVE_CURVE_RIBBON
Definition: kernel_types.h:690
@ PRIMITIVE_MOTION_CURVE_THICK
Definition: kernel_types.h:689
@ PRIMITIVE_CURVE_THICK
Definition: kernel_types.h:688
@ PRIMITIVE_ALL_TRIANGLE
Definition: kernel_types.h:697
@ PRIMITIVE_ALL_CURVE
Definition: kernel_types.h:698
@ PRIMITIVE_TRIANGLE
Definition: kernel_types.h:686
@ PRIMITIVE_ALL_MOTION
Definition: kernel_types.h:700
AttributeStandard
Definition: kernel_types.h:744
@ ATTR_STD_CURVE_INTERCEPT
Definition: kernel_types.h:759
@ ATTR_STD_GENERATED_TRANSFORM
Definition: kernel_types.h:753
@ ATTR_STD_UV
Definition: kernel_types.h:748
@ ATTR_STD_MOTION_VERTEX_NORMAL
Definition: kernel_types.h:757
@ ATTR_STD_VOLUME_TEMPERATURE
Definition: kernel_types.h:767
@ ATTR_STD_VERTEX_NORMAL
Definition: kernel_types.h:746
@ ATTR_STD_UV_TANGENT
Definition: kernel_types.h:749
@ ATTR_STD_NOT_FOUND
Definition: kernel_types.h:773
@ ATTR_STD_NONE
Definition: kernel_types.h:745
@ ATTR_STD_VERTEX_COLOR
Definition: kernel_types.h:751
@ ATTR_STD_VOLUME_DENSITY
Definition: kernel_types.h:763
@ ATTR_STD_NUM
Definition: kernel_types.h:771
@ ATTR_STD_POSITION_UNDISPLACED
Definition: kernel_types.h:755
@ ATTR_STD_VOLUME_FLAME
Definition: kernel_types.h:765
@ ATTR_STD_PTEX_FACE_ID
Definition: kernel_types.h:761
@ ATTR_STD_VOLUME_VELOCITY
Definition: kernel_types.h:768
@ ATTR_STD_POSITION_UNDEFORMED
Definition: kernel_types.h:754
@ ATTR_STD_VOLUME_COLOR
Definition: kernel_types.h:764
@ ATTR_STD_MOTION_VERTEX_POSITION
Definition: kernel_types.h:756
@ ATTR_STD_VOLUME_HEAT
Definition: kernel_types.h:766
@ ATTR_STD_UV_TANGENT_SIGN
Definition: kernel_types.h:750
@ ATTR_STD_CURVE_RANDOM
Definition: kernel_types.h:760
@ ATTR_STD_FACE_NORMAL
Definition: kernel_types.h:747
@ ATTR_STD_PTEX_UV
Definition: kernel_types.h:762
@ ATTR_STD_POINTINESS
Definition: kernel_types.h:769
@ ATTR_STD_GENERATED
Definition: kernel_types.h:752
@ ATTR_STD_RANDOM_PER_ISLAND
Definition: kernel_types.h:770
@ ATTR_STD_PARTICLE
Definition: kernel_types.h:758
#define SHADER_CLOSURE_BASE
Definition: kernel_types.h:816
struct Intersection Intersection
PathTraceDimension
Definition: kernel_types.h:229
@ PRNG_BOUNCE_NUM
Definition: kernel_types.h:248
@ PRNG_LIGHT_TERMINATE
Definition: kernel_types.h:244
@ PRNG_BSDF_U
Definition: kernel_types.h:240
@ PRNG_FILTER_U
Definition: kernel_types.h:230
@ PRNG_LIGHT_U
Definition: kernel_types.h:242
@ PRNG_BASE_NUM
Definition: kernel_types.h:238
@ PRNG_LENS_U
Definition: kernel_types.h:232
@ PRNG_BEVEL_V
Definition: kernel_types.h:251
@ PRNG_SCATTER_DISTANCE
Definition: kernel_types.h:247
@ PRNG_TIME
Definition: kernel_types.h:234
@ PRNG_TERMINATE
Definition: kernel_types.h:245
@ PRNG_LIGHT_V
Definition: kernel_types.h:243
@ PRNG_FILTER_V
Definition: kernel_types.h:231
@ PRNG_LENS_V
Definition: kernel_types.h:233
@ PRNG_BSDF_V
Definition: kernel_types.h:241
@ PRNG_PHASE_CHANNEL
Definition: kernel_types.h:246
@ PRNG_BEVEL_U
Definition: kernel_types.h:250
@ PRNG_UNUSED_2
Definition: kernel_types.h:237
@ PRNG_UNUSED_0
Definition: kernel_types.h:235
@ PRNG_UNUSED_1
Definition: kernel_types.h:236
struct KernelBVH KernelBVH
AttributeFlag
Definition: kernel_types.h:776
@ ATTR_FINAL_SIZE
Definition: kernel_types.h:777
@ ATTR_SUBDIVIDED
Definition: kernel_types.h:778
PathRayFlag
Definition: kernel_types.h:264
@ PATH_RAY_STORE_SHADOW_INFO
Definition: kernel_types.h:308
@ PATH_RAY_SHADOW
Definition: kernel_types.h:284
@ PATH_RAY_TERMINATE_AFTER_TRANSPARENT
Definition: kernel_types.h:317
@ PATH_RAY_SINGULAR
Definition: kernel_types.h:271
@ PATH_RAY_REFLECT
Definition: kernel_types.h:267
@ PATH_RAY_SHADOW_NON_CATCHER
Definition: kernel_types.h:282
@ PATH_RAY_UNUSED
Definition: kernel_types.h:287
@ PATH_RAY_SHADOW_TRANSPARENT_CATCHER
Definition: kernel_types.h:279
@ PATH_RAY_SHADOW_OPAQUE_CATCHER
Definition: kernel_types.h:276
@ PATH_RAY_SHADOW_CATCHER
Definition: kernel_types.h:306
@ PATH_RAY_TRANSPARENT
Definition: kernel_types.h:272
@ PATH_RAY_SHADOW_OPAQUE
Definition: kernel_types.h:277
@ PATH_RAY_TERMINATE
Definition: kernel_types.h:319
@ PATH_RAY_SHADOW_OPAQUE_NON_CATCHER
Definition: kernel_types.h:275
@ PATH_RAY_SINGLE_PASS_DONE
Definition: kernel_types.h:304
@ PATH_RAY_TRANSMIT
Definition: kernel_types.h:268
@ PATH_RAY_SHADOW_TRANSPARENT
Definition: kernel_types.h:280
@ PATH_RAY_EMISSION
Definition: kernel_types.h:321
@ PATH_RAY_VOLUME_SCATTER
Definition: kernel_types.h:290
@ PATH_RAY_SHADOW_TRANSPARENT_NON_CATCHER
Definition: kernel_types.h:278
@ PATH_RAY_MIS_SKIP
Definition: kernel_types.h:299
@ PATH_RAY_TERMINATE_IMMEDIATE
Definition: kernel_types.h:312
@ PATH_RAY_GLOSSY
Definition: kernel_types.h:270
@ PATH_RAY_ALL_VISIBILITY
Definition: kernel_types.h:295
@ PATH_RAY_NODE_UNALIGNED
Definition: kernel_types.h:293
@ PATH_RAY_DIFFUSE
Definition: kernel_types.h:269
@ PATH_RAY_TRANSPARENT_BACKGROUND
Definition: kernel_types.h:310
@ PATH_RAY_CAMERA
Definition: kernel_types.h:266
@ PATH_RAY_DIFFUSE_ANCESTOR
Definition: kernel_types.h:302
CryptomatteType
Definition: kernel_types.h:400
@ CRYPT_ASSET
Definition: kernel_types.h:404
@ CRYPT_NONE
Definition: kernel_types.h:401
@ CRYPT_ACCURATE
Definition: kernel_types.h:405
@ CRYPT_OBJECT
Definition: kernel_types.h:402
@ CRYPT_MATERIAL
Definition: kernel_types.h:403
struct KernelLight KernelLight
struct Ray Ray
CurveShapeType
Definition: kernel_types.h:713
@ CURVE_THICK
Definition: kernel_types.h:715
@ CURVE_NUM_SHAPE_TYPES
Definition: kernel_types.h:717
@ CURVE_RIBBON
Definition: kernel_types.h:714
struct KernelShader KernelShader
struct KernelLightDistribution KernelLightDistribution
ShaderDataTinyStorage
struct PathState PathState
struct KernelBake KernelBake
ccl_addr_space struct PathRadiance PathRadiance
#define LOCAL_MAX_HITS
Definition: kernel_types.h:52
static_assert_align(KernelCamera, 16)
ShaderData
DenoiseFlag
Definition: kernel_types.h:458
@ DENOISING_CLEAN_GLOSSY_IND
Definition: kernel_types.h:462
@ DENOISING_CLEAN_DIFFUSE_DIR
Definition: kernel_types.h:459
@ DENOISING_CLEAN_ALL_PASSES
Definition: kernel_types.h:465
@ DENOISING_CLEAN_TRANSMISSION_IND
Definition: kernel_types.h:464
@ DENOISING_CLEAN_DIFFUSE_IND
Definition: kernel_types.h:460
@ DENOISING_CLEAN_TRANSMISSION_DIR
Definition: kernel_types.h:463
@ DENOISING_CLEAN_GLOSSY_DIR
Definition: kernel_types.h:461
ShaderFlag
Definition: kernel_types.h:580
@ SHADER_EXCLUDE_CAMERA
Definition: kernel_types.h:588
@ SHADER_EXCLUDE_DIFFUSE
Definition: kernel_types.h:585
@ SHADER_USE_MIS
Definition: kernel_types.h:584
@ SHADER_EXCLUDE_ANY
Definition: kernel_types.h:590
@ SHADER_EXCLUDE_SCATTER
Definition: kernel_types.h:589
@ SHADER_EXCLUDE_GLOSSY
Definition: kernel_types.h:586
@ SHADER_AREA_LIGHT
Definition: kernel_types.h:583
@ SHADER_EXCLUDE_TRANSMIT
Definition: kernel_types.h:587
@ SHADER_SMOOTH_NORMAL
Definition: kernel_types.h:581
@ SHADER_CAST_SHADOW
Definition: kernel_types.h:582
@ SHADER_MASK
Definition: kernel_types.h:593
ccl_addr_space struct ccl_align(16) ShaderClosure
Definition: kernel_types.h:822
struct KernelSpotLight KernelSpotLight
ShaderDataObjectFlag
Definition: kernel_types.h:902
@ SD_OBJECT_MOTION
Definition: kernel_types.h:906
@ SD_OBJECT_HAS_VOLUME_ATTRIBUTES
Definition: kernel_types.h:920
@ SD_OBJECT_HAS_VOLUME
Definition: kernel_types.h:912
@ SD_OBJECT_INTERSECTS_VOLUME
Definition: kernel_types.h:914
@ SD_OBJECT_HOLDOUT_MASK
Definition: kernel_types.h:904
@ SD_OBJECT_FLAGS
Definition: kernel_types.h:922
@ SD_OBJECT_SHADOW_CATCHER
Definition: kernel_types.h:918
@ SD_OBJECT_TRANSFORM_APPLIED
Definition: kernel_types.h:908
@ SD_OBJECT_HAS_VERTEX_MOTION
Definition: kernel_types.h:916
@ SD_OBJECT_NEGATIVE_SCALE_APPLIED
Definition: kernel_types.h:910
ccl_addr_space struct PathRadianceState PathRadianceState
SamplingPattern
Definition: kernel_types.h:254
@ SAMPLING_PATTERN_PMJ
Definition: kernel_types.h:257
@ SAMPLING_PATTERN_SOBOL
Definition: kernel_types.h:255
@ SAMPLING_PATTERN_CMJ
Definition: kernel_types.h:256
@ SAMPLING_NUM_PATTERNS
Definition: kernel_types.h:259
BakePassFilterCombos
Definition: kernel_types.h:446
@ BAKE_FILTER_TRANSMISSION_DIRECT
Definition: kernel_types.h:452
@ BAKE_FILTER_DIFFUSE_INDIRECT
Definition: kernel_types.h:453
@ BAKE_FILTER_GLOSSY_INDIRECT
Definition: kernel_types.h:454
@ BAKE_FILTER_COMBINED
Definition: kernel_types.h:447
@ BAKE_FILTER_DIFFUSE_DIRECT
Definition: kernel_types.h:450
@ BAKE_FILTER_TRANSMISSION_INDIRECT
Definition: kernel_types.h:455
@ BAKE_FILTER_GLOSSY_DIRECT
Definition: kernel_types.h:451
KernelBVHLayout
@ BVH_LAYOUT_OPTIX
@ BVH_LAYOUT_NONE
@ BVH_LAYOUT_EMBREE
@ BVH_LAYOUT_AUTO
@ BVH_LAYOUT_MULTI_OPTIX
@ BVH_LAYOUT_BVH2
@ BVH_LAYOUT_ALL
@ BVH_LAYOUT_MULTI_OPTIX_EMBREE
#define ccl_addr_space
Definition: kernel_types.h:38
AttributeElement
Definition: kernel_types.h:729
@ ATTR_ELEMENT_NONE
Definition: kernel_types.h:730
@ ATTR_ELEMENT_CORNER_BYTE
Definition: kernel_types.h:737
@ ATTR_ELEMENT_CURVE_KEY
Definition: kernel_types.h:739
@ ATTR_ELEMENT_CURVE_KEY_MOTION
Definition: kernel_types.h:740
@ ATTR_ELEMENT_VOXEL
Definition: kernel_types.h:741
@ ATTR_ELEMENT_CORNER
Definition: kernel_types.h:736
@ ATTR_ELEMENT_OBJECT
Definition: kernel_types.h:731
@ ATTR_ELEMENT_VERTEX_MOTION
Definition: kernel_types.h:735
@ ATTR_ELEMENT_VERTEX
Definition: kernel_types.h:734
@ ATTR_ELEMENT_FACE
Definition: kernel_types.h:733
@ ATTR_ELEMENT_MESH
Definition: kernel_types.h:732
@ ATTR_ELEMENT_CURVE
Definition: kernel_types.h:738
ClosureLabel
Definition: kernel_types.h:326
@ LABEL_TRANSMIT
Definition: kernel_types.h:328
@ LABEL_TRANSMIT_TRANSPARENT
Definition: kernel_types.h:335
@ LABEL_VOLUME_SCATTER
Definition: kernel_types.h:334
@ LABEL_DIFFUSE
Definition: kernel_types.h:330
@ LABEL_NONE
Definition: kernel_types.h:327
@ LABEL_SINGULAR
Definition: kernel_types.h:332
@ LABEL_GLOSSY
Definition: kernel_types.h:331
@ LABEL_REFLECT
Definition: kernel_types.h:329
@ LABEL_TRANSPARENT
Definition: kernel_types.h:333
struct VolumeStack VolumeStack
#define VOLUME_STACK_SIZE
Definition: kernel_types.h:64
struct KernelData KernelData
struct KernelObject KernelObject
#define MAX_CLOSURE
Definition: kernel_types.h:795
PassType
Definition: kernel_types.h:347
@ PASS_EMISSION
Definition: kernel_types.h:374
@ PASS_BACKGROUND
Definition: kernel_types.h:375
@ PASS_TRANSMISSION_DIRECT
Definition: kernel_types.h:385
@ PASS_VOLUME_DIRECT
Definition: kernel_types.h:388
@ PASS_UV
Definition: kernel_types.h:354
@ PASS_TRANSMISSION_COLOR
Definition: kernel_types.h:387
@ PASS_DEPTH
Definition: kernel_types.h:352
@ PASS_MIST
Definition: kernel_types.h:373
@ PASS_TRANSMISSION_INDIRECT
Definition: kernel_types.h:386
@ PASS_DIFFUSE_DIRECT
Definition: kernel_types.h:379
@ PASS_MOTION
Definition: kernel_types.h:357
@ PASS_CATEGORY_BAKE_END
Definition: kernel_types.h:395
@ PASS_MATERIAL_ID
Definition: kernel_types.h:356
@ PASS_AO
Definition: kernel_types.h:376
@ PASS_COMBINED
Definition: kernel_types.h:351
@ PASS_DIFFUSE_INDIRECT
Definition: kernel_types.h:380
@ PASS_RENDER_TIME
Definition: kernel_types.h:365
@ PASS_ADAPTIVE_AUX_BUFFER
Definition: kernel_types.h:369
@ PASS_CATEGORY_MAIN_END
Definition: kernel_types.h:371
@ PASS_OBJECT_ID
Definition: kernel_types.h:355
@ PASS_AOV_COLOR
Definition: kernel_types.h:367
@ PASS_NONE
Definition: kernel_types.h:348
@ PASS_VOLUME_INDIRECT
Definition: kernel_types.h:389
@ PASS_NORMAL
Definition: kernel_types.h:353
@ PASS_CRYPTOMATTE
Definition: kernel_types.h:366
@ PASS_DIFFUSE_COLOR
Definition: kernel_types.h:381
@ PASS_SAMPLE_COUNT
Definition: kernel_types.h:370
@ PASS_GLOSSY_DIRECT
Definition: kernel_types.h:382
@ PASS_MOTION_WEIGHT
Definition: kernel_types.h:358
@ PASS_AOV_VALUE
Definition: kernel_types.h:368
@ PASS_GLOSSY_COLOR
Definition: kernel_types.h:384
@ PASS_SHADOW
Definition: kernel_types.h:377
@ PASS_GLOSSY_INDIRECT
Definition: kernel_types.h:383
@ PASS_BAKE_DIFFERENTIAL
Definition: kernel_types.h:394
@ PASS_LIGHT
Definition: kernel_types.h:378
@ PASS_BAKE_PRIMITIVE
Definition: kernel_types.h:393
@ PASS_CATEGORY_LIGHT_END
Definition: kernel_types.h:391
struct VolumeState VolumeState
ShaderClosure
Definition: kernel_types.h:831
RayState
@ RAY_BRANCHED_INDIRECT
@ RAY_UPDATE_BUFFER
@ RAY_BRANCHED_VOLUME_INDIRECT
@ RAY_HIT_BACKGROUND
@ RAY_ACTIVE
@ RAY_LIGHT_INDIRECT_NEXT_ITER
@ RAY_BRANCHED_SUBSURFACE_INDIRECT
@ RAY_BRANCHED_LIGHT_INDIRECT
@ RAY_HAS_ONLY_VOLUME
@ RAY_BRANCHED_INDIRECT_SHARED
@ RAY_TO_REGENERATE
@ RAY_INVALID
@ RAY_SUBSURFACE_INDIRECT_NEXT_ITER
@ RAY_VOLUME_INDIRECT_NEXT_ITER
@ RAY_REGENERATED
@ RAY_INACTIVE
AttributePrimitive
Definition: kernel_types.h:722
@ ATTR_PRIM_SUBD
Definition: kernel_types.h:724
@ ATTR_PRIM_TYPES
Definition: kernel_types.h:726
@ ATTR_PRIM_GEOMETRY
Definition: kernel_types.h:723
struct KernelAreaLight KernelAreaLight
PanoramaType
Definition: kernel_types.h:614
@ PANORAMA_MIRRORBALL
Definition: kernel_types.h:618
@ PANORAMA_FISHEYE_EQUISOLID
Definition: kernel_types.h:617
@ PANORAMA_NUM_TYPES
Definition: kernel_types.h:620
@ PANORAMA_FISHEYE_EQUIDISTANT
Definition: kernel_types.h:616
@ PANORAMA_EQUIRECTANGULAR
Definition: kernel_types.h:615
struct BsdfEval BsdfEval
LightType
Definition: kernel_types.h:599
@ LIGHT_AREA
Definition: kernel_types.h:603
@ LIGHT_DISTANT
Definition: kernel_types.h:601
@ LIGHT_SPOT
Definition: kernel_types.h:604
@ LIGHT_BACKGROUND
Definition: kernel_types.h:602
@ LIGHT_TRIANGLE
Definition: kernel_types.h:605
@ LIGHT_POINT
Definition: kernel_types.h:600
ShaderEvalType
Definition: kernel_types.h:196
@ SHADER_EVAL_TRANSMISSION_COLOR
Definition: kernel_types.h:209
@ SHADER_EVAL_DIFFUSE
Definition: kernel_types.h:218
@ SHADER_EVAL_TRANSMISSION
Definition: kernel_types.h:220
@ SHADER_EVAL_GLOSSY
Definition: kernel_types.h:219
@ SHADER_EVAL_DIFFUSE_COLOR
Definition: kernel_types.h:207
@ SHADER_EVAL_AOV_VALUE
Definition: kernel_types.h:212
@ SHADER_EVAL_EMISSION
Definition: kernel_types.h:210
@ SHADER_EVAL_UV
Definition: kernel_types.h:205
@ SHADER_EVAL_AOV_COLOR
Definition: kernel_types.h:211
@ SHADER_EVAL_ROUGHNESS
Definition: kernel_types.h:206
@ SHADER_EVAL_SHADOW
Definition: kernel_types.h:217
@ SHADER_EVAL_BACKGROUND
Definition: kernel_types.h:198
@ SHADER_EVAL_DISPLACE
Definition: kernel_types.h:197
@ SHADER_EVAL_AO
Definition: kernel_types.h:215
@ SHADER_EVAL_NORMAL
Definition: kernel_types.h:204
@ SHADER_EVAL_BAKE
Definition: kernel_types.h:200
@ SHADER_EVAL_GLOSSY_COLOR
Definition: kernel_types.h:208
@ SHADER_EVAL_ENVIRONMENT
Definition: kernel_types.h:223
@ SHADER_EVAL_COMBINED
Definition: kernel_types.h:216
#define BSSRDF_MAX_HITS
Definition: kernel_types.h:50
struct SubsurfaceIndirectRays SubsurfaceIndirectRays
DenoisingPassOffsets
Definition: kernel_types.h:408
@ DENOISING_PASS_ALBEDO
Definition: kernel_types.h:411
@ DENOISING_PASS_COLOR_VAR
Definition: kernel_types.h:418
@ DENOISING_PASS_PREFILTERED_VARIANCE
Definition: kernel_types.h:426
@ DENOISING_PASS_DEPTH
Definition: kernel_types.h:413
@ DENOISING_PASS_PREFILTERED_NORMAL
Definition: kernel_types.h:422
@ DENOISING_PASS_PREFILTERED_SHADOWING
Definition: kernel_types.h:423
@ DENOISING_PASS_SIZE_CLEAN
Definition: kernel_types.h:430
@ DENOISING_PASS_SIZE_BASE
Definition: kernel_types.h:429
@ DENOISING_PASS_PREFILTERED_DEPTH
Definition: kernel_types.h:421
@ DENOISING_PASS_SIZE_PREFILTERED
Definition: kernel_types.h:431
@ DENOISING_PASS_PREFILTERED_ALBEDO
Definition: kernel_types.h:424
@ DENOISING_PASS_NORMAL_VAR
Definition: kernel_types.h:410
@ DENOISING_PASS_ALBEDO_VAR
Definition: kernel_types.h:412
@ DENOISING_PASS_SHADOW_B
Definition: kernel_types.h:416
@ DENOISING_PASS_CLEAN
Definition: kernel_types.h:419
@ DENOISING_PASS_COLOR
Definition: kernel_types.h:417
@ DENOISING_PASS_NORMAL
Definition: kernel_types.h:409
@ DENOISING_PASS_DEPTH_VAR
Definition: kernel_types.h:414
@ DENOISING_PASS_SHADOW_A
Definition: kernel_types.h:415
@ DENOISING_PASS_PREFILTERED_COLOR
Definition: kernel_types.h:425
@ DENOISING_PASS_PREFILTERED_INTENSITY
Definition: kernel_types.h:427
struct differential3 differential3
eBakePassFilter
Definition: kernel_types.h:434
@ BAKE_FILTER_EMISSION
Definition: kernel_types.h:442
@ BAKE_FILTER_TRANSMISSION
Definition: kernel_types.h:441
@ BAKE_FILTER_DIFFUSE
Definition: kernel_types.h:439
@ BAKE_FILTER_NONE
Definition: kernel_types.h:435
@ BAKE_FILTER_DIRECT
Definition: kernel_types.h:436
@ BAKE_FILTER_INDIRECT
Definition: kernel_types.h:437
@ BAKE_FILTER_AO
Definition: kernel_types.h:443
@ BAKE_FILTER_COLOR
Definition: kernel_types.h:438
@ BAKE_FILTER_GLOSSY
Definition: kernel_types.h:440
struct KernelCamera KernelCamera
CameraType
Definition: kernel_types.h:610
@ CAMERA_PERSPECTIVE
Definition: kernel_types.h:610
@ CAMERA_PANORAMA
Definition: kernel_types.h:610
@ CAMERA_ORTHOGRAPHIC
Definition: kernel_types.h:610
QueueNumber
@ QUEUE_LIGHT_INDIRECT_ITER
@ QUEUE_SHADOW_RAY_CAST_DL_RAYS
@ QUEUE_SHADER_SORTED_RAYS
@ QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS
@ NUM_QUEUES
@ QUEUE_SHADOW_RAY_CAST_AO_RAYS
@ QUEUE_VOLUME_INDIRECT_ITER
@ QUEUE_INACTIVE_RAYS
@ QUEUE_SUBSURFACE_INDIRECT_ITER
@ QUEUE_ACTIVE_AND_REGENERATED_RAYS
static float P(float k)
Definition: math_interp.c:41
#define I
params N
AttributeElement element
Definition: kernel_types.h:782
NodeAttributeType type
Definition: kernel_types.h:783
float3 transmission
Definition: kernel_types.h:569
float3 sum_no_mis
Definition: kernel_types.h:574
int use_light_pass
Definition: kernel_types.h:563
float3 diffuse
Definition: kernel_types.h:566
float3 transparent
Definition: kernel_types.h:570
float3 glossy
Definition: kernel_types.h:568
float3 volume
Definition: kernel_types.h:571
int use_bvh_steps
int curve_subdivisions
float transparent_roughness_squared_threshold
float focaldistance
ProjectionTransform ndctoworld
float pole_merge_angle_to
int have_perspective_motion
float sensorheight
ProjectionTransform rastertocamera
float pole_merge_angle_from
float aperturesize
int shutter_table_offset
ProjectionTransform worldtoraster
Transform motion_pass_post
Transform cameratoworld
float4 equirectangular_range
float interocular_offset
Transform worldtocamera
ProjectionTransform screentoworld
float inv_aperture_ratio
ProjectionTransform perspective_post
float rolling_shutter_duration
ProjectionTransform perspective_pre
ProjectionTransform worldtoscreen
Transform motion_pass_pre
int rolling_shutter_type
ProjectionTransform worldtondc
float fisheye_lens
float bladesrotation
float convergence_distance
ProjectionTransform rastertoworld
KernelFilm film
KernelTables tables
KernelCamera cam
KernelBackground background
KernelBake bake
KernelIntegrator integrator
KernelBVH bvh
int pass_bake_primitive
int pass_transmission_color
float mist_falloff
int pass_sample_count
float4 xyz_to_r
int cryptomatte_depth
int pass_glossy_color
int pass_motion_weight
int pass_adaptive_aux_buffer
int pass_transmission_indirect
float4 xyz_to_b
float mist_start
int pass_volume_indirect
int pass_aov_value
int filter_table_offset
int pass_material_id
int pass_denoising_data
int pass_transmission_direct
int display_pass_components
int pass_denoising_clean
int pass_aov_color_num
float4 xyz_to_g
int pass_diffuse_direct
int pass_bake_differential
int pass_aov_color
int denoising_flags
float pass_shadow_scale
int pass_cryptomatte
int pass_volume_direct
int use_display_exposure
int pass_diffuse_color
int light_pass_flag
float4 rgb_to_y
float pass_alpha_threshold
int pass_background
int pass_glossy_indirect
int pass_object_id
int pass_diffuse_indirect
int display_divide_pass_stride
float exposure
float mist_inv_depth
int display_pass_stride
int pass_glossy_direct
int use_light_pass
int use_display_pass_alpha
int cryptomatte_passes
int pass_aov_value_num
float sample_clamp_indirect
int sample_all_lights_indirect
float light_inv_rr_threshold
struct KernelLightDistribution::@1195::@1198 lamp
struct KernelLightDistribution::@1195::@1197 mesh_light
float co[3]
Transform itfm
float strength[3]
float max_bounces
KernelSpotLight spot
Transform tfm
KernelDistantLight distant
KernelAreaLight area
Transform tfm
float shadow_terminator_offset
Transform itfm
float dupli_uv[2]
float volume_density
float random_number
float cryptomatte_asset
float color[3]
uint attribute_map_offset
uint patch_map_offset
float dupli_generated[3]
float cryptomatte_object
float4 angular_velocity
float constant_emission[3]
float cryptomatte_id
struct Intersection hits[LOCAL_MAX_HITS]
float3 weight[LOCAL_MAX_HITS]
float3 Ng[LOCAL_MAX_HITS]
float denoising_depth
Definition: kernel_types.h:553
float3 direct_glossy
Definition: kernel_types.h:510
float3 path_total
Definition: kernel_types.h:527
float3 color_transmission
Definition: kernel_types.h:507
float3 indirect
Definition: kernel_types.h:502
struct PathRadianceState state
Definition: kernel_types.h:523
float3 background
Definition: kernel_types.h:499
float3 indirect_glossy
Definition: kernel_types.h:515
float3 color_glossy
Definition: kernel_types.h:506
float3 color_diffuse
Definition: kernel_types.h:505
float3 denoising_normal
Definition: kernel_types.h:551
float3 indirect_transmission
Definition: kernel_types.h:516
float3 direct_transmission
Definition: kernel_types.h:511
float3 emission
Definition: kernel_types.h:497
float3 indirect_volume
Definition: kernel_types.h:517
float3 direct_emission
Definition: kernel_types.h:503
float shadow_transparency
Definition: kernel_types.h:544
float3 indirect_diffuse
Definition: kernel_types.h:514
float3 direct_diffuse
Definition: kernel_types.h:509
float3 path_total_shaded
Definition: kernel_types.h:533
float3 shadow_background_color
Definition: kernel_types.h:536
float3 direct_volume
Definition: kernel_types.h:512
float transparent
Definition: kernel_types.h:496
float shadow_throughput
Definition: kernel_types.h:541
int has_shadow_catcher
Definition: kernel_types.h:547
float3 denoising_albedo
Definition: kernel_types.h:552
int volume_bounce
int diffuse_bounce
float ray_pdf
float denoising_feature_weight
float3 denoising_feature_throughput
int transparent_bounce
int glossy_bounce
VolumeStack volume_stack[VOLUME_STACK_SIZE]
int volume_bounds_bounce
int transmission_bounce
float branch_factor
float min_ray_pdf
float t
Definition: kernel_types.h:649
differential3 dD
Definition: kernel_types.h:660
float3 P
Definition: kernel_types.h:647
float time
Definition: kernel_types.h:650
differential3 dP
Definition: kernel_types.h:659
float3 D
Definition: kernel_types.h:648
struct PathRadianceState L_state[BSSRDF_MAX_HITS]
PathState state[BSSRDF_MAX_HITS]
struct Ray rays[BSSRDF_MAX_HITS]
float3 throughputs[BSSRDF_MAX_HITS]
PathState ps
uint start_sample
uint num_samples
ccl_global float * buffer
NodeAttributeType
Definition: svm_types.h:166