alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2010 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 | |
| 7 | #ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_ |
| 8 | #define CROSSCOMPILERGLSL_OUTPUTGLSL_H_ |
| 9 | |
alokp@chromium.org | 4e89d23 | 2010-05-14 19:37:21 +0000 | [diff] [blame^] | 10 | #include <set> |
| 11 | |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 12 | #include "compiler/intermediate.h" |
| 13 | #include "compiler/ParseHelper.h" |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 14 | |
| 15 | class TOutputGLSL : public TIntermTraverser |
| 16 | { |
| 17 | public: |
alokp@chromium.org | a499cfc | 2010-05-03 23:14:49 +0000 | [diff] [blame] | 18 | TOutputGLSL(TInfoSinkBase& objSink); |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 19 | |
| 20 | protected: |
alokp@chromium.org | a499cfc | 2010-05-03 23:14:49 +0000 | [diff] [blame] | 21 | TInfoSinkBase& objSink() { return mObjSink; } |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 22 | void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr); |
alokp@chromium.org | 194522f | 2010-05-06 19:09:26 +0000 | [diff] [blame] | 23 | void writeVariableType(const TType& type); |
| 24 | void writeFunctionParameters(const TIntermSequence& args); |
alokp@chromium.org | b3f7fb6 | 2010-05-05 18:21:51 +0000 | [diff] [blame] | 25 | const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion); |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 26 | |
| 27 | virtual void visitSymbol(TIntermSymbol* node); |
| 28 | virtual void visitConstantUnion(TIntermConstantUnion* node); |
| 29 | virtual bool visitBinary(Visit visit, TIntermBinary* node); |
| 30 | virtual bool visitUnary(Visit visit, TIntermUnary* node); |
| 31 | virtual bool visitSelection(Visit visit, TIntermSelection* node); |
| 32 | virtual bool visitAggregate(Visit visit, TIntermAggregate* node); |
| 33 | virtual bool visitLoop(Visit visit, TIntermLoop* node); |
| 34 | virtual bool visitBranch(Visit visit, TIntermBranch* node); |
| 35 | |
| 36 | private: |
alokp@chromium.org | a499cfc | 2010-05-03 23:14:49 +0000 | [diff] [blame] | 37 | TInfoSinkBase& mObjSink; |
alokp@chromium.org | b3f7fb6 | 2010-05-05 18:21:51 +0000 | [diff] [blame] | 38 | bool mScopeSequences; |
alokp@chromium.org | 194522f | 2010-05-06 19:09:26 +0000 | [diff] [blame] | 39 | bool mDeclaringVariables; |
alokp@chromium.org | a499cfc | 2010-05-03 23:14:49 +0000 | [diff] [blame] | 40 | |
| 41 | // Structs are declared as the tree is traversed. This set contains all |
| 42 | // the structs already declared. It is maintained so that a struct is |
| 43 | // declared only once. |
| 44 | typedef std::set<TString> DeclaredStructs; |
| 45 | DeclaredStructs mDeclaredStructs; |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | #endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_ |