[Mesa-dev] [PATCH] i965: Fix an inconsistency the VUE map with gl_ClipVertex on gen4/5.

Eric Anholt eric at anholt.net
Fri Mar 29 10:20:45 PDT 2013


We are intentionally not allocating a slot for gl_ClipVertex.  But by
leaving the bit set in the slots_valid, the fragment shader's computation
of where varyings are in urb entry coming out of the SF would be off by
one.  Fixes rendering in Freespace 2 SCP.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62830
Tested-by: Joaquín Ignacio Aramendía <samsagax at gmail.com>
NOTE: This is a candidate for the 9.1 branch.
---

NOTE: I haven't run this through piglit yet, since I'm out of town.

 src/mesa/drivers/dri/i965/brw_vs.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index e093dd1..6d2c0fd 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -63,6 +63,13 @@ brw_compute_vue_map(struct brw_context *brw, struct brw_vs_compile *c,
 {
    const struct intel_context *intel = &brw->intel;
    struct brw_vue_map *vue_map = &c->prog_data.vue_map;
+
+   /* Prior to Gen6, don't assign a slot for VARYING_SLOT_CLIP_VERTEX, since
+    * it is unsupported.
+    */
+   if (intel->gen < 6)
+      slots_valid &= ~VARYING_BIT_CLIP_VERTEX;
+
    vue_map->slots_valid = slots_valid;
    int i;
 
@@ -152,15 +159,12 @@ brw_compute_vue_map(struct brw_context *brw, struct brw_vs_compile *c,
     * assign them contiguously.  Don't reassign outputs that already have a
     * slot.
     *
-    * Also, prior to Gen6, don't assign a slot for VARYING_SLOT_CLIP_VERTEX,
-    * since it is unsupported.  In Gen6 and above, VARYING_SLOT_CLIP_VERTEX may
-    * be needed for transform feedback; since we don't want to have to
-    * recompute the VUE map (and everything that depends on it) when transform
-    * feedback is enabled or disabled, just go ahead and assign a slot for it.
+    * We generally don't need to assign a slot for VARYING_SLOT_CLIP_VERTEX,
+    * since it's encoded as the clip distances by emit_clip_distances().
+    * However, it may be output by transform feedback, and we'd rather not
+    * recompute state when TF changes, so we just always include it.
     */
    for (int i = 0; i < VARYING_SLOT_MAX; ++i) {
-      if (intel->gen < 6 && i == VARYING_SLOT_CLIP_VERTEX)
-         continue;
       if ((slots_valid & BITFIELD64_BIT(i)) &&
           vue_map->varying_to_slot[i] == -1) {
          assign_vue_slot(vue_map, i);
-- 
1.7.10.4



More information about the mesa-dev mailing list