From 56f99ee640772f71c1eac0388ba2d70935010e3e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Apr 2010 10:05:00 -0600 Subject: st/mesa: fill in stImage->level in st_generate_mipmap() Before, this field was always zero for all the new mipmap levels. Fixes problems with glGetTexImage() from a generated mipmap. --- src/mesa/state_tracker/st_gen_mipmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index f67d7b4cb5c..4a3e38de449 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -297,7 +297,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, dstImage->TexFormat = srcImage->TexFormat; - stImage = (struct st_texture_image *) dstImage; + stImage = st_texture_image(dstImage); + stImage->level = dstLevel; + pipe_texture_reference(&stImage->pt, pt); } } -- cgit v1.2.3 From 7b640f9f708306b3e8c661771f29bf24bf8687fb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Apr 2010 10:06:05 -0600 Subject: st/mesa: fix incorrect RowStride computation Fixes incorrect stride when getting a compressed tex image. --- src/mesa/state_tracker/st_cb_texture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 92eefca2e79..61d3f0f98cc 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -931,7 +931,10 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, PIPE_TRANSFER_READ, 0, 0, stImage->base.Width, stImage->base.Height); - texImage->RowStride = stImage->transfer->stride / util_format_get_blocksize(stImage->pt->format); + /* compute stride in texels from stride in bytes */ + texImage->RowStride = stImage->transfer->stride + * util_format_get_blockwidth(stImage->pt->format) + / util_format_get_blocksize(stImage->pt->format); } else { /* Otherwise, the image should actually be stored in -- cgit v1.2.3