s/format/baseFormat/ to be more explicit
[mesa.git] / src / mesa / main / condrender.c
index 25b3dd678dc5399b753d2531bf547bb40a0091de..57f3715211d01e509165e865ec20bd0534b2b0de 100644 (file)
@@ -34,6 +34,7 @@
 #include "glheader.h"
 #include "condrender.h"
 #include "enums.h"
+#include "mtypes.h"
 #include "queryobj.h"
 
 
@@ -43,7 +44,8 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
    struct gl_query_object *q;
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->Extensions.NV_conditional_render || ctx->Query.CondRenderQuery) {
+   if (!ctx->Extensions.NV_conditional_render || ctx->Query.CondRenderQuery ||
+       queryId == 0) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginConditionalRender()");
       return;
    }
@@ -71,7 +73,7 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
    }
    ASSERT(q->Id == queryId);
 
-   if (q->Target != GL_SAMPLES_PASSED) {
+   if (q->Target != GL_SAMPLES_PASSED || q->Active) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginConditionalRender()");
       return;
    }