Draw-layers (for the lack of a better term) allow separating different drawing
"steps" so that they can be updated indepenently. After drawing a layer, we
blit it into a texture that we keep around as a cache. In the end we
"composite" everything together using simple alpha-over drawing.
Jeroen initially raised the point that background images might have issues with
this, but I couldn't find any issues on a quick test.
- Add separate region redraw tag for UI overlays (gizmos)
- Initial introduction of DRWLayer abstraction
- Draw-layers work with multiple viewports
To not increase GPU memory too much, in this implementation only layers of a single viewport are cached. If we notice that the viewport changed, a full redraw is triggered.
- Only cache framebuffers for layers that aren't always redrawn
It's useless to have a cache for layers that are always redrawn. So we don't create one for them, but draw them directly into the default framebuffer when cached ones are alpha-over'ed.
The following comparison shows how visual glitches due to anti-aliasing and laggy feedback is fixed when interacting with gizmos only (old vs. new):
GPU memory usage is increased by a few MB for a full redraw (reduced for partial ones).
- This patch:
|Full Redraw||Editor overlay only redraw|