unsigned saturate_r;
} nir_lower_tex_options;
-void nir_lower_tex(nir_shader *shader,
+bool nir_lower_tex(nir_shader *shader,
const nir_lower_tex_options *options);
void nir_lower_idiv(nir_shader *shader);
typedef struct {
nir_builder b;
const nir_lower_tex_options *options;
+ bool progress;
} lower_tex_state;
static void
/* If we are clamping any coords, we must lower projector first
* as clamping happens *after* projection:
*/
- if (lower_txp || sat_mask)
+ if (lower_txp || sat_mask) {
project_src(b, tex);
+ state->progress = true;
+ }
if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) &&
- state->options->lower_rect)
+ state->options->lower_rect) {
lower_rect(b, tex);
+ state->progress = true;
+ }
- if (sat_mask)
+ if (sat_mask) {
saturate_src(b, tex, sat_mask);
+ state->progress = true;
+ }
}
return true;
nir_metadata_dominance);
}
-void
+bool
nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
{
lower_tex_state state;
state.options = options;
+ state.progress = false;
+
nir_foreach_overload(shader, overload) {
if (overload->impl)
nir_lower_tex_impl(overload->impl, &state);
}
+
+ return state.progress;
}
.lower_txp = ~0,
};
- OPT_V(nir_lower_tex, &tex_options);
+ OPT(nir_lower_tex, &tex_options);
OPT(nir_normalize_cubemap_coords);
OPT(nir_lower_global_vars_to_local);