nir: Flatten ifs with discards in nir_opt_peephole_select for HW without CF.
authorEmma Anholt <emma@anholt.net>
Tue, 3 Oct 2023 17:04:04 +0000 (10:04 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 18 Oct 2023 01:27:04 +0000 (01:27 +0000)
commitc5712410ec3d65ae6cd759661883868912a903dd
treec2f255a5a955bae27b34658632e96b9148657af2
parent2c4d5c6aecd05197d081771155859bd0e3109abe
nir: Flatten ifs with discards in nir_opt_peephole_select for HW without CF.

i915g and r300-r400 don't have if statements, and discards are all
nir_intrinsic_discard_if.  We can flatten those discards here, saving a
separate GLSL pass to try to do so.

i915g:
GAINED: shaders/closed/xcom-enemy-unknown/413.shader_test FS

rv370:
GAINED: shaders/closed/xcom-enemy-unknown/12.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/122.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/132.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/145.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/146.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/19.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/413.shader_test FS
GAINED: shaders/closed/xcom-enemy-unknown/415.shader_test FS

Closes: #9918
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24763>
src/compiler/nir/nir_opt_peephole_select.c