zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TranslatorESSL.cpp
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 
8 
9 #include "compiler/OutputESSL.h"
10 
12  : TCompiler(type, spec) {
13 }
14 
17 
18  // Write built-in extension behaviors.
19  writeExtensionBehavior();
20 
21  // Write emulated built-in functions if needed.
24 
25  // Write array bounds clamping emulation if needed.
27 
28  // Write translated shader.
30  root->traverse(&outputESSL);
31 }
32 
33 void TranslatorESSL::writeExtensionBehavior() {
35  const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
36  for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
37  iter != extensionBehavior.end(); ++iter) {
38  if (iter->second != EBhUndefined) {
39  sink << "#extension " << iter->first << " : "
40  << getBehaviorString(iter->second) << "\n";
41  }
42  }
43 }
TSymbolTable & getSymbolTable()
Definition: ShHandle.h:77
GLsizei GLenum GLboolean sink
Definition: glew.h:4448
std::map< std::string, TBehavior > TExtensionBehavior
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
ShShaderType getShaderType() const
Definition: ShHandle.h:80
const BuiltInFunctionEmulator & getBuiltInFunctionEmulator() const
Definition: Compiler.cpp:405
const ArrayBoundsClamper & getArrayBoundsClamper() const
Definition: Compiler.cpp:395
TInfoSink & getInfoSink()
Definition: ShHandle.h:70
ShHashFunction64 getHashFunction() const
Definition: ShHandle.h:75
ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const
Definition: Compiler.cpp:400
TranslatorESSL(ShShaderType type, ShShaderSpec spec)
virtual void traverse(TIntermTraverser *)=0
const TExtensionBehavior & getExtensionBehavior() const
Definition: Compiler.cpp:385
void OutputClampingFunctionDefinition(TInfoSinkBase &out) const
virtual void translate(TIntermNode *root)
ShShaderType
Definition: ShaderLang.h:48
ShShaderSpec
Definition: ShaderLang.h:53
TInfoSinkBase obj
Definition: InfoSink.h:112
const char * getBehaviorString(TBehavior b)
NameMap & getNameMap()
Definition: ShHandle.h:76
void OutputEmulatedFunctionDefinition(TInfoSinkBase &out, bool withPrecision) const