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
952543e7
Commit
952543e7
authored
Mar 19, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front-end infrastructure: simplify and localize creating symbol nodes, reducing replication.
parent
2cc221ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+14
-7
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+1
-1
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+4
-3
No files found.
glslang/MachineIndependent/Intermediate.cpp
View file @
952543e7
...
@@ -61,20 +61,21 @@ namespace glslang {
...
@@ -61,20 +61,21 @@ namespace glslang {
// Returns the added node.
// Returns the added node.
//
//
TIntermSymbol
*
TIntermediate
::
addSymbol
(
int
id
,
const
TString
&
name
,
const
TType
&
type
,
const
TSourceLoc
&
loc
)
TIntermSymbol
*
TIntermediate
::
addSymbol
(
int
id
,
const
TString
&
name
,
const
TType
&
type
,
const
T
ConstUnionArray
&
constArray
,
const
T
SourceLoc
&
loc
)
{
{
TIntermSymbol
*
node
=
new
TIntermSymbol
(
id
,
name
,
type
);
TIntermSymbol
*
node
=
new
TIntermSymbol
(
id
,
name
,
type
);
node
->
setLoc
(
loc
);
node
->
setLoc
(
loc
);
node
->
setConstArray
(
constArray
);
return
node
;
return
node
;
}
}
TIntermSymbol
*
TIntermediate
::
addSymbol
(
int
id
,
const
TString
&
name
,
const
TType
&
type
,
const
TConstUnionArray
&
constArray
,
const
TSourceLoc
&
loc
)
TIntermSymbol
*
TIntermediate
::
addSymbol
(
const
TVariable
&
variable
)
{
{
TIntermSymbol
*
node
=
addSymbol
(
id
,
name
,
type
,
loc
);
glslang
::
TSourceLoc
loc
;
// just a null location
node
->
setConstArray
(
constArray
);
loc
.
init
(
);
return
node
;
return
addSymbol
(
variable
,
loc
)
;
}
}
TIntermSymbol
*
TIntermediate
::
addSymbol
(
const
TVariable
&
variable
,
const
TSourceLoc
&
loc
)
TIntermSymbol
*
TIntermediate
::
addSymbol
(
const
TVariable
&
variable
,
const
TSourceLoc
&
loc
)
...
@@ -82,6 +83,13 @@ TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable, const TSource
...
@@ -82,6 +83,13 @@ TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable, const TSource
return
addSymbol
(
variable
.
getUniqueId
(),
variable
.
getName
(),
variable
.
getType
(),
variable
.
getConstArray
(),
loc
);
return
addSymbol
(
variable
.
getUniqueId
(),
variable
.
getName
(),
variable
.
getType
(),
variable
.
getConstArray
(),
loc
);
}
}
TIntermSymbol
*
TIntermediate
::
addSymbol
(
const
TType
&
type
,
const
TSourceLoc
&
loc
)
{
TConstUnionArray
unionArray
;
// just a null constant
return
addSymbol
(
0
,
""
,
type
,
unionArray
,
loc
);
}
//
//
// Connect two nodes with a new parent that does a binary operation on the nodes.
// Connect two nodes with a new parent that does a binary operation on the nodes.
//
//
...
@@ -1018,8 +1026,7 @@ void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymb
...
@@ -1018,8 +1026,7 @@ void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymb
const
TAnonMember
*
anon
=
symbol
.
getAsAnonMember
();
const
TAnonMember
*
anon
=
symbol
.
getAsAnonMember
();
variable
=
&
anon
->
getAnonContainer
();
variable
=
&
anon
->
getAnonContainer
();
}
}
TIntermSymbol
*
node
=
new
TIntermSymbol
(
variable
->
getUniqueId
(),
variable
->
getName
(),
variable
->
getType
());
TIntermSymbol
*
node
=
addSymbol
(
*
variable
);
node
->
setConstArray
(
variable
->
getConstArray
());
linkage
=
growAggregate
(
linkage
,
node
);
linkage
=
growAggregate
(
linkage
,
node
);
}
}
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
952543e7
...
@@ -1017,7 +1017,7 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
...
@@ -1017,7 +1017,7 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
loc
);
loc
);
}
}
}
else
}
else
paramNodes
=
intermediate
.
growAggregate
(
paramNodes
,
intermediate
.
addSymbol
(
0
,
""
,
*
param
.
type
,
loc
),
loc
);
paramNodes
=
intermediate
.
growAggregate
(
paramNodes
,
intermediate
.
addSymbol
(
*
param
.
type
,
loc
),
loc
);
}
}
intermediate
.
setAggregateOperator
(
paramNodes
,
EOpParameters
,
TType
(
EbtVoid
),
loc
);
intermediate
.
setAggregateOperator
(
paramNodes
,
EOpParameters
,
TType
(
EbtVoid
),
loc
);
loopNestingLevel
=
0
;
loopNestingLevel
=
0
;
...
...
glslang/MachineIndependent/localintermediate.h
View file @
952543e7
...
@@ -162,10 +162,10 @@ public:
...
@@ -162,10 +162,10 @@ public:
int
getNumErrors
()
const
{
return
numErrors
;
}
int
getNumErrors
()
const
{
return
numErrors
;
}
void
addPushConstantCount
()
{
++
numPushConstants
;
}
void
addPushConstantCount
()
{
++
numPushConstants
;
}
bool
isRecursive
()
const
{
return
recursive
;
}
bool
isRecursive
()
const
{
return
recursive
;
}
TIntermSymbol
*
addSymbol
(
int
Id
,
const
TString
&
,
const
TType
&
,
const
TConstUnionArray
&
,
const
TSourceLoc
&
);
TIntermSymbol
*
addSymbol
(
const
TVariable
&
);
TIntermSymbol
*
addSymbol
(
int
Id
,
const
TString
&
,
const
TType
&
,
const
TSourceLoc
&
);
TIntermSymbol
*
addSymbol
(
const
TVariable
&
,
const
TSourceLoc
&
);
TIntermSymbol
*
addSymbol
(
const
TVariable
&
,
const
TSourceLoc
&
);
TIntermSymbol
*
addSymbol
(
const
TType
&
,
const
TSourceLoc
&
);
TIntermTyped
*
addConversion
(
TOperator
,
const
TType
&
,
TIntermTyped
*
)
const
;
TIntermTyped
*
addConversion
(
TOperator
,
const
TType
&
,
TIntermTyped
*
)
const
;
TIntermTyped
*
addBinaryMath
(
TOperator
,
TIntermTyped
*
left
,
TIntermTyped
*
right
,
TSourceLoc
);
TIntermTyped
*
addBinaryMath
(
TOperator
,
TIntermTyped
*
left
,
TIntermTyped
*
right
,
TSourceLoc
);
TIntermTyped
*
addAssign
(
TOperator
op
,
TIntermTyped
*
left
,
TIntermTyped
*
right
,
TSourceLoc
);
TIntermTyped
*
addAssign
(
TOperator
op
,
TIntermTyped
*
left
,
TIntermTyped
*
right
,
TSourceLoc
);
...
@@ -326,6 +326,7 @@ public:
...
@@ -326,6 +326,7 @@ public:
static
int
getBaseAlignment
(
const
TType
&
,
int
&
size
,
int
&
stride
,
bool
std140
,
bool
rowMajor
);
static
int
getBaseAlignment
(
const
TType
&
,
int
&
size
,
int
&
stride
,
bool
std140
,
bool
rowMajor
);
protected
:
protected
:
TIntermSymbol
*
addSymbol
(
int
Id
,
const
TString
&
,
const
TType
&
,
const
TConstUnionArray
&
,
const
TSourceLoc
&
);
void
error
(
TInfoSink
&
infoSink
,
const
char
*
);
void
error
(
TInfoSink
&
infoSink
,
const
char
*
);
void
mergeBodies
(
TInfoSink
&
,
TIntermSequence
&
globals
,
const
TIntermSequence
&
unitGlobals
);
void
mergeBodies
(
TInfoSink
&
,
TIntermSequence
&
globals
,
const
TIntermSequence
&
unitGlobals
);
void
mergeLinkerObjects
(
TInfoSink
&
,
TIntermSequence
&
linkerObjects
,
const
TIntermSequence
&
unitLinkerObjects
);
void
mergeLinkerObjects
(
TInfoSink
&
,
TIntermSequence
&
linkerObjects
,
const
TIntermSequence
&
unitLinkerObjects
);
...
...
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