nir: Add a large constants optimization pass
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 29 Jun 2018 02:16:58 +0000 (19:16 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 2 Jul 2018 19:09:45 +0000 (12:09 -0700)
commit1235850522cd5e7b07701f7065996430ca1514b6
treea9a412e5dd7bf31ef9f8a1df6ae423a05fbd2b3a
parentc90f221e0a1f89332189dd5ec79dccf6b251ecf5
nir: Add a large constants optimization pass

This pass searches for reasonably large local variables which can be
statically proven to be constant and moves them into shader constant
data.  This is especially useful when large tables are baked into the
shader source code because they can be moved into a UBO by the driver to
reduce register pressure and make indirect access cheaper.

v2 (Jason Ekstrand):
 - Use a size/align function to ensure we get the right alignments
 - Use the newly added deref offset helpers

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/Makefile.sources
src/compiler/nir/meson.build
src/compiler/nir/nir.h
src/compiler/nir/nir_opt_large_constants.c [new file with mode: 0644]