iris: untested index buffer upload
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 10 Jun 2018 02:11:22 +0000 (19:11 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:06 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_state.c

index 93d1f32f4591acab19d37f6331768c4e6d6a4192..d36a11d0aabdd5b534550bcecfbed1b72b3a0f8b 100644 (file)
@@ -2522,15 +2522,23 @@ iris_upload_render_state(struct iris_context *ice,
    }
 
    if (draw->index_size > 0) {
-      struct iris_resource *res = (struct iris_resource *)draw->index.resource;
+      struct iris_resource *res = NULL;
+      unsigned offset;
 
-      assert(!draw->has_user_indices);
+      if (draw->has_user_indices) {
+         u_upload_data(ice->ctx.stream_uploader, 0,
+                       draw->count * draw->index_size, 4, draw->index.user,
+                       &offset, (struct pipe_resource **) &res);
+      } else {
+         res = (struct iris_resource *) draw->index.resource;
+         offset = 0;
+      }
 
       iris_emit_cmd(batch, GENX(3DSTATE_INDEX_BUFFER), ib) {
          ib.IndexFormat = draw->index_size >> 1;
          ib.MOCS = MOCS_WB;
          ib.BufferSize = res->bo->size;
-         ib.BufferStartingAddress = ro_bo(res->bo, 0);
+         ib.BufferStartingAddress = ro_bo(res->bo, offset);
       }
    }