Line data Source code
1 : //
2 : // Copyright (c) 2002-2014 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_TRANSLATOR_REGENERATESTRUCTNAMES_H_
8 : #define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
9 :
10 : #include "compiler/translator/Intermediate.h"
11 : #include "compiler/translator/SymbolTable.h"
12 :
13 : #include <set>
14 :
15 : namespace sh
16 : {
17 :
18 0 : class RegenerateStructNames : public TIntermTraverser
19 : {
20 : public:
21 0 : RegenerateStructNames(const TSymbolTable &symbolTable,
22 : int shaderVersion)
23 0 : : TIntermTraverser(true, false, false),
24 : mSymbolTable(symbolTable),
25 : mShaderVersion(shaderVersion),
26 0 : mScopeDepth(0) {}
27 :
28 : protected:
29 : void visitSymbol(TIntermSymbol *) override;
30 : bool visitBlock(Visit, TIntermBlock *block) override;
31 :
32 : private:
33 : const TSymbolTable &mSymbolTable;
34 : int mShaderVersion;
35 :
36 : // Indicating the depth of the current scope.
37 : // The global scope is 1.
38 : int mScopeDepth;
39 :
40 : // If a struct's declared globally, push its ID in this set.
41 : std::set<int> mDeclaredGlobalStructs;
42 : };
43 :
44 : } // namespace sh
45 :
46 : #endif // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
|