Fixed multiple issues with struct declaration and construction.
Review URL: http://codereview.appspot.com/1076041
git-svn-id: https://angleproject.googlecode.com/svn/trunk@220 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputGLSL.h b/src/compiler/OutputGLSL.h
index 4dde653..a25ea45 100644
--- a/src/compiler/OutputGLSL.h
+++ b/src/compiler/OutputGLSL.h
@@ -13,12 +13,10 @@
class TOutputGLSL : public TIntermTraverser
{
public:
- TOutputGLSL(TParseContext &context);
-
- void header();
+ TOutputGLSL(TInfoSinkBase& objSink);
protected:
- TInfoSinkBase& objSink() { return parseContext.infoSink.obj; }
+ TInfoSinkBase& objSink() { return mObjSink; }
void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
virtual void visitSymbol(TIntermSymbol* node);
@@ -31,8 +29,14 @@
virtual bool visitBranch(Visit visit, TIntermBranch* node);
private:
- bool writeFullSymbol;
- TParseContext &parseContext;
+ TInfoSinkBase& mObjSink;
+ bool mWriteFullSymbol;
+
+ // Structs are declared as the tree is traversed. This set contains all
+ // the structs already declared. It is maintained so that a struct is
+ // declared only once.
+ typedef std::set<TString> DeclaredStructs;
+ DeclaredStructs mDeclaredStructs;
};
#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_