summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2018-12-28 00:57:29 +0200
committerDylan Baker <dylan@pnwbakers.com>2019-03-19 10:53:33 -0700
commit068e9a8f45f2d08f819c715d98be0cf2073aa635 (patch)
treefe7d84519c47380abcc92517d636333e0b302e7e /src
parent1b4712719e3ad3433576f84afacb36891aa1a88e (diff)
downloadmesa-068e9a8f45f2d08f819c715d98be0cf2073aa635.tar.gz
glsl/linker: don't fail non static used inputs without matching outputs
If there is no Static Use of an input variable, the linker shouldn't fail whenever there is no defined matching output variable in the previous stage. From page 47 (page 51 of the PDF) of the GLSL 4.60 v.5 spec: " Only the input variables that are statically read need to be written by the previous stage; it is allowed to have superfluous declarations of input variables." Now, we complete this exception whenever the input variable has an explicit location. Previously, 18004c338f6 ("glsl: fail when a shader's input var has not an equivalent out var in previous") took care of the cases in which the input variable didn't have an explicit location. v2: do the location based interface matching check regardless on whether it is a separable program or not (Ilia). Fixes: 1aa5738e666 ("glsl: relax input->output validation for SSO programs") Cc: Timothy Arceri <tarceri@itsqueeze.com> Cc: Iago Toral Quiroga <itoral@igalia.com> Cc: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Cc: Tapani Pälli <tapani.palli@intel.com> Cc: Ian Romanick <ian.d.romanick@intel.com> Cc: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (cherry picked from commit 3be05dd2679b2525ff80bac715d6ea097295c9ea)
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/link_varyings.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 93b3b82b93a..8aa5ba098c8 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -773,8 +773,20 @@ cross_validate_outputs_to_inputs(struct gl_context *ctx,
output = explicit_locations[idx][input->data.location_frac].var;
- if (output == NULL ||
- input->data.location != output->data.location) {
+ if (output == NULL) {
+ /* A linker failure should only happen when there is no
+ * output declaration and there is Static Use of the
+ * declared input.
+ */
+ if (input->data.used) {
+ linker_error(prog,
+ "%s shader input `%s' with explicit location "
+ "has no matching output\n",
+ _mesa_shader_stage_to_string(consumer->Stage),
+ input->name);
+ break;
+ }
+ } else if (input->data.location != output->data.location) {
linker_error(prog,
"%s shader input `%s' with explicit location "
"has no matching output\n",