| 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 | |
| 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 | bool TOutputESSL::writeVariablePrecision(TPrecision precision) |
| 34 | { |
| 35 | if (precision == EbpUndefined) |
| 36 | return false; |
| 37 | |
| 38 | TInfoSinkBase &out = objSink(); |
| 39 | if (mForceHighp) |
| 40 | out << getPrecisionString(EbpHigh); |
| 41 | else |
| 42 | out << getPrecisionString(precision); |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | } // namespace sh |
| 47 | |