LEFT | RIGHT |
1 // | 1 // |
2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. | 2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 // | 5 // |
6 | 6 |
7 #ifndef COMPILER_VARIABLE_INFO_H_ | 7 #ifndef COMPILER_VARIABLE_INFO_H_ |
8 #define COMPILER_VARIABLE_INFO_H_ | 8 #define COMPILER_VARIABLE_INFO_H_ |
9 | 9 |
10 #include "GLSLANG/ShaderLang.h" | 10 #include "GLSLANG/ShaderLang.h" |
11 #include "compiler/intermediate.h" | 11 #include "compiler/intermediate.h" |
12 #include "compiler/SymbolTable.h" | |
13 | 12 |
14 // Provides information about a variable. | 13 // Provides information about a variable. |
15 // It is currently being used to store info about active attribs and uniforms. | 14 // It is currently being used to store info about active attribs and uniforms. |
16 struct TVariableInfo { | 15 struct TVariableInfo { |
17 TPersistString name; | 16 TPersistString name; |
18 TPersistString mappedName; | 17 TPersistString mappedName; |
19 ShDataType type; | 18 ShDataType type; |
20 int size; | 19 int size; |
21 }; | 20 }; |
22 typedef std::vector<TVariableInfo> TVariableInfoList; | 21 typedef std::vector<TVariableInfo> TVariableInfoList; |
23 | 22 |
24 // Traverses intermediate tree to collect all attributes and uniforms. | 23 // Traverses intermediate tree to collect all attributes and uniforms. |
25 class CollectAttribsUniforms : public TIntermTraverser { | 24 class CollectAttribsUniforms : public TIntermTraverser { |
26 public: | 25 public: |
27 CollectAttribsUniforms(TSymbolTable& symbolTable, | 26 CollectAttribsUniforms(TVariableInfoList& attribs, |
28 TVariableInfoList& attribs, | |
29 TVariableInfoList& uniforms); | 27 TVariableInfoList& uniforms); |
30 | 28 |
31 virtual void visitSymbol(TIntermSymbol*); | 29 virtual void visitSymbol(TIntermSymbol*); |
32 virtual void visitConstantUnion(TIntermConstantUnion*); | 30 virtual void visitConstantUnion(TIntermConstantUnion*); |
33 virtual bool visitBinary(Visit, TIntermBinary*); | 31 virtual bool visitBinary(Visit, TIntermBinary*); |
34 virtual bool visitUnary(Visit, TIntermUnary*); | 32 virtual bool visitUnary(Visit, TIntermUnary*); |
35 virtual bool visitSelection(Visit, TIntermSelection*); | 33 virtual bool visitSelection(Visit, TIntermSelection*); |
36 virtual bool visitAggregate(Visit, TIntermAggregate*); | 34 virtual bool visitAggregate(Visit, TIntermAggregate*); |
37 virtual bool visitLoop(Visit, TIntermLoop*); | 35 virtual bool visitLoop(Visit, TIntermLoop*); |
38 virtual bool visitBranch(Visit, TIntermBranch*); | 36 virtual bool visitBranch(Visit, TIntermBranch*); |
39 | 37 |
40 private: | 38 private: |
41 TSymbolTable& mSymbolTable; | |
42 TVariableInfoList& mAttribs; | 39 TVariableInfoList& mAttribs; |
43 TVariableInfoList& mUniforms; | 40 TVariableInfoList& mUniforms; |
44 }; | 41 }; |
45 | 42 |
46 #endif // COMPILER_VARIABLE_INFO_H_ | 43 #endif // COMPILER_VARIABLE_INFO_H_ |
LEFT | RIGHT |