mesa: fix incorrect GL_DEPTH_STENCIL_ATTACHMENT format check
authorBrian Paul <brianp@vmware.com>
Thu, 27 May 2010 19:05:23 +0000 (13:05 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 27 May 2010 19:11:08 +0000 (13:11 -0600)
We want to check the incoming renderbuffer format, not the (potentially
non-existant) current attachment.

Fixes segfault w/ fbotexture -ds2.

NOTE: this will be applied to the 7.8 branch too.

src/mesa/main/fbobject.c

index bf445d2b2990f463491f5d4a9abaeac09a4c6c7a..bc4741b279d9fa60de57da8466eb719a5ab71136 100644 (file)
@@ -1802,10 +1802,10 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
       rb = NULL;
    }
 
-   if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+   if (attachment == GL_DEPTH_STENCIL_ATTACHMENT &&
+       rb && rb->Format != MESA_FORMAT_NONE) {
       /* make sure the renderbuffer is a depth/stencil format */
-      const GLenum baseFormat =
-         _mesa_get_format_base_format(att->Renderbuffer->Format);
+      const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
       if (baseFormat != GL_DEPTH_STENCIL) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glFramebufferRenderbufferEXT(renderbuffer"