Desktop array size limit checking for gl_ClipDistance[] and gl_TexCoord[].

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24397 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-12-06 23:57:42 +00:00
parent 64bcb105c9
commit 5f15d4224a
8 changed files with 40 additions and 8 deletions

View File

@ -117,3 +117,5 @@ void foo()
overloadF(1, 1); // ERROR
overloadF(1);
}
varying vec4 gl_TexCoord[35]; // ERROR, size too big

View File

@ -40,3 +40,5 @@ struct S {
layout(location = 10) out S cs[2]; // 10 through 10 + 2 * 22 - 1 = 53
layout(location = 54) out float cf;
layout(location = 53) out float cg; // ERROR, collision at 31
float gl_ClipDistance[17]; // ERROR, size too big

View File

@ -43,7 +43,8 @@ ERROR: 0:107: 'overloadE' : no matching overloaded function found
ERROR: 0:108: 'overloadE' : no matching overloaded function found
ERROR: 0:111: 'overloadE' : no matching overloaded function found
ERROR: 0:117: 'overloadF' : no matching overloaded function found
ERROR: 44 compilation errors. No code generated.
ERROR: 0:121: 'gl_TexCoord array size' : must be less than gl_MaxTextureCoords (32)
ERROR: 45 compilation errors. No code generated.
ERROR: node is still EOpNull!
@ -201,6 +202,8 @@ ERROR: node is still EOpNull!
0:? 3.400000
0:? 'concall' (const float)
0:? 0.295520
0:? 'gl_TexCoord' (smooth out 35-element array of 4-component vector of float)
0:? 'gl_TexCoord' (smooth out 35-element array of 4-component vector of float)
Linked vertex stage:

View File

@ -12,7 +12,8 @@ ERROR: 0:28: '' : cannot use invariant qualifier on a function parameter
ERROR: 0:30: '' : cannot use layout qualifiers on a function parameter
ERROR: 0:31: '' : cannot use auxiliary or interpolation qualifiers on a function parameter
ERROR: 0:42: 'location' : repeated use of location 53
ERROR: 12 compilation errors. No code generated.
ERROR: 0:44: 'gl_ClipDistance array size' : must be less than gl_MaxClipDistances (8)
ERROR: 13 compilation errors. No code generated.
ERROR: node is still EOpNull!
@ -21,7 +22,7 @@ ERROR: node is still EOpNull!
0:16 Sequence
0:16 move second child to first child (float)
0:16 direct index (float)
0:16 gl_ClipDistance: direct index for structure (unsized array of float)
0:16 gl_ClipDistance: direct index for structure (17-element array of float)
0:16 '__anon__0' (out block{gl_ClipDistance})
0:16 Constant:
0:16 0 (const uint)

View File

@ -1,6 +1,6 @@
Current functionality level: ESSL 3.0
- create version system
+ create version system
Link Validation
+ provide input config file for setting limits
@ -28,13 +28,14 @@ Link Validation
- number of input/output compononents
- tessellation limits
- tessellation primitive array sizing consistency
- Non ES: gl_TexCoord can only have a max array size of up to gl_MaxTextureCoords
+ Non ES: gl_TexCoord can only have a max array size of up to gl_MaxTextureCoords
+ Non ES: gl_ClipDistance ...
- ...
+ exactly one main
+ ES 3.0: fragment outputs all have locations, if more than one
- ES 3.0: location aliasing/overlap (except desktop vertex shader inputs)
- Non ES: binding overlap
- location overlap
+ location overlap
+ Non ES: geometry shader input array sizes and input layout qualifier declaration
+ Non ES: read or write to both gl_ClipVertex and gl_ClipDistance
+ Non ES: write to only one of gl_FragColor, gl_FragData, or user-declared

View File

@ -9,5 +9,5 @@
// source have to figure out how to create revision.h just to get a build
// going. However, if it is not updated, it can be a version behind.
#define GLSLANG_REVISION "24391"
#define GLSLANG_DATE "2013/12/06 11:24:47"
#define GLSLANG_REVISION "24396"
#define GLSLANG_DATE "2013/12/06 14:45:15"

View File

@ -1410,6 +1410,8 @@ void TParseContext::reservedPpErrorCheck(TSourceLoc loc, const char* identifier,
//
// See if this version/profile allows use of the line-continuation character '\'.
//
// Returns true if a line continuation should be done.
//
bool TParseContext::lineContinuationCheck(TSourceLoc loc, bool endOfComment)
{
const char* message = "line continuation";
@ -1433,6 +1435,8 @@ bool TParseContext::lineContinuationCheck(TSourceLoc loc, bool endOfComment)
profileRequires(loc, EEsProfile, 300, 0, message);
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 0, message);
}
return lineContinuationAllowed;
}
bool TParseContext::builtInName(const TString& identifier)
@ -1988,6 +1992,11 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
return;
}
if (identifier.compare("gl_TexCoord") == 0)
limitCheck(loc, type.getArraySize(), "gl_MaxTextureCoords", "gl_TexCoord array size");
else if (identifier.compare("gl_ClipDistance") == 0)
limitCheck(loc, type.getArraySize(), "gl_MaxClipDistances", "gl_ClipDistance array size");
newType.shareArraySizes(type);
if (language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn)
@ -2442,6 +2451,18 @@ void TParseContext::inductiveLoopCheck(TSourceLoc loc, TIntermNode* init, TInter
inductiveLoopBodyCheck(loop->getBody(), loopIndex, symbolTable);
}
// See if the provide value is less than the symbol indicated by limit,
// which should be a constant in the symbol table.
void TParseContext::limitCheck(TSourceLoc loc, int value, const char* limit, const char* feature)
{
TSymbol* symbol = symbolTable.find(limit);
assert(symbol->getAsVariable());
const TConstUnionArray& constArray = symbol->getAsVariable()->getConstArray();
assert(! constArray.empty());
if (value >= constArray[0].getIConst())
error(loc, "must be less than", feature, "%s (%d)", limit, constArray[0].getIConst());
}
//
// Do any additional error checking, etc., once we know the parsing is done.
//

View File

@ -134,6 +134,8 @@ public:
void opaqueCheck(TSourceLoc, const TType&, const char* op);
void structTypeCheck(TSourceLoc, TPublicType&);
void inductiveLoopCheck(TSourceLoc, TIntermNode* init, TIntermLoop* loop);
void limitCheck(TSourceLoc, int value, const char* limit, const char* feature);
void inductiveLoopBodyCheck(TIntermNode*, int loopIndexId, TSymbolTable&);
void constantIndexExpressionCheck(TIntermNode*);