Mesa (master): intel: Allow binding a stencil but not a depth buffer.

Eric Anholt anholt at kemper.freedesktop.org
Mon Dec 28 18:53:01 PST 2009


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Dec 28 18:15:06 2009 -0800

intel: Allow binding a stencil but not a depth buffer.

Wine's d3d9 visual.c testcase tries this a lot, so I've added some
piglit tests (fbo-nodepth-test, fbo-nostencil-test, fbo-stencil-only)
and enabled it.

---

 src/mesa/drivers/dri/intel/intel_buffers.c |    6 ++++++
 src/mesa/drivers/dri/intel/intel_fbo.c     |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 0564318..97d56e4 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -291,6 +291,12 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
       FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE);
    }
 
+   /* If we have a (packed) stencil buffer attached but no depth buffer,
+    * we still need to set up the shared depth/stencil state so we can use it.
+    */
+   if (depthRegion == NULL && irbStencil && irbStencil->region)
+      depthRegion = irbStencil->region;
+
    /*
     * Update depth and stencil test state
     */
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index dc96b36..b5ca418 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -591,7 +591,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
       intel_get_renderbuffer(fb, BUFFER_STENCIL);
    int i;
 
-   if (stencilRb && stencilRb != depthRb) {
+   if (depthRb && stencilRb && stencilRb != depthRb) {
       /* we only support combined depth/stencil buffers, not separate
        * stencil buffers.
        */



More information about the mesa-commit mailing list