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