bool TTypeQualifierBuilder::checkSequenceIsValid(TDiagnostics *diagnostics) const { bool areQualifierChecksRelaxed = AreTypeQualifierChecksRelaxed(mShaderVersion); std::string errorMessage; if (HasRepeatingQualifiers(mQualifiers, areQualifierChecksRelaxed, &errorMessage)) { diagnostics->error(mQualifiers[0]->getLine(), errorMessage.c_str(), "qualifier sequence"); return false; } if (!areQualifierChecksRelaxed && !AreQualifiersInOrder(mQualifiers, &errorMessage)) { diagnostics->error(mQualifiers[0]->getLine(), errorMessage.c_str(), "qualifier sequence"); return false; } return true; }
TTypeQualifier TTypeQualifierBuilder::getVariableTypeQualifier(TDiagnostics *diagnostics) const { ASSERT(IsInvariantCorrect(mQualifiers)); if (!checkSequenceIsValid(diagnostics)) { return TTypeQualifier( static_cast<const TStorageQualifierWrapper *>(mQualifiers[0])->getQualifier(), mQualifiers[0]->getLine()); } // If the qualifier checks are relaxed, then it is easier to sort the qualifiers so // that the order imposed by the GLSL ES 3.00 spec is kept. Then we can use the same code to // combine the qualifiers. if (AreTypeQualifierChecksRelaxed(mShaderVersion)) { // Copy the qualifier sequence so that we can sort them. QualifierSequence sortedQualifierSequence = mQualifiers; SortSequence(sortedQualifierSequence); return GetVariableTypeQualifierFromSortedSequence(sortedQualifierSequence, diagnostics); } return GetVariableTypeQualifierFromSortedSequence(mQualifiers, diagnostics); }