summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_pipe.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2008-05-13 16:06:09 -0400
committerZack Rusin <[email protected]>2008-05-13 17:59:09 -0400
commit1c624846a81b0218b4a07328f485e295432c6312 (patch)
treef76bd95ede5c9919523296c33b498365a25f5b86 /src/gallium/auxiliary/draw/draw_pipe.c
parentbbda45ec769120324f44febf00c6bb170f594f23 (diff)
decomposition from keith, adds decomposition of more prim to the pipeline
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe.c74
1 files changed, 50 insertions, 24 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c
index cb97f955b29..1d26706deee 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.c
+++ b/src/gallium/auxiliary/draw/draw_pipe.c
@@ -212,6 +212,55 @@ void draw_pipeline_run( struct draw_context *draw,
draw->pipeline.vertex_count = 0;
}
+#define QUAD(i0,i1,i2,i3) \
+ do_triangle( draw, \
+ ( DRAW_PIPE_RESET_STIPPLE | \
+ DRAW_PIPE_EDGE_FLAG_0 | \
+ DRAW_PIPE_EDGE_FLAG_2 ), \
+ verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
+ verts + stride * (i1), \
+ verts + stride * (i3)); \
+ do_triangle( draw, \
+ ( DRAW_PIPE_EDGE_FLAG_0 | \
+ DRAW_PIPE_EDGE_FLAG_1 ), \
+ verts + stride * ((i1) & ~DRAW_PIPE_FLAG_MASK), \
+ verts + stride * (i2), \
+ verts + stride * (i3))
+
+#define TRIANGLE(flags,i0,i1,i2) \
+ do_triangle( draw, \
+ flags, /* flags */ \
+ verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
+ verts + stride * (i1), \
+ verts + stride * (i2))
+
+#define LINE(flags,i0,i1) \
+ do_line( draw, \
+ flags, \
+ verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
+ verts + stride * (i+1))
+
+#define POINT(i0) \
+ do_point( draw, \
+ verts + stride * i0 )
+
+#define FUNC pipe_run_linear
+#define ARGS \
+ struct draw_context *draw, \
+ unsigned prim, \
+ struct vertex_header *vertices, \
+ unsigned stride
+
+#define LOCAL_VARS \
+ char *verts = (char *)vertices; \
+ boolean flatfirst = (draw->rasterizer->flatshade && \
+ draw->rasterizer->flatshade_first); \
+ unsigned i, flags
+
+#define FLUSH
+
+#include "draw_pt_decompose.h"
+
void draw_pipeline_run_linear( struct draw_context *draw,
unsigned prim,
struct vertex_header *vertices,
@@ -219,34 +268,11 @@ void draw_pipeline_run_linear( struct draw_context *draw,
unsigned stride )
{
char *verts = (char *)vertices;
- unsigned i;
-
draw->pipeline.verts = verts;
draw->pipeline.vertex_stride = stride;
draw->pipeline.vertex_count = count;
- switch (prim) {
- case PIPE_PRIM_POINTS:
- for (i = 0; i < count; i++)
- do_point( draw,
- verts + stride * i );
- break;
- case PIPE_PRIM_LINES:
- for (i = 0; i+1 < count; i += 2)
- do_line( draw,
- i+0, /* flags */
- verts + stride * ((i+0) & ~DRAW_PIPE_FLAG_MASK),
- verts + stride * (i+1));
- break;
- case PIPE_PRIM_TRIANGLES:
- for (i = 0; i+2 < count; i += 3)
- do_triangle( draw,
- (i+0), /* flags */
- verts + stride * ((i+0) & ~DRAW_PIPE_FLAG_MASK),
- verts + stride * (i+1),
- verts + stride * (i+2));
- break;
- }
+ pipe_run_linear(draw, prim, vertices, stride, count);
draw->pipeline.verts = NULL;
draw->pipeline.vertex_count = 0;