Mesa (master): unichrome: Mostly revert my convolution removal changes.

Eric Anholt anholt at kemper.freedesktop.org
Thu Sep 23 23:21:20 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Sep 23 16:19:18 2010 -0700

unichrome: Mostly revert my convolution removal changes.

For this driver, the minimum pitch alignment stuff does appear to be
necessary, so leave the separate munged width/height variable in
place.

---

 src/mesa/drivers/dri/unichrome/via_tex.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 01cb3eb..9ae9466 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -663,6 +663,8 @@ static void viaTexImage(GLcontext *ctx,
 			struct gl_texture_image *texImage)
 {
    struct via_context *vmesa = VIA_CONTEXT(ctx);
+   GLint postConvWidth = width;
+   GLint postConvHeight = height;
    GLint texelBytes, sizeInBytes;
    struct via_texture_object *viaObj = (struct via_texture_object *)texObj;
    struct via_texture_image *viaImage = (struct via_texture_image *)texImage;
@@ -682,13 +684,13 @@ static void viaTexImage(GLcontext *ctx,
    texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
 
    /* Minimum pitch of 32 bytes */
-   if (width * texelBytes < 32) {
-      width = 32 / texelBytes;
-      texImage->RowStride = width;
+   if (postConvWidth * texelBytes < 32) {
+      postConvWidth = 32 / texelBytes;
+      texImage->RowStride = postConvWidth;
    }
 
-   assert(texImage->RowStride == width);
-   viaImage->pitchLog2 = logbase2(width * texelBytes);
+   assert(texImage->RowStride == postConvWidth);
+   viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes);
 
    /* allocate memory */
    if (_mesa_is_format_compressed(texImage->TexFormat))
@@ -697,7 +699,7 @@ static void viaTexImage(GLcontext *ctx,
                                             texImage->Height,
                                             texImage->Depth);
    else
-      sizeInBytes = width * height * texelBytes;
+      sizeInBytes = postConvWidth * postConvHeight * texelBytes;
 
 
    /* Attempt to allocate texture memory directly, otherwise use main
@@ -778,7 +780,7 @@ static void viaTexImage(GLcontext *ctx,
          dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
       }
       else {
-         dstRowStride = width * _mesa_get_format_bytes(texImage->TexFormat);
+         dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat);
       }
       success = _mesa_texstore(ctx, dims,
                                texImage->_BaseFormat,




More information about the mesa-commit mailing list