Mesa (master): nouveau: 1xN, Nx1 levels of a swizzled mip tree shouldn' t be aligned.

Younes Manton ymanton at kemper.freedesktop.org
Wed Feb 11 17:02:04 UTC 2009


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

Author: Younes Manton <younes.m at gmail.com>
Date:   Wed Feb 11 11:52:32 2009 -0500

nouveau: 1xN, Nx1 levels of a swizzled mip tree shouldn't be aligned.

---

 src/gallium/drivers/nv30/nv30_miptree.c |    3 ++-
 src/gallium/drivers/nv40/nv40_miptree.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index fe13f50..510c94d 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -50,7 +50,8 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
 		for (l = 0; l < pt->last_level; l++) {
 			nv30mt->level[l].image_offset[f] = offset;
 
-			if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
+			if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
+			    pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
 				offset += align(nv30mt->level[l].pitch * pt->height[l], 64);
 			else
 				offset += nv30mt->level[l].pitch * pt->height[l];
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index e4f8df9..e38b1e7 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -50,7 +50,8 @@ nv40_miptree_layout(struct nv40_miptree *mt)
 		for (l = 0; l < pt->last_level; l++) {
 			mt->level[l].image_offset[f] = offset;
 
-			if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
+			if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
+			    pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
 				offset += align(mt->level[l].pitch * pt->height[l], 64);
 			else
 				offset += mt->level[l].pitch * pt->height[l];




More information about the mesa-commit mailing list