• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 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 // GlslangWrapper: Wrapper for Vulkan's glslang compiler.
7 //
8 
9 #ifndef LIBANGLE_RENDERER_VULKAN_GLSLANG_WRAPPER_H_
10 #define LIBANGLE_RENDERER_VULKAN_GLSLANG_WRAPPER_H_
11 
12 #include "libANGLE/renderer/ProgramImpl.h"
13 #include "libANGLE/renderer/vulkan/vk_utils.h"
14 
15 namespace rx
16 {
17 // This class currently holds no state. If we want to hold state we would need to solve the
18 // potential race conditions with multiple threads.
19 class GlslangWrapper
20 {
21   public:
22     static void Initialize();
23     static void Release();
24 
25     static void GetShaderSource(const gl::ProgramState &programState,
26                                 const gl::ProgramLinkedResources &resources,
27                                 gl::ShaderMap<std::string> *shaderSourcesOut);
28 
29     static angle::Result GetShaderCode(vk::Context *context,
30                                        const gl::Caps &glCaps,
31                                        bool enableLineRasterEmulation,
32                                        bool enableSubgroupOps,
33                                        const gl::ShaderMap<std::string> &shaderSources,
34                                        gl::ShaderMap<std::vector<uint32_t>> *shaderCodesOut);
35 
36   private:
37     static angle::Result GetShaderCodeImpl(vk::Context *context,
38                                            const gl::Caps &glCaps,
39                                            bool enableSubgroupOps,
40                                            const gl::ShaderMap<std::string> &shaderSources,
41                                            gl::ShaderMap<std::vector<uint32_t>> *shaderCodesOut);
42 };
43 }  // namespace rx
44 
45 #endif  // LIBANGLE_RENDERER_VULKAN_GLSLANG_WRAPPER_H_
46