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
ddb65a46
Commit
ddb65a46
authored
Mar 21, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front-end: Propagate spec-constness up through aggregate constructors.
parent
6d2b07dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+17
-8
No files found.
glslang/MachineIndependent/ParseHelper.cpp
View file @
ddb65a46
...
@@ -2210,7 +2210,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
...
@@ -2210,7 +2210,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
int
size
=
0
;
int
size
=
0
;
bool
constType
=
true
;
bool
constType
=
true
;
bool
specConstType
=
true
;
bool
specConstType
=
false
;
// value is only valid if constType is true
bool
full
=
false
;
bool
full
=
false
;
bool
overFull
=
false
;
bool
overFull
=
false
;
bool
matrixInMatrix
=
false
;
bool
matrixInMatrix
=
false
;
...
@@ -2241,14 +2241,15 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
...
@@ -2241,14 +2241,15 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
if
(
!
function
[
arg
].
type
->
getQualifier
().
isConstant
())
if
(
!
function
[
arg
].
type
->
getQualifier
().
isConstant
())
constType
=
false
;
constType
=
false
;
if
(
!
function
[
arg
].
type
->
getQualifier
().
isSpecConstant
())
if
(
function
[
arg
].
type
->
getQualifier
().
isSpecConstant
())
specConstType
=
fals
e
;
specConstType
=
tru
e
;
}
}
if
(
constType
)
{
if
(
constType
)
{
type
.
getQualifier
().
storage
=
EvqConst
;
if
(
specConstType
)
if
(
specConstType
)
type
.
getQualifier
().
specConstant
=
true
;
type
.
getQualifier
().
makeSpecConstant
();
else
type
.
getQualifier
().
storage
=
EvqConst
;
}
}
if
(
type
.
isArray
())
{
if
(
type
.
isArray
())
{
...
@@ -5101,12 +5102,16 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
...
@@ -5101,12 +5102,16 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
// if the structure constructor contains more than one parameter, then construct
// if the structure constructor contains more than one parameter, then construct
// each parameter
// each parameter
int
paramCount
=
0
;
// keeps
a
track of the constructor parameter number being checked
int
paramCount
=
0
;
// keeps track of the constructor parameter number being checked
// for each parameter to the constructor call, check to see if the right type is passed or convert them
// for each parameter to the constructor call, check to see if the right type is passed or convert them
// to the right type if possible (and allowed).
// to the right type if possible (and allowed).
// for structure constructors, just check if the right type is passed, no conversion is allowed.
// for structure constructors, just check if the right type is passed, no conversion is allowed.
// We don't know "top down" whether type is a specialization constant,
// but a const becomes a specialization constant if any of its children are.
bool
specConst
=
false
;
for
(
TIntermSequence
::
iterator
p
=
sequenceVector
.
begin
();
for
(
TIntermSequence
::
iterator
p
=
sequenceVector
.
begin
();
p
!=
sequenceVector
.
end
();
p
++
,
paramCount
++
)
{
p
!=
sequenceVector
.
end
();
p
++
,
paramCount
++
)
{
if
(
type
.
isArray
())
if
(
type
.
isArray
())
...
@@ -5116,13 +5121,17 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
...
@@ -5116,13 +5121,17 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
else
else
newNode
=
constructBuiltIn
(
type
,
op
,
(
*
p
)
->
getAsTyped
(),
node
->
getLoc
(),
true
);
newNode
=
constructBuiltIn
(
type
,
op
,
(
*
p
)
->
getAsTyped
(),
node
->
getLoc
(),
true
);
if
(
newNode
)
if
(
newNode
)
{
*
p
=
newNode
;
*
p
=
newNode
;
else
if
(
newNode
->
getType
().
getQualifier
().
isSpecConstant
())
specConst
=
true
;
}
else
return
nullptr
;
return
nullptr
;
}
}
TIntermTyped
*
constructor
=
intermediate
.
setAggregateOperator
(
aggrNode
,
op
,
type
,
loc
);
TIntermTyped
*
constructor
=
intermediate
.
setAggregateOperator
(
aggrNode
,
op
,
type
,
loc
);
if
(
constructor
->
getType
().
getQualifier
().
isConstant
()
&&
specConst
)
constructor
->
getWritableType
().
getQualifier
().
makeSpecConstant
();
return
constructor
;
return
constructor
;
}
}
...
...
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