From a01712874d9effb97ed6d8c7dd80966fed0c44ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 13 Apr 2024 18:09:38 -0400 Subject: [PATCH] nir/lower_tex: support FMASK loads with a 16-bit sample index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Georg Lehmann Reviewed-by: Timur Kristóf Part-of: --- src/compiler/nir/nir_lower_tex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 2865fd14647..f49439ce9fc 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1423,13 +1423,15 @@ nir_lower_ms_txf_to_fragment_fetch(nir_builder *b, nir_tex_instr *tex) /* Obtain new sample index. */ int ms_index = nir_tex_instr_src_index(tex, nir_tex_src_ms_index); assert(ms_index >= 0); - nir_src sample = tex->src[ms_index].src; + nir_def *sample = tex->src[ms_index].src.ssa; nir_def *new_sample = nir_ubfe(b, &fmask_fetch->def, - nir_ishl_imm(b, sample.ssa, 2), nir_imm_int(b, 3)); + nir_u2u32(b, nir_ishl_imm(b, sample, 2)), + nir_imm_int(b, 3)); /* Update instruction. */ tex->op = nir_texop_fragment_fetch_amd; - nir_src_rewrite(&tex->src[ms_index].src, new_sample); + nir_src_rewrite(&tex->src[ms_index].src, + nir_u2uN(b, new_sample, sample->bit_size)); } static void