iris: fix bogus index buffer reference
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 20 Jan 2018 09:07:41 +0000 (01:07 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_state.c

index bfca3fb75cbf4a56a9290dfa709594a73e6fc32d..1ec34bddbcbc9f0b6a7e81f254b93265f32f93d3 100644 (file)
@@ -1445,7 +1445,7 @@ iris_upload_render_state(struct iris_context *ice,
    }
 
    // draw->index_size > 0
-   if (1) {
+   if (draw->index_size > 0) {
       struct iris_resource *res = (struct iris_resource *)draw->index.resource;
 
       assert(!draw->has_user_indices);
@@ -1457,24 +1457,24 @@ iris_upload_render_state(struct iris_context *ice,
          // XXX: gah, addresses :(  need two different combine address funcs
          // ib.BufferStartingAddress = res->bo;
       }
+   }
 
-      assert(!draw->indirect); // XXX: indirect support
-
-      iris_emit_cmd(batch, GENX(3DPRIMITIVE), prim) {
-         prim.StartInstanceLocation = draw->start_instance;
-         prim.InstanceCount = draw->instance_count;
+   assert(!draw->indirect); // XXX: indirect support
 
-         // XXX: this is probably bonkers.
-         prim.StartVertexLocation = draw->start;
+   iris_emit_cmd(batch, GENX(3DPRIMITIVE), prim) {
+      prim.StartInstanceLocation = draw->start_instance;
+      prim.InstanceCount = draw->instance_count;
 
-         if (draw->index_size) {
-            prim.BaseVertexLocation += draw->index_bias;
-         } else {
-            prim.StartVertexLocation += draw->index_bias;
-         }
+      // XXX: this is probably bonkers.
+      prim.StartVertexLocation = draw->start;
 
-         //prim.BaseVertexLocation = ...;
+      if (draw->index_size) {
+         prim.BaseVertexLocation += draw->index_bias;
+      } else {
+         prim.StartVertexLocation += draw->index_bias;
       }
+
+      //prim.BaseVertexLocation = ...;
    }
 #if 0
    l3 configuration