diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index 2fb6c7b683a..846583c7354 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1449,6 +1449,7 @@ static void emit_tex(struct lp_build_nir_context *bld_base, { struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base; struct gallivm_state *gallivm = bld_base->base.gallivm; + LLVMBuilderRef builder = bld_base->base.gallivm->builder; params->type = bld_base->base.type; params->context_ptr = bld->context_ptr; @@ -1502,10 +1503,25 @@ static void emit_tex(struct lp_build_nir_context *bld_base, return; } - if (params->texture_index_offset) - params->texture_index_offset = LLVMBuildExtractElement(bld_base->base.gallivm->builder, - params->texture_index_offset, - lp_build_const_int32(bld_base->base.gallivm, 0), ""); + if (params->texture_index_offset) { + struct lp_build_loop_state loop_state; + LLVMValueRef exec_mask = mask_vec(bld_base); + LLVMValueRef outer_cond = LLVMBuildICmp(builder, LLVMIntNE, exec_mask, bld_base->uint_bld.zero, ""); + LLVMValueRef res_store = lp_build_alloca(gallivm, bld_base->uint_bld.elem_type, ""); + lp_build_loop_begin(&loop_state, gallivm, lp_build_const_int32(gallivm, 0)); + LLVMValueRef if_cond = LLVMBuildExtractElement(gallivm->builder, outer_cond, loop_state.counter, ""); + + struct lp_build_if_state ifthen; + lp_build_if(&ifthen, gallivm, if_cond); + LLVMValueRef value_ptr = LLVMBuildExtractElement(gallivm->builder, params->texture_index_offset, + loop_state.counter, ""); + LLVMBuildStore(builder, value_ptr, res_store); + lp_build_endif(&ifthen); + lp_build_loop_end_cond(&loop_state, lp_build_const_int32(gallivm, bld_base->uint_bld.type.length), + NULL, LLVMIntUGE); + LLVMValueRef idx_val = LLVMBuildLoad(builder, res_store, ""); + params->texture_index_offset = idx_val; + } params->type = bld_base->base.type; bld->sampler->emit_tex_sample(bld->sampler, diff --git a/src/gallium/drivers/zink/ci/zink-lvp-fails.txt b/src/gallium/drivers/zink/ci/zink-lvp-fails.txt index b5a1b3d95a2..da69f344fbf 100644 --- a/src/gallium/drivers/zink/ci/zink-lvp-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-lvp-fails.txt @@ -12,10 +12,6 @@ KHR-GL46.tessellation_shader.tessellation_shader_quads_tessellation.degenerate_c KHR-GL46.tessellation_shader.tessellation_shader_quads_tessellation.inner_tessellation_level_rounding,Fail KHR-GL46.tessellation_shader.tessellation_shader_tessellation.gl_InvocationID_PatchVerticesIn_PrimitiveID,Fail KHR-GL46.tessellation_shader.vertex.vertex_spacing,Fail -KHR-GL46.texture_barrier_ARB.disjoint-texels,Fail -KHR-GL46.texture_barrier_ARB.overlapping-texels,Fail -KHR-GL46.texture_barrier.disjoint-texels,Fail -KHR-GL46.texture_barrier.overlapping-texels,Fail KHR-GL46.texture_view.view_sampling,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip,Fail