diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-10 21:50:55 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-10 21:50:55 -0700 |
commit | 71caa922e0bf9f6378bd02374402eaea2990b493 (patch) | |
tree | 2094b6cb3a8751764f66b716c5767fa072a0a3d2 /src/mesa/pipe | |
parent | ea190f4b41d8959aa3edfd46503a3077201cdefd (diff) |
Cell: compute bounding box in cell_vbuf_draw()
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/cell/ppu/cell_vbuf.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/mesa/pipe/cell/ppu/cell_vbuf.c index 059a098914..62d453cb7f 100644 --- a/src/mesa/pipe/cell/ppu/cell_vbuf.c +++ b/src/mesa/pipe/cell/ppu/cell_vbuf.c @@ -95,8 +95,24 @@ cell_vbuf_draw(struct vbuf_render *vbr, { struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr); struct cell_context *cell = cvbr->cell; + float xmin, ymin, xmax, ymax; uint i; + /* compute x/y bounding box */ + xmin = ymin = 1e50; + xmax = ymax = -1e50; + for (i = 0; i < nr_vertices; i++) { + const float *v = (float *) ((ubyte *) vertices + i * vertex_size); + if (v[0] < xmin) + xmin = v[0]; + if (v[0] > xmax) + xmax = v[0]; + if (v[1] < ymin) + ymin = v[1]; + if (v[1] > ymax) + ymax = v[1]; + } + /*printf("cell_vbuf_draw nr_indices = %u\n", nr_indices);*/ if (prim != PIPE_PRIM_TRIANGLES) @@ -110,17 +126,10 @@ cell_vbuf_draw(struct vbuf_render *vbr, render->vertex_data = vertices; render->index_data = indices; render->num_indexes = nr_indices; -#if 0 - render->xmin = cell->prim_buffer.xmin; - render->ymin = cell->prim_buffer.ymin; - render->xmax = cell->prim_buffer.xmax; - render->ymax = cell->prim_buffer.ymax; -#else - render->xmin = -100; - render->ymin = -100; - render->xmax = 100; - render->ymax = 100; -#endif + render->xmin = xmin; + render->ymin = ymin; + render->xmax = xmax; + render->ymax = ymax; ASSERT_ALIGN16(render->vertex_data); ASSERT_ALIGN16(render->index_data); |