draw: fix edge flag handling in clipper (for unfilled tris/quads/polygons)
authorBrian Paul <brianp@vmware.com>
Wed, 8 Jun 2011 14:05:40 +0000 (08:05 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 8 Jun 2011 14:05:40 +0000 (08:05 -0600)
commitf6572017b94a137a4102342ebf6cd20dedc90271
treee2a1fbd6fb5d1718c7eefda3f7b50cab4e2602ae
parent0e8d045bf8bc930576cc69b9de8a31a4c973dc7c
draw: fix edge flag handling in clipper (for unfilled tris/quads/polygons)

Previously, we were errantly drawing some interior edges of clipped
polygons and quads.  Also, we were introducing extra edges where
polygons intersected the view frustum clip planes.

The main problem was that we were ignoring the edgeflags encoded in
the primitive header's 'flags' field which are set during polygon/quad
->tri decomposition.  We need to observe those during clipping.  Since
we can't modify the existing vert's edgeflag fields, we need to store
them in a parallel array.

Edge flags also need to be handled differently for view frustum planes
vs. user-defined clip planes.  In the former case we don't want to draw
new clip edges but in the later case we do.  This matches NVIDIA's
behaviour and it just looks right.

Finally, note that the LLVM draw code does not properly set vertex
edge flags.  It's OK on the regular software path though.
src/gallium/auxiliary/draw/draw_pipe_clip.c