Blender V5.3
data_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#ifndef KERNEL_STRUCT_BEGIN
6# define KERNEL_STRUCT_BEGIN(name, parent)
7#endif
8#ifndef KERNEL_STRUCT_END
9# define KERNEL_STRUCT_END(name)
10#endif
11#ifndef KERNEL_STRUCT_MEMBER
12# define KERNEL_STRUCT_MEMBER(parent, type, name)
13#endif
14#ifndef KERNEL_STRUCT_MEMBER_DONT_SPECIALIZE
15# define KERNEL_STRUCT_MEMBER_DONT_SPECIALIZE
16#endif
17
18/* Background. */
19
20KERNEL_STRUCT_BEGIN(KernelBackground, background)
21/* xyz store direction, w the angle. float4 instead of float3 is used
22 * to ensure consistent padding/alignment across devices. */
23KERNEL_STRUCT_MEMBER(background, float4, sun)
24KERNEL_STRUCT_MEMBER(background, int, use_sun_guiding)
25/* Only shader index. */
26KERNEL_STRUCT_MEMBER(background, int, surface_shader)
27KERNEL_STRUCT_MEMBER(background, int, volume_shader)
28KERNEL_STRUCT_MEMBER(background, int, transparent)
29KERNEL_STRUCT_MEMBER(background, float, transparent_roughness_squared_threshold)
30/* Sun sampling. */
31KERNEL_STRUCT_MEMBER(background, float, sun_weight)
32/* Importance map sampling. */
33KERNEL_STRUCT_MEMBER(background, float, map_weight)
34KERNEL_STRUCT_MEMBER(background, float, portal_weight)
35KERNEL_STRUCT_MEMBER(background, int, map_res_x)
36KERNEL_STRUCT_MEMBER(background, int, map_res_y)
37/* Ray differential used for generating the importance map. */
38KERNEL_STRUCT_MEMBER(background, float, map_dD)
39/* Multiple importance sampling. */
40KERNEL_STRUCT_MEMBER(background, int, use_mis)
41/* Light-group. */
42KERNEL_STRUCT_MEMBER(background, int, lightgroup)
43/* Object Index. */
44KERNEL_STRUCT_MEMBER(background, int, object_index)
45/* Padding. */
46KERNEL_STRUCT_MEMBER(background, int, pad1)
47KERNEL_STRUCT_END(KernelBackground)
48
49/* BVH: own BVH2 if no native device acceleration struct used. */
50
51KERNEL_STRUCT_BEGIN(KernelBVH, bvh)
52KERNEL_STRUCT_MEMBER(bvh, int, root)
53KERNEL_STRUCT_MEMBER(bvh, int, have_motion)
54KERNEL_STRUCT_MEMBER(bvh, int, have_curves)
55KERNEL_STRUCT_MEMBER(bvh, int, have_points)
56KERNEL_STRUCT_MEMBER(bvh, int, have_volumes)
57KERNEL_STRUCT_MEMBER(bvh, int, bvh_layout)
58KERNEL_STRUCT_MEMBER(bvh, int, use_bvh_steps)
59KERNEL_STRUCT_MEMBER(bvh, int, curve_subdivisions)
60KERNEL_STRUCT_END(KernelBVH)
61
62/* Film. */
63
64KERNEL_STRUCT_BEGIN(KernelFilm, film)
65/* XYZ to rendering color space transform. float4 instead of float3 to
66 * ensure consistent padding/alignment across devices. */
67KERNEL_STRUCT_MEMBER(film, float4, xyz_to_r)
68KERNEL_STRUCT_MEMBER(film, float4, xyz_to_g)
69KERNEL_STRUCT_MEMBER(film, float4, xyz_to_b)
70KERNEL_STRUCT_MEMBER(film, float4, rgb_to_y)
71KERNEL_STRUCT_MEMBER(film, float4, white_xyz)
72/* Rec709 to rendering color space. */
73KERNEL_STRUCT_MEMBER(film, float4, rec709_to_r)
74KERNEL_STRUCT_MEMBER(film, float4, rec709_to_g)
75KERNEL_STRUCT_MEMBER(film, float4, rec709_to_b)
76KERNEL_STRUCT_MEMBER(film, int, is_rec709)
77/* Exposure. */
78KERNEL_STRUCT_MEMBER(film, float, exposure)
79/* Passed used. */
80KERNEL_STRUCT_MEMBER(film, int, pass_flag)
81KERNEL_STRUCT_MEMBER(film, int, denoising_pass_flag)
82KERNEL_STRUCT_MEMBER(film, int, light_pass_flag)
83/* Pass offsets. */
84KERNEL_STRUCT_MEMBER(film, int, pass_stride)
85KERNEL_STRUCT_MEMBER(film, int, pass_combined)
86KERNEL_STRUCT_MEMBER(film, int, pass_depth)
87KERNEL_STRUCT_MEMBER(film, int, pass_position)
88KERNEL_STRUCT_MEMBER(film, int, pass_normal)
89KERNEL_STRUCT_MEMBER(film, int, pass_roughness)
90KERNEL_STRUCT_MEMBER(film, int, pass_motion)
91KERNEL_STRUCT_MEMBER(film, int, pass_motion_weight)
92KERNEL_STRUCT_MEMBER(film, int, pass_uv)
93KERNEL_STRUCT_MEMBER(film, int, pass_object_id)
94KERNEL_STRUCT_MEMBER(film, int, pass_material_id)
95KERNEL_STRUCT_MEMBER(film, int, pass_diffuse_color)
96KERNEL_STRUCT_MEMBER(film, int, pass_glossy_color)
97KERNEL_STRUCT_MEMBER(film, int, pass_transmission_color)
98KERNEL_STRUCT_MEMBER(film, int, pass_diffuse_indirect)
99KERNEL_STRUCT_MEMBER(film, int, pass_glossy_indirect)
100KERNEL_STRUCT_MEMBER(film, int, pass_transmission_indirect)
101KERNEL_STRUCT_MEMBER(film, int, pass_volume_indirect)
102KERNEL_STRUCT_MEMBER(film, int, pass_diffuse_direct)
103KERNEL_STRUCT_MEMBER(film, int, pass_glossy_direct)
104KERNEL_STRUCT_MEMBER(film, int, pass_transmission_direct)
105KERNEL_STRUCT_MEMBER(film, int, pass_volume_direct)
106KERNEL_STRUCT_MEMBER(film, int, pass_volume_scatter)
107KERNEL_STRUCT_MEMBER(film, int, pass_volume_scatter_denoised)
108KERNEL_STRUCT_MEMBER(film, int, pass_volume_transmit)
109KERNEL_STRUCT_MEMBER(film, int, pass_volume_transmit_denoised)
110KERNEL_STRUCT_MEMBER(film, int, pass_volume_majorant)
111KERNEL_STRUCT_MEMBER(film, int, pass_volume_majorant_sample_count)
112KERNEL_STRUCT_MEMBER(film, int, pass_emission)
113KERNEL_STRUCT_MEMBER(film, int, pass_background)
114KERNEL_STRUCT_MEMBER(film, int, pass_ao)
115KERNEL_STRUCT_MEMBER(film, float, pass_alpha_threshold)
116KERNEL_STRUCT_MEMBER(film, int, pass_shadow_catcher)
117KERNEL_STRUCT_MEMBER(film, int, pass_shadow_catcher_sample_count)
118KERNEL_STRUCT_MEMBER(film, int, pass_shadow_catcher_matte)
119KERNEL_STRUCT_MEMBER(film, int, pass_render_time)
120/* Cryptomatte. */
121KERNEL_STRUCT_MEMBER(film, int, cryptomatte_passes)
122KERNEL_STRUCT_MEMBER(film, int, cryptomatte_depth)
123KERNEL_STRUCT_MEMBER(film, int, pass_cryptomatte)
124/* Adaptive sampling. */
125KERNEL_STRUCT_MEMBER(film, int, pass_adaptive_aux_buffer)
126KERNEL_STRUCT_MEMBER(film, int, pass_sample_count)
127/* Mist. */
128KERNEL_STRUCT_MEMBER(film, int, pass_mist)
129KERNEL_STRUCT_MEMBER(film, float, mist_start)
130KERNEL_STRUCT_MEMBER(film, float, mist_inv_depth)
131KERNEL_STRUCT_MEMBER(film, float, mist_falloff)
132/* Denoising. */
133KERNEL_STRUCT_MEMBER(film, int, pass_denoising_albedo)
134KERNEL_STRUCT_MEMBER(film, int, pass_denoising_specular_albedo)
135KERNEL_STRUCT_MEMBER(film, int, pass_denoising_normal)
136KERNEL_STRUCT_MEMBER(film, int, pass_denoising_roughness)
137KERNEL_STRUCT_MEMBER(film, int, pass_denoising_depth)
138KERNEL_STRUCT_MEMBER(film, int, pass_denoising_backward_motion)
139KERNEL_STRUCT_MEMBER(film, int, pass_denoising_specular_motion)
140KERNEL_STRUCT_MEMBER(film, int, denoising_pass_options_flag)
141/* AOVs. */
142KERNEL_STRUCT_MEMBER(film, int, pass_aov_color)
143KERNEL_STRUCT_MEMBER(film, int, pass_aov_value)
144/* Light groups. */
145KERNEL_STRUCT_MEMBER(film, int, pass_lightgroup)
146/* Baking. */
147KERNEL_STRUCT_MEMBER(film, int, pass_bake_primitive)
148KERNEL_STRUCT_MEMBER(film, int, pass_bake_seed)
149KERNEL_STRUCT_MEMBER(film, int, pass_bake_differential)
150/* Shadow catcher. */
151KERNEL_STRUCT_MEMBER(film, int, use_approximate_shadow_catcher)
152/* Path Guiding */
153KERNEL_STRUCT_MEMBER(film, int, pass_guiding_color)
154KERNEL_STRUCT_MEMBER(film, int, pass_guiding_probability)
155KERNEL_STRUCT_MEMBER(film, int, pass_guiding_avg_roughness)
156/* Padding. */
157KERNEL_STRUCT_MEMBER(film, int, pad1)
158KERNEL_STRUCT_END(KernelFilm)
159
160/* Integrator. */
161
162KERNEL_STRUCT_BEGIN(KernelIntegrator, integrator)
163/* Emission. */
164KERNEL_STRUCT_MEMBER(integrator, int, use_direct_light)
165KERNEL_STRUCT_MEMBER(integrator, int, use_light_mis)
166KERNEL_STRUCT_MEMBER(integrator, int, use_light_tree)
167KERNEL_STRUCT_MEMBER(integrator, int, num_lights)
168KERNEL_STRUCT_MEMBER(integrator, int, num_distant_lights)
169KERNEL_STRUCT_MEMBER(integrator, int, num_background_lights)
170/* Portal sampling. */
171KERNEL_STRUCT_MEMBER(integrator, int, num_portals)
172KERNEL_STRUCT_MEMBER(integrator, int, portal_offset)
173/* Flat light distribution. */
174KERNEL_STRUCT_MEMBER(integrator, int, num_distribution)
175KERNEL_STRUCT_MEMBER(integrator, float, distribution_pdf_triangles)
176KERNEL_STRUCT_MEMBER(integrator, float, distribution_pdf_lights)
177KERNEL_STRUCT_MEMBER(integrator, float, light_inv_rr_threshold)
178/* Bounces. */
179KERNEL_STRUCT_MEMBER(integrator, int, min_bounce)
180KERNEL_STRUCT_MEMBER(integrator, int, max_bounce)
181KERNEL_STRUCT_MEMBER(integrator, int, max_diffuse_bounce)
182KERNEL_STRUCT_MEMBER(integrator, int, max_glossy_bounce)
183KERNEL_STRUCT_MEMBER(integrator, int, max_transmission_bounce)
184KERNEL_STRUCT_MEMBER(integrator, int, max_volume_bounce)
185/* AO bounces. */
186KERNEL_STRUCT_MEMBER(integrator, int, ao_bounces)
187KERNEL_STRUCT_MEMBER(integrator, float, ao_bounces_distance)
188KERNEL_STRUCT_MEMBER(integrator, float, ao_bounces_factor)
189KERNEL_STRUCT_MEMBER(integrator, float, ao_additive_factor)
190/* Transparency. */
191KERNEL_STRUCT_MEMBER(integrator, int, transparent_min_bounce)
192KERNEL_STRUCT_MEMBER(integrator, int, transparent_max_bounce)
193KERNEL_STRUCT_MEMBER(integrator, int, transparent_shadows)
194/* Caustics. */
195KERNEL_STRUCT_MEMBER(integrator, int, caustics_reflective)
196KERNEL_STRUCT_MEMBER(integrator, int, caustics_refractive)
197KERNEL_STRUCT_MEMBER(integrator, float, filter_glossy)
198KERNEL_STRUCT_MEMBER(integrator, float, differential_widen_scale)
199/* Seed. */
201KERNEL_STRUCT_MEMBER(integrator, int, seed)
202/* Clamp. */
203KERNEL_STRUCT_MEMBER(integrator, float, sample_clamp_direct)
204KERNEL_STRUCT_MEMBER(integrator, float, sample_clamp_indirect)
205/* Caustics. */
206KERNEL_STRUCT_MEMBER(integrator, int, use_caustics)
207/* Sampling pattern. */
208KERNEL_STRUCT_MEMBER(integrator, int, sampling_pattern)
209KERNEL_STRUCT_MEMBER(integrator, float, scrambling_distance)
210/* Sobol pattern. */
212KERNEL_STRUCT_MEMBER(integrator, int, tabulated_sobol_sequence_size)
214KERNEL_STRUCT_MEMBER(integrator, int, sobol_index_mask)
216KERNEL_STRUCT_MEMBER(integrator, int, blue_noise_sequence_length)
217/* Volume render. */
218KERNEL_STRUCT_MEMBER(integrator, int, use_volumes)
219KERNEL_STRUCT_MEMBER(integrator, int, volume_ray_marching)
220KERNEL_STRUCT_MEMBER(integrator, int, volume_max_steps)
221/* Shadow catcher. */
222KERNEL_STRUCT_MEMBER(integrator, int, has_shadow_catcher)
223/* Closure filter. */
224KERNEL_STRUCT_MEMBER(integrator, int, filter_closures)
225/* MIS debugging. */
226KERNEL_STRUCT_MEMBER(integrator, int, direct_light_sampling_type)
227/* Path Guiding */
228KERNEL_STRUCT_MEMBER(integrator, float, surface_guiding_probability)
229KERNEL_STRUCT_MEMBER(integrator, float, volume_guiding_probability)
230KERNEL_STRUCT_MEMBER(integrator, int, guiding_distribution_type)
231KERNEL_STRUCT_MEMBER(integrator, int, guiding_directional_sampling_type)
232KERNEL_STRUCT_MEMBER(integrator, float, guiding_roughness_threshold)
233KERNEL_STRUCT_MEMBER(integrator, int, use_guiding)
234KERNEL_STRUCT_MEMBER(integrator, int, train_guiding)
235KERNEL_STRUCT_MEMBER(integrator, int, use_surface_guiding)
236KERNEL_STRUCT_MEMBER(integrator, int, use_volume_guiding)
237KERNEL_STRUCT_MEMBER(integrator, int, use_guiding_direct_light)
238KERNEL_STRUCT_MEMBER(integrator, int, use_guiding_mis_weights)
239KERNEL_STRUCT_MEMBER(integrator, int, pad1)
240
241KERNEL_STRUCT_MEMBER(integrator, float2, pixel_jitter)
242KERNEL_STRUCT_END(KernelIntegrator)
243
244/* Image. */
245
246KERNEL_STRUCT_BEGIN(KernelImage, image)
247KERNEL_STRUCT_MEMBER(image, float, mip_bias)
248
249/* Padding. */
250KERNEL_STRUCT_MEMBER(image, int, pad1)
251KERNEL_STRUCT_MEMBER(image, int, pad2)
252KERNEL_STRUCT_MEMBER(image, int, pad3)
253KERNEL_STRUCT_END(KernelImage)
254
255/* SVM. For shader specialization. */
256
257KERNEL_STRUCT_BEGIN(KernelSVMUsage, svm_usage)
258#define SHADER_NODE_TYPE(type) KERNEL_STRUCT_MEMBER(svm_usage, int, type)
259#define SHADER_NODE_TYPE_DERIVATIVE(type) \
260 SHADER_NODE_TYPE(type) \
261 SHADER_NODE_TYPE(type##_DERIVATIVE)
263KERNEL_STRUCT_END(KernelSVMUsage)
264
265#undef KERNEL_STRUCT_BEGIN
266#undef KERNEL_STRUCT_MEMBER
267#undef KERNEL_STRUCT_MEMBER_DONT_SPECIALIZE
268#undef KERNEL_STRUCT_END
#define KERNEL_STRUCT_MEMBER_DONT_SPECIALIZE
#define image(slot, qualifiers, format)
#define KERNEL_STRUCT_END(name)
#define KERNEL_STRUCT_BEGIN(name)
#define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature)