Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / compiler / translator / VariableInfo.h
1 //
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
4 // found in the LICENSE file.
5 //
6
7 #ifndef COMPILER_VARIABLE_INFO_H_
8 #define COMPILER_VARIABLE_INFO_H_
9
10 #include <GLSLANG/ShaderLang.h>
11
12 #include "compiler/translator/IntermNode.h"
13
14 class TSymbolTable;
15
16 namespace sh
17 {
18
19 // Traverses intermediate tree to collect all attributes, uniforms, varyings.
20 class CollectVariables : public TIntermTraverser
21 {
22   public:
23     CollectVariables(std::vector<Attribute> *attribs,
24                      std::vector<Attribute> *outputVariables,
25                      std::vector<Uniform> *uniforms,
26                      std::vector<Varying> *varyings,
27                      std::vector<InterfaceBlock> *interfaceBlocks,
28                      ShHashFunction64 hashFunction,
29                      const TSymbolTable &symbolTable);
30
31     virtual void visitSymbol(TIntermSymbol *symbol);
32     virtual bool visitAggregate(Visit, TIntermAggregate *node);
33     virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
34
35   private:
36     template <typename VarT>
37     void visitVariable(const TIntermSymbol *variable, std::vector<VarT> *infoList) const;
38
39     template <typename VarT>
40     void visitInfoList(const TIntermSequence &sequence, std::vector<VarT> *infoList) const;
41
42     std::vector<Attribute> *mAttribs;
43     std::vector<Attribute> *mOutputVariables;
44     std::vector<Uniform> *mUniforms;
45     std::vector<Varying> *mVaryings;
46     std::vector<InterfaceBlock> *mInterfaceBlocks;
47
48     std::map<std::string, InterfaceBlockField *> mInterfaceBlockFields;
49
50     bool mPointCoordAdded;
51     bool mFrontFacingAdded;
52     bool mFragCoordAdded;
53
54     bool mPositionAdded;
55     bool mPointSizeAdded;
56
57     ShHashFunction64 mHashFunction;
58
59     const TSymbolTable &mSymbolTable;
60 };
61
62 // Expand struct uniforms to flattened lists of split variables
63 void ExpandUniforms(const std::vector<Uniform> &compact,
64                     std::vector<ShaderVariable> *expanded);
65
66 }
67
68 #endif  // COMPILER_VARIABLE_INFO_H_