From b2a4b6447156c6986e059041fa883a4a37e9bf56 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 5 Jan 2022 20:06:41 +0100 Subject: [PATCH] vrend: don't try to read from an undefined vertex element array With the link_shader command we might end up calculating shader keys without the full draw info being available, specifically, without the vertex element array being defined. Skip querying the integer masks in this case. v2: Fix extra line (Yiwei) Fixes: #664 Signed-off-by: Gert Wollny Reviewed-by: Yiwei Zhang Reviewed-by: Chia-I Wu --- src/vrend_renderer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index e98fab8..fed7b83 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3542,8 +3542,10 @@ static inline void vrend_fill_shader_key(struct vrend_sub_context *sub_ctx, if (vrend_state.use_core_profile) { int i; - // Only use integer info when drawing to avoid stale info. - if (vrend_state.use_integer && sub_ctx->drawing && + /* Only use integer info when drawing to avoid stale info. + * Since we can get here from link_shaders before actually drawing anything, + * we may have no vertex element array */ + if (vrend_state.use_integer && sub_ctx->drawing && sub_ctx->ve && type == PIPE_SHADER_VERTEX) { key->vs.attrib_signed_int_bitmask = sub_ctx->ve->signed_int_bitmask; key->vs.attrib_unsigned_int_bitmask = sub_ctx->ve->unsigned_int_bitmask;