1bf215546Sopenharmony_ci/* This file is generated by venus-protocol. See vn_protocol_driver.h. */ 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ci/* 4bf215546Sopenharmony_ci * Copyright 2020 Google LLC 5bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT 6bf215546Sopenharmony_ci */ 7bf215546Sopenharmony_ci 8bf215546Sopenharmony_ci#ifndef VN_PROTOCOL_DRIVER_INSTANCE_H 9bf215546Sopenharmony_ci#define VN_PROTOCOL_DRIVER_INSTANCE_H 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ci#include "vn_instance.h" 12bf215546Sopenharmony_ci#include "vn_protocol_driver_structs.h" 13bf215546Sopenharmony_ci 14bf215546Sopenharmony_ci/* 15bf215546Sopenharmony_ci * These structs/unions/commands are not included 16bf215546Sopenharmony_ci * 17bf215546Sopenharmony_ci * vkGetInstanceProcAddr 18bf215546Sopenharmony_ci */ 19bf215546Sopenharmony_ci 20bf215546Sopenharmony_ci/* struct VkApplicationInfo chain */ 21bf215546Sopenharmony_ci 22bf215546Sopenharmony_cistatic inline size_t 23bf215546Sopenharmony_civn_sizeof_VkApplicationInfo_pnext(const void *val) 24bf215546Sopenharmony_ci{ 25bf215546Sopenharmony_ci /* no known/supported struct */ 26bf215546Sopenharmony_ci return vn_sizeof_simple_pointer(NULL); 27bf215546Sopenharmony_ci} 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_cistatic inline size_t 30bf215546Sopenharmony_civn_sizeof_VkApplicationInfo_self(const VkApplicationInfo *val) 31bf215546Sopenharmony_ci{ 32bf215546Sopenharmony_ci size_t size = 0; 33bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 34bf215546Sopenharmony_ci if (val->pApplicationName) { 35bf215546Sopenharmony_ci const size_t string_size = strlen(val->pApplicationName) + 1; 36bf215546Sopenharmony_ci size += vn_sizeof_array_size(string_size); 37bf215546Sopenharmony_ci size += vn_sizeof_char_array(val->pApplicationName, string_size); 38bf215546Sopenharmony_ci } else { 39bf215546Sopenharmony_ci size += vn_sizeof_array_size(0); 40bf215546Sopenharmony_ci } 41bf215546Sopenharmony_ci size += vn_sizeof_uint32_t(&val->applicationVersion); 42bf215546Sopenharmony_ci if (val->pEngineName) { 43bf215546Sopenharmony_ci const size_t string_size = strlen(val->pEngineName) + 1; 44bf215546Sopenharmony_ci size += vn_sizeof_array_size(string_size); 45bf215546Sopenharmony_ci size += vn_sizeof_char_array(val->pEngineName, string_size); 46bf215546Sopenharmony_ci } else { 47bf215546Sopenharmony_ci size += vn_sizeof_array_size(0); 48bf215546Sopenharmony_ci } 49bf215546Sopenharmony_ci size += vn_sizeof_uint32_t(&val->engineVersion); 50bf215546Sopenharmony_ci size += vn_sizeof_uint32_t(&val->apiVersion); 51bf215546Sopenharmony_ci return size; 52bf215546Sopenharmony_ci} 53bf215546Sopenharmony_ci 54bf215546Sopenharmony_cistatic inline size_t 55bf215546Sopenharmony_civn_sizeof_VkApplicationInfo(const VkApplicationInfo *val) 56bf215546Sopenharmony_ci{ 57bf215546Sopenharmony_ci size_t size = 0; 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_ci size += vn_sizeof_VkStructureType(&val->sType); 60bf215546Sopenharmony_ci size += vn_sizeof_VkApplicationInfo_pnext(val->pNext); 61bf215546Sopenharmony_ci size += vn_sizeof_VkApplicationInfo_self(val); 62bf215546Sopenharmony_ci 63bf215546Sopenharmony_ci return size; 64bf215546Sopenharmony_ci} 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_cistatic inline void 67bf215546Sopenharmony_civn_encode_VkApplicationInfo_pnext(struct vn_cs_encoder *enc, const void *val) 68bf215546Sopenharmony_ci{ 69bf215546Sopenharmony_ci /* no known/supported struct */ 70bf215546Sopenharmony_ci vn_encode_simple_pointer(enc, NULL); 71bf215546Sopenharmony_ci} 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_cistatic inline void 74bf215546Sopenharmony_civn_encode_VkApplicationInfo_self(struct vn_cs_encoder *enc, const VkApplicationInfo *val) 75bf215546Sopenharmony_ci{ 76bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 77bf215546Sopenharmony_ci if (val->pApplicationName) { 78bf215546Sopenharmony_ci const size_t string_size = strlen(val->pApplicationName) + 1; 79bf215546Sopenharmony_ci vn_encode_array_size(enc, string_size); 80bf215546Sopenharmony_ci vn_encode_char_array(enc, val->pApplicationName, string_size); 81bf215546Sopenharmony_ci } else { 82bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 83bf215546Sopenharmony_ci } 84bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &val->applicationVersion); 85bf215546Sopenharmony_ci if (val->pEngineName) { 86bf215546Sopenharmony_ci const size_t string_size = strlen(val->pEngineName) + 1; 87bf215546Sopenharmony_ci vn_encode_array_size(enc, string_size); 88bf215546Sopenharmony_ci vn_encode_char_array(enc, val->pEngineName, string_size); 89bf215546Sopenharmony_ci } else { 90bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 91bf215546Sopenharmony_ci } 92bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &val->engineVersion); 93bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &val->apiVersion); 94bf215546Sopenharmony_ci} 95bf215546Sopenharmony_ci 96bf215546Sopenharmony_cistatic inline void 97bf215546Sopenharmony_civn_encode_VkApplicationInfo(struct vn_cs_encoder *enc, const VkApplicationInfo *val) 98bf215546Sopenharmony_ci{ 99bf215546Sopenharmony_ci assert(val->sType == VK_STRUCTURE_TYPE_APPLICATION_INFO); 100bf215546Sopenharmony_ci vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_APPLICATION_INFO }); 101bf215546Sopenharmony_ci vn_encode_VkApplicationInfo_pnext(enc, val->pNext); 102bf215546Sopenharmony_ci vn_encode_VkApplicationInfo_self(enc, val); 103bf215546Sopenharmony_ci} 104bf215546Sopenharmony_ci 105bf215546Sopenharmony_ci/* struct VkInstanceCreateInfo chain */ 106bf215546Sopenharmony_ci 107bf215546Sopenharmony_cistatic inline size_t 108bf215546Sopenharmony_civn_sizeof_VkInstanceCreateInfo_pnext(const void *val) 109bf215546Sopenharmony_ci{ 110bf215546Sopenharmony_ci /* no known/supported struct */ 111bf215546Sopenharmony_ci return vn_sizeof_simple_pointer(NULL); 112bf215546Sopenharmony_ci} 113bf215546Sopenharmony_ci 114bf215546Sopenharmony_cistatic inline size_t 115bf215546Sopenharmony_civn_sizeof_VkInstanceCreateInfo_self(const VkInstanceCreateInfo *val) 116bf215546Sopenharmony_ci{ 117bf215546Sopenharmony_ci size_t size = 0; 118bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 119bf215546Sopenharmony_ci size += vn_sizeof_VkFlags(&val->flags); 120bf215546Sopenharmony_ci size += vn_sizeof_simple_pointer(val->pApplicationInfo); 121bf215546Sopenharmony_ci if (val->pApplicationInfo) 122bf215546Sopenharmony_ci size += vn_sizeof_VkApplicationInfo(val->pApplicationInfo); 123bf215546Sopenharmony_ci size += vn_sizeof_uint32_t(&val->enabledLayerCount); 124bf215546Sopenharmony_ci if (val->ppEnabledLayerNames) { 125bf215546Sopenharmony_ci size += vn_sizeof_array_size(val->enabledLayerCount); 126bf215546Sopenharmony_ci for (uint32_t i = 0; i < val->enabledLayerCount; i++) { 127bf215546Sopenharmony_ci const size_t string_size = strlen(val->ppEnabledLayerNames[i]) + 1; 128bf215546Sopenharmony_ci size += vn_sizeof_array_size(string_size); 129bf215546Sopenharmony_ci size += vn_sizeof_char_array(val->ppEnabledLayerNames[i], string_size); 130bf215546Sopenharmony_ci } 131bf215546Sopenharmony_ci } else { 132bf215546Sopenharmony_ci size += vn_sizeof_array_size(0); 133bf215546Sopenharmony_ci } 134bf215546Sopenharmony_ci size += vn_sizeof_uint32_t(&val->enabledExtensionCount); 135bf215546Sopenharmony_ci if (val->ppEnabledExtensionNames) { 136bf215546Sopenharmony_ci size += vn_sizeof_array_size(val->enabledExtensionCount); 137bf215546Sopenharmony_ci for (uint32_t i = 0; i < val->enabledExtensionCount; i++) { 138bf215546Sopenharmony_ci const size_t string_size = strlen(val->ppEnabledExtensionNames[i]) + 1; 139bf215546Sopenharmony_ci size += vn_sizeof_array_size(string_size); 140bf215546Sopenharmony_ci size += vn_sizeof_char_array(val->ppEnabledExtensionNames[i], string_size); 141bf215546Sopenharmony_ci } 142bf215546Sopenharmony_ci } else { 143bf215546Sopenharmony_ci size += vn_sizeof_array_size(0); 144bf215546Sopenharmony_ci } 145bf215546Sopenharmony_ci return size; 146bf215546Sopenharmony_ci} 147bf215546Sopenharmony_ci 148bf215546Sopenharmony_cistatic inline size_t 149bf215546Sopenharmony_civn_sizeof_VkInstanceCreateInfo(const VkInstanceCreateInfo *val) 150bf215546Sopenharmony_ci{ 151bf215546Sopenharmony_ci size_t size = 0; 152bf215546Sopenharmony_ci 153bf215546Sopenharmony_ci size += vn_sizeof_VkStructureType(&val->sType); 154bf215546Sopenharmony_ci size += vn_sizeof_VkInstanceCreateInfo_pnext(val->pNext); 155bf215546Sopenharmony_ci size += vn_sizeof_VkInstanceCreateInfo_self(val); 156bf215546Sopenharmony_ci 157bf215546Sopenharmony_ci return size; 158bf215546Sopenharmony_ci} 159bf215546Sopenharmony_ci 160bf215546Sopenharmony_cistatic inline void 161bf215546Sopenharmony_civn_encode_VkInstanceCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val) 162bf215546Sopenharmony_ci{ 163bf215546Sopenharmony_ci /* no known/supported struct */ 164bf215546Sopenharmony_ci vn_encode_simple_pointer(enc, NULL); 165bf215546Sopenharmony_ci} 166bf215546Sopenharmony_ci 167bf215546Sopenharmony_cistatic inline void 168bf215546Sopenharmony_civn_encode_VkInstanceCreateInfo_self(struct vn_cs_encoder *enc, const VkInstanceCreateInfo *val) 169bf215546Sopenharmony_ci{ 170bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 171bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &val->flags); 172bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, val->pApplicationInfo)) 173bf215546Sopenharmony_ci vn_encode_VkApplicationInfo(enc, val->pApplicationInfo); 174bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &val->enabledLayerCount); 175bf215546Sopenharmony_ci if (val->ppEnabledLayerNames) { 176bf215546Sopenharmony_ci vn_encode_array_size(enc, val->enabledLayerCount); 177bf215546Sopenharmony_ci for (uint32_t i = 0; i < val->enabledLayerCount; i++) { 178bf215546Sopenharmony_ci const size_t string_size = strlen(val->ppEnabledLayerNames[i]) + 1; 179bf215546Sopenharmony_ci vn_encode_array_size(enc, string_size); 180bf215546Sopenharmony_ci vn_encode_char_array(enc, val->ppEnabledLayerNames[i], string_size); 181bf215546Sopenharmony_ci } 182bf215546Sopenharmony_ci } else { 183bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 184bf215546Sopenharmony_ci } 185bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &val->enabledExtensionCount); 186bf215546Sopenharmony_ci if (val->ppEnabledExtensionNames) { 187bf215546Sopenharmony_ci vn_encode_array_size(enc, val->enabledExtensionCount); 188bf215546Sopenharmony_ci for (uint32_t i = 0; i < val->enabledExtensionCount; i++) { 189bf215546Sopenharmony_ci const size_t string_size = strlen(val->ppEnabledExtensionNames[i]) + 1; 190bf215546Sopenharmony_ci vn_encode_array_size(enc, string_size); 191bf215546Sopenharmony_ci vn_encode_char_array(enc, val->ppEnabledExtensionNames[i], string_size); 192bf215546Sopenharmony_ci } 193bf215546Sopenharmony_ci } else { 194bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 195bf215546Sopenharmony_ci } 196bf215546Sopenharmony_ci} 197bf215546Sopenharmony_ci 198bf215546Sopenharmony_cistatic inline void 199bf215546Sopenharmony_civn_encode_VkInstanceCreateInfo(struct vn_cs_encoder *enc, const VkInstanceCreateInfo *val) 200bf215546Sopenharmony_ci{ 201bf215546Sopenharmony_ci assert(val->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO); 202bf215546Sopenharmony_ci vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO }); 203bf215546Sopenharmony_ci vn_encode_VkInstanceCreateInfo_pnext(enc, val->pNext); 204bf215546Sopenharmony_ci vn_encode_VkInstanceCreateInfo_self(enc, val); 205bf215546Sopenharmony_ci} 206bf215546Sopenharmony_ci 207bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) 208bf215546Sopenharmony_ci{ 209bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateInstance_EXT; 210bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 211bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 212bf215546Sopenharmony_ci 213bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pCreateInfo); 214bf215546Sopenharmony_ci if (pCreateInfo) 215bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkInstanceCreateInfo(pCreateInfo); 216bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pAllocator); 217bf215546Sopenharmony_ci if (pAllocator) 218bf215546Sopenharmony_ci assert(false); 219bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pInstance); 220bf215546Sopenharmony_ci if (pInstance) 221bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkInstance(pInstance); 222bf215546Sopenharmony_ci 223bf215546Sopenharmony_ci return cmd_size; 224bf215546Sopenharmony_ci} 225bf215546Sopenharmony_ci 226bf215546Sopenharmony_cistatic inline void vn_encode_vkCreateInstance(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) 227bf215546Sopenharmony_ci{ 228bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateInstance_EXT; 229bf215546Sopenharmony_ci 230bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 231bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 232bf215546Sopenharmony_ci 233bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pCreateInfo)) 234bf215546Sopenharmony_ci vn_encode_VkInstanceCreateInfo(enc, pCreateInfo); 235bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pAllocator)) 236bf215546Sopenharmony_ci assert(false); 237bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pInstance)) 238bf215546Sopenharmony_ci vn_encode_VkInstance(enc, pInstance); 239bf215546Sopenharmony_ci} 240bf215546Sopenharmony_ci 241bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkCreateInstance_reply(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) 242bf215546Sopenharmony_ci{ 243bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateInstance_EXT; 244bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ci VkResult ret; 247bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 248bf215546Sopenharmony_ci /* skip pCreateInfo */ 249bf215546Sopenharmony_ci /* skip pAllocator */ 250bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pInstance); 251bf215546Sopenharmony_ci if (pInstance) 252bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkInstance(pInstance); 253bf215546Sopenharmony_ci 254bf215546Sopenharmony_ci return cmd_size; 255bf215546Sopenharmony_ci} 256bf215546Sopenharmony_ci 257bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkCreateInstance_reply(struct vn_cs_decoder *dec, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) 258bf215546Sopenharmony_ci{ 259bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 260bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 261bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkCreateInstance_EXT); 262bf215546Sopenharmony_ci 263bf215546Sopenharmony_ci VkResult ret; 264bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 265bf215546Sopenharmony_ci /* skip pCreateInfo */ 266bf215546Sopenharmony_ci /* skip pAllocator */ 267bf215546Sopenharmony_ci if (vn_decode_simple_pointer(dec)) { 268bf215546Sopenharmony_ci vn_decode_VkInstance(dec, pInstance); 269bf215546Sopenharmony_ci } else { 270bf215546Sopenharmony_ci pInstance = NULL; 271bf215546Sopenharmony_ci } 272bf215546Sopenharmony_ci 273bf215546Sopenharmony_ci return ret; 274bf215546Sopenharmony_ci} 275bf215546Sopenharmony_ci 276bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) 277bf215546Sopenharmony_ci{ 278bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyInstance_EXT; 279bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 280bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 281bf215546Sopenharmony_ci 282bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkInstance(&instance); 283bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pAllocator); 284bf215546Sopenharmony_ci if (pAllocator) 285bf215546Sopenharmony_ci assert(false); 286bf215546Sopenharmony_ci 287bf215546Sopenharmony_ci return cmd_size; 288bf215546Sopenharmony_ci} 289bf215546Sopenharmony_ci 290bf215546Sopenharmony_cistatic inline void vn_encode_vkDestroyInstance(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkInstance instance, const VkAllocationCallbacks* pAllocator) 291bf215546Sopenharmony_ci{ 292bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyInstance_EXT; 293bf215546Sopenharmony_ci 294bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 295bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 296bf215546Sopenharmony_ci 297bf215546Sopenharmony_ci vn_encode_VkInstance(enc, &instance); 298bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pAllocator)) 299bf215546Sopenharmony_ci assert(false); 300bf215546Sopenharmony_ci} 301bf215546Sopenharmony_ci 302bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkDestroyInstance_reply(VkInstance instance, const VkAllocationCallbacks* pAllocator) 303bf215546Sopenharmony_ci{ 304bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyInstance_EXT; 305bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 306bf215546Sopenharmony_ci 307bf215546Sopenharmony_ci /* skip instance */ 308bf215546Sopenharmony_ci /* skip pAllocator */ 309bf215546Sopenharmony_ci 310bf215546Sopenharmony_ci return cmd_size; 311bf215546Sopenharmony_ci} 312bf215546Sopenharmony_ci 313bf215546Sopenharmony_cistatic inline void vn_decode_vkDestroyInstance_reply(struct vn_cs_decoder *dec, VkInstance instance, const VkAllocationCallbacks* pAllocator) 314bf215546Sopenharmony_ci{ 315bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 316bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 317bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkDestroyInstance_EXT); 318bf215546Sopenharmony_ci 319bf215546Sopenharmony_ci /* skip instance */ 320bf215546Sopenharmony_ci /* skip pAllocator */ 321bf215546Sopenharmony_ci} 322bf215546Sopenharmony_ci 323bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkEnumerateInstanceVersion(uint32_t* pApiVersion) 324bf215546Sopenharmony_ci{ 325bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT; 326bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 327bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 328bf215546Sopenharmony_ci 329bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pApiVersion); /* out */ 330bf215546Sopenharmony_ci 331bf215546Sopenharmony_ci return cmd_size; 332bf215546Sopenharmony_ci} 333bf215546Sopenharmony_ci 334bf215546Sopenharmony_cistatic inline void vn_encode_vkEnumerateInstanceVersion(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, uint32_t* pApiVersion) 335bf215546Sopenharmony_ci{ 336bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT; 337bf215546Sopenharmony_ci 338bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 339bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 340bf215546Sopenharmony_ci 341bf215546Sopenharmony_ci vn_encode_simple_pointer(enc, pApiVersion); /* out */ 342bf215546Sopenharmony_ci} 343bf215546Sopenharmony_ci 344bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkEnumerateInstanceVersion_reply(uint32_t* pApiVersion) 345bf215546Sopenharmony_ci{ 346bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT; 347bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 348bf215546Sopenharmony_ci 349bf215546Sopenharmony_ci VkResult ret; 350bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 351bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pApiVersion); 352bf215546Sopenharmony_ci if (pApiVersion) 353bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(pApiVersion); 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci return cmd_size; 356bf215546Sopenharmony_ci} 357bf215546Sopenharmony_ci 358bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkEnumerateInstanceVersion_reply(struct vn_cs_decoder *dec, uint32_t* pApiVersion) 359bf215546Sopenharmony_ci{ 360bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 361bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 362bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT); 363bf215546Sopenharmony_ci 364bf215546Sopenharmony_ci VkResult ret; 365bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 366bf215546Sopenharmony_ci if (vn_decode_simple_pointer(dec)) { 367bf215546Sopenharmony_ci vn_decode_uint32_t(dec, pApiVersion); 368bf215546Sopenharmony_ci } else { 369bf215546Sopenharmony_ci pApiVersion = NULL; 370bf215546Sopenharmony_ci } 371bf215546Sopenharmony_ci 372bf215546Sopenharmony_ci return ret; 373bf215546Sopenharmony_ci} 374bf215546Sopenharmony_ci 375bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties) 376bf215546Sopenharmony_ci{ 377bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT; 378bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 379bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 380bf215546Sopenharmony_ci 381bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pPropertyCount); 382bf215546Sopenharmony_ci if (pPropertyCount) 383bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(pPropertyCount); 384bf215546Sopenharmony_ci if (pProperties) { 385bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0)); 386bf215546Sopenharmony_ci for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++) 387bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkLayerProperties_partial(&pProperties[i]); 388bf215546Sopenharmony_ci } else { 389bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 390bf215546Sopenharmony_ci } 391bf215546Sopenharmony_ci 392bf215546Sopenharmony_ci return cmd_size; 393bf215546Sopenharmony_ci} 394bf215546Sopenharmony_ci 395bf215546Sopenharmony_cistatic inline void vn_encode_vkEnumerateInstanceLayerProperties(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, uint32_t* pPropertyCount, VkLayerProperties* pProperties) 396bf215546Sopenharmony_ci{ 397bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT; 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 400bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 401bf215546Sopenharmony_ci 402bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pPropertyCount)) 403bf215546Sopenharmony_ci vn_encode_uint32_t(enc, pPropertyCount); 404bf215546Sopenharmony_ci if (pProperties) { 405bf215546Sopenharmony_ci vn_encode_array_size(enc, (pPropertyCount ? *pPropertyCount : 0)); 406bf215546Sopenharmony_ci for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++) 407bf215546Sopenharmony_ci vn_encode_VkLayerProperties_partial(enc, &pProperties[i]); 408bf215546Sopenharmony_ci } else { 409bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 410bf215546Sopenharmony_ci } 411bf215546Sopenharmony_ci} 412bf215546Sopenharmony_ci 413bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkEnumerateInstanceLayerProperties_reply(uint32_t* pPropertyCount, VkLayerProperties* pProperties) 414bf215546Sopenharmony_ci{ 415bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT; 416bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 417bf215546Sopenharmony_ci 418bf215546Sopenharmony_ci VkResult ret; 419bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 420bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pPropertyCount); 421bf215546Sopenharmony_ci if (pPropertyCount) 422bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(pPropertyCount); 423bf215546Sopenharmony_ci if (pProperties) { 424bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0)); 425bf215546Sopenharmony_ci for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++) 426bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkLayerProperties(&pProperties[i]); 427bf215546Sopenharmony_ci } else { 428bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 429bf215546Sopenharmony_ci } 430bf215546Sopenharmony_ci 431bf215546Sopenharmony_ci return cmd_size; 432bf215546Sopenharmony_ci} 433bf215546Sopenharmony_ci 434bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkEnumerateInstanceLayerProperties_reply(struct vn_cs_decoder *dec, uint32_t* pPropertyCount, VkLayerProperties* pProperties) 435bf215546Sopenharmony_ci{ 436bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 437bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 438bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT); 439bf215546Sopenharmony_ci 440bf215546Sopenharmony_ci VkResult ret; 441bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 442bf215546Sopenharmony_ci if (vn_decode_simple_pointer(dec)) { 443bf215546Sopenharmony_ci vn_decode_uint32_t(dec, pPropertyCount); 444bf215546Sopenharmony_ci } else { 445bf215546Sopenharmony_ci pPropertyCount = NULL; 446bf215546Sopenharmony_ci } 447bf215546Sopenharmony_ci if (vn_peek_array_size(dec)) { 448bf215546Sopenharmony_ci const uint32_t iter_count = vn_decode_array_size(dec, (pPropertyCount ? *pPropertyCount : 0)); 449bf215546Sopenharmony_ci for (uint32_t i = 0; i < iter_count; i++) 450bf215546Sopenharmony_ci vn_decode_VkLayerProperties(dec, &pProperties[i]); 451bf215546Sopenharmony_ci } else { 452bf215546Sopenharmony_ci vn_decode_array_size_unchecked(dec); 453bf215546Sopenharmony_ci pProperties = NULL; 454bf215546Sopenharmony_ci } 455bf215546Sopenharmony_ci 456bf215546Sopenharmony_ci return ret; 457bf215546Sopenharmony_ci} 458bf215546Sopenharmony_ci 459bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) 460bf215546Sopenharmony_ci{ 461bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT; 462bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 463bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 464bf215546Sopenharmony_ci 465bf215546Sopenharmony_ci if (pLayerName) { 466bf215546Sopenharmony_ci const size_t string_size = strlen(pLayerName) + 1; 467bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(string_size); 468bf215546Sopenharmony_ci cmd_size += vn_sizeof_char_array(pLayerName, string_size); 469bf215546Sopenharmony_ci } else { 470bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 471bf215546Sopenharmony_ci } 472bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pPropertyCount); 473bf215546Sopenharmony_ci if (pPropertyCount) 474bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(pPropertyCount); 475bf215546Sopenharmony_ci if (pProperties) { 476bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0)); 477bf215546Sopenharmony_ci for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++) 478bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkExtensionProperties_partial(&pProperties[i]); 479bf215546Sopenharmony_ci } else { 480bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 481bf215546Sopenharmony_ci } 482bf215546Sopenharmony_ci 483bf215546Sopenharmony_ci return cmd_size; 484bf215546Sopenharmony_ci} 485bf215546Sopenharmony_ci 486bf215546Sopenharmony_cistatic inline void vn_encode_vkEnumerateInstanceExtensionProperties(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) 487bf215546Sopenharmony_ci{ 488bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT; 489bf215546Sopenharmony_ci 490bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 491bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 492bf215546Sopenharmony_ci 493bf215546Sopenharmony_ci if (pLayerName) { 494bf215546Sopenharmony_ci const size_t string_size = strlen(pLayerName) + 1; 495bf215546Sopenharmony_ci vn_encode_array_size(enc, string_size); 496bf215546Sopenharmony_ci vn_encode_char_array(enc, pLayerName, string_size); 497bf215546Sopenharmony_ci } else { 498bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 499bf215546Sopenharmony_ci } 500bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pPropertyCount)) 501bf215546Sopenharmony_ci vn_encode_uint32_t(enc, pPropertyCount); 502bf215546Sopenharmony_ci if (pProperties) { 503bf215546Sopenharmony_ci vn_encode_array_size(enc, (pPropertyCount ? *pPropertyCount : 0)); 504bf215546Sopenharmony_ci for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++) 505bf215546Sopenharmony_ci vn_encode_VkExtensionProperties_partial(enc, &pProperties[i]); 506bf215546Sopenharmony_ci } else { 507bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 508bf215546Sopenharmony_ci } 509bf215546Sopenharmony_ci} 510bf215546Sopenharmony_ci 511bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkEnumerateInstanceExtensionProperties_reply(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) 512bf215546Sopenharmony_ci{ 513bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT; 514bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 515bf215546Sopenharmony_ci 516bf215546Sopenharmony_ci VkResult ret; 517bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 518bf215546Sopenharmony_ci /* skip pLayerName */ 519bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pPropertyCount); 520bf215546Sopenharmony_ci if (pPropertyCount) 521bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(pPropertyCount); 522bf215546Sopenharmony_ci if (pProperties) { 523bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0)); 524bf215546Sopenharmony_ci for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++) 525bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkExtensionProperties(&pProperties[i]); 526bf215546Sopenharmony_ci } else { 527bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 528bf215546Sopenharmony_ci } 529bf215546Sopenharmony_ci 530bf215546Sopenharmony_ci return cmd_size; 531bf215546Sopenharmony_ci} 532bf215546Sopenharmony_ci 533bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkEnumerateInstanceExtensionProperties_reply(struct vn_cs_decoder *dec, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) 534bf215546Sopenharmony_ci{ 535bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 536bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 537bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT); 538bf215546Sopenharmony_ci 539bf215546Sopenharmony_ci VkResult ret; 540bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 541bf215546Sopenharmony_ci /* skip pLayerName */ 542bf215546Sopenharmony_ci if (vn_decode_simple_pointer(dec)) { 543bf215546Sopenharmony_ci vn_decode_uint32_t(dec, pPropertyCount); 544bf215546Sopenharmony_ci } else { 545bf215546Sopenharmony_ci pPropertyCount = NULL; 546bf215546Sopenharmony_ci } 547bf215546Sopenharmony_ci if (vn_peek_array_size(dec)) { 548bf215546Sopenharmony_ci const uint32_t iter_count = vn_decode_array_size(dec, (pPropertyCount ? *pPropertyCount : 0)); 549bf215546Sopenharmony_ci for (uint32_t i = 0; i < iter_count; i++) 550bf215546Sopenharmony_ci vn_decode_VkExtensionProperties(dec, &pProperties[i]); 551bf215546Sopenharmony_ci } else { 552bf215546Sopenharmony_ci vn_decode_array_size_unchecked(dec); 553bf215546Sopenharmony_ci pProperties = NULL; 554bf215546Sopenharmony_ci } 555bf215546Sopenharmony_ci 556bf215546Sopenharmony_ci return ret; 557bf215546Sopenharmony_ci} 558bf215546Sopenharmony_ci 559bf215546Sopenharmony_cistatic inline void vn_submit_vkCreateInstance(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance, struct vn_instance_submit_command *submit) 560bf215546Sopenharmony_ci{ 561bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 562bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 563bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkCreateInstance(pCreateInfo, pAllocator, pInstance); 564bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 565bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 566bf215546Sopenharmony_ci if (!cmd_data) 567bf215546Sopenharmony_ci cmd_size = 0; 568bf215546Sopenharmony_ci } 569bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateInstance_reply(pCreateInfo, pAllocator, pInstance) : 0; 570bf215546Sopenharmony_ci 571bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 572bf215546Sopenharmony_ci if (cmd_size) { 573bf215546Sopenharmony_ci vn_encode_vkCreateInstance(enc, cmd_flags, pCreateInfo, pAllocator, pInstance); 574bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 575bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 576bf215546Sopenharmony_ci free(cmd_data); 577bf215546Sopenharmony_ci } 578bf215546Sopenharmony_ci} 579bf215546Sopenharmony_ci 580bf215546Sopenharmony_cistatic inline void vn_submit_vkDestroyInstance(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkInstance instance, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit) 581bf215546Sopenharmony_ci{ 582bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 583bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 584bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkDestroyInstance(instance, pAllocator); 585bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 586bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 587bf215546Sopenharmony_ci if (!cmd_data) 588bf215546Sopenharmony_ci cmd_size = 0; 589bf215546Sopenharmony_ci } 590bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyInstance_reply(instance, pAllocator) : 0; 591bf215546Sopenharmony_ci 592bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 593bf215546Sopenharmony_ci if (cmd_size) { 594bf215546Sopenharmony_ci vn_encode_vkDestroyInstance(enc, cmd_flags, instance, pAllocator); 595bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 596bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 597bf215546Sopenharmony_ci free(cmd_data); 598bf215546Sopenharmony_ci } 599bf215546Sopenharmony_ci} 600bf215546Sopenharmony_ci 601bf215546Sopenharmony_cistatic inline void vn_submit_vkEnumerateInstanceVersion(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, uint32_t* pApiVersion, struct vn_instance_submit_command *submit) 602bf215546Sopenharmony_ci{ 603bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 604bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 605bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkEnumerateInstanceVersion(pApiVersion); 606bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 607bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 608bf215546Sopenharmony_ci if (!cmd_data) 609bf215546Sopenharmony_ci cmd_size = 0; 610bf215546Sopenharmony_ci } 611bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkEnumerateInstanceVersion_reply(pApiVersion) : 0; 612bf215546Sopenharmony_ci 613bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 614bf215546Sopenharmony_ci if (cmd_size) { 615bf215546Sopenharmony_ci vn_encode_vkEnumerateInstanceVersion(enc, cmd_flags, pApiVersion); 616bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 617bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 618bf215546Sopenharmony_ci free(cmd_data); 619bf215546Sopenharmony_ci } 620bf215546Sopenharmony_ci} 621bf215546Sopenharmony_ci 622bf215546Sopenharmony_cistatic inline void vn_submit_vkEnumerateInstanceLayerProperties(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, uint32_t* pPropertyCount, VkLayerProperties* pProperties, struct vn_instance_submit_command *submit) 623bf215546Sopenharmony_ci{ 624bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 625bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 626bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkEnumerateInstanceLayerProperties(pPropertyCount, pProperties); 627bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 628bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 629bf215546Sopenharmony_ci if (!cmd_data) 630bf215546Sopenharmony_ci cmd_size = 0; 631bf215546Sopenharmony_ci } 632bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkEnumerateInstanceLayerProperties_reply(pPropertyCount, pProperties) : 0; 633bf215546Sopenharmony_ci 634bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 635bf215546Sopenharmony_ci if (cmd_size) { 636bf215546Sopenharmony_ci vn_encode_vkEnumerateInstanceLayerProperties(enc, cmd_flags, pPropertyCount, pProperties); 637bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 638bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 639bf215546Sopenharmony_ci free(cmd_data); 640bf215546Sopenharmony_ci } 641bf215546Sopenharmony_ci} 642bf215546Sopenharmony_ci 643bf215546Sopenharmony_cistatic inline void vn_submit_vkEnumerateInstanceExtensionProperties(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties, struct vn_instance_submit_command *submit) 644bf215546Sopenharmony_ci{ 645bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 646bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 647bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkEnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties); 648bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 649bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 650bf215546Sopenharmony_ci if (!cmd_data) 651bf215546Sopenharmony_ci cmd_size = 0; 652bf215546Sopenharmony_ci } 653bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkEnumerateInstanceExtensionProperties_reply(pLayerName, pPropertyCount, pProperties) : 0; 654bf215546Sopenharmony_ci 655bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 656bf215546Sopenharmony_ci if (cmd_size) { 657bf215546Sopenharmony_ci vn_encode_vkEnumerateInstanceExtensionProperties(enc, cmd_flags, pLayerName, pPropertyCount, pProperties); 658bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 659bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 660bf215546Sopenharmony_ci free(cmd_data); 661bf215546Sopenharmony_ci } 662bf215546Sopenharmony_ci} 663bf215546Sopenharmony_ci 664bf215546Sopenharmony_cistatic inline VkResult vn_call_vkCreateInstance(struct vn_instance *vn_instance, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) 665bf215546Sopenharmony_ci{ 666bf215546Sopenharmony_ci VN_TRACE_FUNC(); 667bf215546Sopenharmony_ci 668bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 669bf215546Sopenharmony_ci vn_submit_vkCreateInstance(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pCreateInfo, pAllocator, pInstance, &submit); 670bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 671bf215546Sopenharmony_ci if (dec) { 672bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkCreateInstance_reply(dec, pCreateInfo, pAllocator, pInstance); 673bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 674bf215546Sopenharmony_ci return ret; 675bf215546Sopenharmony_ci } else { 676bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 677bf215546Sopenharmony_ci } 678bf215546Sopenharmony_ci} 679bf215546Sopenharmony_ci 680bf215546Sopenharmony_cistatic inline void vn_async_vkCreateInstance(struct vn_instance *vn_instance, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) 681bf215546Sopenharmony_ci{ 682bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 683bf215546Sopenharmony_ci vn_submit_vkCreateInstance(vn_instance, 0, pCreateInfo, pAllocator, pInstance, &submit); 684bf215546Sopenharmony_ci} 685bf215546Sopenharmony_ci 686bf215546Sopenharmony_cistatic inline void vn_call_vkDestroyInstance(struct vn_instance *vn_instance, VkInstance instance, const VkAllocationCallbacks* pAllocator) 687bf215546Sopenharmony_ci{ 688bf215546Sopenharmony_ci VN_TRACE_FUNC(); 689bf215546Sopenharmony_ci 690bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 691bf215546Sopenharmony_ci vn_submit_vkDestroyInstance(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, instance, pAllocator, &submit); 692bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 693bf215546Sopenharmony_ci if (dec) { 694bf215546Sopenharmony_ci vn_decode_vkDestroyInstance_reply(dec, instance, pAllocator); 695bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 696bf215546Sopenharmony_ci } 697bf215546Sopenharmony_ci} 698bf215546Sopenharmony_ci 699bf215546Sopenharmony_cistatic inline void vn_async_vkDestroyInstance(struct vn_instance *vn_instance, VkInstance instance, const VkAllocationCallbacks* pAllocator) 700bf215546Sopenharmony_ci{ 701bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 702bf215546Sopenharmony_ci vn_submit_vkDestroyInstance(vn_instance, 0, instance, pAllocator, &submit); 703bf215546Sopenharmony_ci} 704bf215546Sopenharmony_ci 705bf215546Sopenharmony_cistatic inline VkResult vn_call_vkEnumerateInstanceVersion(struct vn_instance *vn_instance, uint32_t* pApiVersion) 706bf215546Sopenharmony_ci{ 707bf215546Sopenharmony_ci VN_TRACE_FUNC(); 708bf215546Sopenharmony_ci 709bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 710bf215546Sopenharmony_ci vn_submit_vkEnumerateInstanceVersion(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pApiVersion, &submit); 711bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 712bf215546Sopenharmony_ci if (dec) { 713bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkEnumerateInstanceVersion_reply(dec, pApiVersion); 714bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 715bf215546Sopenharmony_ci return ret; 716bf215546Sopenharmony_ci } else { 717bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 718bf215546Sopenharmony_ci } 719bf215546Sopenharmony_ci} 720bf215546Sopenharmony_ci 721bf215546Sopenharmony_cistatic inline void vn_async_vkEnumerateInstanceVersion(struct vn_instance *vn_instance, uint32_t* pApiVersion) 722bf215546Sopenharmony_ci{ 723bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 724bf215546Sopenharmony_ci vn_submit_vkEnumerateInstanceVersion(vn_instance, 0, pApiVersion, &submit); 725bf215546Sopenharmony_ci} 726bf215546Sopenharmony_ci 727bf215546Sopenharmony_cistatic inline VkResult vn_call_vkEnumerateInstanceLayerProperties(struct vn_instance *vn_instance, uint32_t* pPropertyCount, VkLayerProperties* pProperties) 728bf215546Sopenharmony_ci{ 729bf215546Sopenharmony_ci VN_TRACE_FUNC(); 730bf215546Sopenharmony_ci 731bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 732bf215546Sopenharmony_ci vn_submit_vkEnumerateInstanceLayerProperties(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pPropertyCount, pProperties, &submit); 733bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 734bf215546Sopenharmony_ci if (dec) { 735bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkEnumerateInstanceLayerProperties_reply(dec, pPropertyCount, pProperties); 736bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 737bf215546Sopenharmony_ci return ret; 738bf215546Sopenharmony_ci } else { 739bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 740bf215546Sopenharmony_ci } 741bf215546Sopenharmony_ci} 742bf215546Sopenharmony_ci 743bf215546Sopenharmony_cistatic inline void vn_async_vkEnumerateInstanceLayerProperties(struct vn_instance *vn_instance, uint32_t* pPropertyCount, VkLayerProperties* pProperties) 744bf215546Sopenharmony_ci{ 745bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 746bf215546Sopenharmony_ci vn_submit_vkEnumerateInstanceLayerProperties(vn_instance, 0, pPropertyCount, pProperties, &submit); 747bf215546Sopenharmony_ci} 748bf215546Sopenharmony_ci 749bf215546Sopenharmony_cistatic inline VkResult vn_call_vkEnumerateInstanceExtensionProperties(struct vn_instance *vn_instance, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) 750bf215546Sopenharmony_ci{ 751bf215546Sopenharmony_ci VN_TRACE_FUNC(); 752bf215546Sopenharmony_ci 753bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 754bf215546Sopenharmony_ci vn_submit_vkEnumerateInstanceExtensionProperties(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pLayerName, pPropertyCount, pProperties, &submit); 755bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 756bf215546Sopenharmony_ci if (dec) { 757bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkEnumerateInstanceExtensionProperties_reply(dec, pLayerName, pPropertyCount, pProperties); 758bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 759bf215546Sopenharmony_ci return ret; 760bf215546Sopenharmony_ci } else { 761bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 762bf215546Sopenharmony_ci } 763bf215546Sopenharmony_ci} 764bf215546Sopenharmony_ci 765bf215546Sopenharmony_cistatic inline void vn_async_vkEnumerateInstanceExtensionProperties(struct vn_instance *vn_instance, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) 766bf215546Sopenharmony_ci{ 767bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 768bf215546Sopenharmony_ci vn_submit_vkEnumerateInstanceExtensionProperties(vn_instance, 0, pLayerName, pPropertyCount, pProperties, &submit); 769bf215546Sopenharmony_ci} 770bf215546Sopenharmony_ci 771bf215546Sopenharmony_ci#endif /* VN_PROTOCOL_DRIVER_INSTANCE_H */ 772