This is consistent with how unused uniforms are used elsewhere (for example "sizeVertex").
Alternatively I would add the uniform for the depth only group too, and then add a comment for both explaining that it's unused, but I think that this is cleaner.
There's no need to use selection occlusion when xray is enabled, since it doesn't work anyway (and is a nice way of disabling selection occlusion without disabling the retopology overlay).
Since it's used in multiple places I decided to make a define, though only for v3d, not one that takes overlay because xray lives in shading.
First it draws the objects from the selection context object list like it used to, because apparently the order matters.
Then it draws non-edit objects from the depsgraph iterator; the order doesn't matter here because it's only for the depth pass.
Instead of offsetting edit meshes towards the view, I'm offsetting non-edit meshes away from the view.
Otherwise identical to how the retopology overlay works.
The selection engine now uses the depsgraph iterator instead of the list of objects stored in the selection context.
Objects that are not in edit mode are drawn into a separate shading group, which is part of the depth only pass.