zenilib: zenilib/jni/external/angle/src/compiler/OutputGLSLBase.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OutputGLSLBase.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2002-2011 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_OUTPUTGLSLBASE_H_
8 #define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
9
10 #include <set>
11
12 #include "compiler/ForLoopUnroll.h"
13 #include "compiler/intermediate.h"
14 #include "compiler/ParseHelper.h"
15
16 class TOutputGLSLBase : public TIntermTraverser
17 {
18 public:
19 TOutputGLSLBase(TInfoSinkBase& objSink,
20 ShArrayIndexClampingStrategy clampingStrategy,
21 ShHashFunction64 hashFunction,
22 NameMap& nameMap,
23 TSymbolTable& symbolTable);
24
25 protected:
26 TInfoSinkBase& objSink() { return mObjSink; }
27 void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
28 void writeVariableType(const TType& type);
29 virtual bool writeVariablePrecision(TPrecision precision) = 0;
30 void writeFunctionParameters(const TIntermSequence& args);
31 const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
32 TString getTypeName(const TType& type);
33
34 virtual void visitSymbol(TIntermSymbol* node);
35 virtual void visitConstantUnion(TIntermConstantUnion* node);
36 virtual bool visitBinary(Visit visit, TIntermBinary* node);
37 virtual bool visitUnary(Visit visit, TIntermUnary* node);
38 virtual bool visitSelection(Visit visit, TIntermSelection* node);
39 virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
40 virtual bool visitLoop(Visit visit, TIntermLoop* node);
41 virtual bool visitBranch(Visit visit, TIntermBranch* node);
42
43 void visitCodeBlock(TIntermNode* node);
44
45
46 // Return the original name if hash function pointer is NULL;
47 // otherwise return the hashed name.
48 TString hashName(const TString& name);
49 // Same as hashName(), but without hashing built-in variables.
50 TString hashVariableName(const TString& name);
51 // Same as hashName(), but without hashing built-in functions.
52 TString hashFunctionName(const TString& mangled_name);
53
54 private:
55 bool structDeclared(const TStructure* structure) const;
56 void declareStruct(const TStructure* structure);
57
58 TInfoSinkBase& mObjSink;
59 bool mDeclaringVariables;
60
61 // Structs are declared as the tree is traversed. This set contains all
62 // the structs already declared. It is maintained so that a struct is
63 // declared only once.
64 typedef std::set<TString> DeclaredStructs;
65 DeclaredStructs mDeclaredStructs;
66
67 ForLoopUnroll mLoopUnroll;
68
69 ShArrayIndexClampingStrategy mClampingStrategy;
70
71 // name hashing.
72 ShHashFunction64 mHashFunction;
73
74 NameMap& mNameMap;
75
76 TSymbolTable& mSymbolTable;
77 };
78
79 #endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
TOutputGLSLBase::objSink
TInfoSinkBase & objSink()
Definition: OutputGLSLBase.h:26
TOutputGLSLBase::writeVariableType
void writeVariableType(const TType &type)
Definition: OutputGLSLBase.cpp:74
Visit
Visit
Definition: intermediate.h:524
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
TOutputGLSLBase::TOutputGLSLBase
TOutputGLSLBase(TInfoSinkBase &objSink, ShArrayIndexClampingStrategy clampingStrategy, ShHashFunction64 hashFunction, NameMap &nameMap, TSymbolTable &symbolTable)
Definition: OutputGLSLBase.cpp:42
ShHashFunction64
khronos_uint64_t(* ShHashFunction64)(const char *, size_t)
Definition: ShaderLang.h:197
TOutputGLSLBase::hashVariableName
TString hashVariableName(const TString &name)
Definition: OutputGLSLBase.cpp:778
TSymbolTable
Definition: SymbolTable.h:237
NameMap
std::map< TPersistString, TPersistString > NameMap
Definition: HashNames.h:17
TOutputGLSLBase::visitSelection
virtual bool visitSelection(Visit visit, TIntermSelection *node)
Definition: OutputGLSLBase.cpp:414
intermediate.h
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
TOutputGLSLBase::hashFunctionName
TString hashFunctionName(const TString &mangled_name)
Definition: OutputGLSLBase.cpp:785
TType
Definition: Types.h:93
TOutputGLSLBase::visitAggregate
virtual bool visitAggregate(Visit visit, TIntermAggregate *node)
Definition: OutputGLSLBase.cpp:451
TIntermAggregate
Definition: intermediate.h:460
TIntermBinary
Definition: intermediate.h:404
ShArrayIndexClampingStrategy
ShArrayIndexClampingStrategy
Definition: ShaderLang.h:175
TIntermSelection
Definition: intermediate.h:503
TOutputGLSLBase::getTypeName
TString getTypeName(const TType &type)
Definition: OutputGLSLBase.cpp:737
TInfoSinkBase
Definition: InfoSink.h:38
ParseHelper.h
TOutputGLSLBase::visitConstantUnion
virtual void visitConstantUnion(TIntermConstantUnion *node)
Definition: OutputGLSLBase.cpp:171
TOutputGLSLBase::visitCodeBlock
void visitCodeBlock(TIntermNode *node)
Definition: OutputGLSLBase.cpp:721
TOutputGLSLBase
Definition: OutputGLSLBase.h:16
TIntermBranch
Definition: intermediate.h:321
TOutputGLSLBase::hashName
TString hashName(const TString &name)
Definition: OutputGLSLBase.cpp:766
ConstantUnion
Definition: ConstantUnion.h:12
TIntermTraverser
Definition: intermediate.h:539
TOutputGLSLBase::visitSymbol
virtual void visitSymbol(TIntermSymbol *node)
Definition: OutputGLSLBase.cpp:159
TOutputGLSLBase::writeFunctionParameters
void writeFunctionParameters(const TIntermSequence &args)
Definition: OutputGLSLBase.cpp:94
ForLoopUnroll.h
TOutputGLSLBase::visitLoop
virtual bool visitLoop(Visit visit, TIntermLoop *node)
Definition: OutputGLSLBase.cpp:637
TString
std::basic_string< char, std::char_traits< char >, TStringAllocator > TString
Definition: Common.h:41
TIntermSymbol
Definition: intermediate.h:340
TOutputGLSLBase::visitBranch
virtual bool visitBranch(Visit visit, TIntermBranch *node)
Definition: OutputGLSLBase.cpp:707
TIntermLoop
Definition: intermediate.h:284
TOutputGLSLBase::writeTriplet
void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr)
Definition: OutputGLSLBase.cpp:57
TOutputGLSLBase::visitBinary
virtual bool visitBinary(Visit visit, TIntermBinary *node)
Definition: OutputGLSLBase.cpp:176
TIntermUnary
Definition: intermediate.h:431
TVector< TIntermNode * >
TPrecision
TPrecision
Definition: BaseTypes.h:13
TIntermNode
Definition: intermediate.h:206
TOutputGLSLBase::writeVariablePrecision
virtual bool writeVariablePrecision(TPrecision precision)=0
TStructure
Definition: Types.h:45
precision
GLenum GLint GLint * precision
Definition: glew.h:3391
TOutputGLSLBase::writeConstantUnion
const ConstantUnion * writeConstantUnion(const TType &type, const ConstantUnion *pConstUnion)
Definition: OutputGLSLBase.cpp:118
ForLoopUnroll
Definition: ForLoopUnroll.h:18
TIntermConstantUnion
Definition: intermediate.h:365
TOutputGLSLBase::visitUnary
virtual bool visitUnary(Visit visit, TIntermUnary *node)
Definition: OutputGLSLBase.cpp:322