r300g: Use align() instead of inline maths.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 13 Jul 2009 21:47:36 +0000 (14:47 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 13 Jul 2009 23:26:29 +0000 (16:26 -0700)
src/gallium/drivers/r300/r300_texture.c

index f9dff0370475af612d9d91f4c1f28c05b722f1ba..11c7858d422349f42e1f4ae665f69db1dd24f4e3 100644 (file)
@@ -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. */