diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-02 19:05:34 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-02 19:05:34 -0700 |
commit | 54090bd841b302c6d48e7f130dbe07c8fd5a0a96 (patch) | |
tree | 4f455b1e3347f094bc817b515b9f315198f8a469 | |
parent | d55c4ec9d2c0a8cd9ba75985962297381e6c0364 (diff) |
only fetch as much vertex data as needed
-rw-r--r-- | src/mesa/pipe/cell/common.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/cell/ppu/cell_render.c | 1 | ||||
-rw-r--r-- | 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 8202bbbe76..ee20bd150b 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 672406aa23..b97f4ff536 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 94b9eda5c3..5e29d4faaa 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 */ |