st/mesa: fix incorrect RowStride computation
authorBrian Paul <brianp@vmware.com>
Wed, 28 Apr 2010 16:06:05 +0000 (10:06 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 28 Apr 2010 16:06:08 +0000 (10:06 -0600)
Fixes incorrect stride when getting a compressed tex image.

src/mesa/state_tracker/st_cb_texture.c

index 92eefca2e79068d41c20a280b98af7c6bb04777b..61d3f0f98cc2591741afe34a0f697f8a7ed70e54 100644 (file)
@@ -931,7 +931,10 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
                                             PIPE_TRANSFER_READ, 0, 0,
                                             stImage->base.Width,
                                             stImage->base.Height);
-      texImage->RowStride = stImage->transfer->stride / util_format_get_blocksize(stImage->pt->format);
+      /* compute stride in texels from stride in bytes */
+      texImage->RowStride = stImage->transfer->stride
+         * util_format_get_blockwidth(stImage->pt->format)
+         / util_format_get_blocksize(stImage->pt->format);
    }
    else {
       /* Otherwise, the image should actually be stored in