nvc0: add the index buffer offset where missing
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 19 Dec 2010 20:33:37 +0000 (21:33 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 19 Dec 2010 20:33:37 +0000 (21:33 +0100)
src/gallium/drivers/nvc0/nvc0_push.c
src/gallium/drivers/nvc0/nvc0_push2.c
src/gallium/drivers/nvc0/nvc0_vbo.c

index 1bdc8e88a728708649f1be117cb90c4cfc5fa3ea..8cb05cdd09edc28e39b3a1095cfc78851b2d2535 100644 (file)
@@ -227,6 +227,8 @@ nvc0_push_vbo(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
                                    PIPE_TRANSFER_READ, &transfer);
       if (!ctx.idxbuf)
          return;
+      ctx.idxbuf = (uint8_t *)ctx.idxbuf + nvc0->idxbuf.offset;
+
       index_size = nvc0->idxbuf.index_size;
       ctx.primitive_restart = info->primitive_restart;
       ctx.restart_index = info->restart_index;
index 3f9359cf25f13f3ffa7f3b35daf7d263096e0966..07dd7b56b9085f32b67909d1b28babb9c9a3bf2d 100644 (file)
@@ -298,7 +298,7 @@ nvc0_push_vbo2(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
       struct nvc0_resource *res = nvc0_resource(nvc0->idxbuf.buffer);
       if (!res || nouveau_bo_map(res->bo, NOUVEAU_BO_RD))
          return;
-      ctx.idxbuf = res->bo->map;
+      ctx.idxbuf = (uint8_t *)res->bo->map + nvc0->idxbuf.offset + res->offset;
       nouveau_bo_unmap(res->bo);
       ctx.idxsize = nvc0->idxbuf.index_size;
    } else {
index 84951ed9458e262f2fc6ef0adae256059989aec4..f1d5910e3da171bdeb00a18de7d0b67475b88f2e 100644 (file)
@@ -459,6 +459,7 @@ nvc0_draw_elements(struct nvc0_context *nvc0, boolean shorten,
                              PIPE_TRANSFER_READ, &transfer);
       if (!data)
          return;
+      data = (uint8_t *)data + nvc0->idxbuf.offset;
 
       while (instance_count--) {
          BEGIN_RING(chan, RING_3D(VERTEX_BEGIN_GL), 1);