mesa: Unbind ARB_transform_feedback2 binding points on Delete too.
[mesa.git] / src / mesa / main / bufferobj.c
index fe7db2a678bf7a655de00ff78b5b1a4d433ac200..36a761986a1465579e1ae62a0f2de956c0a664d5 100644 (file)
@@ -42,6 +42,7 @@
 #include "mfeatures.h"
 #include "mtypes.h"
 #include "texobj.h"
+#include "transformfeedback.h"
 
 
 /* Debug flags */
@@ -829,10 +830,15 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
             _mesa_BindBufferARB( GL_COPY_WRITE_BUFFER, 0 );
          }
 
-         /* unbind transform feedback binding point */
+         /* unbind transform feedback binding points */
          if (ctx->TransformFeedback.CurrentBuffer == bufObj) {
             _mesa_BindBufferARB( GL_TRANSFORM_FEEDBACK_BUFFER, 0 );
          }
+         for (j = 0; j < MAX_FEEDBACK_ATTRIBS; j++) {
+            if (ctx->TransformFeedback.CurrentObject->Buffers[j] == bufObj) {
+               _mesa_BindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, j, 0 );
+            }
+         }
 
          /* unbind any pixel pack/unpack pointers bound to this buffer */
          if (ctx->Pack.BufferObj == bufObj) {