Commit 9df6aa53 by John Kessenich

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

Fixes issue #239.
parent ec2e27ad
110scope.vert 110scope.vert
ERROR: 0:5: 'a' : redefinition ERROR: 0:5: 'a' : redefinition
ERROR: 0:34: 'f' : can't call user function from global scope
ERROR: 0:57: 'z' : undeclared identifier ERROR: 0:57: 'z' : undeclared identifier
ERROR: 0:57: 'z' : redefinition ERROR: 0:57: 'z' : redefinition
ERROR: 4 compilation errors. No code generated. ERROR: 3 compilation errors. No code generated.
Shader version: 110 Shader version: 110
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1674" #define GLSLANG_REVISION "Overload400-PrecQual.1676"
#define GLSLANG_DATE "03-Dec-2016" #define GLSLANG_DATE "05-Dec-2016"
...@@ -1109,9 +1109,10 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction ...@@ -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 == true, it's definitely a built-in function with EOpNull
if (! builtIn) { if (! builtIn) {
call->setUserDefined(); call->setUserDefined();
if (symbolTable.atGlobalLevel()) if (symbolTable.atGlobalLevel()) {
error(loc, "can't call user function from global scope", fnCandidate->getName().c_str(), ""); requireProfile(loc, ~EEsProfile, "calling user function from global scope");
else intermediate.addToCallGraph(infoSink, "main(", fnCandidate->getMangledName());
} else
intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName()); intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment