summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-08 20:10:15 -0700
committerBrian Paul <[email protected]>2012-02-10 08:06:57 -0700
commit07459ba50979a99e12720bd9e41a1aa3b8d24e41 (patch)
tree2cfe8cc84f3b802f9008bb2feeaf6936f6d45b0a /src/mesa/main/texcompress.c
parent9d9111108eadd65708899284b1cfa9ca425f3ac8 (diff)
mesa: push row stride adjustment down into _mesa_decompress_image()
There's a mismatch in row strides for compressed textures between what Driver.MapTextureImage() returns and what the software fetch-texel functions use. Move it down a layer. The next step would be to fix this in the fetch-texel functions.
Diffstat (limited to 'src/mesa/main/texcompress.c')
-rw-r--r--src/mesa/main/texcompress.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 44590ea96db..c376b970ede 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -465,6 +465,8 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
/**
* Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image.
+ * \param srcRowStride stride in bytes between rows of blocks in the
+ * compressed source image.
*/
void
_mesa_decompress_image(gl_format format, GLuint width, GLuint height,
@@ -475,11 +477,19 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
GLint i, GLint j, GLint k, GLfloat *texel);
struct swrast_texture_image texImage; /* dummy teximage */
GLuint i, j;
+ GLuint bytes, bw, bh;
+
+ bytes = _mesa_get_format_bytes(format);
+ _mesa_get_format_block_size(format, &bw, &bh);
/* setup dummy texture image info */
memset(&texImage, 0, sizeof(texImage));
texImage.Map = (void *) src;
- texImage.RowStride = srcRowStride;
+
+ /* XXX This line is a bit of a hack to adapt to the row stride
+ * convention used by the texture decompression functions.
+ */
+ texImage.RowStride = srcRowStride * bh / bytes;
switch (format) {
/* DXT formats */