bool lower_rect_offset;
/**
+ * If not NULL, this filter will return true for tex instructions that
+ * should lower away nir_tex_src_offset.
+ */
+ nir_instr_filter_cb lower_offset_filter;
+
+ /**
* If true, lower rect textures to 2D, using txs to fetch the
* texture dimensions and dividing the texture coords by the
* texture dims to normalize.
* absolute values of derivatives is 0 for all coordinates.
*/
bool lower_lod_zero_width;
+
+ /**
+ * Payload data to be sent to callback / filter functions.
+ */
+ void *callback_data;
} nir_lower_tex_options;
/** Lowers complex texture instructions to simpler ones */
if ((tex->op == nir_texop_txf && options->lower_txf_offset) ||
(sat_mask && nir_tex_instr_src_index(tex, nir_tex_src_coord) >= 0) ||
(tex->sampler_dim == GLSL_SAMPLER_DIM_RECT &&
- options->lower_rect_offset)) {
+ options->lower_rect_offset) ||
+ (options->lower_offset_filter &&
+ options->lower_offset_filter(instr, options->callback_data))) {
progress = lower_offset(b, tex) || progress;
}