From 8b45c9ce6e17f9b74f49d308eda3da1c768bc726 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 21:53:34 -0600 Subject: draw: implement flatshade_first for drawing pipeline --- src/gallium/auxiliary/draw/draw_pt_decompose.h | 72 +++++++++++++++++++------- 1 file changed, 54 insertions(+), 18 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_pt_decompose.h') diff --git a/src/gallium/auxiliary/draw/draw_pt_decompose.h b/src/gallium/auxiliary/draw/draw_pt_decompose.h index 3fb0695687..a86c8d7877 100644 --- a/src/gallium/auxiliary/draw/draw_pt_decompose.h +++ b/src/gallium/auxiliary/draw/draw_pt_decompose.h @@ -47,20 +47,36 @@ static void FUNC( ARGS, case PIPE_PRIM_TRIANGLES: for (i = 0; i+2 < count; i += 3) { - TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - (i + 0), - (i + 1), - (i + 2 )); + if (draw->rasterizer->flatshade_first) { + /* put provoking vertex in last pos for clipper */ + TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, + (i + 1), + (i + 2), + (i + 0 )); + } + else { + TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, + (i + 0), + (i + 1), + (i + 2 )); + } } break; case PIPE_PRIM_TRIANGLE_STRIP: if (flatfirst) { + printf("%s tri strip %d %d %d\n", + __FUNCTION__, + (i + 1 + (i&1)), + (i + 2 - (i&1)), + (i + 0) ); + + for (i = 0; i+2 < count; i++) { TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - (i + 0), (i + 1 + (i&1)), - (i + 2 - (i&1))); + (i + 2 - (i&1)), + (i + 0) ); } } else { @@ -78,9 +94,9 @@ static void FUNC( ARGS, if (flatfirst) { for (i = 0; i+2 < count; i++) { TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - (i + 1), (i + 2), - (0 )); + 0, + (i + 1) ); } } else { @@ -96,20 +112,40 @@ static void FUNC( ARGS, case PIPE_PRIM_QUADS: - for (i = 0; i+3 < count; i += 4) { - QUAD( (i + 0), - (i + 1), - (i + 2), - (i + 3)); + if (flatfirst) { + for (i = 0; i+3 < count; i += 4) { + QUAD( (i + 1), + (i + 2), + (i + 3), + (i + 0) ); + } + } + else { + for (i = 0; i+3 < count; i += 4) { + QUAD( (i + 0), + (i + 1), + (i + 2), + (i + 3)); + } } break; case PIPE_PRIM_QUAD_STRIP: - for (i = 0; i+3 < count; i += 2) { - QUAD( (i + 2), - (i + 0), - (i + 1), - (i + 3)); + if (flatfirst) { + for (i = 0; i+3 < count; i += 2) { + QUAD( (i + 1), + (i + 3), + (i + 2), + (i + 0) ); + } + } + else { + for (i = 0; i+3 < count; i += 2) { + QUAD( (i + 2), + (i + 0), + (i + 1), + (i + 3)); + } } break; -- cgit v1.2.3 From 9205a871e75f66de3501519018e76b6f49d2cce8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Jun 2009 22:51:41 -0600 Subject: draw: remove debug code --- src/gallium/auxiliary/draw/draw_pt_decompose.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_pt_decompose.h') diff --git a/src/gallium/auxiliary/draw/draw_pt_decompose.h b/src/gallium/auxiliary/draw/draw_pt_decompose.h index a86c8d7877..8e1d60e9ce 100644 --- a/src/gallium/auxiliary/draw/draw_pt_decompose.h +++ b/src/gallium/auxiliary/draw/draw_pt_decompose.h @@ -65,13 +65,6 @@ static void FUNC( ARGS, case PIPE_PRIM_TRIANGLE_STRIP: if (flatfirst) { - printf("%s tri strip %d %d %d\n", - __FUNCTION__, - (i + 1 + (i&1)), - (i + 2 - (i&1)), - (i + 0) ); - - for (i = 0; i+2 < count; i++) { TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, (i + 1 + (i&1)), -- cgit v1.2.3 From 0ddc4dbe43422211e6f3fb3278e7b2f55a25976b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Jun 2009 23:00:37 -0600 Subject: draw: use flatfirst variable --- src/gallium/auxiliary/draw/draw_pt_decompose.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/auxiliary/draw/draw_pt_decompose.h') diff --git a/src/gallium/auxiliary/draw/draw_pt_decompose.h b/src/gallium/auxiliary/draw/draw_pt_decompose.h index 8e1d60e9ce..4ca5b52020 100644 --- a/src/gallium/auxiliary/draw/draw_pt_decompose.h +++ b/src/gallium/auxiliary/draw/draw_pt_decompose.h @@ -47,7 +47,7 @@ static void FUNC( ARGS, case PIPE_PRIM_TRIANGLES: for (i = 0; i+2 < count; i += 3) { - if (draw->rasterizer->flatshade_first) { + if (flatfirst) { /* put provoking vertex in last pos for clipper */ TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, (i + 1), -- cgit v1.2.3