[Mesa-dev] [PATCH 7/9] svga: fix incorrect user buffer size computation for instance divisor case

Thomas Hellstrom thellstrom at vmware.com
Thu Jun 30 00:29:35 PDT 2011


From: Brian Paul <brianp at vmware.com>

See preceeding commit for more info.
---
 src/gallium/drivers/svga/svga_pipe_draw.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index 78f5aa1..358ef82 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -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 {
-- 
1.6.2.5



More information about the mesa-dev mailing list