summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-05-01 16:42:03 -0700
committerEric Anholt <eric@anholt.net>2017-05-08 12:15:49 -0700
commit79da0ed2fcb8c88253fe2c9036f17e29c1f319dc (patch)
treefce97bfd981a1a7374df4eca96afb22b4fca4f3d
parente5ade7db73ce209f4f23f8c9d1272575fe990b14 (diff)
glsl: Restrict func redeclarations (not just redefinitions) on GLSL 1.00.
Fixes DEQP's scoping.invalid.redeclare_function_fragment/vertex. v2: Fix accidental rejection of prototype+decl. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v1) Tested-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 33490c831c..b03476c576 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -5933,6 +5933,16 @@ ast_function::hir(exec_list *instructions,
*/
return NULL;
}
+ } else if (state->language_version == 100 && !is_definition) {
+ /* From the GLSL 1.00 spec, section 4.2.7:
+ *
+ * "A particular variable, structure or function declaration
+ * may occur at most once within a scope with the exception
+ * that a single function prototype plus the corresponding
+ * function definition are allowed."
+ */
+ YYLTYPE loc = this->get_location();
+ _mesa_glsl_error(&loc, state, "function `%s' redeclared", name);
}
}
}