mesa: complete the GL_TEXTURE_SWIZZLE* setup
[mesa.git] / src / mesa / main / condrender.c
index 8d9a91d5478011d02d9f03e32fe5df4fefc4d066..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;
    }
@@ -117,7 +119,7 @@ _mesa_EndConditionalRender(void)
  * \return GL_TRUE if we should render, GL_FALSE if we should discard
  */
 GLboolean
-_mesa_check_conditional_render(GLcontext *ctx)
+_mesa_check_conditional_render(struct gl_context *ctx)
 {
    struct gl_query_object *q = ctx->Query.CondRenderQuery;