summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-03-03 11:51:14 +0000
committerKeith Whitwell <keithw@vmware.com>2009-03-03 11:51:14 +0000
commit916de35d677ca5238e9515840fa5aa9f81302c5b (patch)
tree73a8a2443c3de43d253a38528335e39b40b391dc /src/mesa/state_tracker
parent72cf6e8e92e49753472e760b1cf4575327b48f43 (diff)
parent2785af803f7d6d64ff17c10645e5f10499289ed0 (diff)
Merge commit 'origin/gallium-0.1'
Conflicts: scons/gallium.py src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c src/gallium/include/pipe/p_defines.h src/mesa/vbo/vbo_exec_api.c src/mesa/vbo/vbo_exec_draw.c
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 562ac6c65c..28e387c399 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -206,8 +206,40 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
}
+
/**
- * Called via glMapBufferARB().
+ * Called via glMapBufferRange().
+ */
+static void *
+st_bufferobj_map_range(GLcontext *ctx, GLenum target,
+ GLintptr offset, GLsizeiptr length, GLbitfield access,
+ struct gl_buffer_object *obj)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct st_buffer_object *st_obj = st_buffer_object(obj);
+ GLuint flags = 0;
+
+ if (access & GL_MAP_WRITE_BIT)
+ flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+
+ if (access & GL_MAP_READ_BIT)
+ flags |= PIPE_BUFFER_USAGE_CPU_READ;
+
+ /* ... other flags ...
+ */
+
+ 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;
+}
+
+
+
+
+/**
+ * Called via glUnmapBufferARB().
*/
static GLboolean
st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
@@ -230,5 +262,6 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
functions->BufferSubData = st_bufferobj_subdata;
functions->GetBufferSubData = st_bufferobj_get_subdata;
functions->MapBuffer = st_bufferobj_map;
+ functions->MapBufferRange = st_bufferobj_map_range;
functions->UnmapBuffer = st_bufferobj_unmap;
}