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_FENCE_H 9bf215546Sopenharmony_ci#define VN_PROTOCOL_DRIVER_FENCE_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 * vkGetFenceFdKHR 18bf215546Sopenharmony_ci */ 19bf215546Sopenharmony_ci 20bf215546Sopenharmony_ci/* struct VkExportFenceCreateInfo chain */ 21bf215546Sopenharmony_ci 22bf215546Sopenharmony_cistatic inline size_t 23bf215546Sopenharmony_civn_sizeof_VkExportFenceCreateInfo_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_VkExportFenceCreateInfo_self(const VkExportFenceCreateInfo *val) 31bf215546Sopenharmony_ci{ 32bf215546Sopenharmony_ci size_t size = 0; 33bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 34bf215546Sopenharmony_ci size += vn_sizeof_VkFlags(&val->handleTypes); 35bf215546Sopenharmony_ci return size; 36bf215546Sopenharmony_ci} 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_cistatic inline size_t 39bf215546Sopenharmony_civn_sizeof_VkExportFenceCreateInfo(const VkExportFenceCreateInfo *val) 40bf215546Sopenharmony_ci{ 41bf215546Sopenharmony_ci size_t size = 0; 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci size += vn_sizeof_VkStructureType(&val->sType); 44bf215546Sopenharmony_ci size += vn_sizeof_VkExportFenceCreateInfo_pnext(val->pNext); 45bf215546Sopenharmony_ci size += vn_sizeof_VkExportFenceCreateInfo_self(val); 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci return size; 48bf215546Sopenharmony_ci} 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_cistatic inline void 51bf215546Sopenharmony_civn_encode_VkExportFenceCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val) 52bf215546Sopenharmony_ci{ 53bf215546Sopenharmony_ci /* no known/supported struct */ 54bf215546Sopenharmony_ci vn_encode_simple_pointer(enc, NULL); 55bf215546Sopenharmony_ci} 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_cistatic inline void 58bf215546Sopenharmony_civn_encode_VkExportFenceCreateInfo_self(struct vn_cs_encoder *enc, const VkExportFenceCreateInfo *val) 59bf215546Sopenharmony_ci{ 60bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 61bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &val->handleTypes); 62bf215546Sopenharmony_ci} 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_cistatic inline void 65bf215546Sopenharmony_civn_encode_VkExportFenceCreateInfo(struct vn_cs_encoder *enc, const VkExportFenceCreateInfo *val) 66bf215546Sopenharmony_ci{ 67bf215546Sopenharmony_ci assert(val->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO); 68bf215546Sopenharmony_ci vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO }); 69bf215546Sopenharmony_ci vn_encode_VkExportFenceCreateInfo_pnext(enc, val->pNext); 70bf215546Sopenharmony_ci vn_encode_VkExportFenceCreateInfo_self(enc, val); 71bf215546Sopenharmony_ci} 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ci/* struct VkFenceCreateInfo chain */ 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_cistatic inline size_t 76bf215546Sopenharmony_civn_sizeof_VkFenceCreateInfo_pnext(const void *val) 77bf215546Sopenharmony_ci{ 78bf215546Sopenharmony_ci const VkBaseInStructure *pnext = val; 79bf215546Sopenharmony_ci size_t size = 0; 80bf215546Sopenharmony_ci 81bf215546Sopenharmony_ci while (pnext) { 82bf215546Sopenharmony_ci switch ((int32_t)pnext->sType) { 83bf215546Sopenharmony_ci case VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO: 84bf215546Sopenharmony_ci size += vn_sizeof_simple_pointer(pnext); 85bf215546Sopenharmony_ci size += vn_sizeof_VkStructureType(&pnext->sType); 86bf215546Sopenharmony_ci size += vn_sizeof_VkFenceCreateInfo_pnext(pnext->pNext); 87bf215546Sopenharmony_ci size += vn_sizeof_VkExportFenceCreateInfo_self((const VkExportFenceCreateInfo *)pnext); 88bf215546Sopenharmony_ci return size; 89bf215546Sopenharmony_ci default: 90bf215546Sopenharmony_ci /* ignore unknown/unsupported struct */ 91bf215546Sopenharmony_ci break; 92bf215546Sopenharmony_ci } 93bf215546Sopenharmony_ci pnext = pnext->pNext; 94bf215546Sopenharmony_ci } 95bf215546Sopenharmony_ci 96bf215546Sopenharmony_ci return vn_sizeof_simple_pointer(NULL); 97bf215546Sopenharmony_ci} 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_cistatic inline size_t 100bf215546Sopenharmony_civn_sizeof_VkFenceCreateInfo_self(const VkFenceCreateInfo *val) 101bf215546Sopenharmony_ci{ 102bf215546Sopenharmony_ci size_t size = 0; 103bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 104bf215546Sopenharmony_ci size += vn_sizeof_VkFlags(&val->flags); 105bf215546Sopenharmony_ci return size; 106bf215546Sopenharmony_ci} 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_cistatic inline size_t 109bf215546Sopenharmony_civn_sizeof_VkFenceCreateInfo(const VkFenceCreateInfo *val) 110bf215546Sopenharmony_ci{ 111bf215546Sopenharmony_ci size_t size = 0; 112bf215546Sopenharmony_ci 113bf215546Sopenharmony_ci size += vn_sizeof_VkStructureType(&val->sType); 114bf215546Sopenharmony_ci size += vn_sizeof_VkFenceCreateInfo_pnext(val->pNext); 115bf215546Sopenharmony_ci size += vn_sizeof_VkFenceCreateInfo_self(val); 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci return size; 118bf215546Sopenharmony_ci} 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_cistatic inline void 121bf215546Sopenharmony_civn_encode_VkFenceCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val) 122bf215546Sopenharmony_ci{ 123bf215546Sopenharmony_ci const VkBaseInStructure *pnext = val; 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci while (pnext) { 126bf215546Sopenharmony_ci switch ((int32_t)pnext->sType) { 127bf215546Sopenharmony_ci case VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO: 128bf215546Sopenharmony_ci vn_encode_simple_pointer(enc, pnext); 129bf215546Sopenharmony_ci vn_encode_VkStructureType(enc, &pnext->sType); 130bf215546Sopenharmony_ci vn_encode_VkFenceCreateInfo_pnext(enc, pnext->pNext); 131bf215546Sopenharmony_ci vn_encode_VkExportFenceCreateInfo_self(enc, (const VkExportFenceCreateInfo *)pnext); 132bf215546Sopenharmony_ci return; 133bf215546Sopenharmony_ci default: 134bf215546Sopenharmony_ci /* ignore unknown/unsupported struct */ 135bf215546Sopenharmony_ci break; 136bf215546Sopenharmony_ci } 137bf215546Sopenharmony_ci pnext = pnext->pNext; 138bf215546Sopenharmony_ci } 139bf215546Sopenharmony_ci 140bf215546Sopenharmony_ci vn_encode_simple_pointer(enc, NULL); 141bf215546Sopenharmony_ci} 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_cistatic inline void 144bf215546Sopenharmony_civn_encode_VkFenceCreateInfo_self(struct vn_cs_encoder *enc, const VkFenceCreateInfo *val) 145bf215546Sopenharmony_ci{ 146bf215546Sopenharmony_ci /* skip val->{sType,pNext} */ 147bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &val->flags); 148bf215546Sopenharmony_ci} 149bf215546Sopenharmony_ci 150bf215546Sopenharmony_cistatic inline void 151bf215546Sopenharmony_civn_encode_VkFenceCreateInfo(struct vn_cs_encoder *enc, const VkFenceCreateInfo *val) 152bf215546Sopenharmony_ci{ 153bf215546Sopenharmony_ci assert(val->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO); 154bf215546Sopenharmony_ci vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }); 155bf215546Sopenharmony_ci vn_encode_VkFenceCreateInfo_pnext(enc, val->pNext); 156bf215546Sopenharmony_ci vn_encode_VkFenceCreateInfo_self(enc, val); 157bf215546Sopenharmony_ci} 158bf215546Sopenharmony_ci 159bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) 160bf215546Sopenharmony_ci{ 161bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFence_EXT; 162bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 163bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 164bf215546Sopenharmony_ci 165bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkDevice(&device); 166bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pCreateInfo); 167bf215546Sopenharmony_ci if (pCreateInfo) 168bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFenceCreateInfo(pCreateInfo); 169bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pAllocator); 170bf215546Sopenharmony_ci if (pAllocator) 171bf215546Sopenharmony_ci assert(false); 172bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pFence); 173bf215546Sopenharmony_ci if (pFence) 174bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFence(pFence); 175bf215546Sopenharmony_ci 176bf215546Sopenharmony_ci return cmd_size; 177bf215546Sopenharmony_ci} 178bf215546Sopenharmony_ci 179bf215546Sopenharmony_cistatic inline void vn_encode_vkCreateFence(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) 180bf215546Sopenharmony_ci{ 181bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFence_EXT; 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 184bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 185bf215546Sopenharmony_ci 186bf215546Sopenharmony_ci vn_encode_VkDevice(enc, &device); 187bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pCreateInfo)) 188bf215546Sopenharmony_ci vn_encode_VkFenceCreateInfo(enc, pCreateInfo); 189bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pAllocator)) 190bf215546Sopenharmony_ci assert(false); 191bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pFence)) 192bf215546Sopenharmony_ci vn_encode_VkFence(enc, pFence); 193bf215546Sopenharmony_ci} 194bf215546Sopenharmony_ci 195bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkCreateFence_reply(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) 196bf215546Sopenharmony_ci{ 197bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFence_EXT; 198bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 199bf215546Sopenharmony_ci 200bf215546Sopenharmony_ci VkResult ret; 201bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 202bf215546Sopenharmony_ci /* skip device */ 203bf215546Sopenharmony_ci /* skip pCreateInfo */ 204bf215546Sopenharmony_ci /* skip pAllocator */ 205bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pFence); 206bf215546Sopenharmony_ci if (pFence) 207bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFence(pFence); 208bf215546Sopenharmony_ci 209bf215546Sopenharmony_ci return cmd_size; 210bf215546Sopenharmony_ci} 211bf215546Sopenharmony_ci 212bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkCreateFence_reply(struct vn_cs_decoder *dec, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) 213bf215546Sopenharmony_ci{ 214bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 215bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 216bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkCreateFence_EXT); 217bf215546Sopenharmony_ci 218bf215546Sopenharmony_ci VkResult ret; 219bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 220bf215546Sopenharmony_ci /* skip device */ 221bf215546Sopenharmony_ci /* skip pCreateInfo */ 222bf215546Sopenharmony_ci /* skip pAllocator */ 223bf215546Sopenharmony_ci if (vn_decode_simple_pointer(dec)) { 224bf215546Sopenharmony_ci vn_decode_VkFence(dec, pFence); 225bf215546Sopenharmony_ci } else { 226bf215546Sopenharmony_ci pFence = NULL; 227bf215546Sopenharmony_ci } 228bf215546Sopenharmony_ci 229bf215546Sopenharmony_ci return ret; 230bf215546Sopenharmony_ci} 231bf215546Sopenharmony_ci 232bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) 233bf215546Sopenharmony_ci{ 234bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFence_EXT; 235bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 236bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 237bf215546Sopenharmony_ci 238bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkDevice(&device); 239bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFence(&fence); 240bf215546Sopenharmony_ci cmd_size += vn_sizeof_simple_pointer(pAllocator); 241bf215546Sopenharmony_ci if (pAllocator) 242bf215546Sopenharmony_ci assert(false); 243bf215546Sopenharmony_ci 244bf215546Sopenharmony_ci return cmd_size; 245bf215546Sopenharmony_ci} 246bf215546Sopenharmony_ci 247bf215546Sopenharmony_cistatic inline void vn_encode_vkDestroyFence(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) 248bf215546Sopenharmony_ci{ 249bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFence_EXT; 250bf215546Sopenharmony_ci 251bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 252bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 253bf215546Sopenharmony_ci 254bf215546Sopenharmony_ci vn_encode_VkDevice(enc, &device); 255bf215546Sopenharmony_ci vn_encode_VkFence(enc, &fence); 256bf215546Sopenharmony_ci if (vn_encode_simple_pointer(enc, pAllocator)) 257bf215546Sopenharmony_ci assert(false); 258bf215546Sopenharmony_ci} 259bf215546Sopenharmony_ci 260bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkDestroyFence_reply(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) 261bf215546Sopenharmony_ci{ 262bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFence_EXT; 263bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 264bf215546Sopenharmony_ci 265bf215546Sopenharmony_ci /* skip device */ 266bf215546Sopenharmony_ci /* skip fence */ 267bf215546Sopenharmony_ci /* skip pAllocator */ 268bf215546Sopenharmony_ci 269bf215546Sopenharmony_ci return cmd_size; 270bf215546Sopenharmony_ci} 271bf215546Sopenharmony_ci 272bf215546Sopenharmony_cistatic inline void vn_decode_vkDestroyFence_reply(struct vn_cs_decoder *dec, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) 273bf215546Sopenharmony_ci{ 274bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 275bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 276bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkDestroyFence_EXT); 277bf215546Sopenharmony_ci 278bf215546Sopenharmony_ci /* skip device */ 279bf215546Sopenharmony_ci /* skip fence */ 280bf215546Sopenharmony_ci /* skip pAllocator */ 281bf215546Sopenharmony_ci} 282bf215546Sopenharmony_ci 283bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) 284bf215546Sopenharmony_ci{ 285bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFences_EXT; 286bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 287bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 288bf215546Sopenharmony_ci 289bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkDevice(&device); 290bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(&fenceCount); 291bf215546Sopenharmony_ci if (pFences) { 292bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(fenceCount); 293bf215546Sopenharmony_ci for (uint32_t i = 0; i < fenceCount; i++) 294bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFence(&pFences[i]); 295bf215546Sopenharmony_ci } else { 296bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 297bf215546Sopenharmony_ci } 298bf215546Sopenharmony_ci 299bf215546Sopenharmony_ci return cmd_size; 300bf215546Sopenharmony_ci} 301bf215546Sopenharmony_ci 302bf215546Sopenharmony_cistatic inline void vn_encode_vkResetFences(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences) 303bf215546Sopenharmony_ci{ 304bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFences_EXT; 305bf215546Sopenharmony_ci 306bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 307bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 308bf215546Sopenharmony_ci 309bf215546Sopenharmony_ci vn_encode_VkDevice(enc, &device); 310bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &fenceCount); 311bf215546Sopenharmony_ci if (pFences) { 312bf215546Sopenharmony_ci vn_encode_array_size(enc, fenceCount); 313bf215546Sopenharmony_ci for (uint32_t i = 0; i < fenceCount; i++) 314bf215546Sopenharmony_ci vn_encode_VkFence(enc, &pFences[i]); 315bf215546Sopenharmony_ci } else { 316bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 317bf215546Sopenharmony_ci } 318bf215546Sopenharmony_ci} 319bf215546Sopenharmony_ci 320bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkResetFences_reply(VkDevice device, uint32_t fenceCount, const VkFence* pFences) 321bf215546Sopenharmony_ci{ 322bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFences_EXT; 323bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_ci VkResult ret; 326bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 327bf215546Sopenharmony_ci /* skip device */ 328bf215546Sopenharmony_ci /* skip fenceCount */ 329bf215546Sopenharmony_ci /* skip pFences */ 330bf215546Sopenharmony_ci 331bf215546Sopenharmony_ci return cmd_size; 332bf215546Sopenharmony_ci} 333bf215546Sopenharmony_ci 334bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkResetFences_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t fenceCount, const VkFence* pFences) 335bf215546Sopenharmony_ci{ 336bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 337bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 338bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkResetFences_EXT); 339bf215546Sopenharmony_ci 340bf215546Sopenharmony_ci VkResult ret; 341bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 342bf215546Sopenharmony_ci /* skip device */ 343bf215546Sopenharmony_ci /* skip fenceCount */ 344bf215546Sopenharmony_ci /* skip pFences */ 345bf215546Sopenharmony_ci 346bf215546Sopenharmony_ci return ret; 347bf215546Sopenharmony_ci} 348bf215546Sopenharmony_ci 349bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkGetFenceStatus(VkDevice device, VkFence fence) 350bf215546Sopenharmony_ci{ 351bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetFenceStatus_EXT; 352bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 353bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkDevice(&device); 356bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFence(&fence); 357bf215546Sopenharmony_ci 358bf215546Sopenharmony_ci return cmd_size; 359bf215546Sopenharmony_ci} 360bf215546Sopenharmony_ci 361bf215546Sopenharmony_cistatic inline void vn_encode_vkGetFenceStatus(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence) 362bf215546Sopenharmony_ci{ 363bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetFenceStatus_EXT; 364bf215546Sopenharmony_ci 365bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 366bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 367bf215546Sopenharmony_ci 368bf215546Sopenharmony_ci vn_encode_VkDevice(enc, &device); 369bf215546Sopenharmony_ci vn_encode_VkFence(enc, &fence); 370bf215546Sopenharmony_ci} 371bf215546Sopenharmony_ci 372bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkGetFenceStatus_reply(VkDevice device, VkFence fence) 373bf215546Sopenharmony_ci{ 374bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetFenceStatus_EXT; 375bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 376bf215546Sopenharmony_ci 377bf215546Sopenharmony_ci VkResult ret; 378bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 379bf215546Sopenharmony_ci /* skip device */ 380bf215546Sopenharmony_ci /* skip fence */ 381bf215546Sopenharmony_ci 382bf215546Sopenharmony_ci return cmd_size; 383bf215546Sopenharmony_ci} 384bf215546Sopenharmony_ci 385bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkGetFenceStatus_reply(struct vn_cs_decoder *dec, VkDevice device, VkFence fence) 386bf215546Sopenharmony_ci{ 387bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 388bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 389bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkGetFenceStatus_EXT); 390bf215546Sopenharmony_ci 391bf215546Sopenharmony_ci VkResult ret; 392bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 393bf215546Sopenharmony_ci /* skip device */ 394bf215546Sopenharmony_ci /* skip fence */ 395bf215546Sopenharmony_ci 396bf215546Sopenharmony_ci return ret; 397bf215546Sopenharmony_ci} 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) 400bf215546Sopenharmony_ci{ 401bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitForFences_EXT; 402bf215546Sopenharmony_ci const VkFlags cmd_flags = 0; 403bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); 404bf215546Sopenharmony_ci 405bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkDevice(&device); 406bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint32_t(&fenceCount); 407bf215546Sopenharmony_ci if (pFences) { 408bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(fenceCount); 409bf215546Sopenharmony_ci for (uint32_t i = 0; i < fenceCount; i++) 410bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkFence(&pFences[i]); 411bf215546Sopenharmony_ci } else { 412bf215546Sopenharmony_ci cmd_size += vn_sizeof_array_size(0); 413bf215546Sopenharmony_ci } 414bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkBool32(&waitAll); 415bf215546Sopenharmony_ci cmd_size += vn_sizeof_uint64_t(&timeout); 416bf215546Sopenharmony_ci 417bf215546Sopenharmony_ci return cmd_size; 418bf215546Sopenharmony_ci} 419bf215546Sopenharmony_ci 420bf215546Sopenharmony_cistatic inline void vn_encode_vkWaitForFences(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) 421bf215546Sopenharmony_ci{ 422bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitForFences_EXT; 423bf215546Sopenharmony_ci 424bf215546Sopenharmony_ci vn_encode_VkCommandTypeEXT(enc, &cmd_type); 425bf215546Sopenharmony_ci vn_encode_VkFlags(enc, &cmd_flags); 426bf215546Sopenharmony_ci 427bf215546Sopenharmony_ci vn_encode_VkDevice(enc, &device); 428bf215546Sopenharmony_ci vn_encode_uint32_t(enc, &fenceCount); 429bf215546Sopenharmony_ci if (pFences) { 430bf215546Sopenharmony_ci vn_encode_array_size(enc, fenceCount); 431bf215546Sopenharmony_ci for (uint32_t i = 0; i < fenceCount; i++) 432bf215546Sopenharmony_ci vn_encode_VkFence(enc, &pFences[i]); 433bf215546Sopenharmony_ci } else { 434bf215546Sopenharmony_ci vn_encode_array_size(enc, 0); 435bf215546Sopenharmony_ci } 436bf215546Sopenharmony_ci vn_encode_VkBool32(enc, &waitAll); 437bf215546Sopenharmony_ci vn_encode_uint64_t(enc, &timeout); 438bf215546Sopenharmony_ci} 439bf215546Sopenharmony_ci 440bf215546Sopenharmony_cistatic inline size_t vn_sizeof_vkWaitForFences_reply(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) 441bf215546Sopenharmony_ci{ 442bf215546Sopenharmony_ci const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitForFences_EXT; 443bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); 444bf215546Sopenharmony_ci 445bf215546Sopenharmony_ci VkResult ret; 446bf215546Sopenharmony_ci cmd_size += vn_sizeof_VkResult(&ret); 447bf215546Sopenharmony_ci /* skip device */ 448bf215546Sopenharmony_ci /* skip fenceCount */ 449bf215546Sopenharmony_ci /* skip pFences */ 450bf215546Sopenharmony_ci /* skip waitAll */ 451bf215546Sopenharmony_ci /* skip timeout */ 452bf215546Sopenharmony_ci 453bf215546Sopenharmony_ci return cmd_size; 454bf215546Sopenharmony_ci} 455bf215546Sopenharmony_ci 456bf215546Sopenharmony_cistatic inline VkResult vn_decode_vkWaitForFences_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) 457bf215546Sopenharmony_ci{ 458bf215546Sopenharmony_ci VkCommandTypeEXT command_type; 459bf215546Sopenharmony_ci vn_decode_VkCommandTypeEXT(dec, &command_type); 460bf215546Sopenharmony_ci assert(command_type == VK_COMMAND_TYPE_vkWaitForFences_EXT); 461bf215546Sopenharmony_ci 462bf215546Sopenharmony_ci VkResult ret; 463bf215546Sopenharmony_ci vn_decode_VkResult(dec, &ret); 464bf215546Sopenharmony_ci /* skip device */ 465bf215546Sopenharmony_ci /* skip fenceCount */ 466bf215546Sopenharmony_ci /* skip pFences */ 467bf215546Sopenharmony_ci /* skip waitAll */ 468bf215546Sopenharmony_ci /* skip timeout */ 469bf215546Sopenharmony_ci 470bf215546Sopenharmony_ci return ret; 471bf215546Sopenharmony_ci} 472bf215546Sopenharmony_ci 473bf215546Sopenharmony_cistatic inline void vn_submit_vkCreateFence(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence, struct vn_instance_submit_command *submit) 474bf215546Sopenharmony_ci{ 475bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 476bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 477bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkCreateFence(device, pCreateInfo, pAllocator, pFence); 478bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 479bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 480bf215546Sopenharmony_ci if (!cmd_data) 481bf215546Sopenharmony_ci cmd_size = 0; 482bf215546Sopenharmony_ci } 483bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateFence_reply(device, pCreateInfo, pAllocator, pFence) : 0; 484bf215546Sopenharmony_ci 485bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 486bf215546Sopenharmony_ci if (cmd_size) { 487bf215546Sopenharmony_ci vn_encode_vkCreateFence(enc, cmd_flags, device, pCreateInfo, pAllocator, pFence); 488bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 489bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 490bf215546Sopenharmony_ci free(cmd_data); 491bf215546Sopenharmony_ci } 492bf215546Sopenharmony_ci} 493bf215546Sopenharmony_ci 494bf215546Sopenharmony_cistatic inline void vn_submit_vkDestroyFence(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit) 495bf215546Sopenharmony_ci{ 496bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 497bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 498bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkDestroyFence(device, fence, pAllocator); 499bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 500bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 501bf215546Sopenharmony_ci if (!cmd_data) 502bf215546Sopenharmony_ci cmd_size = 0; 503bf215546Sopenharmony_ci } 504bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyFence_reply(device, fence, pAllocator) : 0; 505bf215546Sopenharmony_ci 506bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 507bf215546Sopenharmony_ci if (cmd_size) { 508bf215546Sopenharmony_ci vn_encode_vkDestroyFence(enc, cmd_flags, device, fence, pAllocator); 509bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 510bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 511bf215546Sopenharmony_ci free(cmd_data); 512bf215546Sopenharmony_ci } 513bf215546Sopenharmony_ci} 514bf215546Sopenharmony_ci 515bf215546Sopenharmony_cistatic inline void vn_submit_vkResetFences(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences, struct vn_instance_submit_command *submit) 516bf215546Sopenharmony_ci{ 517bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 518bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 519bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkResetFences(device, fenceCount, pFences); 520bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 521bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 522bf215546Sopenharmony_ci if (!cmd_data) 523bf215546Sopenharmony_ci cmd_size = 0; 524bf215546Sopenharmony_ci } 525bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetFences_reply(device, fenceCount, pFences) : 0; 526bf215546Sopenharmony_ci 527bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 528bf215546Sopenharmony_ci if (cmd_size) { 529bf215546Sopenharmony_ci vn_encode_vkResetFences(enc, cmd_flags, device, fenceCount, pFences); 530bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 531bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 532bf215546Sopenharmony_ci free(cmd_data); 533bf215546Sopenharmony_ci } 534bf215546Sopenharmony_ci} 535bf215546Sopenharmony_ci 536bf215546Sopenharmony_cistatic inline void vn_submit_vkGetFenceStatus(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, struct vn_instance_submit_command *submit) 537bf215546Sopenharmony_ci{ 538bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 539bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 540bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkGetFenceStatus(device, fence); 541bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 542bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 543bf215546Sopenharmony_ci if (!cmd_data) 544bf215546Sopenharmony_ci cmd_size = 0; 545bf215546Sopenharmony_ci } 546bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetFenceStatus_reply(device, fence) : 0; 547bf215546Sopenharmony_ci 548bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 549bf215546Sopenharmony_ci if (cmd_size) { 550bf215546Sopenharmony_ci vn_encode_vkGetFenceStatus(enc, cmd_flags, device, fence); 551bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 552bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 553bf215546Sopenharmony_ci free(cmd_data); 554bf215546Sopenharmony_ci } 555bf215546Sopenharmony_ci} 556bf215546Sopenharmony_ci 557bf215546Sopenharmony_cistatic inline void vn_submit_vkWaitForFences(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout, struct vn_instance_submit_command *submit) 558bf215546Sopenharmony_ci{ 559bf215546Sopenharmony_ci uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; 560bf215546Sopenharmony_ci void *cmd_data = local_cmd_data; 561bf215546Sopenharmony_ci size_t cmd_size = vn_sizeof_vkWaitForFences(device, fenceCount, pFences, waitAll, timeout); 562bf215546Sopenharmony_ci if (cmd_size > sizeof(local_cmd_data)) { 563bf215546Sopenharmony_ci cmd_data = malloc(cmd_size); 564bf215546Sopenharmony_ci if (!cmd_data) 565bf215546Sopenharmony_ci cmd_size = 0; 566bf215546Sopenharmony_ci } 567bf215546Sopenharmony_ci const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkWaitForFences_reply(device, fenceCount, pFences, waitAll, timeout) : 0; 568bf215546Sopenharmony_ci 569bf215546Sopenharmony_ci struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); 570bf215546Sopenharmony_ci if (cmd_size) { 571bf215546Sopenharmony_ci vn_encode_vkWaitForFences(enc, cmd_flags, device, fenceCount, pFences, waitAll, timeout); 572bf215546Sopenharmony_ci vn_instance_submit_command(vn_instance, submit); 573bf215546Sopenharmony_ci if (cmd_data != local_cmd_data) 574bf215546Sopenharmony_ci free(cmd_data); 575bf215546Sopenharmony_ci } 576bf215546Sopenharmony_ci} 577bf215546Sopenharmony_ci 578bf215546Sopenharmony_cistatic inline VkResult vn_call_vkCreateFence(struct vn_instance *vn_instance, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) 579bf215546Sopenharmony_ci{ 580bf215546Sopenharmony_ci VN_TRACE_FUNC(); 581bf215546Sopenharmony_ci 582bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 583bf215546Sopenharmony_ci vn_submit_vkCreateFence(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pFence, &submit); 584bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 585bf215546Sopenharmony_ci if (dec) { 586bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkCreateFence_reply(dec, device, pCreateInfo, pAllocator, pFence); 587bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 588bf215546Sopenharmony_ci return ret; 589bf215546Sopenharmony_ci } else { 590bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 591bf215546Sopenharmony_ci } 592bf215546Sopenharmony_ci} 593bf215546Sopenharmony_ci 594bf215546Sopenharmony_cistatic inline void vn_async_vkCreateFence(struct vn_instance *vn_instance, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) 595bf215546Sopenharmony_ci{ 596bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 597bf215546Sopenharmony_ci vn_submit_vkCreateFence(vn_instance, 0, device, pCreateInfo, pAllocator, pFence, &submit); 598bf215546Sopenharmony_ci} 599bf215546Sopenharmony_ci 600bf215546Sopenharmony_cistatic inline void vn_call_vkDestroyFence(struct vn_instance *vn_instance, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) 601bf215546Sopenharmony_ci{ 602bf215546Sopenharmony_ci VN_TRACE_FUNC(); 603bf215546Sopenharmony_ci 604bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 605bf215546Sopenharmony_ci vn_submit_vkDestroyFence(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fence, pAllocator, &submit); 606bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 607bf215546Sopenharmony_ci if (dec) { 608bf215546Sopenharmony_ci vn_decode_vkDestroyFence_reply(dec, device, fence, pAllocator); 609bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 610bf215546Sopenharmony_ci } 611bf215546Sopenharmony_ci} 612bf215546Sopenharmony_ci 613bf215546Sopenharmony_cistatic inline void vn_async_vkDestroyFence(struct vn_instance *vn_instance, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) 614bf215546Sopenharmony_ci{ 615bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 616bf215546Sopenharmony_ci vn_submit_vkDestroyFence(vn_instance, 0, device, fence, pAllocator, &submit); 617bf215546Sopenharmony_ci} 618bf215546Sopenharmony_ci 619bf215546Sopenharmony_cistatic inline VkResult vn_call_vkResetFences(struct vn_instance *vn_instance, VkDevice device, uint32_t fenceCount, const VkFence* pFences) 620bf215546Sopenharmony_ci{ 621bf215546Sopenharmony_ci VN_TRACE_FUNC(); 622bf215546Sopenharmony_ci 623bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 624bf215546Sopenharmony_ci vn_submit_vkResetFences(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fenceCount, pFences, &submit); 625bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 626bf215546Sopenharmony_ci if (dec) { 627bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkResetFences_reply(dec, device, fenceCount, pFences); 628bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 629bf215546Sopenharmony_ci return ret; 630bf215546Sopenharmony_ci } else { 631bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 632bf215546Sopenharmony_ci } 633bf215546Sopenharmony_ci} 634bf215546Sopenharmony_ci 635bf215546Sopenharmony_cistatic inline void vn_async_vkResetFences(struct vn_instance *vn_instance, VkDevice device, uint32_t fenceCount, const VkFence* pFences) 636bf215546Sopenharmony_ci{ 637bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 638bf215546Sopenharmony_ci vn_submit_vkResetFences(vn_instance, 0, device, fenceCount, pFences, &submit); 639bf215546Sopenharmony_ci} 640bf215546Sopenharmony_ci 641bf215546Sopenharmony_cistatic inline VkResult vn_call_vkGetFenceStatus(struct vn_instance *vn_instance, VkDevice device, VkFence fence) 642bf215546Sopenharmony_ci{ 643bf215546Sopenharmony_ci VN_TRACE_FUNC(); 644bf215546Sopenharmony_ci 645bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 646bf215546Sopenharmony_ci vn_submit_vkGetFenceStatus(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fence, &submit); 647bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 648bf215546Sopenharmony_ci if (dec) { 649bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkGetFenceStatus_reply(dec, device, fence); 650bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 651bf215546Sopenharmony_ci return ret; 652bf215546Sopenharmony_ci } else { 653bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 654bf215546Sopenharmony_ci } 655bf215546Sopenharmony_ci} 656bf215546Sopenharmony_ci 657bf215546Sopenharmony_cistatic inline void vn_async_vkGetFenceStatus(struct vn_instance *vn_instance, VkDevice device, VkFence fence) 658bf215546Sopenharmony_ci{ 659bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 660bf215546Sopenharmony_ci vn_submit_vkGetFenceStatus(vn_instance, 0, device, fence, &submit); 661bf215546Sopenharmony_ci} 662bf215546Sopenharmony_ci 663bf215546Sopenharmony_cistatic inline VkResult vn_call_vkWaitForFences(struct vn_instance *vn_instance, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) 664bf215546Sopenharmony_ci{ 665bf215546Sopenharmony_ci VN_TRACE_FUNC(); 666bf215546Sopenharmony_ci 667bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 668bf215546Sopenharmony_ci vn_submit_vkWaitForFences(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fenceCount, pFences, waitAll, timeout, &submit); 669bf215546Sopenharmony_ci struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); 670bf215546Sopenharmony_ci if (dec) { 671bf215546Sopenharmony_ci const VkResult ret = vn_decode_vkWaitForFences_reply(dec, device, fenceCount, pFences, waitAll, timeout); 672bf215546Sopenharmony_ci vn_instance_free_command_reply(vn_instance, &submit); 673bf215546Sopenharmony_ci return ret; 674bf215546Sopenharmony_ci } else { 675bf215546Sopenharmony_ci return VK_ERROR_OUT_OF_HOST_MEMORY; 676bf215546Sopenharmony_ci } 677bf215546Sopenharmony_ci} 678bf215546Sopenharmony_ci 679bf215546Sopenharmony_cistatic inline void vn_async_vkWaitForFences(struct vn_instance *vn_instance, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) 680bf215546Sopenharmony_ci{ 681bf215546Sopenharmony_ci struct vn_instance_submit_command submit; 682bf215546Sopenharmony_ci vn_submit_vkWaitForFences(vn_instance, 0, device, fenceCount, pFences, waitAll, timeout, &submit); 683bf215546Sopenharmony_ci} 684bf215546Sopenharmony_ci 685bf215546Sopenharmony_ci#endif /* VN_PROTOCOL_DRIVER_FENCE_H */ 686