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
2c8265bb
Commit
2c8265bb
authored
Jun 11, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL: Fix #1358: Support "struct name", where name could be a user type
parent
1ea8f595
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
5 deletions
+56
-5
110scope.vert
Test/110scope.vert
+13
-0
110scope.vert.out
Test/baseResults/110scope.vert.out
+32
-1
Scan.cpp
glslang/MachineIndependent/Scan.cpp
+6
-3
ScanContext.h
glslang/MachineIndependent/ScanContext.h
+5
-1
No files found.
Test/110scope.vert
100644 → 100755
View file @
2c8265bb
...
...
@@ -71,4 +71,17 @@ void main()
int
degrees
;
degrees
(
3
.
2
);
{
S
s
;
s
.
x
=
3
;
struct
S
{
// okay, hides S
bool
b
;
};
S
t
;
t
.
b
=
true
;
struct
S
{
// ERROR, redefinition of struct S
float
f
;
};
}
}
Test/baseResults/110scope.vert.out
View file @
2c8265bb
...
...
@@ -2,7 +2,8 @@
ERROR: 0:5: 'a' : redefinition
ERROR: 0:57: 'z' : undeclared identifier
ERROR: 0:57: 'z' : redefinition
ERROR: 3 compilation errors. No code generated.
ERROR: 0:83: 'S' : redefinition struct
ERROR: 4 compilation errors. No code generated.
Shader version: 110
...
...
@@ -120,6 +121,21 @@ ERROR: node is still EOpNull!
0:69 0 (const int)
0:73 Constant:
0:73 183.346494
0:? Sequence
0:77 move second child to first child ( temp int)
0:77 x: direct index for structure ( temp int)
0:77 's' ( temp structure{ temp int x})
0:77 Constant:
0:77 0 (const int)
0:77 Constant:
0:77 3 (const int)
0:82 move second child to first child ( temp bool)
0:82 b: direct index for structure ( temp bool)
0:82 't' ( temp structure{ temp bool b})
0:82 Constant:
0:82 0 (const int)
0:82 Constant:
0:82 true (const bool)
0:? Linker Objects
0:? 'b' ( global bool)
0:? 'c' ( global bool)
...
...
@@ -236,6 +252,21 @@ ERROR: node is still EOpNull!
0:69 0 (const int)
0:73 Constant:
0:73 183.346494
0:? Sequence
0:77 move second child to first child ( temp int)
0:77 x: direct index for structure ( temp int)
0:77 's' ( temp structure{ temp int x})
0:77 Constant:
0:77 0 (const int)
0:77 Constant:
0:77 3 (const int)
0:82 move second child to first child ( temp bool)
0:82 b: direct index for structure ( temp bool)
0:82 't' ( temp structure{ temp bool b})
0:82 Constant:
0:82 0 (const int)
0:82 Constant:
0:82 true (const bool)
0:? Linker Objects
0:? 'b' ( global bool)
0:? 'c' ( global bool)
...
...
glslang/MachineIndependent/Scan.cpp
View file @
2c8265bb
...
...
@@ -778,7 +778,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
case
'?'
:
return
QUESTION
;
case
'['
:
return
LEFT_BRACKET
;
case
']'
:
return
RIGHT_BRACKET
;
case
'{'
:
return
LEFT_BRACE
;
case
'{'
:
afterStruct
=
false
;
return
LEFT_BRACE
;
case
'}'
:
return
RIGHT_BRACE
;
case
'\\'
:
parseContext
.
error
(
loc
,
"illegal use of escape character"
,
"
\\
"
,
""
);
...
...
@@ -861,7 +861,6 @@ int TScanContext::tokenizeIdentifier()
case
IN
:
case
OUT
:
case
INOUT
:
case
STRUCT
:
case
BREAK
:
case
CONTINUE
:
case
DO
:
...
...
@@ -874,6 +873,10 @@ int TScanContext::tokenizeIdentifier()
case
CASE
:
return
keyword
;
case
STRUCT
:
afterStruct
=
true
;
return
keyword
;
case
NONUNIFORM
:
if
(
parseContext
.
extensionTurnedOn
(
E_GL_EXT_nonuniform_qualifier
))
return
keyword
;
...
...
@@ -1537,7 +1540,7 @@ int TScanContext::identifierOrType()
return
IDENTIFIER
;
parserToken
->
sType
.
lex
.
symbol
=
parseContext
.
symbolTable
.
find
(
*
parserToken
->
sType
.
lex
.
string
);
if
(
afterType
==
false
&&
parserToken
->
sType
.
lex
.
symbol
)
{
if
(
(
afterType
==
false
&&
afterStruct
==
false
)
&&
parserToken
->
sType
.
lex
.
symbol
!=
nullptr
)
{
if
(
const
TVariable
*
variable
=
parserToken
->
sType
.
lex
.
symbol
->
getAsVariable
())
{
if
(
variable
->
isUserType
())
{
afterType
=
true
;
...
...
glslang/MachineIndependent/ScanContext.h
100644 → 100755
View file @
2c8265bb
...
...
@@ -50,7 +50,10 @@ class TParserToken;
class
TScanContext
{
public
:
explicit
TScanContext
(
TParseContextBase
&
pc
)
:
parseContext
(
pc
),
afterType
(
false
),
field
(
false
)
{
}
explicit
TScanContext
(
TParseContextBase
&
pc
)
:
parseContext
(
pc
),
afterType
(
false
),
afterStruct
(
false
),
field
(
false
)
{
}
virtual
~
TScanContext
()
{
}
static
void
fillInKeywordMap
();
...
...
@@ -76,6 +79,7 @@ protected:
TParseContextBase
&
parseContext
;
bool
afterType
;
// true if we've recognized a type, so can only be looking for an identifier
bool
afterStruct
;
// true if we've recognized the STRUCT keyword, so can only be looking for an identifier
bool
field
;
// true if we're on a field, right after a '.'
TSourceLoc
loc
;
TParserToken
*
parserToken
;
...
...
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