Blender  V3.3
draw_common_shader_shared.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2022 Blender Foundation. */
3 
8 #ifndef GPU_SHADER
10 
12 #endif
13 
14 /* Future Plan: These globals were once shared between multiple overlay engines. But now that they
15  * have been merged into one engine, there is no reasons to keep these globals out of the overlay
16  * engine. */
17 
18 #define UBO_FIRST_COLOR color_wire
19 #define UBO_LAST_COLOR color_uv_shadow
20 
21 /* Used as ubo but colors can be directly referenced as well */
22 /* NOTE: Also keep all color as vec4 and between #UBO_FIRST_COLOR and #UBO_LAST_COLOR. */
24  /* UBOs data needs to be 16 byte aligned (size of vec4) */
59 
63 
70 
86 
102 
105 
107 
112 
114 
120 
123 
125 
126  /* NOTE: Put all color before #UBO_LAST_COLOR. */
127  float4 screen_vecs[2]; /* Padded as vec4. */
128  float4 size_viewport; /* Packed as vec4. */
129 
130  /* Pack individual float at the end of the buffer to avoid alignment errors */
136 };
138 
139 #ifdef GPU_SHADER
140 /* Keep compatibility_with old global scope syntax. */
141 /* TODO(@fclem) Mass rename and remove the camel case. */
142 # define colorWire globalsBlock.color_wire
143 # define colorWireEdit globalsBlock.color_wire_edit
144 # define colorActive globalsBlock.color_active
145 # define colorSelect globalsBlock.color_select
146 # define colorLibrarySelect globalsBlock.color_library_select
147 # define colorLibrary globalsBlock.color_library
148 # define colorTransform globalsBlock.color_transform
149 # define colorLight globalsBlock.color_light
150 # define colorSpeaker globalsBlock.color_speaker
151 # define colorCamera globalsBlock.color_camera
152 # define colorCameraPath globalsBlock.color_camera_path
153 # define colorEmpty globalsBlock.color_empty
154 # define colorVertex globalsBlock.color_vertex
155 # define colorVertexSelect globalsBlock.color_vertex_select
156 # define colorVertexUnreferenced globalsBlock.color_vertex_unreferenced
157 # define colorVertexMissingData globalsBlock.color_vertex_missing_data
158 # define colorEditMeshActive globalsBlock.color_edit_mesh_active
159 # define colorEdgeSelect globalsBlock.color_edge_select
160 # define colorEdgeSeam globalsBlock.color_edge_seam
161 # define colorEdgeSharp globalsBlock.color_edge_sharp
162 # define colorEdgeCrease globalsBlock.color_edge_crease
163 # define colorEdgeBWeight globalsBlock.color_edge_bweight
164 # define colorEdgeFaceSelect globalsBlock.color_edge_face_select
165 # define colorEdgeFreestyle globalsBlock.color_edge_freestyle
166 # define colorFace globalsBlock.color_face
167 # define colorFaceSelect globalsBlock.color_face_select
168 # define colorFaceFreestyle globalsBlock.color_face_freestyle
169 # define colorGpencilVertex globalsBlock.color_gpencil_vertex
170 # define colorGpencilVertexSelect globalsBlock.color_gpencil_vertex_select
171 # define colorNormal globalsBlock.color_normal
172 # define colorVNormal globalsBlock.color_vnormal
173 # define colorLNormal globalsBlock.color_lnormal
174 # define colorFaceDot globalsBlock.color_facedot
175 # define colorSkinRoot globalsBlock.color_skinroot
176 # define colorDeselect globalsBlock.color_deselect
177 # define colorOutline globalsBlock.color_outline
178 # define colorLightNoAlpha globalsBlock.color_light_no_alpha
179 # define colorBackground globalsBlock.color_background
180 # define colorBackgroundGradient globalsBlock.color_background_gradient
181 # define colorCheckerPrimary globalsBlock.color_checker_primary
182 # define colorCheckerSecondary globalsBlock.color_checker_secondary
183 # define colorClippingBorder globalsBlock.color_clipping_border
184 # define colorEditMeshMiddle globalsBlock.color_edit_mesh_middle
185 # define colorHandleFree globalsBlock.color_handle_free
186 # define colorHandleAuto globalsBlock.color_handle_auto
187 # define colorHandleVect globalsBlock.color_handle_vect
188 # define colorHandleAlign globalsBlock.color_handle_align
189 # define colorHandleAutoclamp globalsBlock.color_handle_autoclamp
190 # define colorHandleSelFree globalsBlock.color_handle_sel_free
191 # define colorHandleSelAuto globalsBlock.color_handle_sel_auto
192 # define colorHandleSelVect globalsBlock.color_handle_sel_vect
193 # define colorHandleSelAlign globalsBlock.color_handle_sel_align
194 # define colorHandleSelAutoclamp globalsBlock.color_handle_sel_autoclamp
195 # define colorNurbUline globalsBlock.color_nurb_uline
196 # define colorNurbVline globalsBlock.color_nurb_vline
197 # define colorNurbSelUline globalsBlock.color_nurb_sel_uline
198 # define colorNurbSelVline globalsBlock.color_nurb_sel_vline
199 # define colorActiveSpline globalsBlock.color_active_spline
200 # define colorBonePose globalsBlock.color_bone_pose
201 # define colorBonePoseActive globalsBlock.color_bone_pose_active
202 # define colorBonePoseActiveUnsel globalsBlock.color_bone_pose_active_unsel
203 # define colorBonePoseConstraint globalsBlock.color_bone_pose_constraint
204 # define colorBonePoseIK globalsBlock.color_bone_pose_ik
205 # define colorBonePoseSplineIK globalsBlock.color_bone_pose_spline_ik
206 # define colorBonePoseTarget globalsBlock.color_bone_pose_target
207 # define colorBoneSolid globalsBlock.color_bone_solid
208 # define colorBoneLocked globalsBlock.color_bone_locked
209 # define colorBoneActive globalsBlock.color_bone_active
210 # define colorBoneActiveUnsel globalsBlock.color_bone_active_unsel
211 # define colorBoneSelect globalsBlock.color_bone_select
212 # define colorBoneIKLine globalsBlock.color_bone_ik_line
213 # define colorBoneIKLineNoTarget globalsBlock.color_bone_ik_line_no_target
214 # define colorBoneIKLineSpline globalsBlock.color_bone_ik_line_spline
215 # define colorText globalsBlock.color_text
216 # define colorTextHi globalsBlock.color_text_hi
217 # define colorBundleSolid globalsBlock.color_bundle_solid
218 # define colorMballRadius globalsBlock.color_mball_radius
219 # define colorMballRadiusSelect globalsBlock.color_mball_radius_select
220 # define colorMballStiffness globalsBlock.color_mball_stiffness
221 # define colorMballStiffnessSelect globalsBlock.color_mball_stiffness_select
222 # define colorCurrentFrame globalsBlock.color_current_frame
223 # define colorGrid globalsBlock.color_grid
224 # define colorGridEmphasis globalsBlock.color_grid_emphasis
225 # define colorGridAxisX globalsBlock.color_grid_axis_x
226 # define colorGridAxisY globalsBlock.color_grid_axis_y
227 # define colorGridAxisZ globalsBlock.color_grid_axis_z
228 # define colorFaceBack globalsBlock.color_face_back
229 # define colorFaceFront globalsBlock.color_face_front
230 # define colorUVShadow globalsBlock.color_uv_shadow
231 # define screenVecs globalsBlock.screen_vecs
232 # define sizeViewport globalsBlock.size_viewport.xy
233 # define sizePixel globalsBlock.size_pixel
234 # define pixelFac globalsBlock.pixel_fac
235 # define sizeObjectCenter globalsBlock.size_object_center
236 # define sizeLightCenter globalsBlock.size_light_center
237 # define sizeLightCircle globalsBlock.size_light_circle
238 # define sizeLightCircleShadow globalsBlock.size_light_circle_shadow
239 # define sizeVertex globalsBlock.size_vertex
240 # define sizeEdge globalsBlock.size_edge
241 # define sizeEdgeFix globalsBlock.size_edge_fix
242 # define sizeFaceDot globalsBlock.size_face_dot
243 # define sizeChecker globalsBlock.size_checker
244 # define sizeVertexGpencil globalsBlock.size_vertex_gpencil
245 #endif
246 
247 /* See: 'draw_cache_impl.h' for matching includes. */
248 #define VERT_GPENCIL_BEZT_HANDLE (1 << 30)
249 /* data[0] (1st byte flags) */
250 #define FACE_ACTIVE (1 << 0)
251 #define FACE_SELECTED (1 << 1)
252 #define FACE_FREESTYLE (1 << 2)
253 #define VERT_UV_SELECT (1 << 3)
254 #define VERT_UV_PINNED (1 << 4)
255 #define EDGE_UV_SELECT (1 << 5)
256 #define FACE_UV_ACTIVE (1 << 6)
257 #define FACE_UV_SELECT (1 << 7)
258 /* data[1] (2st byte flags) */
259 #define VERT_ACTIVE (1 << 0)
260 #define VERT_SELECTED (1 << 1)
261 #define VERT_SELECTED_BEZT_HANDLE (1 << 2)
262 #define EDGE_ACTIVE (1 << 3)
263 #define EDGE_SELECTED (1 << 4)
264 #define EDGE_SEAM (1 << 5)
265 #define EDGE_SHARP (1 << 6)
266 #define EDGE_FREESTYLE (1 << 7)
267 
268 #define COMMON_GLOBALS_LIB
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition: BLI_assert.h:86
float float4[4]