Mesa (master): vbo: Fix array pointer calculation for MapBufferRange-mapped vertex data.

Eric Anholt anholt at kemper.freedesktop.org
Fri Aug 28 22:31:06 UTC 2009


Module: Mesa
Branch: master
Commit: 8096aa521369c3bcf5226c060efa6dd06e48ddc8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8096aa521369c3bcf5226c060efa6dd06e48ddc8

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Aug 28 14:44:55 2009 -0700

vbo: Fix array pointer calculation for MapBufferRange-mapped vertex data.

We would end up with the offset from the start of the mapping rather than
the offset from the start of the buffer.

---

 src/mesa/vbo/vbo_exec_draw.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 53fa90b..0c258c5 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -218,7 +218,9 @@ vbo_exec_bind_arrays( GLcontext *ctx )
             /* a real buffer obj: Ptr is an offset, not a pointer*/
             GLsizeiptr offset;
             assert(exec->vtx.bufferobj->Pointer);  /* buf should be mapped */
-            offset = (GLbyte *) data - (GLbyte *) exec->vtx.bufferobj->Pointer;
+            offset = (GLbyte *) data -
+	       (GLbyte *) exec->vtx.bufferobj->Pointer +
+	       exec->vtx.bufferobj->Offset;
             assert(offset >= 0);
             arrays[attr].Ptr = (void *) offset;
          }




More information about the mesa-commit mailing list