mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
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:664e4a610d("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> (cherry picked from commit038fcbcaed)
This commit is contained in:
parent
55eed08808
commit
07ba04a35a
2 changed files with 7 additions and 1 deletions
|
|
@ -9202,7 +9202,7 @@
|
|||
"description": "glsl: don't duplicate state vars as uniforms in the NIR linker",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "664e4a610dc8c0f2adc50de645a07cf4e2b622fd"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue