Module: Mesa
Branch: main
Commit: 3f1abda631f6f98cd48858728db22c874124a858
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f1abda631f6f98cd48858728db22c874124a858

Author: Alyssa Rosenzweig <[email protected]>
Date:   Sat Jan 15 09:45:26 2022 -0500

panfrost: Use u_reduced_prim for primitive checks

Use a Gallium helper that papers over the differences between primitive
types, as required by hardware operation.

[Cc'd to mesa-stable for use in the next commit.]

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14575>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c 
b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 392a654dfa8..1112f4fa617 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -2738,7 +2738,7 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
 #endif
         }
 
-        bool points = info->mode == PIPE_PRIM_POINTS;
+        enum pipe_prim_type prim = u_reduced_prim(info->mode);
         void *prim_size = pan_section_ptr(job, TILER_JOB, PRIMITIVE_SIZE);
 
 #if PAN_ARCH >= 6
@@ -2769,9 +2769,7 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
                  * be set to 0 and the provoking vertex is selected with the
                  * PRIMITIVE.first_provoking_vertex field.
                  */
-                if (info->mode == PIPE_PRIM_LINES ||
-                    info->mode == PIPE_PRIM_LINE_LOOP ||
-                    info->mode == PIPE_PRIM_LINE_STRIP) {
+                if (prim == PIPE_PRIM_LINES) {
                         /* The logic is inverted across arches. */
                         cfg.flat_shading_vertex = rast->flatshade_first
                                                 ^ (PAN_ARCH <= 5);
@@ -2792,7 +2790,7 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
                 }
         }
 
-        panfrost_emit_primitive_size(ctx, points, psiz, prim_size);
+        panfrost_emit_primitive_size(ctx, prim == PIPE_PRIM_POINTS, psiz, 
prim_size);
 }
 
 static void

Reply via email to