1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_create_info.hh"
/* -------------------------------------------------------------------- */
/** \name Extra shapes
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_iface, "")
.no_perspective(Type::VEC2, "edgePos")
.flat(Type::VEC2, "edgeStart")
.flat(Type::VEC4, "finalColor");
GPU_SHADER_CREATE_INFO(overlay_extra)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "vclass")
/* Instance attributes. */
.vertex_in(2, Type::MAT4, "inst_obmat")
.vertex_in(3, Type::VEC4, "color")
.vertex_out(overlay_extra_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("extra_vert.glsl")
.fragment_source("extra_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_select)
.do_static_compilation(true)
.define("SELECT_EDGES")
.additional_info("overlay_extra");
GPU_SHADER_CREATE_INFO(overlay_extra_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra", "drw_clipped");
GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_select", "drw_clipped");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Irradiance Grid
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface, "").flat(Type::VEC4, "finalColor");
GPU_SHADER_CREATE_INFO(overlay_extra_grid)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
.push_constant(Type::MAT4, "gridModelMatrix")
.push_constant(Type::BOOL, "isTransform")
.vertex_out(overlay_extra_grid_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("extra_lightprobe_grid_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_grid", "drw_clipped");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Ground-lines
* \{ */
GPU_SHADER_CREATE_INFO(overlay_extra_groundline)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
/* Instance attributes. */
.vertex_in(1, Type::VEC3, "inst_pos")
.vertex_out(overlay_extra_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("extra_groundline_vert.glsl")
.fragment_source("extra_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_groundline", "drw_clipped");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Extra wires
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface, "")
.no_perspective(Type::VEC2, "stipple_coord")
.flat(Type::VEC2, "stipple_start")
.flat(Type::VEC4, "finalColor");
GPU_SHADER_CREATE_INFO(overlay_extra_wire)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "color")
/* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */
.vertex_in(2, Type::INT, "colorid")
.vertex_out(overlay_extra_wire_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("extra_wire_vert.glsl")
.fragment_source("extra_wire_frag.glsl")
.additional_info("draw_modelmat", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_wire_select)
.do_static_compilation(true)
.define("SELECT_EDGES")
.additional_info("overlay_extra_wire", "drw_clipped");
GPU_SHADER_CREATE_INFO(overlay_extra_wire_object)
.do_static_compilation(true)
.define("OBJECT_WIRE")
.additional_info("overlay_extra_wire", "drw_clipped");
GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_wire_select", "drw_clipped");
GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_wire_object", "drw_clipped");
GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_wire", "drw_clipped");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Extra points
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface, "")
.flat(Type::VEC4, "radii")
.flat(Type::VEC4, "fillColor")
.flat(Type::VEC4, "outlineColor");
GPU_SHADER_CREATE_INFO(overlay_extra_point)
.do_static_compilation(true)
/* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */
.define("blender_srgb_to_framebuffer_space(a)", "a")
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "color")
.vertex_out(overlay_extra_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("extra_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_varying_outline_aa_frag.glsl")
.additional_info("draw_modelmat", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_point", "drw_clipped");
GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface, "").smooth(Type::VEC4, "finalColor");
GPU_SHADER_CREATE_INFO(overlay_extra_loose_point)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "color")
.vertex_out(overlay_extra_loose_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_out(1, Type::VEC4, "lineOutput")
.vertex_source("extra_loose_point_vert.glsl")
.fragment_source("extra_loose_point_frag.glsl")
.additional_info("draw_modelmat", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped)
.do_static_compilation(true)
.additional_info("overlay_extra_loose_point", "drw_clipped");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Motion Path
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_motion_path_line_iface, "interp")
.flat(Type::VEC2, "ss_pos")
.smooth(Type::VEC4, "color");
GPU_SHADER_CREATE_INFO(overlay_motion_path_line)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::IVEC4, "mpathLineSettings")
.push_constant(Type::BOOL, "selected")
.push_constant(Type::VEC3, "customColor")
.push_constant(Type::INT, "lineThickness") /* In pixels. */
.vertex_out(overlay_motion_path_line_iface)
.geometry_out(overlay_motion_path_line_iface)
.geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("motion_path_line_vert.glsl")
.geometry_source("motion_path_line_geom.glsl")
.fragment_source("motion_path_line_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped)
.do_static_compilation(true)
.additional_info("overlay_motion_path_line", "drw_clipped");
GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface, "").flat(Type::VEC4, "finalColor");
GPU_SHADER_CREATE_INFO(overlay_motion_path_point)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "flag")
.push_constant(Type::IVEC4, "mpathPointSettings")
.push_constant(Type::BOOL, "showKeyFrames")
.push_constant(Type::VEC3, "customColor")
.vertex_out(overlay_motion_path_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("motion_path_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped)
.do_static_compilation(true)
.additional_info("overlay_motion_path_point", "drw_clipped");
/** \} */
/* -------------------------------------------------------------------- */
/** \name Image Empty
* \{ */
GPU_SHADER_INTERFACE_INFO(overlay_image_iface, "").smooth(Type::VEC2, "uvs");
GPU_SHADER_CREATE_INFO(overlay_image)
.do_static_compilation(true)
.push_constant(Type::BOOL, "depthSet")
.push_constant(Type::BOOL, "isCameraBackground")
.push_constant(Type::BOOL, "imgPremultiplied")
.push_constant(Type::BOOL, "imgAlphaBlend")
.push_constant(Type::VEC4, "color")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(overlay_image_iface)
.sampler(0, ImageType::FLOAT_2D, "imgTexture")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("image_vert.glsl")
.fragment_source("image_frag.glsl")
.additional_info("draw_mesh");
GPU_SHADER_CREATE_INFO(overlay_image_clipped)
.do_static_compilation(true)
.additional_info("overlay_image", "drw_clipped");
/** \} */
|