Module: Mesa Branch: staging/21.0 Commit: 176213f01c59ca8268a91f0e84306cc2a17984ef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=176213f01c59ca8268a91f0e84306cc2a17984ef
Author: Dave Airlie <[email protected]> Date: Fri May 7 11:26:35 2021 +1000 gallivm: handle texture arrays in non-fragment shaders with lod. We have to unwind the lod into the scalar path correctly. Fixes a crash with renderdoc demo Fixes: e168d148d76d ("gallivm/nir: handle non-uniform texture offsets") Reviewed-By: Mike Blumenkrantz <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10676> (cherry picked from commit 83a05caaf2ce4fa9d6605eddd5658bf400f642fb) --- .pick_status.json | 2 +- src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a184812bb09..695fe4526e1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4207,7 +4207,7 @@ "description": "gallivm: handle texture arrays in non-fragment shaders with lod.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "e168d148d76d780eda6f9aaa6c66608c4df3096c" }, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index 1105f46f10d..90954a19c82 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1394,10 +1394,10 @@ static void emit_tex(struct lp_build_nir_context *bld_base, LLVMGetUndef(bld_base->base.vec_type), LLVMGetUndef(bld_base->base.vec_type), LLVMGetUndef(bld_base->base.vec_type) }; - LLVMValueRef texel[4], orig_offset; + LLVMValueRef texel[4], orig_offset, orig_lod; unsigned i; orig_texel_ptr = params->texel; - + orig_lod = params->lod; for (i = 0; i < 5; i++) { coords[i] = params->coords[i]; } @@ -1416,6 +1416,8 @@ static void emit_tex(struct lp_build_nir_context *bld_base, idx, ""); params->type = lp_elem_type(bld_base->base.type); + if (orig_lod) + params->lod = LLVMBuildExtractElement(gallivm->builder, orig_lod, idx, ""); params->texel = texel; bld->sampler->emit_tex_sample(bld->sampler, gallivm, _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
