This is a necessary change to emit the right instructions when writing
to result.depth.
However, even with this test, Z-write doesn't work properly, and I don't
fully understand why. In addition to this, we'll at least have to disable
early-Z, but even that doesn't seem to be enough.
argc = r300_fpop[op].argc;
if (REG_GET_TYPE(dest) == REG_TYPE_OUTPUT &&
- REG_GET_INDEX(dest) == FRAG_RESULT_DEPR)
- mask &= ~WRITEMASK_XYZ;
-
+ REG_GET_INDEX(dest) == FRAG_RESULT_DEPR) {
+ if (mask & WRITEMASK_Z) {
+ mask = WRITEMASK_W;
+ } else {
+ return;
+ }
+ }
+
emit_vop = GL_FALSE;
emit_sop = GL_FALSE;
if ((mask & WRITEMASK_XYZ) || vop == R300_FPI0_OUTC_DP3)