nvc0: don't apply base vertex to per-instance arrays
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 21 Jan 2011 15:46:36 +0000 (16:46 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 23 Jan 2011 12:03:00 +0000 (13:03 +0100)
src/gallium/drivers/nvc0/nvc0_push.c

index 74c3451c19a05ea41382a58446be50c9af186534..fcbb7da41a368313a717d60dd79ae36f17dec5a3 100644 (file)
@@ -217,6 +217,7 @@ nvc0_push_vbo(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
    struct push_context ctx;
    unsigned i, index_size;
    unsigned inst = info->instance_count;
+   boolean apply_bias = info->indexed && info->index_bias;
 
    ctx.chan = nvc0->screen->base.channel;
    ctx.translate = nvc0->vertex->translate;
@@ -230,7 +231,8 @@ nvc0_push_vbo(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
 
       data = nvc0_resource_map_offset(nvc0, res,
                                       vb->buffer_offset, NOUVEAU_BO_RD);
-      if (info->indexed)
+
+      if (apply_bias && likely(!(nvc0->vertex->instance_bufs & (1 << i))))
          data += info->index_bias * vb->stride;
 
       ctx.translate->set_buffer(ctx.translate, i, data, vb->stride, ~0);