Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 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 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ |
| 8 | #define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ |
Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 9 | |
Jamie Madill | b9b5c10 | 2014-08-20 17:28:54 -0400 | [diff] [blame] | 10 | #include "compiler/translator/Intermediate.h" |
Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 11 | #include "compiler/translator/SymbolTable.h" |
| 12 | |
| 13 | #include <set> |
| 14 | |
| 15 | class RegenerateStructNames : public TIntermTraverser |
| 16 | { |
| 17 | public: |
| 18 | RegenerateStructNames(const TSymbolTable &symbolTable, |
| 19 | int shaderVersion) |
Olli Etuaho | 3d0d9a4 | 2015-06-01 12:16:36 +0300 | [diff] [blame^] | 20 | : TIntermTraverser(true, false, false), |
| 21 | mSymbolTable(symbolTable), |
Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 22 | mShaderVersion(shaderVersion), |
| 23 | mScopeDepth(0) {} |
| 24 | |
| 25 | protected: |
| 26 | virtual void visitSymbol(TIntermSymbol *); |
| 27 | virtual bool visitAggregate(Visit, TIntermAggregate *); |
| 28 | |
| 29 | private: |
| 30 | const TSymbolTable &mSymbolTable; |
| 31 | int mShaderVersion; |
| 32 | |
| 33 | // Indicating the depth of the current scope. |
| 34 | // The global scope is 1. |
| 35 | int mScopeDepth; |
| 36 | |
| 37 | // If a struct's declared globally, push its ID in this set. |
| 38 | std::set<int> mDeclaredGlobalStructs; |
| 39 | }; |
| 40 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 41 | #endif // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ |