Fix #119244: Auto-Depth fails when we have arrow gizmos in the 3D View
Caused by dd0e60fb51
That commit was an optimization attempt to reuse the depth buffer
updated by the engines.
But it fails when `GPU_clear_depth` is called for gizmos.
So, due to error proneness, revert that solution for now.
This commit is contained in:
@@ -188,7 +188,7 @@ enum eV3DDepthOverrideMode {
|
||||
};
|
||||
/**
|
||||
* Redraw the viewport depth buffer.
|
||||
* Call #view3d_has_depth_buffer_being_used if you want to check if the viewport already has depth
|
||||
* Call #ED_view3d_has_depth_buffer_updated if you want to check if the viewport already has depth
|
||||
* buffer updated.
|
||||
*/
|
||||
void ED_view3d_depth_override(Depsgraph *depsgraph,
|
||||
@@ -211,7 +211,7 @@ bool ED_view3d_depth_unproject_v3(const ARegion *region,
|
||||
double depth,
|
||||
float r_location_world[3]);
|
||||
|
||||
bool ED_view3d_has_depth_buffer_being_used(const Depsgraph *depsgraph, const View3D *v3d);
|
||||
bool ED_view3d_has_depth_buffer_updated(const Depsgraph *depsgraph, const View3D *v3d);
|
||||
|
||||
/**
|
||||
* Utilities to perform navigation.
|
||||
|
||||
@@ -2439,8 +2439,15 @@ void ED_view3d_depths_free(ViewDepths *depths)
|
||||
MEM_freeN(depths);
|
||||
}
|
||||
|
||||
bool ED_view3d_has_depth_buffer_being_used(const Depsgraph *depsgraph, const View3D *v3d)
|
||||
bool ED_view3d_has_depth_buffer_updated(const Depsgraph *depsgraph, const View3D *v3d)
|
||||
{
|
||||
#ifdef REUSE_DEPTH_BUFFER
|
||||
/* Check if the depth buffer was drawn by any engine and thus can be reused.
|
||||
*
|
||||
* The idea is good, but it is too error prone.
|
||||
* Even when updated by an engine, the depth buffer can still be cleared by drawing callbacks and
|
||||
* by the GPU_select API used by gizmos.
|
||||
* Check #GPU_clear_depth to track when the depth buffer is cleared. */
|
||||
const char *engine_name = DEG_get_evaluated_scene(depsgraph)->r.engine;
|
||||
RenderEngineType *engine_type = RE_engines_find(engine_name);
|
||||
|
||||
@@ -2459,6 +2466,10 @@ bool ED_view3d_has_depth_buffer_being_used(const Depsgraph *depsgraph, const Vie
|
||||
return is_viewport_preview_solid || is_viewport_preview_material || is_viewport_wire_no_xray ||
|
||||
is_viewport_render_eevee || is_viewport_render_workbench ||
|
||||
is_viewport_render_external_with_overlay;
|
||||
#else
|
||||
UNUSED_VARS(depsgraph, v3d);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -206,7 +206,7 @@ static eViewOpsFlag navigate_pivot_get(bContext *C,
|
||||
float fallback_depth_pt[3];
|
||||
negate_v3_v3(fallback_depth_pt, static_cast<RegionView3D *>(region->regiondata)->ofs);
|
||||
|
||||
if (!ED_view3d_has_depth_buffer_being_used(depsgraph, v3d)) {
|
||||
if (!ED_view3d_has_depth_buffer_updated(depsgraph, v3d)) {
|
||||
ED_view3d_depth_override(depsgraph, region, v3d, nullptr, V3D_DEPTH_NO_GPENCIL, nullptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user