From e0fffabda7b8c69ef50dfe2da5b54a7b372503bf Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 13 Apr 2026 09:42:04 -0400 Subject: [PATCH] nir/builder: Allow backend1/2 in nir_build_tex() Reviewed-by: Christoph Pillmayer Reviewed-by: Lorenzo Rossi Part-of: --- src/compiler/nir/nir_builder.c | 8 +++++++- src/compiler/nir/nir_builder.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_builder.c b/src/compiler/nir/nir_builder.c index 7098b360faa..8b5eb1ee233 100644 --- a/src/compiler/nir/nir_builder.c +++ b/src/compiler/nir/nir_builder.c @@ -290,7 +290,8 @@ nir_build_tex_struct(nir_builder *build, nir_texop op, struct nir_tex_builder f) } const unsigned num_srcs = has_texture_src + has_sampler_src + !!f.coord + - !!f.ms_index + !!lod + !!f.bias + !!f.comparator; + !!f.ms_index + !!lod + !!f.bias + + !!f.comparator + !!f.backend1 + !!f.backend2; nir_tex_instr *tex = nir_tex_instr_create(build->shader, num_srcs); tex->op = op; @@ -384,6 +385,11 @@ nir_build_tex_struct(nir_builder *build, nir_texop op, struct nir_tex_builder f) tex->src[i++] = nir_tex_src_for_ssa(nir_tex_src_comparator, f.comparator); } + if (f.backend1) + tex->src[i++] = nir_tex_src_for_ssa(nir_tex_src_backend1, f.backend1); + if (f.backend2) + tex->src[i++] = nir_tex_src_for_ssa(nir_tex_src_backend2, f.backend2); + assert(i == num_srcs); nir_def_init(&tex->instr, &tex->def, nir_tex_instr_dest_size(tex), diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 02e2dc683d6..51f0aadfb07 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -2196,6 +2196,7 @@ DEF_DERIV(ddy_coarse) struct nir_tex_builder { nir_def *coord, *ms_index, *lod, *bias, *comparator; + nir_def *backend1, *backend2; unsigned texture_index, sampler_index; nir_def *texture_offset, *sampler_offset; nir_def *texture_heap_offset, *sampler_heap_offset;