[Mesa-dev] [PATCH 2/3] texcompress_s3tc: fix stride checks

Iago Toral itoral at igalia.com
Tue Sep 1 07:31:20 PDT 2015


On Tue, 2015-09-01 at 16:41 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> The fastpath currently checks the stride != width, but

Maybe replace stride with RowLength in the line above to make things
more clear. 

> if you have a RowLength of 7, and Alignment of 4, then
> that shuoldn't match.

Typo in shouldn't

> align the rowlength to the pack alignment before comparing.

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

BTW, it seems that at least _mesa_texstore_rgb_fxt1 in
texcompress_fxt1.c has the same issue, right?

> This fixes compressed cases in CTS packed_pixels_pixelstore
> test when SKIP_PIXELS is enabled, which causes row length
> to get set.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/main/texcompress_s3tc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
> index 7ce3cb8..6cfe06a 100644
> --- a/src/mesa/main/texcompress_s3tc.c
> +++ b/src/mesa/main/texcompress_s3tc.c
> @@ -130,7 +130,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
>     if (srcFormat != GL_RGB ||
>         srcType != GL_UNSIGNED_BYTE ||
>         ctx->_ImageTransferState ||
> -       srcPacking->RowLength != srcWidth ||
> +       ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
>         srcPacking->SwapBytes) {
>        /* convert image to RGB/GLubyte */
>        GLubyte *tempImageSlices[1];
> @@ -187,7 +187,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
>     if (srcFormat != GL_RGBA ||
>         srcType != GL_UNSIGNED_BYTE ||
>         ctx->_ImageTransferState ||
> -       srcPacking->RowLength != srcWidth ||
> +       ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
>         srcPacking->SwapBytes) {
>        /* convert image to RGBA/GLubyte */
>        GLubyte *tempImageSlices[1];
> @@ -244,7 +244,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
>     if (srcFormat != GL_RGBA ||
>         srcType != GL_UNSIGNED_BYTE ||
>         ctx->_ImageTransferState ||
> -       srcPacking->RowLength != srcWidth ||
> +       ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
>         srcPacking->SwapBytes) {
>        /* convert image to RGBA/GLubyte */
>        GLubyte *tempImageSlices[1];
> @@ -300,7 +300,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
>     if (srcFormat != GL_RGBA ||
>         srcType != GL_UNSIGNED_BYTE ||
>         ctx->_ImageTransferState ||
> -       srcPacking->RowLength != srcWidth ||
> +       ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
>         srcPacking->SwapBytes) {
>        /* convert image to RGBA/GLubyte */
>        GLubyte *tempImageSlices[1];




More information about the mesa-dev mailing list