• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2002 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(TCompiler * compiler,TInfoSinkBase & objSink,ShCompileOptions compileOptions)12 TOutputESSL::TOutputESSL(TCompiler *compiler,
13                          TInfoSinkBase &objSink,
14                          ShCompileOptions compileOptions)
15     : TOutputGLSLBase(compiler, objSink, compileOptions)
16 {}
17 
writeVariablePrecision(TPrecision precision)18 bool TOutputESSL::writeVariablePrecision(TPrecision precision)
19 {
20     if (precision == EbpUndefined)
21         return false;
22 
23     if (precision == EbpHigh && !isHighPrecisionSupported())
24     {
25         precision = EbpMedium;
26     }
27 
28     TInfoSinkBase &out = objSink();
29     out << getPrecisionString(precision);
30     return true;
31 }
32 
translateTextureFunction(const ImmutableString & name,const ShCompileOptions & option)33 ImmutableString TOutputESSL::translateTextureFunction(const ImmutableString &name,
34                                                       const ShCompileOptions &option)
35 {
36     // Check WEBGL_video_texture invocation first.
37     if (name == "textureVideoWEBGL")
38     {
39         if (option & SH_TAKE_VIDEO_TEXTURE_AS_EXTERNAL_OES)
40         {
41             // TODO(http://anglebug.com/3889): Implement external image situation.
42             UNIMPLEMENTED();
43             return ImmutableString("");
44         }
45         else
46         {
47             // Default translating textureVideoWEBGL to texture2D.
48             return ImmutableString("texture2D");
49         }
50     }
51 
52     return name;
53 }
54 
55 }  // namespace sh
56