From 52f83011c8f0f4219cfc6b3a1b2d2e7104391f82 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Mon, 5 Aug 2019 11:04:05 -0300 Subject: Fix T67259 : Auto depth not working with multires in sculpt mode Basically the solution is to call `DRW_shgroup_call_sculpt` when `BKE_sculptsession_use_pbvh_draw(...)` is true. Ref T67259 Reviewers: fclem, jbakker, brecht Reviewed By: fclem, brecht Maniphest Tasks: T67259 Differential Revision: https://developer.blender.org/D5396 --- source/blender/draw/engines/basic/basic_engine.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index dd7f4683ce0..f548bd15bf4 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -25,6 +25,7 @@ #include "DRW_render.h" +#include "BKE_paint.h" #include "BKE_particle.h" #include "DNA_particle_types.h" @@ -161,13 +162,19 @@ static void basic_cache_populate(void *vedata, Object *ob) } } - struct GPUBatch *geom = DRW_cache_object_surface_get(ob); - if (geom) { - const bool do_cull = (draw_ctx->v3d && - (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING)); - /* Depth Prepass */ - DRW_shgroup_call( - (do_cull) ? stl->g_data->depth_shgrp_cull : stl->g_data->depth_shgrp, geom, ob); + const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d); + const bool do_cull = (draw_ctx->v3d && + (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING)); + DRWShadingGroup *shgrp = (do_cull) ? stl->g_data->depth_shgrp_cull : stl->g_data->depth_shgrp; + + if (use_sculpt_pbvh) { + DRW_shgroup_call_sculpt(shgrp, ob, false, false, false); + } + else { + struct GPUBatch *geom = DRW_cache_object_surface_get(ob); + if (geom) { + DRW_shgroup_call(shgrp, geom, ob); + } } } -- cgit v1.2.3