diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-03-03 10:47:31 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-03-03 10:47:31 +0000 |
commit | 2e29b7d0f8238f804304b061fb0157cf586db6f9 (patch) | |
tree | 20ae058948ee33b1a07d8c60c88bfdae609473ca /src/mesa/state_tracker | |
parent | c4d1f4607abf3dfbcfcffc5c67bb89d420d3381a (diff) |
mesa/st: implement MapBufferRange callback
Using PIPE_BUFFER_USAGE_DONTBLOCK.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 35 |
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 07fa2afce0..b79b934111 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -212,8 +212,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) @@ -236,5 +268,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; } |