Home | History | Annotate | Download | only in translator
      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_REGENERATE_STRUCT_NAMES_H_
      8 #define COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
      9 
     10 #include "compiler/translator/Intermediate.h"
     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)
     20         : mSymbolTable(symbolTable),
     21           mShaderVersion(shaderVersion),
     22           mScopeDepth(0) {}
     23 
     24   protected:
     25     virtual void visitSymbol(TIntermSymbol *);
     26     virtual bool visitAggregate(Visit, TIntermAggregate *);
     27 
     28   private:
     29     const TSymbolTable &mSymbolTable;
     30     int mShaderVersion;
     31 
     32     // Indicating the depth of the current scope.
     33     // The global scope is 1.
     34     int mScopeDepth;
     35 
     36     // If a struct's declared globally, push its ID in this set.
     37     std::set<int> mDeclaredGlobalStructs;
     38 };
     39 
     40 #endif  // COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
     41