1 |
tmb |
1379153 |
From 068e9a8f45f2d08f819c715d98be0cf2073aa635 Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Andres Gomez <agomez@igalia.com> |
3 |
|
|
Date: Fri, 28 Dec 2018 00:57:29 +0200 |
4 |
tmb |
1379265 |
Subject: [PATCH 20/24] glsl/linker: don't fail non static used inputs without |
5 |
tmb |
1379153 |
matching outputs |
6 |
|
|
MIME-Version: 1.0 |
7 |
|
|
Content-Type: text/plain; charset=UTF-8 |
8 |
|
|
Content-Transfer-Encoding: 8bit |
9 |
|
|
|
10 |
|
|
If there is no Static Use of an input variable, the linker shouldn't |
11 |
|
|
fail whenever there is no defined matching output variable in the |
12 |
|
|
previous stage. |
13 |
|
|
|
14 |
|
|
From page 47 (page 51 of the PDF) of the GLSL 4.60 v.5 spec: |
15 |
|
|
|
16 |
|
|
" Only the input variables that are statically read need to be |
17 |
|
|
written by the previous stage; it is allowed to have superfluous |
18 |
|
|
declarations of input variables." |
19 |
|
|
|
20 |
|
|
Now, we complete this exception whenever the input variable has an |
21 |
|
|
explicit location. Previously, 18004c338f6 ("glsl: fail when a |
22 |
|
|
shader's input var has not an equivalent out var in previous") took |
23 |
|
|
care of the cases in which the input variable didn't have an explicit |
24 |
|
|
location. |
25 |
|
|
|
26 |
|
|
v2: do the location based interface matching check regardless on |
27 |
|
|
whether it is a separable program or not (Ilia). |
28 |
|
|
|
29 |
|
|
Fixes: 1aa5738e666 ("glsl: relax input->output validation for SSO programs") |
30 |
|
|
Cc: Timothy Arceri <tarceri@itsqueeze.com> |
31 |
|
|
Cc: Iago Toral Quiroga <itoral@igalia.com> |
32 |
|
|
Cc: Samuel Iglesias Gonsálvez <siglesias@igalia.com> |
33 |
|
|
Cc: Tapani Pälli <tapani.palli@intel.com> |
34 |
|
|
Cc: Ian Romanick <ian.d.romanick@intel.com> |
35 |
|
|
Cc: Ilia Mirkin <imirkin@alum.mit.edu> |
36 |
|
|
Signed-off-by: Andres Gomez <agomez@igalia.com> |
37 |
|
|
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> |
38 |
|
|
(cherry picked from commit 3be05dd2679b2525ff80bac715d6ea097295c9ea) |
39 |
|
|
--- |
40 |
|
|
src/compiler/glsl/link_varyings.cpp | 16 ++++++++++++++-- |
41 |
|
|
1 file changed, 14 insertions(+), 2 deletions(-) |
42 |
|
|
|
43 |
|
|
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp |
44 |
|
|
index 93b3b82b93a..8aa5ba098c8 100644 |
45 |
|
|
--- a/src/compiler/glsl/link_varyings.cpp |
46 |
|
|
+++ b/src/compiler/glsl/link_varyings.cpp |
47 |
|
|
@@ -773,8 +773,20 @@ cross_validate_outputs_to_inputs(struct gl_context *ctx, |
48 |
|
|
|
49 |
|
|
output = explicit_locations[idx][input->data.location_frac].var; |
50 |
|
|
|
51 |
|
|
- if (output == NULL || |
52 |
|
|
- input->data.location != output->data.location) { |
53 |
|
|
+ if (output == NULL) { |
54 |
|
|
+ /* A linker failure should only happen when there is no |
55 |
|
|
+ * output declaration and there is Static Use of the |
56 |
|
|
+ * declared input. |
57 |
|
|
+ */ |
58 |
|
|
+ if (input->data.used) { |
59 |
|
|
+ linker_error(prog, |
60 |
|
|
+ "%s shader input `%s' with explicit location " |
61 |
|
|
+ "has no matching output\n", |
62 |
|
|
+ _mesa_shader_stage_to_string(consumer->Stage), |
63 |
|
|
+ input->name); |
64 |
|
|
+ break; |
65 |
|
|
+ } |
66 |
|
|
+ } else if (input->data.location != output->data.location) { |
67 |
|
|
linker_error(prog, |
68 |
|
|
"%s shader input `%s' with explicit location " |
69 |
|
|
"has no matching output\n", |
70 |
|
|
-- |
71 |
|
|
2.21.0 |
72 |
|
|
|