From 07ba04a35add2662910369b16eac1280f22e6969 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 1 Oct 2020 20:23:28 +1000 Subject: glsl: don't duplicate state vars as uniforms in the NIR linker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Marek Olšák Part-of: (cherry picked from commit 038fcbcaed31b97f8f477f2496f8cf0a809b1892) --- src/compiler/glsl/gl_nir_link_uniforms.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index c8d32bdf338..00005c20126 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -530,6 +530,12 @@ add_parameter(struct gl_uniform_storage *uniform, const struct glsl_type *type, struct nir_link_uniforms_state *state) { + /* Builtin uniforms are backed by PROGRAM_STATE_VAR, so don't add them as + * uniforms. + */ + if (uniform->builtin) + return; + if (!state->params || uniform->is_shader_storage || (glsl_contains_opaque(type) && !state->current_var->data.bindless)) return; -- cgit v1.2.3