From: Brian Date: Thu, 3 Jan 2008 02:05:34 +0000 (-0700) Subject: only fetch as much vertex data as needed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54090bd841b302c6d48e7f130dbe07c8fd5a0a96;p=mesa.git only fetch as much vertex data as needed --- diff --git a/src/mesa/pipe/cell/common.h b/src/mesa/pipe/cell/common.h index 8202bbbe762..ee20bd150b7 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 672406aa234..b97f4ff5368 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 94b9eda5c37..5e29d4faaaa 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 */