[Mesa-dev] [PATCH 5/9] mesa: fix deletion of inactive bound transform feedback object

Eduardo Lima Mitev elima at igalia.com
Tue Feb 24 10:02:53 PST 2015


From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>

When a transform feedback object is bound and not active, the OpenGL ES
3.0 and GL_ARB_transform_feedback2 specs don't explicitly disallow its
deletion. Only the deletion of the default framebuffer object is
forbidden.

This patch follows what it is done for glDeleteTextures(), i.e.
the binding reverts to 0 (the default framebuffer object).

Fixes:

dEQP-GLES3.functional.lifetime.delete_bound.transform_feedback

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
 src/mesa/main/transformfeedback.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index a737463..28d62da 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -96,8 +96,19 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr,
       ASSERT(oldObj->RefCount > 0);
       oldObj->RefCount--;
 
+      /* If the transform feedback object to delete (obj == NULL) is bound
+       * then revert the binding to the default transform feedback object.
+       */
+      GET_CURRENT_CONTEXT(ctx);
+      if (ctx && obj == NULL &&
+          oldObj == ctx->TransformFeedback.CurrentObject &&
+          oldObj != ctx->TransformFeedback.DefaultObject) {
+         ctx->TransformFeedback.CurrentObject = NULL;
+         reference_transform_feedback_object(&ctx->TransformFeedback.CurrentObject,
+                                             ctx->TransformFeedback.DefaultObject);
+      }
+
       if (oldObj->RefCount == 0) {
-         GET_CURRENT_CONTEXT(ctx);
          if (ctx)
             ctx->Driver.DeleteTransformFeedback(ctx, oldObj);
       }
-- 
2.1.3



More information about the mesa-dev mailing list