1 //
2 // Copyright (c) 2014 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 // Compiler.h: Defines the gl::Compiler class, abstracting the ESSL compiler
8 // that a GL context holds.
9 
10 #ifndef LIBANGLE_COMPILER_H_
11 #define LIBANGLE_COMPILER_H_
12 
13 #include "GLSLANG/ShaderLang.h"
14 #include "libANGLE/Error.h"
15 #include "libANGLE/RefCountObject.h"
16 
17 namespace rx
18 {
19 class CompilerImpl;
20 class GLImplFactory;
21 }
22 
23 namespace gl
24 {
25 class ContextState;
26 
27 class Compiler final : public RefCountObjectNoID
28 {
29   public:
30     Compiler(rx::GLImplFactory *implFactory, const ContextState &data);
31 
32     ShHandle getCompilerHandle(GLenum type);
getShaderOutputType()33     ShShaderOutput getShaderOutputType() const { return mOutputType; }
34     const std::string &getBuiltinResourcesString(GLenum type);
35 
36   private:
37     ~Compiler() override;
38     std::unique_ptr<rx::CompilerImpl> mImplementation;
39     ShShaderSpec mSpec;
40     ShShaderOutput mOutputType;
41     ShBuiltInResources mResources;
42 
43     ShHandle mFragmentCompiler;
44     ShHandle mVertexCompiler;
45     ShHandle mComputeCompiler;
46     ShHandle mGeometryCompiler;
47 };
48 
49 }  // namespace gl
50 
51 #endif // LIBANGLE_COMPILER_H_
52