diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 3b2898f6f1b..ed97aa6851e 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5778,6 +5778,12 @@ typedef struct nir_lower_tex_options { */ bool lower_txd_offset_clamp; + /** + * A generic callback to nir_texop_txd. + */ + bool (*lower_txd_cb)(const nir_tex_instr *tex, const void *data); + const void *lower_txd_data; + /** * If true, lower nir_texop_txd with min_lod to a nir_texop_txl if the * sampler is bindless. diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 28aca6f6a78..48061326219 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1752,7 +1752,9 @@ nir_lower_tex_block(nir_block *block, nir_builder *b, tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) || (options->lower_txd_3d && tex->sampler_dim == GLSL_SAMPLER_DIM_3D) || - (options->lower_txd_array && tex->is_array))) { + (options->lower_txd_array && tex->is_array) || + (options->lower_txd_cb && + options->lower_txd_cb(tex, options->lower_txd_data)))) { lower_gradient(b, tex); progress = true; continue;