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 /* Apply a correction term to smooth illumination on grazing angles when using bump mapping. */
1033 /* Use front side for direct light sampling. */
1034 SD_MIS_FRONT = (1 << 16),
1035 /* Has transparent shadow. */
1037 /* Has volume shader. */
1038 SD_HAS_VOLUME = (1 << 18),
1039 /* Has only volume shader, no surface. */
1041 /* Has heterogeneous volume. */
1043 /* BSSRDF normal uses bump. */
1045 /* Use equiangular volume sampling */
1047 /* Use multiple importance volume sampling. */
1048 SD_VOLUME_MIS = (1 << 23),
1049 /* Use cubic interpolation for voxels. */
1050 SD_VOLUME_CUBIC = (1 << 24),
1051 /* Has data connected to the displacement input or uses bump map. */
1052 SD_HAS_BUMP = (1 << 25),
1053 /* Has true displacement. */
1055 /* Has constant emission (value stored in __shaders) */
1057 /* Needs to access attributes for volume rendering */
1059 /* Shader has emission */
1060 SD_HAS_EMISSION = (1 << 29),
1061 /* Shader has ray-tracing. */
1062 SD_HAS_RAYTRACE = (1 << 30),
1063 /* Use back side for direct light sampling. */
1064 SD_MIS_BACK = (1 << 31),
1065
1071};
1072
1073/* Object flags. */
1075 /* Holdout for camera rays. */
1077 /* Has object motion blur. */
1079 /* Vertices have transform applied. */
1081 /* The object's transform applies a negative scale. */
1083 /* Object has a volume shader. */
1085 /* Object intersects AABB of an object with volume shader. */
1087 /* Has position for motion vertices. */
1089 /* object is used to catch shadows */
1091 /* object has volume attributes */
1093 /* object is caustics caster */
1095 /* object is caustics receiver */
1097 /* object has attribute for volume motion */
1099
1100 /* object is using caustics */
1102
1108};
1109
1110struct ccl_align(16) ShaderData
1111{
1112 /* position */
1113 float3 P;
1114 /* smooth normal for shading */
1115 float3 N;
1116 /* true geometric normal */
1117 float3 Ng;
1118 /* view/incoming direction */
1119 float3 wi;
1120
1121 /* combined type and curve segment for hair */
1122 int type;
1123
1124 /* shader id */
1125 int shader;
1126 /* booleans describing shader, see ShaderDataFlag */
1127 int flag;
1128 /* booleans describing object of the shader, see ShaderDataObjectFlag */
1129 int object_flag;
1130
1131 /* Closure data, we store a fixed array of closures */
1132 int num_closure;
1133 int num_closure_left;
1134
1135 /* primitive id if there is one, ~0 otherwise */
1136 int prim;
1137
1138 /* parametric coordinates
1139 * - barycentric weights for triangles */
1140 float u;
1141 float v;
1142 /* object id if there is one, ~0 otherwise */
1143 int object;
1144
1145 /* motion blur sample time */
1146 float time;
1147
1148 /* length of the ray being shaded */
1149 float ray_length;
1150
1151#ifdef __RAY_DIFFERENTIALS__
1152 /* Radius of differential of P. */
1153 float dP;
1154 /* Radius of differential of wi. */
1155 float dI;
1156 /* differential of u, v */
1157 differential du;
1158 differential dv;
1159#endif
1160#ifdef __DPDU__
1161 /* differential of P w.r.t. parametric coordinates. note that dPdu is
1162 * not readily suitable as a tangent for shading on triangles. */
1163 float3 dPdu;
1164 float3 dPdv;
1165#endif
1166
1167#ifdef __OBJECT_MOTION__
1168 /* Object <-> world space transformations for motion blur, cached to avoid
1169 * re-interpolating them constantly for shading. */
1170 Transform ob_tfm_motion;
1171 Transform ob_itfm_motion;
1172#endif
1173
1174 /* ray start position, only set for backgrounds */
1175 float3 ray_P;
1176 float ray_dP;
1177
1178 /* LCG state for closures that require additional random numbers. */
1179 uint lcg_state;
1180
1181 /* Closure weights summed directly, so we can evaluate
1182 * emission and shadow transparency with MAX_CLOSURE 0. */
1183 Spectrum closure_emission_background;
1184 Spectrum closure_transparent_extinction;
1185
1186 /* At the end so we can adjust size in ShaderDataTinyStorage. */
1187 struct ShaderClosure closure[MAX_CLOSURE];
1188};
1189
1190#ifdef __KERNEL_GPU__
1191/* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
1192 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1194{
1195 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * MAX_CLOSURE];
1196};
1197
1198/* ShaderDataCausticsStorage needs the same alignment as ShaderData, or else
1199 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1201{
1202 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * (MAX_CLOSURE - CAUSTICS_MAX_CLOSURE)];
1203};
1204#else
1205/* On the CPU use full size, to avoid compiler and ASAN warnings. */
1206using ShaderDataTinyStorage = ShaderData;
1207using ShaderDataCausticsStorage = ShaderData;
1208#endif
1209
1210#define AS_SHADER_DATA(shader_data_tiny_storage) \
1211 ((ccl_private ShaderData *)shader_data_tiny_storage)
1212
1213/* Compact volume closures storage.
1214 *
1215 * Used for decoupled direct/indirect light closure storage.
1216 *
1217 * This shares its basic layout with SHADER_CLOSURE_VOLUME_BASE and ShaderClosure,
1218 * just without the normal and with less space for closure-specific parameters.
1219 * That way, we can just cast ShaderClosure* to ShaderVolumeClosure* and assign it.
1220 */
1225 /* Space for closure-specific parameters. */
1226 float param[3];
1227};
1228
1233
1234/* Volume Stack */
1235
1236#ifdef __VOLUME__
1240};
1241#endif
1242
1243/* Struct to gather multiple nearby intersections. */
1249
1250/* Constant Kernel Data
1251 *
1252 * These structs are passed from CPU to various devices, and the struct layout
1253 * must match exactly. Structs are padded to ensure 16 byte alignment, and we
1254 * do not use float3 because its size may not be the same on all devices. */
1255
1257 /* type */
1258 int type;
1260
1261 /* depth of field */
1263 float blades;
1266
1267 /* motion blur */
1270
1271 int pad1;
1272 int pad2;
1273 int pad3;
1274
1275 /* panorama */
1283
1284 /* stereo */
1289
1290 /* matrices */
1293
1294 /* differentials */
1297
1298 /* clipping */
1301
1302 /* sensor size */
1305
1306 /* render size */
1308
1309 /* anamorphic lens bokeh */
1311
1313
1314 /* more matrices */
1322
1323 /* Stores changes in the projection matrix. Use for camera zoom motion
1324 * blur and motion pass output for perspective camera. */
1327
1328 /* Transforms for motion pass. */
1331
1333
1334 /* Rolling shutter */
1337
1339};
1341
1345
1348
1351
1360
1361 float scale;
1364
1368
1369 /* Number of components to write to. */
1371
1372 /* Number of floats per pixel. When zero is the same as `num_components`.
1373 * NOTE: Is ignored for half4 destination. */
1375
1377
1378 /* Padding. */
1379 int pad1;
1380};
1382
1408
1409/* Specialized struct that can become constants in dynamic compilation. */
1410#define KERNEL_STRUCT_BEGIN(name, parent) \
1411 struct ccl_align(16) name \
1412 {
1413#define KERNEL_STRUCT_END(name) \
1414 } \
1415 ; \
1416 static_assert_align(name, 16);
1417
1418#ifdef __KERNEL_USE_DATA_CONSTANTS__
1419# define KERNEL_STRUCT_MEMBER(parent, type, name) type __unused_##name;
1420#else
1421# define KERNEL_STRUCT_MEMBER(parent, type, name) type name;
1422#endif
1423
1424#include "kernel/data_template.h"
1425
1441
1449
1453
1454struct ccl_align(16) KernelData
1455{
1456 /* Features and limits. */
1457 uint kernel_features;
1458 uint max_closures;
1459 uint max_shaders;
1460 uint volume_stack_size;
1461
1462 /* Always dynamic data members. */
1463 KernelCamera cam;
1465 KernelTables tables;
1466 KernelLightLinkSet light_link_sets[LIGHT_LINK_SET_MAX];
1467
1468 /* Potentially specialized data members. */
1469#define KERNEL_STRUCT_BEGIN(name, parent) name parent;
1470#include "kernel/data_template.h"
1471
1472 /* Device specific BVH. */
1473#ifdef __KERNEL_OPTIX__
1474 OptixTraversableHandle device_bvh;
1475#elif defined __METALRT__
1476 metalrt_as_type device_bvh;
1477#elif defined(__HIPRT__)
1478 void *device_bvh;
1479#else
1480# ifdef __EMBREE__
1481# if RTC_VERSION >= 40400
1482 RTCTraversable device_bvh;
1483# else
1484 RTCScene device_bvh;
1485# endif
1486# ifndef __KERNEL_64_BIT__
1487 int pad1;
1488# endif
1489# else
1490 int device_bvh, pad1;
1491# endif
1492#endif
1493 int pad2, pad3;
1494};
1495static_assert_align(KernelData, 16);
1496
1497/* Kernel data structures. */
1498
1544
1552
1554 int prim;
1555 int type;
1556};
1558
1561 float radius;
1567 /* For non-uniform object scaling, the actual spread might be different. */
1569 /* Distance from the apex of the smallest enclosing cone of the light spread to light center. */
1571};
1572
1573/* PointLight is SpotLight with only radius and invarea being used. */
1574
1586
1595
1612
1620
1621/* Bounding box. */
1626
1632
1633enum LightTreeNodeType : uint8_t {
1638};
1639
1641 /* Bounding box. */
1643
1644 /* Bounding cone. */
1646
1647 /* Energy. */
1648 float energy;
1649
1651
1652 /* Leaf nodes need to know the number of emitters stored. */
1654
1655 union {
1656 struct {
1657 int first_emitter; /* The index of the first emitter. */
1659 struct {
1660 /* Indices of the children. */
1664 struct {
1665 int reference; /* A reference to the node with the subtree. */
1667 };
1668
1669 /* Bit trail. */
1671
1672 /* Bits to skip in the bit trail, to skip nodes in for specialized trees. */
1673 uint8_t bit_skip;
1674
1675 /* Padding. */
1676 uint8_t pad[11];
1677};
1679
1681 /* Bounding cone. */
1682 float theta_o;
1683 float theta_e;
1684
1685 /* Energy. */
1686 float energy;
1687
1688 union {
1689 struct {
1690 int id; /* The location in the triangles array. */
1693
1694 struct {
1695 int id; /* The location in the lights array. */
1697
1698 struct {
1702 };
1703
1704 /* Object and shader. */
1705 int object_id;
1707
1708 /* Bit trail from root node to leaf node containing emitter. */
1710};
1712
1715 float age;
1717 float size;
1719 /* Only XYZ are used of the following. float4 instead of float3 are used
1720 * to ensure consistent padding/alignment across devices. */
1724};
1726
1735
1736/* Patches */
1737
1738// NOLINTBEGIN
1739#define PATCH_MAX_CONTROL_VERTS 16
1740
1741/* Patch map node flags */
1742
1743#define PATCH_MAP_NODE_IS_SET (1 << 30)
1744#define PATCH_MAP_NODE_IS_LEAF (1u << 31)
1745#define PATCH_MAP_NODE_INDEX_MASK (~(PATCH_MAP_NODE_IS_SET | PATCH_MAP_NODE_IS_LEAF))
1746// NOLINTEND
1747
1748/* Work Tiles */
1749
1751 uint x, y, w, h;
1752
1756
1759
1760 /* Precalculated parameters used by init_from_camera kernel on GPU. */
1763};
1764
1765/* Shader Evaluation.
1766 *
1767 * Position on a primitive on an object at which we want to evaluate the
1768 * shader for example mesh displacement or light importance map. */
1769
1772 int prim;
1773 float u, v;
1774};
1776
1777/* Pre-computed sample table sizes for the tabulated Sobol sampler.
1778 *
1779 * NOTE: min and max samples *must* be a power of two, and patterns
1780 * ideally should be as well.
1781 */
1782// NOLINTBEGIN
1783#define MIN_TAB_SOBOL_SAMPLES 256
1784#define MAX_TAB_SOBOL_SAMPLES 8192
1785#define NUM_TAB_SOBOL_DIMENSIONS 4
1786#define NUM_TAB_SOBOL_PATTERNS 256
1787// NOLINTEND
1788
1789/* Device kernels.
1790 *
1791 * Identifier for kernels that can be executed in device queues.
1792 *
1793 * Some implementation details.
1794 *
1795 * If the kernel uses shared CUDA memory, `CUDADeviceQueue::enqueue` is to be modified.
1796 * The path iteration kernels are handled in `PathTraceWorkGPU::enqueue_path_iteration`. */
1797
1798enum DeviceKernel : int {
1815
1830
1834
1835#define DECLARE_FILM_CONVERT_KERNEL(variant) \
1836 DEVICE_KERNEL_FILM_CONVERT_##variant, DEVICE_KERNEL_FILM_CONVERT_##variant##_HALF_RGBA
1837
1840 DECLARE_FILM_CONVERT_KERNEL(SAMPLE_COUNT),
1842 DECLARE_FILM_CONVERT_KERNEL(LIGHT_PATH),
1845 DECLARE_FILM_CONVERT_KERNEL(CRYPTOMATTE),
1846 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER),
1847 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER_MATTE_WITH_SHADOW),
1850
1851#undef DECLARE_FILM_CONVERT_KERNEL
1852
1856
1861
1863
1865
1867};
1868
1869enum {
1871};
1872
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_TRANSPARENT
@ SD_HETEROGENEOUS_VOLUME
@ 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
@ DEVICE_KERNEL_INTEGRATOR_NUM
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
#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::@356200223170132330320170070041130000221032010070::@172104031172370276031323017374032051315124063022 mesh
struct KernelLightTreeEmitter::@356200223170132330320170070041130000221032010070::@325141344336311151332364035310340071171367304366 light
EmissionSampling emission_sampling
struct KernelLightTreeEmitter::@356200223170132330320170070041130000221032010070::@236317302131176144314033160004221054174362324170 triangle
struct KernelLightTreeNode::@377247211160321275045111202060143352174123115352::@147137002365230272241313027070044041350111220032 leaf
LightTreeNodeType type
struct KernelLightTreeNode::@377247211160321275045111202060143352174123115352::@164037376102142200071133114324262371123223123045 instance
KernelBoundingBox bbox
struct KernelLightTreeNode::@377247211160321275045111202060143352174123115352::@344000132072154240246265111115054310255155233173 inner
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