gallivm/nir: fix const compact

Since adding support for compacts this crashes with indirects
don't get the const address unless it's a const.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6381>
This commit is contained in:
Dave Airlie 2020-06-19 17:11:12 +10:00
parent 96a5ced65f
commit d7aed02bcc

View file

@ -922,7 +922,7 @@ get_deref_offset(struct lp_build_nir_context *bld_base, nir_deref_instr *instr,
uint32_t const_offset = 0;
LLVMValueRef offset = NULL;
if (var->data.compact) {
if (var->data.compact && nir_src_is_const(instr->arr.index)) {
assert(instr->deref_type == nir_deref_type_array);
const_offset = nir_src_as_uint(instr->arr.index);
goto out;