Skip to contentSkip to conversation

Correct miptree layout for cubemaps on NV20-NV40

PATCH New Luca Barbieri 1 participant 1 message Dec 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Correct miptree layout for cubemaps on NV20-NV40

It seems that the current miptree layout is incorrect because the size of all the levels of each cube map face must be 64-byte aligned. This patch fixes piglit cubemap and fbo-cubemap which were broken. This makes sense since otherwise all the levels would no longer be 64-byte aligned, which the GPU needs for 2D/3D targets.
Note that bin/cubemap and bin/fbo-cubemap still report errors on 2x2 and 1x1 mipmap levels but they also report some of them with softpipe and swrast.

---
 src/gallium/drivers/nv20/nv20_miptree.c |    1 +
 src/gallium/drivers/nv30/nv30_miptree.c |    1 +
 src/gallium/drivers/nv40/nv40_miptree.c |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
src/gallium/drivers/nv20/nv20_miptree.c +1 -0
index 8f7538e..ad61217 100644
@@ -52,6 +52,7 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
 
 		nv20mt->level[l].image_offset[f] = offset;
 		offset += nv20mt->level[l].pitch * u_minify(pt->height0, l);
+		offset = align(offset, 64);
 	}
 
 	nv20mt->total_size = offset;
src/gallium/drivers/nv30/nv30_miptree.c +1 -0
index 8fbba38..9850de8 100644
@@ -54,6 +54,7 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
 
 		nv30mt->level[l].image_offset[f] = offset;
 		offset += nv30mt->level[l].pitch * u_minify(pt->height0, l);
+		offset = align(offset, 64);
 	}
 
 	nv30mt->total_size = offset;
src/gallium/drivers/nv40/nv40_miptree.c +1 -0
index 89bd155..f7e8b55 100644
@@ -56,6 +56,7 @@ nv40_miptree_layout(struct nv40_miptree *mt)
 
 		mt->level[l].image_offset[f] = offset;
 		offset += mt->level[l].pitch * u_minify(pt->height0, l);
+		offset = align(offset, 64);
 	}
 
 	mt->total_size = offset;
Signature · 1 line
1.6.3.3