Mesa (master): vbo: fix void * arithmetic compilation error on MSVC

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 12 03:19:35 UTC 2012


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan 11 20:03:32 2012 -0700

vbo: fix void * arithmetic compilation error on MSVC

Also, call vbo_sizeof_ib_type() once and fix argument cast in
MapBufferRange() call.

---

 src/mesa/vbo/vbo_exec_array.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 263e429..89f032f 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -108,13 +108,14 @@ vbo_get_minmax_index(struct gl_context *ctx,
 {
    const GLboolean restart = ctx->Array.PrimitiveRestart;
    const GLuint restartIndex = ctx->Array.RestartIndex;
-   const void *indices;
+   const int index_size = vbo_sizeof_ib_type(ib->type);
+   const char *indices;
    GLuint i;
 
-   indices = (void *)ib->ptr + prim->start * vbo_sizeof_ib_type(ib->type);
+   indices = (char *) ib->ptr + prim->start * index_size;
    if (_mesa_is_bufferobj(ib->obj)) {
-      GLsizeiptr size = MIN2(count * vbo_sizeof_ib_type(ib->type), ib->obj->Size);
-      indices = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) indices, size,
+      GLsizeiptr size = MIN2(count * ib_size, index->obj->Size);
+      indices = ctx->Driver.MapBufferRange(ctx, (GLintptr) indices, size,
                                            GL_MAP_READ_BIT, ib->obj);
    }
 




More information about the mesa-commit mailing list