Fix build break for non-VS.

This commit is contained in:
John Kessenich 2017-01-13 20:22:00 -07:00
parent 442515393e
commit 33dadd1287
4 changed files with 11 additions and 10 deletions

View File

@ -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"

View File

@ -443,7 +443,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
TSwizzleSelectors<TVectorSelector>& selector)
{
// Too long?
if (compString.size() > TSwizzleSelectors<TVectorSelector>::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<TVectorSelector>::maxSelectors];
} fieldSet[MaxSwizzleSelectors];
// Decode the swizzle string.
int size = std::min(TSwizzleSelectors<TVectorSelector>::maxSelectors, (int)compString.size());
int size = std::min(MaxSwizzleSelectors, (int)compString.size());
for (int i = 0; i < size; ++i) {
switch (compString[i]) {
case 'x':

View File

@ -54,15 +54,16 @@ struct TMatrixSelector {
typedef int TVectorSelector;
const int MaxSwizzleSelectors = 4;
template<typename selectorType>
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];
};
//

View File

@ -513,7 +513,7 @@ void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString
bool HlslParseContext::parseMatrixSwizzleSelector(const TSourceLoc& loc, const TString& fields, int cols, int rows,
TSwizzleSelectors<TMatrixSelector>& components)
{
int startPos[TSwizzleSelectors<TVectorSelector>::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<TVectorSelector>::maxSelectors) {
if (numComps >= MaxSwizzleSelectors) {
error(loc, "matrix component swizzle has too many components", compString.c_str(), "");
return false;
}