Possible nv30 emulation bug?

I think there may be a bug in the nv30 emulation as when I enable a simple fragment program, to simply write out the incomming color, the z-values written are slightly different than if the fragment program is not enabled.

What I did to test was this:

-Setup z-buffer tests as usual
-Enable the simple fragment program
-Render geometry
-Disable fragment program

-Clear the color buffer
-Set z-buffer test to GL_EQUAL
-Render the geometry again

(Note that I am not touching the out-put z value in the fragment program and no vertex programs are enabled. )

The out-put of this is the common horrible z-fighting. Disabling the fragment program produces the expected results.

It was my understanding that the fragment programs produced the same z-buffer out-put if the z value was not written to. Am I correct in assuming this?

BTW my driver version is 40.41

I believe that when you use the fragment program, rasterisation is performed in software. When you don’t, it is done in hardware. Hence the depth invariance. I had the same problems using EXT_stencil_two_side for shadow volumes.
Tick the “Force Software Rasterisation” button on the nv30 emulation app. That should fix it.

The NV30 emulation support in the 40.XX NVIDIA drivers uses your existing hardware whenever possible. We will fall back to software only if you try to use functionality not supported on your current card.

If you are running a multipass algorithm where only some passes use the emulated feature, this is generally not what you want. As bakery2k suggests, you should force software rasterization in that case.