i965: Even if no VS inputs are set, still load some amount of URB as required.
authorEric Anholt <eric@anholt.net>
Tue, 4 Aug 2009 00:12:43 +0000 (17:12 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 4 Aug 2009 00:19:03 +0000 (17:19 -0700)
See comment on Vertex URB Entry Read Length for VS_STATE.

This, combined with the previous three commits, fixes #22945.

src/mesa/drivers/dri/i965/brw_vs_emit.c

index d27b1c8..722307c 100644 (file)
@@ -129,6 +129,11 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
         reg++;
       }
    }
+   /* If there are no inputs, we'll still be reading one attribute's worth
+    * because it's required -- see urb_read_length setting.
+    */
+   if (c->nr_inputs == 0)
+      reg++;
 
    /* Allocate outputs.  The non-position outputs go straight into message regs.
     */
@@ -221,6 +226,12 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     * vertex urb, so is half the amount:
     */
    c->prog_data.urb_read_length = (c->nr_inputs + 1) / 2;
+   /* Setting this field to 0 leads to undefined behavior according to the
+    * the VS_STATE docs.  Our VUEs will always have at least one attribute
+    * sitting in them, even if it's padding.
+    */
+   if (c->prog_data.urb_read_length == 0)
+      c->prog_data.urb_read_length = 1;
 
    /* The VS VUEs are shared by VF (outputting our inputs) and VS, so size
     * them to fit the biggest thing they need to.