glsl: don't duplicate state vars as uniforms in the NIR linker
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 1 Oct 2020 10:23:28 +0000 (20:23 +1000)
committerMarge Bot <eric+marge@anholt.net>
Fri, 2 Oct 2020 00:57:00 +0000 (00:57 +0000)
commit038fcbcaed31b97f8f477f2496f8cf0a809b1892
tree4d4a6058ac55c0d4bfd0745aa7bac475340c477f
parent535fd6d45e658cea148f142c82f64a04838fb5ce
glsl: don't duplicate state vars as uniforms in the NIR linker

The linker was adding all state vars as uniforms, doubling the storage size
for shaders using only builtin uniforms, which increased CPU overhead for
constant buffer uploads.

When this code was originally ported from the GLSL IR linker we forgot
to exclude builtins because the check was not done in the
add_uniform_to_shader class but rather a check was done when passing
variables to this class for processing.

Fixes: 664e4a610dc8 ("glsl/nir: Fill in the Parameters in NIR linker")

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Tested-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6958>
src/compiler/glsl/gl_nir_link_uniforms.c