diff options
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp')
-rw-r--r-- | src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp | 111 |
1 files changed, 44 insertions, 67 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp index dd11f99eb8..12dc9e0dad 100644 --- a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp +++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp @@ -35,104 +35,81 @@ static const int GLSL_VERSION_120 = 120; // - invariant gl_Position; // - varying vec3 color; invariant color; // -TVersionGLSL::TVersionGLSL(ShShaderType type) - : mShaderType(type), - mVersion(GLSL_VERSION_110) +TVersionGLSL::TVersionGLSL(sh::GLenum type) + : mVersion(GLSL_VERSION_110) { } -void TVersionGLSL::visitSymbol(TIntermSymbol* node) +void TVersionGLSL::visitSymbol(TIntermSymbol *node) { if (node->getSymbol() == "gl_PointCoord") updateVersion(GLSL_VERSION_120); } -void TVersionGLSL::visitConstantUnion(TIntermConstantUnion*) -{ -} - -bool TVersionGLSL::visitBinary(Visit, TIntermBinary*) -{ - return true; -} - -bool TVersionGLSL::visitUnary(Visit, TIntermUnary*) -{ - return true; -} - -bool TVersionGLSL::visitSelection(Visit, TIntermSelection*) -{ - return true; -} - -bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node) +bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node) { bool visitChildren = true; - switch (node->getOp()) { + switch (node->getOp()) + { case EOpSequence: // We need to visit sequence children to get to global or inner scope. visitChildren = true; break; - case EOpDeclaration: { - const TIntermSequence& sequence = node->getSequence(); - TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier(); - if ((qualifier == EvqInvariantVaryingIn) || - (qualifier == EvqInvariantVaryingOut)) { - updateVersion(GLSL_VERSION_120); + case EOpDeclaration: + { + const TIntermSequence &sequence = *(node->getSequence()); + TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier(); + if ((qualifier == EvqInvariantVaryingIn) || + (qualifier == EvqInvariantVaryingOut)) + { + updateVersion(GLSL_VERSION_120); + } + break; } - break; - } - case EOpParameters: { - const TIntermSequence& params = node->getSequence(); - for (TIntermSequence::const_iterator iter = params.begin(); - iter != params.end(); ++iter) + case EOpParameters: { - const TIntermTyped* param = (*iter)->getAsTyped(); - if (param->isArray()) + const TIntermSequence ¶ms = *(node->getSequence()); + for (TIntermSequence::const_iterator iter = params.begin(); + iter != params.end(); ++iter) { - TQualifier qualifier = param->getQualifier(); - if ((qualifier == EvqOut) || (qualifier == EvqInOut)) + const TIntermTyped *param = (*iter)->getAsTyped(); + if (param->isArray()) { - updateVersion(GLSL_VERSION_120); - break; + TQualifier qualifier = param->getQualifier(); + if ((qualifier == EvqOut) || (qualifier == EvqInOut)) + { + updateVersion(GLSL_VERSION_120); + break; + } } } + // Fully processed. No need to visit children. + visitChildren = false; + break; } - // Fully processed. No need to visit children. - visitChildren = false; - break; - } case EOpConstructMat2: case EOpConstructMat3: - case EOpConstructMat4: { - const TIntermSequence& sequence = node->getSequence(); - if (sequence.size() == 1) { - TIntermTyped* typed = sequence.front()->getAsTyped(); - if (typed && typed->isMatrix()) { - updateVersion(GLSL_VERSION_120); - } + case EOpConstructMat4: + { + const TIntermSequence &sequence = *(node->getSequence()); + if (sequence.size() == 1) + { + TIntermTyped *typed = sequence.front()->getAsTyped(); + if (typed && typed->isMatrix()) + { + updateVersion(GLSL_VERSION_120); + } + } + break; } + default: break; - } - - default: break; } return visitChildren; } -bool TVersionGLSL::visitLoop(Visit, TIntermLoop*) -{ - return true; -} - -bool TVersionGLSL::visitBranch(Visit, TIntermBranch*) -{ - return true; -} - void TVersionGLSL::updateVersion(int version) { mVersion = std::max(version, mVersion); |