nir/alu_to_scalar: Use ssa_for_alu_src in hand-rolled expansions
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 3 Oct 2018 17:14:20 +0000 (12:14 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 4 Oct 2018 17:43:59 +0000 (12:43 -0500)
commitdd553bc67f8ab1513fd196b6ffb7c4a76723adfd
tree1e6675709cfe879b3c9ae26d465e5da71e1aa7d8
parent5f0567a4f60c6671d4e2a942ab3f3248dbbd6997
nir/alu_to_scalar: Use ssa_for_alu_src in hand-rolled expansions

The ssa_for_alu_src helper will correctly handle swizzles and other
source modifiers for you.  The expansions for unpack_half_2x16,
pack_uvec2_to_uint, and pack_uvec4_to_uint were all broken with regards
to swizzles.  The brokenness of unpack_half_2x16 was causing rendering
errors in Rise of the Tomb Raider on Intel ever since c11833ab24dcba26
which added an extra copy propagation to the optimization pipeline and
caused us to start seeing swizzles where we hadn't seen any before.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107926
Fixes: 9ce901058f3d "nir: Add lowering of nir_op_unpack_half_2x16."
Fixes: 9b8786eba955 "nir: Add lowering support for packing opcodes."
Tested-by: Alex Smith <asmith@feralinteractive.com>
Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/compiler/nir/nir_lower_alu_to_scalar.c