st/mesa & v_bug_mgr: two small instanced drawing fixes
authorChristian König <deathsimple@vodafone.de>
Mon, 28 Feb 2011 00:54:36 +0000 (01:54 +0100)
committerChristian König <deathsimple@vodafone.de>
Mon, 28 Feb 2011 01:19:39 +0000 (02:19 +0100)
src/gallium/auxiliary/util/u_vbuf_mgr.c
src/mesa/state_tracker/st_draw.c

index dec8dd717e8a475557fc0483d56613f0f6d79013..3cf8ee0831d45b4930c5de6d3c2daf4e470a72c9 100644 (file)
@@ -531,7 +531,10 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
          unsigned first, size;
          boolean flushed;
 
-         if (vb->stride) {
+         if (mgr->ve->ve[i].instance_divisor) {
+            first = 0;
+            size = vb->buffer->width0;
+         } else if (vb->stride) {
             first = vb->stride * min_index;
             size = vb->stride * count;
          } else {
index 6530a06ade43b7ecde4386e047a64baa57f14af3..c99eafbadf348b1343612fbbda545f0ec84d4940 100644 (file)
@@ -579,6 +579,7 @@ st_validate_varrays(struct gl_context *ctx,
    if (is_interleaved_arrays(vp, vpv, arrays)) {
       setup_interleaved_attribs(ctx, vp, vpv, arrays, vbuffer, velements,
                                 max_index);
+
       num_vbuffers = 1;
       num_velements = vpv->num_inputs;
       if (num_velements == 0)
@@ -645,6 +646,7 @@ st_draw_vbo(struct gl_context *ctx,
       for (i = 0; i < nr_prims; i++) {
          min_index = MIN2(min_index, prims[i].start);
          max_index = MAX2(max_index, prims[i].start + prims[i].count - 1);
+         max_index = MAX2(max_index, prims[i].num_instances);
       }
    }