Commit a499cfc5 by alokp@chromium.org

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
parent 2986a8cb
......@@ -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 @@ protected:
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_
......@@ -14,10 +14,8 @@ TranslatorGLSL::TranslatorGLSL(EShLanguage l, int dOptions)
}
bool TranslatorGLSL::compile(TIntermNode* root) {
TParseContext& parseContext = *GetGlobalParseContext();
TOutputGLSL outputGLSL(parseContext);
outputGLSL.header();
parseContext.treeRoot->traverse(&outputGLSL);
TOutputGLSL outputGLSL(infoSink.obj);
root->traverse(&outputGLSL);
return true;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment