mesa: Fix order of errors for glDrawTransformFeedbackStream
authorChris Forbes <chrisf@ijw.co.nz>
Sat, 18 Oct 2014 08:12:07 +0000 (21:12 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 29 Oct 2014 08:25:20 +0000 (21:25 +1300)
The OpenGL 4.0 core profile specification, section 2.17.3
Transform Feedback Draw Operations says:

   "The error INVALID_VALUE is generated if <stream> is greater
    than or equal to the value of MAX_VERTEX_STREAMS.
    ...
    The error INVALID_OPERATION
    is generated if EndTransformFeedback has never been called
    while the object named by id was bound."

Fixes the piglit test:
   ARB_transform_feedback3/arb_transform_feedback3-draw_using_invalid_stream_index
   (with the test itself fixed to eliminate an unrelated failure)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/api_validate.c

index 9b80600dedac4138fc867f3f164623f7292b0272..a3a2d2580377247dc4f5009132cf4d34ac94856f 100644 (file)
@@ -749,17 +749,17 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
       return GL_FALSE;
    }
 
-   if (!obj->EndedAnytime) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*");
-      return GL_FALSE;
-   }
-
    if (stream >= ctx->Const.MaxVertexStreams) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "glDrawTransformFeedbackStream*(index>=MaxVertexStream)");
       return GL_FALSE;
    }
 
+   if (!obj->EndedAnytime) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*");
+      return GL_FALSE;
+   }
+
    if (numInstances <= 0) {
       if (numInstances < 0)
          _mesa_error(ctx, GL_INVALID_VALUE,