From f153f945fc6ee4239e15c536bdff67ca7eeba664 Mon Sep 17 00:00:00 2001 From: Constantine Shablia Date: Wed, 24 Apr 2024 14:33:04 +0300 Subject: [PATCH] pan/bi: clean up tex coord lowering Reviewed-by: Erik Faye-Lund Reviewed-by: Boris Brezillon Reviewed-by: Mary Guillemard Part-of: --- src/panfrost/compiler/bifrost_compile.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index e2c92fcffc1..0a48a1f38fd 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -3573,10 +3573,11 @@ bi_emit_tex_valhall(bi_builder *b, nir_tex_instr *instr) for (unsigned i = 0; i < instr->num_srcs; ++i) { bi_index index = bi_src_index(&instr->src[i].src); unsigned sz = nir_src_bit_size(instr->src[i].src); - unsigned components = nir_src_num_components(instr->src[i].src); switch (instr->src[i].src_type) { - case nir_tex_src_coord: + case nir_tex_src_coord: { + unsigned components = nir_src_num_components(instr->src[i].src) - instr->is_array; + if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE) { sregs[VALHALL_TEX_SREG_X_COORD] = bi_emit_texc_cube_coord( b, index, &sregs[VALHALL_TEX_SREG_Y_COORD]); @@ -3586,20 +3587,20 @@ bi_emit_tex_valhall(bi_builder *b, nir_tex_instr *instr) /* Copy XY (for 2D+) or XX (for 1D) */ sregs[VALHALL_TEX_SREG_X_COORD] = index; - if ((components == 2 && !instr->is_array) || components > 2) + if (components >= 2) sregs[VALHALL_TEX_SREG_Y_COORD] = bi_extract(b, index, 1); - if (components == 3 && !instr->is_array) { + if (components == 3) sregs[VALHALL_TEX_SREG_Z_COORD] = bi_extract(b, index, 2); - } } if (instr->is_array) { sregs[VALHALL_TEX_SREG_ARRAY] = - bi_extract(b, index, components - 1); + bi_extract(b, index, components); } break; + } case nir_tex_src_lod: if (nir_src_is_const(instr->src[i].src) &&