mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-12 13:10:06 +00:00
Fix build break for non-VS.
This commit is contained in:
parent
442515393e
commit
33dadd1287
@ -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"
|
||||
|
@ -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':
|
||||
|
@ -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];
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user