Blender  V3.3
overlay_extra_info.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
4 
5 /* -------------------------------------------------------------------- */
9 GPU_SHADER_INTERFACE_INFO(overlay_extra_iface, "")
10  .no_perspective(Type::VEC2, "edgePos")
11  .flat(Type::VEC2, "edgeStart")
12  .flat(Type::VEC4, "finalColor");
13 
14 GPU_SHADER_CREATE_INFO(overlay_extra)
15  .do_static_compilation(true)
16  .vertex_in(0, Type::VEC3, "pos")
17  .vertex_in(1, Type::INT, "vclass")
18  /* Instance attributes. */
19  .vertex_in(2, Type::VEC4, "color")
20  .vertex_in(3, Type::MAT4, "inst_obmat")
21  .vertex_out(overlay_extra_iface)
22  .fragment_out(0, Type::VEC4, "fragColor")
23  .fragment_out(1, Type::VEC4, "lineOutput")
24  .vertex_source("overlay_extra_vert.glsl")
25  .fragment_source("overlay_extra_frag.glsl")
26  .additional_info("draw_view", "draw_globals");
27 
28 GPU_SHADER_CREATE_INFO(overlay_extra_select)
29  .do_static_compilation(true)
30  .define("SELECT_EDGES")
31  .additional_info("overlay_extra");
32 
33 GPU_SHADER_CREATE_INFO(overlay_extra_clipped)
34  .do_static_compilation(true)
35  .additional_info("overlay_extra", "drw_clipped");
36 
37 GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped)
38  .do_static_compilation(true)
39  .additional_info("overlay_extra_select", "drw_clipped");
40 
43 /* -------------------------------------------------------------------- */
47 GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface, "").flat(Type::VEC4, "finalColor");
48 
49 GPU_SHADER_CREATE_INFO(overlay_extra_grid)
50  .do_static_compilation(true)
51  .sampler(0, ImageType::DEPTH_2D, "depthBuffer")
52  .push_constant(Type::MAT4, "gridModelMatrix")
53  .push_constant(Type::BOOL, "isTransform")
54  .vertex_out(overlay_extra_grid_iface)
55  .fragment_out(0, Type::VEC4, "fragColor")
56  .vertex_source("overlay_extra_lightprobe_grid_vert.glsl")
57  .fragment_source("overlay_point_varying_color_frag.glsl")
58  .additional_info("draw_view", "draw_globals");
59 
60 GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped)
61  .do_static_compilation(true)
62  .additional_info("overlay_extra_grid", "drw_clipped");
63 
66 /* -------------------------------------------------------------------- */
70 GPU_SHADER_CREATE_INFO(overlay_extra_groundline)
71  .do_static_compilation(true)
72  .vertex_in(0, Type::VEC3, "pos")
73  /* Instance attributes. */
74  .vertex_in(1, Type::VEC3, "inst_pos")
75  .vertex_out(overlay_extra_iface)
76  .fragment_out(0, Type::VEC4, "fragColor")
77  .fragment_out(1, Type::VEC4, "lineOutput")
78  .vertex_source("overlay_extra_groundline_vert.glsl")
79  .fragment_source("overlay_extra_frag.glsl")
80  .additional_info("draw_view", "draw_globals");
81 
82 GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped)
83  .do_static_compilation(true)
84  .additional_info("overlay_extra_groundline", "drw_clipped");
85 
88 /* -------------------------------------------------------------------- */
92 GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface, "")
93  .no_perspective(Type::VEC2, "stipple_coord")
94  .flat(Type::VEC2, "stipple_start")
95  .flat(Type::VEC4, "finalColor");
96 
97 GPU_SHADER_CREATE_INFO(overlay_extra_wire)
98  .do_static_compilation(true)
99  .vertex_in(0, Type::VEC3, "pos")
100  .vertex_in(1, Type::VEC4, "color")
101  /* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */
102  .vertex_in(2, Type::INT, "colorid")
103  .vertex_out(overlay_extra_wire_iface)
104  .fragment_out(0, Type::VEC4, "fragColor")
105  .fragment_out(1, Type::VEC4, "lineOutput")
106  .vertex_source("overlay_extra_wire_vert.glsl")
107  .fragment_source("overlay_extra_wire_frag.glsl")
108  .additional_info("draw_modelmat", "draw_globals");
109 
110 GPU_SHADER_CREATE_INFO(overlay_extra_wire_select)
111  .do_static_compilation(true)
112  .define("SELECT_EDGES")
113  .additional_info("overlay_extra_wire", "drw_clipped");
114 
115 GPU_SHADER_CREATE_INFO(overlay_extra_wire_object)
116  .do_static_compilation(true)
117  .define("OBJECT_WIRE")
118  .additional_info("overlay_extra_wire", "drw_clipped");
119 
120 GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped)
121  .do_static_compilation(true)
122  .additional_info("overlay_extra_wire_select", "drw_clipped");
123 
124 GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped)
125  .do_static_compilation(true)
126  .additional_info("overlay_extra_wire_object", "drw_clipped");
127 
128 GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped)
129  .do_static_compilation(true)
130  .additional_info("overlay_extra_wire", "drw_clipped");
131 
134 /* -------------------------------------------------------------------- */
138 GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface, "")
139  .flat(Type::VEC4, "radii")
140  .flat(Type::VEC4, "fillColor")
141  .flat(Type::VEC4, "outlineColor");
142 
143 GPU_SHADER_CREATE_INFO(overlay_extra_point)
144  .do_static_compilation(true)
145  /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */
146  .define("blender_srgb_to_framebuffer_space(a)", "a")
147  .vertex_in(0, Type::VEC3, "pos")
148  .push_constant(Type::VEC4, "color")
149  .vertex_out(overlay_extra_point_iface)
150  .fragment_out(0, Type::VEC4, "fragColor")
151  .vertex_source("overlay_extra_point_vert.glsl")
152  .fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl")
153  .additional_info("draw_modelmat", "draw_globals");
154 
155 GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped)
156  .do_static_compilation(true)
157  .additional_info("overlay_extra_point", "drw_clipped");
158 
159 GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface, "").smooth(Type::VEC4, "finalColor");
160 
161 GPU_SHADER_CREATE_INFO(overlay_extra_loose_point)
162  .do_static_compilation(true)
163  .vertex_in(0, Type::VEC3, "pos")
164  .push_constant(Type::VEC4, "color")
165  .vertex_out(overlay_extra_loose_point_iface)
166  .fragment_out(0, Type::VEC4, "fragColor")
167  .fragment_out(1, Type::VEC4, "lineOutput")
168  .vertex_source("overlay_extra_loose_point_vert.glsl")
169  .fragment_source("overlay_extra_loose_point_frag.glsl")
170  .additional_info("draw_modelmat", "draw_globals");
171 
172 GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped)
173  .do_static_compilation(true)
174  .additional_info("overlay_extra_loose_point", "drw_clipped");
175 
178 /* -------------------------------------------------------------------- */
182 GPU_SHADER_INTERFACE_INFO(overlay_motion_path_line_iface, "interp")
183  .flat(Type::VEC2, "ss_pos")
184  .smooth(Type::VEC4, "color");
185 
186 GPU_SHADER_CREATE_INFO(overlay_motion_path_line)
187  .do_static_compilation(true)
188  .vertex_in(0, Type::VEC3, "pos")
189  .push_constant(Type::IVEC4, "mpathLineSettings")
190  .push_constant(Type::BOOL, "selected")
191  .push_constant(Type::VEC3, "customColor")
192  .push_constant(Type::INT, "lineThickness") /* In pixels. */
193  .vertex_out(overlay_motion_path_line_iface)
194  .geometry_out(overlay_motion_path_line_iface)
195  .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
196  .fragment_out(0, Type::VEC4, "fragColor")
197  .vertex_source("overlay_motion_path_line_vert.glsl")
198  .geometry_source("overlay_motion_path_line_geom.glsl")
199  .fragment_source("overlay_motion_path_line_frag.glsl")
200  .additional_info("draw_view", "draw_globals");
201 
202 GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped)
203  .do_static_compilation(true)
204  .additional_info("overlay_motion_path_line", "drw_clipped");
205 
206 GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface, "").flat(Type::VEC4, "finalColor");
207 
208 GPU_SHADER_CREATE_INFO(overlay_motion_path_point)
209  .do_static_compilation(true)
210  .typedef_source("overlay_shader_shared.h")
211  .vertex_in(0, Type::VEC3, "pos")
212  .vertex_in(1, Type::INT, "flag")
213  .push_constant(Type::IVEC4, "mpathPointSettings")
214  .push_constant(Type::BOOL, "showKeyFrames")
215  .push_constant(Type::VEC3, "customColor")
216  .vertex_out(overlay_motion_path_point_iface)
217  .fragment_out(0, Type::VEC4, "fragColor")
218  .vertex_source("overlay_motion_path_point_vert.glsl")
219  .fragment_source("overlay_point_varying_color_frag.glsl")
220  .additional_info("draw_view", "draw_globals");
221 
222 GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped)
223  .do_static_compilation(true)
224  .additional_info("overlay_motion_path_point", "drw_clipped");
225 
228 /* -------------------------------------------------------------------- */
232 GPU_SHADER_INTERFACE_INFO(overlay_image_iface, "").smooth(Type::VEC2, "uvs");
233 
234 GPU_SHADER_CREATE_INFO(overlay_image)
235  .do_static_compilation(true)
236  .push_constant(Type::BOOL, "depthSet")
237  .push_constant(Type::BOOL, "isCameraBackground")
238  .push_constant(Type::BOOL, "imgPremultiplied")
239  .push_constant(Type::BOOL, "imgAlphaBlend")
240  .push_constant(Type::VEC4, "color")
241  .vertex_in(0, Type::VEC3, "pos")
242  .vertex_out(overlay_image_iface)
243  .sampler(0, ImageType::FLOAT_2D, "imgTexture")
244  .fragment_out(0, Type::VEC4, "fragColor")
245  .vertex_source("overlay_image_vert.glsl")
246  .fragment_source("overlay_image_frag.glsl")
247  .additional_info("draw_mesh");
248 
249 GPU_SHADER_CREATE_INFO(overlay_image_clipped)
250  .do_static_compilation(true)
251  .additional_info("overlay_image", "drw_clipped");
252 
255 /* -------------------------------------------------------------------- */
259 GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas)
260  .do_static_compilation(true)
261  .vertex_out(overlay_extra_iface)
262  .push_constant(Type::VEC4, "color")
263  .push_constant(Type::VEC3, "xAxis")
264  .push_constant(Type::VEC3, "yAxis")
265  .push_constant(Type::VEC3, "origin")
266  .push_constant(Type::INT, "halfLineCount")
267  .fragment_out(0, Type::VEC4, "fragColor")
268  .fragment_out(1, Type::VEC4, "lineOutput")
269  .vertex_source("overlay_edit_gpencil_canvas_vert.glsl")
270  .fragment_source("overlay_extra_frag.glsl")
271  .additional_info("draw_mesh", "draw_globals");
272 
273 GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped)
274  .do_static_compilation(true)
275  .additional_info("overlay_gpencil_canvas", "drw_clipped");
276 
279 /* -------------------------------------------------------------------- */
283 GPU_SHADER_INTERFACE_INFO(overlay_particle_iface, "").flat(Type::VEC4, "finalColor");
284 
285 GPU_SHADER_CREATE_INFO(overlay_particle)
286  .sampler(0, ImageType::FLOAT_1D, "weightTex")
287  .push_constant(Type::VEC4, "color") /* Draw-size packed in alpha. */
288  .vertex_in(0, Type::VEC3, "part_pos")
289  .vertex_in(1, Type::VEC4, "part_rot")
290  .vertex_in(2, Type::FLOAT, "part_val")
291  .vertex_out(overlay_particle_iface)
292  .vertex_source("overlay_particle_vert.glsl")
293  .additional_info("draw_globals");
294 
295 GPU_SHADER_CREATE_INFO(overlay_particle_dot)
296  .do_static_compilation(true)
297  .define("USE_DOTS")
298  .define("vclass", "0")
299  .define("pos", "vec3(0.0)")
300  .fragment_out(0, Type::VEC4, "fragColor")
301  .fragment_out(1, Type::VEC4, "lineOutput")
302  .fragment_source("overlay_particle_frag.glsl")
303  .additional_info("overlay_particle", "draw_mesh");
304 
305 GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped)
306  .do_static_compilation(true)
307  .additional_info("overlay_particle_dot", "drw_clipped");
308 
309 GPU_SHADER_CREATE_INFO(overlay_particle_shape)
310  .do_static_compilation(true)
311  /* Instantiated Attrs. */
312  .vertex_in(3, Type::VEC3, "pos")
313  .vertex_in(4, Type::INT, "vclass")
314  .fragment_out(0, Type::VEC4, "fragColor")
315  .fragment_source("overlay_varying_color.glsl")
316  .additional_info("overlay_particle", "draw_modelmat", "draw_resource_id_uniform");
317 
318 GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped)
319  .do_static_compilation(true)
320  .additional_info("overlay_particle_shape", "drw_clipped");
321 
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)
@ FLOAT