diff options
author | marha <marha@users.sourceforge.net> | 2012-08-13 10:09:30 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-13 10:09:30 +0200 |
commit | 9ddf44af81782451cee798e06749ce3067a14a41 (patch) | |
tree | f84b06f6897929113f080d8e505621fa6bf73fb9 /mesalib/src/mesa/main/bufferobj.c | |
parent | f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0 (diff) | |
download | vcxsrv-9ddf44af81782451cee798e06749ce3067a14a41.tar.gz vcxsrv-9ddf44af81782451cee798e06749ce3067a14a41.tar.bz2 vcxsrv-9ddf44af81782451cee798e06749ce3067a14a41.zip |
mesa pixman xkeyboard-config xserver git update 13 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main/bufferobj.c')
-rw-r--r-- | mesalib/src/mesa/main/bufferobj.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 48edd89c9..22d7927bb 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -656,6 +656,28 @@ _mesa_free_buffer_objects( struct gl_context *ctx ) ctx->UniformBufferBindings = NULL; } +static void +handle_bind_buffer_gen(struct gl_context *ctx, + GLenum target, + GLuint buffer, + struct gl_buffer_object **buf_handle) +{ + struct gl_buffer_object *buf = *buf_handle; + + if (!buf || buf == &DummyBufferObject) { + /* If this is a new buffer object id, or one which was generated but + * never used before, allocate a buffer object now. + */ + ASSERT(ctx->Driver.NewBufferObject); + buf = ctx->Driver.NewBufferObject(ctx, buffer, target); + if (!buf) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); + return; + } + _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, buf); + *buf_handle = buf; + } +} /** * Bind the specified target to buffer for the specified context. @@ -691,18 +713,7 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer) else { /* non-default buffer object */ newBufObj = _mesa_lookup_bufferobj(ctx, buffer); - if (!newBufObj || newBufObj == &DummyBufferObject) { - /* If this is a new buffer object id, or one which was generated but - * never used before, allocate a buffer object now. - */ - ASSERT(ctx->Driver.NewBufferObject); - newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target); - if (!newBufObj) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); - return; - } - _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj); - } + handle_bind_buffer_gen(ctx, target, buffer, &newBufObj); } /* bind new buffer */ @@ -875,6 +886,13 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) } } + /* unbind UBO binding points */ + for (j = 0; j < ctx->Const.MaxUniformBufferBindings; j++) { + if (ctx->UniformBufferBindings[j].BufferObject == bufObj) { + _mesa_BindBufferBase( GL_UNIFORM_BUFFER, j, 0 ); + } + } + if (ctx->UniformBuffer == bufObj) { _mesa_BindBufferARB( GL_UNIFORM_BUFFER, 0 ); } @@ -2089,6 +2107,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index, } else { bufObj = _mesa_lookup_bufferobj(ctx, buffer); } + handle_bind_buffer_gen(ctx, target, buffer, &bufObj); if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -2134,6 +2153,7 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) } else { bufObj = _mesa_lookup_bufferobj(ctx, buffer); } + handle_bind_buffer_gen(ctx, target, buffer, &bufObj); if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, |