X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=inline;f=src%2Fmesa%2Fmain%2Fcondrender.c;h=57f3715211d01e509165e865ec20bd0534b2b0de;hb=77cd3bf18d509dcbb2f121e4082027f4048ca623;hp=8d9a91d5478011d02d9f03e32fe5df4fefc4d066;hpb=fd70841121475d7aad98812d6bf9c9c67567b89a;p=mesa.git diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index 8d9a91d5478..57f3715211d 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -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;