summaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2014-11-04 14:20:15 +0200
committerTapani Pälli <[email protected]>2014-12-03 08:56:19 +0200
commit636db35c35d4420a308629cead3287c57458644d (patch)
treef0fbc308532f53ed702db3578d50161917558153 /src/glsl/glsl_parser.yy
parentc914247dcb7c44c25efc335413da2d9d83fe550f (diff)
glsl: throw error when using invariant(all) in a fragment shader
Note that some of the GLSL specifications explicitly state this as compile error, some simply state that 'it is an error'. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser.yy')
-rw-r--r--src/glsl/glsl_parser.yy13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 6160e265e79..6a55a4e6bf6 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -331,7 +331,18 @@ pragma_statement:
| PRAGMA_OPTIMIZE_OFF EOL
| PRAGMA_INVARIANT_ALL EOL
{
- if (!state->is_version(120, 100)) {
+ /* Pragma invariant(all) cannot be used in a fragment shader.
+ *
+ * Page 27 of the GLSL 1.20 spec, Page 53 of the GLSL ES 3.00 spec:
+ *
+ * "It is an error to use this pragma in a fragment shader."
+ */
+ if (state->is_version(120, 300) &&
+ state->stage == MESA_SHADER_FRAGMENT) {
+ _mesa_glsl_error(& @1, state,
+ "pragma `invariant(all)' cannot be used "
+ "in a fragment shader.");
+ } else if (!state->is_version(120, 100)) {
_mesa_glsl_warning(& @1, state,
"pragma `invariant(all)' not supported in %s "
"(GLSL ES 1.00 or GLSL 1.20 required)",