summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-04-01 14:48:59 +0100
committerKeith Whitwell <[email protected]>2008-04-01 14:51:25 +0100
commitcaa44763f7f7aa26ed0b0d1e5af0c410fba6bfe6 (patch)
tree4d50bb0f077627a51f0326bdef09d7bb8e704eb8 /src/gallium
parent52f40dcc468039fc9cca45a4de20a5aa11228b67 (diff)
draw: respect flatshade_first in flatshade stage
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_flatshade.c55
1 files changed, 49 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_flatshade.c b/src/gallium/auxiliary/draw/draw_flatshade.c
index ccad71d6957..af2cb05c989 100644
--- a/src/gallium/auxiliary/draw/draw_flatshade.c
+++ b/src/gallium/auxiliary/draw/draw_flatshade.c
@@ -84,8 +84,25 @@ static INLINE void copy_colors2( struct draw_stage *stage,
* Flatshade tri. Required for clipping and when unfilled tris are
* active, otherwise handled by hardware.
*/
-static void flatshade_tri( struct draw_stage *stage,
- struct prim_header *header )
+static void flatshade_tri_0( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct prim_header tmp;
+
+ tmp.det = header->det;
+ tmp.edgeflags = header->edgeflags;
+ tmp.v[0] = header->v[0];
+ tmp.v[1] = dup_vert(stage, header->v[1], 0);
+ tmp.v[2] = dup_vert(stage, header->v[2], 1);
+
+ copy_colors2(stage, tmp.v[1], tmp.v[2], tmp.v[0]);
+
+ stage->next->tri( stage->next, &tmp );
+}
+
+
+static void flatshade_tri_2( struct draw_stage *stage,
+ struct prim_header *header )
{
struct prim_header tmp;
@@ -101,11 +118,27 @@ static void flatshade_tri( struct draw_stage *stage,
}
+
+
+
/**
* Flatshade line. Required for clipping.
*/
-static void flatshade_line( struct draw_stage *stage,
- struct prim_header *header )
+static void flatshade_line_0( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct prim_header tmp;
+
+ tmp.v[0] = header->v[0];
+ tmp.v[1] = dup_vert(stage, header->v[1], 0);
+
+ copy_colors(stage, tmp.v[1], tmp.v[0]);
+
+ stage->next->line( stage->next, &tmp );
+}
+
+static void flatshade_line_1( struct draw_stage *stage,
+ struct prim_header *header )
{
struct prim_header tmp;
@@ -118,6 +151,8 @@ static void flatshade_line( struct draw_stage *stage,
}
+/* Flatshade point -- passthrough.
+ */
static void flatshade_point( struct draw_stage *stage,
struct prim_header *header )
{
@@ -140,8 +175,16 @@ static void flatshade_init_state( struct draw_stage *stage )
}
}
- stage->line = flatshade_line;
- stage->tri = flatshade_tri;
+ /* Choose flatshade routine according to provoking vertex:
+ */
+ if (stage->draw->rasterizer->flatshade_first) {
+ stage->line = flatshade_line_0;
+ stage->tri = flatshade_tri_0;
+ }
+ else {
+ stage->line = flatshade_line_1;
+ stage->tri = flatshade_tri_2;
+ }
}
static void flatshade_first_tri( struct draw_stage *stage,