blob: b41623aa16efa275b91b72e950dfdb4c2fb10357 [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
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -08009TOutputESSL::TOutputESSL(TInfoSinkBase &objSink,
shannon.woods@transgaming.com1d432bb2013-01-25 21:57:28 +000010 ShArrayIndexClampingStrategy clampingStrategy,
daniel@transgaming.com0aa3b5a2012-11-28 19:43:24 +000011 ShHashFunction64 hashFunction,
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080012 NameMap &nameMap,
13 TSymbolTable &symbolTable,
Olli Etuaho853dc1a2014-11-06 17:25:48 +020014 int shaderVersion,
Qiankun Miao705a9192016-08-29 10:05:27 +080015 bool forceHighp,
16 ShCompileOptions compileOptions)
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080017 : TOutputGLSLBase(objSink,
18 clampingStrategy,
19 hashFunction,
20 nameMap,
21 symbolTable,
22 shaderVersion,
Qiankun Miao705a9192016-08-29 10:05:27 +080023 SH_ESSL_OUTPUT,
24 compileOptions),
Olli Etuaho853dc1a2014-11-06 17:25:48 +020025 mForceHighp(forceHighp)
zmo@google.com5601ea02011-06-10 18:23:25 +000026{
27}
28
29bool TOutputESSL::writeVariablePrecision(TPrecision precision)
30{
31 if (precision == EbpUndefined)
32 return false;
33
34 TInfoSinkBase& out = objSink();
Olli Etuaho853dc1a2014-11-06 17:25:48 +020035 if (mForceHighp)
36 out << getPrecisionString(EbpHigh);
37 else
38 out << getPrecisionString(precision);
zmo@google.com5601ea02011-06-10 18:23:25 +000039 return true;
40}