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
3fcb42cf
Commit
3fcb42cf
authored
Jun 08, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL: Fix #853: Only outer dimension of array can be specialization constant.
parent
d314ecfb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
19 deletions
+41
-19
vulkan.vert.out
Test/baseResults/vulkan.vert.out
+5
-1
vulkan.vert
Test/vulkan.vert
+13
-0
Types.h
glslang/Include/Types.h
+1
-1
arrays.h
glslang/Include/arrays.h
+14
-12
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+7
-4
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+1
-1
No files found.
Test/baseResults/vulkan.vert.out
View file @
3fcb42cf
...
...
@@ -22,7 +22,11 @@ ERROR: 0:32: 'initializer' : can't use with types containing arrays sized with a
ERROR: 0:34: '=' : can't use with types containing arrays sized with a specialization constant
ERROR: 0:35: '==' : can't use with types containing arrays sized with a specialization constant
ERROR: 0:39: 'set' : cannot be used with push_constant
ERROR: 23 compilation errors. No code generated.
ERROR: 0:49: '[]' : only outermost dimension of an array of arrays can be a specialization constant
ERROR: 0:50: '[]' : only outermost dimension of an array of arrays can be a specialization constant
ERROR: 0:51: '[]' : only outermost dimension of an array of arrays can be a specialization constant
ERROR: 0:54: '[]' : only outermost dimension of an array of arrays can be a specialization constant
ERROR: 27 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
Test/vulkan.vert
View file @
3fcb42cf
...
...
@@ -45,3 +45,16 @@ layout(set = 1, push_constant) uniform badpc { int a; } badpcI; // ERROR, no de
#if VULKAN != 100
#error VULKAN should be 100
#endif
float
AofA0
[
2
][
arraySize
];
// ERROR, only outer dimension
float
AofA1
[
arraySize
][
arraySize
];
// ERROR, only outer dimension
float
AofA2
[
arraySize
][
2
+
arraySize
];
// ERROR, only outer dimension
float
AofA3
[
arraySize
][
2
];
out
ban1
{
// ERROR, only outer dimension
float
f
;
}
bai1
[
2
][
arraySize
];
out
ban2
{
float
f
;
}
bai2
[
arraySize
][
2
];
glslang/Include/Types.h
View file @
3fcb42cf
...
...
@@ -1460,7 +1460,7 @@ public:
virtual
bool
containsSpecializationSize
()
const
{
return
contains
([](
const
TType
*
t
)
{
return
t
->
isArray
()
&&
t
->
arraySizes
->
containsNode
();
}
);
return
contains
([](
const
TType
*
t
)
{
return
t
->
isArray
()
&&
t
->
arraySizes
->
isOuterSpecialization
();
}
);
}
// Array editing methods. Array descriptors can be shared across
...
...
glslang/Include/arrays.h
View file @
3fcb42cf
...
...
@@ -264,6 +264,20 @@ struct TArraySizes {
return
false
;
}
bool
isInnerSpecialization
()
const
{
for
(
int
d
=
1
;
d
<
sizes
.
size
();
++
d
)
{
if
(
sizes
.
getDimNode
(
d
)
!=
nullptr
)
return
true
;
}
return
false
;
}
bool
isOuterSpecialization
()
{
return
sizes
.
getDimNode
(
0
)
!=
nullptr
;
}
bool
isImplicit
()
const
{
return
getOuterSize
()
==
UnsizedArraySize
||
isInnerImplicit
();
}
void
addOuterSizes
(
const
TArraySizes
&
s
)
{
sizes
.
push_front
(
s
.
sizes
);
}
void
dereference
()
{
sizes
.
pop_front
();
}
...
...
@@ -288,18 +302,6 @@ struct TArraySizes {
return
true
;
}
// Returns true if any of the dimensions of the array is sized with a node
// instead of a front-end compile-time constant.
bool
containsNode
()
{
for
(
int
d
=
0
;
d
<
sizes
.
size
();
++
d
)
{
if
(
sizes
.
getDimNode
(
d
)
!=
nullptr
)
return
true
;
}
return
false
;
}
bool
operator
==
(
const
TArraySizes
&
rhs
)
{
return
sizes
==
rhs
.
sizes
;
}
bool
operator
!=
(
const
TArraySizes
&
rhs
)
{
return
sizes
!=
rhs
.
sizes
;
}
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
3fcb42cf
...
...
@@ -2958,7 +2958,7 @@ void TParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& typ
}
}
void
TParseContext
::
array
Unsized
Check
(
const
TSourceLoc
&
loc
,
const
TQualifier
&
qualifier
,
const
TArraySizes
*
arraySizes
,
bool
initializer
,
bool
lastMember
)
void
TParseContext
::
array
Sizes
Check
(
const
TSourceLoc
&
loc
,
const
TQualifier
&
qualifier
,
const
TArraySizes
*
arraySizes
,
bool
initializer
,
bool
lastMember
)
{
assert
(
arraySizes
);
...
...
@@ -2974,6 +2974,9 @@ void TParseContext::arrayUnsizedCheck(const TSourceLoc& loc, const TQualifier& q
if
(
arraySizes
->
isInnerImplicit
())
error
(
loc
,
"only outermost dimension of an array of arrays can be implicitly sized"
,
"[]"
,
""
);
if
(
arraySizes
->
isInnerSpecialization
())
error
(
loc
,
"only outermost dimension of an array of arrays can be a specialization constant"
,
"[]"
,
""
);
// desktop always allows outer-dimension-unsized variable arrays,
if
(
profile
!=
EEsProfile
)
return
;
...
...
@@ -5081,7 +5084,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
arrayDimMerge
(
type
,
arraySizes
);
// Check that implicit sizing is only where allowed.
array
Unsized
Check
(
loc
,
type
.
getQualifier
(),
&
type
.
getArraySizes
(),
initializer
!=
nullptr
,
false
);
array
Sizes
Check
(
loc
,
type
.
getQualifier
(),
&
type
.
getArraySizes
(),
initializer
!=
nullptr
,
false
);
if
(
!
arrayQualifierError
(
loc
,
type
.
getQualifier
())
&&
!
arrayError
(
loc
,
type
))
declareArray
(
loc
,
identifier
,
type
,
symbol
);
...
...
@@ -5633,7 +5636,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
blockStageIoCheck
(
loc
,
currentBlockQualifier
);
blockQualifierCheck
(
loc
,
currentBlockQualifier
,
instanceName
!=
nullptr
);
if
(
arraySizes
)
{
array
Unsized
Check
(
loc
,
currentBlockQualifier
,
arraySizes
,
false
,
false
);
array
Sizes
Check
(
loc
,
currentBlockQualifier
,
arraySizes
,
false
,
false
);
arrayDimCheck
(
loc
,
arraySizes
,
0
);
if
(
arraySizes
->
getNumDims
()
>
1
)
requireProfile
(
loc
,
~
EEsProfile
,
"array-of-array of block"
);
...
...
@@ -5651,7 +5654,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if
((
currentBlockQualifier
.
storage
==
EvqUniform
||
currentBlockQualifier
.
storage
==
EvqBuffer
)
&&
(
memberQualifier
.
isInterpolation
()
||
memberQualifier
.
isAuxiliary
()))
error
(
memberLoc
,
"member of uniform or buffer block cannot have an auxiliary or interpolation qualifier"
,
memberType
.
getFieldName
().
c_str
(),
""
);
if
(
memberType
.
isArray
())
array
Unsized
Check
(
memberLoc
,
currentBlockQualifier
,
&
memberType
.
getArraySizes
(),
false
,
member
==
typeList
.
size
()
-
1
);
array
Sizes
Check
(
memberLoc
,
currentBlockQualifier
,
&
memberType
.
getArraySizes
(),
false
,
member
==
typeList
.
size
()
-
1
);
if
(
memberQualifier
.
hasOffset
())
{
if
(
spvVersion
.
spv
==
0
)
{
requireProfile
(
memberLoc
,
~
EEsProfile
,
"offset on block member"
);
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
3fcb42cf
...
...
@@ -317,7 +317,7 @@ public:
bool
arrayError
(
const
TSourceLoc
&
,
const
TType
&
);
void
arraySizeRequiredCheck
(
const
TSourceLoc
&
,
const
TArraySizes
&
);
void
structArrayCheck
(
const
TSourceLoc
&
,
const
TType
&
structure
);
void
array
Unsized
Check
(
const
TSourceLoc
&
,
const
TQualifier
&
,
const
TArraySizes
*
,
bool
initializer
,
bool
lastMember
);
void
array
Sizes
Check
(
const
TSourceLoc
&
,
const
TQualifier
&
,
const
TArraySizes
*
,
bool
initializer
,
bool
lastMember
);
void
arrayOfArrayVersionCheck
(
const
TSourceLoc
&
);
void
arrayDimCheck
(
const
TSourceLoc
&
,
const
TArraySizes
*
sizes1
,
const
TArraySizes
*
sizes2
);
void
arrayDimCheck
(
const
TSourceLoc
&
,
const
TType
*
,
const
TArraySizes
*
);
...
...
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