From d1b569d26f879fd606c666692db73ef5dfe43043 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 30 Mar 2023 14:08:38 -0400 Subject: [PATCH] nir/print: Don't print sampler_index for txf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NIR's docs for sampler_index say The following operations do not require a sampler and, as such, this field should be ignored: - nir_texop_txf - nir_texop_txf_ms - nir_texop_txs - nir_texop_query_levels - nir_texop_texture_samples - nir_texop_samples_identical Contrary to this documentation, we were still printing the sampler_index anyway, even though the value is formally undefined. This was helpful for PIPE_CAP_TEXTURE_BUFFER_SAMPLER drivers that (despite the NIR docs) respected the sampler_index anyway. There are no longer any such drivers, so we should stop printing sampler_index for txf to avoid confusion (and noise). Signed-off-by: Alyssa Rosenzweig Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir_print.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index c443fcc5828..6073e4121b8 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1413,14 +1413,12 @@ print_tex_instr(nir_tex_instr *instr, print_state *state) fprintf(fp, " } (offsets)"); } - if (instr->op != nir_texop_txf_ms_fb) { - if (!has_texture_deref) { - fprintf(fp, ", %u (texture)", instr->texture_index); - } + if (instr->op != nir_texop_txf_ms_fb && !has_texture_deref) { + fprintf(fp, ", %u (texture)", instr->texture_index); + } - if (!has_sampler_deref) { - fprintf(fp, ", %u (sampler)", instr->sampler_index); - } + if (nir_tex_instr_need_sampler(instr) && !has_sampler_deref) { + fprintf(fp, ", %u (sampler)", instr->sampler_index); } if (instr->texture_non_uniform) {