Cell: make vertex_header and prim_header types private to tri.c

This commit is contained in:
Brian 2008-01-10 21:35:13 -07:00
parent 44f4b9b9ea
commit c56b20971b
3 changed files with 38 additions and 36 deletions

View file

@ -256,13 +256,11 @@ render(const struct cell_command_render *render)
/* loop over tris */
for (j = 0; j < render->num_verts; j += 3) {
struct prim_header prim;
const float *v0 = (const float *) prim_buffer.vertex[j+0];
const float *v1 = (const float *) prim_buffer.vertex[j+1];
const float *v2 = (const float *) prim_buffer.vertex[j+2];
prim.v[0] = (struct vertex_header *) prim_buffer.vertex[j+0];
prim.v[1] = (struct vertex_header *) prim_buffer.vertex[j+1];
prim.v[2] = (struct vertex_header *) prim_buffer.vertex[j+2];
tri_draw(&prim, tx, ty);
tri_draw(v0, v1, v2, tx, ty);
}
/* write color/z tiles back to main framebuffer, if dirtied */
@ -292,13 +290,16 @@ render_vbuf(const struct cell_command_render_vbuf *render)
/* we'll DMA into these buffers */
ubyte vertex_data[CELL_MAX_VBUF_SIZE] ALIGN16_ATTRIB;
ushort indexes[CELL_MAX_VBUF_INDEXES] ALIGN16_ATTRIB;
uint i, j, vertex_bytes, index_bytes;
uint i, j, vertex_size, vertex_bytes, index_bytes;
ASSERT_ALIGN16(render->vertex_data);
ASSERT_ALIGN16(render->index_data);
vertex_size = render->num_attribs * 4 * sizeof(float);
/* how much vertex data */
vertex_bytes = render->num_verts * render->num_attribs * 4 * sizeof(float);
vertex_bytes = render->num_verts * vertex_size;
index_bytes = render->num_indexes * sizeof(ushort);
if (index_bytes < 8)
index_bytes = 8;
@ -369,19 +370,13 @@ render_vbuf(const struct cell_command_render_vbuf *render)
/* loop over tris */
for (j = 0; j < render->num_indexes; j += 3) {
struct prim_header prim;
const float *vbuf = (const float *) vertex_data;
const float *v0, *v1, *v2;
v0 = vbuf + indexes[j] * render->num_attribs * 4;
v1 = vbuf + indexes[j+1] * render->num_attribs * 4;
v2 = vbuf + indexes[j+2] * render->num_attribs * 4;
v0 = (const float *) (vertex_data + indexes[j+0] * vertex_size);
v1 = (const float *) (vertex_data + indexes[j+1] * vertex_size);
v2 = (const float *) (vertex_data + indexes[j+2] * vertex_size);
prim.v[0] = (struct vertex_header *) v0;
prim.v[1] = (struct vertex_header *) v1;
prim.v[2] = (struct vertex_header *) v2;
tri_draw(&prim, tx, ty);
tri_draw(v0, v1, v2, tx, ty);
}
/* write color/z tiles back to main framebuffer, if dirtied */

View file

@ -54,6 +54,23 @@
*/
/**
* Simplified types taken from other parts of Gallium
*/
struct vertex_header {
float data[2][4]; /* pos and color */
};
struct prim_header {
struct vertex_header *v[3];
uint color;
};
#if 1
/* XXX fix this */
@ -946,10 +963,15 @@ struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe )
* The tile data should have already been fetched.
*/
void
tri_draw(struct prim_header *tri, uint tx, uint ty)
tri_draw(const float *v0, const float *v1, const float *v2, uint tx, uint ty)
{
struct prim_header tri;
struct setup_stage setup;
tri.v[0] = (struct vertex_header *) v0;
tri.v[1] = (struct vertex_header *) v1;
tri.v[2] = (struct vertex_header *) v2;
setup.tx = tx;
setup.ty = ty;
@ -959,5 +981,5 @@ tri_draw(struct prim_header *tri, uint tx, uint ty)
setup.cliprect_maxx = (tx + 1) * TILE_SIZE;
setup.cliprect_maxy = (ty + 1) * TILE_SIZE;
setup_tri(&setup, tri);
setup_tri(&setup, &tri);
}

View file

@ -30,23 +30,8 @@
#define TRI_H
/**
* Simplified types taken from other parts of Gallium
*/
struct vertex_header {
float data[2][4]; /* pos and color */
};
struct prim_header {
struct vertex_header *v[3];
uint color;
};
extern void
tri_draw(struct prim_header *tri, uint tx, uint ty);
tri_draw(const float *v0, const float *v1, const float *v2, uint tx, uint ty);
#endif /* TRI_H */