From 54090bd841b302c6d48e7f130dbe07c8fd5a0a96 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 2 Jan 2008 19:05:34 -0700 Subject: [PATCH] only fetch as much vertex data as needed --- src/mesa/pipe/cell/common.h | 2 +- src/mesa/pipe/cell/ppu/cell_render.c | 1 + src/mesa/pipe/cell/spu/main.c | 11 +++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/pipe/cell/common.h b/src/mesa/pipe/cell/common.h index 8202bbb..ee20bd1 100644 --- a/src/mesa/pipe/cell/common.h +++ b/src/mesa/pipe/cell/common.h @@ -76,7 +76,7 @@ struct cell_command_clear_tiles struct cell_command_render { uint prim_type; - uint num_verts; + uint num_verts, num_attribs; float xmin, ymin, xmax, ymax; void *vertex_data; } ALIGN16_ATTRIB; diff --git a/src/mesa/pipe/cell/ppu/cell_render.c b/src/mesa/pipe/cell/ppu/cell_render.c index 672406a..b97f4ff 100644 --- a/src/mesa/pipe/cell/ppu/cell_render.c +++ b/src/mesa/pipe/cell/ppu/cell_render.c @@ -155,6 +155,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->xmin = cell->prim_buffer.xmin; render->ymin = cell->prim_buffer.ymin; render->xmax = cell->prim_buffer.xmax; diff --git a/src/mesa/pipe/cell/spu/main.c b/src/mesa/pipe/cell/spu/main.c index 94b9eda..5e29d4f 100644 --- a/src/mesa/pipe/cell/spu/main.c +++ b/src/mesa/pipe/cell/spu/main.c @@ -144,7 +144,7 @@ render(const struct cell_command_render *render) const uint num_tiles = fb.width_tiles * fb.height_tiles; struct cell_prim_buffer prim_buffer ALIGN16_ATTRIB; int tag = DefaultTag; - uint i, j; + uint i, j, vertex_bytes; /* printf("SPU %u: RENDER buffer dst=%p src=%p size=%d\n", @@ -155,10 +155,13 @@ render(const struct cell_command_render *render) ASSERT_ALIGN16(render->vertex_data); ASSERT_ALIGN16(&prim_buffer); + /* how much vertex data */ + vertex_bytes = render->num_verts * render->num_attribs * 4 * sizeof(float); + /* get vertex data from main memory */ mfc_get(&prim_buffer, /* dest */ (unsigned int) render->vertex_data, /* src */ - sizeof(prim_buffer), /* bytes */ + vertex_bytes, /* size */ tag, 0, /* tid */ 0 /* rid */); @@ -166,8 +169,8 @@ render(const struct cell_command_render *render) /* loop over tiles */ for (i = init.id; i < num_tiles; i += init.num_spus) { - uint tx = i % fb.width_tiles; - uint ty = i / fb.width_tiles; + const uint tx = i % fb.width_tiles; + const uint ty = i / fb.width_tiles; get_tile(&fb, tx, ty, (uint *) tile, DefaultTag); wait_on_mask(1 << DefaultTag); /* XXX temporary */ -- 2.7.4