#include "compiler/translator/QualifierTypes.h"
#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/ImmutableStringBuilder.h"
#include <algorithm>
namespace sh
{
namespace
{
constexpr const ImmutableString kSpecifiedMultipleTimes(" specified multiple times");
constexpr const ImmutableString kInvariantMultipleTimes(
"The invariant qualifier specified multiple times.");
constexpr const ImmutableString kPreciseMultipleTimes(
"The precise qualifier specified multiple times.");
constexpr const ImmutableString kPrecisionMultipleTimes(
"The precision qualifier specified multiple times.");
constexpr const ImmutableString kLayoutMultipleTimes(
"The layout qualifier specified multiple times.");
constexpr const ImmutableString kLayoutAndInvariantDisallowed(
"The layout qualifier and invariant qualifier cannot coexist in the same "
"declaration according to the grammar.");
constexpr const ImmutableString kInterpolationMultipleTimes(
"The interpolation qualifier specified multiple times.");
constexpr const ImmutableString kOutputLayoutMultipleTimes(
"Output layout location specified multiple times.");
constexpr const ImmutableString kInvariantQualifierFirst(
"The invariant qualifier has to be first in the expression.");
constexpr const ImmutableString kStorageAfterInterpolation(
"Storage qualifiers have to be after interpolation qualifiers.");
constexpr const ImmutableString kPrecisionAfterInterpolation(
"Precision qualifiers have to be after interpolation qualifiers.");
constexpr const ImmutableString kStorageAfterLayout(
"Storage qualifiers have to be after layout qualifiers.");
constexpr const ImmutableString kPrecisionAfterLayout(
"Precision qualifiers have to be after layout qualifiers.");
constexpr const ImmutableString kPrecisionAfterStorage(
"Precision qualifiers have to be after storage qualifiers.");
constexpr const ImmutableString kPrecisionAfterMemory(
"Precision qualifiers have to be after memory qualifiers.");
bool AreTypeQualifierChecksRelaxed(int shaderVersion)
{ … }
bool IsScopeQualifier(TQualifier qualifier)
{ … }
bool IsScopeQualifierWrapper(const TQualifierWrapperBase *qualifier)
{ … }
bool IsInvariantCorrect(const TTypeQualifierBuilder::QualifierSequence &qualifiers)
{ … }
ImmutableString QualifierSpecifiedMultipleTimesErrorMessage(const ImmutableString &qualifierString)
{ … }
bool HasRepeatingQualifiers(const TTypeQualifierBuilder::QualifierSequence &qualifiers,
bool areQualifierChecksRelaxed,
ImmutableString *errorMessage)
{ … }
bool AreQualifiersInOrder(const TTypeQualifierBuilder::QualifierSequence &qualifiers,
int shaderVersion,
ImmutableString *errorMessage)
{ … }
struct QualifierComparator
{ … };
void SortSequence(TTypeQualifierBuilder::QualifierSequence &qualifiers)
{ … }
bool JoinVariableStorageQualifier(TQualifier *joinedQualifier, TQualifier storageQualifier)
{ … }
bool JoinParameterStorageQualifier(TQualifier *joinedQualifier, TQualifier storageQualifier)
{ … }
bool JoinMemoryQualifier(TMemoryQualifier *joinedMemoryQualifier, TQualifier memoryQualifier)
{ … }
TTypeQualifier GetVariableTypeQualifierFromSortedSequence(
const TTypeQualifierBuilder::QualifierSequence &sortedSequence,
TDiagnostics *diagnostics)
{ … }
TTypeQualifier GetParameterTypeQualifierFromSortedSequence(
TBasicType parameterBasicType,
const TTypeQualifierBuilder::QualifierSequence &sortedSequence,
TDiagnostics *diagnostics)
{ … }
}
TLayoutQualifier JoinLayoutQualifiers(TLayoutQualifier leftQualifier,
TLayoutQualifier rightQualifier,
const TSourceLoc &rightQualifierLocation,
TDiagnostics *diagnostics)
{ … }
unsigned int TInvariantQualifierWrapper::getRank() const
{ … }
unsigned int TPreciseQualifierWrapper::getRank() const
{ … }
unsigned int TInterpolationQualifierWrapper::getRank() const
{ … }
unsigned int TLayoutQualifierWrapper::getRank() const
{ … }
unsigned int TStorageQualifierWrapper::getRank() const
{ … }
unsigned int TMemoryQualifierWrapper::getRank() const
{ … }
unsigned int TPrecisionQualifierWrapper::getRank() const
{ … }
TTypeQualifier::TTypeQualifier(TQualifier scope, const TSourceLoc &loc)
: … { … }
TTypeQualifierBuilder::TTypeQualifierBuilder(const TStorageQualifierWrapper *scope,
int shaderVersion)
: … { … }
void TTypeQualifierBuilder::appendQualifier(const TQualifierWrapperBase *qualifier)
{ … }
bool TTypeQualifierBuilder::checkSequenceIsValid(TDiagnostics *diagnostics) const
{ … }
TTypeQualifier TTypeQualifierBuilder::getParameterTypeQualifier(TBasicType parameterBasicType,
TDiagnostics *diagnostics) const
{ … }
TTypeQualifier TTypeQualifierBuilder::getVariableTypeQualifier(TDiagnostics *diagnostics) const
{ … }
}