summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2017-10-24 10:21:13 +0200
committerIago Toral Quiroga <itoral@igalia.com>2017-10-26 08:40:14 +0200
commitb9446172249f05f577072f09ea17a391f3ee5d90 (patch)
tree2569e2087948e7f2484860c2b1d8af853d3c39b3
parent16cfbef44cf0b196992bd06cb3521e70d1903033 (diff)
glsl/linker: report linker errors for invalid explicit locations on inputs
We were assuming that if an input has an invalid explicit location it would fail to link because it would not find the corresponding output, however, since we look for the matching output by indexing the explicit_locations array with the input location, we still need to ensure that we don't index out of bounds. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r--src/compiler/glsl/link_varyings.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 69c92bf53b..cb9091d86b 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -556,6 +556,13 @@ cross_validate_outputs_to_inputs(struct gl_context *ctx,
unsigned slot_limit = idx + num_elements;
while (idx < slot_limit) {
+ if (idx >= MAX_VARYING) {
+ linker_error(prog,
+ "Invalid location %u in %s shader\n", idx,
+ _mesa_shader_stage_to_string(consumer->Stage));
+ return;
+ }
+
output = explicit_locations[idx][input->data.location_frac];
if (output == NULL ||