GLSL: Allow desktop shaders to call functions from outside main().

Fixes issue #239.
This commit is contained in:
John Kessenich 2016-12-05 21:36:48 -07:00
parent ec2e27adf8
commit 9df6aa5361
3 changed files with 7 additions and 7 deletions

View file

@ -1109,9 +1109,10 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
// if builtIn == true, it's definitely a built-in function with EOpNull
if (! builtIn) {
call->setUserDefined();
if (symbolTable.atGlobalLevel())
error(loc, "can't call user function from global scope", fnCandidate->getName().c_str(), "");
else
if (symbolTable.atGlobalLevel()) {
requireProfile(loc, ~EEsProfile, "calling user function from global scope");
intermediate.addToCallGraph(infoSink, "main(", fnCandidate->getMangledName());
} else
intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName());
}