Mesa (master): gallivm/nir: fix const compact

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 31 03:35:23 UTC 2020


Module: Mesa
Branch: master
Commit: d7aed02bccae41c68c06002bab42c9efe166e68e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7aed02bccae41c68c06002bab42c9efe166e68e

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jun 19 17:11:12 2020 +1000

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 at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6381>

---

 src/gallium/auxiliary/gallivm/lp_bld_nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 99b35cfccd6..b9fb3393a7c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -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;



More information about the mesa-commit mailing list