draw: simplify clip null tri logic

Simplifies the logic when to emit null tris (albeit the reasons why we
have to do this remain unclear).
This is strictly just logic simplification, the behavior doesn't change
at all.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Roland Scheidegger 2018-04-24 18:12:34 +02:00
parent c17ddcb4b4
commit 98578df27b
1 changed files with 9 additions and 11 deletions

View File

@ -252,8 +252,7 @@ static void emit_poly(struct draw_stage *stage,
struct prim_header header; struct prim_header header;
unsigned i; unsigned i;
ushort edge_first, edge_middle, edge_last; ushort edge_first, edge_middle, edge_last;
boolean last_tri_was_null = FALSE; boolean tri_emitted = FALSE;
boolean tri_was_not_null = FALSE;
if (stage->draw->rasterizer->flatshade_first) { if (stage->draw->rasterizer->flatshade_first) {
edge_first = DRAW_PIPE_EDGE_FLAG_0; edge_first = DRAW_PIPE_EDGE_FLAG_0;
@ -289,17 +288,16 @@ static void emit_poly(struct draw_stage *stage,
} }
tri_null = is_tri_null(clipper, &header); tri_null = is_tri_null(clipper, &header);
/* If we generated a triangle with an area, aka. non-null triangle, /*
* or if the previous triangle was also null then skip all subsequent * If we ever generated a tri (regardless if it had area or not),
* null triangles */ * skip all subsequent null tris.
if ((tri_was_not_null && tri_null) || (last_tri_was_null && tri_null)) { * FIXME: it is unclear why we always have to emit at least one
last_tri_was_null = tri_null; * tri. Maybe this is hiding bugs elsewhere.
*/
if (tri_null && tri_emitted) {
continue; continue;
} }
last_tri_was_null = tri_null; tri_emitted = TRUE;
if (!tri_null) {
tri_was_not_null = TRUE;
}
if (!edgeflags[i-1]) { if (!edgeflags[i-1]) {
header.flags &= ~edge_middle; header.flags &= ~edge_middle;