more tweaks to error checking and reporting
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 28 Nov 2003 21:06:40 +0000 (21:06 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 28 Nov 2003 21:06:40 +0000 (21:06 +0000)
src/mesa/main/occlude.c

index 2a3f8a00b9d920216538cf340a4b8a8c3de0ffe7..c8fa1dfacd85d0c8238037916bd2de9697a9eaa5 100644 (file)
@@ -220,7 +220,7 @@ void GLAPIENTRY
 _mesa_EndQueryARB(GLenum target)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct occlusion_query *q;
+   struct occlusion_query *q = NULL;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    FLUSH_VERTICES(ctx, _NEW_DEPTH);
@@ -230,11 +230,12 @@ _mesa_EndQueryARB(GLenum target)
       return;
    }
 
-   q = (struct occlusion_query *)
-      _mesa_HashLookup(ctx->Occlusion.QueryObjects,
-                       ctx->Occlusion.CurrentQueryObject);
+   if (ctx->Occlusion.CurrentQueryObject)
+      q = (struct occlusion_query *)
+         _mesa_HashLookup(ctx->Occlusion.QueryObjects,
+                          ctx->Occlusion.CurrentQueryObject);
    if (!q || !q->Active) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQuery with glBeginQuery");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQuery with no glBeginQuery");
       return;
    }
 
@@ -282,7 +283,7 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
          _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
 
    if (!q || q->Active) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectivARB");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectivARB(id=%d)", id);
       return;
    }
 
@@ -312,7 +313,7 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
       q = (struct occlusion_query *)
          _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
    if (!q || q->Active) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB(id=%d", id);
       return;
    }