WM: new offscreen window draw method to replace all existing methods.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 27 Apr 2018 08:22:37 +0000 (10:22 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 27 Apr 2018 10:14:14 +0000 (12:14 +0200)
commite01cadd657c76267266546781703df107c55f83a
treeaf6685123707af7cce17c74d681dcce378d4bc72
parent868c9ac408f75634c75bf4bc0b17c87b79d7af73
WM: new offscreen window draw method to replace all existing methods.

For Blender 2.8 we had to be compatible with very old OpenGL versions, and
triple buffer was designed to work without offscreen rendering, by copying
the the backbuffer to a texture right before swapping. This way we could
avoid redrawing unchanged regions by copying them from this texture on the
next redraws. Triple buffer used to suffer from poor performance and driver
bugs on specific cards, so alternative draw methods remained available.

Now that we require newer OpenGL, we can have just a single draw method
that draw each region into an offscreen buffer, and then draws those to
the screen. This has some advantages:

* Poor 3D view performance when using Region Overlap should be solved now,
  since we can also cache overlapping regions in offscreen buffers.
* Page flip, anaglyph and interlace stereo drawing can be a little faster
  by avoiding a copy to an intermediate texture.
* The new 3D view drawing already writes to an offscreen buffer, which we
  can draw from directly instead of duplicating it to another buffer.
* Eventually we will be able to remove depth and stencil buffers from the
  window and save memory, though at the moment there are still some tools
  using it so it's not possible yet.
* This also fixes a bug with Eevee sampling not progressing with stereo
  drawing in the 3D viewport.

Differential Revision: https://developer.blender.org/D3061
38 files changed:
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenkernel/BKE_screen.h
source/blender/blenkernel/intern/screen.c
source/blender/blenloader/intern/readfile.c
source/blender/draw/DRW_engine.h
source/blender/draw/intern/draw_manager.c
source/blender/editors/include/ED_screen.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_region_popup.c
source/blender/editors/interface/resources.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_draw.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_draw_legacy.c
source/blender/gpu/GPU_framebuffer.h
source/blender/gpu/GPU_viewport.h
source/blender/gpu/intern/gpu_framebuffer.c
source/blender/gpu/intern/gpu_shader.c
source/blender/gpu/intern/gpu_viewport.c
source/blender/makesdna/DNA_screen_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/makesrna/intern/rna_userdef.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_stereo.c
source/blender/windowmanager/intern/wm_subwindow.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm.h
source/blender/windowmanager/wm_draw.h