svga: fix incorrect user buffer size computation for instance divisor case
authorBrian Paul <brianp@vmware.com>
Thu, 16 Jun 2011 16:31:53 +0000 (10:31 -0600)
committerThomas Hellstrom <thellstrom@vmware.com>
Fri, 1 Jul 2011 11:30:40 +0000 (13:30 +0200)
See preceeding commit for more info.

src/gallium/drivers/svga/svga_pipe_draw.c

index 78f5aa10677ea4ef4a282d325120b9328b5aad32..358ef82db311d3c2cfad2a4300f0eea664ad8a82 100644 (file)
@@ -68,15 +68,15 @@ svga_upload_user_buffers(struct svga_context *svga,
          unsigned first, size;
          boolean flushed;
          unsigned instance_div = ve[i].instance_divisor;
+         unsigned elemSize = util_format_get_blocksize(ve->src_format);
 
          svga->dirty |= SVGA_NEW_VBUFFER;
 
          if (instance_div) {
             first = 0;
-            size = vb->stride *
-               (instance_count + instance_div - 1) / instance_div;
+            count = (instance_count + instance_div - 1) / instance_div;
+            size = vb->stride * (count - 1) + elemSize;
          } else if (vb->stride) {
-            uint elemSize = util_format_get_blocksize(ve->src_format);
             first = vb->stride * start;
             size = vb->stride * (count - 1) + elemSize;
          } else {