panfrost: Fix provoking vertex selection for lines
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 1 Dec 2020 08:18:18 +0000 (09:18 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 9 Dec 2020 16:54:19 +0000 (16:54 +0000)
For line primitives, the provoking vertex selection is done through the
DRAW.flat_shading_vertex field and PRIMITIVE.first_provoking_vertex must
be set to true.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7923>

.gitlab-ci/traces-panfrost.yml
src/gallium/drivers/panfrost/pan_context.c

index b6aa7d8..2e2e84f 100644 (file)
@@ -57,7 +57,7 @@ traces:
   - path: 0ad/0ad.trace
     expectations:
       - device: gl-panfrost-t860
-        checksum: e159a06f423998ea7fcc0107f0e62f15
+        checksum: 63fd6b8720a6dbc42f3c1281179d5e82
   - path: glmark2/buffer-columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map.rdc
     expectations:
       - device: gl-panfrost-t860
@@ -125,7 +125,7 @@ traces:
   - path: glmark2/ideas-speed=duration.rdc
     expectations:
       - device: gl-panfrost-t860
-        checksum: 2cf45bca36f4d168e96faf7f90a7e515
+        checksum: 458556bc1ade89323181e4d0483a7cd3
   - path: glmark2/loop-fragment-loop=false:fragment-steps=5:vertex-steps=5.rdc
     expectations:
       - device: gl-panfrost-t860
@@ -202,7 +202,7 @@ traces:
   - path: humus/CelShading.trace
     expectations:
       - device: gl-panfrost-t860
-        checksum: e44a7ac7442e82d85de583f2cdd68fdf
+        checksum: 521ca6a236b8400cf692e6817b91c739
   - path: humus/DynamicBranching3.trace
     expectations:
       - device: gl-panfrost-t860
index 0b55528..2b752c0 100644 (file)
@@ -354,7 +354,18 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
                 cfg.draw_mode = pan_draw_mode(info->mode);
                 if (panfrost_writes_point_size(ctx))
                         cfg.point_size_array_format = MALI_POINT_SIZE_ARRAY_FORMAT_FP16;
-                cfg.first_provoking_vertex = rast->flatshade_first;
+
+                /* For line primitives, PRIMITIVE.first_provoking_vertex must
+                 * be set to true and the provoking vertex is selected with
+                 * DRAW.flat_shading_vertex.
+                 */
+                if (info->mode == PIPE_PRIM_LINES ||
+                    info->mode == PIPE_PRIM_LINE_LOOP ||
+                    info->mode == PIPE_PRIM_LINE_STRIP)
+                        cfg.first_provoking_vertex = true;
+                else
+                        cfg.first_provoking_vertex = rast->flatshade_first;
+
                 if (info->primitive_restart)
                         cfg.primitive_restart = MALI_PRIMITIVE_RESTART_IMPLICIT;
                 cfg.job_task_split = 6;
@@ -402,6 +413,18 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
                 cfg.varying_buffers = fs_vary ? varyings : 0;
                 cfg.thread_storage = shared_mem;
 
+                /* For all primitives but lines DRAW.flat_shading_vertex must
+                 * 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) {
+                        /* The logic is inverted on bifrost. */
+                        cfg.flat_shading_vertex =
+                                is_bifrost ? rast->flatshade_first : !rast->flatshade_first;
+                }
+
                 pan_emit_draw_descs(batch, &cfg, PIPE_SHADER_FRAGMENT);
 
                 if (ctx->occlusion_query && ctx->active_queries) {