Mesa (master): st/mesa: don't use gl_texture_image::RowStride

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 5 20:17:05 PDT 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Oct  5 21:14:37 2011 -0600

st/mesa: don't use gl_texture_image::RowStride

It's always the same as the texture width.

---

 src/mesa/state_tracker/st_cb_texture.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index de3b972..1b93c9d 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1685,16 +1685,18 @@ copy_image_data_to_texture(struct st_context *st,
       pipe_resource_reference(&stImage->pt, NULL);
    }
    else if (stImage->TexData) {
+      /* Copy from malloc'd memory */
+      /* XXX this should be re-examined/tested with a compressed format */
+      GLuint blockSize = util_format_get_blocksize(stObj->pt->format);
+      GLuint srcRowStride = stImage->base.Width * blockSize;
+      GLuint srcSliceStride = stImage->base.Height * srcRowStride;
       st_texture_image_data(st,
                             stObj->pt,
                             stImage->base.Face,
                             dstLevel,
                             stImage->TexData,
-                            stImage->base.RowStride * 
-                            util_format_get_blocksize(stObj->pt->format),
-                            stImage->base.RowStride *
-                            stImage->base.Height *
-                            util_format_get_blocksize(stObj->pt->format));
+                            srcRowStride,
+                            srcSliceStride);
       _mesa_align_free(stImage->TexData);
       stImage->TexData = NULL;
    }



More information about the mesa-commit mailing list