mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
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.
This commit is contained in:
parent
2d187672b7
commit
aaf03b9486
2 changed files with 16 additions and 2 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue