summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-08-21 10:04:56 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-09-10 14:36:46 -0700
commit4f33f96c4517f86f6f720f745cd49f8a0754393b (patch)
tree23b0194c0191e0fb7d4ce71878b71b9af73afe86 /src
parent304719993120c463e14de40cbe0297e645142881 (diff)
glsl/nir: Avoid overflow when setting max_uniform_location
Don't use the UNMAPPED_UNIFORM_LOC (-1) to set the unsigned max_uniform_location. Those unmapped uniforms don't have to be accounted at this point. Fixes: 7a9e5cdfbb9 ("nir/linker: Add gl_nir_link_uniforms()") Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/gl_nir_link_uniforms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c
index ac97334e9cd..6323d2940db 100644
--- a/src/compiler/glsl/gl_nir_link_uniforms.c
+++ b/src/compiler/glsl/gl_nir_link_uniforms.c
@@ -603,7 +603,8 @@ nir_link_uniform(struct gl_context *ctx,
state->num_shader_uniform_components += values;
state->num_values += values;
- if (state->max_uniform_location < uniform->remap_location + entries)
+ if (uniform->remap_location != UNMAPPED_UNIFORM_LOC &&
+ state->max_uniform_location < uniform->remap_location + entries)
state->max_uniform_location = uniform->remap_location + entries;
return MAX2(uniform->array_elements, 1);