maxvujovic@gmail.com | 66ebd01 | 2012-05-30 22:18:11 +0000 | [diff] [blame^] | 1 | // |
| 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | #include "compiler/timing/RestrictVertexShaderTiming.h" |
| 8 | |
| 9 | void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node) |
| 10 | { |
| 11 | if (node->getQualifier() == EvqUniform && |
| 12 | node->getBasicType() == EbtSampler2D && |
| 13 | node->getSymbol() == mRestrictedSymbol) { |
| 14 | mFoundRestrictedSymbol = true; |
| 15 | mSink.prefix(EPrefixError); |
| 16 | mSink.location(node->getLine()); |
| 17 | mSink << "Definition of a uniform sampler2D by the name '" << mRestrictedSymbol |
| 18 | << "' is not permitted in vertex shaders.\n"; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | bool RestrictVertexShaderTiming::visitAggregate(Visit visit, TIntermAggregate* node) |
| 23 | { |
| 24 | // Don't keep exploring if we've found the restricted symbol, and don't explore anything besides |
| 25 | // the global scope (i.e. don't explore function definitions). |
| 26 | if (mFoundRestrictedSymbol || node->getOp() == EOpFunction) |
| 27 | return false; |
| 28 | |
| 29 | return true; |
| 30 | } |