Blender V5.0
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#define THIN_FILM_TABLE_SIZE 512
37
38#define BSSRDF_MIN_RADIUS 1e-8f
39#define BSSRDF_MAX_HITS 4
40#define BSSRDF_MAX_BOUNCES 256
41#define LOCAL_MAX_HITS 4
42
43#define VOLUME_BOUNDS_MAX 1024
44
45#define SHADER_NONE (~0)
46#define OBJECT_NONE (~0)
47#define PRIM_NONE (~0)
48#define LAMP_NONE (~0)
49#define EMITTER_NONE (~0)
50#define ID_NONE (0.0f)
51#define PASS_UNUSED (~0)
52#define LIGHTGROUP_NONE (~0)
53
54#define LIGHT_LINK_SET_MAX 64
55#define LIGHT_LINK_MASK_ALL (~uint64_t(0))
56
57#define INTEGRATOR_SHADOW_ISECT_SIZE_CPU 1024U
58#define INTEGRATOR_SHADOW_ISECT_SIZE_GPU 4U
59
60#ifdef __KERNEL_GPU__
61# define INTEGRATOR_SHADOW_ISECT_SIZE INTEGRATOR_SHADOW_ISECT_SIZE_GPU
62#else
63# define INTEGRATOR_SHADOW_ISECT_SIZE INTEGRATOR_SHADOW_ISECT_SIZE_CPU
64#endif
65
66// NOLINTEND
67
68/* Kernel Features */
69/* NOTE: Keep kernel features as defines as they are used by the preprocessor to do compile time
70 * optimization while using adaptive kernel compilation. */
71
72/* Shader nodes. */
73#define KERNEL_FEATURE_NODE_BSDF (1U << 0U)
74#define KERNEL_FEATURE_NODE_EMISSION (1U << 1U)
75#define KERNEL_FEATURE_NODE_VOLUME (1U << 2U)
76#define KERNEL_FEATURE_NODE_BUMP (1U << 3U)
77#define KERNEL_FEATURE_NODE_BUMP_STATE (1U << 4U)
78#define KERNEL_FEATURE_NODE_VORONOI_EXTRA (1U << 5U)
79#define KERNEL_FEATURE_NODE_RAYTRACE (1U << 6U)
80#define KERNEL_FEATURE_NODE_AOV (1U << 7U)
81#define KERNEL_FEATURE_NODE_LIGHT_PATH (1U << 8U)
82#define KERNEL_FEATURE_NODE_PRINCIPLED_HAIR (1U << 9U)
83#define KERNEL_FEATURE_NODE_PORTAL (1U << 10U)
84
85/* Use path tracing kernels. */
86#define KERNEL_FEATURE_PATH_TRACING (1U << 11U)
87
88/* BVH/sampling kernel features. */
89#define KERNEL_FEATURE_POINTCLOUD (1U << 12U)
90#define KERNEL_FEATURE_HAIR_RIBBON (1U << 13U)
91#define KERNEL_FEATURE_HAIR_THICK (1U << 14U)
92#define KERNEL_FEATURE_HAIR (KERNEL_FEATURE_HAIR_RIBBON | KERNEL_FEATURE_HAIR_THICK)
93#define KERNEL_FEATURE_OBJECT_MOTION (1U << 15U)
94
95/* Denotes whether baking functionality is needed. */
96#define KERNEL_FEATURE_BAKING (1U << 16U)
97
98/* Use subsurface scattering materials. */
99#define KERNEL_FEATURE_SUBSURFACE (1U << 17U)
100
101/* Use volume materials. */
102#define KERNEL_FEATURE_VOLUME (1U << 18U)
103
104/* Use Transparent shadows */
105#define KERNEL_FEATURE_TRANSPARENT (1U << 19U)
106
107/* Use shadow catcher. */
108#define KERNEL_FEATURE_SHADOW_CATCHER (1U << 20U)
109
110/* Light render passes. */
111#define KERNEL_FEATURE_LIGHT_PASSES (1U << 21U)
112
113/* AO. */
114#define KERNEL_FEATURE_AO_PASS (1U << 22U)
115#define KERNEL_FEATURE_AO_ADDITIVE (1U << 23U)
116#define KERNEL_FEATURE_AO (KERNEL_FEATURE_AO_PASS | KERNEL_FEATURE_AO_ADDITIVE)
117
118/* MNEE. */
119#define KERNEL_FEATURE_MNEE (1U << 24U)
120
121/* Path guiding. */
122#define KERNEL_FEATURE_PATH_GUIDING (1U << 25U)
123
124/* OSL. */
125#define KERNEL_FEATURE_OSL_SHADING (1U << 26U)
126#define KERNEL_FEATURE_OSL_CAMERA (1U << 27U)
127
128/* Light and shadow linking. */
129#define KERNEL_FEATURE_LIGHT_LINKING (1U << 28U)
130#define KERNEL_FEATURE_SHADOW_LINKING (1U << 29U)
131
132/* Use denoising kernels and output denoising passes. */
133#define KERNEL_FEATURE_DENOISING (1U << 30U)
134
135/* Light tree. */
136#define KERNEL_FEATURE_LIGHT_TREE (1U << 31U)
137
138/* Shader node feature mask, to specialize shader evaluation for kernels. */
139
140#define KERNEL_FEATURE_NODE_MASK_SURFACE_LIGHT \
141 (KERNEL_FEATURE_NODE_EMISSION | KERNEL_FEATURE_NODE_VORONOI_EXTRA | \
142 KERNEL_FEATURE_NODE_LIGHT_PATH | KERNEL_FEATURE_NODE_PORTAL)
143#define KERNEL_FEATURE_NODE_MASK_SURFACE_BACKGROUND \
144 (KERNEL_FEATURE_NODE_MASK_SURFACE_LIGHT | KERNEL_FEATURE_NODE_AOV)
145#define KERNEL_FEATURE_NODE_MASK_SURFACE_SHADOW \
146 (KERNEL_FEATURE_NODE_BSDF | KERNEL_FEATURE_NODE_EMISSION | KERNEL_FEATURE_NODE_BUMP | \
147 KERNEL_FEATURE_NODE_BUMP_STATE | KERNEL_FEATURE_NODE_VORONOI_EXTRA | \
148 KERNEL_FEATURE_NODE_LIGHT_PATH | KERNEL_FEATURE_NODE_PRINCIPLED_HAIR | \
149 KERNEL_FEATURE_NODE_PORTAL)
150#define KERNEL_FEATURE_NODE_MASK_SURFACE \
151 (KERNEL_FEATURE_NODE_MASK_SURFACE_SHADOW | KERNEL_FEATURE_NODE_RAYTRACE | \
152 KERNEL_FEATURE_NODE_AOV | KERNEL_FEATURE_NODE_LIGHT_PATH)
153#define KERNEL_FEATURE_NODE_MASK_VOLUME \
154 (KERNEL_FEATURE_NODE_EMISSION | KERNEL_FEATURE_NODE_VOLUME | \
155 KERNEL_FEATURE_NODE_VORONOI_EXTRA | KERNEL_FEATURE_NODE_LIGHT_PATH | \
156 KERNEL_FEATURE_NODE_PORTAL)
157#define KERNEL_FEATURE_NODE_MASK_DISPLACEMENT \
158 (KERNEL_FEATURE_NODE_VORONOI_EXTRA | KERNEL_FEATURE_NODE_BUMP | \
159 KERNEL_FEATURE_NODE_BUMP_STATE | KERNEL_FEATURE_NODE_PORTAL)
160#define KERNEL_FEATURE_NODE_MASK_BUMP KERNEL_FEATURE_NODE_MASK_DISPLACEMENT
161
162#define IF_KERNEL_FEATURE(feature) \
163 if constexpr ((node_feature_mask & (KERNEL_FEATURE_##feature)) != 0U)
164#define IF_KERNEL_NODES_FEATURE(feature) \
165 if constexpr ((node_feature_mask & (KERNEL_FEATURE_NODE_##feature)) != 0U)
166
167/* Kernel features */
168#define __AO__
169#define __CAUSTICS_TRICKS__
170#define __CLAMP_SAMPLE__
171#define __DENOISING_FEATURES__
172#define __DPDU__
173#define __HAIR__
174#define __LIGHT_LINKING__
175#define __SHADOW_LINKING__
176#define __LIGHT_TREE__
177#define __OBJECT_MOTION__
178#define __MNEE__
179#define __PASSES__
180#define __POINTCLOUD__
181#define __PRINCIPLED_HAIR__
182#define __RAY_DIFFERENTIALS__
183#define __SHADER_RAYTRACE__
184#define __SHADOW_CATCHER__
185#define __SHADOW_RECORD_ALL__
186#define __SUBSURFACE__
187#define __SVM__
188#define __TRANSPARENT_SHADOWS__
189#define __VISIBILITY_FLAG__
190#define __VOLUME__
191
192/* Device specific features */
193#ifdef WITH_OSL
194# define __OSL__
195# ifdef __KERNEL_OPTIX__
196/* Kernels with OSL support are built separately in OptiX and don't need SVM. */
197# undef __SVM__
198# endif
199#endif
200#ifndef __KERNEL_GPU__
201# if defined(WITH_PATH_GUIDING)
202# define __PATH_GUIDING__
203# endif
204# define __VOLUME_RECORD_ALL__
205#endif /* !__KERNEL_GPU__ */
206
207/* MNEE caused "Compute function exceeds available temporary registers" in macOS < 13 due to a bug
208 * in spill buffer allocation sizing. */
209#if defined(__KERNEL_METAL__) && (__KERNEL_METAL_MACOS__ < 13)
210# undef __MNEE__
211#endif
212
213/* Scene-based selective features compilation. */
214#ifdef __KERNEL_FEATURES__
215# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_OBJECT_MOTION)
216# undef __OBJECT_MOTION__
217# endif
218# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_HAIR)
219# undef __HAIR__
220# endif
221# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_POINTCLOUD)
222# undef __POINTCLOUD__
223# endif
224# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_VOLUME)
225# undef __VOLUME__
226# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_TRANSPARENT)
227# undef __TRANSPARENT_SHADOWS__
228# undef __SHADOW_RECORD_ALL__
229# endif
230# endif
231# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_SUBSURFACE)
232# undef __SUBSURFACE__
233# endif
234# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_SHADOW_CATCHER)
235# undef __SHADOW_CATCHER__
236# endif
237# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_DENOISING)
238# undef __DENOISING_FEATURES__
239# endif
240# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_AO)
241# undef __AO__
242# endif
243# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_MNEE)
244# undef __MNEE__
245# endif
246# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_PATH_GUIDING)
247# undef __PATH_GUIDING__
248# endif
249# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_NODE_PRINCIPLED_HAIR)
250# undef __PRINCIPLED_HAIR__
251# endif
252# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_LIGHT_LINKING)
253# undef __LIGHT_LINKING__
254# endif
255# if !(__KERNEL_FEATURES__ & KERNEL_FEATURE_SHADOW_LINKING)
256# undef __SHADOW_LINKING__
257# endif
258#endif
259
260#ifdef WITH_CYCLES_DEBUG_NAN
261# define __KERNEL_DEBUG_NAN__
262#endif
263
264/* Features that enable others */
265
266#if defined(__SUBSURFACE__) || defined(__SHADER_RAYTRACE__)
267# define __BVH_LOCAL__
268#endif
269
270/* Sampling Patterns */
271
272/* Unique numbers for sampling patterns in each bounce. */
274 /* Init bounce */
277
278 /* Shade bounce */
282 /* Surface */
287
288 /* Guiding RIS */
291
292 /* Volume */
302
303 /* Subsurface random walk bounces */
309
310 /* Subsurface disk bounce */
313
314 /* Volume density baking. */
316
317 /* High enough number so we don't need to change it when adding new dimensions,
318 * low enough so there is no uint16_t overflow with many bounces. */
320};
321
333
334/* These flags values correspond to `raytypes` in `osl.cpp`, so keep them in sync! */
335
336enum PathRayFlag : uint32_t {
337 /* --------------------------------------------------------------------
338 * Ray visibility.
339 *
340 * NOTE: Recalculated after a surface bounce.
341 */
342
343 PATH_RAY_CAMERA = (1U << 0U),
344 PATH_RAY_REFLECT = (1U << 1U),
345 PATH_RAY_TRANSMIT = (1U << 2U),
346 PATH_RAY_DIFFUSE = (1U << 3U),
347 PATH_RAY_GLOSSY = (1U << 4U),
348 PATH_RAY_SINGULAR = (1U << 5U),
352
353 /* Shadow ray visibility. */
357
358 /* Subset of flags used for ray visibility for intersection.
359 *
360 * NOTE: SHADOW_CATCHER macros below assume there are no more than
361 * 16 visibility bits. */
362 PATH_RAY_ALL_VISIBILITY = ((1U << 11U) - 1U),
363
364 /* Special flag to tag unaligned BVH nodes.
365 * Only set and used in BVH nodes to distinguish how to interpret bounding box information stored
366 * in the node (either it should be intersected as AABB or as OBBU).
367 * So this can overlap with path flags. */
369
370 /* --------------------------------------------------------------------
371 * Path flags.
372 */
373
374 /* Surface had transmission component at previous bounce. Used for light tree
375 * traversal and culling to be consistent with MIS PDF at the next bounce. */
377
378 /* Don't apply multiple importance sampling weights to emission from
379 * lamp or surface hits, because they were not direct light sampled. */
380 PATH_RAY_MIS_SKIP = (1U << 12U),
381
382 /* Diffuse bounce earlier in the path, skip SSS to improve performance
383 * and avoid branching twice with disk sampling SSS. */
385
386 /* Single pass has been written. */
388
389 /* Zero background alpha, for camera or transparent glass rays. */
391
392 /* Terminate ray immediately at next bounce. */
395
396 /* Ray is to be terminated, but continue with transparent bounces and
397 * emission as long as we encounter them. This is required to make the
398 * MIS between direct and indirect light rays match, as shadow rays go
399 * through transparent surfaces to reach emission too. */
401
402 /* Terminate ray immediately after volume shading. */
404
405 /* Ray is to be terminated. */
408
409 /* Path and shader is being evaluated for direct lighting emission. */
410 PATH_RAY_EMISSION = (1U << 20U),
411
412 /* Perform subsurface scattering. */
418
419 /* Contribute to denoising features. */
421
422 /* Render pass categories. */
424 PATH_RAY_VOLUME_PASS = (1U << 27U),
426
427 /* Shadow ray is for AO. */
429
430 /* A shadow catcher object was hit and the path was split into two. */
432
433 /* A shadow catcher object was hit and this path traces only shadow catchers, writing them into
434 * their dedicated pass for later division.
435 *
436 * NOTE: Is not covered with `PATH_RAY_ANY_PASS` because shadow catcher does special handling
437 * which is separate from the light passes. */
439
440 /* Path is evaluating background for an approximate shadow catcher with non-transparent film. */
442
443 /* TODO(weizhen): should add another flag to record only the primary scatter, but then we need to
444 change the flag to 64 bits or split path_flags in two. Right now we also write volume scatter
445 if the primary hit is surface, but that seems fine. */
446 /* Volume scattering probability guiding. This flag is added to path where the primary ray passed
447 through the volume without scattering. */
449};
450
451// 8bit enum, just in case we need to move more variables in it
459
460/* Configure ray visibility bits for rays and objects respectively,
461 * to make shadow catchers work.
462 *
463 * On shadow catcher paths we want to ignore any intersections with non-catchers,
464 * whereas on regular paths we want to intersect all objects. */
465
466#define SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) ((visibility) << 16)
467
468#define SHADOW_CATCHER_PATH_VISIBILITY(path_flag, visibility) \
469 (((path_flag) & PATH_RAY_SHADOW_CATCHER_PASS) ? SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) : \
470 (visibility))
471
472#define SHADOW_CATCHER_OBJECT_VISIBILITY(is_shadow_catcher, visibility) \
473 (((is_shadow_catcher) ? SHADOW_CATCHER_VISIBILITY_SHIFT(visibility) : 0) | (visibility))
474
475/* Closure Label */
476
490
491/* Render Passes */
492
493#define PASS_NAME_JOIN(a, b) a##_##b
494#define PASSMASK(pass) (1 << ((PASS_NAME_JOIN(PASS, pass)) % 32))
495
496// NOTE: Keep in sync with `Pass::get_type_enum()`.
499
500 /* Light Passes */
520
521 /* Data passes */
539 /* No Scatter color since it's tricky to define what it would even mean. */
546
547 /* PASS_SHADOW_CATCHER accumulates contribution of shadow catcher object which is not affected by
548 * any other object. The pass accessor will divide the combined pass by the shadow catcher. The
549 * result of this division is then to be multiplied with the backdrop. The alpha channel of this
550 * pass contains number of samples which contributed to the color components of the pass.
551 *
552 * PASS_SHADOW_CATCHER_SAMPLE_COUNT contains number of samples for which the path split
553 * happened.
554 *
555 * PASS_SHADOW_CATCHER_MATTE contains pass which contains non-catcher objects. This pass is to be
556 * alpha-overed onto the backdrop (after multiplication). */
560
561 /* Guiding related debug rendering passes */
562 /* The estimated sample color from the PathSegmentStorage. If everything is integrated correctly
563 * the output should be similar to PASS_COMBINED. */
565 /* The guiding probability at the first bounce. */
567 /* The avg. roughness at the first bounce. */
569 /* The majorant optical depth along the ray, for volume scattering probability guiding.
570 * When reading this pass, it is converted to majorant transmittance */
574
579
581};
582
583#define PASS_ANY (~0) // NOLINT
584
587 CRYPT_OBJECT = (1 << 0),
588 CRYPT_MATERIAL = (1 << 1),
589 CRYPT_ASSET = (1 << 2),
590 CRYPT_ACCURATE = (1 << 3),
591};
592
598
599/* Closure Filter */
600
609
610/* Shader Flag */
611
630
640
641/* Light Type */
642
651
652/* Guiding Distribution Type */
653
661
662/* Guiding Directional Sampling Type */
663
671
672/* Camera Type */
673
675
676/* Panorama Type */
677
688
689/* Specifies an offset for the shutter's time interval. */
691 /* Shutter opens at the current frame. */
693 /* Shutter is fully open at the current frame. */
695 /* Shutter closes at the current frame. */
697
699};
700
701/* Direct Light Sampling */
702
710
711/* Differential */
712
717
719 float dx;
720 float dy;
721};
722
723/* Ray */
724
726 int prim; /* Primitive the ray is starting from */
727 int object; /* Instance prim is a part of */
728 int light_prim; /* Light primitive */
729 int light_object; /* Light object */
730};
731
732struct Ray {
733 float3 P; /* origin */
734 float3 D; /* direction */
735 float tmin; /* start distance */
736 float tmax; /* end distance */
737 float time; /* time (for motion blur) */
738
739#ifdef __RAY_DIFFERENTIALS__
740 float dP;
741 float dD;
742#endif
743
745};
746
747/* Intersection */
748
750 float t, u, v;
751 int prim;
753 int type;
754};
755
756/* On certain GPUs (Apple Silicon), splitting every integrator state field into its own separate
757 * array can be detrimental for cache utilization. By enabling __INTEGRATOR_GPU_PACKED_STATE__, we
758 * specify that certain fields should be packed together. This improves cache hit ratios in cases
759 * where fields are often accessed together (e.g. "ray" and "isect").
760 */
761#if (defined(__APPLE__) && TARGET_CPU_ARM64) || \
762 (defined(__KERNEL_METAL_APPLE__) && defined(__KERNEL_METAL_TARGET_CPU_ARM64__))
763# define __INTEGRATOR_GPU_PACKED_STATE__
764
765/* Generate packed layouts for structs declared with KERNEL_STRUCT_BEGIN_PACKED. For example the
766 * following template...
767 *
768 * KERNEL_STRUCT_BEGIN_PACKED(shadow_ray, KERNEL_FEATURE_PATH_TRACING)
769 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, packed_float3, P, KERNEL_FEATURE_PATH_TRACING)
770 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, packed_float3, D, KERNEL_FEATURE_PATH_TRACING)
771 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, tmin, KERNEL_FEATURE_PATH_TRACING)
772 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, tmax, KERNEL_FEATURE_PATH_TRACING)
773 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, time, KERNEL_FEATURE_PATH_TRACING)
774 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, float, dP, KERNEL_FEATURE_PATH_TRACING)
775 * KERNEL_STRUCT_MEMBER_PACKED(shadow_ray, int, self_light, KERNEL_FEATURE_SHADOW_LINKING)
776 * KERNEL_STRUCT_END(shadow_ray)
777 *
778 * ...will produce the following packed struct:
779 *
780 * struct packed_shadow_ray {
781 * packed_float3 P;
782 * packed_float3 D;
783 * float tmin;
784 * float tmax;
785 * float time;
786 * float dP;
787 * int self_light;
788 * };
789 */
790
791# define KERNEL_STRUCT_BEGIN(name) struct dummy_##name {
792# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) struct packed_##parent_struct {
793# define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature)
794# define KERNEL_STRUCT_MEMBER_PACKED(parent_struct, type, name, feature) type name;
795# define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) type name;
796# define KERNEL_STRUCT_END(name) \
797 } \
798 ;
799# define KERNEL_STRUCT_END_ARRAY(name, cpu_size, gpu_size) \
800 } \
801 ;
802# define KERNEL_STRUCT_VOLUME_STACK_SIZE MAX_VOLUME_STACK_SIZE
803
806
807# undef KERNEL_STRUCT_BEGIN
808# undef KERNEL_STRUCT_BEGIN_PACKED
809# undef KERNEL_STRUCT_MEMBER
810# undef KERNEL_STRUCT_MEMBER_PACKED
811# undef KERNEL_STRUCT_ARRAY_MEMBER
812# undef KERNEL_STRUCT_END
813# undef KERNEL_STRUCT_END_ARRAY
814# undef KERNEL_STRUCT_VOLUME_STACK_SIZE
815
816#endif
817
818/* Primitives */
819
846
847/* Convert type to index in range 0..PRIMITIVE_NUM-1. */
848#define PRIMITIVE_INDEX(type) \
849 (bitscan((uint32_t)(type)) * 2 + (((type) & PRIMITIVE_MOTION) ? 1 : 0))
850
851/* Pack segment into type value to save space. */
852#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_BITS) | (type))
853#define PRIMITIVE_UNPACK_SEGMENT(type) (type >> PRIMITIVE_NUM_BITS)
854
862
863/* Attributes */
864
871
886
926
928 ATTR_SUBDIVIDE_SMOOTH_FVAR = (1 << 0), /* This attribute is face-varying and requires smooth
929 * subdivision (typically UV map). */
930};
931
937
938/* For looking up attributes on objects and geometry. */
940 uint64_t id; /* Global unique identifier. */
941 int offset; /* Offset into __attributes global arrays. */
942 uint16_t element; /* AttributeElement. */
943 uint8_t type; /* NodeAttributeType. */
944 uint8_t pad;
945};
946
947/* Closure data */
948
949#ifndef __MAX_CLOSURE__
950# define MAX_CLOSURE 64
951#else
952# define MAX_CLOSURE __MAX_CLOSURE__
953#endif
954
955/* For manifold next event estimation, we need space to store and evaluate
956 * 2 closures (with extra data) on the refractive interfaces, in addition
957 * to keeping the full sd at the current shading point. We need 4 because a
958 * refractive BSDF is instanced with a companion reflection BSDF, even though
959 * we only need the refractive one, and each of them requires 2 slots. */
960#ifndef __CAUSTICS_MAX_CLOSURE__
961# define CAUSTICS_MAX_CLOSURE 4
962#else
963# define CAUSTICS_MAX_CLOSURE __CAUSTICS_MAX_CLOSURE__
964#endif
965
966#ifndef __MAX_VOLUME_STACK_SIZE__
967# define MAX_VOLUME_STACK_SIZE 32
968#else
969# define MAX_VOLUME_STACK_SIZE __MAX_VOLUME_STACK_SIZE__
970#endif
971
972#define MAX_VOLUME_CLOSURE 8 // NOLINT
973/* Set the maximal resolution to be 128 (2^7) to limit traversing overhead. */
974#define VOLUME_OCTREE_MAX_DEPTH 7
975
976/* This struct is the base class for all closures. The common members are
977 * duplicated in all derived classes since we don't have C++ in the kernel
978 * yet, and because it lets us lay out the members to minimize padding. The
979 * weight member is located at the beginning of the struct for this reason.
980 *
981 * ShaderClosure has a fixed size, and any extra space must be allocated
982 * with closure_alloc_extra().
983 *
984 * We pad the struct to align to 16 bytes. All shader closures are assumed
985 * to fit in this struct size. CPU sizes are a bit larger because float3 is
986 * padded to be 16 bytes, while it's only 12 bytes on the GPU. */
987
988#define SHADER_CLOSURE_BASE \
989 Spectrum weight; \
990 ClosureType type; \
991 float sample_weight; \
992 float3 N
993
994/* To save some space, volume closures (phase functions) don't store a normal.
995 * They are still allocated as ShaderClosures first, but get assigned to
996 * slots of type ShaderVolumeClosure later, so make sure to keep the layout
997 * in sync. */
998#define SHADER_CLOSURE_VOLUME_BASE \
999 Spectrum weight; \
1000 ClosureType type; \
1001 float sample_weight
1002
1003struct ccl_align(16) ShaderClosure {
1005
1006 /* Extra space for closures to store data, somewhat arbitrary but closures
1007 * assert that their size fits. */
1008 char pad[sizeof(Spectrum) * 2 + sizeof(float) * 4];
1009};
1010
1011/* Shader Data
1012 *
1013 * Main shader state at a point on the surface or in a volume. All coordinates
1014 * are in world space.
1015 */
1016
1018 /* Runtime flags. */
1019
1020 /* Set when ray hits backside of surface. */
1021 SD_BACKFACING = (1 << 0),
1022 /* Shader has non-zero emission. */
1023 SD_EMISSION = (1 << 1),
1024 /* Shader has BSDF closure. */
1025 SD_BSDF = (1 << 2),
1026 /* Shader has non-singular BSDF closure. */
1028 /* Shader has BSSRDF closure. */
1029 SD_BSSRDF = (1 << 4),
1030 /* Shader has holdout closure. */
1031 SD_HOLDOUT = (1 << 5),
1032 /* Shader has non-zero volume extinction. */
1033 SD_EXTINCTION = (1 << 6),
1034 /* Shader has a volume phase (scatter) closure. */
1035 SD_SCATTER = (1 << 7),
1036 /* Shader is being evaluated in a volume. */
1038 /* Shader has transparent closure. */
1039 SD_TRANSPARENT = (1 << 9),
1040 /* BSDF requires LCG for evaluation. */
1042 /* BSDF has a transmissive component. */
1044 /* Shader has ray portal closure. */
1045 SD_RAY_PORTAL = (1 << 12),
1046
1050
1051 /* Shader flags. */
1052
1053 /* If Light Path Node is present in the shader graph. */
1055 /* Apply a correction term to smooth illumination on grazing angles when using bump mapping. */
1057 /* Use front side for direct light sampling. */
1058 SD_MIS_FRONT = (1 << 16),
1059 /* Has transparent shadow. */
1061 /* Has volume shader. */
1062 SD_HAS_VOLUME = (1 << 18),
1063 /* Has only volume shader, no surface. */
1065 /* Has heterogeneous volume. */
1067 /* BSSRDF normal uses bump. */
1069 /* Use equiangular volume sampling */
1071 /* Use multiple importance volume sampling. */
1072 SD_VOLUME_MIS = (1 << 23),
1073 /* Use cubic interpolation for voxels. */
1074 SD_VOLUME_CUBIC = (1 << 24),
1075 /* Has data connected to the displacement input or uses bump map. */
1076 SD_HAS_BUMP = (1 << 25),
1077 /* Has true displacement. */
1079 /* Has constant emission (value stored in __shaders) */
1081 /* Needs to access attributes for volume rendering */
1083 /* Shader has emission */
1084 SD_HAS_EMISSION = (1 << 29),
1085 /* Shader has ray-tracing. */
1086 SD_HAS_RAYTRACE = (1 << 30),
1087 /* Use back side for direct light sampling. */
1088 SD_MIS_BACK = (1 << 31),
1089
1095};
1096
1097/* Object flags. */
1099 /* Holdout for camera rays. */
1101 /* Has object motion blur. */
1103 /* Vertices have transform applied. */
1105 /* The object's transform applies a negative scale. */
1107 /* Object has a volume shader. */
1109 /* Object intersects AABB of an object with volume shader. */
1111 /* Has position for motion vertices. */
1113 /* object is used to catch shadows */
1115 /* object has volume attributes */
1117 /* object is caustics caster */
1119 /* object is caustics receiver */
1121 /* object has attribute for volume motion */
1123
1124 /* object is using caustics */
1126
1132};
1133
1134struct ccl_align(16) ShaderData {
1135 /* position */
1136 float3 P;
1137 /* smooth normal for shading */
1138 float3 N;
1139 /* true geometric normal */
1140 float3 Ng;
1141 /* view/incoming direction */
1142 float3 wi;
1143
1144 /* combined type and curve segment for hair */
1145 int type;
1146
1147 /* shader id */
1148 int shader;
1149 /* booleans describing shader, see ShaderDataFlag */
1150 int flag;
1151 /* booleans describing object of the shader, see ShaderDataObjectFlag */
1152 int object_flag;
1153
1154 /* Closure data, we store a fixed array of closures */
1155 int num_closure;
1156 int num_closure_left;
1157
1158 /* primitive id if there is one, ~0 otherwise */
1159 int prim;
1160
1161 /* parametric coordinates
1162 * - barycentric weights for triangles */
1163 float u;
1164 float v;
1165 /* object id if there is one, ~0 otherwise */
1166 int object;
1167
1168 /* motion blur sample time */
1169 float time;
1170
1171 /* length of the ray being shaded */
1172 float ray_length;
1173
1174#ifdef __RAY_DIFFERENTIALS__
1175 /* Radius of differential of P. */
1176 float dP;
1177 /* Radius of differential of wi. */
1178 float dI;
1179 /* differential of u, v */
1180 differential du;
1181 differential dv;
1182#endif
1183#ifdef __DPDU__
1184 /* differential of P w.r.t. parametric coordinates. note that dPdu is
1185 * not readily suitable as a tangent for shading on triangles. */
1186 float3 dPdu;
1187 float3 dPdv;
1188#endif
1189
1190#ifdef __OBJECT_MOTION__
1191 /* Object <-> world space transformations for motion blur, cached to avoid
1192 * re-interpolating them constantly for shading. */
1193 Transform ob_tfm_motion;
1194 Transform ob_itfm_motion;
1195#endif
1196
1197 /* ray start position, only set for backgrounds */
1198 float3 ray_P;
1199 float ray_dP;
1200
1201 /* LCG state for closures that require additional random numbers. */
1202 uint lcg_state;
1203
1204 /* Closure weights summed directly, so we can evaluate
1205 * emission and shadow transparency with MAX_CLOSURE 0. */
1206 Spectrum closure_emission_background;
1207 Spectrum closure_transparent_extinction;
1208
1209 /* At the end so we can adjust size in ShaderDataTinyStorage. */
1210 struct ShaderClosure closure[MAX_CLOSURE];
1211};
1212
1213#ifdef __KERNEL_GPU__
1214/* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
1215 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1217 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * MAX_CLOSURE];
1218};
1219
1220/* ShaderDataCausticsStorage needs the same alignment as ShaderData, or else
1221 * the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
1223 char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * (MAX_CLOSURE - CAUSTICS_MAX_CLOSURE)];
1224};
1225#else
1226/* On the CPU use full size, to avoid compiler and ASAN warnings. */
1227using ShaderDataTinyStorage = ShaderData;
1228using ShaderDataCausticsStorage = ShaderData;
1229#endif
1230
1231#define AS_SHADER_DATA(shader_data_tiny_storage) \
1232 ((ccl_private ShaderData *)shader_data_tiny_storage)
1233
1234/* Compact volume closures storage.
1235 *
1236 * Used for decoupled direct/indirect light closure storage.
1237 *
1238 * This shares its basic layout with SHADER_CLOSURE_VOLUME_BASE and ShaderClosure,
1239 * just without the normal and with less space for closure-specific parameters.
1240 * That way, we can just cast ShaderClosure* to ShaderVolumeClosure* and assign it.
1241 */
1246 /* Space for closure-specific parameters. */
1247 float param[3];
1248};
1249
1254
1255/* Volume Stack */
1256
1257#ifdef __VOLUME__
1261};
1262#endif
1263
1264/* Struct to gather multiple nearby intersections. */
1270
1271/* Constant Kernel Data
1272 *
1273 * These structs are passed from CPU to various devices, and the struct layout
1274 * must match exactly. Structs are padded to ensure 16 byte alignment, and we
1275 * do not use float3 because its size may not be the same on all devices. */
1276
1278 /* type */
1279 int type;
1281
1282 /* depth of field */
1284 float blades;
1287
1288 /* motion blur */
1291
1292 int pad1;
1293 int pad2;
1294 int pad3;
1295
1296 /* panorama */
1304
1305 /* stereo */
1310
1311 /* matrices */
1314
1315 /* differentials */
1318
1319 /* clipping */
1322
1323 /* sensor size */
1326
1327 /* render size */
1329
1330 /* anamorphic lens bokeh */
1332
1334
1335 /* more matrices */
1343
1344 /* Stores changes in the projection matrix. Use for camera zoom motion
1345 * blur and motion pass output for perspective camera. */
1348
1349 /* Transforms for motion pass. */
1352
1354
1355 /* Rolling shutter */
1358
1360};
1362
1366
1369
1372
1381
1382 float scale;
1385
1389
1390 /* Number of components to write to. */
1392
1393 /* Number of floats per pixel. When zero is the same as `num_components`.
1394 * NOTE: Is ignored for half4 destination. */
1396
1398
1399 /* Padding. */
1400 int pad1;
1401};
1403
1429
1430/* Specialized struct that can become constants in dynamic compilation. */
1431#define KERNEL_STRUCT_BEGIN(name, parent) struct ccl_align(16) name {
1432#define KERNEL_STRUCT_END(name) \
1433 } \
1434 ; \
1435 static_assert_align(name, 16);
1436
1437#ifdef __KERNEL_USE_DATA_CONSTANTS__
1438# define KERNEL_STRUCT_MEMBER(parent, type, name) type __unused_##name;
1439#else
1440# define KERNEL_STRUCT_MEMBER(parent, type, name) type name;
1441#endif
1442
1443#include "kernel/data_template.h"
1444
1460
1468
1472
1473struct ccl_align(16) KernelData {
1474 /* Features and limits. */
1475 uint kernel_features;
1476 uint max_closures;
1477 uint max_shaders;
1478 uint volume_stack_size;
1479
1480 /* Always dynamic data members. */
1481 KernelCamera cam;
1483 KernelTables tables;
1484 KernelLightLinkSet light_link_sets[LIGHT_LINK_SET_MAX];
1485
1486 /* Potentially specialized data members. */
1487#define KERNEL_STRUCT_BEGIN(name, parent) name parent;
1488#include "kernel/data_template.h"
1489
1490 /* Device specific BVH. */
1491#ifdef __KERNEL_OPTIX__
1492 OptixTraversableHandle device_bvh;
1493#elif defined __METALRT__
1494 metalrt_as_type device_bvh;
1495#elif defined(__HIPRT__)
1496 void *device_bvh;
1497#else
1498# ifdef __EMBREE__
1499# if RTC_VERSION >= 40400
1500 RTCTraversable device_bvh;
1501# else
1502 RTCScene device_bvh;
1503# endif
1504# ifndef __KERNEL_64_BIT__
1505 int pad1;
1506# endif
1507# else
1508 int device_bvh, pad1;
1509# endif
1510#endif
1511 int pad2, pad3;
1512};
1513static_assert_align(KernelData, 16);
1514
1515/* Kernel data structures. */
1516
1562
1570
1572 int prim;
1573 int type;
1574};
1576
1579 float radius;
1585 /* For non-uniform object scaling, the actual spread might be different. */
1587 /* Distance from the apex of the smallest enclosing cone of the light spread to light center. */
1589};
1590
1591/* PointLight is SpotLight with only radius and invarea being used. */
1592
1604
1613
1630
1638
1639/* Bounding box. */
1644
1650
1651enum LightTreeNodeType : uint8_t {
1656};
1657
1659 /* Bounding box. */
1661
1662 /* Bounding cone. */
1664
1665 /* Energy. */
1666 float energy;
1667
1669
1670 /* Leaf nodes need to know the number of emitters stored. */
1672
1673 union {
1674 struct {
1675 int first_emitter; /* The index of the first emitter. */
1677 struct {
1678 /* Indices of the children. */
1682 struct {
1683 int reference; /* A reference to the node with the subtree. */
1685 };
1686
1687 /* Bit trail. */
1689
1690 /* Bits to skip in the bit trail, to skip nodes in for specialized trees. */
1691 uint8_t bit_skip;
1692
1693 /* Padding. */
1694 uint8_t pad[11];
1695};
1697
1704
1706 /* Index of the parent node in device vector `volume_tree_nodes`. */
1708
1709 /* Index of the first child node in device vector `volume_tree_nodes`. All children of the same
1710 * node are stored in contiguous memory. */
1712
1713 /* Minimal and maximal volume density inside the node. */
1714 /* TODO(weizhen): we can make sigma Spectral for better accuracy. Since only root and leaf nodes
1715 * need sigma, we can introduce `KernelOctreeInnerNode` to reduce the size of the struct. */
1717};
1718
1720 /* Bounding cone. */
1721 float theta_o;
1722 float theta_e;
1723
1724 /* Energy. */
1725 float energy;
1726
1727 union {
1728 struct {
1729 int id; /* The location in the triangles array. */
1732
1733 struct {
1734 int id; /* The location in the lights array. */
1736
1737 struct {
1741 };
1742
1743 /* Object and shader. */
1744 int object_id;
1746
1747 /* Bit trail from root node to leaf node containing emitter. */
1749};
1751
1754 float age;
1756 float size;
1758 /* Only XYZ are used of the following. float4 instead of float3 are used
1759 * to ensure consistent padding/alignment across devices. */
1763};
1765
1774
1775/* Patches */
1776
1777// NOLINTBEGIN
1778#define PATCH_MAX_CONTROL_VERTS 16
1779
1780/* Patch map node flags */
1781
1782#define PATCH_MAP_NODE_IS_SET (1 << 30)
1783#define PATCH_MAP_NODE_IS_LEAF (1u << 31)
1784#define PATCH_MAP_NODE_INDEX_MASK (~(PATCH_MAP_NODE_IS_SET | PATCH_MAP_NODE_IS_LEAF))
1785// NOLINTEND
1786
1787/* Work Tiles */
1788
1790 uint x, y, w, h;
1791
1795
1798
1799 /* Precalculated parameters used by init_from_camera kernel on GPU. */
1802};
1803
1804/* Shader Evaluation.
1805 *
1806 * Position on a primitive on an object at which we want to evaluate the
1807 * shader for example mesh displacement or light importance map. */
1808
1811 int prim;
1812 float u, v;
1813};
1815
1816/* Pre-computed sample table sizes for the tabulated Sobol sampler.
1817 *
1818 * NOTE: min and max samples *must* be a power of two, and patterns
1819 * ideally should be as well.
1820 */
1821// NOLINTBEGIN
1822#define MIN_TAB_SOBOL_SAMPLES 256
1823#define MAX_TAB_SOBOL_SAMPLES 8192
1824#define NUM_TAB_SOBOL_DIMENSIONS 4
1825#define NUM_TAB_SOBOL_PATTERNS 256
1826// NOLINTEND
1827
1828/* Device kernels.
1829 *
1830 * Identifier for kernels that can be executed in device queues.
1831 *
1832 * Some implementation details.
1833 *
1834 * If the kernel uses shared CUDA memory, `CUDADeviceQueue::enqueue` is to be modified.
1835 * The path iteration kernels are handled in `PathTraceWorkGPU::enqueue_path_iteration`. */
1836
1837enum DeviceKernel : int {
1855
1870
1875
1876#define DECLARE_FILM_CONVERT_KERNEL(variant) \
1877 DEVICE_KERNEL_FILM_CONVERT_##variant, DEVICE_KERNEL_FILM_CONVERT_##variant##_HALF_RGBA
1878
1881 DECLARE_FILM_CONVERT_KERNEL(VOLUME_MAJORANT),
1882 DECLARE_FILM_CONVERT_KERNEL(SAMPLE_COUNT),
1884 DECLARE_FILM_CONVERT_KERNEL(LIGHT_PATH),
1888 DECLARE_FILM_CONVERT_KERNEL(CRYPTOMATTE),
1889 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER),
1890 DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER_MATTE_WITH_SHADOW),
1893
1894#undef DECLARE_FILM_CONVERT_KERNEL
1895
1899
1905
1908
1910
1912
1914};
1915
1916enum {
1918};
1919
unsigned int uint
int pad[32 - sizeof(int)]
#define U
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned long long int uint64_t
nullptr FLOAT
nullptr float
#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, 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_HAS_LIGHT_PATH_NODE
@ 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_CURVE_THICK_LINEAR
@ 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_CURVE_THICK_LINEAR
@ 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_UV_TANGENT_SIGN_UNDISPLACED
@ ATTR_STD_SHADOW_TRANSPARENCY
@ ATTR_STD_UV_TANGENT_UNDISPLACED
@ 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_BAKE_VOLUME_DENSITY_EVAL
@ PRNG_VOLUME_EXPANSION_ORDER
@ PRNG_LENS_TIME
@ PRNG_VOLUME_SHADE_OFFSET
@ PRNG_SUBSURFACE_GUIDE_STRATEGY
@ PRNG_TERMINATE
@ PRNG_VOLUME_RESERVOIR
@ PRNG_SUBSURFACE_DISK
@ PRNG_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_VOLUME_PRIMARY_TRANSMIT
@ 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
@ CURVE_THICK_LINEAR
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_VOLUME_SCATTER
@ PASS_TRANSMISSION_INDIRECT
@ PASS_BAKE_SEED
@ PASS_SHADOW_CATCHER
@ PASS_VOLUME_MAJORANT
@ PASS_DENOISING_NORMAL
@ PASS_ROUGHNESS
@ PASS_DIFFUSE_DIRECT
@ PASS_MOTION
@ PASS_CATEGORY_BAKE_END
@ PASS_MATERIAL_ID
@ PASS_VOLUME_MAJORANT_SAMPLE_COUNT
@ PASS_AO
@ PASS_COMBINED
@ PASS_DIFFUSE
@ PASS_DIFFUSE_INDIRECT
@ PASS_RENDER_TIME
@ 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_VOLUME_TRANSMIT
@ PASS_DENOISING_DEPTH
@ PASS_BAKE_PRIMITIVE
@ PASS_CATEGORY_LIGHT_END
ShaderData ShaderDataCausticsStorage
AttributePrimitive
@ ATTR_PRIM_SUBD
@ ATTR_PRIM_TYPES
@ ATTR_PRIM_GEOMETRY
PanoramaType
@ PANORAMA_MIRRORBALL
@ PANORAMA_FISHEYE_EQUISOLID
@ PANORAMA_NUM_TYPES
@ PANORAMA_CENTRAL_CYLINDRICAL
@ PANORAMA_EQUIANGULAR_CUBEMAP_FACE
@ PANORAMA_FISHEYE_EQUIDISTANT
@ PANORAMA_FISHEYE_LENS_POLYNOMIAL
@ PANORAMA_EQUIRECTANGULAR
@ DEVICE_KERNEL_INTEGRATOR_NUM
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_SHADER_EVAL_VOLUME_DENSITY
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE
@ DEVICE_KERNEL_VOLUME_GUIDING_FILTER_X
@ DEVICE_KERNEL_INTEGRATOR_QUEUED_SHADOW_PATHS_ARRAY
@ DEVICE_KERNEL_FILTER_GUIDING_SET_FAKE_ALBEDO
@ DEVICE_KERNEL_FILTER_COLOR_FLIP_Y
@ DEVICE_KERNEL_FILTER_COLOR_POSTPROCESS
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW
@ DEVICE_KERNEL_INTEGRATOR_TERMINATED_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_VOLUME_STACK
@ DEVICE_KERNEL_SHADER_EVAL_BACKGROUND
@ DEVICE_KERNEL_INTEGRATOR_SORTED_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_SHADOW_PATHS_ARRAY
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_SHADOW_STATES
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE
@ DEVICE_KERNEL_INTEGRATOR_SORT_BUCKET_PASS
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_DEDICATED_LIGHT
@ DEVICE_KERNEL_FILTER_GUIDING_PREPROCESS
@ DEVICE_KERNEL_INTEGRATOR_COMPACT_STATES
@ DEVICE_KERNEL_INTEGRATOR_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_INTEGRATOR_SHADE_VOLUME_RAY_MARCHING
@ 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_VOLUME_GUIDING_FILTER_Y
@ DEVICE_KERNEL_PREFIX_SUM
GuidingDistributionType
@ GUIDING_TYPE_VMM
@ GUIDING_NUM_TYPES
@ GUIDING_TYPE_DIRECTIONAL_QUAD_TREE
@ GUIDING_TYPE_PARALLAX_AWARE_VMM
CameraType
@ CAMERA_PERSPECTIVE
@ CAMERA_PANORAMA
@ CAMERA_CUSTOM
@ CAMERA_ORTHOGRAPHIC
#define N
@ FLOAT4
@ FLOAT3
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::@100244224035147311323362061026206066304156105230::@145257001270125053357336343156215202056055243242 light
struct KernelLightTreeEmitter::@100244224035147311323362061026206066304156105230::@155115103153173066061151154125014102203306247176 mesh
EmissionSampling emission_sampling
struct KernelLightTreeEmitter::@100244224035147311323362061026206066304156105230::@126172035204211036214107167014276257320000170324 triangle
struct KernelLightTreeNode::@075060275333356206225201163255143122031204113015::@064327011010203173153234374026232040346041241257 instance
LightTreeNodeType type
KernelBoundingBox bbox
struct KernelLightTreeNode::@075060275333356206225201163255143122031204113015::@121232343267032302300332005257270111102366024356 inner
KernelBoundingCone bcone
struct KernelLightTreeNode::@075060275333356206225201163255143122031204113015::@354167317357124241334100100220231122277063225056 leaf
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
Extrema< float > sigma
packed_float3 translation
packed_float3 scale
float4 angular_velocity
float constant_emission[3]
float half_cot_half_spot_angle
packed_float3 dir
float cos_half_larger_spread
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:145