summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-30 14:31:42 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-08-30 14:43:08 -0600
commitaaf03b94861cbf5a602863e4542dd1c2e54ba365 (patch)
tree853b15984f8ebfb0f60ed1aa83ce7f3a5eedd384 /src
parent2d187672b7e38fcd8f6caa93f35dceb6fa11aa7f (diff)
Fix lost edge flags problem when clipping.
In emit_poly() we need to compute header.edgeflags from the vertex edge flags. Also need to set header.det so later stages can determine front/back orientation.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/draw/draw_clip.c12
-rw-r--r--src/mesa/pipe/draw/draw_unfilled.c6
2 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c
index a23b7a2810..1396b60f45 100644
--- a/src/mesa/pipe/draw/draw_clip.c
+++ b/src/mesa/pipe/draw/draw_clip.c
@@ -177,11 +177,15 @@ static INLINE void do_tri( struct draw_stage *next,
static void emit_poly( struct draw_stage *stage,
struct vertex_header **inlist,
- unsigned n )
+ unsigned n,
+ const struct prim_header *origPrim)
{
struct prim_header header;
unsigned i;
+ /* later stages may need the determinant, but only the sign matters */
+ header.det = origPrim->det;
+
for (i = 2; i < n; i++) {
header.v[0] = inlist[0];
header.v[1] = inlist[i-1];
@@ -194,6 +198,10 @@ static void emit_poly( struct draw_stage *stage,
if (i != 2) header.v[0]->edgeflag = 0;
if (i != n-1) header.v[2]->edgeflag = 0;
+ header.edgeflags = ((header.v[0]->edgeflag << 0) |
+ (header.v[1]->edgeflag << 1) |
+ (header.v[2]->edgeflag << 2));
+
stage->next->tri( stage->next, &header );
header.v[0]->edgeflag = tmp0;
@@ -302,7 +310,7 @@ do_clip_tri( struct draw_stage *stage,
/* Emit the polygon as triangles to the setup stage:
*/
if (n >= 3)
- emit_poly( stage, inlist, n );
+ emit_poly( stage, inlist, n, header );
}
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c
index 4215b8b228..b0d6f3d065 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/mesa/pipe/draw/draw_unfilled.c
@@ -104,6 +104,12 @@ static void lines( struct draw_stage *stage,
struct vertex_header *v1 = header->v[1];
struct vertex_header *v2 = header->v[2];
+#if 0
+ assert(((header->edgeflags & 0x1) >> 0) == header->v[0]->edgeflag);
+ assert(((header->edgeflags & 0x2) >> 1) == header->v[1]->edgeflag);
+ assert(((header->edgeflags & 0x4) >> 2) == header->v[2]->edgeflag);
+#endif
+
if (header->edgeflags & 0x1) line( stage, v0, v1 );
if (header->edgeflags & 0x2) line( stage, v1, v2 );
if (header->edgeflags & 0x4) line( stage, v2, v0 );