Skip to content
Snippets Groups Projects
Commit 7882268c authored by Caio Oliveira's avatar Caio Oliveira Committed by Dylan Baker
Browse files

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: 7a9e5cdf ("nir/linker: Add gl_nir_link_uniforms()")
Reviewed-by: default avatarAlejandro Piñeiro <apinheiro@igalia.com>
(cherry picked from commit 4f33f96c)
parent 4eabbc04
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment