diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2009-01-05 14:07:48 +1100 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2009-01-06 08:05:57 +1100 |
commit | 108942f22a51bc1435c34b04b2c9747825ccefb7 (patch) | |
tree | 55c0deb49c1ad5b3d7488c5bc4a2ea6ac5cc887c /src/gallium/drivers/nv50/nv50_miptree.c | |
parent | 5696267efd6f85d79f5fe511d1a066a17c4d1ccc (diff) |
nv50: slightly better miptree allocation
I swear this didn't work last time I tried it.. Anyhow, still only
suitable for 2D miptrees - more coming once I know the layout.
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_miptree.c')
-rw-r--r-- | src/gallium/drivers/nv50/nv50_miptree.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 28a8bdc0fa..0e46a2b0be 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -31,7 +31,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) { struct pipe_winsys *ws = pscreen->winsys; struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree); - unsigned usage, pitch; + unsigned usage, pitch, width, height; mt->base = *pt; mt->base.refcount = 1; @@ -47,11 +47,12 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) break; } - pitch = ((pt->width[0] + 63) & ~63) * pt->block.size; - /*XXX*/ - pitch *= 2; + width = align(pt->width[0], 8); + height = align(pt->height[0], 8); + pitch = width * pt->block.size; + pitch = (pitch + 63) & ~63; - mt->buffer = ws->buffer_create(ws, 256, usage, pitch * pt->height[0]); + mt->buffer = ws->buffer_create(ws, 256, usage, pitch * height); if (!mt->buffer) { FREE(mt); return NULL; |