mesa: flip current tf object back to default if current is being deleted
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 6 Mar 2016 17:36:19 +0000 (12:36 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Mon, 7 Mar 2016 05:36:08 +0000 (00:36 -0500)
In the rather unusual case of Bind + Delete, we need to make sure that
we unbind the current tf object.

Fixes dEQP-GLES3.functional.lifetime.delete_bound.transform_feedback

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/main/transformfeedback.c

index 976b2686a6046047245acf7f85e9de23e14c9f26..f73a89f6c0f4bd79afc5b93b7f16ece2e38dca4f 100644 (file)
@@ -1136,6 +1136,11 @@ _mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names)
             }
             _mesa_HashRemove(ctx->TransformFeedback.Objects, names[i]);
             /* unref, but object may not be deleted until later */
+            if (obj == ctx->TransformFeedback.CurrentObject) {
+               reference_transform_feedback_object(
+                     &ctx->TransformFeedback.CurrentObject,
+                     ctx->TransformFeedback.DefaultObject);
+            }
             reference_transform_feedback_object(&obj, NULL);
          }
       }