i965: Validate the number of URB entries selected for the VS.
authorEric Anholt <eric@anholt.net>
Thu, 12 Nov 2009 22:05:18 +0000 (14:05 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 13 Nov 2009 21:18:56 +0000 (13:18 -0800)
src/mesa/drivers/dri/i965/brw_vs_state.c

index d790ab65553a31295b2691de6f76df924dd54ed4..7285466645b66a1aa7457c44fbccfaaf535f25ae 100644 (file)
@@ -109,10 +109,39 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
    vs.thread3.urb_entry_read_offset = 0;
    vs.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
 
-   if (BRW_IS_IGDNG(brw))
-       vs.thread4.nr_urb_entries = key->nr_urb_entries >> 2;
-   else
-       vs.thread4.nr_urb_entries = key->nr_urb_entries;
+   if (BRW_IS_IGDNG(brw)) {
+      switch (key->nr_urb_entries) {
+      case 8:
+      case 12:
+      case 16:
+      case 32:
+      case 64:
+      case 96:
+      case 128:
+      case 168:
+      case 192:
+      case 224:
+      case 256:
+        vs.thread4.nr_urb_entries = key->nr_urb_entries >> 2;
+        break;
+      default:
+        assert(0);
+      }
+   } else {
+      switch (key->nr_urb_entries) {
+      case 8:
+      case 12:
+      case 16:
+      case 32:
+        break;
+      case 64:
+        assert(BRW_IS_G4X(brw));
+        break;
+      default:
+        assert(0);
+      }
+      vs.thread4.nr_urb_entries = key->nr_urb_entries;
+   }
 
    vs.thread4.urb_entry_allocation_size = key->urb_size - 1;