Module: Mesa
Branch: master
Commit: 98578df27bbf682f254d59a3a7d63b5f1b98f838
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98578df27bbf682f254d59a3a7d63b5f1b98f838

Author: Roland Scheidegger <[email protected]>
Date:   Tue Apr 24 18:12:34 2018 +0200

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 <[email protected]>

---

 src/gallium/auxiliary/draw/draw_pipe_clip.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

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

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to