nir/opt_large_constants: Handle store writemasks
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 24 Sep 2019 10:43:29 +0000 (12:43 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Tue, 24 Sep 2019 20:59:58 +0000 (20:59 +0000)
commit270fe55256c78ede507d75d4665d73936ea7db31
tree24b15b83b959441fa9099043d79555a25e6b83e2
parentda496d4e30b78a0a8e096453f3ffccffaf9c2f7e
nir/opt_large_constants: Handle store writemasks

This fixes some piglit tests on radeonsi NIR where a varying is
initialized to a constant array in the vertex shader. Varying packing
after nir_lower_io_to_temporaries creates writemasked stores which
persist after pulling the constant initialization down into the fragment
shader.

While we're here, rewrite handle_constant_store() to do the loop over
components outside the switch, so that we don't have to duplicate the
writemask checking for every bitsize.

Fixes: 1235850522c ("nir: Add a large constants optimization pass")
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/nir/nir_opt_large_constants.c