Blender V5.3
state_template.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/************************************ Path State *****************************/
6
8/* Index of a pixel within the device render buffer where this path will write its result.
9 * To get an actual offset within the buffer the value needs to be multiplied by the
10 * `kernel_data.film.pass_stride`.
11 *
12 * The multiplication is delayed for later, so that state can use 32bit integer. */
13KERNEL_STRUCT_MEMBER(path, uint32_t, render_pixel_index, KERNEL_FEATURE_PATH_TRACING)
14/* Current sample number. */
16/* Current ray bounce depth. */
18/* Current transparent ray bounce depth. */
19KERNEL_STRUCT_MEMBER(path, uint16_t, transparent_bounce, KERNEL_FEATURE_PATH_TRACING)
20/* Current diffuse ray bounce depth. */
21KERNEL_STRUCT_MEMBER(path, uint16_t, diffuse_bounce, KERNEL_FEATURE_PATH_TRACING)
22/* Current glossy ray bounce depth. */
23KERNEL_STRUCT_MEMBER(path, uint16_t, glossy_bounce, KERNEL_FEATURE_PATH_TRACING)
24/* Current transmission ray bounce depth. */
25KERNEL_STRUCT_MEMBER(path, uint16_t, transmission_bounce, KERNEL_FEATURE_PATH_TRACING)
26/* Current volume ray bounce depth. */
27KERNEL_STRUCT_MEMBER(path, uint16_t, volume_bounce, KERNEL_FEATURE_PATH_TRACING)
28/* Current volume bounds ray bounce depth. */
29KERNEL_STRUCT_MEMBER(path, uint16_t, volume_bounds_bounce, KERNEL_FEATURE_PATH_TRACING)
30/* Current portal ray bounce depth. */
31KERNEL_STRUCT_MEMBER(path, uint16_t, portal_bounce, KERNEL_FEATURE_NODE_PORTAL)
32/* DeviceKernel bit indicating queued kernels. */
33KERNEL_STRUCT_MEMBER(path, uint16_t, queued_kernel, KERNEL_FEATURE_PATH_TRACING)
34/* Random number generator per-pixel info. */
35KERNEL_STRUCT_MEMBER(path, uint32_t, rng_pixel, KERNEL_FEATURE_PATH_TRACING)
36/* Random number dimension offset. */
37KERNEL_STRUCT_MEMBER(path, uint16_t, rng_offset, KERNEL_FEATURE_PATH_TRACING)
38/* enum PathRayVisibilityFlag, limited to bits from PATH_RAY_VISIBILITY_ALL */
39KERNEL_STRUCT_MEMBER(path, uint8_t, visibility, KERNEL_FEATURE_PATH_TRACING)
40/* enum PathRayFlag */
42/* enum PathRayMNEE */
44/* Index of shadow state path used for storing MNEE state. */
45KERNEL_STRUCT_MEMBER(path, int, mnee_shadow_state, KERNEL_FEATURE_MNEE)
46/* Majorant volume optical depth. */
47KERNEL_STRUCT_MEMBER(path, float, optical_depth, KERNEL_FEATURE_PATH_TRACING)
48/* Multiple importance sampling
49 * The PDF of BSDF sampling at the last scatter point, which is at ray distance
50 * zero and distance. Note that transparency and volume attenuation increase
51 * the ray tmin but keep P unmodified so that this works. */
53/* Object at last scatter point for light linking. */
54KERNEL_STRUCT_MEMBER(path, int, mis_ray_object, KERNEL_FEATURE_LIGHT_LINKING)
55/* Normal at last scatter point for light tree. */
57/* Filter glossy. */
59/* Continuation probability for path termination. */
62 continuation_probability,
64/* Throughput. */
66/* Factor to multiple with throughput to get remove any guiding PDFS.
67 * Such throughput without guiding PDFS is used for Russian roulette termination. */
68KERNEL_STRUCT_MEMBER(path, float, unguided_throughput, KERNEL_FEATURE_PATH_GUIDING)
69/* Ratio of throughput to distinguish diffuse / glossy / transmission render passes. */
76 pass_glossy_weight,
78/* Denoising. */
83/* Shader sorting. */
84/* TODO: compress as uint16? or leave out entirely and recompute key in sorting code? */
85KERNEL_STRUCT_MEMBER(path, uint32_t, shader_sort_key, KERNEL_FEATURE_PATH_TRACING)
87
88/************************************** Ray ***********************************/
89
98KERNEL_STRUCT_MEMBER(ray, float, previous_dt, KERNEL_FEATURE_LIGHT_TREE)
100
101/*************************** Intersection result ******************************/
102
103/* Result from scene intersection. */
112
113/*************** Subsurface closure state for subsurface kernel ***************/
114
121 anisotropy,
123KERNEL_STRUCT_END(subsurface)
124
125/********************************** Volume Stack ******************************/
126
127KERNEL_STRUCT_BEGIN(volume_stack)
128KERNEL_STRUCT_ARRAY_MEMBER(volume_stack, int, object, KERNEL_FEATURE_VOLUME)
129KERNEL_STRUCT_ARRAY_MEMBER(volume_stack, int, shader, KERNEL_FEATURE_VOLUME)
130KERNEL_STRUCT_END_ARRAY(volume_stack,
133
134/************************************ Path Guiding *****************************/
135KERNEL_STRUCT_BEGIN(guiding)
136#if defined(__PATH_GUIDING__)
137/* Current path segment of the random walk/path. */
139 openpgl::cpp::PathSegment *,
140 path_segment,
142#else
143/* Current path segment of the random walk/path. */
145#endif
146/* If surface guiding is enabled */
147KERNEL_STRUCT_MEMBER(guiding, bool, use_surface_guiding, KERNEL_FEATURE_PATH_GUIDING)
148/* Random number used for additional guiding decisions (e.g., cache query, selection to use guiding
149 * or BSDF sampling) */
152 sample_surface_guiding_rand,
154/* The probability to use surface guiding (i.e., diffuse sampling prob * guiding prob). */
159/* Probability of sampling a BSSRDF closure instead of a BSDF closure. */
162 bssrdf_sampling_prob,
164/* If volume guiding is enabled */
165KERNEL_STRUCT_MEMBER(guiding, bool, use_volume_guiding, KERNEL_FEATURE_PATH_GUIDING)
166/* Random number used for additional guiding decisions (e.g., cache query, selection to use guiding
167 * or BSDF sampling) */
172/* The probability to use surface guiding (i.e., diffuse sampling prob * guiding prob). */
175 volume_guiding_sampling_prob,
177KERNEL_STRUCT_END(guiding)
178
179/******************************* Shadow linking *******************************/
180
181KERNEL_STRUCT_BEGIN(shadow_link)
182/* Number of dedicated light hits along the shadow ray. */
183KERNEL_STRUCT_MEMBER(shadow_link, uint16_t, dedicated_light_weight, KERNEL_FEATURE_SHADOW_LINKING)
184/* Copy of primitive and object from the last main path intersection. */
185KERNEL_STRUCT_MEMBER(shadow_link, int, last_isect_prim, KERNEL_FEATURE_SHADOW_LINKING)
186KERNEL_STRUCT_MEMBER(shadow_link, int, last_isect_object, KERNEL_FEATURE_SHADOW_LINKING)
187KERNEL_STRUCT_END(shadow_link)
#define D
unsigned long long int uint64_t
#define KERNEL_FEATURE_LIGHT_TREE
#define KERNEL_FEATURE_VOLUME
#define KERNEL_FEATURE_NODE_PORTAL
#define KERNEL_FEATURE_PATH_GUIDING
#define KERNEL_FEATURE_SUBSURFACE
#define KERNEL_FEATURE_LIGHT_PASSES
#define KERNEL_FEATURE_PATH_TRACING
#define KERNEL_FEATURE_SHADOW_LINKING
#define KERNEL_FEATURE_DENOISING
#define KERNEL_FEATURE_LIGHT_LINKING
#define KERNEL_FEATURE_MNEE
#define N
#define KERNEL_STRUCT_END(name)
#define KERNEL_STRUCT_BEGIN(name)
#define KERNEL_STRUCT_VOLUME_STACK_SIZE
#define KERNEL_STRUCT_END_ARRAY(name, cpu_array_size, gpu_array_size)
#define KERNEL_STRUCT_MEMBER_PACKED
#define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature)
#define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature)
#define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature)
pass_diffuse_weight
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_DENOISING KERNEL_STRUCT_VOLUME_STACK_SIZE KERNEL_FEATURE_PATH_GUIDING sample_volume_guiding_rand
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_DENOISING KERNEL_STRUCT_VOLUME_STACK_SIZE surface_guiding_sampling_prob
KERNEL_FEATURE_LIGHT_PASSES denoising_feature_throughput
packed_float3 PackedSpectrum