Blender V4.3
eevee_tracing_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/* -------------------------------------------------------------------- */
12#define image_out(slot, format, type, name) \
13 image(slot, format, Qualifier::WRITE, type, name, Frequency::PASS)
14#define image_in(slot, format, type, name) \
15 image(slot, format, Qualifier::READ, type, name, Frequency::PASS)
16
17GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify)
18 .do_static_compilation(true)
20 .additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo")
21 .typedef_source("draw_shader_shared.hh")
22 .image_out(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img")
23 .image_out(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img")
24 .image_out(2, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_denoise_img")
25 .image_out(3, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_tracing_img")
26 .compute_source("eevee_ray_tile_classify_comp.glsl");
27
28GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact)
29 .do_static_compilation(true)
31 .additional_info("eevee_shared", "eevee_global_ubo")
32 .typedef_source("draw_shader_shared.hh")
33 .image_in(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img")
34 .image_in(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img")
35 .storage_buf(0, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_tracing_dispatch_buf")
36 .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_denoise_dispatch_buf")
37 .storage_buf(4, Qualifier::WRITE, "uint", "raytrace_tracing_tiles_buf[]")
38 .storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]")
39 .specialization_constant(Type::INT, "closure_index", 0)
40 .specialization_constant(Type::INT, "resolution_scale", 2)
41 .compute_source("eevee_ray_tile_compact_comp.glsl");
42
43GPU_SHADER_CREATE_INFO(eevee_ray_generate)
44 .do_static_compilation(true)
46 .additional_info("eevee_shared",
47 "eevee_gbuffer_data",
48 "eevee_global_ubo",
49 "eevee_sampling_data",
50 "draw_view",
51 "eevee_utility_texture")
52 .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ray_data_img")
53 .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
54 .specialization_constant(Type::INT, "closure_index", 0)
55 .compute_source("eevee_ray_generate_comp.glsl");
56
57GPU_SHADER_CREATE_INFO(eevee_ray_trace_fallback)
58 .do_static_compilation(true)
60 .additional_info("eevee_shared",
61 "eevee_gbuffer_data",
62 "eevee_global_ubo",
63 "draw_view",
64 "eevee_sampling_data",
65 "eevee_lightprobe_data")
66 .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img")
67 .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img")
68 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img")
69 .sampler(1, ImageType::DEPTH_2D, "depth_tx")
70 .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]")
71 .specialization_constant(Type::INT, "closure_index", 0)
72 .compute_source("eevee_ray_trace_fallback_comp.glsl");
73
74GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar)
75 .do_static_compilation(true)
77 .define("PLANAR_PROBES")
78 .additional_info("eevee_shared",
79 "eevee_global_ubo",
80 "eevee_sampling_data",
81 "eevee_gbuffer_data",
82 "draw_view",
83 "eevee_lightprobe_data",
84 "eevee_lightprobe_planar_data")
85 .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "ray_data_img")
86 .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img")
87 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img")
88 .sampler(2, ImageType::DEPTH_2D, "depth_tx")
89 .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]")
90 .specialization_constant(Type::INT, "closure_index", 0)
91 .compute_source("eevee_ray_trace_planar_comp.glsl");
92
93GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen)
94 .do_static_compilation(true)
96 .additional_info("eevee_shared",
97 "eevee_global_ubo",
98 "eevee_sampling_data",
99 "eevee_gbuffer_data",
100 "draw_view",
101 "eevee_hiz_data",
102 "eevee_lightprobe_data")
103 .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img")
104 .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img")
105 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img")
106 .sampler(0, ImageType::DEPTH_2D, "depth_tx")
107 .sampler(1, ImageType::FLOAT_2D, "radiance_front_tx")
108 .sampler(2, ImageType::FLOAT_2D, "radiance_back_tx")
109 .sampler(4, ImageType::FLOAT_2D, "hiz_front_tx")
110 .sampler(5, ImageType::FLOAT_2D, "hiz_back_tx")
111 .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]")
112 .compute_source("eevee_ray_trace_screen_comp.glsl")
113 /* Metal: Provide compiler with hint to tune per-thread resource allocation. */
114 .mtl_max_total_threads_per_threadgroup(400)
115 .specialization_constant(Type::BOOL, "trace_refraction", true)
116 .specialization_constant(Type::INT, "closure_index", 0)
117 .compute_source("eevee_ray_trace_screen_comp.glsl");
118
119GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial)
120 .do_static_compilation(true)
121 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
122 .additional_info("eevee_shared",
123 "eevee_gbuffer_data",
124 "eevee_global_ubo",
125 "eevee_sampling_data",
126 "draw_view",
127 "eevee_utility_texture")
128 .sampler(3, ImageType::DEPTH_2D, "depth_tx")
129 .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img")
130 .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_time_img")
131 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_radiance_img")
132 .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
133 .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img")
134 .image(5, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_hit_depth_img")
135 .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img")
136 .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
137 /* Metal: Provide compiler with hint to tune per-thread resource allocation. */
138 .mtl_max_total_threads_per_threadgroup(316)
139 .specialization_constant(Type::INT, "raytrace_resolution_scale", 2)
140 .specialization_constant(Type::BOOL, "skip_denoise", false)
141 .specialization_constant(Type::INT, "closure_index", 0)
142 .compute_source("eevee_ray_denoise_spatial_comp.glsl");
143
144GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal)
145 .do_static_compilation(true)
146 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
147 .additional_info("eevee_shared", "eevee_global_ubo", "draw_view")
148 .sampler(0, ImageType::FLOAT_2D, "radiance_history_tx")
149 .sampler(1, ImageType::FLOAT_2D, "variance_history_tx")
150 .sampler(2, ImageType::UINT_2D_ARRAY, "tilemask_history_tx")
151 .sampler(3, ImageType::DEPTH_2D, "depth_tx")
152 .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "hit_depth_img")
153 .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img")
154 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
155 .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img")
156 .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img")
157 .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
158 .compute_source("eevee_ray_denoise_temporal_comp.glsl")
159 /* Metal: Provide compiler with hint to tune per-thread resource allocation. */
160 .mtl_max_total_threads_per_threadgroup(512)
161 .specialization_constant(Type::INT, "closure_index", 0)
162 .compute_source("eevee_ray_denoise_temporal_comp.glsl");
163
164GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral)
165 .do_static_compilation(true)
166 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
167 .additional_info("eevee_shared",
168 "eevee_gbuffer_data",
169 "eevee_global_ubo",
170 "eevee_sampling_data",
171 "draw_view")
172 .sampler(1, ImageType::DEPTH_2D, "depth_tx")
173 .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img")
174 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
175 .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img")
176 .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img")
177 .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
178 .specialization_constant(Type::INT, "closure_index", 0)
179 .compute_source("eevee_ray_denoise_bilateral_comp.glsl");
180
181GPU_SHADER_CREATE_INFO(eevee_horizon_setup)
182 .do_static_compilation(true)
183 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
184 .additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "draw_view")
185 .sampler(0, ImageType::DEPTH_2D, "depth_tx")
186 .sampler(1, ImageType::FLOAT_2D, "in_radiance_tx")
187 .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
188 .image(3, GPU_RGB10_A2, Qualifier::WRITE, ImageType::FLOAT_2D, "out_normal_img")
189 .compute_source("eevee_horizon_setup_comp.glsl");
190
191GPU_SHADER_CREATE_INFO(eevee_horizon_scan)
192 .do_static_compilation(true)
193 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
194 .additional_info("eevee_shared",
195 "eevee_gbuffer_data",
196 "eevee_global_ubo",
197 "eevee_sampling_data",
198 "eevee_utility_texture",
199 "eevee_hiz_data",
200 "draw_view")
201 .specialization_constant(Type::INT, "fast_gi_slice_count", 2)
202 .specialization_constant(Type::INT, "fast_gi_step_count", 8)
203 .specialization_constant(Type::BOOL, "fast_gi_ao_only", false)
204 .sampler(0, ImageType::FLOAT_2D, "screen_radiance_tx")
205 .sampler(1, ImageType::FLOAT_2D, "screen_normal_tx")
206 .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_0_img")
207 .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_1_img")
208 .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_2_img")
209 .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_3_img")
210 .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]")
211 /* Metal: Provide compiler with hint to tune per-thread resource allocation. */
212 .mtl_max_total_threads_per_threadgroup(400)
213 .compute_source("eevee_horizon_scan_comp.glsl");
214
215GPU_SHADER_CREATE_INFO(eevee_horizon_denoise)
216 .do_static_compilation(true)
217 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
218 .additional_info(
219 "eevee_shared", "eevee_global_ubo", "eevee_sampling_data", "eevee_hiz_data", "draw_view")
220 .sampler(2, ImageType::FLOAT_2D, "in_sh_0_tx")
221 .sampler(4, ImageType::FLOAT_2D, "in_sh_1_tx")
222 .sampler(5, ImageType::FLOAT_2D, "in_sh_2_tx")
223 .sampler(6, ImageType::FLOAT_2D, "in_sh_3_tx")
224 .sampler(7, ImageType::FLOAT_2D, "screen_normal_tx")
225 .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_0_img")
226 .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_1_img")
227 .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_2_img")
228 .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_3_img")
229 .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]")
230 .compute_source("eevee_horizon_denoise_comp.glsl");
231
232GPU_SHADER_CREATE_INFO(eevee_horizon_resolve)
233 .do_static_compilation(true)
234 .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
235 .additional_info("eevee_shared",
236 "eevee_gbuffer_data",
237 "eevee_global_ubo",
238 "eevee_sampling_data",
239 "eevee_lightprobe_data",
240 "draw_view")
241 .sampler(1, ImageType::DEPTH_2D, "depth_tx")
242 .sampler(2, ImageType::FLOAT_2D, "horizon_radiance_0_tx")
243 .sampler(3, ImageType::FLOAT_2D, "horizon_radiance_1_tx")
244 .sampler(4, ImageType::FLOAT_2D, "horizon_radiance_2_tx")
245 .sampler(5, ImageType::FLOAT_2D, "horizon_radiance_3_tx")
246 .sampler(8, ImageType::FLOAT_2D, "screen_normal_tx")
247 .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure0_img")
248 .image(4, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure1_img")
249 .image(5, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure2_img")
250 .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]")
251 /* Metal: Provide compiler with hint to tune per-thread resource allocation. */
252 .mtl_max_total_threads_per_threadgroup(400)
253 .compute_source("eevee_horizon_resolve_comp.glsl");
254
255#undef image_out
256#undef image_in
257
@ GPU_RGB10_A2
#define RAYTRACE_GROUP_SIZE
RAYTRACE_GROUP_SIZE eevee_lightprobe_planar_data ray_time_img depth_tx storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") .specialization_constant(Type RAYTRACE_GROUP_SIZE ray_data_img ray_radiance_img radiance_front_tx hiz_front_tx tiles_coord_buf[] compute_source("eevee_ray_trace_screen_comp.glsl") .mtl_max_total_threads_per_threadgroup(400) .specialization_constant(Type RAYTRACE_GROUP_SIZE depth_tx ray_time_img out_radiance_img GPU_R32F
RAYTRACE_GROUP_SIZE eevee_lightprobe_planar_data RAYTRACE_RAYTIME_FORMAT
RAYTRACE_GROUP_SIZE eevee_lightprobe_planar_data ray_time_img depth_tx storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") .specialization_constant(Type RAYTRACE_GROUP_SIZE ray_data_img ray_radiance_img radiance_front_tx hiz_front_tx tiles_coord_buf[] compute_source("eevee_ray_trace_screen_comp.glsl") .mtl_max_total_threads_per_threadgroup(400) .specialization_constant(Type RAYTRACE_GROUP_SIZE depth_tx ray_time_img out_radiance_img out_hit_depth_img tiles_coord_buf[] mtl_max_total_threads_per_threadgroup(316) .specialization_constant(Type RAYTRACE_GROUP_SIZE radiance_history_tx tilemask_history_tx hit_depth_img out_radiance_img RAYTRACE_VARIANCE_FORMAT
RAYTRACE_GROUP_SIZE tile_raytrace_denoise_img raytrace_tracing_dispatch_buf raytrace_tracing_tiles_buf[] storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]") .specialization_constant(Type RAYTRACE_GROUP_SIZE GPU_RGBA16F
RAYTRACE_GROUP_SIZE tile_raytrace_denoise_img raytrace_tracing_dispatch_buf raytrace_tracing_tiles_buf[] storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]") .specialization_constant(Type RAYTRACE_GROUP_SIZE out_ray_data_img storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") .specialization_constant(Type RAYTRACE_GROUP_SIZE ray_data_img RAYTRACE_RADIANCE_FORMAT
RAYTRACE_GROUP_SIZE additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "eevee_sampling_data", "eevee_utility_texture", "eevee_hiz_data", "draw_view") .specialization_constant(Type RAYTRACE_GROUP_SIZE in_sh_0_tx in_sh_2_tx screen_normal_tx GPU_RGBA8
RAYTRACE_GROUP_SIZE RAYTRACE_TILEMASK_FORMAT
#define GPU_SHADER_CREATE_INFO(_info)