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