Initialize all output variables.
BUG=angleproject:1441
TEST=bots
Change-Id: Ia4cf415d8346c3234bf0f548a178ee3ea8cd35c4
Reviewed-on: https://chromium-review.googlesource.com/362110
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/InitializeVariables.h b/src/compiler/translator/InitializeVariables.h
index 2a141ec..f826032 100644
--- a/src/compiler/translator/InitializeVariables.h
+++ b/src/compiler/translator/InitializeVariables.h
@@ -7,45 +7,12 @@
#ifndef COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_
#define COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_
-#include "compiler/translator/IntermNode.h"
+#include <GLSLANG/ShaderLang.h>
-class InitializeVariables : public TIntermTraverser
-{
- public:
- struct InitVariableInfo
- {
- TString name;
- TType type;
+class TIntermNode;
- InitVariableInfo(const TString &_name, const TType &_type)
- : name(_name),
- type(_type)
- {
- }
- };
- typedef TVector<InitVariableInfo> InitVariableInfoList;
+typedef std::vector<sh::ShaderVariable> InitVariableList;
- InitializeVariables(const InitVariableInfoList &vars)
- : TIntermTraverser(true, false, false),
- mVariables(vars),
- mCodeInserted(false)
- {
- }
-
- protected:
- bool visitBinary(Visit, TIntermBinary *node) override { return false; }
- bool visitUnary(Visit, TIntermUnary *node) override { return false; }
- bool visitSelection(Visit, TIntermSelection *node) override { return false; }
- bool visitLoop(Visit, TIntermLoop *node) override { return false; }
- bool visitBranch(Visit, TIntermBranch *node) override { return false; }
-
- bool visitAggregate(Visit visit, TIntermAggregate *node) override;
-
- private:
- void insertInitCode(TIntermSequence *sequence);
-
- InitVariableInfoList mVariables;
- bool mCodeInserted;
-};
+void InitializeVariables(TIntermNode *root, const InitVariableList &vars);
#endif // COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_