A tangent from this thread.
So the problem is that you can't get the final visibility information back (from after alpha testing) into the "z block" without stalling the whole pipeline. Correct?
And you can't do the z updates inside the "z block" the usual way because you'd produce false positives (culled even though visible).
But ... what about just not updating the "z block" internal data while alpha testing is active? No updates would mean no false positives. You'd still be able to vis cull alpha tested fragments against "old" fragments that have been rendered without alpha test AFAICS. And there are circumstances that do not require you to update regardless: depth test=EQUAL; and anything with depth writes masked off. That should be pretty common during multipass rendering (all passes except for the first one).
All of this would, of course, require that a proper z test and (external) z buffer update happen after the alpha test. Isn't such a "fallback" z test facility at the end of the pipe already, exactly for such cases as alpha testing? Or is this the same "z block" that -- by some magic I do not understand -- changes its position in the pipeline?
That much I knewSimon F said:Early Z effectively does the Z testing before the far more expensive texturing operation thus can save some otherwise redundant work.
It can't be used with alpha testing as that requires you to texture before deciding if you need to do the Z test.
With alpha testing, visibility is a function of (amongst other things) the texturing operation. You can only update the Z buffer if the pixel is visible.
That was the direction I was going in with my theory ...Simon F said:AHHH! I think I know why you're confused. Consider what would happen with the next object, i.e the following an alpha tested object, if you didn't do all the operations on the alpha tested object first.
So the problem is that you can't get the final visibility information back (from after alpha testing) into the "z block" without stalling the whole pipeline. Correct?
And you can't do the z updates inside the "z block" the usual way because you'd produce false positives (culled even though visible).
But ... what about just not updating the "z block" internal data while alpha testing is active? No updates would mean no false positives. You'd still be able to vis cull alpha tested fragments against "old" fragments that have been rendered without alpha test AFAICS. And there are circumstances that do not require you to update regardless: depth test=EQUAL; and anything with depth writes masked off. That should be pretty common during multipass rendering (all passes except for the first one).
All of this would, of course, require that a proper z test and (external) z buffer update happen after the alpha test. Isn't such a "fallback" z test facility at the end of the pipe already, exactly for such cases as alpha testing? Or is this the same "z block" that -- by some magic I do not understand -- changes its position in the pipeline?