diff options
author | Ian Romanick <[email protected]> | 2014-01-09 14:08:55 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-01-10 17:19:48 -0800 |
commit | 2dc35a619c50139d07ad96fc4dfe456e5811c84e (patch) | |
tree | 6fddef94d90f7e3b1daf909232acffbe6888d1f6 /src/mesa/main/condrender.c | |
parent | db1dc21a75d110344c0a7eccbddcce9c3a1b99d9 (diff) |
mesa: Set the correct error in _mesa_BeginConditionalRender
Piglit was recently changed to expect the correct error code (piglit
commit 271b998), so it started failing on Mesa. This corrects that
failing and adds some spec quotations to justify the errrors set.
The code was rearranged a little bit to match the order listed in the
spec.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/main/condrender.c')
-rw-r--r-- | src/mesa/main/condrender.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index 2632f7a1a37..0ad1e5c2aee 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -40,17 +40,38 @@ void GLAPIENTRY _mesa_BeginConditionalRender(GLuint queryId, GLenum mode) { - struct gl_query_object *q; + struct gl_query_object *q = NULL; GET_CURRENT_CONTEXT(ctx); - if (!ctx->Extensions.NV_conditional_render || ctx->Query.CondRenderQuery || - queryId == 0) { + /* Section 2.14 (Conditional Rendering) of the OpenGL 3.0 spec says: + * + * "If BeginConditionalRender is called while conditional rendering is + * in progress, or if EndConditionalRender is called while conditional + * rendering is not in progress, the error INVALID_OPERATION is + * generated." + */ + if (!ctx->Extensions.NV_conditional_render || ctx->Query.CondRenderQuery) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginConditionalRender()"); return; } ASSERT(ctx->Query.CondRenderMode == GL_NONE); + /* Section 2.14 (Conditional Rendering) of the OpenGL 3.0 spec says: + * + * "The error INVALID_VALUE is generated if <id> is not the name of an + * existing query object query." + */ + if (queryId != 0) + q = _mesa_lookup_query_object(ctx, queryId); + + if (!q) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBeginConditionalRender(bad queryId=%u)", queryId); + return; + } + ASSERT(q->Id == queryId); + switch (mode) { case GL_QUERY_WAIT: case GL_QUERY_NO_WAIT: @@ -64,14 +85,12 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode) return; } - q = _mesa_lookup_query_object(ctx, queryId); - if (!q) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glBeginConditionalRender(bad queryId=%u)", queryId); - return; - } - ASSERT(q->Id == queryId); - + /* Section 2.14 (Conditional Rendering) of the OpenGL 3.0 spec says: + * + * "The error INVALID_OPERATION is generated if <id> is the name of a + * query object with a target other than SAMPLES_PASSED, or <id> is the + * name of a query currently in progress." + */ if ((q->Target != GL_SAMPLES_PASSED && q->Target != GL_ANY_SAMPLES_PASSED && q->Target != GL_ANY_SAMPLES_PASSED_CONSERVATIVE) || q->Active) { |