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

Brian Paul brianp at kemper.freedesktop.org
Tue May 19 09:07:13 PDT 2009


Module: Mesa
Branch: mesa_7_4_branch
Commit: 63d1e89138fca3e04896392a9f62e04ee88249fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=63d1e89138fca3e04896392a9f62e04ee88249fe

Author: Brian Paul <brianp at vmware.com>
Date:   Tue May 19 10:04:17 2009 -0600

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

See sourceforge bug #2793846.

(cherry picked from commit 042d9a513213b1fa356c0d80abc62b9327e0bcc2)

---

 src/mesa/main/fbobject.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 876d691..5a7ba45 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -323,6 +323,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 */
          }
@@ -332,9 +333,18 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
          }
       }
       else {
-         /* no such thing as stencil textures */
-         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->Complete = GL_FALSE;
+            return;
+         }
       }
    }
    else if (att->Type == GL_RENDERBUFFER_EXT) {



More information about the mesa-commit mailing list