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 SpirVAsmBuildOptions 40 { 41 SpirvVersion targetVersion; 42 SpirVAsmBuildOptionsvk::SpirVAsmBuildOptions43 SpirVAsmBuildOptions (SpirvVersion targetVersion_) 44 : targetVersion (targetVersion_) 45 {} 46 SpirVAsmBuildOptionsvk::SpirVAsmBuildOptions47 SpirVAsmBuildOptions (void) 48 : targetVersion (SPIRV_VERSION_1_0) 49 {} 50 }; 51 52 struct SpirVAsmSource 53 { SpirVAsmSourcevk::SpirVAsmSource54 SpirVAsmSource (void) 55 { 56 } 57 SpirVAsmSourcevk::SpirVAsmSource58 SpirVAsmSource (const std::string& source_) 59 : source(source_) 60 { 61 } 62 operator <<vk::SpirVAsmSource63 SpirVAsmSource& operator<< (const SpirVAsmBuildOptions& buildOptions_) 64 { 65 buildOptions = buildOptions_; 66 return *this; 67 }; 68 69 SpirVAsmBuildOptions buildOptions; 70 std::string source; 71 }; 72 73 struct SpirVProgramInfo 74 { SpirVProgramInfovk::SpirVProgramInfo75 SpirVProgramInfo (void) 76 : compileTimeUs (0) 77 , compileOk (false) 78 { 79 } 80 81 std::string source; 82 std::string infoLog; 83 deUint64 compileTimeUs; 84 bool compileOk; 85 }; 86 87 tcu::TestLog& operator<< (tcu::TestLog& log, const SpirVProgramInfo& shaderInfo); 88 tcu::TestLog& operator<< (tcu::TestLog& log, const SpirVAsmSource& program); 89 90 // Helper for constructing SpirVAsmSource 91 template<typename T> operator <<(SpirVAsmSource & src,const T & val)92SpirVAsmSource& operator<< (SpirVAsmSource& src, const T& val) 93 { 94 src.source += de::toString(val); 95 return src; 96 } 97 98 } 99 100 #endif // _VKSPIRVPROGRAM_HPP 101