diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index 2b56a527cb0..8cb512021be 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -5535,6 +5535,12 @@ visit_tex(struct lp_build_nir_soa_context *bld, nir_tex_instr *instr) if (!sampler_resource) sampler_resource = texture_resource; + if (instr->is_array && instr->sampler_dim == GLSL_SAMPLER_DIM_1D) { + /* move layer coord for 1d arrays. */ + coords[2] = coords[1]; + coords[1] = coord_zero; + } + switch (instr->op) { case nir_texop_tex: case nir_texop_tg4: @@ -5554,12 +5560,6 @@ visit_tex(struct lp_build_nir_soa_context *bld, nir_tex_instr *instr) ; } - if (instr->is_array && instr->sampler_dim == GLSL_SAMPLER_DIM_1D) { - /* move layer coord for 1d arrays. */ - coords[2] = coords[1]; - coords[1] = coord_zero; - } - uint32_t samp_base_index = 0, tex_base_index = 0; if (!sampler_deref_instr) { int samp_src_index = nir_tex_instr_src_index(instr, nir_tex_src_sampler_handle);