diff --git a/.pick_status.json b/.pick_status.json index 26f6e1dca0f..ea72a44baab 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -391,7 +391,7 @@ "description": "gallivm: fix ssbo oob reads", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "591899eedd2d797bfdb7dbb6b3e2169d50d42109" }, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index 5a8fd02561b..fb509bfb685 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1181,9 +1181,12 @@ static void emit_load_mem(struct lp_build_nir_context *bld_base, LLVMValueRef res_store = lp_build_alloca(gallivm, LLVMTypeOf(zero), ""); LLVMBuildStore(builder, zero, res_store); - LLVMValueRef fetch_cond = LLVMBuildICmp(gallivm->builder, LLVMIntUGE, ssbo_limit, chan_offset, ""); + LLVMValueRef fetch_extent = LLVMBuildAdd(builder, chan_offset, lp_build_const_int32(gallivm, 1), ""); + LLVMValueRef fetch_cond = LLVMBuildICmp(gallivm->builder, LLVMIntUGE, ssbo_limit, fetch_extent, ""); + LLVMValueRef fetch_cond2 = LLVMBuildICmp(gallivm->builder, LLVMIntSGE, chan_offset, lp_build_const_int32(gallivm, 0), ""); + LLVMValueRef fetch_cond_final = LLVMBuildAnd(gallivm->builder, fetch_cond, fetch_cond2, ""); struct lp_build_if_state ifthen; - lp_build_if(&ifthen, gallivm, fetch_cond); + lp_build_if(&ifthen, gallivm, fetch_cond_final); LLVMBuildStore(builder, lp_build_pointer_get(builder, mem_ptr, chan_offset), res_store); lp_build_endif(&ifthen);