main: Complete error conditions for glInvalidate*Framebuffer.
authorLaura Ekstrand <laura@jlekstrand.net>
Wed, 4 Feb 2015 22:21:17 +0000 (14:21 -0800)
committerFredrik Höglund <fredrik@kde.org>
Thu, 14 May 2015 13:48:14 +0000 (15:48 +0200)
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
src/mesa/main/fbobject.c

index 15878d327c69797ee7c50a40f91506d6ada8e030..7ba725588302b863cf8308f8d97519dae0386c51 100644 (file)
@@ -3650,12 +3650,29 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments,
       return;
    }
 
+   /* Section 17.4 Whole Framebuffer Operations of the OpenGL 4.5 Core
+    * Spec (2.2.2015, PDF page 522) says:
+    *    "An INVALID_VALUE error is generated if numAttachments, width, or
+    *    height is negative."
+    */
    if (numAttachments < 0) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "%s(numAttachments < 0)", name);
       return;
    }
 
+   if (width < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "%s(width < 0)", name);
+      return;
+   }
+
+   if (height < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "%s(height < 0)", name);
+      return;
+   }
+
    /* The GL_ARB_invalidate_subdata spec says:
     *
     *     "If an attachment is specified that does not exist in the
@@ -3748,7 +3765,8 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments,
    return;
 
 invalid_enum:
-   _mesa_error(ctx, GL_INVALID_ENUM, "%s(attachment)", name);
+   _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid attachment %s)", name,
+               _mesa_lookup_enum_by_nr(attachments[i]));
    return;
 }