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 @@ ...@@ -13,12 +13,10 @@
class TOutputGLSL : public TIntermTraverser class TOutputGLSL : public TIntermTraverser
{ {
public: public:
TOutputGLSL(TParseContext &context); TOutputGLSL(TInfoSinkBase& objSink);
void header();
protected: protected:
TInfoSinkBase& objSink() { return parseContext.infoSink.obj; } TInfoSinkBase& objSink() { return mObjSink; }
void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr); void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
virtual void visitSymbol(TIntermSymbol* node); virtual void visitSymbol(TIntermSymbol* node);
...@@ -31,8 +29,14 @@ protected: ...@@ -31,8 +29,14 @@ protected:
virtual bool visitBranch(Visit visit, TIntermBranch* node); virtual bool visitBranch(Visit visit, TIntermBranch* node);
private: private:
bool writeFullSymbol; TInfoSinkBase& mObjSink;
TParseContext &parseContext; 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_ #endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
...@@ -14,10 +14,8 @@ TranslatorGLSL::TranslatorGLSL(EShLanguage l, int dOptions) ...@@ -14,10 +14,8 @@ TranslatorGLSL::TranslatorGLSL(EShLanguage l, int dOptions)
} }
bool TranslatorGLSL::compile(TIntermNode* root) { bool TranslatorGLSL::compile(TIntermNode* root) {
TParseContext& parseContext = *GetGlobalParseContext(); TOutputGLSL outputGLSL(infoSink.obj);
TOutputGLSL outputGLSL(parseContext); root->traverse(&outputGLSL);
outputGLSL.header();
parseContext.treeRoot->traverse(&outputGLSL);
return true; 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