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.
This commit is contained in:
Germano Cavalcante 2022-10-06 15:00:35 -03:00 committed by Philipp Oeser
parent 86f8898ccd
commit c98268d3f5
Notes: blender-bot 2023-12-08 16:39:08 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
3 changed files with 14 additions and 34 deletions

View File

@ -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.
*/

View File

@ -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();

View File

@ -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(