Fixes piglit gl-3.1/genned-names.
---
 src/mesa/main/queryobj.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index d216913..2a39176 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -321,13 +321,18 @@ _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(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 */
-- 
1.7.10.4

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to