ES check for vertex out or fragment in containing any of
• An array of arrays • An array of structures • A structure containing an array • A structure containing a structure git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@28745 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
ad54b24fba
commit
b07957cf22
9 changed files with 163 additions and 6 deletions
|
|
@ -1053,6 +1053,7 @@ public:
|
|||
virtual int getMatrixCols() const { return matrixCols; }
|
||||
virtual int getMatrixRows() const { return matrixRows; }
|
||||
virtual int getArraySize() const { return arraySizes->sizes.front(); }
|
||||
virtual bool isArrayOfArrays() const { return arraySizes && arraySizes->isArrayOfArrays(); }
|
||||
virtual int getImplicitArraySize () const { return arraySizes->implicitArraySize; }
|
||||
|
||||
virtual bool isScalar() const { return vectorSize == 1 && ! isStruct() && ! isArray(); }
|
||||
|
|
@ -1093,6 +1094,18 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check the structure for any structures, needed for some error checks
|
||||
virtual bool containsStructure() const
|
||||
{
|
||||
if (! structure)
|
||||
return false;
|
||||
for (unsigned int i = 0; i < structure->size(); ++i) {
|
||||
if ((*structure)[i].type->structure)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Recursively check the structure for any implicitly-sized arrays, needed for triggering a copyUp().
|
||||
virtual bool containsImplicitlySizedArray() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2077,6 +2077,10 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
|
|||
if (publicType.userDef) {
|
||||
profileRequires(loc, EEsProfile, 300, 0, "fragment-shader struct input");
|
||||
profileRequires(loc, ~EEsProfile, 150, 0, "fragment-shader struct input");
|
||||
if (publicType.userDef->containsStructure())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing structure");
|
||||
if (publicType.userDef->containsArray())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing an array");
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -2095,7 +2099,12 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
|
|||
if (publicType.userDef) {
|
||||
profileRequires(loc, EEsProfile, 300, 0, "vertex-shader struct output");
|
||||
profileRequires(loc, ~EEsProfile, 150, 0, "vertex-shader struct output");
|
||||
if (publicType.userDef->containsStructure())
|
||||
requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing structure");
|
||||
if (publicType.userDef->containsArray())
|
||||
requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing an array");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EShLangTessControl:
|
||||
|
|
@ -2347,6 +2356,30 @@ bool TParseContext::arrayQualifierError(TSourceLoc loc, const TQualifier& qualif
|
|||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// See if this qualifier and type combination can be an array.
|
||||
// Assumes arrayQualifierError() was also called to catch the type-invariant tests.
|
||||
//
|
||||
// Returns true if there is an error.
|
||||
//
|
||||
bool TParseContext::arrayError(TSourceLoc loc, const TType& type)
|
||||
{
|
||||
if (type.getQualifier().storage == EvqVaryingOut && language == EShLangVertex) {
|
||||
if (type.isArrayOfArrays())
|
||||
requireProfile(loc, ~EEsProfile, "vertex-shader array-of-array output");
|
||||
else if (type.getArraySize() && type.isStruct())
|
||||
requireProfile(loc, ~EEsProfile, "vertex-shader array-of-struct output");
|
||||
}
|
||||
if (type.getQualifier().storage == EvqVaryingIn && language == EShLangFragment) {
|
||||
if (type.isArrayOfArrays())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader array-of-array input");
|
||||
else if (type.getArraySize() && type.isStruct())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader array-of-struct input");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Require array to have size
|
||||
//
|
||||
|
|
@ -3932,7 +3965,7 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
|
|||
if (profile == EEsProfile && ! initializer)
|
||||
arraySizeRequiredCheck(loc, type.getArraySize());
|
||||
|
||||
if (! arrayQualifierError(loc, type.getQualifier()))
|
||||
if (! arrayQualifierError(loc, type.getQualifier()) && ! arrayError(loc, type))
|
||||
declareArray(loc, identifier, type, symbol, newDeclaration);
|
||||
|
||||
if (initializer) {
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ public:
|
|||
bool constructorError(TSourceLoc, TIntermNode*, TFunction&, TOperator, TType&);
|
||||
void arraySizeCheck(TSourceLoc, TIntermTyped* expr, int& size);
|
||||
bool arrayQualifierError(TSourceLoc, const TQualifier&);
|
||||
bool arrayError(TSourceLoc, const TType&);
|
||||
void arraySizeRequiredCheck(TSourceLoc, int size);
|
||||
void structArrayCheck(TSourceLoc, TType* structure);
|
||||
void arrayDimError(TSourceLoc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue