[Mesa-dev] [PATCH] Remove error when calling glGenQueries/glDeleteQueries while a query is active

Kenneth Graunke kenneth at whitecape.org
Tue Oct 29 05:15:09 CET 2013


On 10/28/2013 11:02 AM, Carl Worth wrote:
[snip]

Would you mind adding the "mesa: " prefix to the commit title?

> @@ -241,18 +234,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);
> +            }

It might be a little friendlier to drivers to call EndQuery before
unbinding it.  Though, i965 doesn't appear to care.

With or without that change, your patch is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

Thanks for fixing this, Carl.

(Also...for some reason, this patch was really mangled and would not
apply cleanly.  I had to hack the mbox file.)


More information about the mesa-dev mailing list