alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 1 | // |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 2 | // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 7 | #ifndef COMPILER_VARIABLE_INFO_H_ |
| 8 | #define COMPILER_VARIABLE_INFO_H_ |
| 9 | |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 10 | #include "GLSLANG/ShaderLang.h" |
| 11 | #include "compiler/intermediate.h" |
| 12 | |
| 13 | // Provides information about a variable. |
| 14 | // It is currently being used to store info about active attribs and uniforms. |
| 15 | struct TVariableInfo { |
gman@chromium.org | 8d80479 | 2012-10-17 21:33:48 +0000 | [diff] [blame] | 16 | TVariableInfo(ShDataType type, int size); |
| 17 | TVariableInfo(); |
| 18 | |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 19 | TPersistString name; |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 20 | TPersistString mappedName; |
alokp@chromium.org | 4888ceb | 2010-10-01 21:13:12 +0000 | [diff] [blame] | 21 | ShDataType type; |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 22 | int size; |
| 23 | }; |
| 24 | typedef std::vector<TVariableInfo> TVariableInfoList; |
| 25 | |
| 26 | // Traverses intermediate tree to collect all attributes and uniforms. |
| 27 | class CollectAttribsUniforms : public TIntermTraverser { |
| 28 | public: |
| 29 | CollectAttribsUniforms(TVariableInfoList& attribs, |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame^] | 30 | TVariableInfoList& uniforms, |
| 31 | ShHashFunction64 hashFunction); |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 32 | |
| 33 | virtual void visitSymbol(TIntermSymbol*); |
| 34 | virtual void visitConstantUnion(TIntermConstantUnion*); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 35 | virtual bool visitBinary(Visit, TIntermBinary*); |
| 36 | virtual bool visitUnary(Visit, TIntermUnary*); |
| 37 | virtual bool visitSelection(Visit, TIntermSelection*); |
| 38 | virtual bool visitAggregate(Visit, TIntermAggregate*); |
| 39 | virtual bool visitLoop(Visit, TIntermLoop*); |
| 40 | virtual bool visitBranch(Visit, TIntermBranch*); |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | TVariableInfoList& mAttribs; |
| 44 | TVariableInfoList& mUniforms; |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame^] | 45 | |
| 46 | ShHashFunction64 mHashFunction; |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
daniel@transgaming.com | 5cb728c | 2011-05-17 18:34:24 +0000 | [diff] [blame] | 49 | #endif // COMPILER_VARIABLE_INFO_H_ |