• 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 // GlslangWrapperVk: 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/glslang_wrapper_utils.h"
14 #include "libANGLE/renderer/vulkan/vk_utils.h"
15 
16 namespace angle
17 {
18 struct FeaturesVk;
19 }  // namespace angle
20 
21 namespace rx
22 {
23 // This class currently holds no state. If we want to hold state we would need to solve the
24 // potential race conditions with multiple threads.
25 class GlslangWrapperVk
26 {
27   public:
28     static GlslangSourceOptions CreateSourceOptions(const angle::FeaturesVk &features);
29 
30     static void ResetGlslangProgramInterfaceInfo(
31         GlslangProgramInterfaceInfo *glslangProgramInterfaceInfo);
32 
33     static void GetShaderSource(const angle::FeaturesVk &features,
34                                 const gl::ProgramState &programState,
35                                 const gl::ProgramLinkedResources &resources,
36                                 GlslangProgramInterfaceInfo *programInterfaceInfo,
37                                 gl::ShaderMap<std::string> *shaderSourcesOut,
38                                 ShaderMapInterfaceVariableInfoMap *variableInfoMapOut);
39 
40     static angle::Result GetShaderCode(vk::Context *context,
41                                        const gl::Caps &glCaps,
42                                        const gl::ShaderMap<std::string> &shaderSources,
43                                        const ShaderMapInterfaceVariableInfoMap &variableInfoMap,
44                                        gl::ShaderMap<std::vector<uint32_t>> *shaderCodesOut);
45 
46     static angle::Result TransformSpirV(vk::Context *context,
47                                         const gl::ShaderType shaderType,
48                                         bool removeEarlyFragmentTestsOptimization,
49                                         const ShaderInterfaceVariableInfoMap &variableInfoMap,
50                                         const SpirvBlob &initialSpirvBlob,
51                                         SpirvBlob *shaderCodeOut);
52 };
53 }  // namespace rx
54 
55 #endif  // LIBANGLE_RENDERER_VULKAN_GLSLANG_WRAPPER_H_
56