mesa: Unbind uniform buffer bindings on glDeleteBuffers().
authorEric Anholt <eric@anholt.net>
Tue, 31 Jul 2012 19:46:25 +0000 (12:46 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 7 Aug 2012 20:54:51 +0000 (13:54 -0700)
Fixes piglit GL_ARB_uniform_buffer_object/deletebuffers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/bufferobj.c

index 0e3216009b0c96e383902ad36ab31e2e59f2c939..22d7927bbcb96fe3648db4e77e64b012c15ac4f5 100644 (file)
@@ -886,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 );
          }