summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/cell/ppu
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-28 18:03:45 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-28 18:18:46 -0700
commite2406b47883d74933e74507af65695c8c7d7861a (patch)
treee18e46fcda82ef5576121b761c14a3ec1a64e5c0 /src/mesa/pipe/cell/ppu
parent25105276b38451439516928d188e07f2eb3e250e (diff)
Cell: compute min index referenced in draw command, use it to reduce size of vertex data payload
Diffstat (limited to 'src/mesa/pipe/cell/ppu')
-rw-r--r--src/mesa/pipe/cell/ppu/cell_vbuf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/mesa/pipe/cell/ppu/cell_vbuf.c
index 9f737287ad..e63b34cf52 100644
--- a/src/mesa/pipe/cell/ppu/cell_vbuf.c
+++ b/src/mesa/pipe/cell/ppu/cell_vbuf.c
@@ -138,17 +138,24 @@ cell_vbuf_draw(struct vbuf_render *vbr,
struct cell_context *cell = cvbr->cell;
float xmin, ymin, xmax, ymax;
uint i;
- uint nr_vertices = 0;
+ uint nr_vertices = 0, min_index = ~0;
const void *vertices = cvbr->vertex_buffer;
const uint vertex_size = cvbr->vertex_size;
for (i = 0; i < nr_indices; i++) {
if (indices[i] > nr_vertices)
nr_vertices = indices[i];
+ if (indices[i] < min_index)
+ min_index = indices[i];
}
nr_vertices++;
#if 0
+ /*if (min_index > 0)*/
+ printf("%s min_index = %u\n", __FUNCTION__, min_index);
+#endif
+
+#if 0
printf("cell_vbuf_draw() nr_indices = %u nr_verts = %u\n",
nr_indices, nr_vertices);
printf(" ");
@@ -169,7 +176,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
/* compute x/y bounding box */
xmin = ymin = 1e50;
xmax = ymax = -1e50;
- for (i = 0; i < nr_vertices; i++) {
+ for (i = min_index; i < nr_vertices; i++) {
const float *v = (float *) ((ubyte *) vertices + i * vertex_size);
if (v[0] < xmin)
xmin = v[0];
@@ -204,6 +211,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
render->prim_type = cvbr->prim;
render->num_indexes = nr_indices;
+ render->min_index = min_index;
/* append indices after render command */
memcpy(render + 1, indices, nr_indices * 2);
@@ -214,6 +222,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
render->vertex_size = 4 * cell->vertex_info.size;
render->num_verts = nr_vertices;
if (ALLOW_INLINE_VERTS &&
+ min_index == 0 &&
vertex_bytes <= cell_batch_free_space(cell)) {
/* vertex data inlined, after indices */
void *dst = cell_batch_alloc(cell, vertex_bytes);