Mesa (master): mesa: allow depth/ stencil textures to be attached to GL_STENCIL_ATTACHMENT

Brian Paul brianp at kemper.freedesktop.org
Tue May 19 16:09:51 UTC 2009


Module: Mesa
Branch: master
Commit: 042d9a513213b1fa356c0d80abc62b9327e0bcc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=042d9a513213b1fa356c0d80abc62b9327e0bcc2

Author: Mathias Fröhlich <frohlich8 at users.sourceforge.net>
Date:   Tue May 19 09:59:01 2009 -0600

mesa: allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT

See sourceforge bug #2793846.

---

 src/mesa/main/fbobject.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 9c5a590..e8e8c2b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -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) {




More information about the mesa-commit mailing list