Add the following ESSL 2.0 (#version 100) limitations to the configuration file, internal infrastructure, and test cases. Still need to implement the actual detection of non-inductive loops and array accesses. While and do-while loop detection is done.

nonInductiveForLoops
whileLoops
doWhileLoops
generalUniformIndexing
generalAttributeMatrixVectorIndexing
generalVaryingIndexing
generalSamplerIndexing
generalVariableIndexing
generalConstantMatrixVectorIndexing


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23323 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-02 05:10:48 +00:00
parent 44e8cae80a
commit a5830dfc0e
14 changed files with 395 additions and 7 deletions

View file

@ -37,6 +37,18 @@
#ifndef _RESOURCE_LIMITS_INCLUDED_
#define _RESOURCE_LIMITS_INCLUDED_
struct TLimits {
bool nonInductiveForLoops;
bool whileLoops;
bool doWhileLoops;
bool generalUniformIndexing;
bool generalAttributeMatrixVectorIndexing;
bool generalVaryingIndexing;
bool generalSamplerIndexing;
bool generalVariableIndexing;
bool generalConstantMatrixVectorIndexing;
};
struct TBuiltInResource {
int maxLights;
int maxClipPlanes;
@ -57,6 +69,7 @@ struct TBuiltInResource {
int maxFragmentInputVectors;
int minProgramTexelOffset;
int maxProgramTexelOffset;
TLimits limits;
};
#endif // _RESOURCE_LIMITS_INCLUDED_

View file

@ -539,9 +539,11 @@ TIntermTyped* TParseContext::handleBracketDereference(TSourceLoc loc, TIntermTyp
error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable");
if (base->getBasicType() == EbtBlock)
requireProfile(base->getLoc(), static_cast<EProfileMask>(~EEsProfileMask), "variable indexing block array");
if (base->getBasicType() == EbtSampler) {
requireProfile(base->getLoc(), static_cast<EProfileMask>(ECoreProfileMask | ECompatibilityProfileMask), "variable indexing sampler array");
profileRequires(base->getLoc(), ECoreProfile, 400, 0, "variable indexing sampler array");
if (base->getBasicType() == EbtSampler && version >= 130) {
const char* explanation = "variable indexing sampler array";
requireProfile(base->getLoc(), static_cast<EProfileMask>(ECoreProfileMask | ECompatibilityProfileMask), explanation);
profileRequires(base->getLoc(), ECoreProfile, 400, 0, explanation);
profileRequires(base->getLoc(), ECompatibilityProfile, 400, 0, explanation);
}
result = intermediate.addIndex(EOpIndexIndirect, base, index, loc);

View file

@ -201,6 +201,7 @@ public:
TPrecisionQualifier defaultPrecision[EbtNumTypes];
TSourceLoc currentLoc;
bool tokensBeforeEOF;
TLimits limits;
protected:
TScanContext* scanContext;

View file

@ -451,6 +451,7 @@ bool CompileDeferred(
TPpContext ppContext(parseContext);
parseContext.setScanContext(&scanContext);
parseContext.setPpContext(&ppContext);
parseContext.limits = resources->limits;
if (! goodVersion)
parseContext.addError();

View file

@ -2226,6 +2226,8 @@ case_label
iteration_statement
: WHILE LEFT_PAREN {
if (! parseContext.limits.whileLoops)
parseContext.error($1.loc, "while loops not available", "limitation", "");
parseContext.symbolTable.push();
++parseContext.loopNestingLevel;
}
@ -2235,6 +2237,9 @@ iteration_statement
--parseContext.loopNestingLevel;
}
| DO { ++parseContext.loopNestingLevel; } statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
if (! parseContext.limits.whileLoops)
parseContext.error($1.loc, "do-while loops not available", "limitation", "");
parseContext.boolCheck($8.loc, $6);
$$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);