1 //
2 // Copyright (c) 2002-2013 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 #include "compiler/translator/OutputESSL.h"
8
9 namespace sh
10 {
11
TOutputESSL(TInfoSinkBase & objSink,ShArrayIndexClampingStrategy clampingStrategy,ShHashFunction64 hashFunction,NameMap & nameMap,TSymbolTable * symbolTable,sh::GLenum shaderType,int shaderVersion,bool forceHighp,ShCompileOptions compileOptions)12 TOutputESSL::TOutputESSL(TInfoSinkBase &objSink,
13 ShArrayIndexClampingStrategy clampingStrategy,
14 ShHashFunction64 hashFunction,
15 NameMap &nameMap,
16 TSymbolTable *symbolTable,
17 sh::GLenum shaderType,
18 int shaderVersion,
19 bool forceHighp,
20 ShCompileOptions compileOptions)
21 : TOutputGLSLBase(objSink,
22 clampingStrategy,
23 hashFunction,
24 nameMap,
25 symbolTable,
26 shaderType,
27 shaderVersion,
28 SH_ESSL_OUTPUT,
29 compileOptions),
30 mForceHighp(forceHighp)
31 {
32 }
33
writeVariablePrecision(TPrecision precision)34 bool TOutputESSL::writeVariablePrecision(TPrecision precision)
35 {
36 if (precision == EbpUndefined)
37 return false;
38
39 TInfoSinkBase &out = objSink();
40 if (mForceHighp)
41 out << getPrecisionString(EbpHigh);
42 else
43 out << getPrecisionString(precision);
44 return true;
45 }
46
47 } // namespace sh
48