From fffbd3ff2b9a53299ffd4b5c7dd5399f69685335 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 16 Jul 2024 17:31:08 -0500 Subject: [PATCH] nak/nir: Use prmt in texture lowering Part-of: --- src/nouveau/compiler/nak_nir_lower_tex.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nouveau/compiler/nak_nir_lower_tex.c b/src/nouveau/compiler/nak_nir_lower_tex.c index 9bb4d64bfde..2e16c26cda8 100644 --- a/src/nouveau/compiler/nak_nir_lower_tex.c +++ b/src/nouveau/compiler/nak_nir_lower_tex.c @@ -156,9 +156,9 @@ lower_tex(nir_builder *b, nir_tex_instr *tex, const struct nak_compiler *nak) PUSH(src0, nir_channel(b, coord, i)); if (offset != NULL) { - nir_def *arr_off = nir_ishl_imm(b, offset, 16); - if (arr_idx) - arr_off = nir_ior(b, arr_off, arr_idx); + nir_def *arr_idx_or_zero = arr_idx ? arr_idx : nir_imm_int(b, 0); + nir_def *arr_off = nir_prmt_nv(b, nir_imm_int(b, 0x1054), + offset, arr_idx_or_zero); PUSH(src0, arr_off); } else if (arr_idx != NULL) { PUSH(src0, arr_idx); @@ -171,9 +171,9 @@ lower_tex(nir_builder *b, nir_tex_instr *tex, const struct nak_compiler *nak) } } else { if (min_lod != NULL) { - nir_def *arr_ml = nir_ishl_imm(b, min_lod, 16); - if (arr_idx) - arr_ml = nir_ior(b, arr_ml, arr_idx); + nir_def *arr_idx_or_zero = arr_idx ? arr_idx : nir_imm_int(b, 0); + nir_def *arr_ml = nir_prmt_nv(b, nir_imm_int(b, 0x1054), + min_lod, arr_idx_or_zero); PUSH(src0, arr_ml); } else if (arr_idx != NULL) { PUSH(src0, arr_idx);