summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 5be8d9fc48f..6657777d74c 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -3146,6 +3146,7 @@ check_explicit_uniform_locations(struct gl_context *ctx,
return;
}
+ unsigned entries_total = 0;
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
struct gl_shader *sh = prog->_LinkedShaders[i];
@@ -3157,6 +3158,8 @@ check_explicit_uniform_locations(struct gl_context *ctx,
if (!var || var->data.mode != ir_var_uniform)
continue;
+ entries_total += var->type->uniform_locations();
+
if (var->data.explicit_location) {
bool ret;
if (var->type->without_array()->is_subroutine())
@@ -3170,6 +3173,15 @@ check_explicit_uniform_locations(struct gl_context *ctx,
}
}
}
+
+ /* Verify that total amount of entries for explicit and implicit locations
+ * is less than MAX_UNIFORM_LOCATIONS.
+ */
+ if (entries_total >= ctx->Const.MaxUserAssignableUniformLocations) {
+ linker_error(prog, "count of uniform locations >= MAX_UNIFORM_LOCATIONS"
+ "(%u >= %u)", entries_total,
+ ctx->Const.MaxUserAssignableUniformLocations);
+ }
delete uniform_map;
}
@@ -4544,12 +4556,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
update_array_sizes(prog);
- link_assign_uniform_locations(prog, ctx->Const.UniformBooleanTrue,
- ctx->Const.MaxUserAssignableUniformLocations);
-
- if (!prog->LinkStatus)
- goto done;
-
+ link_assign_uniform_locations(prog, ctx->Const.UniformBooleanTrue);
link_assign_atomic_counter_resources(ctx, prog);
store_fragdepth_layout(prog);