[Mesa-dev] [PATCH 25/38] main: Complete error conditions for glInvalidate*Framebuffer.

Laura Ekstrand laura at jlekstrand.net
Tue Mar 3 17:32:17 PST 2015


---
 src/mesa/main/fbobject.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 7a1684c..0b4cabe 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3476,12 +3476,29 @@ invalidate_framebuffer_storage(struct gl_context *ctx,
 {
    int i;
 
+   /* 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
@@ -3574,7 +3591,8 @@ invalidate_framebuffer_storage(struct gl_context *ctx,
    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;
 }
 
-- 
2.1.0



More information about the mesa-dev mailing list