Fix T94728: Auto Depth problem with Cliping Region
Issue introduced in rB1d49293b80446b89b5b12fa0eeefaf14e5051e48 `drw_manager_init` must be called after `drw_context_state_init` as `DST.draw_ctx.sh_cfg` (indicating when the view is clipped) must be set first. Differential Revision: https://developer.blender.org/D13795
This commit is contained in:
parent
fc0f315106
commit
6774cae3f2
Notes:
blender-bot
2023-02-14 07:25:46 +01:00
Referenced by commit 0d0e2dc0a8
, DRW: fix use of potentially uninitialized variable
Referenced by issue #94728, Auto Depth problem with Cliping Region
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
|
@ -2534,13 +2534,19 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
|||
static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport)
|
||||
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);
|
||||
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
/* Reset before using it. */
|
||||
drw_state_prepare_clean_for_draw(&DST);
|
||||
|
||||
DST.options.is_depth = true;
|
||||
|
||||
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
|
||||
|
@ -2555,6 +2561,18 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph,
|
|||
.depsgraph = depsgraph,
|
||||
};
|
||||
drw_context_state_init();
|
||||
drw_manager_init(&DST, viewport, NULL);
|
||||
|
||||
if (use_gpencil) {
|
||||
use_drw_engine(&draw_engine_gpencil_type);
|
||||
}
|
||||
if (use_basic) {
|
||||
drw_engines_enable_basic();
|
||||
}
|
||||
if (use_overlay) {
|
||||
drw_engines_enable_overlays();
|
||||
}
|
||||
|
||||
drw_task_graph_init();
|
||||
|
||||
/* Setup frame-buffer. */
|
||||
|
@ -2629,26 +2647,8 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
|
|||
View3D *v3d,
|
||||
GPUViewport *viewport)
|
||||
{
|
||||
/* Reset before using it. */
|
||||
drw_state_prepare_clean_for_draw(&DST);
|
||||
|
||||
/* Required by `drw_manager_init()` */
|
||||
DST.draw_ctx.region = region;
|
||||
DST.draw_ctx.rv3d = region->regiondata;
|
||||
drw_manager_init(&DST, viewport, NULL);
|
||||
|
||||
/* Get list of enabled engines */
|
||||
{
|
||||
/* Required by `DRW_state_draw_support()` */
|
||||
DST.draw_ctx.v3d = v3d;
|
||||
|
||||
drw_engines_enable_basic();
|
||||
if (DRW_state_draw_support()) {
|
||||
drw_engines_enable_overlays();
|
||||
}
|
||||
}
|
||||
|
||||
drw_draw_depth_loop_impl(depsgraph, region, v3d, 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,
|
||||
|
@ -2656,17 +2656,7 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
|
|||
View3D *v3d,
|
||||
GPUViewport *viewport)
|
||||
{
|
||||
/* Reset before using it. */
|
||||
drw_state_prepare_clean_for_draw(&DST);
|
||||
|
||||
/* Required by `drw_manager_init()` */
|
||||
DST.draw_ctx.region = region;
|
||||
DST.draw_ctx.rv3d = region->regiondata;
|
||||
drw_manager_init(&DST, viewport, NULL);
|
||||
|
||||
use_drw_engine(&draw_engine_gpencil_type);
|
||||
|
||||
drw_draw_depth_loop_impl(depsgraph, region, v3d, 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)
|
||||
|
|
Loading…
Reference in New Issue