I'm doing deferred lighting, where I have a gbuffer pass, followed by a main pass. For alpha tested objects, I would like to do the alpha test in the gbuffer pass, and then skip alpha test in the main pass by using a depth compare function of EQUAL. This way the main pass should only render on top of pixels that passed the alpha test during the gbuffer pass.
The problem is that I can't get the depth values to match exactly between passes. It works sometimes, on some machines, in some situations, but not all the time. As far as I know, I am passing the exact same data for all verts and relevant shader parameters (matrices, etc). Each pass has a different vertex shader, but they compute the output position in exactly the same way. Is there any way to make this work reliably in D3D9? Or will I just have to use LESSEQUAL in the main pass, with a possible depth bias?