diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-12-02 03:40:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-12-02 15:15:52 +0300 |
commit | 9516921c05bd9fee5c94942eb8e38f47ba7e4351 (patch) | |
tree | da007fc17bc6a02f849dae2e8f76f5ab304fe4dc /source/blender/draw/intern/shaders/common_globals_lib.glsl | |
parent | 1f6c3699a836d485ed37f443cd0fcd19e978dbb6 (diff) |
Overlay Engine: Refactor & Cleanup
This is the unification of all overlays into one overlay engine as described in T65347.
I went over all the code making it more future proof with less hacks and removing old / not relevent parts.
Goals / Acheivements:
- Remove internal shader usage (only drw shaders)
- Remove viewportSize and viewportSizeInv and put them in gloabl ubo
- Fixed some drawing issues: Missing probe option and Missing Alt+B clipping of some shader
- Remove old (legacy) shaders dependancy (not using view UBO).
- Less shader variation (less compilation time at first load and less patching needed for vulkan)
- removed some geom shaders when I could
- Remove static e_data (except shaders storage where it is OK)
- Clear the way to fix some anoying limitations (dithered transparency, background image compositing etc...)
- Wireframe drawing now uses the same batching capabilities as workbench & eevee (indirect drawing).
- Reduced complexity, removed ~3000 Lines of code in draw (also removed a lot of unused shader in GPU).
- Post AA to avoid complexity and cost of MSAA.
Remaining issues:
- ~~Armature edits, overlay toggles, (... others?) are not refreshing viewport after AA is complete~~
- FXAA is not the best for wires, maybe investigate SMAA
- Maybe do something more temporally stable for AA.
- ~~Paint overlays are not working with AA.~~
- ~~infront objects are difficult to select.~~
- ~~the infront wires sometimes goes through they solid counterpart (missing clear maybe?) (toggle overlays on-off when using infront+wireframe overlay in solid shading)~~
Note: I made some decision to change slightly the appearance of some objects to simplify their drawing. Namely the empty arrows end (which is now hollow/wire) and distance points of the cameras/spots being done by lines.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6296
Diffstat (limited to 'source/blender/draw/intern/shaders/common_globals_lib.glsl')
-rw-r--r-- | source/blender/draw/intern/shaders/common_globals_lib.glsl | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/source/blender/draw/intern/shaders/common_globals_lib.glsl b/source/blender/draw/intern/shaders/common_globals_lib.glsl new file mode 100644 index 00000000000..151932a3b47 --- /dev/null +++ b/source/blender/draw/intern/shaders/common_globals_lib.glsl @@ -0,0 +1,108 @@ +#define COMMON_GLOBALS_LIB + +/* keep in sync with GlobalsUboStorage */ +layout(std140) uniform globalsBlock +{ + vec4 colorWire; + vec4 colorWireEdit; + vec4 colorActive; + vec4 colorSelect; + vec4 colorDupliSelect; + vec4 colorDupli; + vec4 colorLibrarySelect; + vec4 colorLibrary; + vec4 colorTransform; + vec4 colorLight; + vec4 colorSpeaker; + vec4 colorCamera; + vec4 colorCameraPath; + vec4 colorEmpty; + vec4 colorVertex; + vec4 colorVertexSelect; + vec4 colorVertexUnreferenced; + vec4 colorVertexMissingData; + vec4 colorEditMeshActive; + vec4 colorEdgeSelect; + vec4 colorEdgeSeam; + vec4 colorEdgeSharp; + vec4 colorEdgeCrease; + vec4 colorEdgeBWeight; + vec4 colorEdgeFaceSelect; + vec4 colorEdgeFreestyle; + vec4 colorFace; + vec4 colorFaceSelect; + vec4 colorFaceFreestyle; + vec4 colorNormal; + vec4 colorVNormal; + vec4 colorLNormal; + vec4 colorFaceDot; + vec4 colorSkinRoot; + vec4 colorDeselect; + vec4 colorOutline; + vec4 colorLightNoAlpha; + + vec4 colorBackground; + vec4 colorEditMeshMiddle; + + vec4 colorHandleFree; + vec4 colorHandleAuto; + vec4 colorHandleVect; + vec4 colorHandleAlign; + vec4 colorHandleAutoclamp; + vec4 colorHandleSelFree; + vec4 colorHandleSelAuto; + vec4 colorHandleSelVect; + vec4 colorHandleSelAlign; + vec4 colorHandleSelAutoclamp; + vec4 colorNurbUline; + vec4 colorNurbVline; + vec4 colorNurbSelUline; + vec4 colorNurbSelVline; + vec4 colorActiveSpline; + + vec4 colorBonePose; + + vec4 colorCurrentFrame; + + vec4 colorGrid; + vec4 colorGridEmphasise; + vec4 colorGridAxisX; + vec4 colorGridAxisY; + vec4 colorGridAxisZ; + + vec4 screenVecs[2]; + vec4 sizeViewport; /* Inverted size in zw. */ + + float sizePixel; /* This one is for dpi scalling */ + float pixelFac; /* To use with mul_project_m4_v3_zfac() */ + float sizeObjectCenter; + float sizeLightCenter; + float sizeLightCircle; + float sizeLightCircleShadow; + float sizeVertex; + float sizeEdge; + float sizeEdgeFix; + float sizeFaceDot; + + float pad_globalsBlock; +}; + +#define sizeViewportInv (sizeViewport.zw) + +/* data[0] (1st byte flags) */ +#define FACE_ACTIVE (1 << 0) +#define FACE_SELECTED (1 << 1) +#define FACE_FREESTYLE (1 << 2) +#define VERT_UV_SELECT (1 << 3) +#define VERT_UV_PINNED (1 << 4) +#define EDGE_UV_SELECT (1 << 5) +#define FACE_UV_ACTIVE (1 << 6) +#define FACE_UV_SELECT (1 << 7) +/* data[1] (2st byte flags) */ +#define VERT_ACTIVE (1 << 0) +#define VERT_SELECTED (1 << 1) +#define EDGE_ACTIVE (1 << 2) +#define EDGE_SELECTED (1 << 3) +#define EDGE_SEAM (1 << 4) +#define EDGE_SHARP (1 << 5) +#define EDGE_FREESTYLE (1 << 6) |