The current glCompressedTexImage support in the state tracker assumes that compressed textures have minimal pitch.
However, in some cases this is not true, such as for mipmaps of non-POT compressed textures on nVidia hardware. This patch adds a check and does a memcpy for each line instead of the whole image in that case. --- src/mesa/state_tracker/st_cb_texture.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 84e946e..d1416f0 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -683,7 +683,20 @@ st_TexImage(GLcontext * ctx, * conversion and copy: */ if (compressed_src) { - memcpy(texImage->Data, pixels, imageSize); + const GLuint srcImageStride = _mesa_format_row_stride(texImage->TexFormat, width); + if(dstRowStride == srcImageStride) + memcpy(texImage->Data, pixels, imageSize); + else + { + char* dst = texImage->Data; + char* src = pixels; + for(int i = 0; i < height; ++i) + { + memcpy(dst, src, srcImageStride); + dst += dstRowStride; + src += srcImageStride; + } + } } else { const GLuint srcImageStride = -- 1.6.3.3 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev