st/mesa: don't use gl_texture_image::RowStride
authorBrian Paul <brianp@vmware.com>
Thu, 6 Oct 2011 03:14:37 +0000 (21:14 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 6 Oct 2011 03:14:37 +0000 (21:14 -0600)
It's always the same as the texture width.

src/mesa/state_tracker/st_cb_texture.c

index de3b972cfd4c18a556487ac7ee42e08bbc5c64b2..1b93c9d06149f5f735381a8b05e56a195489d7de 100644 (file)
@@ -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;
    }