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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8191>
(cherry picked from commit a250f3620c)
This commit is contained in:
Icecream95 2020-12-22 13:02:34 +13:00 committed by Dylan Baker
parent 6e75f406f8
commit b4cbf3776a
2 changed files with 4 additions and 4 deletions

View file

@ -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
},

View file

@ -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