Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
820a22fc
Commit
820a22fc
authored
Oct 06, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give error for calling a user-defined function at global scope.
parent
894c1c10
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
110scope.vert
Test/110scope.vert
+1
-1
110scope.vert.out
Test/baseResults/110scope.vert.out
+24
-1
revision.h
glslang/Include/revision.h
+2
-2
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+4
-1
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+1
-1
No files found.
Test/110scope.vert
View file @
820a22fc
...
...
@@ -31,7 +31,7 @@ bool radians(bool x) // okay, can overload built-in functions
return
true
;
}
int
gi
=
f
(
1
,
2
,
3
);
// ERROR, can't call user-defined function from global scope
void
main
()
{
...
...
Test/baseResults/110scope.vert.out
View file @
820a22fc
110scope.vert
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' : redefinition
ERROR:
3
compilation errors. No code generated.
ERROR:
4
compilation errors. No code generated.
Shader version: 110
...
...
@@ -38,6 +39,16 @@ ERROR: node is still EOpNull!
0:31 Branch: Return with expression
0:31 Constant:
0:31 true (const bool)
0:34 Sequence
0:34 move second child to first child (temp int)
0:34 'gi' (global int)
0:34 Function Call: f(i1;i1;i1; (global int)
0:34 Constant:
0:34 1 (const int)
0:34 Constant:
0:34 2 (const int)
0:34 Constant:
0:34 3 (const int)
0:36 Function Definition: main( (global void)
0:36 Function Parameters:
0:? Sequence
...
...
@@ -115,6 +126,7 @@ ERROR: node is still EOpNull!
0:? 'c' (global bool)
0:? 'f' (global float)
0:? 'tan' (global float)
0:? 'gi' (global int)
Linked vertex stage:
...
...
@@ -153,6 +165,16 @@ ERROR: node is still EOpNull!
0:31 Branch: Return with expression
0:31 Constant:
0:31 true (const bool)
0:34 Sequence
0:34 move second child to first child (temp int)
0:34 'gi' (global int)
0:34 Function Call: f(i1;i1;i1; (global int)
0:34 Constant:
0:34 1 (const int)
0:34 Constant:
0:34 2 (const int)
0:34 Constant:
0:34 3 (const int)
0:36 Function Definition: main( (global void)
0:36 Function Parameters:
0:? Sequence
...
...
@@ -230,4 +252,5 @@ ERROR: node is still EOpNull!
0:? 'c' (global bool)
0:? 'f' (global float)
0:? 'tan' (global float)
0:? 'gi' (global int)
glslang/Include/revision.h
View file @
820a22fc
...
...
@@ -2,5 +2,5 @@
// 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).
#define GLSLANG_REVISION "3.0.7
79
"
#define GLSLANG_DATE "0
5
-Oct-2015"
#define GLSLANG_REVISION "3.0.7
80
"
#define GLSLANG_DATE "0
6
-Oct-2015"
glslang/MachineIndependent/ParseHelper.cpp
View file @
820a22fc
...
...
@@ -1124,7 +1124,10 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
// if builtIn == true, it's definitely a built-in function with EOpNull
if
(
!
builtIn
)
{
call
->
setUserDefined
();
intermediate
.
addToCallGraph
(
infoSink
,
currentCaller
,
fnCandidate
->
getMangledName
());
if
(
symbolTable
.
atGlobalLevel
())
error
(
loc
,
"can't call user function from global scope"
,
fnCandidate
->
getName
().
c_str
(),
""
);
else
intermediate
.
addToCallGraph
(
infoSink
,
currentCaller
,
fnCandidate
->
getMangledName
());
}
if
(
builtIn
)
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
820a22fc
...
...
@@ -323,7 +323,7 @@ protected:
TQualifier
globalInputDefaults
;
TQualifier
globalOutputDefaults
;
int
*
atomicUintOffsets
;
// to become an array of the right size to hold an offset per binding point
TString
currentCaller
;
TString
currentCaller
;
// name of last function body entered (not valid when at global scope)
TIdSetType
inductiveLoopIds
;
bool
anyIndexLimits
;
TVector
<
TIntermTyped
*>
needsIndexLimitationChecking
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment