summaryrefslogtreecommitdiff
path: root/src/compiler/ParseHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/ParseHelper.cpp')
-rw-r--r--src/compiler/ParseHelper.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/compiler/ParseHelper.cpp b/src/compiler/ParseHelper.cpp
index b84a1755..a4787a1c 100644
--- a/src/compiler/ParseHelper.cpp
+++ b/src/compiler/ParseHelper.cpp
@@ -892,6 +892,19 @@ bool TParseContext::supportsExtension(const char* extension)
return (iter != extbehavior.end());
}
+bool TParseContext::isExtensionEnabled(const char* extension) const
+{
+ const TExtensionBehavior& extbehavior = extensionBehavior();
+ TExtensionBehavior::const_iterator iter = extbehavior.find(extension);
+
+ if (iter == extbehavior.end())
+ {
+ return false;
+ }
+
+ return (iter->second == EBhEnable || iter->second == EBhRequire);
+}
+
/////////////////////////////////////////////////////////////////////////////////
//
// Non-Errors.
@@ -907,8 +920,9 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction*
{
// First find by unmangled name to check whether the function name has been
// hidden by a variable name or struct typename.
+ // If a function is found, check for one with a matching argument list.
const TSymbol* symbol = symbolTable.find(call->getName(), builtIn);
- if (symbol == 0) {
+ if (symbol == 0 || symbol->isFunction()) {
symbol = symbolTable.find(call->getMangledName(), builtIn);
}
@@ -925,27 +939,6 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction*
return static_cast<const TFunction*>(symbol);
}
-bool TParseContext::isVariableBuiltIn(const TVariable* var)
-{
- bool builtIn = false;
- // First find by unmangled name to check whether the function name has been
- // hidden by a variable name or struct typename.
- const TSymbol* symbol = symbolTable.find(var->getName(), &builtIn);
- if (symbol == 0) {
- symbol = symbolTable.find(var->getMangledName(), &builtIn);
- }
-
- if (symbol == 0) {
- return false;
- }
-
- if (!symbol->isVariable()) {
- return false;
- }
-
- return builtIn;
-}
-
//
// Initializers show up in several places in the grammar. Have one set of
// code to handle them here.
@@ -1513,6 +1506,12 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
recover();
index = baseExpression->getType().getArraySize() - 1;
}
+ else if (baseExpression->getQualifier() == EvqFragData && index > 0 && !isExtensionEnabled("GL_EXT_draw_buffers"))
+ {
+ error(location, "", "[", "array indexes for gl_FragData must be zero when GL_EXT_draw_buffers is disabled");
+ recover();
+ index = 0;
+ }
}
else if ((baseExpression->isVector() || baseExpression->isMatrix()) && baseExpression->getType().getNominalSize() <= index)
{