blob: 2223b03b997d866ed6cf83fdd1b58956923ae79a [file] [log] [blame]
zmo@google.com5601ea02011-06-10 18:23:25 +00001//
Jamie Madill02f20dd2013-09-12 12:07:42 -04002// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
zmo@google.com5601ea02011-06-10 18:23:25 +00003// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
Geoff Lang17732822013-08-29 13:46:49 -04007#include "compiler/translator/OutputESSL.h"
zmo@google.com5601ea02011-06-10 18:23:25 +00008
Jamie Madill45bcc782016-11-07 13:58:48 -05009namespace sh
10{
11
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080012TOutputESSL::TOutputESSL(TInfoSinkBase &objSink,
shannon.woods@transgaming.com1d432bb2013-01-25 21:57:28 +000013 ShArrayIndexClampingStrategy clampingStrategy,
daniel@transgaming.com0aa3b5a2012-11-28 19:43:24 +000014 ShHashFunction64 hashFunction,
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080015 NameMap &nameMap,
16 TSymbolTable &symbolTable,
Olli Etuaho853dc1a2014-11-06 17:25:48 +020017 int shaderVersion,
Qiankun Miao705a9192016-08-29 10:05:27 +080018 bool forceHighp,
19 ShCompileOptions compileOptions)
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080020 : TOutputGLSLBase(objSink,
21 clampingStrategy,
22 hashFunction,
23 nameMap,
24 symbolTable,
25 shaderVersion,
Qiankun Miao705a9192016-08-29 10:05:27 +080026 SH_ESSL_OUTPUT,
27 compileOptions),
Olli Etuaho853dc1a2014-11-06 17:25:48 +020028 mForceHighp(forceHighp)
zmo@google.com5601ea02011-06-10 18:23:25 +000029{
30}
31
32bool TOutputESSL::writeVariablePrecision(TPrecision precision)
33{
34 if (precision == EbpUndefined)
35 return false;
36
37 TInfoSinkBase& out = objSink();
Olli Etuaho853dc1a2014-11-06 17:25:48 +020038 if (mForceHighp)
39 out << getPrecisionString(EbpHigh);
40 else
41 out << getPrecisionString(precision);
zmo@google.com5601ea02011-06-10 18:23:25 +000042 return true;
43}
Jamie Madill45bcc782016-11-07 13:58:48 -050044
45} // namespace sh