diff options
author | Eric Anholt <[email protected]> | 2017-05-01 16:42:03 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2017-05-08 12:15:49 -0700 |
commit | 79da0ed2fcb8c88253fe2c9036f17e29c1f319dc (patch) | |
tree | fce97bfd981a1a7374df4eca96afb22b4fca4f3d /src/compiler | |
parent | e5ade7db73ce209f4f23f8c9d1272575fe990b14 (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 <[email protected]> (v1)
Tested-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 10 |
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 33490c831cb..b03476c5763 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); } } } |