r300: move r300_transform_*_trig_input out of nir_to_rc

This was moved from r300_optimize_nir previously because we that was
called in finalize_nir and thus could be called more than once. This is
not the case anymore. Also drop the stale nine optimization.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
This commit is contained in:
Pavel Ondračka 2026-05-07 10:16:20 +02:00 committed by Marge Bot
parent 267b6e4bef
commit ebf2ab9d59
2 changed files with 11 additions and 20 deletions

View file

@ -1866,26 +1866,6 @@ nir_to_rc(struct nir_shader *s, struct pipe_screen *screen,
ntr_fixup_varying_slots(s, s->info.stage == MESA_SHADER_FRAGMENT ? nir_var_shader_in : nir_var_shader_out);
if (s->info.stage == MESA_SHADER_FRAGMENT) {
if (is_r500) {
NIR_PASS(_, s, r300_transform_fs_trig_input);
}
} else if (r300_screen(screen)->caps.has_tcl) {
if (is_r500) {
/* Only nine should set both NTT shader name and
* use_legacy_math_rules and D3D9 already mandates
* the proper range for the trigonometric inputs.
*/
if (!s->info.use_legacy_math_rules || !(s->info.name && !strcmp("TTN", s->info.name))) {
NIR_PASS(_, s, r300_transform_vs_trig_input);
}
} else {
if (r300_screen(screen)->caps.is_r400) {
NIR_PASS(_, s, r300_transform_vs_trig_input);
}
}
}
/* Lower array indexing on FS inputs. Since we don't set
* ureg->supports_any_inout_decl_range, the TGSI input decls will be split to
* elements by ureg, and so dynamically indexing them would be invalid.

View file

@ -265,6 +265,17 @@ r300_optimize_nir(struct nir_shader *s, struct r300_screen *screen)
NIR_PASS(_, s, nir_lower_var_copies);
NIR_PASS(_, s, nir_remove_dead_variables, nir_var_function_temp, NULL);
/* FIXME: this could be probably moved earlier... */
if (s->info.stage == MESA_SHADER_FRAGMENT) {
if (is_r500) {
NIR_PASS(_, s, r300_transform_fs_trig_input);
}
} else if (screen->caps.has_tcl) {
if (is_r500 || screen->caps.is_r400) {
NIR_PASS(_, s, r300_transform_vs_trig_input);
}
}
}
char *