diff options
Diffstat (limited to 'src/mesa/pipe/cell/ppu')
-rw-r--r-- | src/mesa/pipe/cell/ppu/cell_vbuf.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/mesa/pipe/cell/ppu/cell_vbuf.c index 1a43d237d9..cf468204bb 100644 --- a/src/mesa/pipe/cell/ppu/cell_vbuf.c +++ b/src/mesa/pipe/cell/ppu/cell_vbuf.c @@ -32,6 +32,7 @@ #include "cell_context.h" +#include "cell_spu.h" #include "cell_vbuf.h" #include "pipe/draw/draw_vbuf.h" @@ -69,7 +70,7 @@ static void * cell_vbuf_allocate_vertices(struct vbuf_render *vbr, ushort vertex_size, ushort nr_vertices) { - printf("Alloc verts %u * %u\n", vertex_size, nr_vertices); + /*printf("Alloc verts %u * %u\n", vertex_size, nr_vertices);*/ return align_malloc(vertex_size * nr_vertices, 16); } @@ -79,23 +80,63 @@ cell_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) { struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr); cvbr->prim = prim; - printf("cell_set_prim %u\n", prim); + /*printf("cell_set_prim %u\n", prim);*/ } +#if 0 static void cell_vbuf_draw(struct vbuf_render *vbr, - const ushort *indices, unsigned nr_indices) + uint prim, + const ushort *indices, + uint nr_indices, + const void *vertices, + uint nr_vertices, + uint vertex_size) { - printf("cell_vbuf_draw nr_indices = %u\n", nr_indices); + struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr); + struct cell_context *cell = cvbr->cell; + uint i; + + /*printf("cell_vbuf_draw nr_indices = %u\n", nr_indices);*/ + + if (prim != PIPE_PRIM_TRIANGLES) + return; /* only render tris for now */ + + for (i = 0; i < cell->num_spus; i++) { + struct cell_command_render_vbuf *render = &cell_global.command[i].render_vbuf; + render->prim_type = prim; + render->num_verts = nr_vertices; + render->num_attribs = CELL_MAX_ATTRIBS; /* XXX fix */ + render->vertex_data = vertices; + render->index_data = indices; + render->num_indexes = nr_indices; +#if 0 + render->xmin = cell->prim_buffer.xmin; + render->ymin = cell->prim_buffer.ymin; + render->xmax = cell->prim_buffer.xmax; + render->ymax = cell->prim_buffer.ymax; +#else + render->xmin = -100; + render->ymin = -100; + render->xmax = 100; + render->ymax = 100; +#endif + + ASSERT_ALIGN16(render->vertex_data); + ASSERT_ALIGN16(render->index_data); + send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_RENDER_VBUF); + } + + cell_flush(&cell->pipe, 0x0); } - +#endif static void cell_vbuf_release_vertices(struct vbuf_render *vbr, void *vertices, unsigned vertex_size, unsigned vertices_used) { - printf("Free verts %u * %u\n", vertex_size, vertices_used); + /*printf("Free verts %u * %u\n", vertex_size, vertices_used);*/ align_free(vertices); } @@ -120,13 +161,15 @@ cell_init_vbuf(struct cell_context *cell) cell->vbuf_render = CALLOC_STRUCT(cell_vbuf_render); - cell->vbuf_render->base.max_indices = 100; - cell->vbuf_render->base.max_vertex_buffer_bytes = 16 * 1024; + cell->vbuf_render->base.max_indices = CELL_MAX_VBUF_INDEXES; + cell->vbuf_render->base.max_vertex_buffer_bytes = CELL_MAX_VBUF_SIZE; cell->vbuf_render->base.get_vertex_info = cell_vbuf_get_vertex_info; cell->vbuf_render->base.allocate_vertices = cell_vbuf_allocate_vertices; cell->vbuf_render->base.set_primitive = cell_vbuf_set_primitive; +#if 0 cell->vbuf_render->base.draw = cell_vbuf_draw; +#endif cell->vbuf_render->base.release_vertices = cell_vbuf_release_vertices; cell->vbuf_render->base.destroy = cell_vbuf_destroy; |