blob: a9101351ec08876f6b8a5d89916855ad268904b4 [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
Geoff Lang0a73dd82014-11-19 16:18:08 -05007#ifndef COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
8#define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
Zhenyao Moe740add2014-07-18 17:01:01 -07009
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)
Olli Etuaho3d0d9a42015-06-01 12:16:36 +030020 : TIntermTraverser(true, false, false),
21 mSymbolTable(symbolTable),
Zhenyao Moe740add2014-07-18 17:01:01 -070022 mShaderVersion(shaderVersion),
23 mScopeDepth(0) {}
24
25 protected:
Corentin Walleze5a1f272015-08-21 02:58:25 +020026 void visitSymbol(TIntermSymbol *) override;
Olli Etuaho6d40bbd2016-09-30 13:49:38 +010027 bool visitBlock(Visit, TIntermBlock *block) override;
Zhenyao Moe740add2014-07-18 17:01:01 -070028
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 Lang0a73dd82014-11-19 16:18:08 -050041#endif // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_