1 // Copyright 2018 The Amber Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef AMBER_SHADER_INFO_H_
16 #define AMBER_SHADER_INFO_H_
17 
18 #include <string>
19 #include <vector>
20 
21 namespace amber {
22 
23 enum ShaderFormat {
24   kShaderFormatDefault = 0,
25   kShaderFormatText,
26   kShaderFormatGlsl,
27   kShaderFormatHlsl,
28   kShaderFormatSpirvAsm,
29   kShaderFormatSpirvHex,
30   kShaderFormatOpenCLC,
31 };
32 
33 enum ShaderType {
34   kShaderTypeCompute = 0,
35   kShaderTypeGeometry,
36   kShaderTypeFragment,
37   kShaderTypeVertex,
38   kShaderTypeTessellationControl,
39   kShaderTypeTessellationEvaluation,
40   kShaderTypeMulti,
41 };
42 
43 /// Stores information for a shader.
44 struct ShaderInfo {
45   /// The format of the shader.
46   ShaderFormat format;
47   /// The type of shader.
48   ShaderType type;
49   /// This is a unique name for this shader. The name is produced from the
50   /// input script, possibly with extra prefix contents. This name, if used
51   /// in the ShaderMap will map to this specific shader.
52   std::string shader_name;
53   /// This is the shader source, the source is in the |format| given above.
54   std::string shader_source;
55   /// A list of SPIR-V optimization passes to execute on the shader.
56   std::vector<std::string> optimizations;
57   /// Target environment for the shader compilation.
58   std::string target_env;
59   /// The shader SPIR-V if it was compiled by Amber
60   std::vector<uint32_t> shader_data;
61 };
62 
63 }  // namespace amber
64 
65 #endif  // AMBER_SHADER_INFO_H_
66