Blender V5.3
kernel/types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#ifndef __KERNEL_GPU__
9#endif
10
11#if (!defined(__KERNEL_GPU__) || (defined(__KERNEL_ONEAPI__) && defined(WITH_EMBREE_GPU))) && \
12 defined(WITH_EMBREE)
13# include <embree4/rtcore.h>
14# include <embree4/rtcore_scene.h>
15# define __EMBREE__
16#endif
17
18#ifdef __APPLE__
19# include <TargetConditionals.h>
20#endif
21
22#include "util/projection.h"
23#include "util/static_assert.h"
24
25#include "kernel/features.h"
26#include "kernel/svm/types.h"
27
29
30// NOLINTBEGIN
31
32/* Constants */
33#define OBJECT_MOTION_PASS_SIZE 2
34#define FILTER_TABLE_SIZE 1024
35#define RAMP_TABLE_SIZE 256
36#define SHUTTER_TABLE_SIZE 256
37#define THIN_FILM_TABLE_SIZE 512
38
39#define BSSRDF_MIN_RADIUS 1e-8f
40#define BSSRDF_MAX_HITS 4
41#define BSSRDF_MAX_BOUNCES 256
42#define LOCAL_MAX_HITS 4
43
44#define VOLUME_BOUNDS_MAX 1024
45
46#define SHADER_NONE (~0)
47#define OBJECT_NONE (~0)
48#define PRIM_NONE (~0)
49#define LAMP_NONE (~0)
50#define EMITTER_NONE (~0)
51#define ID_NONE (0.0f)
52#define PASS_UNUSED (~0)
53#define LIGHTGROUP_NONE (~0)
54
55#define LIGHT_LINK_SET_MAX 64
56#define LIGHT_LINK_MASK_ALL (~uint64_t(0))
57
58#define INTEGRATOR_SHADOW_ISECT_SIZE_CPU 1024U
59#define INTEGRATOR_SHADOW_ISECT_SIZE_GPU 4U
60
61#ifdef __KERNEL_GPU__
62# define INTEGRATOR_SHADOW_ISECT_SIZE INTEGRATOR_SHADOW_ISECT_SIZE_GPU
63#else
64# define INTEGRATOR_SHADOW_ISECT_SIZE INTEGRATOR_SHADOW_ISECT_SIZE_CPU
65#endif
66
67/* All ShaderData structs need to have the same alignment. */
68#ifdef __KERNEL_ONEAPI__
69/* On Intel GPUs, for large structs in private memory, an alignment of 64 gives the best
70 * performance. */
71# define SHADER_DATA_ALIGNMENT 64
72#else
73# define SHADER_DATA_ALIGNMENT 16
74#endif
75
76// NOLINTEND
77
78/* Sampling Patterns */
79
80/* Unique numbers for sampling patterns in each bounce. */
82 /* Init bounce */
85
86 /* Shade bounce */
90 /* Surface */
95
96 /* Guiding RIS */
99
100 /* Volume */
110
111 /* Subsurface random walk bounces */
117
118 /* Subsurface disk bounce */
121
122 /* Volume density baking. */
124
125 /* Sample wavelength for dispersion. */
127
128 /* High enough number so we don't need to change it when adding new dimensions,
129 * low enough so there is no uint16_t overflow with many bounces. */
131};
132
144
145/* --------------------------------------------------------------------
146 * Path and ray visibility.
147 *
148 * Path visibility is essentially ray visibility when it comes to ray tracing, but it carries a bit
149 * of extra semantic information in the wavefront state. For example, a path that has visibility
150 * set to PATH_RAY_VISIBILITY_CAMERA means that this is a primary path (comes directly from the
151 * camera or only went through transparency).
152 *
153 * The underlying storage matches PathRayVisibility, to avoid possible narrowing when applying bit
154 * shifts when calculating ray visibility from a path.
155 *
156 * NOTE: State (both main and shadow) stores a limited subset of this enum, limited to bits in
157 * the PATH_RAY_VISIBILITY_ALL (but it is not checked at compile time).
158 *
159 * NOTE: Both PathRayVisibilityFlag and PathRayFlag flags are packed into ShaderGlobals::raytype.
160 * Keep in sync with the raytype mapping in the osl.cpp OSLManager::shading_system_init().
161 *
162 * NOTE: Recalculated after a surface bounce. */
163enum PathRayVisibilityFlag : uint32_t {
165
171
172 /* Shadow ray visibility. */
177
178 /* Set of flags used for path ray visibility. */
179 PATH_RAY_VISIBILITY_ALL = ((1U << 7U) - 1U),
180
181 /* Raycast shader node rays, not part of the path. */
183
184 /* Set of all flags an object can be visible to.
185 *
186 * NOTE: SHADOW_CATCHER and OSL macros below assume there are no more than 16 visibility bits. */
188
189 /* Special flag to tag unaligned BVH nodes.
190 * Only set and used in BVH nodes to distinguish how to interpret bounding box information stored
191 * in the node (either it should be intersected as AABB or as OBB). */
193};
194
195/* Stored as uint8_t in the integrator state. */
196static_assert(PATH_RAY_VISIBILITY_ALL <= 0xff);
197
198/* Type that is used to pass visibility flags around in the kernel.
199 * It is a wider type than the number of bits required by the PathRayVisibilityFlag enum values
200 * due to shadow catcher visibility (see shadow catcher utilities below). */
201using PathRayVisibility = uint32_t;
202
203/* --------------------------------------------------------------------
204 * Path flags.
205 */
206enum PathRayFlag : uint32_t {
208
209 /* NOTE: These are the bits that have to be packed into the high word of OSL's raytype and that
210 * are actually checked by the OSL integration. */
211
212 PATH_RAY_REFLECT = (1U << 0U),
213 PATH_RAY_SINGULAR = (1U << 1U),
216
217 /* Diffuse bounce earlier in the path, skip SSS to improve performance
218 * and avoid branching twice with disk sampling SSS. */
220
221 /* Path and shader is being evaluated for direct lighting emission. */
222 PATH_RAY_EMISSION = (1U << 5U),
223
224 /* NOTE: Some of these bits might be packed into the OSL's raytype (up to 16 bit in total for the
225 * path flag), but their presence is not important as it is not checked. */
226
227 /* Surface had transmission component at previous bounce. Used for light tree
228 * traversal and culling to be consistent with MIS PDF at the next bounce. */
230
231 /* Don't apply multiple importance sampling weights to emission from
232 * lamp or surface hits, because they were not direct light sampled. */
233 PATH_RAY_MIS_SKIP = (1U << 7U),
234
235 /* Single pass has been written. */
237
238 /* Zero background alpha, for camera or transparent glass rays. */
240
241 /* Terminate ray immediately at next bounce. */
244
245 /* Ray is to be terminated, but continue with transparent bounces and emission as long as we
246 * encounter them. This is required to make the MIS between direct and indirect light rays match,
247 * as shadow rays go through transparent surfaces to reach emission too. */
249
250 /* Terminate ray immediately after volume shading. */
252
253 /* Ray is to be terminated. */
256
257 /* Perform subsurface scattering. */
263
264 /* Contribute to denoising features. */
266
267 /* Render pass categories. */
269 PATH_RAY_VOLUME_PASS = (1U << 19U),
271
272 /* Shadow ray is for AO. */
274
275 /* A shadow catcher object was hit and the path was split into two. */
277
278 /* A shadow catcher object was hit and this path traces only shadow catchers, writing them into
279 * their dedicated pass for later division.
280 *
281 * NOTE: Is not covered with `PATH_RAY_ANY_PASS` because shadow catcher does special handling
282 * which is separate from the light passes. */
284
285 /* Path is evaluating background for an approximate shadow catcher with non-transparent film. */
287
288 /* TODO(weizhen): should add another flag to record only the primary scatter, but then we need to
289 * change the flag to 64 bits or split path_flags in two. Right now we also write volume scatter
290 * if the primary hit is surface, but that seems fine. */
291
292 /* Volume scattering probability guiding. This flag is added to path where the primary ray passed
293 * through the volume without scattering. */
295
296 /* The current shadow ray is a light linking (forward) and not next-event shadow ray. */
298
299 /* Path and shader is being evaluated for volume extinction. */
300 PATH_RAY_EXTINCTION = (1U << 26U),
301
302 /* Path has associated wavelength. */
303 PATH_RAY_SPECTRAL = (1U << 27U),
304};
305
306// 8bit enum, just in case we need to move more variables in it
309
310 PATH_MNEE_VALID = (1U << 0U),
313
314 /* MNEE path was successfully sampled in intersect_mnee. */
315 PATH_MNEE_SAMPLED = (1U << 3U),
316};
317
318/* Configure ray visibility bits for rays and objects respectively,
319 * to make shadow catchers work.
320 *
321 * On shadow catcher paths we want to ignore any intersections with non-catchers,
322 * whereas on regular paths we want to intersect all objects. */
323
324static_assert(PATH_RAY_VISIBILITY_OBJECT_ALL <= 0xffff);
325
326#define SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) (uint32_t(visibility) << 16)
327
328#define SHADOW_CATCHER_PATH_VISIBILITY(path_flag, visibility) \
329 (((path_flag) & PATH_RAY_SHADOW_CATCHER_PASS) ? SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) : \
330 uint32_t(visibility))
331
332#define SHADOW_CATCHER_OBJECT_VISIBILITY(is_shadow_catcher, visibility) \
333 (((is_shadow_catcher) ? SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) : 0) | uint32_t(visibility))
334
335/* Helpers to pack and unpack path information into a single 32bit integer.
336 *
337 * The packed result is stored in the OSL's ShaderGlobals::raytype. It is used by the raytype()
338 * OSL function in shaders, as well as attribute fetching functionality.
339 *
340 * Note that while the entire PathRayVisibilityFlag flags are stored in the rayrtype, only part of
341 * the PathRayFlag is stored. */
342
343static_assert(PATH_RAY_VISIBILITY_OBJECT_ALL <= 0xffff);
344
345#define OSL_RAYTYPE_PACK(visibility, path_flag) \
346 (int((uint32_t((path_flag) & 0xffff) << 16) | uint32_t((visibility) & 0xffff)))
347
348#define OSL_RAYTYPE_TO_VISIBILITY(raytype) ((raytype) & 0xffff)
349#define OSL_RAYTYPE_TO_PARTIAL_PATH_FLAG(raytype) ((raytype) >> 16)
350
351/* Closure Label */
352
367
368/* Render Passes */
369
370#define PASS_NAME_JOIN(a, b) a##_##b
371#define PASSMASK(pass) (1 << ((PASS_NAME_JOIN(PASS, pass)) % 32))
372
373// NOTE: Keep in sync with `Pass::get_type_enum()`.
376
377 /* Light Passes */
397
398 /* Data passes */
416 /* No Scatter color since it's tricky to define what it would even mean. */
419
420 /* PASS_SHADOW_CATCHER accumulates contribution of shadow catcher object which is not affected by
421 * any other object. The pass accessor will divide the combined pass by the shadow catcher. The
422 * result of this division is then to be multiplied with the backdrop. The alpha channel of this
423 * pass contains number of samples which contributed to the color components of the pass.
424 *
425 * PASS_SHADOW_CATCHER_SAMPLE_COUNT contains number of samples for which the path split
426 * happened.
427 *
428 * PASS_SHADOW_CATCHER_MATTE contains pass which contains non-catcher objects. This pass is to be
429 * alpha-overed onto the backdrop (after multiplication). */
433
434 /* Guiding related debug rendering passes */
435 /* The estimated sample color from the PathSegmentStorage. If everything is integrated correctly
436 * the output should be similar to PASS_COMBINED. */
438 /* The guiding probability at the first bounce. */
440 /* The avg. roughness at the first bounce. */
442 /* The majorant optical depth along the ray, for volume scattering probability guiding.
443 * When reading this pass, it is converted to majorant transmittance */
447
448 /* Denoising passes */
457
462
464
466};
467
468#define PASS_ANY (~0) // NOLINT
469
472 CRYPT_OBJECT = (1 << 0),
473 CRYPT_MATERIAL = (1 << 1),
474 CRYPT_ASSET = (1 << 2),
475 CRYPT_ACCURATE = (1 << 3),
476};
477
478struct BsdfEval {
482};
483
485 /* Whether to follow reflections for the denoising passes. */
487 /* Whether to use roughness-based weighting for the albedo or split by the BSDF type. */
489};
490
491/* Closure Filter */
492
501
502/* Shader Flag */
503
520
530
531/* Light Type */
532
541
542/* Guiding Distribution Type */
543
551
552/* Guiding Directional Sampling Type */
553
561
562/* Camera Type */
563
565
566/* Panorama Type */
567
578
579/* Specifies an offset for the shutter's time interval. */
581 /* Shutter opens at the current frame. */
583 /* Shutter is fully open at the current frame. */
585 /* Shutter closes at the current frame. */
587
589};
590
591/* Direct Light Sampling */
592
600
601/* Differential */
602
607
609 float dx;
610 float dy;
611};
612
613/* Ray */
614
616 int prim; /* Primitive the ray is starting from */
617 int object; /* Instance prim is a part of */
618 int light_prim; /* Light primitive */
619 int light_object; /* Light object */
620};
621
622struct Ray {
623 float3 P; /* origin */
624 float3 D; /* direction */
625 float tmin; /* start distance */
626 float tmax; /* end distance */
627 float time; /* time (for motion blur) */
628
629#ifdef __RAY_DIFFERENTIALS__
630 float dP;
631 float dD;
632#endif
633
635};
636
637/* Intersection */
638
640 float t, u, v;
641 int prim;
643 int type;
644};
645
646/* On certain GPUs (Apple Silicon), splitting every integrator state field into its own separate
647 * array can be detrimental for cache utilization. By enabling __INTEGRATOR_GPU_PACKED_STATE__, we
648 * specify that certain fields should be packed together. This improves cache hit ratios in cases
649 * where fields are often accessed together (e.g. "ray" and "isect").
650 */
651#if (defined(__APPLE__) && TARGET_CPU_ARM64) || \
652 (defined(__KERNEL_METAL_APPLE__) && defined(__KERNEL_METAL_TARGET_CPU_ARM64__))
653# define __INTEGRATOR_GPU_PACKED_STATE__
654
655/* Generate packed layouts for structs declared with KERNEL_STRUCT_BEGIN_PACKED. For example the
656 * following template...
657 *
658 * KERNEL_STRUCT_BEGIN_PACKED(shadow_ray, KERNEL_FEATURE_PATH_TRACING)
659 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, packed_float3, P, KERNEL_FEATURE_PATH_TRACING)
660 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, packed_float3, D, KERNEL_FEATURE_PATH_TRACING)
661 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, tmin, KERNEL_FEATURE_PATH_TRACING)
662 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, tmax, KERNEL_FEATURE_PATH_TRACING)
663 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, time, KERNEL_FEATURE_PATH_TRACING)
664 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, dP, KERNEL_FEATURE_PATH_TRACING)
665 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, int, self_light, KERNEL_FEATURE_SHADOW_LINKING)
666 * KERNEL_STRUCT_END(shadow_ray)
667 *
668 * ...will produce the following packed struct:
669 *
670 * struct packed_shadow_ray {
671 * packed_float3 P;
672 * packed_float3 D;
673 * float tmin;
674 * float tmax;
675 * float time;
676 * float dP;
677 * int self_light;
678 * };
679 */
680
681# define KERNEL_STRUCT_BEGIN(name) struct dummy_##name {
682# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) struct packed_##parent_struct {
683# define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature)
684# ifdef __KERNEL_GPU__
685# define KERNEL_STRUCT_MEMBER_PACKED(parent_struct, type, name, feature) type name;
686# else
687# define KERNEL_STRUCT_MEMBER_PACKED(parent_struct, type, name, feature) \
688 gpu_state_storage<type>::gpu_type name;
689# endif
690# define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) type name;
691# define KERNEL_STRUCT_END(name) \
692 } \
693 ;
694# define KERNEL_STRUCT_END_ARRAY(name, cpu_size, gpu_size) \
695 } \
696 ;
697# define KERNEL_STRUCT_VOLUME_STACK_SIZE MAX_VOLUME_STACK_SIZE
698
701
702# undef KERNEL_STRUCT_BEGIN
703# undef KERNEL_STRUCT_BEGIN_PACKED
704# undef KERNEL_STRUCT_MEMBER
705# undef KERNEL_STRUCT_MEMBER_PACKED
706# undef KERNEL_STRUCT_ARRAY_MEMBER
707# undef KERNEL_STRUCT_END
708# undef KERNEL_STRUCT_END_ARRAY
709# undef KERNEL_STRUCT_VOLUME_STACK_SIZE
710
711#endif
712
713/* Primitives */
714
745
746/* Convert type to index in range 0..PRIMITIVE_NUM-1. */
747#define PRIMITIVE_INDEX(type) \
748 (bitscan((uint32_t)(type)) * 2 + (((type) & PRIMITIVE_MOTION) ? 1 : 0))
749
750/* Pack segment into type value to save space. */
751#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_BITS) | (type))
752#define PRIMITIVE_UNPACK_SEGMENT(type) (type >> PRIMITIVE_NUM_BITS)
753
761
762/* Attributes */
763
770
772 /* Elements for regular domains. */
782
783 /* Elements with special encoding where the data type for storage does not
784 * match the data type returned when reading the attribute and needs a
785 * conversion or interpolation when reading. */
789
790 /* Only these combinations are supported by the kernel and can be
791 * created on geometry. */
793
796
798};
799
846
848 ATTR_SUBDIVIDE_SMOOTH_FVAR = (1 << 0), /* This attribute is face-varying and requires smooth
849 * subdivision (typically UV map). */
850};
851
857
858/* For looking up attributes on objects and geometry. */
860 uint64_t id; /* Global unique identifier. */
861 int offset; /* Offset into __attributes global arrays. */
862 uint16_t element; /* AttributeElement. */
863 uint8_t type; /* NodeAttributeType. */
864 uint8_t pad;
865};
866
867/* Closure data */
868
869#ifndef __MAX_CLOSURE__
870# define MAX_CLOSURE 64
871#else
872# define MAX_CLOSURE __MAX_CLOSURE__
873#endif
874
875/* For manifold next event estimation, we need space to store and evaluate
876 * 2 closures (with extra data) on the refractive interfaces, in addition
877 * to keeping the full sd at the current shading point. We need 4 because a
878 * refractive BSDF is instanced with a companion reflection BSDF, even though
879 * we only need the refractive one, and each of them requires 2 slots. */
880#ifndef __CAUSTICS_MAX_CLOSURE__
881# define CAUSTICS_MAX_CLOSURE 4
882#else
883# define CAUSTICS_MAX_CLOSURE __CAUSTICS_MAX_CLOSURE__
884#endif
885
886#ifndef __MAX_VOLUME_STACK_SIZE__
887# define MAX_VOLUME_STACK_SIZE 32
888#else
889# define MAX_VOLUME_STACK_SIZE __MAX_VOLUME_STACK_SIZE__
890#endif
891
892#define MAX_VOLUME_CLOSURE 8 // NOLINT
893/* Set the maximal resolution to be 128 (2^7) to limit traversing overhead. */
894#define VOLUME_OCTREE_MAX_DEPTH 7
895
896/* This struct is the base class for all closures. The common members are
897 * duplicated in all derived classes since we don't have C++ in the kernel
898 * yet, and because it lets us lay out the members to minimize padding. The
899 * weight member is located at the beginning of the struct for this reason.
900 *
901 * ShaderClosure has a fixed size, and any extra space must be allocated
902 * with closure_alloc_extra().
903 *
904 * We pad the struct to align to 16 bytes. All shader closures are assumed
905 * to fit in this struct size. CPU sizes are a bit larger because float3 is
906 * padded to be 16 bytes, while it's only 12 bytes on the GPU. */
907
908#define SHADER_CLOSURE_BASE \
909 Spectrum weight; \
910 ClosureType type; \
911 float sample_weight; \
912 float3 N
913
914/* To save some space, volume closures (phase functions) don't store a normal.
915 * They are still allocated as ShaderClosures first, but get assigned to
916 * slots of type ShaderVolumeClosure later, so make sure to keep the layout
917 * in sync. */
918#define SHADER_CLOSURE_VOLUME_BASE \
919 Spectrum weight; \
920 ClosureType type; \
921 float sample_weight
922
923struct ccl_align(16) ShaderClosure {
925
926 /* Extra space for closures to store data, somewhat arbitrary but closures
927 * assert that their size fits. */
928 char pad[sizeof(Spectrum) * 2 + sizeof(float) * 4];
929};
930
931/* Shader Data
932 *
933 * Main shader state at a point on the surface or in a volume. All coordinates
934 * are in world space.
935 */
936
937/* Shader runtime flags, determined during rendering. */
939 /* Set when ray hits backside of surface. */
940 SR_BACKFACING = (1 << 0),
941 /* Shader evaluation needs to be redone, because of texture cache miss */
942 SR_CACHE_MISS = (1 << 1),
943
944 /* Shader has non-zero emission. */
945 SR_EMISSION = (1 << 2),
946 /* Shader has BSDF closure. */
947 SR_BSDF = (1 << 3),
948 /* Shader has non-singular BSDF closure. */
950 /* Shader has BSSRDF closure. */
951 SR_BSSRDF = (1 << 5),
952 /* Shader has holdout closure. */
953 SR_HOLDOUT = (1 << 6),
954 /* Shader has non-zero volume extinction. */
955 SR_EXTINCTION = (1 << 7),
956 /* Shader has a volume phase (scatter) closure. */
957 SR_SCATTER = (1 << 8),
958 /* Shader is being evaluated in a volume. */
960 /* Shader has transparent closure. */
961 SR_TRANSPARENT = (1 << 10),
962 /* BSDF has a transmissive component. */
964 /* Shader has ray portal closure. */
965 SR_RAY_PORTAL = (1 << 12),
966 /* BSDF has dispersion. */
968
969 /* Flags that indicate the presence of closures. */
973};
974
975/* Shader flags that are set after compiling the shaders. */
977 /* If the shader is wavelength-dependent. */
979 /* If Light Path Node is present in the shader graph. */
981 /* Has bump mapping from BSDF connected to surface socket. */
983 /* Apply a correction term to smooth illumination on grazing angles when using bump mapping. */
985 /* Use front side for direct light sampling. */
986 SD_MIS_FRONT = (1 << 16),
987 /* Has transparent shadow. */
989 /* Has volume shader. */
990 SD_HAS_VOLUME = (1 << 18),
991 /* Has only volume shader, no surface. */
993 /* Has heterogeneous volume. */
995 /* BSSRDF normal uses bump. */
997 /* Use equiangular volume sampling */
999 /* Use multiple importance volume sampling. */
1000 SD_VOLUME_MIS = (1 << 23),
1001 /* Use cubic interpolation for voxels. */
1002 SD_VOLUME_CUBIC = (1 << 24),
1003 /* Has bump mapping from the displacement socket. */
1006 /* Has true displacement. */
1008 /* Has constant emission (value stored in __shaders) */
1010 /* Needs to access attributes for volume rendering */
1012 /* Shader has emission */
1013 SD_HAS_EMISSION = (1 << 29),
1014 /* Shader has ray-tracing. */
1015 SD_HAS_RAYTRACE = (1 << 30),
1016 /* Use back side for direct light sampling. */
1017 SD_MIS_BACK = (1 << 31),
1018};
1019
1020/* Object flags. */
1022 /* Holdout for camera rays. */
1024 /* Has object motion blur. */
1025 SD_OBJECT_MOTION = (1u << 1),
1026 /* Vertices have transform applied. */
1028 /* The object's transform applies a negative scale. */
1030 /* Object has a volume shader. */
1032 /* Object intersects AABB of an object with volume shader. */
1034 /* Has position for motion vertices. */
1036 /* object is used to catch shadows */
1038 /* object has volume attributes */
1040 /* object is caustics caster */
1042 /* object is caustics receiver */
1044 /* object has attribute for volume motion */
1046 /* Geometry has per-corner normals instead of per-vertex. */
1048
1049 /* object is using caustics */
1051
1057};
1058
1059struct ccl_align(SHADER_DATA_ALIGNMENT) ShaderData {
1060 /* position */
1061 float3 P;
1062 /* smooth normal for shading */
1063 float3 N;
1064 /* true geometric normal */
1065 float3 Ng;
1066 /* view/incoming direction */
1067 float3 wi;
1068
1069 /* combined type and curve segment for hair */
1070 int type;
1071
1072 /* shader id */
1073 int shader;
1074 /* booleans describing shader, see ShaderRuntimeFlag */
1075 int runtime_flag;
1076 /* booleans describing shader, see ShaderDataFlag */
1077 int shader_flag;
1078 /* booleans describing object of the shader, see ShaderDataObjectFlag */
1079 uint object_flag;
1080
1081 /* Closure data, we store a fixed array of closures */
1082 int num_closure;
1083 int num_closure_left;
1084
1085 /* primitive id if there is one, ~0 otherwise */
1086 int prim;
1087
1088 /* parametric coordinates
1089 * - barycentric weights for triangles */
1090 float u;
1091 float v;
1092 /* object id if there is one, ~0 otherwise */
1093 int object;
1094
1095 /* motion blur sample time */
1096 float time;
1097
1098 /* length of the ray being shaded */
1099 float ray_length;
1100
1101#ifdef __RAY_DIFFERENTIALS__
1102 /* Radius of differential of P. */
1103 float dP;
1104 /* Radius of differential of wi. */
1105 float dI;
1106 /* differential of u, v */
1107 differential du;
1108 differential dv;
1109#endif
1110#ifdef __DPDU__
1111 /* differential of P w.r.t. parametric coordinates. note that dPdu is
1112 * not readily suitable as a tangent for shading on triangles. */
1113 float3 dPdu;
1114 float3 dPdv;
1115#endif
1116
1117#ifdef __OBJECT_MOTION__
1118 /* Object <-> world space transformations for motion blur, cached to avoid
1119 * re-interpolating them constantly for shading. */
1120 Transform ob_tfm_motion;
1121 Transform ob_itfm_motion;
1122#endif
1123
1124 /* ray start position, only set for backgrounds */
1125 float3 ray_P;
1126 float ray_dP;
1127
1128 /* LCG state for closures that require additional random numbers. */
1129 uint lcg_state;
1130#ifdef __SPECTRAL__
1131 /* Random number for sampling the wavelength. */
1132 float rand_wavelength;
1133#endif
1134
1135 /* Closure weights summed directly, so we can evaluate
1136 * emission and shadow transparency with MAX_CLOSURE 0. */
1137 Spectrum closure_emission_background;
1138 Spectrum closure_transparent_extinction;
1139
1140 /* At the end so we can adjust size in ShaderDataTinyStorage. */
1141 struct ShaderClosure closure[MAX_CLOSURE];
1142};
1143
1144#ifdef __KERNEL_GPU__
1145/* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
1146 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1147struct ccl_align(SHADER_DATA_ALIGNMENT) ShaderDataTinyStorage {
1148 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * MAX_CLOSURE];
1149};
1150
1151/* ShaderDataCausticsStorage needs the same alignment as ShaderData, or else
1152 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1153struct ccl_align(SHADER_DATA_ALIGNMENT) ShaderDataCausticsStorage {
1154 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * (MAX_CLOSURE - CAUSTICS_MAX_CLOSURE)];
1155};
1156#else
1157/* On the CPU use full size, to avoid compiler and ASAN warnings. */
1158using ShaderDataTinyStorage = ShaderData;
1159using ShaderDataCausticsStorage = ShaderData;
1160#endif
1161
1162#define AS_SHADER_DATA(shader_data_tiny_storage) \
1163 ((ccl_private ShaderData *)shader_data_tiny_storage)
1164
1165/* Compact volume closures storage.
1166 *
1167 * Used for decoupled direct/indirect light closure storage.
1168 *
1169 * This shares its basic layout with SHADER_CLOSURE_VOLUME_BASE and ShaderClosure,
1170 * just without the normal and with less space for closure-specific parameters.
1171 * That way, we can just cast ShaderClosure* to ShaderVolumeClosure* and assign it.
1172 */
1177 /* Space for closure-specific parameters. */
1178 float param[3];
1179};
1180
1185
1186/* Volume Stack */
1187
1188#ifdef __VOLUME__
1189struct VolumeStack {
1190 int object;
1191 int shader;
1192};
1193#endif
1194
1195/* Struct to gather multiple nearby intersections. */
1201
1202/* Constant Kernel Data
1203 *
1204 * These structs are passed from CPU to various devices, and the struct layout
1205 * must match exactly. Structs are padded to ensure 16 byte alignment, and we
1206 * do not use float3 because its size may not be the same on all devices. */
1207
1209 /* type */
1210 int type;
1212
1213 /* depth of field */
1215 float blades;
1218
1219 /* motion blur */
1222
1223 int pad1;
1224 int pad2;
1225 int pad3;
1226
1227 /* panorama */
1235
1236 /* stereo */
1241
1242 /* matrices */
1245
1246 /* differentials */
1249
1250 /* Scale up differentials for progressive rendering, so that mip levels for the
1251 * full resolution are used rather than loading unnecessary lower levels. */
1253
1254 /* clipping */
1257
1258 /* sensor size */
1261
1262 /* render size */
1264
1265 /* anamorphic lens bokeh */
1267
1269
1270 /* more matrices */
1278
1279 /* Stores changes in the projection matrix. Use for camera zoom motion
1280 * blur and motion pass output for perspective camera. */
1283
1284 /* Transforms for motion pass. */
1287
1289
1290 /* Rolling shutter */
1293
1295};
1297
1301
1304
1307
1316
1317 float scale;
1320
1324
1325 /* Number of components to write to. */
1327
1328 /* Number of floats per pixel. When zero is the same as `num_components`.
1329 * NOTE: Is ignored for half4 destination. */
1331
1333
1334 /* Padding. */
1335 int pad1;
1336};
1338
1364
1365/* Specialized struct that can become constants in dynamic compilation. */
1366#define KERNEL_STRUCT_BEGIN(name, parent) struct ccl_align(16) name {
1367#define KERNEL_STRUCT_END(name) \
1368 } \
1369 ; \
1370 static_assert_align(name, 16);
1371
1372#ifdef __KERNEL_USE_DATA_CONSTANTS__
1373# define KERNEL_STRUCT_MEMBER(parent, type, name) type __unused_##name;
1374#else
1375# define KERNEL_STRUCT_MEMBER(parent, type, name) type name;
1376#endif
1377
1378#include "kernel/data_template.h"
1379
1395
1403
1407
1409 float time;
1410 float frame;
1411};
1412
1413struct ccl_align(16) KernelData {
1414 /* Features and limits. */
1415 uint64_t kernel_features;
1416 uint max_closures;
1417 uint max_shaders;
1418 uint volume_stack_size;
1419
1420 /* Always dynamic data members. */
1421 KernelCamera cam;
1422 KernelBake bake;
1423 KernelTables tables;
1424 KernelLightLinkSet light_link_sets[LIGHT_LINK_SET_MAX];
1425 KernelSceneTime scene_time;
1426
1427 /* Potentially specialized data members. */
1428#define KERNEL_STRUCT_BEGIN(name, parent) name parent;
1429#include "kernel/data_template.h"
1430
1431 /* Device specific BVH. */
1432#ifdef __KERNEL_OPTIX__
1433 OptixTraversableHandle device_bvh;
1434#elif defined __KERNEL_METALRT__
1435 metalrt_as_type device_bvh;
1436#elif defined(__KERNEL_HIPRT__)
1437 void *device_bvh;
1438#else
1439# ifdef __EMBREE__
1440# if RTC_VERSION >= 40400
1441 RTCTraversable device_bvh;
1442# else
1443 RTCScene device_bvh;
1444# endif
1445# ifndef __KERNEL_64_BIT__
1446 int pad1;
1447# endif
1448# else
1449 int device_bvh, pad1;
1450# endif
1451#endif
1452 int pad2, pad3;
1453};
1454static_assert_align(KernelData, 16);
1455
1456/* Kernel data structures. */
1457
1461
1462 float pass_id;
1464 float color[3];
1465 float alpha;
1467
1469 float dupli_uv[2];
1470
1474
1477
1478 /* Cached offset into attribute arrays, as these are accessed often. */
1480
1481 union {
1482 /* Information about mesh and volume objects. */
1483 struct {
1484 int num_prims;
1485
1486 float volume_density;
1488
1489 int normal_offset;
1490 } mesh_volume;
1491
1492 /* Information about Gaussian splat objects. */
1493 struct {
1494 /* Offset for the attributes.
1495 * The least significant bit denotes whether the attribute has motion. */
1499
1501 } gsplat;
1502 };
1503
1506
1509
1511
1513
1516
1517 /* TODO: separate array to avoid memory overhead when not used. */
1522};
1524
1532
1534 int prim;
1535 int type;
1536};
1538
1541 float radius;
1547 /* For non-uniform object scaling, the actual spread might be different. */
1549 /* Distance from the apex of the smallest enclosing cone of the light spread to light center. */
1551};
1552
1553/* PointLight is SpotLight with only radius and invarea being used. */
1554
1566
1575
1592
1600
1601/* Bounding box. */
1606
1612
1613enum LightTreeNodeType : uint8_t {
1618};
1619
1621 /* Bounding box. */
1623
1624 /* Bounding cone. */
1626
1627 /* Energy. */
1628 float energy;
1629
1631
1632 /* Leaf nodes need to know the number of emitters stored. */
1634
1635 union {
1636 struct {
1637 int first_emitter; /* The index of the first emitter. */
1638 } leaf;
1639 struct {
1640 /* Indices of the children. */
1641 int left_child;
1642 int right_child;
1643 } inner;
1644 struct {
1645 int reference; /* A reference to the node with the subtree. */
1646 } instance;
1647 };
1648
1649 /* Bit trail. */
1651
1652 /* Bits to skip in the bit trail, to skip nodes in for specialized trees. */
1653 uint8_t bit_skip;
1654
1655 /* Padding. */
1656 uint8_t pad[11];
1657};
1659
1666
1668 /* Index of the parent node in device vector `volume_tree_nodes`. */
1670
1671 /* Index of the first child node in device vector `volume_tree_nodes`. All children of the same
1672 * node are stored in contiguous memory. */
1674
1675 /* Minimal and maximal volume density inside the node. */
1676 /* TODO(weizhen): we can make sigma Spectral for better accuracy. Since only root and leaf nodes
1677 * need sigma, we can introduce `KernelOctreeInnerNode` to reduce the size of the struct. */
1679};
1680
1682 /* Bounding cone. */
1683 float theta_o;
1684 float theta_e;
1685
1686 /* Energy. */
1687 float energy;
1688
1689 union {
1690 struct {
1691 int id; /* The location in the triangles array. */
1693 } triangle;
1694
1695 struct {
1696 int id; /* The location in the lights array. */
1697 } light;
1698
1699 struct {
1700 int object_id;
1701 int node_id;
1702 } mesh;
1703 };
1704
1705 /* Object and shader. */
1708
1709 /* Bit trail from root node to leaf node containing emitter. */
1711};
1713
1716 float age;
1718 float size;
1720 /* Only XYZ are used of the following. float4 instead of float3 are used
1721 * to ensure consistent padding/alignment across devices. */
1725};
1727
1736
1737/* Patches */
1738
1739// NOLINTBEGIN
1740#define PATCH_MAX_CONTROL_VERTS 16
1741
1742/* Patch map node flags */
1743
1744#define PATCH_MAP_NODE_IS_SET (1 << 30)
1745#define PATCH_MAP_NODE_IS_LEAF (1u << 31)
1746#define PATCH_MAP_NODE_INDEX_MASK (~(PATCH_MAP_NODE_IS_SET | PATCH_MAP_NODE_IS_LEAF))
1747// NOLINTEND
1748
1749/* Work Tiles */
1750
1752 uint x, y, w, h;
1753
1757
1760
1761 /* Precalculated parameters used by init_from_camera kernel on GPU. */
1764};
1765
1766/* Shader Evaluation.
1767 *
1768 * Position on a primitive on an object at which we want to evaluate the
1769 * shader for example mesh displacement or light importance map. */
1770
1773 int prim;
1774 float u, v;
1775};
1777
1779 /* Shader evaluation is empty (e.g. no volume density, no emission from light, ..). */
1781 /* Shader evaluation succeeded. */
1783 /* Cache miss means shader evaluation can not be used. */
1785};
1786/* Pre-computed sample table sizes for the tabulated Sobol sampler.
1787 *
1788 * NOTE: min and max samples *must* be a power of two, and patterns
1789 * ideally should be as well.
1790 */
1791// NOLINTBEGIN
1792#define MIN_TAB_SOBOL_SAMPLES 256
1793#define MAX_TAB_SOBOL_SAMPLES 8192
1794#define NUM_TAB_SOBOL_DIMENSIONS 4
1795#define NUM_TAB_SOBOL_PATTERNS 256
1796// NOLINTEND
1797
1798/* Device kernels.
1799 *
1800 * Identifier for kernels that can be executed in device queues.
1801 *
1802 * Some implementation details.
1803 *
1804 * If the kernel uses shared CUDA memory, `CUDADeviceQueue::enqueue` is to be modified.
1805 * The path iteration kernels are handled in `PathTraceWorkGPU::enqueue_path_iteration`. */
1806
1807enum DeviceKernel : int {
1827
1842
1847
1848#define DECLARE_FILM_CONVERT_KERNEL(variant) \
1849 DEVICE_KERNEL_FILM_CONVERT_##variant, DEVICE_KERNEL_FILM_CONVERT_##variant##_HALF_RGBA
1850
1853 DECLARE_FILM_CONVERT_KERNEL(VOLUME_MAJORANT),
1854 DECLARE_FILM_CONVERT_KERNEL(SAMPLE_COUNT),
1856 DECLARE_FILM_CONVERT_KERNEL(LIGHT_PATH),
1860 DECLARE_FILM_CONVERT_KERNEL(CRYPTOMATTE),
1861 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER),
1862 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER_MATTE_WITH_SHADOW),
1865
1866#undef DECLARE_FILM_CONVERT_KERNEL
1867
1871
1880
1883
1885
1887
1889};
1890
1891enum {
1892 /* Megakernel is the first kernel not used by GPU integrator. */
1894};
1895
int pad[32 - sizeof(int)]
#define U
unsigned long long int uint64_t
nullptr FLOAT
#define static_assert_align(st, align)
#define DECLARE_FILM_CONVERT_KERNEL(variant)
#define LIGHT_LINK_SET_MAX
#define SHADER_CLOSURE_BASE
#define MAX_CLOSURE
#define ccl_align(...)
#define CAUSTICS_MAX_CLOSURE
#define CCL_NAMESPACE_END
VecBase< float, 3 > float3
#define RTCTraversable
NodeAttributeType
ClosureType
uint32_t PathRayVisibility
PathRayMNEE
@ PATH_MNEE_RECEIVER_ANCESTOR
@ PATH_MNEE_SAMPLED
@ PATH_MNEE_VALID
@ PATH_MNEE_NONE
@ PATH_MNEE_CULL_LIGHT_CONNECTION
ShaderRuntimeFlag
@ SR_RAY_PORTAL
@ SR_CLOSURE_FLAG
@ SR_TRANSPARENT
@ SR_BSDF_HAS_TRANSMISSION
@ SR_BACKFACING
@ SR_IS_VOLUME_SHADER_EVAL
@ SR_BSDF_HAS_EVAL
@ SR_EMISSION
@ SR_CACHE_MISS
@ SR_BSDF_HAS_DISPERSION
@ SR_HOLDOUT
@ SR_BSDF
@ SR_BSSRDF
@ SR_EXTINCTION
@ SR_SCATTER
FilterClosures
@ FILTER_CLOSURE_EMISSION
@ FILTER_CLOSURE_GLOSSY
@ FILTER_CLOSURE_DIFFUSE
@ FILTER_CLOSURE_TRANSPARENT
@ FILTER_CLOSURE_DIRECT_LIGHT
@ FILTER_CLOSURE_TRANSMISSION
ShaderDataFlag
@ SD_VOLUME_MIS
@ SD_MIS_BACK
@ SD_HAS_TRANSPARENT_SHADOW
@ SD_VOLUME_EQUIANGULAR
@ SD_HAS_BUMP
@ SD_HAS_CONSTANT_EMISSION
@ SD_HAS_DISPLACEMENT
@ SD_HAS_EMISSION
@ SD_MIS_FRONT
@ SD_HAS_BSSRDF_BUMP
@ SD_HAS_ONLY_VOLUME
@ SD_HAS_LIGHT_PATH_NODE
@ SD_HAS_RAYTRACE
@ SD_VOLUME_CUBIC
@ SD_HAS_VOLUME
@ SD_REQUIRES_WAVELENGTH
@ SD_NEED_VOLUME_ATTRIBUTES
@ SD_USE_BUMP_MAP_CORRECTION
@ SD_HAS_BUMP_FROM_DISPLACEMENT
@ SD_HETEROGENEOUS_VOLUME
@ SD_HAS_BUMP_FROM_SURFACE
PrimitiveType
@ PRIMITIVE_LAMP
@ PRIMITIVE_MOTION_CURVE_RIBBON
@ PRIMITIVE_CURVE_THICK_LINEAR
@ PRIMITIVE_ALL
@ PRIMITIVE_MOTION
@ PRIMITIVE_MOTION_TRIANGLE
@ PRIMITIVE_NONE
@ PRIMITIVE_NUM_SHAPES
@ PRIMITIVE_GSPLAT
@ PRIMITIVE_CURVE_RIBBON
@ PRIMITIVE_MOTION_GSPLAT
@ PRIMITIVE_VOLUME
@ PRIMITIVE_NUM
@ PRIMITIVE_MOTION_CURVE_THICK
@ PRIMITIVE_CURVE
@ PRIMITIVE_CURVE_THICK
@ PRIMITIVE_NUM_BITS
@ PRIMITIVE_ANY_POINT
@ PRIMITIVE_TRIANGLE
@ PRIMITIVE_MOTION_CURVE_THICK_LINEAR
@ PRIMITIVE_MOTION_POINT
@ PRIMITIVE_POINT
#define MAX_VOLUME_CLOSURE
ShaderData ShaderDataTinyStorage
LightTreeNodeType
@ LIGHT_TREE_INSTANCE
@ LIGHT_TREE_DISTANT
@ LIGHT_TREE_INNER
@ LIGHT_TREE_LEAF
DirectLightSamplingType
@ DIRECT_LIGHT_SAMPLING_MIS
@ DIRECT_LIGHT_SAMPLING_NUM
@ DIRECT_LIGHT_SAMPLING_NEE
@ DIRECT_LIGHT_SAMPLING_FORWARD
ShaderEvalResult
@ SHADER_EVAL_EMPTY
@ SHADER_EVAL_CACHE_MISS
@ SHADER_EVAL_OK
PathTraceDimension
@ PRNG_SUBSURFACE_COLOR_CHANNEL
@ PRNG_SURFACE_BSDF_GUIDING
@ PRNG_BOUNCE_NUM
@ PRNG_LIGHT_TERMINATE
@ PRNG_VOLUME_PHASE
@ PRNG_SUBSURFACE_BSDF
@ PRNG_LIGHT
@ PRNG_VOLUME_OFFSET
@ PRNG_SURFACE_BSDF
@ PRNG_SUBSURFACE_DISK_RESAMPLE
@ PRNG_BAKE_VOLUME_DENSITY_EVAL
@ PRNG_VOLUME_EXPANSION_ORDER
@ PRNG_LENS_TIME
@ PRNG_VOLUME_SHADE_OFFSET
@ PRNG_SUBSURFACE_GUIDE_STRATEGY
@ PRNG_TERMINATE
@ PRNG_VOLUME_RESERVOIR
@ PRNG_SUBSURFACE_DISK
@ PRNG_WAVELENGTH
@ PRNG_SURFACE_AO
@ PRNG_SUBSURFACE_SCATTER_DISTANCE
@ PRNG_VOLUME_PHASE_GUIDING_DISTANCE
@ PRNG_SURFACE_RIS_GUIDING_0
@ PRNG_SURFACE_BEVEL
@ PRNG_VOLUME_PHASE_GUIDING_EQUIANGULAR
@ PRNG_SUBSURFACE_GUIDE_DIRECTION
@ PRNG_FILTER
@ PRNG_VOLUME_COLOR_CHANNEL
@ PRNG_VOLUME_SCATTER_DISTANCE
@ PRNG_SURFACE_RIS_GUIDING_1
PathRayFlag
@ PATH_RAY_SHADOW_FOR_AO
@ PATH_RAY_SHADOW_CATCHER_HIT
@ PATH_RAY_VOLUME_PASS
@ PATH_RAY_TERMINATE_AFTER_TRANSPARENT
@ PATH_RAY_SINGULAR
@ PATH_RAY_REFLECT
@ PATH_RAY_IMPORTANCE_BAKE
@ PATH_RAY_MIS_HAD_TRANSMISSION
@ PATH_RAY_SUBSURFACE_BACKFACING
@ PATH_RAY_TRANSPARENT
@ PATH_RAY_TERMINATE_AFTER_VOLUME
@ PATH_RAY_SHADOW_CATCHER_PASS
@ PATH_RAY_TERMINATE
@ PATH_RAY_FLAG_NONE
@ PATH_RAY_SINGLE_PASS_DONE
@ PATH_RAY_EMISSION
@ PATH_RAY_TERMINATE_IN_NEXT_VOLUME
@ PATH_RAY_MIS_SKIP
@ PATH_RAY_DENOISING_FEATURES
@ PATH_RAY_SUBSURFACE
@ PATH_RAY_SURFACE_PASS
@ PATH_RAY_SUBSURFACE_DISK
@ PATH_RAY_TRANSPARENT_BACKGROUND
@ PATH_RAY_SHADOW_CATCHER_BACKGROUND
@ PATH_RAY_ANY_PASS
@ PATH_RAY_EXTINCTION
@ PATH_RAY_SHADOW_FOR_LIGHT_LINKING
@ PATH_RAY_TERMINATE_ON_NEXT_SURFACE
@ PATH_RAY_VOLUME_PRIMARY_TRANSMIT
@ PATH_RAY_DIFFUSE_ANCESTOR
@ PATH_RAY_SPECTRAL
@ PATH_RAY_SUBSURFACE_RANDOM_WALK
AttributeFlag
@ ATTR_SUBDIVIDE_SMOOTH_FVAR
CryptomatteType
@ CRYPT_ASSET
@ CRYPT_NONE
@ CRYPT_ACCURATE
@ CRYPT_OBJECT
@ CRYPT_MATERIAL
CurveShapeType
@ CURVE_THICK
@ CURVE_NUM_SHAPE_TYPES
@ CURVE_RIBBON
@ CURVE_THICK_LINEAR
PathRayVisibilityFlag
@ PATH_RAY_VISIBILITY_NODE_UNALIGNED
@ PATH_RAY_VISIBILITY_VOLUME_SCATTER
@ PATH_RAY_VISIBILITY_SHADOW_TRANSPARENT
@ PATH_RAY_VISIBILITY_CAMERA
@ PATH_RAY_VISIBILITY_TRANSMIT
@ PATH_RAY_VISIBILITY_SHADOW
@ PATH_RAY_VISIBILITY_ALL
@ PATH_RAY_VISIBILITY_RAYCAST
@ PATH_RAY_VISIBILITY_DIFFUSE
@ PATH_RAY_VISIBILITY_OBJECT_ALL
@ PATH_RAY_VISIBILITY_NONE
@ PATH_RAY_VISIBILITY_SHADOW_OPAQUE
@ PATH_RAY_VISIBILITY_GLOSSY
ShaderDataObjectFlag
@ SD_OBJECT_MOTION
@ SD_OBJECT_HAS_VOLUME_ATTRIBUTES
@ SD_OBJECT_HAS_CORNER_NORMALS
@ SD_OBJECT_HAS_VOLUME
@ SD_OBJECT_CAUSTICS
@ SD_OBJECT_INTERSECTS_VOLUME
@ SD_OBJECT_NEGATIVE_SCALE
@ SD_OBJECT_HOLDOUT_MASK
@ SD_OBJECT_HAS_VOLUME_MOTION
@ SD_OBJECT_CAUSTICS_RECEIVER
@ SD_OBJECT_FLAGS
@ SD_OBJECT_SHADOW_CATCHER
@ SD_OBJECT_TRANSFORM_APPLIED
@ SD_OBJECT_HAS_VERTEX_MOTION
@ SD_OBJECT_CAUSTICS_CASTER
EmissionSampling
@ EMISSION_SAMPLING_NUM
@ EMISSION_SAMPLING_NONE
@ EMISSION_SAMPLING_AUTO
@ EMISSION_SAMPLING_BACK
@ EMISSION_SAMPLING_FRONT_BACK
@ EMISSION_SAMPLING_FRONT
#define LOCAL_MAX_HITS
ShaderFlag
@ SHADER_EXCLUDE_SHADOW_CATCHER
@ SHADER_EXCLUDE_CAMERA
@ SHADER_EXCLUDE_DIFFUSE
@ SHADER_USE_MIS
@ SHADER_EXCLUDE_ANY
@ SHADER_EXCLUDE_SCATTER
@ SHADER_EXCLUDE_GLOSSY
@ SHADER_EXCLUDE_TRANSMIT
@ SHADER_SMOOTH_NORMAL
@ SHADER_CAST_SHADOW
@ SHADER_MASK
MotionPosition
@ MOTION_POSITION_END
@ MOTION_POSITION_START
@ MOTION_POSITION_CENTER
@ MOTION_NUM_POSITIONS
@ DEVICE_GPU_KERNEL_INTEGRATOR_NUM
GuidingDirectionalSamplingType
@ GUIDING_DIRECTIONAL_SAMPLING_NUM_TYPES
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_PRODUCT_MIS
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_RIS
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_ROUGHNESS
SamplingPattern
@ SAMPLING_PATTERN_AUTOMATIC
@ SAMPLING_PATTERN_BLUE_NOISE_FIRST
@ SAMPLING_PATTERN_TABULATED_SOBOL
@ SAMPLING_PATTERN_BLUE_NOISE_PURE
@ SAMPLING_PATTERN_SOBOL_BURLEY
@ SAMPLING_NUM_PATTERNS
@ SAMPLING_PATTERN_BLUE_NOISE_ROUND
KernelBVHLayout
@ BVH_LAYOUT_OPTIX
@ BVH_LAYOUT_MULTI_HIPRT_EMBREE
@ BVH_LAYOUT_NONE
@ BVH_LAYOUT_MULTI_EMBREEGPU
@ BVH_LAYOUT_METAL
@ BVH_LAYOUT_MULTI_HIPRT
@ BVH_LAYOUT_HIPRT
@ BVH_LAYOUT_EMBREE
@ BVH_LAYOUT_AUTO
@ BVH_LAYOUT_MULTI_OPTIX
@ BVH_LAYOUT_BVH2
@ BVH_LAYOUT_EMBREEGPU
@ BVH_LAYOUT_MULTI_METAL
@ BVH_LAYOUT_MULTI_METAL_EMBREE
@ BVH_LAYOUT_MULTI_EMBREEGPU_EMBREE
@ BVH_LAYOUT_ALL
@ BVH_LAYOUT_MULTI_OPTIX_EMBREE
AttributeElement
@ ATTR_ELEMENT_NONE
@ ATTR_ELEMENT_IS_MOTION
@ ATTR_ELEMENT_VERTEX_NORMAL
@ ATTR_ELEMENT_CORNER_BYTE
@ ATTR_ELEMENT_CURVE_KEY
@ ATTR_ELEMENT_CORNER_NORMAL
@ ATTR_ELEMENT_VOXEL
@ ATTR_ELEMENT_CORNER
@ ATTR_ELEMENT_OBJECT
@ ATTR_ELEMENT_VERTEX
@ ATTR_ELEMENT_IS_BYTE
@ ATTR_ELEMENT_CURVE_KEY_NORMAL
@ ATTR_ELEMENT_IS_NORMAL
@ ATTR_ELEMENT_FACE
@ ATTR_ELEMENT_MESH
@ ATTR_ELEMENT_CURVE
ClosureLabel
@ LABEL_CACHE_MISS
@ LABEL_TRANSMIT
@ LABEL_RAY_PORTAL
@ LABEL_TRANSMIT_TRANSPARENT
@ LABEL_VOLUME_SCATTER
@ LABEL_DIFFUSE
@ LABEL_NONE
@ LABEL_SINGULAR
@ LABEL_GLOSSY
@ LABEL_REFLECT
@ LABEL_TRANSPARENT
@ LABEL_SUBSURFACE_SCATTER
PassType
@ PASS_SHADOW_CATCHER_SAMPLE_COUNT
@ PASS_EMISSION
@ PASS_POSITION
@ PASS_BACKGROUND
@ PASS_TRANSMISSION_DIRECT
@ PASS_VOLUME_DIRECT
@ PASS_UV
@ PASS_TRANSMISSION_COLOR
@ PASS_SHADOW_CATCHER_MATTE
@ PASS_GUIDING_COLOR
@ PASS_DEPTH
@ PASS_MIST
@ PASS_VOLUME_SCATTER
@ PASS_TRANSMISSION_INDIRECT
@ PASS_BAKE_SEED
@ PASS_SHADOW_CATCHER
@ PASS_VOLUME_MAJORANT
@ PASS_DENOISING_NORMAL
@ PASS_ROUGHNESS
@ PASS_DIFFUSE_DIRECT
@ PASS_MOTION
@ PASS_CATEGORY_BAKE_END
@ PASS_MATERIAL_ID
@ PASS_CATEGORY_DENOISING_END
@ PASS_VOLUME_MAJORANT_SAMPLE_COUNT
@ PASS_AO
@ PASS_COMBINED
@ PASS_DIFFUSE
@ PASS_DENOISING_BACKWARD_MOTION
@ PASS_DIFFUSE_INDIRECT
@ PASS_RENDER_TIME
@ PASS_GUIDING_PROBABILITY
@ PASS_CATEGORY_DATA_END
@ PASS_ADAPTIVE_AUX_BUFFER
@ PASS_GLOSSY
@ PASS_OBJECT_ID
@ PASS_DENOISING_SPECULAR_MOTION
@ PASS_DENOISING_ROUGHNESS
@ PASS_AOV_COLOR
@ PASS_NUM
@ PASS_NONE
@ PASS_DENOISING_SPECULAR_ALBEDO
@ PASS_VOLUME_INDIRECT
@ PASS_TRANSMISSION
@ PASS_NORMAL
@ PASS_CRYPTOMATTE
@ PASS_DIFFUSE_COLOR
@ PASS_SAMPLE_COUNT
@ PASS_GLOSSY_DIRECT
@ PASS_MOTION_WEIGHT
@ PASS_DENOISING_ALBEDO
@ PASS_VOLUME
@ PASS_AOV_VALUE
@ PASS_GUIDING_AVG_ROUGHNESS
@ PASS_GLOSSY_COLOR
@ PASS_DENOISING_PREVIOUS
@ PASS_GLOSSY_INDIRECT
@ PASS_BAKE_DIFFERENTIAL
@ PASS_VOLUME_TRANSMIT
@ PASS_DENOISING_DEPTH
@ PASS_BAKE_PRIMITIVE
@ PASS_CATEGORY_LIGHT_END
ShaderData ShaderDataCausticsStorage
AttributePrimitive
@ ATTR_PRIM_SUBD
@ ATTR_PRIM_TYPES
@ ATTR_PRIM_GEOMETRY
PanoramaType
@ PANORAMA_MIRRORBALL
@ PANORAMA_FISHEYE_EQUISOLID
@ PANORAMA_NUM_TYPES
@ PANORAMA_CENTRAL_CYLINDRICAL
@ PANORAMA_EQUIANGULAR_CUBEMAP_FACE
@ PANORAMA_FISHEYE_EQUIDISTANT
@ PANORAMA_FISHEYE_LENS_POLYNOMIAL
@ PANORAMA_EQUIRECTANGULAR
AttributeStandard
@ ATTR_STD_CURVE_INTERCEPT
@ ATTR_STD_GENERATED_TRANSFORM
@ ATTR_STD_UV
@ ATTR_STD_GSPLAT_SCALE
@ ATTR_STD_VOLUME_VELOCITY_Y
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_VERTEX_NORMAL
@ ATTR_STD_UV_TANGENT
@ ATTR_STD_NOT_FOUND
@ ATTR_STD_NONE
@ ATTR_STD_VOLUME_VELOCITY_Z
@ ATTR_STD_POINT_RANDOM
@ ATTR_STD_VERTEX_COLOR
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_NUM
@ ATTR_STD_POSITION_UNDISPLACED
@ ATTR_STD_VOLUME_FLAME
@ ATTR_STD_PTEX_FACE_ID
@ ATTR_STD_GSPLAT_RADIANCE_BASE
@ ATTR_STD_VOLUME_VELOCITY
@ ATTR_STD_POSITION_UNDEFORMED
@ ATTR_STD_VOLUME_COLOR
@ ATTR_STD_VOLUME_HEAT
@ ATTR_STD_NORMAL_UNDISPLACED
@ ATTR_STD_UV_TANGENT_SIGN
@ ATTR_STD_CURVE_RANDOM
@ ATTR_STD_GSPLAT_ROTATION
@ ATTR_STD_UV_TANGENT_SIGN_UNDISPLACED
@ ATTR_STD_SHADOW_TRANSPARENCY
@ ATTR_STD_POSITION
@ ATTR_STD_CORNER_NORMAL
@ ATTR_STD_UV_TANGENT_UNDISPLACED
@ ATTR_STD_GSPLAT_RADIANCE
@ ATTR_STD_GSPLAT_RADIANCE_SPHERICAL_HARMONICS_REST
@ ATTR_STD_PTEX_UV
@ ATTR_STD_POINTINESS
@ ATTR_STD_GENERATED
@ ATTR_STD_RADIUS
@ ATTR_STD_CURVE_LENGTH
@ ATTR_STD_VOLUME_VELOCITY_X
@ ATTR_STD_RANDOM_PER_ISLAND
@ ATTR_STD_PARTICLE
LightType
@ LIGHT_AREA
@ LIGHT_SUN
@ LIGHT_SPOT
@ LIGHT_BACKGROUND
@ LIGHT_TRIANGLE
@ LIGHT_POINT
DenoisingPassFlag
@ DENOISING_PASS_FOLLOW_REFLECTIONS
@ DENOISING_PASS_USE_ALBEDO_ROUGHNESS_WEIGHTING
DeviceKernel
@ DEVICE_KERNEL_ADAPTIVE_SAMPLING_CONVERGENCE_CHECK
@ DEVICE_KERNEL_FILTER_COLOR_POSTPROCESS_FROM_SURFACE
@ DEVICE_KERNEL_INTEGRATOR_RESET
@ DEVICE_KERNEL_INTEGRATOR_QUEUED_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_SHADE_DEDICATED_LIGHT
@ DEVICE_KERNEL_FILTER_COLOR_PREPROCESS
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE
@ DEVICE_KERNEL_INTEGRATOR_SORT_WRITE_PASS
@ DEVICE_KERNEL_SHADER_EVAL_DISPLACE
@ DEVICE_KERNEL_INTEGRATOR_SHADOW_CATCHER_COUNT_POSSIBLE_SPLITS
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_MNEE
@ DEVICE_KERNEL_SHADER_EVAL_VOLUME_DENSITY
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE
@ DEVICE_KERNEL_VOLUME_GUIDING_FILTER_X
@ DEVICE_KERNEL_INTEGRATOR_QUEUED_SHADOW_PATHS_ARRAY
@ DEVICE_KERNEL_FILTER_GUIDING_SET_FAKE_ALBEDO
@ DEVICE_KERNEL_FILTER_COLOR_PREPROCESS_TO_SURFACE
@ DEVICE_KERNEL_FILTER_COLOR_FLIP_Y
@ DEVICE_KERNEL_FILTER_COLOR_POSTPROCESS
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW
@ DEVICE_KERNEL_INTEGRATOR_TERMINATED_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_VOLUME_STACK
@ DEVICE_KERNEL_SHADER_EVAL_BACKGROUND
@ DEVICE_KERNEL_INTEGRATOR_SORTED_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_SHADOW_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_SHADOW_STATES
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE
@ DEVICE_KERNEL_INTEGRATOR_SORT_BUCKET_PASS
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_DEDICATED_LIGHT
@ DEVICE_KERNEL_FILTER_GUIDING_PREPROCESS
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_STATES
@ DEVICE_KERNEL_INTEGRATOR_SHADOW_PATH_MNEE_PENDING
@ DEVICE_KERNEL_INTEGRATOR_TERMINATED_SHADOW_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_MEGAKERNEL
@ DEVICE_KERNEL_NUM
@ DEVICE_KERNEL_INTEGRATOR_ACTIVE_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_INIT_FROM_CAMERA
@ DEVICE_KERNEL_ADAPTIVE_SAMPLING_CONVERGENCE_FILTER_Y
@ DEVICE_KERNEL_INTEGRATOR_SHADE_LIGHT_FORWARD
@ DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME_RAY_MARCHING
@ DEVICE_KERNEL_ADAPTIVE_SAMPLING_CONVERGENCE_FILTER_X
@ DEVICE_KERNEL_INTEGRATOR_SHADE_LIGHT_NEE
@ DEVICE_KERNEL_CRYPTOMATTE_POSTPROCESS
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_INIT_FROM_BAKE
@ DEVICE_KERNEL_SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY
@ DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST
@ DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND
@ DEVICE_KERNEL_FILTER_GUIDING_PREPROCESS_TO_SURFACE
@ DEVICE_KERNEL_VOLUME_GUIDING_FILTER_Y
@ DEVICE_KERNEL_PREFIX_SUM
GuidingDistributionType
@ GUIDING_TYPE_VMM
@ GUIDING_NUM_TYPES
@ GUIDING_TYPE_DIRECTIONAL_QUAD_TREE
@ GUIDING_TYPE_PARALLAX_AWARE_VMM
CameraType
@ CAMERA_PERSPECTIVE
@ CAMERA_PANORAMA
@ CAMERA_CUSTOM
@ CAMERA_ORTHOGRAPHIC
#define N
std::string time(const std::tm &date_time, TimeFormat format=TimeFormat::H24)
unsigned int uint
Definition BKE_text.h:55
ATTR_WARN_UNUSED_RESULT const BMVert * v
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
AttributeElement element
NodeAttributeType type
uint16_t element
Spectrum sum
Spectrum diffuse
Spectrum glossy
packed_float3 axis_u
packed_float3 axis_v
packed_float3 dir
packed_float3 min
packed_float3 max
packed_float3 axis
ProjectionTransform ndctoworld
float pole_merge_angle_to
int have_perspective_motion
ProjectionTransform rastertocamera
float pole_merge_angle_from
float4 central_cylindrical_range
int use_dof_or_motion_blur
ProjectionTransform worldtoraster
float fisheye_lens_polynomial_bias
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
ProjectionTransform worldtondc
float convergence_distance
float differential_scale
ProjectionTransform rastertoworld
float4 fisheye_lens_polynomial_coefficients
int use_approximate_shadow_catcher_background
int pass_shadow_catcher_sample_count
LightTreeNodeType type
KernelBoundingBox bbox
KernelBoundingCone bcone
float strength[3]
packed_float3 co
Transform tfm
uint64_t shadow_set_membership
Transform itfm
float dupli_uv[2]
float shadow_terminator_geometry_offset
float cryptomatte_asset
uint16_t num_tfm_steps
uint blocker_shadow_set
uint attribute_map_offset
uint receiver_light_set
uint64_t light_set_membership
float shadow_terminator_shading_offset
float dupli_generated[3]
uint16_t num_geom_steps
float cryptomatte_object
Extrema< float > sigma
packed_float3 translation
packed_float3 scale
float4 angular_velocity
float constant_emission[3]
float half_cot_half_spot_angle
packed_float3 dir
float cos_half_larger_spread
float half_inv_sin_half_angle
int ggx_gen_schlick_ior_s
Intersection hits[LOCAL_MAX_HITS]
float3 Ng[LOCAL_MAX_HITS]
float tmax
float tmin
float3 P
float time
RaySelfPrimitives self
float3 D
ShaderVolumeClosure closure[MAX_VOLUME_CLOSURE]
float3 Spectrum
struct KernelLightTreeEmitter::@251376204300027246331136371257235150246356306215::@146134270377343007162367053135361202313312115175 light
struct KernelLightTreeEmitter::@251376204300027246331136371257235150246356306215::@255254200232237361250153277203342345160177327265 triangle
struct KernelLightTreeEmitter::@251376204300027246331136371257235150246356306215::@304025134127236377216327265334115134000214376020 mesh
struct KernelLightTreeNode::@172207143026217266124212104210134272117061375006::@115101133105377363244337016204023174203166334164 leaf
struct KernelLightTreeNode::@172207143026217266124212104210134272117061375006::@276271217246031363255203047334015275151227066160 inner
struct KernelLightTreeNode::@172207143026217266124212104210134272117061375006::@326150147366144004217032120147031134124306063167 instance
struct KernelObject::@115025115277263222101106304355122365154122023350::@155240353147172012162353236324013044206020070135 mesh_volume
struct KernelObject::@115025115277263222101106304355122365154122023350::@221373076317311071245371304256304103316220320316 gsplat