summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2013-10-17 10:54:56 -0700
committerCarl Worth <cworth@cworth.org>2013-10-28 12:56:49 -0700
commit29996e219912fb1fdf35a6595d8f6261384a18dc (patch)
treec39102134d27050839bf6a1af725bbe5e66e9281 /src
parent5563dfabc8c1b7cc1a67e4d64311ea29aef43087 (diff)
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@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com> Tested-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/queryobj.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index a1801336968..86e7c3ad0a1 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -202,13 +202,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;
@@ -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);
+ }
_mesa_HashRemove(ctx->Query.QueryObjects, ids[i]);
ctx->Driver.DeleteQuery(ctx, q);
}