Blender V4.3
eevee_lightprobe_volume_info.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "eevee_defines.hh"
7
8/* -------------------------------------------------------------------- */
12GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface, "")
13 .smooth(Type::VEC3, "P")
14 .flat(Type::INT, "surfel_index");
15
16GPU_SHADER_CREATE_INFO(eevee_debug_surfels)
17 .additional_info("eevee_shared", "draw_view")
18 .vertex_source("eevee_debug_surfels_vert.glsl")
19 .vertex_out(eevee_debug_surfel_iface)
20 .fragment_source("eevee_debug_surfels_frag.glsl")
21 .fragment_out(0, Type::VEC4, "out_color")
22 .storage_buf(0, Qualifier::READ, "Surfel", "surfels_buf[]")
23 .push_constant(Type::FLOAT, "debug_surfel_radius")
24 .push_constant(Type::INT, "debug_mode")
25 .do_static_compilation(true);
26
27GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface, "")
28 .smooth(Type::VEC4, "interp_color");
29
30GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid)
31 .additional_info("eevee_shared", "draw_view")
32 .fragment_out(0, Type::VEC4, "out_color")
33 .vertex_out(eevee_debug_irradiance_grid_iface)
34 .sampler(0, ImageType::FLOAT_3D, "debug_data_tx")
35 .push_constant(Type::MAT4, "grid_mat")
36 .push_constant(Type::INT, "debug_mode")
37 .push_constant(Type::FLOAT, "debug_value")
38 .vertex_source("eevee_debug_irradiance_grid_vert.glsl")
39 .fragment_source("eevee_debug_irradiance_grid_frag.glsl")
40 .do_static_compilation(true);
41
42GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface, "")
43 .smooth(Type::VEC2, "lP")
44 .flat(Type::IVEC3, "cell");
45
46GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume)
47 .additional_info("eevee_shared", "draw_view")
48 .vertex_source("eevee_display_lightprobe_volume_vert.glsl")
49 .vertex_out(eevee_display_lightprobe_volume_iface)
50 .fragment_source("eevee_display_lightprobe_volume_frag.glsl")
51 .fragment_out(0, Type::VEC4, "out_color")
52 .push_constant(Type::FLOAT, "sphere_radius")
53 .push_constant(Type::IVEC3, "grid_resolution")
54 .push_constant(Type::MAT4, "grid_to_world")
55 .push_constant(Type::MAT4, "world_to_grid")
56 .push_constant(Type::BOOL, "display_validity")
57 .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx")
58 .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx")
59 .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx")
60 .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx")
61 .sampler(4, ImageType::FLOAT_3D, "validity_tx")
62 .do_static_compilation(true);
63
66/* -------------------------------------------------------------------- */
71 .storage_buf(SURFEL_BUF_SLOT, Qualifier::READ_WRITE, "Surfel", "surfel_buf[]")
72 .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ, "CaptureInfoData", "capture_info_buf");
73
74GPU_SHADER_CREATE_INFO(eevee_surfel_light)
75 .define("LIGHT_ITER_FORCE_NO_CULLING")
76 .define("LIGHT_CLOSURE_EVAL_COUNT", "1")
77 .local_group_size(SURFEL_GROUP_SIZE)
78 .additional_info("eevee_shared",
79 "draw_view",
80 "eevee_global_ubo",
81 "eevee_utility_texture",
82 "eevee_surfel_common",
83 "eevee_light_data",
84 "eevee_shadow_data")
85 .compute_source("eevee_surfel_light_comp.glsl")
86 .do_static_compilation(true);
87
88GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build)
89 .local_group_size(SURFEL_GROUP_SIZE)
90 .builtins(BuiltinBits::TEXTURE_ATOMIC)
91 .additional_info("eevee_shared", "eevee_surfel_common", "draw_view")
92 .image(0, GPU_R32I, Qualifier::READ_WRITE, ImageType::INT_3D_ATOMIC, "cluster_list_img")
93 .compute_source("eevee_surfel_cluster_build_comp.glsl")
94 .do_static_compilation(true);
95
96GPU_SHADER_CREATE_INFO(eevee_surfel_list_build)
97 .local_group_size(SURFEL_GROUP_SIZE)
98 .builtins(BuiltinBits::TEXTURE_ATOMIC)
99 .additional_info("eevee_shared", "eevee_surfel_common", "draw_view")
100 .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]")
101 .storage_buf(6, Qualifier::READ_WRITE, "SurfelListInfoData", "list_info_buf")
102 .compute_source("eevee_surfel_list_build_comp.glsl")
103 .do_static_compilation(true);
104
105GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort)
106 .local_group_size(SURFEL_LIST_GROUP_SIZE)
107 .additional_info("eevee_shared", "eevee_surfel_common", "draw_view")
108 .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]")
109 .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf")
110 .compute_source("eevee_surfel_list_sort_comp.glsl")
111 .do_static_compilation(true);
112
113GPU_SHADER_CREATE_INFO(eevee_surfel_ray)
114 .local_group_size(SURFEL_GROUP_SIZE)
115 .additional_info("eevee_shared",
116 "eevee_surfel_common",
117 "eevee_lightprobe_sphere_data",
118 "draw_view")
119 .push_constant(Type::INT, "radiance_src")
120 .push_constant(Type::INT, "radiance_dst")
121 .compute_source("eevee_surfel_ray_comp.glsl")
122 .do_static_compilation(true);
123
124GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_bounds)
125 .do_static_compilation(true)
126 .local_group_size(IRRADIANCE_BOUNDS_GROUP_SIZE)
127 .storage_buf(0, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf")
128 .storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
129 .push_constant(Type::INT, "resource_len")
130 .typedef_source("draw_shader_shared.hh")
131 .additional_info("eevee_shared")
132 .compute_source("eevee_lightprobe_volume_bounds_comp.glsl");
133
134GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_ray)
135 .local_group_size(IRRADIANCE_GRID_GROUP_SIZE,
138 .additional_info("eevee_shared",
139 "eevee_surfel_common",
140 "eevee_lightprobe_sphere_data",
141 "draw_view")
142 .push_constant(Type::INT, "radiance_src")
143 .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]")
144 .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf")
145 .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L0_img")
146 .image(1, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_a_img")
147 .image(2, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_b_img")
148 .image(3, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_c_img")
149 .image(4, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_3D, "virtual_offset_img")
150 .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "validity_img")
151 .compute_source("eevee_lightprobe_volume_ray_comp.glsl")
152 .do_static_compilation(true);
153
154GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset)
155 .local_group_size(IRRADIANCE_GRID_GROUP_SIZE,
158 .additional_info("eevee_shared", "eevee_surfel_common", "draw_view")
159 .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]")
160 .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf")
161 .image(0, GPU_R32I, Qualifier::READ, ImageType::INT_3D_ATOMIC, "cluster_list_img")
162 .image(1, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "virtual_offset_img")
163 .compute_source("eevee_lightprobe_volume_offset_comp.glsl")
164 .do_static_compilation(true);
165
168/* -------------------------------------------------------------------- */
172GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_world)
173 .local_group_size(IRRADIANCE_GRID_BRICK_SIZE,
176 .define("IRRADIANCE_GRID_UPLOAD")
177 .additional_info("eevee_shared", "eevee_global_ubo")
178 .push_constant(Type::INT, "grid_index")
179 .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]")
180 .storage_buf(1, Qualifier::READ, "SphereProbeHarmonic", "harmonic_buf")
181 .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]")
182 .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img")
183 .compute_source("eevee_lightprobe_volume_world_comp.glsl")
184 .do_static_compilation(true);
185
186GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_load)
187 .local_group_size(IRRADIANCE_GRID_BRICK_SIZE,
190 .define("IRRADIANCE_GRID_UPLOAD")
191 .additional_info("eevee_shared", "eevee_global_ubo")
192 .push_constant(Type::MAT4, "grid_local_to_world")
193 .push_constant(Type::INT, "grid_index")
194 .push_constant(Type::INT, "grid_start_index")
195 .push_constant(Type::FLOAT, "validity_threshold")
196 .push_constant(Type::FLOAT, "dilation_threshold")
197 .push_constant(Type::FLOAT, "dilation_radius")
198 .push_constant(Type::FLOAT, "grid_intensity_factor")
199 .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]")
200 .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]")
201 .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx")
202 .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx")
203 .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx")
204 .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx")
205 .sampler(4, ImageType::FLOAT_3D, "visibility_a_tx")
206 .sampler(5, ImageType::FLOAT_3D, "visibility_b_tx")
207 .sampler(6, ImageType::FLOAT_3D, "visibility_c_tx")
208 .sampler(7, ImageType::FLOAT_3D, "visibility_d_tx")
209 .sampler(8, ImageType::FLOAT_3D, "irradiance_atlas_tx")
210 .sampler(9, ImageType::FLOAT_3D, "validity_tx")
211 .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img")
212 .compute_source("eevee_lightprobe_volume_load_comp.glsl")
213 .do_static_compilation(true);
214
217 "VolumeProbeData",
218 "grids_infos_buf[IRRADIANCE_GRID_MAX]")
219 /* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type.
220 */
221 .storage_buf(IRRADIANCE_BRICK_BUF_SLOT, Qualifier::READ, "uint", "bricks_infos_buf[]")
222 .sampler(VOLUME_PROBE_TEX_SLOT, ImageType::FLOAT_3D, "irradiance_atlas_tx")
223 .define("IRRADIANCE_GRID_SAMPLING");
224
226 .additional_info("eevee_lightprobe_sphere_data", "eevee_volume_probe_data");
227
229 .define("SPHERE_PROBE")
230 .uniform_buf(PLANAR_PROBE_BUF_SLOT, "PlanarProbeData", "probe_planar_buf[PLANAR_PROBE_MAX]")
231 .sampler(PLANAR_PROBE_RADIANCE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "planar_radiance_tx")
232 .sampler(PLANAR_PROBE_DEPTH_TEX_SLOT, ImageType::DEPTH_2D_ARRAY, "planar_depth_tx");
233
@ GPU_R32I
direct_radiance_1_tx direct_radiance_3_tx indirect_radiance_2_tx radiance_feedback_img draw_fullscreen fragment_source("eevee_deferred_combine_frag.glsl") .specialization_constant(Type out_radiance eevee_volume_probe_data
#define SURFEL_GROUP_SIZE
#define IRRADIANCE_BOUNDS_GROUP_SIZE
#define CAPTURE_BUF_SLOT
#define SURFEL_LIST_GROUP_SIZE
#define IRRADIANCE_GRID_BUF_SLOT
#define IRRADIANCE_GRID_BRICK_SIZE
#define IRRADIANCE_GRID_GROUP_SIZE
#define PLANAR_PROBE_DEPTH_TEX_SLOT
#define PLANAR_PROBE_RADIANCE_TEX_SLOT
#define VOLUME_PROBE_TEX_SLOT
#define IRRADIANCE_BRICK_BUF_SLOT
#define PLANAR_PROBE_BUF_SLOT
#define VOLUME_PROBE_FORMAT
#define SURFEL_BUF_SLOT
flat(Type::VEC3, "probe_normal") .flat(Type eevee_lightprobe_planar_data
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view list_start_buf[] GPU_RGBA32F
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view list_start_buf[] irradiance_L0_img irradiance_L1_b_img GPU_RGBA16F
eevee_lightprobe_data
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)