summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/cell/common.h6
-rw-r--r--src/mesa/pipe/cell/ppu/cell_render.c2
-rw-r--r--src/mesa/pipe/cell/ppu/cell_vbuf.c26
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.c28
4 files changed, 22 insertions, 40 deletions
diff --git a/src/mesa/pipe/cell/common.h b/src/mesa/pipe/cell/common.h
index 4c998722a26..cd2b61e6e94 100644
--- a/src/mesa/pipe/cell/common.h
+++ b/src/mesa/pipe/cell/common.h
@@ -96,12 +96,14 @@ struct cell_command_clear_surface
#define CELL_MAX_VBUF_SIZE (16 * 1024)
#define CELL_MAX_VBUF_INDEXES 1024
-#define CELL_MAX_ATTRIBS 2 /* temporary! */
+
+
struct cell_command_render
{
uint opcode;
uint prim_type;
- uint num_verts, num_attribs;
+ uint num_verts;
+ uint vertex_size; /**< bytes per vertex */
uint num_indexes;
const void *vertex_data;
const ushort *index_data;
diff --git a/src/mesa/pipe/cell/ppu/cell_render.c b/src/mesa/pipe/cell/ppu/cell_render.c
index ecdd47e28b0..4ab277a4b24 100644
--- a/src/mesa/pipe/cell/ppu/cell_render.c
+++ b/src/mesa/pipe/cell/ppu/cell_render.c
@@ -152,7 +152,7 @@ cell_flush_prim_buffer(struct cell_context *cell)
struct cell_command_render *render = &cell_global.command[i].render;
render->prim_type = PIPE_PRIM_TRIANGLES;
render->num_verts = cell->prim_buffer.num_verts;
- render->num_attribs = CELL_MAX_ATTRIBS;
+ render->vertex_size = cell->vertex_info->size * 4;
render->xmin = cell->prim_buffer.xmin;
render->ymin = cell->prim_buffer.ymin;
render->xmax = cell->prim_buffer.xmax;
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/mesa/pipe/cell/ppu/cell_vbuf.c
index a420de041af..711d03b49fc 100644
--- a/src/mesa/pipe/cell/ppu/cell_vbuf.c
+++ b/src/mesa/pipe/cell/ppu/cell_vbuf.c
@@ -31,7 +31,9 @@
*/
+#include "cell_batch.h"
#include "cell_context.h"
+#include "cell_flush.h"
#include "cell_spu.h"
#include "cell_vbuf.h"
#include "pipe/draw/draw_vbuf.h"
@@ -141,26 +143,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
if (cvbr->prim != PIPE_PRIM_TRIANGLES)
return; /* only render tris for now */
-#if 0
- for (i = 0; i < cell->num_spus; i++) {
- struct cell_command_render *render = &cell_global.command[i].render;
- render->opcode = CELL_CMD_RENDER;
- render->prim_type = cvbr->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;
- render->xmin = xmin;
- render->ymin = ymin;
- render->xmax = xmax;
- render->ymax = ymax;
-
- ASSERT_ALIGN16(render->vertex_data);
- ASSERT_ALIGN16(render->index_data);
- send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_RENDER);
- }
-#else
+ /* build/insert batch RENDER command */
{
struct cell_command_render *render
= (struct cell_command_render *)
@@ -168,7 +151,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
render->opcode = CELL_CMD_RENDER;
render->prim_type = cvbr->prim;
render->num_verts = nr_vertices;
- render->num_attribs = CELL_MAX_ATTRIBS; /* XXX fix */
+ render->vertex_size = 4 * cell->vertex_info.size;
render->vertex_data = vertices;
render->index_data = indices;
render->num_indexes = nr_indices;
@@ -180,7 +163,6 @@ cell_vbuf_draw(struct vbuf_render *vbr,
ASSERT_ALIGN16(render->vertex_data);
ASSERT_ALIGN16(render->index_data);
}
-#endif
#if 01
/* XXX this is temporary */
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c
index 2e5cb76b4a2..03dbef051b5 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/mesa/pipe/cell/spu/spu_main.c
@@ -210,8 +210,8 @@ cmd_render(const struct cell_command_render *render)
/* we'll DMA into these buffers */
ubyte vertex_data[CELL_MAX_VBUF_SIZE] ALIGN16_ATTRIB;
ushort indexes[CELL_MAX_VBUF_INDEXES] ALIGN16_ATTRIB;
-
- uint i, j, vertex_size, vertex_bytes, index_bytes;
+ uint i, j, total_vertex_bytes, total_index_bytes;
+ const uint vertex_size = render->vertex_size; /* in bytes */
if (Debug) {
printf("SPU %u: RENDER prim %u, indices: %u, nr_vert: %u\n",
@@ -228,36 +228,34 @@ cmd_render(const struct cell_command_render *render)
ASSERT_ALIGN16(render->vertex_data);
ASSERT_ALIGN16(render->index_data);
- vertex_size = render->num_attribs * 4 * sizeof(float);
-
/* how much vertex data */
- vertex_bytes = render->num_verts * vertex_size;
- index_bytes = render->num_indexes * sizeof(ushort);
- if (index_bytes < 16)
- index_bytes = 16;
+ total_vertex_bytes = render->num_verts * vertex_size;
+ total_index_bytes = render->num_indexes * sizeof(ushort);
+ if (total_index_bytes < 16)
+ total_index_bytes = 16;
else
- index_bytes = (index_bytes + 15) & ~0xf; /* multiple of 16 */
+ total_index_bytes = (total_index_bytes + 15) & ~0xf; /* multiple of 16 */
/*
- printf("VBUF: indices at %p, vertices at %p vertex_bytes %u ind_bytes %u\n",
- render->index_data, render->vertex_data, vertex_bytes, index_bytes);
+ printf("VBUF: indices at %p, vertices at %p total_vertex_bytes %u ind_bytes %u\n",
+ render->index_data, render->vertex_data, total_vertex_bytes, total_index_bytes);
*/
- ASSERT(vertex_bytes % 16 == 0);
+ ASSERT(total_vertex_bytes % 16 == 0);
/* get vertex data from main memory */
mfc_get(vertex_data, /* dest */
(unsigned int) render->vertex_data, /* src */
- vertex_bytes, /* size */
+ total_vertex_bytes, /* size */
TAG_VERTEX_BUFFER,
0, /* tid */
0 /* rid */);
- ASSERT(index_bytes % 16 == 0);
+ ASSERT(total_index_bytes % 16 == 0);
/* get index data from main memory */
mfc_get(indexes, /* dest */
(unsigned int) render->index_data, /* src */
- index_bytes,
+ total_index_bytes,
TAG_INDEX_BUFFER,
0, /* tid */
0 /* rid */);