Improve GLSL source program support
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / framework / vulkan / vkSpirVProgram.hpp
1 #ifndef _VKSPIRVPROGRAM_HPP
2 #define _VKSPIRVPROGRAM_HPP
3 /*-------------------------------------------------------------------------
4  * Vulkan CTS Framework
5  * --------------------
6  *
7  * Copyright (c) 2015 Google Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief SPIR-V program and binary info.
24  *//*--------------------------------------------------------------------*/
25
26 #include "vkDefs.hpp"
27 #include "deStringUtil.hpp"
28
29 #include <string>
30
31 namespace tcu
32 {
33 class TestLog;
34 } // tcu
35
36 namespace vk
37 {
38
39 struct SpirVAsmSource
40 {
41         SpirVAsmSource (void)
42         {
43         }
44
45         SpirVAsmSource (const std::string& source_)
46                 : source(source_)
47         {
48         }
49
50         std::string             source;
51 };
52
53 struct SpirVProgramInfo
54 {
55         SpirVProgramInfo (void)
56                 : compileTimeUs (0)
57                 , compileOk             (false)
58         {
59         }
60
61         std::string             source;
62         std::string             infoLog;
63         deUint64                compileTimeUs;
64         bool                    compileOk;
65 };
66
67 tcu::TestLog&   operator<<              (tcu::TestLog& log, const SpirVProgramInfo& shaderInfo);
68 tcu::TestLog&   operator<<              (tcu::TestLog& log, const SpirVAsmSource& program);
69
70 // Helper for constructing SpirVAsmSource
71 template<typename T>
72 SpirVAsmSource& operator<< (SpirVAsmSource& src, const T& val)
73 {
74         src.source += de::toString(val);
75         return src;
76 }
77
78 }
79
80 #endif // _VKSPIRVPROGRAM_HPP