1 #ifndef _VKSPROTOCOL_HPP 2 #define _VKSPROTOCOL_HPP 3 4 /*------------------------------------------------------------------------- 5 * Vulkan CTS Framework 6 * -------------------- 7 * 8 * Copyright (c) 2021 The Khronos Group Inc. 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 *-------------------------------------------------------------------------*/ 23 24 #include "vksSerializerVKSC.hpp" 25 #include "vksStructsVKSC.hpp" 26 27 namespace vksc_server 28 { 29 30 struct CompileShaderRequest 31 { 32 SourceVariant source; 33 string commandLine{}; 34 Typevksc_server::CompileShaderRequest35 static constexpr u32 Type() 36 { 37 return 0; 38 } 39 40 template <typename TYPE> Serializevksc_server::CompileShaderRequest41 void Serialize(Serializer<TYPE> &archive) 42 { 43 archive.SerializeObject(source); 44 archive.Serialize(commandLine); 45 } 46 }; 47 48 struct CompileShaderResponse 49 { 50 bool status{}; 51 vector<u8> binary; 52 Typevksc_server::CompileShaderResponse53 static constexpr u32 Type() 54 { 55 return 1; 56 } 57 58 template <typename TYPE> Serializevksc_server::CompileShaderResponse59 void Serialize(Serializer<TYPE> &archive) 60 { 61 archive.Serialize(status, binary); 62 } 63 }; 64 65 struct StoreContentRequest 66 { 67 string name; 68 vector<u8> data; 69 Typevksc_server::StoreContentRequest70 static constexpr u32 Type() 71 { 72 return 2; 73 } 74 75 template <typename TYPE> Serializevksc_server::StoreContentRequest76 void Serialize(Serializer<TYPE> &archive) 77 { 78 archive.Serialize(name, data); 79 } 80 }; 81 82 struct StoreContentResponse 83 { 84 bool status{}; 85 Typevksc_server::StoreContentResponse86 static constexpr u32 Type() 87 { 88 return 3; 89 } 90 91 template <typename TYPE> Serializevksc_server::StoreContentResponse92 void Serialize(Serializer<TYPE> &archive) 93 { 94 archive.Serialize(status); 95 } 96 }; 97 98 struct AppendRequest 99 { 100 string fileName; 101 vector<u8> data; 102 bool clear{}; 103 Typevksc_server::AppendRequest104 static constexpr u32 Type() 105 { 106 return 4; 107 } 108 109 template <typename TYPE> Serializevksc_server::AppendRequest110 void Serialize(Serializer<TYPE> &archive) 111 { 112 archive.Serialize(fileName, data, clear); 113 } 114 }; 115 116 struct GetContentRequest 117 { 118 string path; 119 bool physicalFile{}; 120 bool removeAfter{}; 121 Typevksc_server::GetContentRequest122 static constexpr u32 Type() 123 { 124 return 5; 125 } 126 127 template <typename TYPE> Serializevksc_server::GetContentRequest128 void Serialize(Serializer<TYPE> &archive) 129 { 130 archive.Serialize(path, physicalFile, removeAfter); 131 } 132 }; 133 134 struct GetContentResponse 135 { 136 bool status{}; 137 vector<u8> data; 138 Typevksc_server::GetContentResponse139 static constexpr u32 Type() 140 { 141 return 6; 142 } 143 144 template <typename TYPE> Serializevksc_server::GetContentResponse145 void Serialize(Serializer<TYPE> &archive) 146 { 147 archive.Serialize(status, data); 148 } 149 }; 150 151 struct CreateCacheRequest 152 { 153 VulkanPipelineCacheInput input; 154 s32 caseFraction; Typevksc_server::CreateCacheRequest155 static constexpr u32 Type() 156 { 157 return 7; 158 } 159 160 template <typename TYPE> Serializevksc_server::CreateCacheRequest161 void Serialize(Serializer<TYPE> &archive) 162 { 163 archive.SerializeObject(input); 164 archive.Serialize(caseFraction); 165 } 166 }; 167 168 struct CreateCacheResponse 169 { 170 bool status{}; 171 vector<u8> binary; Typevksc_server::CreateCacheResponse172 static constexpr u32 Type() 173 { 174 return 8; 175 } 176 177 template <typename TYPE> Serializevksc_server::CreateCacheResponse178 void Serialize(Serializer<TYPE> &archive) 179 { 180 archive.Serialize(status, binary); 181 } 182 }; 183 184 struct LogRequest 185 { 186 s32 type; 187 string message; 188 Typevksc_server::LogRequest189 static constexpr u32 Type() 190 { 191 return 9; 192 } 193 194 template <typename TYPE> Serializevksc_server::LogRequest195 void Serialize(Serializer<TYPE> &archive) 196 { 197 archive.Serialize(type, message); 198 } 199 }; 200 201 } // namespace vksc_server 202 203 #endif // _VKSPROTOCOL_HPP 204