blob: 8c2c33a3056fe6de97ce83fd94fc8c35f9bf87df [file] [log] [blame]
alokp@chromium.org76b82082010-03-24 17:59:39 +00001//
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
daniel@transgaming.combbf56f72010-04-20 18:52:13 +000010#include "compiler/intermediate.h"
11#include "compiler/ParseHelper.h"
alokp@chromium.org76b82082010-03-24 17:59:39 +000012
13class TOutputGLSL : public TIntermTraverser
14{
15public:
alokp@chromium.orga499cfc2010-05-03 23:14:49 +000016 TOutputGLSL(TInfoSinkBase& objSink);
alokp@chromium.org76b82082010-03-24 17:59:39 +000017
18protected:
alokp@chromium.orga499cfc2010-05-03 23:14:49 +000019 TInfoSinkBase& objSink() { return mObjSink; }
alokp@chromium.org76b82082010-03-24 17:59:39 +000020 void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
alokp@chromium.orgb3f7fb62010-05-05 18:21:51 +000021 const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
alokp@chromium.org76b82082010-03-24 17:59:39 +000022
23 virtual void visitSymbol(TIntermSymbol* node);
24 virtual void visitConstantUnion(TIntermConstantUnion* node);
25 virtual bool visitBinary(Visit visit, TIntermBinary* node);
26 virtual bool visitUnary(Visit visit, TIntermUnary* node);
27 virtual bool visitSelection(Visit visit, TIntermSelection* node);
28 virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
29 virtual bool visitLoop(Visit visit, TIntermLoop* node);
30 virtual bool visitBranch(Visit visit, TIntermBranch* node);
31
32private:
alokp@chromium.orga499cfc2010-05-03 23:14:49 +000033 TInfoSinkBase& mObjSink;
34 bool mWriteFullSymbol;
alokp@chromium.orgb3f7fb62010-05-05 18:21:51 +000035 bool mScopeSequences;
alokp@chromium.orga499cfc2010-05-03 23:14:49 +000036
37 // Structs are declared as the tree is traversed. This set contains all
38 // the structs already declared. It is maintained so that a struct is
39 // declared only once.
40 typedef std::set<TString> DeclaredStructs;
41 DeclaredStructs mDeclaredStructs;
alokp@chromium.org76b82082010-03-24 17:59:39 +000042};
43
44#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_