Mesa (9.2): Remove error when calling glGenQueries/ glDeleteQueries while a query is active

Carl Worth cworth at kemper.freedesktop.org
Wed Nov 13 01:01:16 UTC 2013


Module: Mesa
Branch: 9.2
Commit: dbeb24c39b28814f2d40d765a4ab72f5cbb4c940
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbeb24c39b28814f2d40d765a4ab72f5cbb4c940

Author: Carl Worth <cworth at cworth.org>
Date:   Thu Oct 17 10:54:56 2013 -0700

Remove error when calling glGenQueries/glDeleteQueries while a query is active

There is nothing in the OpenGL specification which prevents the user from
calling glGenQueries to generate a new query object while another object is
active. Neither is there anything in the Mesa implementation which prevents
this. So remove the INVALID_OPERATION errors in this case.

Similarly, it is explicitly allowed by the OpenGL specification to delete an
active query, so remove the assertion for that case, replacing it with the
necesssary state updates to end the query, (clear the bindpt pointer and call
into the driver's EndQuery hook).

CC: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp at vmware.com>
Tested-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit 29996e219912fb1fdf35a6595d8f6261384a18dc)

---

 src/mesa/main/queryobj.c |   25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 60356b8..db8cdc0 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -201,13 +201,6 @@ _mesa_GenQueries(GLsizei n, GLuint *ids)
       return;
    }
 
-   /* No query objects can be active at this time! */
-   if (ctx->Query.CurrentOcclusionObject ||
-       ctx->Query.CurrentTimerObject) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB");
-      return;
-   }
-
    first = _mesa_HashFindFreeKeyBlock(ctx->Query.QueryObjects, n);
    if (first) {
       GLsizei i;
@@ -240,18 +233,20 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids)
       return;
    }
 
-   /* No query objects can be active at this time! */
-   if (ctx->Query.CurrentOcclusionObject ||
-       ctx->Query.CurrentTimerObject) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteQueriesARB");
-      return;
-   }
-
    for (i = 0; i < n; i++) {
       if (ids[i] > 0) {
          struct gl_query_object *q = _mesa_lookup_query_object(ctx, ids[i]);
          if (q) {
-            ASSERT(!q->Active); /* should be caught earlier */
+            if (q->Active) {
+               struct gl_query_object **bindpt;
+               bindpt = get_query_binding_point(ctx, q->Target);
+               assert(bindpt); /* Should be non-null for active q. */
+               if (bindpt) {
+                  *bindpt = NULL;
+               }
+               q->Active = GL_FALSE;
+               ctx->Driver.EndQuery(ctx, q);
+            }
             _mesa_HashRemove(ctx->Query.QueryObjects, ids[i]);
             ctx->Driver.DeleteQuery(ctx, q);
          }




More information about the mesa-commit mailing list