mesa: fix incorrect GL_DEPTH_STENCIL_ATTACHMENT format check

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.
This commit is contained in:
Brian Paul 2010-05-27 13:05:23 -06:00
parent 90e5a37d12
commit a504f2387e
1 changed files with 3 additions and 3 deletions

View 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"