blob: 130dc8e1bbd2e57e2c2774a06dd87b09f2746b0a [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.org194522f2010-05-06 19:09:26 +000021 void writeVariableType(const TType& type);
22 void writeFunctionParameters(const TIntermSequence& args);
alokp@chromium.orgb3f7fb62010-05-05 18:21:51 +000023 const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
alokp@chromium.org76b82082010-03-24 17:59:39 +000024
25 virtual void visitSymbol(TIntermSymbol* node);
26 virtual void visitConstantUnion(TIntermConstantUnion* node);
27 virtual bool visitBinary(Visit visit, TIntermBinary* node);
28 virtual bool visitUnary(Visit visit, TIntermUnary* node);
29 virtual bool visitSelection(Visit visit, TIntermSelection* node);
30 virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
31 virtual bool visitLoop(Visit visit, TIntermLoop* node);
32 virtual bool visitBranch(Visit visit, TIntermBranch* node);
33
34private:
alokp@chromium.orga499cfc2010-05-03 23:14:49 +000035 TInfoSinkBase& mObjSink;
alokp@chromium.orgb3f7fb62010-05-05 18:21:51 +000036 bool mScopeSequences;
alokp@chromium.org194522f2010-05-06 19:09:26 +000037 bool mDeclaringVariables;
alokp@chromium.orga499cfc2010-05-03 23:14:49 +000038
39 // Structs are declared as the tree is traversed. This set contains all
40 // the structs already declared. It is maintained so that a struct is
41 // declared only once.
42 typedef std::set<TString> DeclaredStructs;
43 DeclaredStructs mDeclaredStructs;
alokp@chromium.org76b82082010-03-24 17:59:39 +000044};
45
46#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_