nir/lower_tex: add an callback to lower txd ops

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Anne Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37692>
This commit is contained in:
Lionel Landwerlin
2025-09-09 18:26:46 +03:00
committed by Marge Bot
parent 1db77d08e2
commit 97dde5bc10
2 changed files with 9 additions and 1 deletions

View File

@@ -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.

View File

@@ -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;