Page MenuHome

Refactor/Cleanup: Unify functions that redraw the depth buffer
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Mar 9 2021, 10:28 PM.

Details

Summary

This patch proposes to unify the functions that rewrite the 3DView's depth buffer
(ED_view3d_backbuf_depth_validate, ED_view3d_draw_depth
and ED_view3d_draw_depth_gpencil) in a new one called
ED_view3d_depth_override.

This new function is similar to the existing ED_view3d_autodist_init
so it was now removed and replaced.

Also, since ED_view3d_depth_update depends on the render context, and
changing the context is a slow operation, that function also was removed,
and the depth buffer cached is now updated inside the new unified drawing
function when the "bool update_cache" parameter is true.

Another thing that this patch changes is the V3D_INVALID_BACKBUF flag.
It is now V3D_RUNTIME_DEPTHBUF_OVERRIDDEN and is part of runtime.flag
as it does not need to be saved in the file.

So in summary, the functions indicated below have been replaced by
parameters of the new ED_view3d_depth_override:

ED_view3d_backbuf_depth_validate-> enum V3D_DEPTH_OBJECT_ONLY
ED_view3d_draw_depth-> enum V3D_DEPTH_NO_GPENCIL
ED_view3d_draw_depth_gpencil-> enum V3D_DEPTH_GPENCIL_ONLY
ED_view3d_depth_update-> bool update_cache

The ED_view3d_autodist_init utility was be replaced and removed.

ED_view3d_autodist_init-> ED_view3d_depth_override

And the V3D_INVALID_BACKBUF flag has been renamed and moved:

V3D_INVALID_BACKBUF-> V3D_RUNTIME_DEPTHBUF_OVERRIDDEN

Diff Detail

Repository
rB Blender

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Mar 9 2021, 10:28 PM
Germano Cavalcante (mano-wii) created this revision.
  • Fix wrong cache update
  • Fix OpenGL context being enabled twice and thus locking thread
Germano Cavalcante (mano-wii) retitled this revision from Cleanup: Unify functions that redraw the depth buffer to Refactor/Cleanup: Unify functions that redraw the depth buffer.Mar 22 2021, 6:00 PM
Germano Cavalcante (mano-wii) edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Mar 30 2021, 9:24 PM
This revision was automatically updated to reflect the committed changes.