summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 52099232ad..45fbe8c76e 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -217,6 +217,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;
@@ -230,11 +231,25 @@ 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);
+ /* this is expected to point to the buffer start, in order to calculate the
+ * vertices offsets
+ */
+ obj->Pointer = map ? map - offset : NULL;
+ return map;
}
+static void
+st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
+ GLintptr offset, GLsizeiptr length,
+ struct gl_buffer_object *obj)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+ pipe_buffer_flush_mapped_range(pipe->screen, st_obj->buffer, offset, length);
+}
/**
@@ -262,5 +277,6 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
functions->GetBufferSubData = st_bufferobj_get_subdata;
functions->MapBuffer = st_bufferobj_map;
functions->MapBufferRange = st_bufferobj_map_range;
+ functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
functions->UnmapBuffer = st_bufferobj_unmap;
}