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;
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;
}
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,