nv40: align each level to 64 pixels
authorBen Skeggs <skeggsb@gmail.com>
Fri, 21 Mar 2008 10:58:17 +0000 (21:58 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Fri, 21 Mar 2008 10:58:17 +0000 (21:58 +1100)
src/gallium/drivers/nv40/nv40_miptree.c

index 0dff9b3ad6d134c41315ecc73b9afc5104aef440..01b3952fe665753b229aa6a3523f5c41833361f2 100644 (file)
@@ -12,7 +12,7 @@ nv40_miptree_layout(struct nv40_miptree *nv40mt)
        boolean swizzled = FALSE;
        uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
        uint offset = 0;
-       int nr_faces, l, f;
+       int nr_faces, l, f, pitch;
 
        if (pt->target == PIPE_TEXTURE_CUBE) {
                nr_faces = 6;
@@ -22,18 +22,18 @@ nv40_miptree_layout(struct nv40_miptree *nv40mt)
        } else {
                nr_faces = 1;
        }
-       
+
+       pitch = pt->width[0];
        for (l = 0; l <= pt->last_level; l++) {
                pt->width[l] = width;
                pt->height[l] = height;
                pt->depth[l] = depth;
 
                if (swizzled)
-                       nv40mt->level[l].pitch = pt->width[l] * pt->cpp;
-               else
-                       nv40mt->level[l].pitch = pt->width[0] * pt->cpp;
-               nv40mt->level[l].pitch = (nv40mt->level[l].pitch + 63) & ~63;
+                       pitch = pt->width[l];
+               pitch = (pitch + 63) & ~63;
 
+               nv40mt->level[l].pitch = pitch * pt->cpp;
                nv40mt->level[l].image_offset =
                        CALLOC(nr_faces, sizeof(unsigned));
 
@@ -49,6 +49,7 @@ nv40_miptree_layout(struct nv40_miptree *nv40mt)
                        offset += nv40mt->level[l].pitch * pt->height[l];
                }
        }
+       NOUVEAU_ERR("\n");
 
        nv40mt->total_size = offset;
 }