diff options
Diffstat (limited to 'src/mesa/state_tracker/st_cb_bufferobjects.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 8c1fd5ce025..8e09d0b9324 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -134,9 +134,10 @@ st_bufferobj_get_subdata(GLcontext *ctx, * Allocate space for and store data in a buffer object. Any data that was * previously stored in the buffer object is lost. If data is NULL, * memory will be allocated, but no copy will occur. - * Called via glBufferDataARB(). + * Called via ctx->Driver.BufferData(). + * \return GL_TRUE for success, GL_FALSE if out of memory */ -static void +static GLboolean st_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size, @@ -172,13 +173,13 @@ st_bufferobj_data(GLcontext *ctx, st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size ); if (!st_obj->buffer) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB"); - return; + return GL_FALSE; } if (data) st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0, size, data); + return GL_TRUE; } @@ -228,7 +229,6 @@ 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); uint flags = 0x0; - char *map; if (access & GL_MAP_WRITE_BIT) flags |= PIPE_BUFFER_USAGE_CPU_WRITE; @@ -250,14 +250,15 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, assert(offset < obj->Size); assert(offset + length <= obj->Size); - map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); - if(obj->Pointer) { + obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); + if (obj->Pointer) { + obj->Pointer = (ubyte *) obj->Pointer + offset; obj->Offset = offset; obj->Length = length; - map += offset; + obj->AccessFlags = access; } - return map; + return obj->Pointer; } |