mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 07:50:11 +01:00
r300: optimize out more modifiers produced later
The code handling NIR to TGSI translation can't handle multiple chained modifiers. Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com> Reviewed-by: Filip Gawin <filip.gawin@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27089>
This commit is contained in:
parent
bdf42690f6
commit
99abd9ad30
3 changed files with 10 additions and 9 deletions
|
|
@ -2466,7 +2466,7 @@ const void *nir_to_rc_options(struct nir_shader *s,
|
|||
NIR_PASS_V(s, r300_nir_lower_fcsel_r300);
|
||||
NIR_PASS_V(s, r300_nir_lower_flrp);
|
||||
}
|
||||
NIR_PASS_V(s, r300_nir_clean_double_fneg);
|
||||
NIR_PASS_V(s, r300_nir_opt_algebraic_late);
|
||||
NIR_PASS_V(s, nir_opt_dce);
|
||||
|
||||
nir_move_options move_all =
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ extern bool r300_nir_lower_bool_to_float(struct nir_shader *shader);
|
|||
|
||||
extern bool r300_nir_prepare_presubtract(struct nir_shader *shader);
|
||||
|
||||
extern bool r300_nir_clean_double_fneg(struct nir_shader *shader);
|
||||
extern bool r300_nir_opt_algebraic_late(struct nir_shader *shader);
|
||||
|
||||
extern bool r300_nir_post_integer_lowering(struct nir_shader *shader);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,11 +87,12 @@ for multiplier in [2.0, 4.0, 8.0, 16.0, 0.5, 0.25, 0.125, 0.0625]:
|
|||
(('fmul', a, ('fmul(is_used_once)', 'b(is_ubo_or_input)', multiplier)), ('fmul', multiplier, ('fmul', a, b))),
|
||||
])
|
||||
|
||||
# Previous prepare_presubtract pass can sometimes produce double fneg patterns.
|
||||
# The backend copy propagate could handle it, but the nir to tgsi translation
|
||||
# does not and blows up. Just run a simple pass to clean it up.
|
||||
r300_nir_clean_double_fneg = [
|
||||
(('fneg', ('fneg', a)), a)
|
||||
r300_nir_opt_algebraic_late = [
|
||||
# Previous prepare_presubtract pass can sometimes produce double fneg patterns.
|
||||
# The backend copy propagate could handle it, but the nir to tgsi translation
|
||||
# does not and blows up. Clean this up.
|
||||
(('fneg', ('fneg', a)), a),
|
||||
(('fabs', ('fneg', a)), ('fabs', a)),
|
||||
]
|
||||
|
||||
# This is very late flrp lowering to clean up after bcsel->fcsel->flrp.
|
||||
|
|
@ -167,8 +168,8 @@ def main():
|
|||
f.write(nir_algebraic.AlgebraicPass("r300_nir_prepare_presubtract",
|
||||
r300_nir_prepare_presubtract).render())
|
||||
|
||||
f.write(nir_algebraic.AlgebraicPass("r300_nir_clean_double_fneg",
|
||||
r300_nir_clean_double_fneg).render())
|
||||
f.write(nir_algebraic.AlgebraicPass("r300_nir_opt_algebraic_late",
|
||||
r300_nir_opt_algebraic_late).render())
|
||||
|
||||
f.write(nir_algebraic.AlgebraicPass("r300_nir_post_integer_lowering",
|
||||
r300_nir_post_integer_lowering).render())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue