Mesa (master): r600g: fix copying between NPOT mipmapped compressed textures

Marek Olšák mareko at kemper.freedesktop.org
Thu Aug 16 19:01:02 UTC 2012


Module: Mesa
Branch: master
Commit: 6fd9218bb44b8719da60ce325d4f41c4a611e871
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fd9218bb44b8719da60ce325d4f41c4a611e871

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Aug 16 19:05:22 2012 +0200

r600g: fix copying between NPOT mipmapped compressed textures

We aligned the dimensions to the blocksize, then divided by it
(in r600_blit.c), then minified, which was wrong.

The minification must be done first, not last.
This fixes piglit/fbo-generatemipmap-formats with S3TC and maybe
a bunch of other tests too. Tested on RV730.

---

 src/gallium/drivers/r600/r600_texture.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index ac49038..c1499e6 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -340,6 +340,7 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe,
 						struct pipe_resource *texture,
 						const struct pipe_surface *templ)
 {
+	struct r600_texture *rtex = (struct r600_texture*)texture;
 	struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
 	unsigned level = templ->u.tex.level;
 
@@ -350,8 +351,8 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe,
 	pipe_resource_reference(&surface->base.texture, texture);
 	surface->base.context = pipe;
 	surface->base.format = templ->format;
-	surface->base.width = u_minify(texture->width0, level);
-	surface->base.height = u_minify(texture->height0, level);
+	surface->base.width = rtex->surface.level[level].npix_x;
+	surface->base.height = rtex->surface.level[level].npix_y;
 	surface->base.usage = templ->usage;
 	surface->base.u = templ->u;
 	return &surface->base;




More information about the mesa-commit mailing list