Mesa (master): swrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL )

Chad Versace chadversary at kemper.freedesktop.org
Sat Oct 15 22:45:34 UTC 2011


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

Author: Chad Versace <chad at chad-versace.us>
Date:   Mon Oct 10 15:07:14 2011 -0700

swrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL)

For glReadPixels, the user supplied pixels have format
GL_UNSIGNED_INT_24_8.  But, when the depthstencil buffer's format was
MESA_FORMAT_S8_Z24, the fastpath read from the buffer without reordering
the depth and stencil bits. To fix this, this patch just skips the
fastpath when the format is not MESA_FORMAT_Z24_S8.

The problem and fix for glWritePixels is analagous.

Fixes the Piglit tests below on i965/gen6 and causes no regressions.
   general/depthstencil-default_fb-drawpixels-24_8
   general/depthstencil-default_fb-readpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-drawpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8

Note: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Chad Versace <chad at chad-versace.us>

---

 src/mesa/swrast/s_drawpix.c |    2 ++
 src/mesa/swrast/s_readpix.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 63bfa79..55b31df 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -591,6 +591,8 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
 
    if (depthRb->_BaseFormat == GL_DEPTH_STENCIL_EXT &&
        stencilRb->_BaseFormat == GL_DEPTH_STENCIL_EXT &&
+       depthRb->Format == MESA_FORMAT_Z24_S8 &&
+       type == GL_UNSIGNED_INT_24_8 &&
        depthRb == stencilRb &&
        !scaleOrBias &&
        !zoom &&
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 6eec2fc..0f1f0ff 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -392,6 +392,8 @@ read_depth_stencil_pixels(struct gl_context *ctx,
 
    if (depthRb->_BaseFormat == GL_DEPTH_STENCIL_EXT &&
        stencilRb->_BaseFormat == GL_DEPTH_STENCIL_EXT &&
+       depthRb->Format == MESA_FORMAT_Z24_S8 &&
+       type == GL_UNSIGNED_INT_24_8 &&
        depthRb == stencilRb &&
        !scaleOrBias &&
        !stencilTransfer) {




More information about the mesa-commit mailing list