1 #ifndef _GLCSPIRVUTILS_HPP
2 #define _GLCSPIRVUTILS_HPP
3 /*-------------------------------------------------------------------------
4 * OpenGL Conformance Test Suite
5 * -----------------------------
7 * Copyright (c) 2017-2019 The Khronos Group Inc.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * \file glcSpirvUtils.hpp
23 * \brief Utility functions for using Glslang and Spirv-tools to work with
25 */ /*-------------------------------------------------------------------*/
26 #include "glcContext.hpp"
27 #include "gluShaderProgram.hpp"
33 typedef std::map<std::string, std::vector<std::string> > SpirVMapping;
40 SPIRV_VERSION_1_0 = 0, //!< SPIR-V 1.0
41 SPIRV_VERSION_1_1 = 1, //!< SPIR-V 1.1
42 SPIRV_VERSION_1_2 = 2, //!< SPIR-V 1.2
43 SPIRV_VERSION_1_3 = 3, //!< SPIR-V 1.3
48 void checkGlSpirvSupported(deqp::Context& m_context);
50 glu::ShaderBinary makeSpirV(tcu::TestLog& log, glu::ShaderSource source, SpirvVersion version = SPIRV_VERSION_1_0);
52 void spirvAssemble(glu::ShaderBinaryDataType& dst, const std::string& src);
53 void spirvDisassemble(std::string& dst, const glu::ShaderBinaryDataType& src);
54 bool spirvValidate(glu::ShaderBinaryDataType& dst, bool throwOnError);
56 bool verifyMappings(std::string glslSource, std::string spirVSource, SpirVMapping& mappings, bool anyOf);
60 #endif // _GLCSPIRVUTILS_HPP