summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-01-24 18:26:37 -0700
committerBrian <[email protected]>2008-01-25 08:20:09 -0700
commit78bff07f73a546363b737b33958311efa7b3ce53 (patch)
treebf95fd7aed2d18f020e83d393538c037b56e2dbb /src
parenta148cc51fbe56266199057cfde2abb2b59eb8713 (diff)
Cell: new ROUNDUP16() macro
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/cell/common.h3
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/pipe/cell/common.h b/src/mesa/pipe/cell/common.h
index b9a00ccbb5f..5c437daac6f 100644
--- a/src/mesa/pipe/cell/common.h
+++ b/src/mesa/pipe/cell/common.h
@@ -43,6 +43,9 @@
assert((((unsigned long) (ptr)) & 0xf) == 0);
+/** round up value to next multiple of 16 */
+#define ROUNDUP16(k) (((k) + 0xf) & ~0xf)
+
#define TILE_SIZE 32
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c
index 03dbef051b5..1d0de7b1f9e 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/mesa/pipe/cell/spu/spu_main.c
@@ -234,7 +234,7 @@ cmd_render(const struct cell_command_render *render)
if (total_index_bytes < 16)
total_index_bytes = 16;
else
- total_index_bytes = (total_index_bytes + 15) & ~0xf; /* multiple of 16 */
+ total_index_bytes = ROUNDUP16(total_index_bytes);
/*
printf("VBUF: indices at %p, vertices at %p total_vertex_bytes %u ind_bytes %u\n",
@@ -457,10 +457,9 @@ cmd_batch(uint opcode)
ASSERT_ALIGN16(spu.init.batch_buffers[buf]);
- size = (size + 0xf) & ~0xf;
+ size = ROUNDUP16(size);
- ASSERT(size % 16 == 0);
- ASSERT((unsigned int) spu.init.batch_buffers[buf] % 16 == 0);
+ ASSERT_ALIGN16(spu.init.batch_buffers[buf]);
mfc_get(buffer, /* dest */
(unsigned int) spu.init.batch_buffers[buf], /* src */