To avoid overdraw (shading the same pixel twice) it's beneficial to draw objects front to back. When you draw an object in the front the depth values are written to the depth buffer, then when you draw an object behind it the pixel can be rejected if it's depth value doesn't pass the comparison operation. However I've been wondering whether there's any benefit to depth sorting if you do a complete depth pre-pass. The only way I can see that there's a benefit to sorting front to back is if the testing of the depth is separate from the writing. Because the pixel depth value is read in order to compare it with the currently rasterised triangle the number then the number of depth buffer reads is ALWAYS the same, no matter whether rendering front to back or back to front.
However the number of writes to the depth buffer (to replace the value with a new lowest/highest value) does seem dependent on whether you sort front to back or back to front. I don't know much about it but I'm led to believe that the depth test and write are the same one operation (disabling depth tests also disables depth writes). If that's the case then sorting won't matter.
So does it make a difference? And if so or if not, why?
Also, consider whether there's a difference if the depth pass for an object has a fragment shader attached which writes to depth (which is necessary for alpha tested writes, such as chain link fences, trees, etc.) My intuition is that alpha tested objects won't make a difference, since if you write to the depth buffer, early depth test cannot be done, and therefore the fragment shader needs to run regardless. And so in this case the same question applies, except the depth is read and written at the end of the fragment shader execution, the question still being whether only testing (and not writing), is faster than both testing and writing (ie., is there benefit to depth sorting for depth prepass?).