summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/cell/spu/spu_render.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-02-05 14:23:34 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-02-05 15:08:06 -0700
commit4da82fd5c5e0a7535e30aa81f08dcbe1a26358b7 (patch)
tree21c7bfe48efb55638d2632f8c835cc0581c000aa /src/mesa/pipe/cell/spu/spu_render.c
parent2174890ed030bde8494b7f13b7090e27771695fa (diff)
Cell: re-enable inlined vertex buffers
Vertex data must be on a 16-byte address/offset so SIMD operations will work properly in the SPU code.
Diffstat (limited to 'src/mesa/pipe/cell/spu/spu_render.c')
-rw-r--r--src/mesa/pipe/cell/spu/spu_render.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_render.c b/src/mesa/pipe/cell/spu/spu_render.c
index e8705eeeba..932fb500b3 100644
--- a/src/mesa/pipe/cell/spu/spu_render.c
+++ b/src/mesa/pipe/cell/spu/spu_render.c
@@ -171,6 +171,7 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
ubyte vertex_data[CELL_BUFFER_SIZE] ALIGN16_ATTRIB;
const uint vertex_size = render->vertex_size; /* in bytes */
/*const*/ uint total_vertex_bytes = render->num_verts * vertex_size;
+ uint index_bytes;
const ubyte *vertices;
const ushort *indexes;
uint i, j;
@@ -199,13 +200,16 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
/* indexes are right after the render command in the batch buffer */
indexes = (const ushort *) (render + 1);
- *pos_incr = (render->num_indexes * 2 + 3) / 4;
+ index_bytes = ROUNDUP8(render->num_indexes * 2);
+ *pos_incr = index_bytes / 8 + sizeof(*render) / 8;
if (render->inline_verts) {
- /* Vertices are right after indexes in batch buffer */
- vertices = (const ubyte *) (render + 1) + *pos_incr * 4;
- *pos_incr = *pos_incr + total_vertex_bytes / 4;
+ /* Vertices are after indexes in batch buffer at next 16-byte addr */
+ vertices = (const ubyte *) render + (*pos_incr * 8);
+ vertices = (const ubyte *) align_pointer((void *) vertices, 16);
+ ASSERT_ALIGN16(vertices);
+ *pos_incr = ((vertices + total_vertex_bytes) - (ubyte *) render) / 8;
}
else {
/* Begin DMA fetch of vertex buffer */