Blender V4.5
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/svm/types.h"
26
28
29// NOLINTBEGIN
30
31/* Constants */
32#define OBJECT_MOTION_PASS_SIZE 2
33#define FILTER_TABLE_SIZE 1024
34#define RAMP_TABLE_SIZE 256
35#define SHUTTER_TABLE_SIZE 256
36
37#define BSSRDF_MIN_RADIUS 1e-8f
38#define BSSRDF_MAX_HITS 4
39#define BSSRDF_MAX_BOUNCES 256
40#define LOCAL_MAX_HITS 4
41
42#define VOLUME_BOUNDS_MAX 1024
43
44#define SHADER_NONE (~0)
45#define OBJECT_NONE (~0)
46#define PRIM_NONE (~0)
47#define LAMP_NONE (~0)
48#define EMITTER_NONE (~0)
49#define ID_NONE (0.0f)
50#define PASS_UNUSED (~0)
51#define LIGHTGROUP_NONE (~0)
52
53#define LIGHT_LINK_SET_MAX 64
54#define LIGHT_LINK_MASK_ALL (~uint64_t(0))
55
56#define INTEGRATOR_SHADOW_ISECT_SIZE_CPU 1024U
57#define INTEGRATOR_SHADOW_ISECT_SIZE_GPU 4U
58
59#ifdef __KERNEL_GPU__
60# define INTEGRATOR_SHADOW_ISECT_SIZE INTEGRATOR_SHADOW_ISECT_SIZE_GPU
61#else
62# define INTEGRATOR_SHADOW_ISECT_SIZE INTEGRATOR_SHADOW_ISECT_SIZE_CPU
63#endif
64
65// NOLINTEND
66
67/* Kernel Features */
68/* NOTE: Keep kernel features as defines as they are used by the preprocessor to do compile time
69 * optimization while using adaptive kernel compilation. */
70
71/* Shader nodes. */
72#define KERNEL_FEATURE_NODE_BSDF (1U << 0U)
73#define KERNEL_FEATURE_NODE_EMISSION (1U << 1U)
74#define KERNEL_FEATURE_NODE_VOLUME (1U << 2U)
75#define KERNEL_FEATURE_NODE_BUMP (1U << 3U)
76#define KERNEL_FEATURE_NODE_BUMP_STATE (1U << 4U)
77#define KERNEL_FEATURE_NODE_VORONOI_EXTRA (1U << 5U)
78#define KERNEL_FEATURE_NODE_RAYTRACE (1U << 6U)
79#define KERNEL_FEATURE_NODE_AOV (1U << 7U)
80#define KERNEL_FEATURE_NODE_LIGHT_PATH (1U << 8U)
81#define KERNEL_FEATURE_NODE_PRINCIPLED_HAIR (1U << 9U)
82
83/* Use path tracing kernels. */
84#define KERNEL_FEATURE_PATH_TRACING (1U << 10U)
85
86/* BVH/sampling kernel features. */
87#define KERNEL_FEATURE_POINTCLOUD (1U << 11U)
88#define KERNEL_FEATURE_HAIR (1U << 12U)
89#define KERNEL_FEATURE_HAIR_THICK (1U << 13U)
90#define KERNEL_FEATURE_OBJECT_MOTION (1U << 14U)
91
92/* Denotes whether baking functionality is needed. */
93#define KERNEL_FEATURE_BAKING (1U << 15U)
94
95/* Use subsurface scattering materials. */
96#define KERNEL_FEATURE_SUBSURFACE (1U << 16U)
97
98/* Use volume materials. */
99#define KERNEL_FEATURE_VOLUME (1U << 17U)
100
101/* Use Transparent shadows */
102#define KERNEL_FEATURE_TRANSPARENT (1U << 18U)
103
104/* Use shadow catcher. */
105#define KERNEL_FEATURE_SHADOW_CATCHER (1U << 19U)
106
107/* Light render passes. */
108#define KERNEL_FEATURE_LIGHT_PASSES (1U << 20U)
109
110/* AO. */
111#define KERNEL_FEATURE_AO_PASS (1U << 21U)
112#define KERNEL_FEATURE_AO_ADDITIVE (1U << 22U)
113#define KERNEL_FEATURE_AO (KERNEL_FEATURE_AO_PASS | KERNEL_FEATURE_AO_ADDITIVE)
114
115/* MNEE. */
116#define KERNEL_FEATURE_MNEE (1U << 23U)
117
118/* Path guiding. */
119#define KERNEL_FEATURE_PATH_GUIDING (1U << 24U)
120
121/* OSL. */
122#define KERNEL_FEATURE_OSL_SHADING (1U << 25U)
123#define KERNEL_FEATURE_OSL_CAMERA (1U << 26U)
124
125/* Light and shadow linking. */
126#define KERNEL_FEATURE_LIGHT_LINKING (1U << 27U)
127#define KERNEL_FEATURE_SHADOW_LINKING (1U << 28U)
128
129/* Use denoising kernels and output denoising passes. */
130#define KERNEL_FEATURE_DENOISING (1U << 29U)
131
132/* Light tree. */
133#define KERNEL_FEATURE_LIGHT_TREE (1U << 30U)
134
135/* Shader node feature mask, to specialize shader evaluation for kernels. */
136
137#define KERNEL_FEATURE_NODE_MASK_SURFACE_LIGHT \
138 (KERNEL_FEATURE_NODE_EMISSION | KERNEL_FEATURE_NODE_VORONOI_EXTRA | \
139 KERNEL_FEATURE_NODE_LIGHT_PATH)
140#define KERNEL_FEATURE_NODE_MASK_SURFACE_BACKGROUND \
141 (KERNEL_FEATURE_NODE_MASK_SURFACE_LIGHT | KERNEL_FEATURE_NODE_AOV)
142#define KERNEL_FEATURE_NODE_MASK_SURFACE_SHADOW \
143 (KERNEL_FEATURE_NODE_BSDF | KERNEL_FEATURE_NODE_EMISSION | KERNEL_FEATURE_NODE_BUMP | \
144 KERNEL_FEATURE_NODE_BUMP_STATE | KERNEL_FEATURE_NODE_VORONOI_EXTRA | \
145 KERNEL_FEATURE_NODE_LIGHT_PATH | KERNEL_FEATURE_NODE_PRINCIPLED_HAIR)
146#define KERNEL_FEATURE_NODE_MASK_SURFACE \
147 (KERNEL_FEATURE_NODE_MASK_SURFACE_SHADOW | KERNEL_FEATURE_NODE_RAYTRACE | \
148 KERNEL_FEATURE_NODE_AOV | KERNEL_FEATURE_NODE_LIGHT_PATH)
149#define KERNEL_FEATURE_NODE_MASK_VOLUME \
150 (KERNEL_FEATURE_NODE_EMISSION | KERNEL_FEATURE_NODE_VOLUME | \
151 KERNEL_FEATURE_NODE_VORONOI_EXTRA | KERNEL_FEATURE_NODE_LIGHT_PATH)
152#define KERNEL_FEATURE_NODE_MASK_DISPLACEMENT \
153 (KERNEL_FEATURE_NODE_VORONOI_EXTRA | KERNEL_FEATURE_NODE_BUMP | KERNEL_FEATURE_NODE_BUMP_STATE)
154#define KERNEL_FEATURE_NODE_MASK_BUMP KERNEL_FEATURE_NODE_MASK_DISPLACEMENT
155
156/* Must be constexpr on the CPU to avoid compile errors because the state types
157 * are different depending on the main, shadow or null path. For GPU we don't have
158 * C++17 everywhere so need to check it. */
159#if __cplusplus < 201703L
160# define IF_KERNEL_FEATURE(feature) if ((node_feature_mask & (KERNEL_FEATURE_##feature)) != 0U)
161# define IF_KERNEL_NODES_FEATURE(feature) \
162 if ((node_feature_mask & (KERNEL_FEATURE_NODE_##feature)) != 0U)
163#else
164# define IF_KERNEL_FEATURE(feature) \
165 if constexpr ((node_feature_mask & (KERNEL_FEATURE_##feature)) != 0U)
166# define IF_KERNEL_NODES_FEATURE(feature) \
167 if constexpr ((node_feature_mask & (KERNEL_FEATURE_NODE_##feature)) != 0U)
168#endif
169
170/* Kernel features */
171#define __AO__
172#define __CAUSTICS_TRICKS__
173#define __CLAMP_SAMPLE__
174#define __DENOISING_FEATURES__
175#define __DPDU__
176#define __HAIR__
177#define __LIGHT_LINKING__
178#define __SHADOW_LINKING__
179#define __LIGHT_TREE__
180#define __OBJECT_MOTION__
181#define __MNEE__
182#define __PASSES__
183#define __POINTCLOUD__
184#define __PRINCIPLED_HAIR__
185#define __RAY_DIFFERENTIALS__
186#define __SHADER_RAYTRACE__
187#define __SHADOW_CATCHER__
188#define __SHADOW_RECORD_ALL__
189#define __SUBSURFACE__
190#define __SVM__
191#define __TRANSPARENT_SHADOWS__
192#define __VISIBILITY_FLAG__
193#define __VOLUME__
194
195/* Device specific features */
196#ifdef WITH_OSL
197# define __OSL__
198# ifdef __KERNEL_OPTIX__
199/* Kernels with OSL support are built separately in OptiX and don't need SVM. */
200# undef __SVM__
201# endif
202#endif
203#ifndef __KERNEL_GPU__
204# ifdef WITH_PATH_GUIDING
205# define __PATH_GUIDING__
206# endif
207# define __VOLUME_RECORD_ALL__
208#endif /* !__KERNEL_GPU__ */
209
210/* MNEE caused "Compute function exceeds available temporary registers" in macOS < 13 due to a bug
211 * in spill buffer allocation sizing. */
212#if defined(__KERNEL_METAL__) && (__KERNEL_METAL_MACOS__ < 13)
213# undef __MNEE__
214#endif
215
216/* Scene-based selective features compilation. */
217#ifdef __KERNEL_FEATURES__
218# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_OBJECT_MOTION)
219# undef __OBJECT_MOTION__
220# endif
221# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_HAIR)
222# undef __HAIR__
223# endif
224# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_POINTCLOUD)
225# undef __POINTCLOUD__
226# endif
227# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_VOLUME)
228# undef __VOLUME__
229# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_TRANSPARENT)
230# undef __TRANSPARENT_SHADOWS__
231# undef __SHADOW_RECORD_ALL__
232# endif
233# endif
234# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_SUBSURFACE)
235# undef __SUBSURFACE__
236# endif
237# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_SHADOW_CATCHER)
238# undef __SHADOW_CATCHER__
239# endif
240# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_DENOISING)
241# undef __DENOISING_FEATURES__
242# endif
243# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_AO)
244# undef __AO__
245# endif
246# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_MNEE)
247# undef __MNEE__
248# endif
249# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_PATH_GUIDING)
250# undef __PATH_GUIDING__
251# endif
252# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_NODE_PRINCIPLED_HAIR)
253# undef __PRINCIPLED_HAIR__
254# endif
255# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_LIGHT_LINKING)
256# undef __LIGHT_LINKING__
257# endif
258# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_SHADOW_LINKING)
259# undef __SHADOW_LINKING__
260# endif
261#endif
262
263#ifdef WITH_CYCLES_DEBUG_NAN
264# define __KERNEL_DEBUG_NAN__
265#endif
266
267/* Features that enable others */
268
269#if defined(__SUBSURFACE__) || defined(__SHADER_RAYTRACE__)
270# define __BVH_LOCAL__
271#endif
272
273/* Sampling Patterns */
274
275/* Unique numbers for sampling patterns in each bounce. */
277 /* Init bounce */
280
281 /* Shade bounce */
285 /* Surface */
290
291 /* Guiding RIS */
294
295 /* Volume */
303
304 /* Subsurface random walk bounces */
310
311 /* Subsurface disk bounce */
314
315 /* High enough number so we don't need to change it when adding new dimensions,
316 * low enough so there is no uint16_t overflow with many bounces. */
318};
319
331
332/* These flags values correspond to `raytypes` in `osl.cpp`, so keep them in sync! */
333
334enum PathRayFlag : uint32_t {
335 /* --------------------------------------------------------------------
336 * Ray visibility.
337 *
338 * NOTE: Recalculated after a surface bounce.
339 */
340
341 PATH_RAY_CAMERA = (1U << 0U),
342 PATH_RAY_REFLECT = (1U << 1U),
343 PATH_RAY_TRANSMIT = (1U << 2U),
344 PATH_RAY_DIFFUSE = (1U << 3U),
345 PATH_RAY_GLOSSY = (1U << 4U),
346 PATH_RAY_SINGULAR = (1U << 5U),
350
351 /* Shadow ray visibility. */
355
356 /* Subset of flags used for ray visibility for intersection.
357 *
358 * NOTE: SHADOW_CATCHER macros below assume there are no more than
359 * 16 visibility bits. */
360 PATH_RAY_ALL_VISIBILITY = ((1U << 11U) - 1U),
361
362 /* Special flag to tag unaligned BVH nodes.
363 * Only set and used in BVH nodes to distinguish how to interpret bounding box information stored
364 * in the node (either it should be intersected as AABB or as OBBU).
365 * So this can overlap with path flags. */
367
368 /* --------------------------------------------------------------------
369 * Path flags.
370 */
371
372 /* Surface had transmission component at previous bounce. Used for light tree
373 * traversal and culling to be consistent with MIS PDF at the next bounce. */
375
376 /* Don't apply multiple importance sampling weights to emission from
377 * lamp or surface hits, because they were not direct light sampled. */
378 PATH_RAY_MIS_SKIP = (1U << 12U),
379
380 /* Diffuse bounce earlier in the path, skip SSS to improve performance
381 * and avoid branching twice with disk sampling SSS. */
383
384 /* Single pass has been written. */
386
387 /* Zero background alpha, for camera or transparent glass rays. */
389
390 /* Terminate ray immediately at next bounce. */
393
394 /* Ray is to be terminated, but continue with transparent bounces and
395 * emission as long as we encounter them. This is required to make the
396 * MIS between direct and indirect light rays match, as shadow rays go
397 * through transparent surfaces to reach emission too. */
399
400 /* Terminate ray immediately after volume shading. */
402
403 /* Ray is to be terminated. */
406
407 /* Path and shader is being evaluated for direct lighting emission. */
408 PATH_RAY_EMISSION = (1U << 20U),
409
410 /* Perform subsurface scattering. */
416
417 /* Contribute to denoising features. */
419
420 /* Render pass categories. */
422 PATH_RAY_VOLUME_PASS = (1U << 27U),
424
425 /* Shadow ray is for AO. */
427
428 /* A shadow catcher object was hit and the path was split into two. */
430
431 /* A shadow catcher object was hit and this path traces only shadow catchers, writing them into
432 * their dedicated pass for later division.
433 *
434 * NOTE: Is not covered with `PATH_RAY_ANY_PASS` because shadow catcher does special handling
435 * which is separate from the light passes. */
437
438 /* Path is evaluating background for an approximate shadow catcher with non-transparent film. */
440};
441
442// 8bit enum, just in case we need to move more variables in it
450
451/* Configure ray visibility bits for rays and objects respectively,
452 * to make shadow catchers work.
453 *
454 * On shadow catcher paths we want to ignore any intersections with non-catchers,
455 * whereas on regular paths we want to intersect all objects. */
456
457#define SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) ((visibility) << 16)
458
459#define SHADOW_CATCHER_PATH_VISIBILITY(path_flag, visibility) \
460 (((path_flag) & PATH_RAY_SHADOW_CATCHER_PASS) ? SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) : \
461 (visibility))
462
463#define SHADOW_CATCHER_OBJECT_VISIBILITY(is_shadow_catcher, visibility) \
464 (((is_shadow_catcher) ? SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) : 0) | (visibility))
465
466/* Closure Label */
467
481
482/* Render Passes */
483
484#define PASS_NAME_JOIN(a, b) a##_##b
485#define PASSMASK(pass) (1 << ((PASS_NAME_JOIN(PASS, pass)) % 32))
486
487// NOTE: Keep in sync with `Pass::get_type_enum()`.
490
491 /* Light Passes */
509
510 /* Data passes */
528 /* No Scatter color since it's tricky to define what it would even mean. */
534
535 /* PASS_SHADOW_CATCHER accumulates contribution of shadow catcher object which is not affected by
536 * any other object. The pass accessor will divide the combined pass by the shadow catcher. The
537 * result of this division is then to be multiplied with the backdrop. The alpha channel of this
538 * pass contains number of samples which contributed to the color components of the pass.
539 *
540 * PASS_SHADOW_CATCHER_SAMPLE_COUNT contains number of samples for which the path split
541 * happened.
542 *
543 * PASS_SHADOW_CATCHER_MATTE contains pass which contains non-catcher objects. This pass is to be
544 * alpha-overed onto the backdrop (after multiplication). */
548
549 /* Guiding related debug rendering passes */
550 /* The estimated sample color from the PathSegmentStorage. If everything is integrated correctly
551 * the output should be similar to PASS_COMBINED. */
553 /* The guiding probability at the first bounce. */
555 /* The avg. roughness at the first bounce. */
558
563
565};
566
567#define PASS_ANY (~0) // NOLINT
568
571 CRYPT_OBJECT = (1 << 0),
572 CRYPT_MATERIAL = (1 << 1),
573 CRYPT_ASSET = (1 << 2),
574 CRYPT_ACCURATE = (1 << 3),
575};
576
582
583/* Closure Filter */
584
593
594/* Shader Flag */
595
614
624
625/* Light Type */
626
635
636/* Guiding Distribution Type */
637
645
646/* Guiding Directional Sampling Type */
647
655
656/* Camera Type */
657
659
660/* Panorama Type */
661
672
673/* Specifies an offset for the shutter's time interval. */
675 /* Shutter opens at the current frame. */
677 /* Shutter is fully open at the current frame. */
679 /* Shutter closes at the current frame. */
681
683};
684
685/* Direct Light Sampling */
686
694
695/* Differential */
696
701
703 float dx;
704 float dy;
705};
706
707/* Ray */
708
710 int prim; /* Primitive the ray is starting from */
711 int object; /* Instance prim is a part of */
712 int light_prim; /* Light primitive */
713 int light_object; /* Light object */
714};
715
716struct Ray {
717 float3 P; /* origin */
718 float3 D; /* direction */
719 float tmin; /* start distance */
720 float tmax; /* end distance */
721 float time; /* time (for motion blur) */
722
723#ifdef __RAY_DIFFERENTIALS__
724 float dP;
725 float dD;
726#endif
727
729};
730
731/* Intersection */
732
734 float t, u, v;
735 int prim;
737 int type;
738};
739
740/* On certain GPUs (Apple Silicon), splitting every integrator state field into its own separate
741 * array can be detrimental for cache utilization. By enabling __INTEGRATOR_GPU_PACKED_STATE__, we
742 * specify that certain fields should be packed together. This improves cache hit ratios in cases
743 * where fields are often accessed together (e.g. "ray" and "isect").
744 */
745#if (defined(__APPLE__) && TARGET_CPU_ARM64) || \
746 (defined(__KERNEL_METAL_APPLE__) && defined(__KERNEL_METAL_TARGET_CPU_ARM64__))
747# define __INTEGRATOR_GPU_PACKED_STATE__
748
749/* Generate packed layouts for structs declared with KERNEL_STRUCT_BEGIN_PACKED. For example the
750 * following template...
751 *
752 * KERNEL_STRUCT_BEGIN_PACKED(shadow_ray, KERNEL_FEATURE_PATH_TRACING)
753 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, packed_float3, P, KERNEL_FEATURE_PATH_TRACING)
754 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, packed_float3, D, KERNEL_FEATURE_PATH_TRACING)
755 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, tmin, KERNEL_FEATURE_PATH_TRACING)
756 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, tmax, KERNEL_FEATURE_PATH_TRACING)
757 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, time, KERNEL_FEATURE_PATH_TRACING)
758 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, dP, KERNEL_FEATURE_PATH_TRACING)
759 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, int, self_light, KERNEL_FEATURE_SHADOW_LINKING)
760 * KERNEL_STRUCT_END(shadow_ray)
761 *
762 * ...will produce the following packed struct:
763 *
764 * struct packed_shadow_ray {
765 * packed_float3 P;
766 * packed_float3 D;
767 * float tmin;
768 * float tmax;
769 * float time;
770 * float dP;
771 * int self_light;
772 * };
773 */
774
775# define KERNEL_STRUCT_BEGIN(name) struct dummy_##name {
776# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) struct packed_##parent_struct {
777# define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature)
778# define KERNEL_STRUCT_MEMBER_PACKED(parent_struct, type, name, feature) type name;
779# define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) type name;
780# define KERNEL_STRUCT_END(name) \
781 } \
782 ;
783# define KERNEL_STRUCT_END_ARRAY(name, cpu_size, gpu_size) \
784 } \
785 ;
786# define KERNEL_STRUCT_VOLUME_STACK_SIZE MAX_VOLUME_STACK_SIZE
787
790
791# undef KERNEL_STRUCT_BEGIN
792# undef KERNEL_STRUCT_BEGIN_PACKED
793# undef KERNEL_STRUCT_MEMBER
794# undef KERNEL_STRUCT_MEMBER_PACKED
795# undef KERNEL_STRUCT_ARRAY_MEMBER
796# undef KERNEL_STRUCT_END
797# undef KERNEL_STRUCT_END_ARRAY
798# undef KERNEL_STRUCT_VOLUME_STACK_SIZE
799
800#endif
801
802/* Primitives */
803
828
829/* Convert type to index in range 0..PRIMITIVE_NUM-1. */
830#define PRIMITIVE_INDEX(type) \
831 (bitscan((uint32_t)(type)) * 2 + (((type) & PRIMITIVE_MOTION) ? 1 : 0))
832
833/* Pack segment into type value to save space. */
834#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_BITS) | (type))
835#define PRIMITIVE_UNPACK_SEGMENT(type) (type >> PRIMITIVE_NUM_BITS)
836
843
844/* Attributes */
845
852
867
905
907 ATTR_SUBDIVIDE_SMOOTH_FVAR = (1 << 0), /* This attribute is face-varying and requires smooth
908 * subdivision (typically UV map). */
909};
910
916
917/* For looking up attributes on objects and geometry. */
919 uint64_t id; /* Global unique identifier. */
920 int offset; /* Offset into __attributes global arrays. */
921 uint16_t element; /* AttributeElement. */
922 uint8_t type; /* NodeAttributeType. */
923 uint8_t pad;
924};
925
926/* Closure data */
927
928#ifndef __MAX_CLOSURE__
929# define MAX_CLOSURE 64
930#else
931# define MAX_CLOSURE __MAX_CLOSURE__
932#endif
933
934/* For manifold next event estimation, we need space to store and evaluate
935 * 2 closures (with extra data) on the refractive interfaces, in addition
936 * to keeping the full sd at the current shading point. We need 4 because a
937 * refractive BSDF is instanced with a companion reflection BSDF, even though
938 * we only need the refractive one, and each of them requires 2 slots. */
939#ifndef __CAUSTICS_MAX_CLOSURE__
940# define CAUSTICS_MAX_CLOSURE 4
941#else
942# define CAUSTICS_MAX_CLOSURE __CAUSTICS_MAX_CLOSURE__
943#endif
944
945#ifndef __MAX_VOLUME_STACK_SIZE__
946# define MAX_VOLUME_STACK_SIZE 32
947#else
948# define MAX_VOLUME_STACK_SIZE __MAX_VOLUME_STACK_SIZE__
949#endif
950
951#define MAX_VOLUME_CLOSURE 8 // NOLINT
952
953/* This struct is the base class for all closures. The common members are
954 * duplicated in all derived classes since we don't have C++ in the kernel
955 * yet, and because it lets us lay out the members to minimize padding. The
956 * weight member is located at the beginning of the struct for this reason.
957 *
958 * ShaderClosure has a fixed size, and any extra space must be allocated
959 * with closure_alloc_extra().
960 *
961 * We pad the struct to align to 16 bytes. All shader closures are assumed
962 * to fit in this struct size. CPU sizes are a bit larger because float3 is
963 * padded to be 16 bytes, while it's only 12 bytes on the GPU. */
964
965#define SHADER_CLOSURE_BASE \
966 Spectrum weight; \
967 ClosureType type; \
968 float sample_weight; \
969 float3 N
970
971/* To save some space, volume closures (phase functions) don't store a normal.
972 * They are still allocated as ShaderClosures first, but get assigned to
973 * slots of type ShaderVolumeClosure later, so make sure to keep the layout
974 * in sync. */
975#define SHADER_CLOSURE_VOLUME_BASE \
976 Spectrum weight; \
977 ClosureType type; \
978 float sample_weight
979
980struct ccl_align(16) ShaderClosure
981{
983
984 /* Extra space for closures to store data, somewhat arbitrary but closures
985 * assert that their size fits. */
986 char pad[sizeof(Spectrum) * 2 + sizeof(float) * 4];
987};
988
989/* Shader Data
990 *
991 * Main shader state at a point on the surface or in a volume. All coordinates
992 * are in world space.
993 */
994
996 /* Runtime flags. */
997
998 /* Set when ray hits backside of surface. */
999 SD_BACKFACING = (1 << 0),
1000 /* Shader has non-zero emission. */
1001 SD_EMISSION = (1 << 1),
1002 /* Shader has BSDF closure. */
1003 SD_BSDF = (1 << 2),
1004 /* Shader has non-singular BSDF closure. */
1006 /* Shader has BSSRDF closure. */
1007 SD_BSSRDF = (1 << 4),
1008 /* Shader has holdout closure. */
1009 SD_HOLDOUT = (1 << 5),
1010 /* Shader has non-zero volume extinction. */
1011 SD_EXTINCTION = (1 << 6),
1012 /* Shader has have volume phase (scatter) closure. */
1013 SD_SCATTER = (1 << 7),
1014 /* Shader is being evaluated in a volume. */
1016 /* Shader has transparent closure. */
1017 SD_TRANSPARENT = (1 << 9),
1018 /* BSDF requires LCG for evaluation. */
1020 /* BSDF has a transmissive component. */
1022 /* Shader has ray portal closure. */
1023 SD_RAY_PORTAL = (1 << 12),
1024
1028
1029 /* Shader flags. */
1030
1031 /* Has bump mapping from BSDF connected to surface socket. */
1033 /* Apply a correction term to smooth illumination on grazing angles when using bump mapping. */
1035 /* Use front side for direct light sampling. */
1036 SD_MIS_FRONT = (1 << 16),
1037 /* Has transparent shadow. */
1039 /* Has volume shader. */
1040 SD_HAS_VOLUME = (1 << 18),
1041 /* Has only volume shader, no surface. */
1043 /* Has heterogeneous volume. */
1045 /* BSSRDF normal uses bump. */
1047 /* Use equiangular volume sampling */
1049 /* Use multiple importance volume sampling. */
1050 SD_VOLUME_MIS = (1 << 23),
1051 /* Use cubic interpolation for voxels. */
1052 SD_VOLUME_CUBIC = (1 << 24),
1053 /* Has bump mapping from the displacement socket. */
1056 /* Has true displacement. */
1058 /* Has constant emission (value stored in __shaders) */
1060 /* Needs to access attributes for volume rendering */
1062 /* Shader has emission */
1063 SD_HAS_EMISSION = (1 << 29),
1064 /* Shader has ray-tracing. */
1065 SD_HAS_RAYTRACE = (1 << 30),
1066 /* Use back side for direct light sampling. */
1067 SD_MIS_BACK = (1 << 31),
1068
1074};
1075
1076/* Object flags. */
1078 /* Holdout for camera rays. */
1080 /* Has object motion blur. */
1082 /* Vertices have transform applied. */
1084 /* The object's transform applies a negative scale. */
1086 /* Object has a volume shader. */
1088 /* Object intersects AABB of an object with volume shader. */
1090 /* Has position for motion vertices. */
1092 /* object is used to catch shadows */
1094 /* object has volume attributes */
1096 /* object is caustics caster */
1098 /* object is caustics receiver */
1100 /* object has attribute for volume motion */
1102
1103 /* object is using caustics */
1105
1111};
1112
1113struct ccl_align(16) ShaderData
1114{
1115 /* position */
1116 float3 P;
1117 /* smooth normal for shading */
1118 float3 N;
1119 /* true geometric normal */
1120 float3 Ng;
1121 /* view/incoming direction */
1122 float3 wi;
1123
1124 /* combined type and curve segment for hair */
1125 int type;
1126
1127 /* shader id */
1128 int shader;
1129 /* booleans describing shader, see ShaderDataFlag */
1130 int flag;
1131 /* booleans describing object of the shader, see ShaderDataObjectFlag */
1132 int object_flag;
1133
1134 /* Closure data, we store a fixed array of closures */
1135 int num_closure;
1136 int num_closure_left;
1137
1138 /* primitive id if there is one, ~0 otherwise */
1139 int prim;
1140
1141 /* parametric coordinates
1142 * - barycentric weights for triangles */
1143 float u;
1144 float v;
1145 /* object id if there is one, ~0 otherwise */
1146 int object;
1147
1148 /* motion blur sample time */
1149 float time;
1150
1151 /* length of the ray being shaded */
1152 float ray_length;
1153
1154#ifdef __RAY_DIFFERENTIALS__
1155 /* Radius of differential of P. */
1156 float dP;
1157 /* Radius of differential of wi. */
1158 float dI;
1159 /* differential of u, v */
1160 differential du;
1161 differential dv;
1162#endif
1163#ifdef __DPDU__
1164 /* differential of P w.r.t. parametric coordinates. note that dPdu is
1165 * not readily suitable as a tangent for shading on triangles. */
1166 float3 dPdu;
1167 float3 dPdv;
1168#endif
1169
1170#ifdef __OBJECT_MOTION__
1171 /* Object <-> world space transformations for motion blur, cached to avoid
1172 * re-interpolating them constantly for shading. */
1173 Transform ob_tfm_motion;
1174 Transform ob_itfm_motion;
1175#endif
1176
1177 /* ray start position, only set for backgrounds */
1178 float3 ray_P;
1179 float ray_dP;
1180
1181 /* LCG state for closures that require additional random numbers. */
1182 uint lcg_state;
1183
1184 /* Closure weights summed directly, so we can evaluate
1185 * emission and shadow transparency with MAX_CLOSURE 0. */
1186 Spectrum closure_emission_background;
1187 Spectrum closure_transparent_extinction;
1188
1189 /* At the end so we can adjust size in ShaderDataTinyStorage. */
1190 struct ShaderClosure closure[MAX_CLOSURE];
1191};
1192
1193#ifdef __KERNEL_GPU__
1194/* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
1195 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1197{
1198 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * MAX_CLOSURE];
1199};
1200
1201/* ShaderDataCausticsStorage needs the same alignment as ShaderData, or else
1202 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1204{
1205 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * (MAX_CLOSURE - CAUSTICS_MAX_CLOSURE)];
1206};
1207#else
1208/* On the CPU use full size, to avoid compiler and ASAN warnings. */
1209using ShaderDataTinyStorage = ShaderData;
1210using ShaderDataCausticsStorage = ShaderData;
1211#endif
1212
1213#define AS_SHADER_DATA(shader_data_tiny_storage) \
1214 ((ccl_private ShaderData *)shader_data_tiny_storage)
1215
1216/* Compact volume closures storage.
1217 *
1218 * Used for decoupled direct/indirect light closure storage.
1219 *
1220 * This shares its basic layout with SHADER_CLOSURE_VOLUME_BASE and ShaderClosure,
1221 * just without the normal and with less space for closure-specific parameters.
1222 * That way, we can just cast ShaderClosure* to ShaderVolumeClosure* and assign it.
1223 */
1228 /* Space for closure-specific parameters. */
1229 float param[3];
1230};
1231
1236
1237/* Volume Stack */
1238
1239#ifdef __VOLUME__
1243};
1244#endif
1245
1246/* Struct to gather multiple nearby intersections. */
1252
1253/* Constant Kernel Data
1254 *
1255 * These structs are passed from CPU to various devices, and the struct layout
1256 * must match exactly. Structs are padded to ensure 16 byte alignment, and we
1257 * do not use float3 because its size may not be the same on all devices. */
1258
1260 /* type */
1261 int type;
1263
1264 /* depth of field */
1266 float blades;
1269
1270 /* motion blur */
1273
1274 int pad1;
1275 int pad2;
1276 int pad3;
1277
1278 /* panorama */
1286
1287 /* stereo */
1292
1293 /* matrices */
1296
1297 /* differentials */
1300
1301 /* clipping */
1304
1305 /* sensor size */
1308
1309 /* render size */
1311
1312 /* anamorphic lens bokeh */
1314
1316
1317 /* more matrices */
1325
1326 /* Stores changes in the projection matrix. Use for camera zoom motion
1327 * blur and motion pass output for perspective camera. */
1330
1331 /* Transforms for motion pass. */
1334
1336
1337 /* Rolling shutter */
1340
1342};
1344
1348
1351
1354
1363
1364 float scale;
1367
1371
1372 /* Number of components to write to. */
1374
1375 /* Number of floats per pixel. When zero is the same as `num_components`.
1376 * NOTE: Is ignored for half4 destination. */
1378
1380
1381 /* Padding. */
1382 int pad1;
1383};
1385
1411
1412/* Specialized struct that can become constants in dynamic compilation. */
1413#define KERNEL_STRUCT_BEGIN(name, parent) \
1414 struct ccl_align(16) name \
1415 {
1416#define KERNEL_STRUCT_END(name) \
1417 } \
1418 ; \
1419 static_assert_align(name, 16);
1420
1421#ifdef __KERNEL_USE_DATA_CONSTANTS__
1422# define KERNEL_STRUCT_MEMBER(parent, type, name) type __unused_##name;
1423#else
1424# define KERNEL_STRUCT_MEMBER(parent, type, name) type name;
1425#endif
1426
1427#include "kernel/data_template.h"
1428
1444
1452
1456
1457struct ccl_align(16) KernelData
1458{
1459 /* Features and limits. */
1460 uint kernel_features;
1461 uint max_closures;
1462 uint max_shaders;
1463 uint volume_stack_size;
1464
1465 /* Always dynamic data members. */
1466 KernelCamera cam;
1468 KernelTables tables;
1469 KernelLightLinkSet light_link_sets[LIGHT_LINK_SET_MAX];
1470
1471 /* Potentially specialized data members. */
1472#define KERNEL_STRUCT_BEGIN(name, parent) name parent;
1473#include "kernel/data_template.h"
1474
1475 /* Device specific BVH. */
1476#ifdef __KERNEL_OPTIX__
1477 OptixTraversableHandle device_bvh;
1478#elif defined __METALRT__
1479 metalrt_as_type device_bvh;
1480#elif defined(__HIPRT__)
1481 void *device_bvh;
1482#else
1483# ifdef __EMBREE__
1484# if RTC_VERSION >= 40400
1485 RTCTraversable device_bvh;
1486# else
1487 RTCScene device_bvh;
1488# endif
1489# ifndef __KERNEL_64_BIT__
1490 int pad1;
1491# endif
1492# else
1493 int device_bvh, pad1;
1494# endif
1495#endif
1496 int pad2, pad3;
1497};
1498static_assert_align(KernelData, 16);
1499
1500/* Kernel data structures. */
1501
1547
1555
1557 int prim;
1558 int type;
1559};
1561
1564 float radius;
1570 /* For non-uniform object scaling, the actual spread might be different. */
1572 /* Distance from the apex of the smallest enclosing cone of the light spread to light center. */
1574};
1575
1576/* PointLight is SpotLight with only radius and invarea being used. */
1577
1589
1598
1615
1623
1624/* Bounding box. */
1629
1635
1636enum LightTreeNodeType : uint8_t {
1641};
1642
1644 /* Bounding box. */
1646
1647 /* Bounding cone. */
1649
1650 /* Energy. */
1651 float energy;
1652
1654
1655 /* Leaf nodes need to know the number of emitters stored. */
1657
1658 union {
1659 struct {
1660 int first_emitter; /* The index of the first emitter. */
1662 struct {
1663 /* Indices of the children. */
1667 struct {
1668 int reference; /* A reference to the node with the subtree. */
1670 };
1671
1672 /* Bit trail. */
1674
1675 /* Bits to skip in the bit trail, to skip nodes in for specialized trees. */
1676 uint8_t bit_skip;
1677
1678 /* Padding. */
1679 uint8_t pad[11];
1680};
1682
1684 /* Bounding cone. */
1685 float theta_o;
1686 float theta_e;
1687
1688 /* Energy. */
1689 float energy;
1690
1691 union {
1692 struct {
1693 int id; /* The location in the triangles array. */
1696
1697 struct {
1698 int id; /* The location in the lights array. */
1700
1701 struct {
1705 };
1706
1707 /* Object and shader. */
1708 int object_id;
1710
1711 /* Bit trail from root node to leaf node containing emitter. */
1713};
1715
1718 float age;
1720 float size;
1722 /* Only XYZ are used of the following. float4 instead of float3 are used
1723 * to ensure consistent padding/alignment across devices. */
1727};
1729
1738
1739/* Patches */
1740
1741// NOLINTBEGIN
1742#define PATCH_MAX_CONTROL_VERTS 16
1743
1744/* Patch map node flags */
1745
1746#define PATCH_MAP_NODE_IS_SET (1 << 30)
1747#define PATCH_MAP_NODE_IS_LEAF (1u << 31)
1748#define PATCH_MAP_NODE_INDEX_MASK (~(PATCH_MAP_NODE_IS_SET | PATCH_MAP_NODE_IS_LEAF))
1749// NOLINTEND
1750
1751/* Work Tiles */
1752
1754 uint x, y, w, h;
1755
1759
1762
1763 /* Precalculated parameters used by init_from_camera kernel on GPU. */
1766};
1767
1768/* Shader Evaluation.
1769 *
1770 * Position on a primitive on an object at which we want to evaluate the
1771 * shader for example mesh displacement or light importance map. */
1772
1775 int prim;
1776 float u, v;
1777};
1779
1780/* Pre-computed sample table sizes for the tabulated Sobol sampler.
1781 *
1782 * NOTE: min and max samples *must* be a power of two, and patterns
1783 * ideally should be as well.
1784 */
1785// NOLINTBEGIN
1786#define MIN_TAB_SOBOL_SAMPLES 256
1787#define MAX_TAB_SOBOL_SAMPLES 8192
1788#define NUM_TAB_SOBOL_DIMENSIONS 4
1789#define NUM_TAB_SOBOL_PATTERNS 256
1790// NOLINTEND
1791
1792/* Device kernels.
1793 *
1794 * Identifier for kernels that can be executed in device queues.
1795 *
1796 * Some implementation details.
1797 *
1798 * If the kernel uses shared CUDA memory, `CUDADeviceQueue::enqueue` is to be modified.
1799 * The path iteration kernels are handled in `PathTraceWorkGPU::enqueue_path_iteration`. */
1800
1801enum DeviceKernel : int {
1818
1833
1837
1838#define DECLARE_FILM_CONVERT_KERNEL(variant) \
1839 DEVICE_KERNEL_FILM_CONVERT_##variant, DEVICE_KERNEL_FILM_CONVERT_##variant##_HALF_RGBA
1840
1843 DECLARE_FILM_CONVERT_KERNEL(SAMPLE_COUNT),
1845 DECLARE_FILM_CONVERT_KERNEL(LIGHT_PATH),
1848 DECLARE_FILM_CONVERT_KERNEL(CRYPTOMATTE),
1849 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER),
1850 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER_MATTE_WITH_SHADOW),
1853
1854#undef DECLARE_FILM_CONVERT_KERNEL
1855
1859
1864
1866
1868
1870};
1871
1872enum {
1874};
1875
unsigned int uint
int pad[32 - sizeof(int)]
#define U
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned long long int uint64_t
#define static_assert_align(st, align)
#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, 4 > float4
VecBase< float, 3 > float3
#define RTCTraversable
ClosureType
NodeAttributeType
PathRayMNEE
@ PATH_MNEE_RECEIVER_ANCESTOR
@ PATH_MNEE_VALID
@ PATH_MNEE_NONE
@ PATH_MNEE_CULL_LIGHT_CONNECTION
FilterClosures
@ FILTER_CLOSURE_EMISSION
@ FILTER_CLOSURE_GLOSSY
@ FILTER_CLOSURE_DIFFUSE
@ FILTER_CLOSURE_TRANSPARENT
@ FILTER_CLOSURE_DIRECT_LIGHT
@ FILTER_CLOSURE_TRANSMISSION
#define DECLARE_FILM_CONVERT_KERNEL(variant)
ShaderDataFlag
@ SD_VOLUME_MIS
@ SD_CLOSURE_FLAGS
@ SD_MIS_BACK
@ SD_HAS_TRANSPARENT_SHADOW
@ SD_BSDF_HAS_EVAL
@ SD_VOLUME_EQUIANGULAR
@ SD_SHADER_FLAGS
@ SD_HAS_BUMP
@ SD_HAS_CONSTANT_EMISSION
@ SD_HAS_DISPLACEMENT
@ SD_HAS_EMISSION
@ SD_IS_VOLUME_SHADER_EVAL
@ SD_BACKFACING
@ SD_MIS_FRONT
@ SD_BSSRDF
@ SD_BSDF_NEEDS_LCG
@ SD_HAS_BSSRDF_BUMP
@ SD_HAS_ONLY_VOLUME
@ SD_EXTINCTION
@ SD_HAS_RAYTRACE
@ SD_BSDF
@ SD_VOLUME_CUBIC
@ SD_HAS_VOLUME
@ SD_RAY_PORTAL
@ SD_NEED_VOLUME_ATTRIBUTES
@ SD_BSDF_HAS_TRANSMISSION
@ SD_SCATTER
@ SD_USE_BUMP_MAP_CORRECTION
@ SD_HAS_BUMP_FROM_DISPLACEMENT
@ SD_TRANSPARENT
@ SD_HETEROGENEOUS_VOLUME
@ SD_HAS_BUMP_FROM_SURFACE
@ SD_HOLDOUT
@ SD_EMISSION
PrimitiveType
@ PRIMITIVE_LAMP
@ PRIMITIVE_MOTION_CURVE_RIBBON
@ PRIMITIVE_ALL
@ PRIMITIVE_MOTION
@ PRIMITIVE_MOTION_TRIANGLE
@ PRIMITIVE_NONE
@ PRIMITIVE_NUM_SHAPES
@ PRIMITIVE_CURVE_RIBBON
@ PRIMITIVE_VOLUME
@ PRIMITIVE_NUM
@ PRIMITIVE_MOTION_CURVE_THICK
@ PRIMITIVE_CURVE
@ PRIMITIVE_CURVE_THICK
@ PRIMITIVE_NUM_BITS
@ PRIMITIVE_TRIANGLE
@ PRIMITIVE_MOTION_POINT
@ PRIMITIVE_POINT
#define MAX_VOLUME_CLOSURE
AttributeStandard
@ ATTR_STD_CURVE_INTERCEPT
@ ATTR_STD_GENERATED_TRANSFORM
@ ATTR_STD_UV
@ ATTR_STD_MOTION_VERTEX_NORMAL
@ 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_VOLUME_VELOCITY
@ ATTR_STD_POSITION_UNDEFORMED
@ ATTR_STD_VOLUME_COLOR
@ ATTR_STD_MOTION_VERTEX_POSITION
@ ATTR_STD_VOLUME_HEAT
@ ATTR_STD_NORMAL_UNDISPLACED
@ ATTR_STD_UV_TANGENT_SIGN
@ ATTR_STD_CURVE_RANDOM
@ ATTR_STD_SHADOW_TRANSPARENCY
@ ATTR_STD_PTEX_UV
@ ATTR_STD_POINTINESS
@ ATTR_STD_GENERATED
@ ATTR_STD_CURVE_LENGTH
@ ATTR_STD_VOLUME_VELOCITY_X
@ ATTR_STD_RANDOM_PER_ISLAND
@ ATTR_STD_PARTICLE
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
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_LENS_TIME
@ PRNG_VOLUME_SHADE_OFFSET
@ PRNG_SUBSURFACE_GUIDE_STRATEGY
@ PRNG_TERMINATE
@ PRNG_SUBSURFACE_DISK
@ 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
@ 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_SHADOW_OPAQUE
@ PATH_RAY_TERMINATE
@ PATH_RAY_SINGLE_PASS_DONE
@ PATH_RAY_TRANSMIT
@ PATH_RAY_SHADOW_TRANSPARENT
@ PATH_RAY_EMISSION
@ PATH_RAY_VOLUME_SCATTER
@ PATH_RAY_TERMINATE_IN_NEXT_VOLUME
@ PATH_RAY_MIS_SKIP
@ PATH_RAY_DENOISING_FEATURES
@ PATH_RAY_GLOSSY
@ PATH_RAY_SUBSURFACE
@ PATH_RAY_SURFACE_PASS
@ PATH_RAY_ALL_VISIBILITY
@ PATH_RAY_SUBSURFACE_DISK
@ PATH_RAY_NODE_UNALIGNED
@ PATH_RAY_DIFFUSE
@ PATH_RAY_TRANSPARENT_BACKGROUND
@ PATH_RAY_SHADOW_CATCHER_BACKGROUND
@ PATH_RAY_CAMERA
@ PATH_RAY_ANY_PASS
@ PATH_RAY_TERMINATE_ON_NEXT_SURFACE
@ PATH_RAY_DIFFUSE_ANCESTOR
@ 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
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_AREA_LIGHT
@ SHADER_EXCLUDE_TRANSMIT
@ SHADER_SMOOTH_NORMAL
@ SHADER_CAST_SHADOW
@ SHADER_MASK
MotionPosition
@ MOTION_POSITION_END
@ MOTION_POSITION_START
@ MOTION_POSITION_CENTER
@ MOTION_NUM_POSITIONS
GuidingDirectionalSamplingType
@ GUIDING_DIRECTIONAL_SAMPLING_NUM_TYPES
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_PRODUCT_MIS
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_RIS
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_ROUGHNESS
ShaderDataObjectFlag
@ SD_OBJECT_MOTION
@ SD_OBJECT_HAS_VOLUME_ATTRIBUTES
@ 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
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_CORNER_BYTE
@ ATTR_ELEMENT_CURVE_KEY
@ ATTR_ELEMENT_CURVE_KEY_MOTION
@ ATTR_ELEMENT_VOXEL
@ ATTR_ELEMENT_CORNER
@ ATTR_ELEMENT_OBJECT
@ ATTR_ELEMENT_VERTEX_MOTION
@ ATTR_ELEMENT_VERTEX
@ ATTR_ELEMENT_FACE
@ ATTR_ELEMENT_MESH
@ ATTR_ELEMENT_CURVE
ClosureLabel
@ 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_TRANSMISSION_INDIRECT
@ PASS_BAKE_SEED
@ PASS_SHADOW_CATCHER
@ PASS_DENOISING_NORMAL
@ PASS_ROUGHNESS
@ PASS_DIFFUSE_DIRECT
@ PASS_MOTION
@ PASS_CATEGORY_BAKE_END
@ PASS_MATERIAL_ID
@ PASS_AO
@ PASS_COMBINED
@ PASS_DIFFUSE
@ PASS_DIFFUSE_INDIRECT
@ PASS_GUIDING_PROBABILITY
@ PASS_CATEGORY_DATA_END
@ PASS_ADAPTIVE_AUX_BUFFER
@ PASS_GLOSSY
@ PASS_OBJECT_ID
@ PASS_AOV_COLOR
@ PASS_NUM
@ PASS_NONE
@ 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_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
LightType
@ LIGHT_AREA
@ LIGHT_DISTANT
@ LIGHT_SPOT
@ LIGHT_BACKGROUND
@ LIGHT_TRIANGLE
@ LIGHT_POINT
DeviceKernel
@ DEVICE_KERNEL_ADAPTIVE_SAMPLING_CONVERGENCE_CHECK
@ DEVICE_KERNEL_INTEGRATOR_RESET
@ DEVICE_KERNEL_INTEGRATOR_QUEUED_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_SHADE_LIGHT
@ 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_SUBSURFACE
@ DEVICE_KERNEL_INTEGRATOR_QUEUED_SHADOW_PATHS_ARRAY
@ DEVICE_KERNEL_FILTER_GUIDING_SET_FAKE_ALBEDO
@ 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_SHADE_SURFACE_MNEE
@ 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_ADAPTIVE_SAMPLING_CONVERGENCE_FILTER_X
@ 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_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
@ DEVICE_KERNEL_INTEGRATOR_NUM
#define N
@ FLOAT4
@ FLOAT3
@ 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
ProjectionTransform rastertoworld
float4 fisheye_lens_polynomial_coefficients
int use_approximate_shadow_catcher_background
int pass_shadow_catcher_sample_count
struct KernelLightTreeEmitter::@143257146161155345052333027160364024367362065237::@212374123365116313034205145107251170317321056056 mesh
struct KernelLightTreeEmitter::@143257146161155345052333027160364024367362065237::@152243010152136341132171270256252201101137226256 triangle
struct KernelLightTreeEmitter::@143257146161155345052333027160364024367362065237::@062072141333246171121176226367205266357252303264 light
EmissionSampling emission_sampling
struct KernelLightTreeNode::@041233304374253155016236000210152124044132222011::@026003005251357117134226377022146341143204017326 leaf
LightTreeNodeType type
KernelBoundingBox bbox
struct KernelLightTreeNode::@041233304374253155016236000210152124044132222011::@234364062212067303356055261142066012077137235100 inner
struct KernelLightTreeNode::@041233304374253155016236000210152124044132222011::@124124255006055046044025013106143067307116262174 instance
KernelBoundingCone bcone
float strength[3]
KernelSpotLight spot
packed_float3 co
KernelDistantLight distant
KernelAreaLight area
Transform tfm
uint64_t shadow_set_membership
Transform itfm
float dupli_uv[2]
float shadow_terminator_geometry_offset
float cryptomatte_asset
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]
float cryptomatte_object
float4 angular_velocity
float constant_emission[3]
float half_cot_half_spot_angle
packed_float3 dir
float cos_half_larger_spread
int ggx_gen_schlick_ior_s
struct Intersection hits[LOCAL_MAX_HITS]
float3 Ng[LOCAL_MAX_HITS]
float tmax
float tmin
float dD
float3 P
float time
float dP
RaySelfPrimitives self
float3 D
ShaderVolumeClosure closure[MAX_VOLUME_CLOSURE]
float3 Spectrum
uint8_t flag
Definition wm_window.cc:139