aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2014-11-25 12:23:10 +0100
committerIago Toral Quiroga <[email protected]>2014-12-09 11:40:00 +0100
commit426a50e2089b12d33f5c075aa5622f64076914a3 (patch)
tree85689833a1d60f62f477f4ddf16c464455dfe9e4 /src/glsl/glsl_parser.yy
parente1ed4f2532b4e9bafb5663cccbe28033c49b2e77 (diff)
glsl: invariant qualifier is not valid for shader inputs in GLSL ES 3.00
GLSL ES 3.00 spec, chapter 4.6.1 "The Invariant Qualifier", Only variables output from a shader can be candidates for invariance. This includes user-defined output variables and the built-in output variables. As only outputs can be declared as invariant, an invariant output from one shader stage will still match an input of a subsequent stage without the input being declared as invariant. This patch fixes the following dEQP tests: dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_interp_storage_precision dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_interp_storage dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_storage_precision dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_storage dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_interp_storage_precision_invariant_input dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_interp_storage_invariant_input dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_storage_precision_invariant_input dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_storage_invariant_input No piglit regressions observed. v2: - Add spec content in the code Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser.yy')
-rw-r--r--src/glsl/glsl_parser.yy11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 6a55a4e6bf6..7fb8c38abe3 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1602,6 +1602,17 @@ type_qualifier:
$$ = $2;
$$.flags.q.invariant = 1;
+
+ /* GLSL ES 3.00 spec, section 4.6.1 "The Invariant Qualifier":
+ *
+ * "Only variables output from a shader can be candidates for invariance.
+ * This includes user-defined output variables and the built-in output
+ * variables. As only outputs can be declared as invariant, an invariant
+ * output from one shader stage will still match an input of a subsequent
+ * stage without the input being declared as invariant."
+ */
+ if (state->es_shader && state->language_version >= 300 && $$.flags.q.in)
+ _mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with shader inputs");
}
| interpolation_qualifier type_qualifier
{