Mesa (staging/20.3): panfrost: Fix panfrost_small_padded_vertex_count for 17 vertices

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 23 18:51:54 UTC 2020


Module: Mesa
Branch: staging/20.3
Commit: b4cbf3776a73e5687c2657da4f3d5cbc6661b409
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4cbf3776a73e5687c2657da4f3d5cbc6661b409

Author: Icecream95 <ixn at disroot.org>
Date:   Tue Dec 22 13:02:34 2020 +1300

panfrost: Fix panfrost_small_padded_vertex_count for 17 vertices

All odd numbers above 10 need to be rounded up to an even number, so
add one and mask off the least significant bit instead of maintaining
a list of special cases.

Fixes crashes in SuperTuxKart.

Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8191>
(cherry picked from commit a250f3620c8a2ad9164ed37d04f5241c02ccb684)

---

 .pick_status.json                 | 2 +-
 src/panfrost/lib/pan_attributes.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index b2dc667b6d1..7d18a1f6784 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -859,7 +859,7 @@
         "description": "panfrost: Fix panfrost_small_padded_vertex_count for 17 vertices",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/panfrost/lib/pan_attributes.c b/src/panfrost/lib/pan_attributes.c
index 1fe6d8cb47d..3af657f55a1 100644
--- a/src/panfrost/lib/pan_attributes.c
+++ b/src/panfrost/lib/pan_attributes.c
@@ -40,10 +40,10 @@
 static unsigned
 panfrost_small_padded_vertex_count(unsigned idx)
 {
-        if (idx == 11 || idx == 13 || idx == 15 || idx == 19)
-                return idx + 1;
-        else
+        if (idx < 10)
                 return idx;
+        else
+                return (idx + 1) & ~1;
 }
 
 static unsigned



More information about the mesa-commit mailing list