From 7ce105d2e6885eeac73c59dc14c4cd59a89c1425 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 10:28:04 -0600 Subject: [PATCH] st/mesa: fix incorrect src/dst stride params to _mesa_generate_mipmap_level() The stride needs to be in texels, not bytes. --- src/mesa/state_tracker/st_gen_mipmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 3a88908022a..dc6d77825f5 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -123,6 +123,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, struct pipe_transfer *srcTrans, *dstTrans; const ubyte *srcData; ubyte *dstData; + int srcStride, dstStride; srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face, srcLevel, zslice, @@ -139,14 +140,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, srcData = (ubyte *) screen->transfer_map(screen, srcTrans); dstData = (ubyte *) screen->transfer_map(screen, dstTrans); + srcStride = srcTrans->stride / srcTrans->block.size; + dstStride = dstTrans->stride / dstTrans->block.size; + _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel], srcData, - srcTrans->stride, /* stride in bytes */ + srcStride, /* stride in texels */ pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel], dstData, - dstTrans->stride); /* stride in bytes */ + dstStride); /* stride in texels */ screen->transfer_unmap(screen, srcTrans); screen->transfer_unmap(screen, dstTrans); -- 2.30.2