mirror of
https://github.com/RPCS3/glslang.git
synced 2024-12-01 07:01:12 +00:00
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.
This commit is contained in:
parent
8318878c89
commit
fdfa6bbdfe
@ -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;
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
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.
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
int x(){
|
||||
something that shouldnt compile;
|
||||
}
|
||||
|
||||
int x(){
|
||||
something that shouldnt compile;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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&);
|
||||
|
Loading…
Reference in New Issue
Block a user