diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-07-25 19:34:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-07-25 19:35:27 +0300 |
commit | 2b1cd24c6ebacb17032914c0897038cd7e63b07b (patch) | |
tree | 7b00be073b41b63de7b255620eed2ecdca115b91 /source/blender/draw | |
parent | 80e03e77099ba963cbc08545f0f28fe02e885110 (diff) |
Fix T52190: Depth picking fails
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/basic/basic_engine.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index d1afb0b4a1e..cc78a43912e 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -206,21 +206,42 @@ static void BASIC_draw_scene(void *vedata) BASIC_PassList *psl = ((BASIC_Data *)vedata)->psl; BASIC_FramebufferList *fbl = ((BASIC_Data *)vedata)->fbl; DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); + const bool is_select = DRW_state_is_select(); + + bool use_color = true; + bool use_depth = true; + bool use_depth_cull = true; + + if (is_select) { + /* Needed for depth-picking, + * for other selection types there are no need for extra passes either. */ + use_color = false; + use_depth_cull = false; + } #ifdef USE_DEPTH /* Pass 1 : Depth pre-pass */ - DRW_draw_pass(psl->depth_pass); - DRW_draw_pass(psl->depth_pass_cull); + if (use_depth) { + DRW_draw_pass(psl->depth_pass); + } + + if (use_depth_cull) { + DRW_draw_pass(psl->depth_pass_cull); + } /* Pass 2 : Duplicate depth */ - /* Unless we go for deferred shading we need this to avoid manual depth test and artifacts */ - if (DRW_state_is_fbo()) { - DRW_framebuffer_blit(dfbl->default_fb, fbl->dupli_depth, true); + if (use_depth || use_depth_cull) { + /* Unless we go for deferred shading we need this to avoid manual depth test and artifacts */ + if (DRW_state_is_fbo()) { + DRW_framebuffer_blit(dfbl->default_fb, fbl->dupli_depth, true); + } } #endif /* Pass 3 : Shading */ - DRW_draw_pass(psl->color_pass); + if (use_color) { + DRW_draw_pass(psl->color_pass); + } } static void BASIC_engine_free(void) |