blob: e55d6c544ff4152cbd12edabf7e67f6dea8edee5 [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,
Qiankun Miao89dd8f32016-11-09 12:59:30 +000017 sh::GLenum shaderType,
Olli Etuaho853dc1a2014-11-06 17:25:48 +020018 int shaderVersion,
Qiankun Miao705a9192016-08-29 10:05:27 +080019 bool forceHighp,
20 ShCompileOptions compileOptions)
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080021 : TOutputGLSLBase(objSink,
22 clampingStrategy,
23 hashFunction,
24 nameMap,
25 symbolTable,
Qiankun Miao89dd8f32016-11-09 12:59:30 +000026 shaderType,
Zhenyao Mo05b6b7f2015-03-02 17:08:09 -080027 shaderVersion,
Qiankun Miao705a9192016-08-29 10:05:27 +080028 SH_ESSL_OUTPUT,
29 compileOptions),
Olli Etuaho853dc1a2014-11-06 17:25:48 +020030 mForceHighp(forceHighp)
zmo@google.com5601ea02011-06-10 18:23:25 +000031{
32}
33
34bool TOutputESSL::writeVariablePrecision(TPrecision precision)
35{
36 if (precision == EbpUndefined)
37 return false;
38
39 TInfoSinkBase& out = objSink();
Olli Etuaho853dc1a2014-11-06 17:25:48 +020040 if (mForceHighp)
41 out << getPrecisionString(EbpHigh);
42 else
43 out << getPrecisionString(precision);
zmo@google.com5601ea02011-06-10 18:23:25 +000044 return true;
45}
Jamie Madill45bcc782016-11-07 13:58:48 -050046
47} // namespace sh