mesa: sort state vars with constant indexing for ARB programs
authorMarek Olšák <marek.olsak@amd.com>
Sat, 12 Dec 2020 03:17:35 +0000 (22:17 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 Jan 2021 21:59:29 +0000 (21:59 +0000)
commit0f7877d96a9b6bd5f3f211324f2ee169a3b73e40
treec6f2e11b3baae3e17c5b01532d42f57aaaf35e85
parentf485331c5b6fb5ab3493ef7c2c7ae787d56f7cb9
mesa: sort state vars with constant indexing for ARB programs

This enables merging of state variables such as local parameters
for faster constant uploads. For Trine 2, this mainly sorts local
parameters which are in a random order.

Originally, the next pass added state variables (the code after this code).
If we add them before that, _mesa_add_state_reference will be a no-op
later and will return the ones we added.

So add all state parameters (without indirect indexing). After they are
added, sort them within the parameter list. Then fix their offsets to
correspond to their location after sorting.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183>
src/mesa/program/prog_parameter_layout.c