panfrost: Fix crash with GALLIUM_HUD

Due to the order of binding shaders, GALLIUM_HUD triggered a NULL pointer
dereference in the new shader variants code.

Fixes: 0fcddd4d2c ("pan/bi: Rework varying linking on Valhall")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16707>
This commit is contained in:
Alyssa Rosenzweig
2022-05-20 16:30:46 -04:00
committed by Marge Bot
parent ef76b83633
commit 9773ed1dc7
@@ -526,6 +526,10 @@ panfrost_update_shader_variant(struct panfrost_context *ctx,
if (type == PIPE_SHADER_FRAGMENT && !ctx->shader[PIPE_SHADER_VERTEX])
return;
/* Also defer, happens with GALLIUM_HUD */
if (!ctx->shader[type])
return;
/* Match the appropriate variant */
signed variant = -1;
struct panfrost_shader_variants *variants = ctx->shader[type];