tgsi/ureg: make the dst register match the src indirection
[mesa.git] / src / gallium / auxiliary / draw / draw_cliptest_tmp.h
index bff266b8f98de6f61c34827938decd269f3ff528..48f234931cdcd24fd1f97df0bfae3bf63b4b02ba 100644 (file)
@@ -129,6 +129,10 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
          need_pipeline |= out->clipmask;
       }
 
+      /*
+       * Transform the vertex position from clip coords to window coords,
+       * if the vertex is unclipped.
+       */
       if ((flags & DO_VIEWPORT) && mask == 0)
       {
         /* divide by w */
@@ -140,6 +144,18 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
         position[2] = position[2] * w * scale[2] + trans[2];
         position[3] = w;
       }
+#ifdef DEBUG
+      /* For debug builds, set the clipped vertex's window coordinate
+       * to NaN to help catch potential errors later.
+       */
+      else {
+         float zero = 0.0f;
+         position[0] =
+         position[1] =
+         position[2] =
+         position[3] = zero / zero; /* MSVC doesn't accept 0.0 / 0.0 */
+      }
+#endif
 
       if ((flags & DO_EDGEFLAG) && ef) {
          const float *edgeflag = out->data[ef];