it is interesting to note the old r600 driver was already doing this way and the comments say:
When alpha test is enabled we can't trust the hw to make the proper decision on the order in which ztest should be run related to fragment shader execution.
If alpha test is enabled perform early z rejection (RE_Z) but don't early write to the zbuffer. Write to zbuffer is delayed after fragment shader execution and thus after alpha test so if discarded by the alpha test the z value is not written.
If ReZ is enabled, and the zfunc/zenable/zwrite values change you can get a hang unless you flush the DB in between. For now just use LATE_Z.
If alpha test is enabled perform z test after fragment. RE_Z (early z test but no write to the zbuffer) seems to cause lockup on r6xx/r7xx
If alpha test is enabled perform early z rejection (RE_Z) but don't early write to the zbuffer. Write to zbuffer is delayed after fragment shader execution and thus after alpha test so if discarded by the alpha test the z value is not written.
If ReZ is enabled, and the zfunc/zenable/zwrite values change you can get a hang unless you flush the DB in between. For now just use LATE_Z.
If alpha test is enabled perform z test after fragment. RE_Z (early z test but no write to the zbuffer) seems to cause lockup on r6xx/r7xx
Comment