summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-01-10 21:35:13 -0700
committerBrian <[email protected]>2008-01-10 21:35:13 -0700
commitc56b20971bfe554f2b9ba74c40b350f950bb31ff (patch)
treec82f6e459034a8f55b4177040677e7727cd3ef42 /src/mesa/pipe
parent44f4b9b9ea81974a8e7de444280e471ca05e9261 (diff)
Cell: make vertex_header and prim_header types private to tri.c
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/cell/spu/main.c31
-rw-r--r--src/mesa/pipe/cell/spu/tri.c26
-rw-r--r--src/mesa/pipe/cell/spu/tri.h17
3 files changed, 38 insertions, 36 deletions
diff --git a/src/mesa/pipe/cell/spu/main.c b/src/mesa/pipe/cell/spu/main.c
index 27e1169a7f8..7c420132791 100644
--- a/src/mesa/pipe/cell/spu/main.c
+++ b/src/mesa/pipe/cell/spu/main.c
@@ -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;
-
- prim.v[0] = (struct vertex_header *) v0;
- prim.v[1] = (struct vertex_header *) v1;
- prim.v[2] = (struct vertex_header *) v2;
+ 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);
- tri_draw(&prim, tx, ty);
+ tri_draw(v0, v1, v2, tx, ty);
}
/* write color/z tiles back to main framebuffer, if dirtied */
diff --git a/src/mesa/pipe/cell/spu/tri.c b/src/mesa/pipe/cell/spu/tri.c
index 77f7052cd5a..9eaf1df90be 100644
--- a/src/mesa/pipe/cell/spu/tri.c
+++ b/src/mesa/pipe/cell/spu/tri.c
@@ -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);
}
diff --git a/src/mesa/pipe/cell/spu/tri.h b/src/mesa/pipe/cell/spu/tri.h
index bcb42852b24..f10c4077d3c 100644
--- a/src/mesa/pipe/cell/spu/tri.h
+++ b/src/mesa/pipe/cell/spu/tri.h
@@ -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 */