mesa: don't use genned but unnamed xfb objects.
authorDave Airlie <airlied@redhat.com>
Mon, 9 May 2016 06:09:13 +0000 (16:09 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 9 May 2016 20:06:09 +0000 (06:06 +1000)
If we try to draw or query an XFB object that hasn't been bound,
we shouldn't return any information.

This fixes a couple if cases in:
GL33-CTS.transform_feedback.api_errors_test

The ObjectLabel test is inspired by another test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/main/api_validate.c
src/mesa/main/objectlabel.c

index 9d29f8d..a714c0a 100644 (file)
@@ -665,6 +665,15 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
       return GL_FALSE;
    }
 
+   /* From the GL 4.5 specification, page 429:
+    * "An INVALID_VALUE error is generated if id is not the name of a
+    *  transform feedback object."
+    */
+   if (!obj->EverBound) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedback*(name)");
+      return GL_FALSE;
+   }
+
    if (stream >= ctx->Const.MaxVertexStreams) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "glDrawTransformFeedbackStream*(index>=MaxVertexStream)");
index 5070b00..974abbc 100644 (file)
@@ -176,9 +176,13 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
       break;
    case GL_TRANSFORM_FEEDBACK:
       {
+         /* From the GL 4.5 specification, page 536:
+          * "An INVALID_VALUE error is generated if name is not the name of a
+          *  valid object of the type specified by identifier."
+          */
          struct gl_transform_feedback_object *tfo =
             _mesa_lookup_transform_feedback_object(ctx, name);
-         if (tfo)
+         if (tfo && tfo->EverBound)
             labelPtr = &tfo->Label;
       }
       break;