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 <cstdint>
19 #include <string>
20 #include <vector>
21 
22 namespace amber {
23 
24 enum ShaderFormat {
25   kShaderFormatDefault = 0,
26   kShaderFormatText,
27   kShaderFormatGlsl,
28   kShaderFormatHlsl,
29   kShaderFormatSpirvAsm,
30   kShaderFormatSpirvHex,
31   kShaderFormatOpenCLC,
32 };
33 
34 enum ShaderType {
35   kShaderTypeCompute = 0,
36   kShaderTypeGeometry,
37   kShaderTypeFragment,
38   kShaderTypeVertex,
39   kShaderTypeTessellationControl,
40   kShaderTypeTessellationEvaluation,
41   kShaderTypeMulti,
42 };
43 
44 /// Stores information for a shader.
45 struct ShaderInfo {
46   /// The format of the shader.
47   ShaderFormat format;
48   /// The type of shader.
49   ShaderType type;
50   /// This is a unique name for this shader. The name is produced from the
51   /// input script, possibly with extra prefix contents. This name, if used
52   /// in the ShaderMap will map to this specific shader.
53   std::string shader_name;
54   /// This is the shader source, the source is in the |format| given above.
55   std::string shader_source;
56   /// A list of SPIR-V optimization passes to execute on the shader.
57   std::vector<std::string> optimizations;
58   /// Target environment for the shader compilation.
59   std::string target_env;
60   /// The shader SPIR-V if it was compiled by Amber
61   std::vector<uint32_t> shader_data;
62 };
63 
64 }  // namespace amber
65 
66 #endif  // AMBER_SHADER_INFO_H_
67