diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-02-26 21:41:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-02-26 21:41:17 +0300 |
commit | 13261304a331b4cff37de477ddf19c915ed64b2c (patch) | |
tree | 3660f94436af2e4d44d8310247280ab456243543 /source/blender/draw/intern/draw_cache.c | |
parent | 0940e89e604d85d717f792b73e30e5e96a42e7c6 (diff) |
DRW: Add new Draw Manager OpenGL Context.
This separate context allows two things:
- It allows viewports in multi-windows configuration.
- F12 render can use this context in a separate thread and do a non-blocking render.
The downside is that the context cannot be used while rendering so a request to refresh a viewport will lock the UI. This is something that will be adressed in the future.
Under the hood what does that mean:
- Not adding more mess with VAOs management in gawain.
- Doing depth only draw for operators / selection needs to be done in an offscreen buffer.
- The 3D cursor "autodis" operator is still reading the backbuffer so we need to copy the result to it.
- All FBOs needed by the drawmanager must to be created/destroyed with its context active.
- We cannot use batches created for UI in the DRW context and vice-versa. There is a clear separation of resources that enables the use of safe multi-threading.
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 3b4180c0375..6b1a3356b51 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -45,6 +45,7 @@ static struct DRWShapeCache { Gwn_Batch *drw_single_vertice; Gwn_Batch *drw_fullscreen_quad; Gwn_Batch *drw_quad; + Gwn_Batch *drw_sphere; Gwn_Batch *drw_screenspace_circle; Gwn_Batch *drw_plain_axes; Gwn_Batch *drw_single_arrow; @@ -266,7 +267,6 @@ Gwn_Batch *DRW_cache_fullscreen_quad_get(void) Gwn_Batch *DRW_cache_quad_get(void) { if (!SHC.drw_quad) { - /* Use a triangle instead of a real quad */ float pos[4][2] = {{-1.0f, -1.0f}, { 1.0f, -1.0f}, {1.0f, 1.0f}, {-1.0f, 1.0f}}; float uvs[4][2] = {{ 0.0f, 0.0f}, { 1.0f, 0.0f}, {1.0f, 1.0f}, { 0.0f, 1.0f}}; @@ -294,7 +294,10 @@ Gwn_Batch *DRW_cache_quad_get(void) /* Sphere */ Gwn_Batch *DRW_cache_sphere_get(void) { - return GPU_batch_preset_sphere(2); + if (!SHC.drw_sphere) { + SHC.drw_sphere = gpu_batch_sphere(32, 24); + } + return SHC.drw_sphere; } /** \} */ |