Mesa (master): mesa: fix texstore addressing bugs for depth/stencil formats

Brian Paul brianp at kemper.freedesktop.org
Wed Jul 6 21:15:24 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jul  6 15:04:17 2011 -0600

mesa: fix texstore addressing bugs for depth/stencil formats

Using GLuint pointers worked when the pixel size was four bytes
or the row stride was a multiple of four but was otherwise broken.
Fixes failures found with the piglit fbo-stencil test.

This helps to fix https://bugs.freedesktop.org/show_bug.cgi?id=38729

NOTE: This is a candidate for the 7.11 branch.

---

 src/mesa/main/texstore.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 5c925a3..e527981 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3303,8 +3303,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
 {
    const GLuint depthScale = 0xffffff;
    const GLint srcRowStride
-      = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
-      / sizeof(GLuint);
+      = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
    GLint img, row;
 
    ASSERT(dstFormat == MESA_FORMAT_Z24_S8);
@@ -3332,8 +3331,8 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
             + dstImageOffsets[dstZoffset + img]
             + dstYoffset * dstRowStride / sizeof(GLuint)
             + dstXoffset;
-         const GLuint *src
-            = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
+         const GLubyte *src
+            = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
                   srcWidth, srcHeight,
                   srcFormat, srcType,
                   img, 0, 0);
@@ -3390,8 +3389,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
 {
    const GLuint depthScale = 0xffffff;
    const GLint srcRowStride
-      = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
-      / sizeof(GLuint);
+      = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
    GLint img, row;
 
    ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
@@ -3406,8 +3404,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
 	 + dstImageOffsets[dstZoffset + img]
 	 + dstYoffset * dstRowStride / sizeof(GLuint)
 	 + dstXoffset;
-      const GLuint *src
-	 = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
+      const GLubyte *src
+	 = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
 						srcWidth, srcHeight,
 						srcFormat, srcType,
 						img, 0, 0);
@@ -3479,8 +3477,7 @@ _mesa_texstore_s8(TEXSTORE_PARAMS)
    }
    else {
       const GLint srcRowStride
-	 = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
-	 / sizeof(GLuint);
+	 = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
       GLint img, row;
       
       for (img = 0; img < srcDepth; img++) {
@@ -3488,8 +3485,8 @@ _mesa_texstore_s8(TEXSTORE_PARAMS)
             + dstImageOffsets[dstZoffset + img]
             + dstYoffset * dstRowStride / sizeof(GLuint)
             + dstXoffset;
-         const GLuint *src
-            = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
+         const GLubyte *src
+            = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
                                                    srcWidth, srcHeight,
                                                    srcFormat, srcType,
                                                    img, 0, 0);




More information about the mesa-commit mailing list