Upstream version 5.34.104.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 #include "compiler/translator/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 {
16     TVariableInfo(ShDataType type, int size);
17     TVariableInfo();
18
19     TPersistString name;
20     TPersistString mappedName;
21     ShDataType type;
22     int size;
23     bool isArray;
24     TPrecision precision;
25     bool staticUse;
26 };
27 typedef std::vector<TVariableInfo> TVariableInfoList;
28
29 // Traverses intermediate tree to collect all attributes, uniforms, varyings.
30 class CollectVariables : public TIntermTraverser {
31 public:
32     CollectVariables(TVariableInfoList& attribs,
33                      TVariableInfoList& uniforms,
34                      TVariableInfoList& varyings,
35                      ShHashFunction64 hashFunction);
36
37     virtual void visitSymbol(TIntermSymbol*);
38     virtual bool visitAggregate(Visit, TIntermAggregate*);
39
40 private:
41     TVariableInfoList& mAttribs;
42     TVariableInfoList& mUniforms;
43     TVariableInfoList& mVaryings;
44
45     bool mPointCoordAdded;
46     bool mFrontFacingAdded;
47     bool mFragCoordAdded;
48
49     ShHashFunction64 mHashFunction;
50 };
51
52 #endif  // COMPILER_VARIABLE_INFO_H_