blob: ac87600347590f620aab7ce4686b304acd02b658 [file] [log] [blame]
Zhenyao Moe740add2014-07-18 17:01:01 -07001//
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
Jamie Madillb9b5c102014-08-20 17:28:54 -040010#include "compiler/translator/Intermediate.h"
Zhenyao Moe740add2014-07-18 17:01:01 -070011#include "compiler/translator/SymbolTable.h"
12
13#include <set>
14
15class 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_