Mesa (master): Fix compressed texture loads for non-minimal pitches again

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 25 15:31:38 UTC 2010


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

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Tue Jan 19 17:39:27 2010 -0800

Fix compressed texture loads for non-minimal pitches again

My commit eea6a7639f767b1d30b6ef1f91a9c49e3f3b78f0 does a memcpy of height
lines, but that's wrong because the texture has a block layout and we
must thus use the number of vertical blocks instead of the height.

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/state_tracker/st_cb_texture.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b94bfc8..cee2452 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -686,9 +686,11 @@ st_TexImage(GLcontext * ctx,
       {
          char *dst = texImage->Data;
          const char *src = pixels;
-         int i;
+         GLuint i, bw, bh, lines;
+         _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+         lines = (height + bh - 1) / bh;
 
-         for(i = 0; i < height; ++i)
+         for(i = 0; i < lines; ++i)
          {
             memcpy(dst, src, srcImageStride);
             dst += dstRowStride;




More information about the mesa-commit mailing list