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 () { return 0; } 36 37 template <typename TYPE> Serializevksc_server::CompileShaderRequest38 void Serialize (Serializer<TYPE>& archive) { archive.SerializeObject(source); archive.Serialize(commandLine); } 39 }; 40 41 struct CompileShaderResponse 42 { 43 bool status{}; 44 vector<u8> binary; 45 Typevksc_server::CompileShaderResponse46 static constexpr u32 Type() { return 1; } 47 48 template <typename TYPE> Serializevksc_server::CompileShaderResponse49 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(status, binary); } 50 }; 51 52 struct StoreContentRequest 53 { 54 string name; 55 vector<u8> data; 56 Typevksc_server::StoreContentRequest57 static constexpr u32 Type() { return 2; } 58 59 template <typename TYPE> Serializevksc_server::StoreContentRequest60 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(name, data); } 61 }; 62 63 struct StoreContentResponse 64 { 65 bool status{}; 66 Typevksc_server::StoreContentResponse67 static constexpr u32 Type() { return 3; } 68 69 template <typename TYPE> Serializevksc_server::StoreContentResponse70 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(status); } 71 }; 72 73 struct AppendRequest 74 { 75 string fileName; 76 vector<u8> data; 77 bool clear{}; 78 Typevksc_server::AppendRequest79 static constexpr u32 Type() { return 4; } 80 81 template <typename TYPE> Serializevksc_server::AppendRequest82 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(fileName, data, clear); } 83 }; 84 85 struct GetContentRequest 86 { 87 string path; 88 bool physicalFile{}; 89 bool removeAfter{}; 90 Typevksc_server::GetContentRequest91 static constexpr u32 Type() { return 5; } 92 93 template <typename TYPE> Serializevksc_server::GetContentRequest94 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(path, physicalFile, removeAfter); } 95 }; 96 97 struct GetContentResponse 98 { 99 bool status{}; 100 vector<u8> data; 101 Typevksc_server::GetContentResponse102 static constexpr u32 Type() { return 6; } 103 104 template <typename TYPE> Serializevksc_server::GetContentResponse105 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(status, data); } 106 }; 107 108 struct CreateCacheRequest 109 { 110 VulkanPipelineCacheInput input; 111 s32 caseFraction; Typevksc_server::CreateCacheRequest112 static constexpr u32 Type() { return 7; } 113 114 template <typename TYPE> Serializevksc_server::CreateCacheRequest115 void Serialize (Serializer<TYPE>& archive) 116 { 117 archive.SerializeObject(input); 118 archive.Serialize(caseFraction); 119 } 120 }; 121 122 struct CreateCacheResponse 123 { 124 bool status{}; 125 vector<u8> binary; Typevksc_server::CreateCacheResponse126 static constexpr u32 Type() { return 8; } 127 128 template <typename TYPE> Serializevksc_server::CreateCacheResponse129 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(status, binary); } 130 }; 131 132 struct LogRequest 133 { 134 s32 type; 135 string message; 136 Typevksc_server::LogRequest137 static constexpr u32 Type() { return 9; } 138 139 template <typename TYPE> Serializevksc_server::LogRequest140 void Serialize (Serializer<TYPE>& archive) { archive.Serialize(type, message); } 141 }; 142 143 } 144 145 #endif // _VKSPROTOCOL_HPP 146