diff options
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 9 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 28e387c399d..526fc958734 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -218,6 +218,7 @@ 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); GLuint flags = 0; + char *map; if (access & GL_MAP_WRITE_BIT) flags |= PIPE_BUFFER_USAGE_CPU_WRITE; @@ -231,8 +232,12 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, if (access & MESA_MAP_NOWAIT_BIT) flags |= PIPE_BUFFER_USAGE_DONTBLOCK; - obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags); - return obj->Pointer; + map = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); + /* FIXME: some code expects this to point to the buffer start, which means that + * the range might not be respected in all circumstances + */ + obj->Pointer = map ? map - offset : NULL; + return map; } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 38b6c56f479..b08909c76fb 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -281,11 +281,8 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec ) MESA_MAP_NOWAIT_BIT), exec->vtx.bufferobj); } - - if (exec->vtx.buffer_map) { - exec->vtx.buffer_map += exec->vtx.buffer_used / sizeof(float); - } - else { + + if (!exec->vtx.buffer_map) { exec->vtx.buffer_used = 0; ctx->Driver.BufferData(ctx, target, |