Commit: c98268d3f56dd6d448584872c00aceda6b91ccfe Author: Germano Cavalcante Date: Thu Oct 6 15:00:35 2022 -0300 Branches: blender-v3.3-release https://developer.blender.org/rBc98268d3f56dd6d448584872c00aceda6b91ccfe
DRW: fix use of potentially uninitialized variable Bug introduced in rB6774cae3f25b. This causes undefined behavior in `DRW_state_draw_support()` making overlay depth drawing unpredictable. =================================================================== M source/blender/draw/DRW_engine.h M source/blender/draw/intern/draw_manager.c M source/blender/editors/space_view3d/view3d_draw.c =================================================================== diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index dec7a22aadb..8c5f1b70cc0 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -126,14 +126,10 @@ 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); -/** - * Converted from #ED_view3d_draw_depth_gpencil (legacy drawing). - */ -void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, - struct ARegion *region, - struct View3D *v3d, - struct GPUViewport *viewport); + struct GPUViewport *viewport, + const bool use_gpencil, + const bool use_basic, + const bool use_overlay); /** * Clears the Depth Buffer and draws only the specified object. */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index b2422504825..fcada20e5fb 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2534,13 +2534,13 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, /** * object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing). */ -static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, - ARegion *region, - View3D *v3d, - GPUViewport *viewport, - const bool use_gpencil, - const bool use_basic, - const bool use_overlay) +void DRW_draw_depth_loop(struct Depsgraph *depsgraph, + ARegion *region, + View3D *v3d, + GPUViewport *viewport, + const bool use_gpencil, + const bool use_basic, + const bool use_overlay) { Scene *scene = DEG_get_evaluated_scene(depsgraph); RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); @@ -2649,23 +2649,6 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, drw_manager_exit(&DST); } -void DRW_draw_depth_loop(struct Depsgraph *depsgraph, - ARegion *region, - View3D *v3d, - GPUViewport *viewport) -{ - drw_draw_depth_loop_impl( - depsgraph, region, v3d, viewport, false, true, DRW_state_draw_support()); -} - -void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, - ARegion *region, - View3D *v3d, - GPUViewport *viewport) -{ - drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, true, false, false); -} - void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect) { SELECTID_Context *sel_ctx = DRW_select_engine_context_get(); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index df5ff163cf2..f854b5d18af 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2332,10 +2332,11 @@ void ED_view3d_depth_override(Depsgraph *depsgraph, if (viewport != NULL) { switch (mode) { case V3D_DEPTH_NO_GPENCIL: - DRW_draw_depth_loop(depsgraph, region, v3d, viewport); + DRW_draw_depth_loop( + depsgraph, region, v3d, viewport, false, true, (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0); break; case V3D_DEPTH_GPENCIL_ONLY: - DRW_draw_depth_loop_gpencil(depsgraph, region, v3d, viewport); + DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, false, false); break; case V3D_DEPTH_OBJECT_ONLY: DRW_draw_depth_object( _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs