Blender V4.3
overlay_armature_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
7GPU_SHADER_CREATE_INFO(overlay_frag_output)
8 .fragment_out(0, Type::VEC4, "fragColor")
9 .fragment_out(1, Type::VEC4, "lineOutput");
10
11GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface, "")
12 .flat(Type::VEC4, "finalColor")
13 .flat(Type::VEC2, "edgeStart")
14 .no_perspective(Type::VEC2, "edgePos");
15
17 .push_constant(Type::FLOAT, "alpha")
18 .additional_info("draw_view");
19
20/* -------------------------------------------------------------------- */
24GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline)
25 .do_static_compilation(true)
26 .vertex_in(0, Type::VEC2, "pos")
27 /* Per instance. */
28 .vertex_in(1, Type::MAT4, "inst_obmat")
29 .vertex_out(overlay_armature_wire_iface)
30 .vertex_source("overlay_armature_sphere_outline_vert.glsl")
31 .fragment_source("overlay_armature_wire_frag.glsl")
32 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
33
34GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped)
35 .do_static_compilation(true)
36 .additional_info("overlay_armature_sphere_outline", "drw_clipped");
37
38GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface, "")
39 .flat(Type::VEC3, "finalStateColor")
40 .flat(Type::VEC3, "finalBoneColor")
41 .flat(Type::MAT4, "sphereMatrix")
42 .smooth(Type::VEC3, "viewPosition");
43
44GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid)
45 .do_static_compilation(true)
46 .vertex_in(0, Type::VEC2, "pos")
47 /* Per instance. */
48 .vertex_in(1, Type::VEC4, "color")
49 .vertex_in(2, Type::MAT4, "inst_obmat")
50 .depth_write(DepthWrite::GREATER)
51 .vertex_out(overlay_armature_sphere_solid_iface)
52 .vertex_source("overlay_armature_sphere_solid_vert.glsl")
53 .fragment_source("overlay_armature_sphere_solid_frag.glsl")
54 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals")
55 .depth_write(DepthWrite::ANY);
56
57GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped)
58 .do_static_compilation(true)
59 .additional_info("overlay_armature_sphere_solid", "drw_clipped");
60
63/* -------------------------------------------------------------------- */
67GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_iface, "geom_in")
68 .smooth(Type::VEC4, "pPos")
69 .smooth(Type::VEC3, "vPos")
70 .smooth(Type::VEC2, "ssPos")
71 .smooth(Type::VEC4, "vColSize");
72GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, "geom_flat_in")
73 .flat(Type::INT, "inverted");
74
75GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface, "")
76 .flat(Type::VEC4, "finalColor")
77 .flat(Type::VEC2, "edgeStart")
78 .no_perspective(Type::VEC2, "edgePos");
79
80GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline)
81 .do_static_compilation(true)
82 .vertex_in(0, Type::VEC3, "pos")
83 /* Per instance. */
84 .vertex_in(3, Type::MAT4, "inst_obmat")
85 .vertex_out(overlay_armature_shape_outline_iface)
86 .vertex_out(overlay_armature_shape_outline_flat_iface)
87 .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2)
88 .geometry_out(overlay_armature_wire_iface)
89 .vertex_source("overlay_armature_shape_outline_vert.glsl")
90 .geometry_source("overlay_armature_shape_outline_geom.glsl")
91 .fragment_source("overlay_armature_wire_frag.glsl")
92 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
93
94GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom)
95 .metal_backend_only(true)
96 .do_static_compilation(true)
97 .vertex_in(0, Type::VEC3, "pos")
98 /* Per instance. */
99 .vertex_in(3, Type::MAT4, "inst_obmat")
100 .vertex_out(overlay_armature_shape_outline_no_geom_iface)
101 .vertex_source("overlay_armature_shape_outline_vert_no_geom.glsl")
102 .fragment_source("overlay_armature_wire_frag.glsl")
103 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
104
105GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next)
106 .do_static_compilation(true)
107 .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
108 .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]")
109 .push_constant(Type::IVEC2, "gpu_attr_0")
110 .vertex_out(overlay_armature_shape_outline_no_geom_iface)
111 .vertex_source("overlay_armature_shape_outline_next_vert.glsl")
112 .fragment_source("overlay_armature_wire_frag.glsl")
113 .additional_info("overlay_frag_output",
114 "overlay_armature_common",
115 "gpu_index_load",
116 "draw_globals");
117
118GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped)
119 .do_static_compilation(true)
120 .additional_info("overlay_armature_shape_outline", "drw_clipped");
121
122GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom)
123 .metal_backend_only(true)
124 .do_static_compilation(true)
125 .additional_info("overlay_armature_shape_outline_no_geom", "drw_clipped");
126
127GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface, "")
128 .smooth(Type::VEC4, "finalColor")
129 .flat(Type::INT, "inverted");
130
131GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid)
132 .do_static_compilation(true)
133 .vertex_in(0, Type::VEC3, "pos")
134 .vertex_in(1, Type::VEC3, "nor")
135 /* Per instance. */
136 .vertex_in(2, Type::MAT4, "inst_obmat")
137 .depth_write(DepthWrite::GREATER)
138 .vertex_out(overlay_armature_shape_solid_iface)
139 .vertex_source("overlay_armature_shape_solid_vert.glsl")
140 .fragment_source("overlay_armature_shape_solid_frag.glsl")
141 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
142
143GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped)
144 .do_static_compilation(true)
145 .additional_info("overlay_armature_shape_solid", "drw_clipped");
146
147GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface, "")
148 .flat(Type::VEC4, "finalColor")
149 .flat(Type::FLOAT, "wire_width")
150 .no_perspective(Type::FLOAT, "edgeCoord");
151
152GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_iface, "geometry_in")
153 .flat(Type::VEC4, "finalColor")
154 .flat(Type::FLOAT, "wire_width");
155
156GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, "geometry_out")
157 .flat(Type::VEC4, "finalColor")
158 .flat(Type::FLOAT, "wire_width");
159
160GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface,
161 "geometry_noperspective_out")
162 .no_perspective(Type::FLOAT, "edgeCoord");
163
164GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire)
165 .do_static_compilation(true)
166 .push_constant(Type::BOOL, "do_smooth_wire")
167 .vertex_in(0, Type::VEC3, "pos")
168 /* Per instance. */
169 .vertex_in(2, Type::MAT4, "inst_obmat")
170 .vertex_out(overlay_armature_shape_wire_iface)
171 .vertex_source("overlay_armature_shape_wire_vert.glsl")
172 .geometry_out(overlay_armature_shape_wire_geom_iface)
173 .geometry_out(overlay_armature_shape_wire_geom_noperspective_iface)
174 .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
175 .geometry_source("overlay_armature_shape_wire_geom.glsl")
176 .fragment_source("overlay_armature_shape_wire_frag.glsl")
177 .typedef_source("overlay_shader_shared.h")
178 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
179
180GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped)
181 .do_static_compilation(true)
182 .additional_info("overlay_armature_shape_wire", "drw_clipped");
183
184#ifdef WITH_METAL_BACKEND
185GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom)
186 .metal_backend_only(true)
187 .do_static_compilation(true)
188 .push_constant(Type::BOOL, "do_smooth_wire")
189 .vertex_in(0, Type::VEC3, "pos")
190 .vertex_in(2, Type::MAT4, "inst_obmat")
191 .vertex_out(overlay_armature_wire_iface)
192 .vertex_source("overlay_armature_shape_wire_vert_no_geom.glsl")
193 .fragment_source("overlay_armature_wire_frag.glsl")
194 .typedef_source("overlay_shader_shared.h")
195 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
196#endif
197
198GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next)
199 .do_static_compilation(true)
200 .define("NO_GEOM")
201 .push_constant(Type::BOOL, "do_smooth_wire")
202 .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
203 .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]")
204 .push_constant(Type::IVEC2, "gpu_attr_0")
205 .define("inst_obmat", "data_buf[gl_InstanceID]")
206 .vertex_out(overlay_armature_shape_wire_next_iface)
207 .vertex_source("overlay_armature_shape_wire_next_vert.glsl")
208 .fragment_source("overlay_armature_shape_wire_frag.glsl")
209 .typedef_source("overlay_shader_shared.h")
210 .additional_info("overlay_frag_output",
211 "overlay_armature_common",
212 "gpu_index_load",
213 "draw_globals");
214
217/* -------------------------------------------------------------------- */
221GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline)
222 .do_static_compilation(true)
223 .typedef_source("overlay_shader_shared.h")
224 .vertex_in(0, Type::VEC2, "pos0")
225 .vertex_in(1, Type::VEC2, "pos1")
226 .vertex_in(2, Type::VEC2, "pos2")
227 /* Per instance. */
228 .vertex_in(3, Type::VEC4, "headSphere")
229 .vertex_in(4, Type::VEC4, "tailSphere")
230 .vertex_in(5, Type::VEC4, "outlineColorSize")
231 .vertex_in(6, Type::VEC3, "xAxis")
232 .vertex_out(overlay_armature_wire_iface)
233 .vertex_source("overlay_armature_envelope_outline_vert.glsl")
234 .fragment_source("overlay_armature_wire_frag.glsl")
235 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
236
237GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped)
238 .do_static_compilation(true)
239 .additional_info("overlay_armature_envelope_outline", "drw_clipped");
240
241GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface, "")
242 .flat(Type::VEC3, "finalStateColor")
243 .flat(Type::VEC3, "finalBoneColor")
244 .smooth(Type::VEC3, "normalView");
245
246GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid)
247 .do_static_compilation(true)
248 .typedef_source("overlay_shader_shared.h")
249 .vertex_in(0, Type::VEC3, "pos")
250 /* Per instance. Assumed to be in world coordinate already. */
251 .vertex_in(1, Type::VEC4, "headSphere")
252 .vertex_in(2, Type::VEC4, "tailSphere")
253 .vertex_in(3, Type::VEC3, "xAxis")
254 .vertex_in(4, Type::VEC3, "stateColor")
255 .vertex_in(5, Type::VEC3, "boneColor")
256 .vertex_out(overlay_armature_envelope_solid_iface)
257 .push_constant(Type::BOOL, "isDistance")
258 .vertex_source("overlay_armature_envelope_solid_vert.glsl")
259 .fragment_source("overlay_armature_envelope_solid_frag.glsl")
260 .additional_info("overlay_frag_output", "overlay_armature_common");
261
262GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped)
263 .do_static_compilation(true)
264 .additional_info("overlay_armature_envelope_solid", "drw_clipped");
265
268/* -------------------------------------------------------------------- */
272GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface, "")
273 .no_perspective(Type::FLOAT, "colorFac")
274 .flat(Type::VEC4, "finalWireColor")
275 .flat(Type::VEC4, "finalInnerColor");
276
277GPU_SHADER_CREATE_INFO(overlay_armature_stick)
278 .do_static_compilation(true)
279 .typedef_source("overlay_shader_shared.h")
280 /* Bone aligned screen space. */
281 .vertex_in(0, Type::VEC2, "pos")
282 .vertex_in(1, Type::UINT, "flag")
283 /* Per instance. Assumed to be in world coordinate already. */
284 .vertex_in(2, Type::VEC3, "boneStart")
285 .vertex_in(3, Type::VEC3, "boneEnd")
286 /* alpha encode if we do wire. If 0.0 we don't. */
287 .vertex_in(4, Type::VEC4, "wireColor")
288 .vertex_in(5, Type::VEC4, "boneColor")
289 .vertex_in(6, Type::VEC4, "headColor")
290 .vertex_in(7, Type::VEC4, "tailColor")
291 .define("do_wire", "(wireColor.a > 0.0)")
292 .vertex_out(overlay_armature_stick_iface)
293 .vertex_source("overlay_armature_stick_vert.glsl")
294 .fragment_source("overlay_armature_stick_frag.glsl")
295 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
296
297GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped)
298 .do_static_compilation(true)
299 .additional_info("overlay_armature_stick", "drw_clipped");
300
303/* -------------------------------------------------------------------- */
307GPU_SHADER_CREATE_INFO(overlay_armature_dof)
308 .do_static_compilation(true)
309 .typedef_source("overlay_shader_shared.h")
310 .vertex_in(0, Type::VEC2, "pos")
311 /* Per instance. Assumed to be in world coordinate already. */
312 .vertex_in(1, Type::VEC4, "color")
313 .vertex_in(2, Type::MAT4, "inst_obmat")
314 .vertex_out(overlay_armature_wire_iface)
315 .vertex_source("overlay_armature_dof_vert.glsl")
316 .fragment_source("overlay_armature_dof_solid_frag.glsl")
317 .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
318
319GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped)
320 .do_static_compilation(true)
321 .additional_info("overlay_armature_dof", "drw_clipped");
322
325/* -------------------------------------------------------------------- */
329GPU_SHADER_CREATE_INFO(overlay_armature_wire)
330 .do_static_compilation(true)
331 .typedef_source("overlay_shader_shared.h")
332 .vertex_in(0, Type::VEC3, "pos")
333 .vertex_in(1, Type::VEC4, "color")
334 .push_constant(Type::FLOAT, "alpha")
335 .vertex_out(overlay_armature_wire_iface)
336 .vertex_source("overlay_armature_wire_vert.glsl")
337 .fragment_source("overlay_armature_wire_frag.glsl")
338 .additional_info("overlay_frag_output", "draw_mesh", "draw_globals");
339
340GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped)
341 .do_static_compilation(true)
342 .additional_info("overlay_armature_wire", "drw_clipped");
343
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)
pos overlay_armature_common