Page MenuHome

Draw-manager: Introduce draw-layers to decouple gizmo and scene drawing

Authored by Julian Eisel (Severin) on Jan 27 2020, 4:58 PM.



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).

  • Master:
  • This patch:
Full RedrawEditor overlay only redraw

Diff Detail

rB Blender
Build Status
Buildable 6396
Build 6396: arc lint + arc unit

Event Timeline

Clément Foucault (fclem) requested changes to this revision.Jan 27 2020, 5:15 PM

I already detected a few problems but I would suggest to see what I did in the draw-colormanagement branch. I already have a separate buffer for overlays.

I think the tagging part of your patch can be reuse and just use what I did in draw-colormanagement. I would prefer the engines to do the caching not the draw manager.

For even caching overlays, you can force the use of the AA pass in overlay_antialiasing.c which will render most of the overlays into another buffer and cache this buffer.

The overall layering system in this patch seems way too over-engineered.

This revision now requires changes to proceed.Jan 27 2020, 5:15 PM
Julian Eisel (Severin) edited the summary of this revision. (Show Details)Jan 27 2020, 5:22 PM

Closing since this will have to be redone to make use of the draw manager changes.