util/primconvert: Avoid point arithmetic; apply offset on all cases.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 5 Dec 2014 14:15:02 +0000 (14:15 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 5 Dec 2014 14:44:16 +0000 (14:44 +0000)
Matches what u_vbuf_get_minmax_index() does.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/auxiliary/indices/u_primconvert.c

index 4632781900687d3ccf1525a6532017935d3bbfe1..eba1f9e4b30d34d09a63dba5338614658439b4a6 100644 (file)
@@ -137,8 +137,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
       src = ib->user_buffer;
       if (!src) {
          src = pipe_buffer_map(pc->pipe, ib->buffer,
-                               PIPE_TRANSFER_READ, &src_transfer) + ib->offset;
+                               PIPE_TRANSFER_READ, &src_transfer);
       }
+      src = (const uint8_t *)src + ib->offset;
    }
    else {
       u_index_generator(pc->primtypes_mask,