[Mesa-dev] [PATCH 10/11] mesa: Return error if BeginQuery is called with an existing object of different type

Eduardo Lima Mitev elima at igalia.com
Tue Feb 10 07:40:47 PST 2015


Section 2.14 Asynchronous Queries, page 84 of the OpenGL ES 3.0.4
spec states:

  "BeginQuery generates an INVALID_OPERATION error if any of the
   following conditions hold: [...] id is the name of an
   existing query object whose type does not match target; [...]

Similar wording exists in the OpenGL 4.5 spec, section 4.2. QUERY
OBJECTS AND ASYNCHRONOUS QUERIES, page 43.

Fixes 1 dEQP test:
* dEQP-GLES3.functional.negative_api.fragment.begin_query
---
 src/mesa/main/queryobj.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 8ce899f..6b4a58b 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -361,6 +361,22 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
                      "glBeginQuery{Indexed}(query already active)");
          return;
       }
+
+      /* Section 2.14 Asynchronous Queries, page 84 of the OpenGL ES 3.0.4
+       * spec states:
+       *
+       *     "BeginQuery generates an INVALID_OPERATION error if any of the
+       *      following conditions hold: [...] id is the name of an
+       *      existing query object whose type does not match target; [...]
+       *
+       * Similar wording exists in the OpenGL 4.5 spec, section 4.2. QUERY
+       * OBJECTS AND ASYNCHRONOUS QUERIES, page 43.
+       */
+      if (q->EverBound && q->Target != target) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glBeginQuery{Indexed}(target mismatch)");
+         return;
+      }
    }
 
    q->Target = target;
-- 
2.1.3



More information about the mesa-dev mailing list