Mesa (7.10): st/mesa: fix compressed mipmap generation.
Marek Olšák
mareko at kemper.freedesktop.org
Sun Jun 12 03:45:38 UTC 2011
Module: Mesa
Branch: 7.10
Commit: 08c47e485146a87c5ab53840bd7fe3d9cf29bc8b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08c47e485146a87c5ab53840bd7fe3d9cf29bc8b
Author: Dave Airlie <airlied at redhat.com>
Date: Tue Feb 15 12:50:37 2011 +1000
st/mesa: fix compressed mipmap generation.
If the underlying transfer had a stride wider for hw alignment reasons,
the mipmap generation would generate badly strided images.
this fixes a few problems I found while testing r600g with s3tc
Signed-off-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit fdb4373a2083ccd0363737fade295b0bedaf9f50 by Marek)
This fixes the DXT1 tests from fbo-generatemipmap-formats on some drivers.
---
src/mesa/state_tracker/st_gen_mipmap.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 7f3fd88..2fb6e66 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -114,13 +114,12 @@ st_render_mipmap(struct st_context *st,
static void
decompress_image(enum pipe_format format,
const uint8_t *src, uint8_t *dst,
- unsigned width, unsigned height)
+ unsigned width, unsigned height, unsigned src_stride)
{
const struct util_format_description *desc = util_format_description(format);
const uint bw = util_format_get_blockwidth(format);
const uint bh = util_format_get_blockheight(format);
const uint dst_stride = 4 * MAX2(width, bw);
- const uint src_stride = util_format_get_stride(format, width);
desc->unpack_rgba_8unorm(dst, dst_stride, src, src_stride, width, height);
@@ -153,10 +152,9 @@ decompress_image(enum pipe_format format,
static void
compress_image(enum pipe_format format,
const uint8_t *src, uint8_t *dst,
- unsigned width, unsigned height)
+ unsigned width, unsigned height, unsigned dst_stride)
{
const struct util_format_description *desc = util_format_description(format);
- const uint dst_stride = util_format_get_stride(format, width);
const uint src_stride = 4 * width;
desc->pack_rgba_8unorm(dst, dst_stride, src, src_stride, width, height);
@@ -245,7 +243,7 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
dstTemp = malloc(dstWidth2 * dstHeight2 * comps + 000);
/* decompress the src image: srcData -> srcTemp */
- decompress_image(format, srcData, srcTemp, srcWidth, srcHeight);
+ decompress_image(format, srcData, srcTemp, srcWidth, srcHeight, srcTrans->stride);
_mesa_generate_mipmap_level(target, datatype, comps,
0 /*border*/,
@@ -257,7 +255,7 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
dstWidth2); /* stride in texels */
/* compress the new image: dstTemp -> dstData */
- compress_image(format, dstTemp, dstData, dstWidth, dstHeight);
+ compress_image(format, dstTemp, dstData, dstWidth, dstHeight, dstTrans->stride);
free(srcTemp);
free(dstTemp);
More information about the mesa-commit
mailing list