mesa: Throw an error for a new query on an already-active query target.
authorEric Anholt <eric@anholt.net>
Wed, 17 Oct 2012 00:21:39 +0000 (17:21 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 23 Oct 2012 00:36:52 +0000 (17:36 -0700)
There's a similar test below, but it's not the same: that one checks whether
this query object is already active (potentially on another target).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/queryobj.c

index 18792cf6c0e69b5e091a1ea5c7e47a772ea03828..ac03649084985c4da36e4e80f844e41589a7e881 100644 (file)
@@ -301,6 +301,19 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
       return;
    }
 
+   /* From the GL_ARB_occlusion_query spec:
+    *
+    *     "If BeginQueryARB is called while another query is already in
+    *      progress with the same target, an INVALID_OPERATION error is
+    *      generated."
+    */
+   if (*bindpt) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glBeginQuery{Indexed}(target=%s is active)",
+                  _mesa_lookup_enum_by_nr(target));
+      return;
+   }
+
    if (id == 0) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQuery{Indexed}(id==0)");
       return;