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
fdfa6bbd
Commit
fdfa6bbd
authored
Jul 14, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front-end: enforce qualifiers that cannot appear on block declarations.
Also seems to pick up some white-space (line-ending) test differences with a prevoius checkin.
parent
8318878c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
14 deletions
+74
-14
310.vert
Test/310.vert
+16
-0
310.vert.out
Test/baseResults/310.vert.out
+13
-1
preprocessor.errors.vert.err
Test/baseResults/preprocessor.errors.vert.err
+8
-8
preprocessor.success_if_parse_would_fail.vert.out
...Results/preprocessor.success_if_parse_would_fail.vert.out
+4
-4
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+32
-1
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+1
-0
No files found.
Test/310.vert
View file @
fdfa6bbd
...
...
@@ -123,3 +123,19 @@ out gl_PerVertex { // ERROR, already used and already redeclared
highp
vec4
gl_Position
;
highp
vec4
t
;
};
smooth
out
smo
{
// ERROR, no smooth on a block
int
i
;
}
smon
;
flat
out
fmo
{
// ERROR, no flat on a block
int
i
;
}
fmon
;
centroid
out
cmo
{
// ERROR, no centroid on a block
int
i
;
}
cmon
;
invariant
out
imo
{
// ERROR, no invariant on a block
int
i
;
}
imon
;
Test/baseResults/310.vert.out
View file @
fdfa6bbd
...
...
@@ -23,7 +23,11 @@ ERROR: 0:109: 'gl_PerVertex' : block redeclaration has extra members
ERROR: 0:119: 'gl_PointSize' : member of nameless block was not redeclared
ERROR: 0:119: 'assign' : cannot convert from 'const float' to 'gl_PointSize highp void PointSize'
ERROR: 0:122: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
ERROR: 22 compilation errors. No code generated.
ERROR: 0:127: 'flat/smooth/noperspective' : cannot use interpolation qualifiers on an interface block
ERROR: 0:131: 'flat/smooth/noperspective' : cannot use interpolation qualifiers on an interface block
ERROR: 0:135: 'centroid' : cannot use centroid qualifier on an interface block
ERROR: 0:139: 'invariant' : cannot use invariant qualifier on an interface block
ERROR: 26 compilation errors. No code generated.
Shader version: 310
...
...
@@ -225,6 +229,10 @@ ERROR: node is still EOpNull!
0:? 'aliased' (layout(location=12 ) smooth out highp int)
0:? 'inbinst' (in block{in highp int a})
0:? 'anon@1' (out block{gl_Position highp 4-component vector of float Position gl_Position, })
0:? 'smon' (smooth out block{out highp int i})
0:? 'fmon' (flat out block{out highp int i})
0:? 'cmon' (centroid out block{out highp int i})
0:? 'imon' (invariant out block{out highp int i})
0:? 'gl_VertexID' (gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId)
...
...
@@ -431,6 +439,10 @@ ERROR: node is still EOpNull!
0:? 'aliased' (layout(location=12 ) smooth out highp int)
0:? 'inbinst' (in block{in highp int a})
0:? 'anon@1' (out block{gl_Position highp 4-component vector of float Position gl_Position, })
0:? 'smon' (smooth out block{out highp int i})
0:? 'fmon' (flat out block{out highp int i})
0:? 'cmon' (centroid out block{out highp int i})
0:? 'imon' (invariant out block{out highp int i})
0:? 'gl_VertexID' (gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId)
Test/baseResults/preprocessor.errors.vert.err
View file @
fdfa6bbd
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:9: '#error' : This should show up in pp output .
ERROR: 0:14: '#' : invalid directive: def
ERROR: 0:15: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile Y
ERROR: 0:21: '' : missing #endif
ERROR: 4 compilation errors.
No code generated.
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:9: '#error' : This should show up in pp output .
ERROR: 0:14: '#' : invalid directive: def
ERROR: 0:15: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile Y
ERROR: 0:21: '' : missing #endif
ERROR: 4 compilation errors.
No code generated.
Test/baseResults/preprocessor.success_if_parse_would_fail.vert.out
View file @
fdfa6bbd
int x(){
something that shouldnt compile;
}
int x(){
something that shouldnt compile;
}
glslang/MachineIndependent/ParseHelper.cpp
View file @
fdfa6bbd
...
...
@@ -4586,6 +4586,7 @@ TIntermTyped* TParseContext::constructStruct(TIntermNode* node, const TType& typ
void
TParseContext
::
declareBlock
(
TSourceLoc
loc
,
TTypeList
&
typeList
,
const
TString
*
instanceName
,
TArraySizes
*
arraySizes
)
{
blockStageIoCheck
(
loc
,
currentBlockQualifier
);
blockQualifierCheck
(
loc
,
currentBlockQualifier
);
if
(
arraySizes
)
arrayUnsizedCheck
(
loc
,
currentBlockQualifier
,
arraySizes
->
getOuterSize
(),
false
);
arrayDimCheck
(
loc
,
arraySizes
,
0
);
...
...
@@ -4810,10 +4811,40 @@ void TParseContext::blockStageIoCheck(TSourceLoc loc, const TQualifier& qualifie
break
;
default
:
error
(
loc
,
"only uniform, buffer, in, or out blocks are supported"
,
blockName
->
c_str
(),
""
);
return
;
break
;
}
}
// Do all block-declaration checking regarding its qualifers.
void
TParseContext
::
blockQualifierCheck
(
TSourceLoc
loc
,
const
TQualifier
&
qualifier
)
{
// The 4.5 specification says:
//
// interface-block :
// layout-qualifieropt interface-qualifier block-name { member-list } instance-nameopt ;
//
// interface-qualifier :
// in
// out
// patch in
// patch out
// uniform
// buffer
//
// Note however memory qualifiers aren't included, yet the specification also says
//
// "...memory qualifiers may also be used in the declaration of shader storage blocks..."
if
(
qualifier
.
isInterpolation
())
error
(
loc
,
"cannot use interpolation qualifiers on an interface block"
,
"flat/smooth/noperspective"
,
""
);
if
(
qualifier
.
centroid
)
error
(
loc
,
"cannot use centroid qualifier on an interface block"
,
"centroid"
,
""
);
if
(
qualifier
.
sample
)
error
(
loc
,
"cannot use sample qualifier on an interface block"
,
"sample"
,
""
);
if
(
qualifier
.
invariant
)
error
(
loc
,
"cannot use invariant qualifier on an interface block"
,
"invariant"
,
""
);
}
//
// "For a block, this process applies to the entire block, or until the first member
// is reached that has a location layout qualifier. When a block member is declared with a location
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
fdfa6bbd
...
...
@@ -193,6 +193,7 @@ public:
TIntermTyped
*
constructBuiltIn
(
const
TType
&
,
TOperator
,
TIntermTyped
*
,
TSourceLoc
,
bool
subset
);
void
declareBlock
(
TSourceLoc
,
TTypeList
&
typeList
,
const
TString
*
instanceName
=
0
,
TArraySizes
*
arraySizes
=
0
);
void
blockStageIoCheck
(
TSourceLoc
,
const
TQualifier
&
);
void
blockQualifierCheck
(
TSourceLoc
,
const
TQualifier
&
);
void
fixBlockLocations
(
TSourceLoc
,
TQualifier
&
,
TTypeList
&
,
bool
memberWithLocation
,
bool
memberWithoutLocation
);
void
fixBlockXfbOffsets
(
TQualifier
&
,
TTypeList
&
);
void
fixBlockUniformOffsets
(
TQualifier
&
,
TTypeList
&
);
...
...
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