i965/vs: Don't emit an extra copy of the vertex position.
authorEric Anholt <eric@anholt.net>
Fri, 5 Aug 2011 23:29:48 +0000 (16:29 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 16 Aug 2011 20:04:41 +0000 (13:04 -0700)
Fixes glsl-vs-abs-neg, glsl-vs-all-01, and probably many other tests.

src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 439969a..c4a3c8a 100644 (file)
@@ -1550,7 +1550,7 @@ vec4_visitor::emit_vue_header_gen4(int header_mrf)
        * dword 8-11 (m3) of the vertex header is the 4D space position
        * dword 12-19 (m4,m5) of the vertex header is the user clip distance.
        * m6 is a pad so that the vertex element data is aligned
-       * m7 is the first vertex data we fill, which is the vertex position.
+       * m7 is the first vertex data we fill.
        */
       current_annotation = "NDC";
       emit(BRW_OPCODE_MOV, brw_message_reg(header_mrf++), src_reg(ndc));
@@ -1561,15 +1561,14 @@ vec4_visitor::emit_vue_header_gen4(int header_mrf)
       /* user clip distance. */
       header_mrf += 2;
 
-      /* Pad so that vertex element data (starts with position) is aligned. */
+      /* Pad so that vertex element data is aligned. */
       header_mrf++;
    } else {
       /* There are 8 dwords in VUE header pre-Ironlake:
        * dword 0-3 (m1) is indices, point width, clip flags.
        * dword 4-7 (m2) is ndc position (set above)
        *
-       * dword 8-11 (m3) is the first vertex data, which we always have be the
-       * vertex position.
+       * dword 8-11 (m3) is the first vertex data.
        */
       current_annotation = "NDC";
       emit(BRW_OPCODE_MOV, brw_message_reg(header_mrf++), src_reg(ndc));
@@ -1592,8 +1591,7 @@ vec4_visitor::emit_vue_header_gen6(int header_mrf)
     * dword 8-15 (m4,m5) of the vertex header is the user clip distance if
     * enabled.
     *
-    * m4 or 6 is the first vertex element data we fill, which is
-    * the vertex position.
+    * m4 or 6 is the first vertex element data we fill.
     */
 
    current_annotation = "indices, point width, clip flags";
@@ -1681,6 +1679,10 @@ vec4_visitor::emit_urb_writes()
       if (!(c->prog_data.outputs_written & BITFIELD64_BIT(attr)))
         continue;
 
+      /* This is set up in the VUE header. */
+      if (attr == VERT_RESULT_HPOS)
+        continue;
+
       /* This is loaded into the VUE header, and thus doesn't occupy
        * an attribute slot.
        */