mesa: allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT
authorMathias Fröhlich <frohlich8@users.sourceforge.net>
Tue, 19 May 2009 15:59:01 +0000 (09:59 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 19 May 2009 15:59:01 +0000 (09:59 -0600)
See sourceforge bug #2793846.

src/mesa/main/fbobject.c

index 9c5a5908a2208a5c950ee30ff3ce0bfa9b79d6e4..e8e8c2bf30e53163915020537a8872519bebd571 100644 (file)
@@ -374,6 +374,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
+                  ctx->Extensions.ARB_depth_texture &&
                   texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
             /* OK */
          }
@@ -384,10 +385,19 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
          }
       }
       else {
-         /* no such thing as stencil textures */
-         att_incomplete("illegal stencil texture");
-         att->Complete = GL_FALSE;
-         return;
+         ASSERT(format == GL_STENCIL);
+         ASSERT(att->Renderbuffer->StencilBits);
+         if (ctx->Extensions.EXT_packed_depth_stencil &&
+             ctx->Extensions.ARB_depth_texture &&
+             att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+            /* OK */
+         }
+         else {
+            /* no such thing as stencil-only textures */
+            att_incomplete("illegal stencil texture");
+            att->Complete = GL_FALSE;
+            return;
+         }
       }
    }
    else if (att->Type == GL_RENDERBUFFER_EXT) {