initial import
[vuplus_webkit] / Source / ThirdParty / ANGLE / src / compiler / MapLongVariableNames.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_MAP_LONG_VARIABLE_NAMES_H_
8 #define COMPILER_MAP_LONG_VARIABLE_NAMES_H_
9
10 #include "GLSLANG/ShaderLang.h"
11
12 #include "compiler/intermediate.h"
13 #include "compiler/VariableInfo.h"
14
15 // This size does not include '\0' in the end.
16 #define MAX_IDENTIFIER_NAME_SIZE 32
17
18 // Traverses intermediate tree to map attributes and uniforms names that are
19 // longer than MAX_IDENTIFIER_NAME_SIZE to MAX_IDENTIFIER_NAME_SIZE.
20 class MapLongVariableNames : public TIntermTraverser {
21 public:
22     MapLongVariableNames(TMap<TString, TString>& varyingLongNameMap);
23
24     virtual void visitSymbol(TIntermSymbol*);
25     virtual void visitConstantUnion(TIntermConstantUnion*);
26     virtual bool visitBinary(Visit, TIntermBinary*);
27     virtual bool visitUnary(Visit, TIntermUnary*);
28     virtual bool visitSelection(Visit, TIntermSelection*);
29     virtual bool visitAggregate(Visit, TIntermAggregate*);
30     virtual bool visitLoop(Visit, TIntermLoop*);
31     virtual bool visitBranch(Visit, TIntermBranch*);
32
33 private:
34     TString mapVaryingLongName(const TString& name);
35
36     TMap<TString, TString>& mVaryingLongNameMap;
37 };
38
39 #endif  // COMPILER_MAP_LONG_VARIABLE_NAMES_H_