Blender V4.3
eevee_deferred_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#define image_out(slot, format, name) \
9 image(slot, format, Qualifier::WRITE, ImageType::FLOAT_2D, name, Frequency::PASS)
10#define uimage_out(slot, format, name) \
11 image(slot, format, Qualifier::WRITE, ImageType::UINT_2D, name, Frequency::PASS)
12#define image_in(slot, format, name) \
13 image(slot, format, Qualifier::READ, ImageType::FLOAT_2D, name, Frequency::PASS)
14#define image_array_out(slot, qualifier, format, name) \
15 image(slot, format, qualifier, ImageType::FLOAT_2D_ARRAY, name, Frequency::PASS)
16
17/* -------------------------------------------------------------------- */
21GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend)
22 .do_static_compilation(true)
23 .define("GBUFFER_LOAD")
24 .sampler(0, ImageType::UINT_2D, "gbuf_header_tx")
25 .image(0, GPU_RG16, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_img")
26 /* Early fragment test is needed to discard fragment that do not need this processing. */
27 .early_fragment_test(true)
28 .fragment_source("eevee_deferred_thickness_amend_frag.glsl")
29 .additional_info("draw_view",
30 "draw_fullscreen",
31 "eevee_sampling_data",
32 "eevee_shared",
33 "eevee_light_data",
34 "eevee_shadow_data",
35 "eevee_hiz_data");
36
40 .define("GBUFFER_LOAD")
41 .sampler(12, ImageType::UINT_2D, "gbuf_header_tx")
42 .sampler(13, ImageType::FLOAT_2D_ARRAY, "gbuf_closure_tx")
43 .sampler(14, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_tx");
44
45GPU_SHADER_CREATE_INFO(eevee_deferred_tile_classify)
46 .fragment_source("eevee_deferred_tile_classify_frag.glsl")
47 .additional_info("eevee_shared", "draw_fullscreen")
48 .subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID)
49 .typedef_source("draw_shader_shared.hh")
50 .push_constant(Type::INT, "current_bit")
51 .do_static_compilation(true);
52
53GPU_SHADER_CREATE_INFO(eevee_deferred_light)
54 .fragment_source("eevee_deferred_light_frag.glsl")
55 /* Early fragment test is needed to avoid processing background fragments. */
56 .early_fragment_test(true)
57 .fragment_out(0, Type::VEC4, "out_combined")
58 /* Chaining to next pass. */
59 .uimage_out(2, DEFERRED_RADIANCE_FORMAT, "direct_radiance_1_img")
60 .uimage_out(3, DEFERRED_RADIANCE_FORMAT, "direct_radiance_2_img")
61 .uimage_out(4, DEFERRED_RADIANCE_FORMAT, "direct_radiance_3_img")
62 /* Optimized out if use_split_indirect is false. */
63 .image_out(5, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_1_img")
64 .image_out(6, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_2_img")
65 .image_out(7, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_3_img")
66 .specialization_constant(Type::BOOL, "use_split_indirect", false)
67 .specialization_constant(Type::BOOL, "use_lightprobe_eval", false)
68 .specialization_constant(Type::BOOL, "use_transmission", false)
69 .specialization_constant(Type::INT, "render_pass_shadow_id", -1)
70 .define("SPECIALIZED_SHADOW_PARAMS")
71 .specialization_constant(Type::INT, "shadow_ray_count", 1)
72 .specialization_constant(Type::INT, "shadow_ray_step_count", 6)
73 .additional_info("eevee_shared",
74 "eevee_gbuffer_data",
75 "eevee_utility_texture",
76 "eevee_sampling_data",
77 "eevee_light_data",
78 "eevee_shadow_data",
79 "eevee_hiz_data",
80 "eevee_lightprobe_data",
81 "eevee_render_pass_out",
82 "draw_fullscreen",
83 "draw_view");
84
85GPU_SHADER_CREATE_INFO(eevee_deferred_light_single)
86 .additional_info("eevee_deferred_light")
87 .define("LIGHT_CLOSURE_EVAL_COUNT", "1")
88 .do_static_compilation(true);
89
90GPU_SHADER_CREATE_INFO(eevee_deferred_light_double)
91 .additional_info("eevee_deferred_light")
92 .define("LIGHT_CLOSURE_EVAL_COUNT", "2")
93 .do_static_compilation(true);
94
95GPU_SHADER_CREATE_INFO(eevee_deferred_light_triple)
96 .additional_info("eevee_deferred_light")
97 .define("LIGHT_CLOSURE_EVAL_COUNT", "3")
98 .do_static_compilation(true);
99
100GPU_SHADER_CREATE_INFO(eevee_deferred_combine)
101 /* Early fragment test is needed to avoid processing fragments background fragments. */
102 .early_fragment_test(true)
103 /* Inputs. */
104 .sampler(2, ImageType::UINT_2D, "direct_radiance_1_tx")
105 .sampler(3, ImageType::UINT_2D, "direct_radiance_2_tx")
106 .sampler(4, ImageType::UINT_2D, "direct_radiance_3_tx")
107 .sampler(5, ImageType::FLOAT_2D, "indirect_radiance_1_tx")
108 .sampler(6, ImageType::FLOAT_2D, "indirect_radiance_2_tx")
109 .sampler(7, ImageType::FLOAT_2D, "indirect_radiance_3_tx")
110 .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "radiance_feedback_img")
111 .fragment_out(0, Type::VEC4, "out_combined")
112 .additional_info("eevee_shared",
113 "eevee_gbuffer_data",
114 "eevee_render_pass_out",
115 "draw_fullscreen")
116 .fragment_source("eevee_deferred_combine_frag.glsl")
117 /* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is
118 * present will we instead dynamically look-up ID from the uniform buffer. */
119 .specialization_constant(Type::BOOL, "render_pass_diffuse_light_enabled", true)
120 .specialization_constant(Type::BOOL, "render_pass_specular_light_enabled", true)
121 .specialization_constant(Type::BOOL, "render_pass_normal_enabled", true)
122 .specialization_constant(Type::BOOL, "use_radiance_feedback", false)
123 .specialization_constant(Type::BOOL, "use_split_radiance", false)
124 .do_static_compilation(true);
125
126GPU_SHADER_CREATE_INFO(eevee_deferred_capture_eval)
127 /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */
128 .early_fragment_test(true)
129 /* Inputs. */
130 .fragment_out(0, Type::VEC4, "out_radiance")
131 .define("LIGHT_CLOSURE_EVAL_COUNT", "1")
132 .additional_info("eevee_shared",
133 "eevee_gbuffer_data",
134 "eevee_utility_texture",
135 "eevee_sampling_data",
136 "eevee_light_data",
137 "eevee_shadow_data",
138 "eevee_hiz_data",
139 "eevee_volume_probe_data",
140 "draw_view",
141 "draw_fullscreen")
142 .fragment_source("eevee_deferred_capture_frag.glsl")
143 .do_static_compilation(true);
144
145GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval)
146 /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */
147 .early_fragment_test(true)
148 /* Inputs. */
149 .fragment_out(0, Type::VEC4, "out_radiance")
150 .define("SPHERE_PROBE")
151 .define("LIGHT_CLOSURE_EVAL_COUNT", "1")
152 .additional_info("eevee_shared",
153 "eevee_gbuffer_data",
154 "eevee_utility_texture",
155 "eevee_sampling_data",
156 "eevee_light_data",
157 "eevee_lightprobe_data",
158 "eevee_shadow_data",
159 "eevee_hiz_data",
160 "draw_view",
161 "draw_fullscreen")
162 .fragment_source("eevee_deferred_planar_frag.glsl")
163 .do_static_compilation(true);
164
165#undef image_array_out
166#undef image_out
167#undef image_in
168
169/* -------------------------------------------------------------------- */
173GPU_SHADER_CREATE_INFO(eevee_debug_gbuffer)
174 .do_static_compilation(true)
175 .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0)
176 .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1)
177 .push_constant(Type::INT, "debug_mode")
178 .fragment_source("eevee_debug_gbuffer_frag.glsl")
179 .additional_info("draw_view", "draw_fullscreen", "eevee_shared", "eevee_gbuffer_data");
180
draw_fullscreen subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID) .typedef_source("draw_shader_shared.hh") .push_constant(Type out_combined DEFERRED_RADIANCE_FORMAT
direct_radiance_1_tx direct_radiance_3_tx indirect_radiance_2_tx GPU_RGBA16F
draw_fullscreen subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID) .typedef_source("draw_shader_shared.hh") .push_constant(Type out_combined direct_radiance_2_img RAYTRACE_RADIANCE_FORMAT
direct_radiance_1_tx direct_radiance_3_tx indirect_radiance_2_tx radiance_feedback_img eevee_gbuffer_data
#define DEFERRED_GBUFFER_ROG_ID
out_radiance out_gbuf_normal out_gbuf_closure2 GPU_RG16
#define GPU_SHADER_CREATE_INFO(_info)