Mesa (staging/22.0): panfrost: Fix primitive restart with 32-bit indices
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 25 05:32:43 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: 49c0a9606c7981722774fc12d5cc652a830f6644
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49c0a9606c7981722774fc12d5cc652a830f6644
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Sun Mar 13 18:41:05 2022 -0400
panfrost: Fix primitive restart with 32-bit indices
There's an overflow here if index_size = 4. Caught when bringing up Valhall, not
sure why this was never caught before. Yikes.
Fixes: 7a6a5f3fe15 ("panfrost: Handle explicit primitive restart")
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
(cherry picked from commit 6d51c1b8987570bbf3f60d05ef6dc77edbe16ac7)
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index bc3f01ddc0a..8b36aae8b21 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -2592,7 +2592,7 @@ panfrost_emit_primitive_size(struct panfrost_context *ctx,
static bool
panfrost_is_implicit_prim_restart(const struct pipe_draw_info *info)
{
- unsigned implicit_index = (1 << (info->index_size * 8)) - 1;
+ unsigned implicit_index = BITFIELD_MASK(info->index_size * 8);
bool implicit = info->restart_index == implicit_index;
return info->primitive_restart && implicit;
}
More information about the mesa-commit
mailing list