From f2b09257ba04a8f50c58e208ca8ab66cfa362298 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Sat, 3 Sep 2011 08:23:27 -0700 Subject: [PATCH] i965: For GEN6+, always make front/back colors adjacent in VUE. 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 --- src/mesa/drivers/dri/i965/brw_vs.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index de19ded2fb0..8a7a3768b43 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -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"); -- 2.30.2