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:
parent
64bcb105c9
commit
5f15d4224a
8 changed files with 40 additions and 8 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -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*);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue