Keep track of shader built-in declarations separately per ESSL version
The patch decouples the list of unmangled built-ins' names into levels
based on the ESSL version they are from. This is required
because ESSL31 and above built-ins' names should not conflict with
user-declared functions in ESSL3 shaders.
BUG=angleproject:1666
TEST=angle_unittest
Change-Id: I731918a058629c7b6d9d15eb7eac19ce47280315
Reviewed-on: https://chromium-review.googlesource.com/420324
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 64302e4..d9618df 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2548,9 +2548,11 @@
TFunction *prevDec =
static_cast<TFunction *>(symbolTable.find(function->getMangledName(), getShaderVersion()));
- if (getShaderVersion() >= 300 && symbolTable.hasUnmangledBuiltIn(function->getName().c_str()))
+ if (getShaderVersion() >= 300 &&
+ symbolTable.hasUnmangledBuiltInForShaderVersion(function->getName().c_str(),
+ getShaderVersion()))
{
- // With ESSL 3.00, names of built-in functions cannot be redeclared as functions.
+ // With ESSL 3.00 and above, names of built-in functions cannot be redeclared as functions.
// Therefore overloading or redefining builtin functions is an error.
error(location, "Name of a built-in function cannot be redeclared as function",
function->getName().c_str());