I am currently trying to understand why using discard inside of a fragment shader disables early z.
I am using a simple cutout shader, which discards fully transparent pixels.
In a scenario where I render two overlapping triangles (with one draw call), each with a texture containing a few fully transparent pixels (a sprite with a transparent background), in a front to back order, the early z test should be no problem for the front triangle. The fragment shader is called for each pixel of the first triangle and only the opaque pixels update the depth buffer.
After that, the back triangle will be rasterized. Now early z should also work, because the depth buffer is updated. For each pixel that should be visible after early z test the fragment shader simply gets executed, for those which don't it doesn't matter if they are discarded or not, because they do not update the depth buffer anyways.
Where exactly is my mistake? Does it not work because the triangles are rendered in parallel? That would confuse me even more because I know that for rendering translucent pixels the order is crucial.
Thank you!