Currently in blender 2.8, to adapt the Cycles engine with the elements in view3d (grid, lamps, outline, wire ...), the depth of all objects are drawn in draw_manager.c
However this solution is appropriate for external render_engines that only pass RGBA values. If an engine also informs the Z-buffer, the depth pass in the draw_manager should be ignored.
Therefore, it is convenient for the depth of the draw_manager to be toggleable.
So this patch proposes to separate the depth of the external_engine.c thus making a new internal engine called depth_only_engine.
This other internal engine is added when the new bool bf_use_internal_depth is True.
This solution only solves the visual aspect of an external render engine. The selection continues using the internal geometry of each object.