Mesa (master): r300g: Use align() instead of inline maths.

Corbin Simpson csimpson at kemper.freedesktop.org
Mon Jul 13 23:28:57 UTC 2009


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

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Mon Jul 13 14:47:36 2009 -0700

r300g: Use align() instead of inline maths.

---

 src/gallium/drivers/r300/r300_texture.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index f9dff03..11c7858 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -73,12 +73,15 @@ static void r300_setup_miptree(struct r300_texture* tex)
         base->nblocksx[i] = pf_get_nblocksx(&base->block, base->width[i]);
         base->nblocksy[i] = pf_get_nblocksy(&base->block, base->width[i]);
 
-        /* Radeons enjoy things in multiples of 32. */
-        /* XXX this can be 32 when POT */
-        stride = (base->nblocksx[i] * base->block.size + 63) & ~63;
+        /* Radeons enjoy things in multiples of 64.
+         *
+         * XXX
+         * POT, uncompressed, unmippmapped textures can be aligned to 32,
+         * instead of 64. */
+        stride = align(base->nblocksx[i] * base->block.size, 64);
         size = stride * base->nblocksy[i] * base->depth[i];
 
-        tex->offset[i] = (tex->size + 63) & ~63;
+        tex->offset[i] = align(tex->size, 64);
         tex->size = tex->offset[i] + size;
 
         /* Save stride of first level to the texture. */




More information about the mesa-commit mailing list