Merge master branch from upstream
This commit is contained in:
commit
30f9258d5e
43 changed files with 1992 additions and 174 deletions
|
|
@ -2063,6 +2063,8 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden
|
|||
// however, before that, ES tests required an error.
|
||||
if (strncmp(identifier, "GL_", 3) == 0)
|
||||
ppError(loc, "names beginning with \"GL_\" can't be (un)defined:", op, identifier);
|
||||
else if (strncmp(identifier, "defined", 8) == 0)
|
||||
ppError(loc, "\"defined\" can't be (un)defined:", op, identifier);
|
||||
else if (strstr(identifier, "__") != 0) {
|
||||
if (profile == EEsProfile && version >= 300 &&
|
||||
(strcmp(identifier, "__LINE__") == 0 ||
|
||||
|
|
@ -2736,16 +2738,20 @@ bool TParseContext::arrayError(const TSourceLoc& loc, const TType& type)
|
|||
else if (type.isStruct())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader array-of-struct input");
|
||||
}
|
||||
if (type.getQualifier().storage == EvqVaryingOut && language == EShLangFragment) {
|
||||
if (type.isArrayOfArrays())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader array-of-array output");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Require array to have size
|
||||
// Require array to be completely sized
|
||||
//
|
||||
void TParseContext::arraySizeRequiredCheck(const TSourceLoc& loc, int size)
|
||||
void TParseContext::arraySizeRequiredCheck(const TSourceLoc& loc, const TArraySizes& arraySizes)
|
||||
{
|
||||
if (size == UnsizedArraySize)
|
||||
if (arraySizes.isImplicit())
|
||||
error(loc, "array size required", "", "");
|
||||
}
|
||||
|
||||
|
|
@ -2754,12 +2760,12 @@ void TParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& typ
|
|||
const TTypeList& structure = *type.getStruct();
|
||||
for (int m = 0; m < (int)structure.size(); ++m) {
|
||||
const TType& member = *structure[m].type;
|
||||
if (member.isArray() && ! member.isExplicitlySizedArray())
|
||||
arraySizeRequiredCheck(structure[m].loc, 0);
|
||||
if (member.isArray())
|
||||
arraySizeRequiredCheck(structure[m].loc, *member.getArraySizes());
|
||||
}
|
||||
}
|
||||
|
||||
void TParseContext::arrayUnsizedCheck(const TSourceLoc& loc, const TQualifier& qualifier, const TArraySizes* arraySizes, bool initializer)
|
||||
void TParseContext::arrayUnsizedCheck(const TSourceLoc& loc, const TQualifier& qualifier, const TArraySizes* arraySizes, bool initializer, bool lastMember)
|
||||
{
|
||||
assert(arraySizes);
|
||||
|
||||
|
|
@ -2781,6 +2787,12 @@ void TParseContext::arrayUnsizedCheck(const TSourceLoc& loc, const TQualifier& q
|
|||
|
||||
// for ES, if size isn't coming from an initializer, it has to be explicitly declared now,
|
||||
// with very few exceptions
|
||||
|
||||
// last member of ssbo block exception:
|
||||
if (qualifier.storage == EvqBuffer && lastMember)
|
||||
return;
|
||||
|
||||
// implicitly-sized io exceptions:
|
||||
switch (language) {
|
||||
case EShLangGeometry:
|
||||
if (qualifier.storage == EvqVaryingIn)
|
||||
|
|
@ -2803,7 +2815,7 @@ void TParseContext::arrayUnsizedCheck(const TSourceLoc& loc, const TQualifier& q
|
|||
break;
|
||||
}
|
||||
|
||||
arraySizeRequiredCheck(loc, arraySizes->getOuterSize());
|
||||
arraySizeRequiredCheck(loc, *arraySizes);
|
||||
}
|
||||
|
||||
void TParseContext::arrayOfArrayVersionCheck(const TSourceLoc& loc)
|
||||
|
|
@ -4461,7 +4473,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
|
|||
arrayDimMerge(type, arraySizes);
|
||||
|
||||
// Check that implicit sizing is only where allowed.
|
||||
arrayUnsizedCheck(loc, type.getQualifier(), &type.getArraySizes(), initializer != nullptr);
|
||||
arrayUnsizedCheck(loc, type.getQualifier(), &type.getArraySizes(), initializer != nullptr, false);
|
||||
|
||||
if (! arrayQualifierError(loc, type.getQualifier()) && ! arrayError(loc, type))
|
||||
declareArray(loc, identifier, type, symbol, newDeclaration);
|
||||
|
|
@ -4945,8 +4957,10 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
blockStageIoCheck(loc, currentBlockQualifier);
|
||||
blockQualifierCheck(loc, currentBlockQualifier);
|
||||
if (arraySizes) {
|
||||
arrayUnsizedCheck(loc, currentBlockQualifier, arraySizes, false);
|
||||
arrayUnsizedCheck(loc, currentBlockQualifier, arraySizes, false, false);
|
||||
arrayDimCheck(loc, arraySizes, 0);
|
||||
if (arraySizes->getNumDims() > 1)
|
||||
requireProfile(loc, ~EEsProfile, "array-of-array of block");
|
||||
}
|
||||
|
||||
// fix and check for member storage qualifiers and types that don't belong within a block
|
||||
|
|
@ -4960,10 +4974,8 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
memberQualifier.storage = currentBlockQualifier.storage;
|
||||
if ((currentBlockQualifier.storage == EvqUniform || currentBlockQualifier.storage == EvqBuffer) && (memberQualifier.isInterpolation() || memberQualifier.isAuxiliary()))
|
||||
error(memberLoc, "member of uniform or buffer block cannot have an auxiliary or interpolation qualifier", memberType.getFieldName().c_str(), "");
|
||||
if (memberType.isRuntimeSizedArray() && member < typeList.size() - 1)
|
||||
error(memberLoc, "only the last member of a buffer block can be run-time sized", memberType.getFieldName().c_str(), "");
|
||||
if (memberType.isImplicitlySizedArray())
|
||||
requireProfile(memberLoc, ~EEsProfile, "implicitly-sized array in a block");
|
||||
if (memberType.isArray())
|
||||
arrayUnsizedCheck(memberLoc, currentBlockQualifier, &memberType.getArraySizes(), false, member == typeList.size() - 1);
|
||||
if (memberQualifier.hasOffset()) {
|
||||
requireProfile(memberLoc, ~EEsProfile, "offset on block member");
|
||||
profileRequires(memberLoc, ~EEsProfile, 440, E_GL_ARB_enhanced_layouts, "offset on block member");
|
||||
|
|
|
|||
|
|
@ -137,9 +137,9 @@ public:
|
|||
void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, int& size);
|
||||
bool arrayQualifierError(const TSourceLoc&, const TQualifier&);
|
||||
bool arrayError(const TSourceLoc&, const TType&);
|
||||
void arraySizeRequiredCheck(const TSourceLoc&, int size);
|
||||
void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&);
|
||||
void structArrayCheck(const TSourceLoc&, const TType& structure);
|
||||
void arrayUnsizedCheck(const TSourceLoc&, const TQualifier&, const TArraySizes*, bool initializer);
|
||||
void arrayUnsizedCheck(const TSourceLoc&, const TQualifier&, const TArraySizes*, bool initializer, bool lastMember);
|
||||
void arrayOfArrayVersionCheck(const TSourceLoc&);
|
||||
void arrayDimCheck(const TSourceLoc&, const TArraySizes* sizes1, const TArraySizes* sizes2);
|
||||
void arrayDimCheck(const TSourceLoc&, const TType*, const TArraySizes*);
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ function_header
|
|||
GetStorageQualifierString($1.qualifier.storage), "");
|
||||
}
|
||||
if ($1.arraySizes)
|
||||
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
|
||||
|
||||
// Add the function as a prototype after parsing it (we do not support recursion)
|
||||
TFunction *function;
|
||||
|
|
@ -814,7 +814,7 @@ parameter_declarator
|
|||
if ($1.arraySizes) {
|
||||
parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
|
||||
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
|
||||
}
|
||||
if ($1.basicType == EbtVoid) {
|
||||
parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
|
||||
|
|
@ -829,11 +829,11 @@ parameter_declarator
|
|||
if ($1.arraySizes) {
|
||||
parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
|
||||
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
|
||||
}
|
||||
parseContext.arrayDimCheck($2.loc, $1.arraySizes, $3.arraySizes);
|
||||
|
||||
parseContext.arraySizeRequiredCheck($3.loc, $3.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
|
||||
parseContext.reservedErrorCheck($2.loc, *$2.string);
|
||||
|
||||
$1.arraySizes = $3.arraySizes;
|
||||
|
|
@ -893,7 +893,7 @@ parameter_type_specifier
|
|||
TParameter param = { 0, new TType($1) };
|
||||
$$.param = param;
|
||||
if ($1.arraySizes)
|
||||
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1962,7 +1962,7 @@ struct_declaration
|
|||
parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
|
||||
if (parseContext.profile == EEsProfile)
|
||||
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
|
||||
}
|
||||
|
||||
$$ = $2;
|
||||
|
|
@ -1981,7 +1981,7 @@ struct_declaration
|
|||
parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
|
||||
parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
|
||||
if (parseContext.profile == EEsProfile)
|
||||
parseContext.arraySizeRequiredCheck($2.loc, $2.arraySizes->getOuterSize());
|
||||
parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes);
|
||||
}
|
||||
|
||||
$$ = $3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue