Mesa (mesa_7_5_branch): mesa: move assertions in test_attachment_completeness()

Brian Paul brianp at kemper.freedesktop.org
Fri Aug 14 17:25:16 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 3ffaa11f888ced2ae5da7e794a57f20dcc7a3dfc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ffaa11f888ced2ae5da7e794a57f20dcc7a3dfc

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Aug 14 10:30:10 2009 -0600

mesa: move assertions in test_attachment_completeness()

Put the assertions after the error checks.

---

 src/mesa/main/fbobject.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ab91fbc..825a230 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -417,21 +417,22 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       if (format == GL_COLOR) {
          if (att->Renderbuffer->_BaseFormat != GL_RGB &&
              att->Renderbuffer->_BaseFormat != GL_RGBA) {
-            ASSERT(att->Renderbuffer->RedBits);
-            ASSERT(att->Renderbuffer->GreenBits);
-            ASSERT(att->Renderbuffer->BlueBits);
             att_incomplete("bad renderbuffer color format");
             att->Complete = GL_FALSE;
             return;
          }
+         ASSERT(att->Renderbuffer->RedBits);
+         ASSERT(att->Renderbuffer->GreenBits);
+         ASSERT(att->Renderbuffer->BlueBits);
       }
       else if (format == GL_DEPTH) {
-         ASSERT(att->Renderbuffer->DepthBits);
          if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
+            ASSERT(att->Renderbuffer->DepthBits);
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
                   att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+            ASSERT(att->Renderbuffer->DepthBits);
             /* OK */
          }
          else {
@@ -442,12 +443,13 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       }
       else {
          assert(format == GL_STENCIL);
-         ASSERT(att->Renderbuffer->StencilBits);
          if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
+            ASSERT(att->Renderbuffer->StencilBits);
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
                   att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+            ASSERT(att->Renderbuffer->StencilBits);
             /* OK */
          }
          else {




More information about the mesa-commit mailing list