alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2010 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 "GLSLANG/ShaderLang.h" |
| 8 | #include "compiler/intermediate.h" |
| 9 | |
| 10 | // Provides information about a variable. |
| 11 | // It is currently being used to store info about active attribs and uniforms. |
| 12 | struct TVariableInfo { |
| 13 | TPersistString name; |
| 14 | EShDataType type; |
| 15 | int size; |
| 16 | }; |
| 17 | typedef std::vector<TVariableInfo> TVariableInfoList; |
| 18 | |
| 19 | // Traverses intermediate tree to collect all attributes and uniforms. |
| 20 | class CollectAttribsUniforms : public TIntermTraverser { |
| 21 | public: |
| 22 | CollectAttribsUniforms(TVariableInfoList& attribs, |
| 23 | TVariableInfoList& uniforms); |
| 24 | |
| 25 | virtual void visitSymbol(TIntermSymbol*); |
| 26 | virtual void visitConstantUnion(TIntermConstantUnion*); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame^] | 27 | virtual bool visitBinary(Visit, TIntermBinary*); |
| 28 | virtual bool visitUnary(Visit, TIntermUnary*); |
| 29 | virtual bool visitSelection(Visit, TIntermSelection*); |
| 30 | virtual bool visitAggregate(Visit, TIntermAggregate*); |
| 31 | virtual bool visitLoop(Visit, TIntermLoop*); |
| 32 | virtual bool visitBranch(Visit, TIntermBranch*); |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | TVariableInfoList& mAttribs; |
| 36 | TVariableInfoList& mUniforms; |
| 37 | }; |
| 38 | |