diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index bacfd0ab..f66d3024 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // For the version, it uses the latest git tag followed by the number of commits. // For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.1769" +#define GLSLANG_REVISION "Overload400-PrecQual.1770" #define GLSLANG_DATE "13-Jan-2017" diff --git a/glslang/MachineIndependent/ParseContextBase.cpp b/glslang/MachineIndependent/ParseContextBase.cpp index 83a9fdf5..24c8e609 100644 --- a/glslang/MachineIndependent/ParseContextBase.cpp +++ b/glslang/MachineIndependent/ParseContextBase.cpp @@ -443,7 +443,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin TSwizzleSelectors& selector) { // Too long? - if (compString.size() > TSwizzleSelectors::maxSelectors) + if (compString.size() > MaxSwizzleSelectors) error(loc, "vector swizzle too long", compString.c_str(), ""); // Use this to test that all swizzle characters are from the same swizzle-namespace-set @@ -451,10 +451,10 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin exyzw, ergba, estpq, - } fieldSet[TSwizzleSelectors::maxSelectors]; + } fieldSet[MaxSwizzleSelectors]; // Decode the swizzle string. - int size = std::min(TSwizzleSelectors::maxSelectors, (int)compString.size()); + int size = std::min(MaxSwizzleSelectors, (int)compString.size()); for (int i = 0; i < size; ++i) { switch (compString[i]) { case 'x': diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 812d4a36..ec58d50d 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -54,15 +54,16 @@ struct TMatrixSelector { typedef int TVectorSelector; +const int MaxSwizzleSelectors = 4; + template class TSwizzleSelectors { public: - static const int maxSelectors = 4; TSwizzleSelectors() : size_(0) { } void push_back(selectorType comp) { - if (size_ < maxSelectors) + if (size_ < MaxSwizzleSelectors) components[size_++] = comp; } void resize(int s) @@ -73,13 +74,13 @@ public: int size() const { return size_; } selectorType operator[](int i) const { - assert(i < maxSelectors); + assert(i < MaxSwizzleSelectors); return components[i]; } private: int size_; - selectorType components[maxSelectors]; + selectorType components[MaxSwizzleSelectors]; }; // diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index de1275c4..2e5b7331 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -513,7 +513,7 @@ void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector& components) { - int startPos[TSwizzleSelectors::maxSelectors]; + int startPos[MaxSwizzleSelectors]; int numComps = 0; TString compString = fields; @@ -521,7 +521,7 @@ bool HlslParseContext::parseMatrixSwizzleSelector(const TSourceLoc& loc, const T // recording the first character position after the '_'. for (size_t c = 0; c < compString.size(); ++c) { if (compString[c] == '_') { - if (numComps >= TSwizzleSelectors::maxSelectors) { + if (numComps >= MaxSwizzleSelectors) { error(loc, "matrix component swizzle has too many components", compString.c_str(), ""); return false; }