summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_vcache.c
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-05-13 16:06:09 -0400
committerZack Rusin <zack@tungstengraphics.com>2008-05-13 17:59:09 -0400
commit1c624846a81b0218b4a07328f485e295432c6312 (patch)
treef76bd95ede5c9919523296c33b498365a25f5b86 /src/gallium/auxiliary/draw/draw_pt_vcache.c
parentbbda45ec769120324f44febf00c6bb170f594f23 (diff)
decomposition from keith, adds decomposition of more prim to the pipeline
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_vcache.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c117
1 files changed, 52 insertions, 65 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index a3495f2a30..6c17edba34 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -104,23 +104,11 @@ static INLINE void vcache_elt( struct vcache_frontend *vcache,
static void vcache_triangle( struct vcache_frontend *vcache,
+ ushort flags,
unsigned i0,
unsigned i1,
unsigned i2 )
{
- vcache_elt(vcache, i0, 0);
- vcache_elt(vcache, i1, 0);
- vcache_elt(vcache, i2, 0);
- vcache_check_flush(vcache);
-}
-
-
-static void vcache_triangle_flags( struct vcache_frontend *vcache,
- ushort flags,
- unsigned i0,
- unsigned i1,
- unsigned i2 )
-{
vcache_elt(vcache, i0, flags);
vcache_elt(vcache, i1, 0);
vcache_elt(vcache, i2, 0);
@@ -128,20 +116,10 @@ static void vcache_triangle_flags( struct vcache_frontend *vcache,
}
static void vcache_line( struct vcache_frontend *vcache,
+ ushort flags,
unsigned i0,
unsigned i1 )
{
- vcache_elt(vcache, i0, 0);
- vcache_elt(vcache, i1, 0);
- vcache_check_flush(vcache);
-}
-
-
-static void vcache_line_flags( struct vcache_frontend *vcache,
- ushort flags,
- unsigned i0,
- unsigned i1 )
-{
vcache_elt(vcache, i0, flags);
vcache_elt(vcache, i1, 0);
vcache_check_flush(vcache);
@@ -161,46 +139,63 @@ static void vcache_quad( struct vcache_frontend *vcache,
unsigned i2,
unsigned i3 )
{
- vcache_triangle( vcache, i0, i1, i3 );
- vcache_triangle( vcache, i1, i2, i3 );
-}
-
-static void vcache_ef_quad( struct vcache_frontend *vcache,
- unsigned i0,
- unsigned i1,
- unsigned i2,
- unsigned i3 )
-{
- const unsigned omitEdge1 = DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_2;
- const unsigned omitEdge2 = DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_1;
-
- vcache_triangle_flags( vcache,
- DRAW_PIPE_RESET_STIPPLE | omitEdge1,
- i0, i1, i3 );
-
- vcache_triangle_flags( vcache,
- omitEdge2,
- i1, i2, i3 );
+ vcache_triangle( vcache,
+ ( DRAW_PIPE_RESET_STIPPLE |
+ DRAW_PIPE_EDGE_FLAG_0 |
+ DRAW_PIPE_EDGE_FLAG_2 ),
+ i0, i1, i3 );
+
+ vcache_triangle( vcache,
+ ( DRAW_PIPE_EDGE_FLAG_0 |
+ DRAW_PIPE_EDGE_FLAG_1 ),
+ i1, i2, i3 );
}
/* At least for now, we're back to using a template include file for
* this. The two paths aren't too different though - it may be
* possible to reunify them.
*/
-#define TRIANGLE(vc,flags,i0,i1,i2) vcache_triangle_flags(vc,flags,i0,i1,i2)
-#define QUAD(vc,i0,i1,i2,i3) vcache_ef_quad(vc,i0,i1,i2,i3)
-#define LINE(vc,flags,i0,i1) vcache_line_flags(vc,flags,i0,i1)
-#define POINT(vc,i0) vcache_point(vc,i0)
-#define FUNC vcache_run_extras
-#include "draw_pt_vcache_tmp.h"
-
-#define TRIANGLE(vc,flags,i0,i1,i2) vcache_triangle(vc,i0,i1,i2)
-#define QUAD(vc,i0,i1,i2,i3) vcache_quad(vc,i0,i1,i2,i3)
-#define LINE(vc,flags,i0,i1) vcache_line(vc,i0,i1)
-#define POINT(vc,i0) vcache_point(vc,i0)
+#define TRIANGLE(flags,i0,i1,i2) \
+ vcache_triangle(vcache, \
+ flags, \
+ get_elt(elts,i0), \
+ get_elt(elts,i1), \
+ get_elt(elts,i2))
+
+#define QUAD(i0,i1,i2,i3) \
+ vcache_quad(vcache, \
+ get_elt(elts,i0), \
+ get_elt(elts,i1), \
+ get_elt(elts,i2), \
+ get_elt(elts,i3))
+
+#define LINE(flags,i0,i1) \
+ vcache_line(vcache, \
+ flags, \
+ get_elt(elts,i0), \
+ get_elt(elts,i1))
+
+#define POINT(i0) \
+ vcache_point(vcache, \
+ get_elt(elts,i0))
+
#define FUNC vcache_run
-#include "draw_pt_vcache_tmp.h"
+#define ARGS \
+ struct draw_pt_front_end *frontend, \
+ pt_elt_func get_elt, \
+ const void *elts
+
+#define LOCAL_VARS \
+ struct vcache_frontend *vcache = (struct vcache_frontend *)frontend; \
+ struct draw_context *draw = vcache->draw; \
+ boolean flatfirst = (draw->rasterizer->flatshade && \
+ draw->rasterizer->flatshade_first); \
+ unsigned prim = vcache->input_prim; \
+ unsigned i, flags;
+#define FLUSH vcache_flush( vcache )
+
+#include "draw_pt_decompose.h"
@@ -213,15 +208,7 @@ static void vcache_prepare( struct draw_pt_front_end *frontend,
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
- if (opt & PT_PIPELINE)
- {
- vcache->base.run = vcache_run_extras;
- }
- else
- {
- vcache->base.run = vcache_run;
- }
-
+ vcache->base.run = vcache_run;
vcache->input_prim = prim;
vcache->output_prim = draw_pt_reduced_prim(prim);