Mesa (master): mesa: Fix core GL genned-name handling for glBeginQuery().

Eric Anholt anholt at kemper.freedesktop.org
Sun Nov 4 20:34:55 UTC 2012


Module: Mesa
Branch: master
Commit: 4fce0230fc3528be32562410bcddfc887c4d25a0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fce0230fc3528be32562410bcddfc887c4d25a0

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct 31 15:36:27 2012 -0700

mesa: Fix core GL genned-name handling for glBeginQuery().

Fixes piglit gl-3.1/genned-names.

NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/queryobj.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index d216913..1e39adc 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -321,13 +321,19 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
 
    q = _mesa_lookup_query_object(ctx, id);
    if (!q) {
-      /* create new object */
-      q = ctx->Driver.NewQueryObject(ctx, id);
-      if (!q) {
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}");
+      if (ctx->API == API_OPENGL_CORE) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glBeginQuery{Indexed}(non-gen name)");
          return;
+      } else {
+         /* create new object */
+         q = ctx->Driver.NewQueryObject(ctx, id);
+         if (!q) {
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}");
+            return;
+         }
+         _mesa_HashInsert(ctx->Query.QueryObjects, id, q);
       }
-      _mesa_HashInsert(ctx->Query.QueryObjects, id, q);
    }
    else {
       /* pre-existing object */




More information about the mesa-commit mailing list