mesa: Refuse to EndQuery with a mismatched query target.
authorEric Anholt <eric@anholt.net>
Wed, 17 Oct 2012 00:26:05 +0000 (17:26 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 23 Oct 2012 00:36:53 +0000 (17:36 -0700)
v2: Add a comment about what we're checking for.

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

index ac03649084985c4da36e4e80f844e41589a7e881..735e4d1b1abc4cc3a773117f991911e66f60918c 100644 (file)
@@ -374,6 +374,16 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
 
    /* XXX should probably refcount query objects */
    q = *bindpt;
+
+   /* Check for GL_ANY_SAMPLES_PASSED vs GL_SAMPLES_PASSED. */
+   if (q && q->Target != target) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glEndQuery(target=%s with active query of target %s)",
+                  _mesa_lookup_enum_by_nr(target),
+                  _mesa_lookup_enum_by_nr(q->Target));
+      return;
+   }
+
    *bindpt = NULL;
 
    if (!q || !q->Active) {