only fetch as much vertex data as needed
authorBrian <brian.paul@tungstengraphics.com>
Thu, 3 Jan 2008 02:05:34 +0000 (19:05 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Thu, 3 Jan 2008 02:05:34 +0000 (19:05 -0700)
src/mesa/pipe/cell/common.h
src/mesa/pipe/cell/ppu/cell_render.c
src/mesa/pipe/cell/spu/main.c

index 8202bbbe7624ddbfd81185f6b1fdd63ca132472f..ee20bd150b7959f86045c67325237cc8ccd32096 100644 (file)
@@ -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;
index 672406aa234d18255ddaa0ab9b3f8350362b2d89..b97f4ff53687effa808f49f4f0032493e5cec282 100644 (file)
@@ -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;
index 94b9eda5c371283dbe8cb62b7fdb7d4ce165f272..5e29d4faaaaa61369ab33c1b8e3632d7d5a6b625 100644 (file)
@@ -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 */