summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-09-20 21:56:26 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-09-21 11:04:21 +0200
commitdf8767a14e3eae4dcb8241b731b34e9379706795 (patch)
tree057254bb9c6151080b566e3fd66118b41601f181 /src/compiler
parenteb71394ff38d05a42cb8d04fedb6539cc7bbe6fa (diff)
glsl/linker: properly fix output variable overlap check
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102904 Fixes: 15cae12804e ("glsl/linker: fix output variable overlap check") Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/linker.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 422b8ecd13e..f352c5385ca 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2884,12 +2884,6 @@ assign_attribute_or_color_locations(void *mem_ctx,
}
}
}
-
- /* At most one variable per fragment output component should
- * reach this. */
- assert(assigned_attr < ARRAY_SIZE(assigned));
- assigned[assigned_attr] = var;
- assigned_attr++;
} else if (target_index == MESA_SHADER_FRAGMENT ||
(prog->IsES && prog->data->Version >= 300)) {
linker_error(prog, "overlapping location is assigned "
@@ -2903,6 +2897,18 @@ assign_attribute_or_color_locations(void *mem_ctx,
}
}
+ if (target_index == MESA_SHADER_FRAGMENT && !prog->IsES) {
+ /* Only track assigned variables for non-ES fragment shaders
+ * to avoid overflowing the array.
+ *
+ * At most one variable per fragment output component should
+ * reach this.
+ */
+ assert(assigned_attr < ARRAY_SIZE(assigned));
+ assigned[assigned_attr] = var;
+ assigned_attr++;
+ }
+
used_locations |= (use_mask << attr);
/* From the GL 4.5 core spec, section 11.1.1 (Vertex Attributes):