Blender V4.3
overlay_extra_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
6
7/* -------------------------------------------------------------------- */
11GPU_SHADER_INTERFACE_INFO(overlay_extra_iface, "")
12 .no_perspective(Type::VEC2, "edgePos")
13 .flat(Type::VEC2, "edgeStart")
14 .flat(Type::VEC4, "finalColor");
15
16GPU_SHADER_CREATE_INFO(overlay_extra)
17 .do_static_compilation(true)
18 .typedef_source("overlay_shader_shared.h")
19 .vertex_in(0, Type::VEC3, "pos")
20 .vertex_in(1, Type::INT, "vclass")
21 /* Instance attributes. */
22 .vertex_in(2, Type::VEC4, "color")
23 .vertex_in(3, Type::MAT4, "inst_obmat")
24 .vertex_out(overlay_extra_iface)
25 .fragment_out(0, Type::VEC4, "fragColor")
26 .fragment_out(1, Type::VEC4, "lineOutput")
27 .vertex_source("overlay_extra_vert.glsl")
28 .fragment_source("overlay_extra_frag.glsl")
29 .additional_info("draw_view", "draw_globals");
30
31GPU_SHADER_CREATE_INFO(overlay_extra_select)
32 .do_static_compilation(true)
33 .define("SELECT_EDGES")
34 .additional_info("overlay_extra");
35
36GPU_SHADER_CREATE_INFO(overlay_extra_clipped)
37 .do_static_compilation(true)
38 .additional_info("overlay_extra", "drw_clipped");
39
40GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped)
41 .do_static_compilation(true)
42 .additional_info("overlay_extra_select", "drw_clipped");
43
46/* -------------------------------------------------------------------- */
50GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface, "").flat(Type::VEC4, "finalColor");
51
52GPU_SHADER_CREATE_INFO(overlay_extra_grid)
53 .do_static_compilation(true)
54 .sampler(0, ImageType::DEPTH_2D, "depthBuffer")
55 .push_constant(Type::MAT4, "gridModelMatrix")
56 .push_constant(Type::BOOL, "isTransform")
57 .vertex_out(overlay_extra_grid_iface)
58 .fragment_out(0, Type::VEC4, "fragColor")
59 .vertex_source("overlay_extra_lightprobe_grid_vert.glsl")
60 .fragment_source("overlay_point_varying_color_frag.glsl")
61 .additional_info("draw_view", "draw_globals");
62
63GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped)
64 .do_static_compilation(true)
65 .additional_info("overlay_extra_grid", "drw_clipped");
66
69/* -------------------------------------------------------------------- */
73GPU_SHADER_CREATE_INFO(overlay_extra_groundline)
74 .do_static_compilation(true)
75 .vertex_in(0, Type::VEC3, "pos")
76 /* Instance attributes. */
77 .vertex_in(1, Type::VEC3, "inst_pos")
78 .vertex_out(overlay_extra_iface)
79 .fragment_out(0, Type::VEC4, "fragColor")
80 .fragment_out(1, Type::VEC4, "lineOutput")
81 .vertex_source("overlay_extra_groundline_vert.glsl")
82 .fragment_source("overlay_extra_frag.glsl")
83 .additional_info("draw_view", "draw_globals");
84
85GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped)
86 .do_static_compilation(true)
87 .additional_info("overlay_extra_groundline", "drw_clipped");
88
91/* -------------------------------------------------------------------- */
95GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface, "")
96 .no_perspective(Type::VEC2, "stipple_coord")
97 .flat(Type::VEC2, "stipple_start")
98 .flat(Type::VEC4, "finalColor");
99
100GPU_SHADER_CREATE_INFO(overlay_extra_wire)
101 .do_static_compilation(true)
102 .vertex_in(0, Type::VEC3, "pos")
103 .vertex_in(1, Type::VEC4, "color")
104 /* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */
105 .vertex_in(2, Type::INT, "colorid")
106 .vertex_out(overlay_extra_wire_iface)
107 .fragment_out(0, Type::VEC4, "fragColor")
108 .fragment_out(1, Type::VEC4, "lineOutput")
109 .vertex_source("overlay_extra_wire_vert.glsl")
110 .fragment_source("overlay_extra_wire_frag.glsl")
111 .additional_info("draw_modelmat", "draw_globals");
112
113GPU_SHADER_CREATE_INFO(overlay_extra_wire_select)
114 .do_static_compilation(true)
115 .define("SELECT_EDGES")
116 .additional_info("overlay_extra_wire");
117
118GPU_SHADER_CREATE_INFO(overlay_extra_wire_object)
119 .do_static_compilation(true)
120 .define("OBJECT_WIRE")
121 .additional_info("overlay_extra_wire");
122
123GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped)
124 .do_static_compilation(true)
125 .additional_info("overlay_extra_wire_select", "drw_clipped");
126
127GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped)
128 .do_static_compilation(true)
129 .additional_info("overlay_extra_wire_object", "drw_clipped");
130
131GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped)
132 .do_static_compilation(true)
133 .additional_info("overlay_extra_wire", "drw_clipped");
134
137/* -------------------------------------------------------------------- */
141GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface, "")
142 .flat(Type::VEC4, "radii")
143 .flat(Type::VEC4, "fillColor")
144 .flat(Type::VEC4, "outlineColor");
145
146GPU_SHADER_CREATE_INFO(overlay_extra_point)
147 .do_static_compilation(true)
148 /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */
149 .define("blender_srgb_to_framebuffer_space(a)", "a")
150 .vertex_in(0, Type::VEC3, "pos")
151 .push_constant(Type::VEC4, "ucolor")
152 .vertex_out(overlay_extra_point_iface)
153 .fragment_out(0, Type::VEC4, "fragColor")
154 .vertex_source("overlay_extra_point_vert.glsl")
155 .fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl")
156 .additional_info("draw_modelmat", "draw_globals");
157
158GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped)
159 .do_static_compilation(true)
160 .additional_info("overlay_extra_point", "drw_clipped");
161
162GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface, "").smooth(Type::VEC4, "finalColor");
163
164GPU_SHADER_CREATE_INFO(overlay_extra_loose_point)
165 .do_static_compilation(true)
166 .vertex_in(0, Type::VEC3, "pos")
167 .vertex_in(1, Type::VEC4, "vertex_color")
168 .vertex_out(overlay_extra_loose_point_iface)
169 .fragment_out(0, Type::VEC4, "fragColor")
170 .fragment_out(1, Type::VEC4, "lineOutput")
171 .vertex_source("overlay_extra_loose_point_vert.glsl")
172 .fragment_source("overlay_extra_loose_point_frag.glsl")
173 .additional_info("draw_modelmat", "draw_globals");
174
175GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped)
176 .do_static_compilation(true)
177 .additional_info("overlay_extra_loose_point", "drw_clipped");
178
181/* -------------------------------------------------------------------- */
185GPU_SHADER_INTERFACE_INFO(overlay_motion_path_line_iface, "interp").smooth(Type::VEC4, "color");
186GPU_SHADER_INTERFACE_INFO(overlay_motion_path_line_flat_iface, "interp_flat")
187 .flat(Type::VEC2, "ss_pos");
188
189GPU_SHADER_CREATE_INFO(overlay_motion_path_line)
190 .do_static_compilation(true)
191 .vertex_in(0, Type::VEC3, "pos")
192 .push_constant(Type::IVEC4, "mpathLineSettings")
193 .push_constant(Type::BOOL, "selected")
194 .push_constant(Type::VEC3, "customColorPre")
195 .push_constant(Type::VEC3, "customColorPost")
196 .push_constant(Type::INT, "lineThickness") /* In pixels. */
197 .push_constant(Type::MAT4, "camera_space_matrix")
198 .vertex_out(overlay_motion_path_line_iface)
199 .vertex_out(overlay_motion_path_line_flat_iface)
200 .geometry_out(overlay_motion_path_line_iface)
201 .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
202 .fragment_out(0, Type::VEC4, "fragColor")
203 .vertex_source("overlay_motion_path_line_vert.glsl")
204 .geometry_source("overlay_motion_path_line_geom.glsl")
205 .fragment_source("overlay_motion_path_line_frag.glsl")
206 .additional_info("draw_view", "draw_globals");
207
208GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom)
209 .metal_backend_only(true)
210 .do_static_compilation(true)
211 .vertex_in(0, Type::VEC3, "pos")
212 .push_constant(Type::IVEC4, "mpathLineSettings")
213 .push_constant(Type::BOOL, "selected")
214 .push_constant(Type::VEC3, "customColorPre")
215 .push_constant(Type::VEC3, "customColorPost")
216 .push_constant(Type::INT, "lineThickness") /* In pixels. */
217 .vertex_out(overlay_motion_path_line_iface)
218 .fragment_out(0, Type::VEC4, "fragColor")
219 .vertex_source("overlay_motion_path_line_vert_no_geom.glsl")
220 .fragment_source("overlay_motion_path_line_frag.glsl")
221 .additional_info("draw_view", "draw_globals");
222
223GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next)
224 .do_static_compilation(true)
225 .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
226 .push_constant(Type::IVEC2, "gpu_attr_0")
227 .push_constant(Type::IVEC4, "mpathLineSettings")
228 .push_constant(Type::BOOL, "selected")
229 .push_constant(Type::VEC3, "customColorPre")
230 .push_constant(Type::VEC3, "customColorPost")
231 .push_constant(Type::INT, "lineThickness") /* In pixels. */
232 .push_constant(Type::MAT4, "camera_space_matrix")
233 .vertex_out(overlay_motion_path_line_iface)
234 .fragment_out(0, Type::VEC4, "fragColor")
235 .vertex_source("overlay_motion_path_line_next_vert.glsl")
236 .fragment_source("overlay_motion_path_line_frag.glsl")
237 .additional_info("draw_view", "gpu_index_load", "draw_globals");
238
239GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped)
240 .do_static_compilation(true)
241 .additional_info("overlay_motion_path_line", "drw_clipped");
242
243GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom)
244 .metal_backend_only(true)
245 .do_static_compilation(true)
246 .additional_info("overlay_motion_path_line_no_geom", "drw_clipped");
247
248GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface, "").flat(Type::VEC4, "finalColor");
249
250GPU_SHADER_CREATE_INFO(overlay_motion_path_point)
251 .do_static_compilation(true)
252 .typedef_source("overlay_shader_shared.h")
253 .vertex_in(0, Type::VEC3, "pos")
254 .vertex_in(1, Type::INT, "flag")
255 .push_constant(Type::IVEC4, "mpathPointSettings")
256 .push_constant(Type::BOOL, "showKeyFrames")
257 .push_constant(Type::VEC3, "customColorPre")
258 .push_constant(Type::VEC3, "customColorPost")
259 .push_constant(Type::MAT4, "camera_space_matrix")
260 .vertex_out(overlay_motion_path_point_iface)
261 .fragment_out(0, Type::VEC4, "fragColor")
262 .vertex_source("overlay_motion_path_point_vert.glsl")
263 .fragment_source("overlay_point_varying_color_frag.glsl")
264 .additional_info("draw_view", "draw_globals");
265
266GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped)
267 .do_static_compilation(true)
268 .additional_info("overlay_motion_path_point", "drw_clipped");
269
272/* -------------------------------------------------------------------- */
276GPU_SHADER_INTERFACE_INFO(overlay_image_iface, "").smooth(Type::VEC2, "uvs");
277
278GPU_SHADER_CREATE_INFO(overlay_image)
279 .do_static_compilation(true)
280 .push_constant(Type::BOOL, "depthSet")
281 .push_constant(Type::BOOL, "isCameraBackground")
282 .push_constant(Type::BOOL, "imgPremultiplied")
283 .push_constant(Type::BOOL, "imgAlphaBlend")
284 .push_constant(Type::VEC4, "ucolor")
285 .vertex_in(0, Type::VEC3, "pos")
286 .vertex_out(overlay_image_iface)
287 .sampler(0, ImageType::FLOAT_2D, "imgTexture")
288 .fragment_out(0, Type::VEC4, "fragColor")
289 .vertex_source("overlay_image_vert.glsl")
290 .fragment_source("overlay_image_frag.glsl")
291 .additional_info("draw_mesh");
292
293GPU_SHADER_CREATE_INFO(overlay_image_clipped)
294 .do_static_compilation(true)
295 .additional_info("overlay_image", "drw_clipped");
296
299/* -------------------------------------------------------------------- */
303GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas)
304 .do_static_compilation(true)
305 .vertex_out(overlay_extra_iface)
306 .push_constant(Type::VEC4, "color")
307 .push_constant(Type::VEC3, "xAxis")
308 .push_constant(Type::VEC3, "yAxis")
309 .push_constant(Type::VEC3, "origin")
310 .push_constant(Type::INT, "halfLineCount")
311 .fragment_out(0, Type::VEC4, "fragColor")
312 .fragment_out(1, Type::VEC4, "lineOutput")
313 .vertex_source("overlay_edit_gpencil_canvas_vert.glsl")
314 .fragment_source("overlay_extra_frag.glsl")
315 .additional_info("draw_mesh", "draw_globals");
316
317GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped)
318 .do_static_compilation(true)
319 .additional_info("overlay_gpencil_canvas", "drw_clipped");
320
323/* -------------------------------------------------------------------- */
327GPU_SHADER_INTERFACE_INFO(overlay_particle_iface, "").flat(Type::VEC4, "finalColor");
328
329GPU_SHADER_CREATE_INFO(overlay_particle)
330 .sampler(0, ImageType::FLOAT_1D, "weightTex")
331 .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */
332 .vertex_in(0, Type::VEC3, "part_pos")
333 .vertex_in(1, Type::VEC4, "part_rot")
334 .vertex_in(2, Type::FLOAT, "part_val")
335 .vertex_out(overlay_particle_iface)
336 .vertex_source("overlay_particle_vert.glsl")
337 .additional_info("draw_globals");
338
339GPU_SHADER_CREATE_INFO(overlay_particle_dot)
340 .do_static_compilation(true)
341 .define("USE_DOTS")
342 .define("vclass", "0")
343 .define("pos", "vec3(0.0)")
344 .fragment_out(0, Type::VEC4, "fragColor")
345 .fragment_out(1, Type::VEC4, "lineOutput")
346 .fragment_source("overlay_particle_frag.glsl")
347 .additional_info("overlay_particle", "draw_mesh");
348
349GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped)
350 .do_static_compilation(true)
351 .additional_info("overlay_particle_dot", "drw_clipped");
352
353GPU_SHADER_CREATE_INFO(overlay_particle_shape)
354 .do_static_compilation(true)
355 /* Instantiated Attrs. */
356 .vertex_in(3, Type::VEC3, "pos")
357 .vertex_in(4, Type::INT, "vclass")
358 .fragment_out(0, Type::VEC4, "fragColor")
359 .fragment_source("overlay_varying_color.glsl")
360 .additional_info("overlay_particle", "draw_modelmat", "draw_resource_id_uniform");
361
362GPU_SHADER_CREATE_INFO(overlay_particle_shape_next)
363 .do_static_compilation(true)
364 .typedef_source("overlay_shader_shared.h")
365 .sampler(0, ImageType::FLOAT_1D, "weightTex")
366 .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */
367 .push_constant(Type::INT, "shape_type")
368 /* Use first attribute to only bind one buffer. */
369 .storage_buf(0, Qualifier::READ, "ParticlePointData", "part_pos[]", Frequency::GEOMETRY)
370 .vertex_out(overlay_extra_iface)
371 .fragment_out(0, Type::VEC4, "fragColor")
372 .fragment_out(1, Type::VEC4, "lineOutput")
373 .vertex_source("overlay_particle_shape_vert.glsl")
374 .fragment_source("overlay_particle_shape_frag.glsl")
375 .additional_info("draw_view", "draw_modelmat_new", "draw_resource_handle_new", "draw_globals");
376
377GPU_SHADER_CREATE_INFO(overlay_particle_hair_next)
378 .do_static_compilation(true)
379 .typedef_source("overlay_shader_shared.h")
380 .vertex_in(0, Type::VEC3, "pos")
381 .vertex_in(1, Type::VEC3, "nor")
382 .push_constant(Type::INT, "colorType")
383 .push_constant(Type::BOOL, "isTransform")
384 .push_constant(Type::BOOL, "useColoring")
385 .vertex_out(overlay_extra_iface)
386 .fragment_out(0, Type::VEC4, "fragColor")
387 .fragment_out(1, Type::VEC4, "lineOutput")
388 .vertex_source("overlay_particle_hair_vert.glsl")
389 .fragment_source("overlay_particle_shape_frag.glsl")
390 .additional_info("draw_view",
391 "draw_modelmat_new",
392 "draw_object_infos_new",
393 "draw_resource_handle_new",
394 "draw_globals");
395
396GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped)
397 .do_static_compilation(true)
398 .additional_info("overlay_particle_shape", "drw_clipped");
399
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)