OSDN Git Service

i965: For GEN6+, always make front/back colors adjacent in VUE.
authorPaul Berry <stereotype441@gmail.com>
Sat, 3 Sep 2011 15:23:27 +0000 (08:23 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 6 Sep 2011 18:05:44 +0000 (11:05 -0700)
When doing two-sided color on GEN6+, we use the SF unit's
INPUTATTR_FACING mode to cause front colors to be used on front-facing
triangles, and back colors to be used on back-facing triangles.  This
mode requires that the front and back colors be adjacent in the VUE.

Previously, we would only place front and back colors adjacent in the
VUE when two-sided color was enabled.  Now we place them adjacent in
the VUE whether two-sided color is enabled or not.  (We still only
swizzle the colors when two-sided color is enabled, so there should be
no user-visible change).

This simplifies the implementation of the VUE map and reduces the
amount of code that is dependent on two-sided color mode.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vs.c

index de19ded..8a7a376 100644 (file)
@@ -116,22 +116,18 @@ brw_compute_vue_map(struct brw_vue_map *vue_map,
          assign_vue_slot(vue_map, BRW_VERT_RESULT_CLIP0);
          assign_vue_slot(vue_map, BRW_VERT_RESULT_CLIP1);
       }
-      if (two_side_color) {
-         /* front and back colors need to be consecutive */
-         if ((outputs_written & BITFIELD64_BIT(VERT_RESULT_COL1)) &&
-             (outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC1))) {
-            assert(outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0));
-            assert(outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0));
-            assign_vue_slot(vue_map, VERT_RESULT_COL0);
-            assign_vue_slot(vue_map, VERT_RESULT_BFC0);
-            assign_vue_slot(vue_map, VERT_RESULT_COL1);
-            assign_vue_slot(vue_map, VERT_RESULT_BFC1);
-         } else if ((outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0)) &&
-                    (outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0))) {
-            assign_vue_slot(vue_map, VERT_RESULT_COL0);
-            assign_vue_slot(vue_map, VERT_RESULT_BFC0);
-         }
-      }
+      /* front and back colors need to be consecutive so that we can use
+       * ATTRIBUTE_SWIZZLE_INPUTATTR_FACING to swizzle them when doing
+       * two-sided color.
+       */
+      if (outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0))
+         assign_vue_slot(vue_map, VERT_RESULT_COL0);
+      if (outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0))
+         assign_vue_slot(vue_map, VERT_RESULT_BFC0);
+      if (outputs_written & BITFIELD64_BIT(VERT_RESULT_COL1))
+         assign_vue_slot(vue_map, VERT_RESULT_COL1);
+      if (outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC1))
+         assign_vue_slot(vue_map, VERT_RESULT_BFC1);
       break;
    default:
       assert (!"VUE map not known for this chip generation");