diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-03-30 22:23:58 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-03-30 22:23:58 +0300 |
commit | 142541124976af41f08fb5479886350c2d803710 (patch) | |
tree | 6ee06d11f3179f4d704a20531f91541a4a15094e /source/blender/draw | |
parent | da1b002c8d2f331d97458167746e5974d8556799 (diff) |
Cleanup/Refactor: Unify functions that redraw the depth buffer
Now `ED_view3d_backbuf_depth_validate`, `ED_view3d_draw_depth` and
`ED_view3d_draw_depth_gpencil` are unified in `ED_view3d_depth_override`.
This new function replaces `ED_view3d_autodist_init`.
Also, since `ED_view3d_depth_update` depends on the render context, and
changing the context is a slow operation, that function also was removed,
and the depth buffer cached is now updated inside the new unified drawing
function when the "bool update_cache" parameter is true.
Finally `V3D_INVALID_BACKBUF` flag has been renamed and moved to
`runtime.flag`.
Differential revision: https://developer.blender.org/D10678
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/DRW_engine.h | 3 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 9 |
2 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 2d5b93f4272..8a35ab2aeb9 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -118,8 +118,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, void DRW_draw_depth_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, - struct GPUViewport *viewport, - bool use_opengl_context); + struct GPUViewport *viewport); void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index a088c27d3f3..c09b4719f3a 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2601,8 +2601,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, void DRW_draw_depth_loop(struct Depsgraph *depsgraph, ARegion *region, View3D *v3d, - GPUViewport *viewport, - bool use_opengl_context) + GPUViewport *viewport) { /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); @@ -2618,7 +2617,7 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph, } } - drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, use_opengl_context); + drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, false); } /** @@ -2634,7 +2633,7 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, use_drw_engine(&draw_engine_gpencil_type); - drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, true); + drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, false); } void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect) @@ -2725,7 +2724,6 @@ void DRW_draw_depth_object( { RegionView3D *rv3d = region->regiondata; - DRW_opengl_context_enable(); GPU_matrix_projection_set(rv3d->winmat); GPU_matrix_set(rv3d->viewmat); GPU_matrix_mul(object->obmat); @@ -2784,7 +2782,6 @@ void DRW_draw_depth_object( GPU_matrix_set(rv3d->viewmat); GPU_depth_test(GPU_DEPTH_NONE); GPU_framebuffer_restore(); - DRW_opengl_context_disable(); } /** \} */ |