st/mesa: fix obj->Pointer offset in st_bufferobj_map_range()
authorBrian Paul <brianp@vmware.com>
Mon, 31 Aug 2009 14:49:22 +0000 (08:49 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 31 Aug 2009 14:49:24 +0000 (08:49 -0600)
This fixes a bunch of gallium regressions since
commit 8096aa521369c3bcf5226c060efa6dd06e48ddc8

src/mesa/state_tracker/st_cb_bufferobjects.c

index 8c1fd5ce025890dd509cd8bb294a7df13f7e4326..69dd76d083735f3dbe118246e7c23a025cb7ede5 100644 (file)
@@ -228,7 +228,6 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
    struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_buffer_object *st_obj = st_buffer_object(obj);
    uint flags = 0x0;
-   char *map;
 
    if (access & GL_MAP_WRITE_BIT)
       flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
@@ -250,14 +249,15 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
    assert(offset < obj->Size);
    assert(offset + length <= obj->Size);
 
-   map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags);
-   if(obj->Pointer) {
+   obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags);
+   if (obj->Pointer) {
+      obj->Pointer = (ubyte *) obj->Pointer + offset;
       obj->Offset = offset;
       obj->Length = length;
-      map += offset;
+      obj->AccessFlags = access;
    }
    
-   return map;
+   return obj->Pointer;
 }