• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This file is generated by venus-protocol.  See vn_protocol_driver.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_DRIVER_DEVICE_MEMORY_H
9 #define VN_PROTOCOL_DRIVER_DEVICE_MEMORY_H
10 
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13 
14 /*
15  * These structs/unions/commands are not included
16  *
17  *   VkImportMemoryFdInfoKHR
18  *   vkMapMemory
19  */
20 
21 /* struct VkExportMemoryAllocateInfo chain */
22 
23 static inline size_t
vn_sizeof_VkExportMemoryAllocateInfo_pnext(const void * val)24 vn_sizeof_VkExportMemoryAllocateInfo_pnext(const void *val)
25 {
26     /* no known/supported struct */
27     return vn_sizeof_simple_pointer(NULL);
28 }
29 
30 static inline size_t
vn_sizeof_VkExportMemoryAllocateInfo_self(const VkExportMemoryAllocateInfo * val)31 vn_sizeof_VkExportMemoryAllocateInfo_self(const VkExportMemoryAllocateInfo *val)
32 {
33     size_t size = 0;
34     /* skip val->{sType,pNext} */
35     size += vn_sizeof_VkFlags(&val->handleTypes);
36     return size;
37 }
38 
39 static inline size_t
vn_sizeof_VkExportMemoryAllocateInfo(const VkExportMemoryAllocateInfo * val)40 vn_sizeof_VkExportMemoryAllocateInfo(const VkExportMemoryAllocateInfo *val)
41 {
42     size_t size = 0;
43 
44     size += vn_sizeof_VkStructureType(&val->sType);
45     size += vn_sizeof_VkExportMemoryAllocateInfo_pnext(val->pNext);
46     size += vn_sizeof_VkExportMemoryAllocateInfo_self(val);
47 
48     return size;
49 }
50 
51 static inline void
vn_encode_VkExportMemoryAllocateInfo_pnext(struct vn_cs_encoder * enc,const void * val)52 vn_encode_VkExportMemoryAllocateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
53 {
54     /* no known/supported struct */
55     vn_encode_simple_pointer(enc, NULL);
56 }
57 
58 static inline void
vn_encode_VkExportMemoryAllocateInfo_self(struct vn_cs_encoder * enc,const VkExportMemoryAllocateInfo * val)59 vn_encode_VkExportMemoryAllocateInfo_self(struct vn_cs_encoder *enc, const VkExportMemoryAllocateInfo *val)
60 {
61     /* skip val->{sType,pNext} */
62     vn_encode_VkFlags(enc, &val->handleTypes);
63 }
64 
65 static inline void
vn_encode_VkExportMemoryAllocateInfo(struct vn_cs_encoder * enc,const VkExportMemoryAllocateInfo * val)66 vn_encode_VkExportMemoryAllocateInfo(struct vn_cs_encoder *enc, const VkExportMemoryAllocateInfo *val)
67 {
68     assert(val->sType == VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO);
69     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO });
70     vn_encode_VkExportMemoryAllocateInfo_pnext(enc, val->pNext);
71     vn_encode_VkExportMemoryAllocateInfo_self(enc, val);
72 }
73 
74 /* struct VkMemoryAllocateFlagsInfo chain */
75 
76 static inline size_t
vn_sizeof_VkMemoryAllocateFlagsInfo_pnext(const void * val)77 vn_sizeof_VkMemoryAllocateFlagsInfo_pnext(const void *val)
78 {
79     /* no known/supported struct */
80     return vn_sizeof_simple_pointer(NULL);
81 }
82 
83 static inline size_t
vn_sizeof_VkMemoryAllocateFlagsInfo_self(const VkMemoryAllocateFlagsInfo * val)84 vn_sizeof_VkMemoryAllocateFlagsInfo_self(const VkMemoryAllocateFlagsInfo *val)
85 {
86     size_t size = 0;
87     /* skip val->{sType,pNext} */
88     size += vn_sizeof_VkFlags(&val->flags);
89     size += vn_sizeof_uint32_t(&val->deviceMask);
90     return size;
91 }
92 
93 static inline size_t
vn_sizeof_VkMemoryAllocateFlagsInfo(const VkMemoryAllocateFlagsInfo * val)94 vn_sizeof_VkMemoryAllocateFlagsInfo(const VkMemoryAllocateFlagsInfo *val)
95 {
96     size_t size = 0;
97 
98     size += vn_sizeof_VkStructureType(&val->sType);
99     size += vn_sizeof_VkMemoryAllocateFlagsInfo_pnext(val->pNext);
100     size += vn_sizeof_VkMemoryAllocateFlagsInfo_self(val);
101 
102     return size;
103 }
104 
105 static inline void
vn_encode_VkMemoryAllocateFlagsInfo_pnext(struct vn_cs_encoder * enc,const void * val)106 vn_encode_VkMemoryAllocateFlagsInfo_pnext(struct vn_cs_encoder *enc, const void *val)
107 {
108     /* no known/supported struct */
109     vn_encode_simple_pointer(enc, NULL);
110 }
111 
112 static inline void
vn_encode_VkMemoryAllocateFlagsInfo_self(struct vn_cs_encoder * enc,const VkMemoryAllocateFlagsInfo * val)113 vn_encode_VkMemoryAllocateFlagsInfo_self(struct vn_cs_encoder *enc, const VkMemoryAllocateFlagsInfo *val)
114 {
115     /* skip val->{sType,pNext} */
116     vn_encode_VkFlags(enc, &val->flags);
117     vn_encode_uint32_t(enc, &val->deviceMask);
118 }
119 
120 static inline void
vn_encode_VkMemoryAllocateFlagsInfo(struct vn_cs_encoder * enc,const VkMemoryAllocateFlagsInfo * val)121 vn_encode_VkMemoryAllocateFlagsInfo(struct vn_cs_encoder *enc, const VkMemoryAllocateFlagsInfo *val)
122 {
123     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO);
124     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO });
125     vn_encode_VkMemoryAllocateFlagsInfo_pnext(enc, val->pNext);
126     vn_encode_VkMemoryAllocateFlagsInfo_self(enc, val);
127 }
128 
129 /* struct VkMemoryDedicatedAllocateInfo chain */
130 
131 static inline size_t
vn_sizeof_VkMemoryDedicatedAllocateInfo_pnext(const void * val)132 vn_sizeof_VkMemoryDedicatedAllocateInfo_pnext(const void *val)
133 {
134     /* no known/supported struct */
135     return vn_sizeof_simple_pointer(NULL);
136 }
137 
138 static inline size_t
vn_sizeof_VkMemoryDedicatedAllocateInfo_self(const VkMemoryDedicatedAllocateInfo * val)139 vn_sizeof_VkMemoryDedicatedAllocateInfo_self(const VkMemoryDedicatedAllocateInfo *val)
140 {
141     size_t size = 0;
142     /* skip val->{sType,pNext} */
143     size += vn_sizeof_VkImage(&val->image);
144     size += vn_sizeof_VkBuffer(&val->buffer);
145     return size;
146 }
147 
148 static inline size_t
vn_sizeof_VkMemoryDedicatedAllocateInfo(const VkMemoryDedicatedAllocateInfo * val)149 vn_sizeof_VkMemoryDedicatedAllocateInfo(const VkMemoryDedicatedAllocateInfo *val)
150 {
151     size_t size = 0;
152 
153     size += vn_sizeof_VkStructureType(&val->sType);
154     size += vn_sizeof_VkMemoryDedicatedAllocateInfo_pnext(val->pNext);
155     size += vn_sizeof_VkMemoryDedicatedAllocateInfo_self(val);
156 
157     return size;
158 }
159 
160 static inline void
vn_encode_VkMemoryDedicatedAllocateInfo_pnext(struct vn_cs_encoder * enc,const void * val)161 vn_encode_VkMemoryDedicatedAllocateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
162 {
163     /* no known/supported struct */
164     vn_encode_simple_pointer(enc, NULL);
165 }
166 
167 static inline void
vn_encode_VkMemoryDedicatedAllocateInfo_self(struct vn_cs_encoder * enc,const VkMemoryDedicatedAllocateInfo * val)168 vn_encode_VkMemoryDedicatedAllocateInfo_self(struct vn_cs_encoder *enc, const VkMemoryDedicatedAllocateInfo *val)
169 {
170     /* skip val->{sType,pNext} */
171     vn_encode_VkImage(enc, &val->image);
172     vn_encode_VkBuffer(enc, &val->buffer);
173 }
174 
175 static inline void
vn_encode_VkMemoryDedicatedAllocateInfo(struct vn_cs_encoder * enc,const VkMemoryDedicatedAllocateInfo * val)176 vn_encode_VkMemoryDedicatedAllocateInfo(struct vn_cs_encoder *enc, const VkMemoryDedicatedAllocateInfo *val)
177 {
178     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO);
179     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO });
180     vn_encode_VkMemoryDedicatedAllocateInfo_pnext(enc, val->pNext);
181     vn_encode_VkMemoryDedicatedAllocateInfo_self(enc, val);
182 }
183 
184 /* struct VkMemoryOpaqueCaptureAddressAllocateInfo chain */
185 
186 static inline size_t
vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext(const void * val)187 vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext(const void *val)
188 {
189     /* no known/supported struct */
190     return vn_sizeof_simple_pointer(NULL);
191 }
192 
193 static inline size_t
vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_self(const VkMemoryOpaqueCaptureAddressAllocateInfo * val)194 vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_self(const VkMemoryOpaqueCaptureAddressAllocateInfo *val)
195 {
196     size_t size = 0;
197     /* skip val->{sType,pNext} */
198     size += vn_sizeof_uint64_t(&val->opaqueCaptureAddress);
199     return size;
200 }
201 
202 static inline size_t
vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo(const VkMemoryOpaqueCaptureAddressAllocateInfo * val)203 vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo(const VkMemoryOpaqueCaptureAddressAllocateInfo *val)
204 {
205     size_t size = 0;
206 
207     size += vn_sizeof_VkStructureType(&val->sType);
208     size += vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext(val->pNext);
209     size += vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_self(val);
210 
211     return size;
212 }
213 
214 static inline void
vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext(struct vn_cs_encoder * enc,const void * val)215 vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
216 {
217     /* no known/supported struct */
218     vn_encode_simple_pointer(enc, NULL);
219 }
220 
221 static inline void
vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_self(struct vn_cs_encoder * enc,const VkMemoryOpaqueCaptureAddressAllocateInfo * val)222 vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_self(struct vn_cs_encoder *enc, const VkMemoryOpaqueCaptureAddressAllocateInfo *val)
223 {
224     /* skip val->{sType,pNext} */
225     vn_encode_uint64_t(enc, &val->opaqueCaptureAddress);
226 }
227 
228 static inline void
vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo(struct vn_cs_encoder * enc,const VkMemoryOpaqueCaptureAddressAllocateInfo * val)229 vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo(struct vn_cs_encoder *enc, const VkMemoryOpaqueCaptureAddressAllocateInfo *val)
230 {
231     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO);
232     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO });
233     vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext(enc, val->pNext);
234     vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_self(enc, val);
235 }
236 
237 /* struct VkImportMemoryResourceInfoMESA chain */
238 
239 static inline size_t
vn_sizeof_VkImportMemoryResourceInfoMESA_pnext(const void * val)240 vn_sizeof_VkImportMemoryResourceInfoMESA_pnext(const void *val)
241 {
242     /* no known/supported struct */
243     return vn_sizeof_simple_pointer(NULL);
244 }
245 
246 static inline size_t
vn_sizeof_VkImportMemoryResourceInfoMESA_self(const VkImportMemoryResourceInfoMESA * val)247 vn_sizeof_VkImportMemoryResourceInfoMESA_self(const VkImportMemoryResourceInfoMESA *val)
248 {
249     size_t size = 0;
250     /* skip val->{sType,pNext} */
251     size += vn_sizeof_uint32_t(&val->resourceId);
252     return size;
253 }
254 
255 static inline size_t
vn_sizeof_VkImportMemoryResourceInfoMESA(const VkImportMemoryResourceInfoMESA * val)256 vn_sizeof_VkImportMemoryResourceInfoMESA(const VkImportMemoryResourceInfoMESA *val)
257 {
258     size_t size = 0;
259 
260     size += vn_sizeof_VkStructureType(&val->sType);
261     size += vn_sizeof_VkImportMemoryResourceInfoMESA_pnext(val->pNext);
262     size += vn_sizeof_VkImportMemoryResourceInfoMESA_self(val);
263 
264     return size;
265 }
266 
267 static inline void
vn_encode_VkImportMemoryResourceInfoMESA_pnext(struct vn_cs_encoder * enc,const void * val)268 vn_encode_VkImportMemoryResourceInfoMESA_pnext(struct vn_cs_encoder *enc, const void *val)
269 {
270     /* no known/supported struct */
271     vn_encode_simple_pointer(enc, NULL);
272 }
273 
274 static inline void
vn_encode_VkImportMemoryResourceInfoMESA_self(struct vn_cs_encoder * enc,const VkImportMemoryResourceInfoMESA * val)275 vn_encode_VkImportMemoryResourceInfoMESA_self(struct vn_cs_encoder *enc, const VkImportMemoryResourceInfoMESA *val)
276 {
277     /* skip val->{sType,pNext} */
278     vn_encode_uint32_t(enc, &val->resourceId);
279 }
280 
281 static inline void
vn_encode_VkImportMemoryResourceInfoMESA(struct vn_cs_encoder * enc,const VkImportMemoryResourceInfoMESA * val)282 vn_encode_VkImportMemoryResourceInfoMESA(struct vn_cs_encoder *enc, const VkImportMemoryResourceInfoMESA *val)
283 {
284     assert(val->sType == VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA);
285     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA });
286     vn_encode_VkImportMemoryResourceInfoMESA_pnext(enc, val->pNext);
287     vn_encode_VkImportMemoryResourceInfoMESA_self(enc, val);
288 }
289 
290 /* struct VkMemoryAllocateInfo chain */
291 
292 static inline size_t
vn_sizeof_VkMemoryAllocateInfo_pnext(const void * val)293 vn_sizeof_VkMemoryAllocateInfo_pnext(const void *val)
294 {
295     const VkBaseInStructure *pnext = val;
296     size_t size = 0;
297 
298     while (pnext) {
299         switch ((int32_t)pnext->sType) {
300         case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO:
301             size += vn_sizeof_simple_pointer(pnext);
302             size += vn_sizeof_VkStructureType(&pnext->sType);
303             size += vn_sizeof_VkMemoryAllocateInfo_pnext(pnext->pNext);
304             size += vn_sizeof_VkExportMemoryAllocateInfo_self((const VkExportMemoryAllocateInfo *)pnext);
305             return size;
306         case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO:
307             size += vn_sizeof_simple_pointer(pnext);
308             size += vn_sizeof_VkStructureType(&pnext->sType);
309             size += vn_sizeof_VkMemoryAllocateInfo_pnext(pnext->pNext);
310             size += vn_sizeof_VkMemoryAllocateFlagsInfo_self((const VkMemoryAllocateFlagsInfo *)pnext);
311             return size;
312         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
313             size += vn_sizeof_simple_pointer(pnext);
314             size += vn_sizeof_VkStructureType(&pnext->sType);
315             size += vn_sizeof_VkMemoryAllocateInfo_pnext(pnext->pNext);
316             size += vn_sizeof_VkMemoryDedicatedAllocateInfo_self((const VkMemoryDedicatedAllocateInfo *)pnext);
317             return size;
318         case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO:
319             size += vn_sizeof_simple_pointer(pnext);
320             size += vn_sizeof_VkStructureType(&pnext->sType);
321             size += vn_sizeof_VkMemoryAllocateInfo_pnext(pnext->pNext);
322             size += vn_sizeof_VkMemoryOpaqueCaptureAddressAllocateInfo_self((const VkMemoryOpaqueCaptureAddressAllocateInfo *)pnext);
323             return size;
324         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA:
325             size += vn_sizeof_simple_pointer(pnext);
326             size += vn_sizeof_VkStructureType(&pnext->sType);
327             size += vn_sizeof_VkMemoryAllocateInfo_pnext(pnext->pNext);
328             size += vn_sizeof_VkImportMemoryResourceInfoMESA_self((const VkImportMemoryResourceInfoMESA *)pnext);
329             return size;
330         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
331         default:
332             /* ignore unknown/unsupported struct */
333             break;
334         }
335         pnext = pnext->pNext;
336     }
337 
338     return vn_sizeof_simple_pointer(NULL);
339 }
340 
341 static inline size_t
vn_sizeof_VkMemoryAllocateInfo_self(const VkMemoryAllocateInfo * val)342 vn_sizeof_VkMemoryAllocateInfo_self(const VkMemoryAllocateInfo *val)
343 {
344     size_t size = 0;
345     /* skip val->{sType,pNext} */
346     size += vn_sizeof_VkDeviceSize(&val->allocationSize);
347     size += vn_sizeof_uint32_t(&val->memoryTypeIndex);
348     return size;
349 }
350 
351 static inline size_t
vn_sizeof_VkMemoryAllocateInfo(const VkMemoryAllocateInfo * val)352 vn_sizeof_VkMemoryAllocateInfo(const VkMemoryAllocateInfo *val)
353 {
354     size_t size = 0;
355 
356     size += vn_sizeof_VkStructureType(&val->sType);
357     size += vn_sizeof_VkMemoryAllocateInfo_pnext(val->pNext);
358     size += vn_sizeof_VkMemoryAllocateInfo_self(val);
359 
360     return size;
361 }
362 
363 static inline void
vn_encode_VkMemoryAllocateInfo_pnext(struct vn_cs_encoder * enc,const void * val)364 vn_encode_VkMemoryAllocateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
365 {
366     const VkBaseInStructure *pnext = val;
367 
368     while (pnext) {
369         switch ((int32_t)pnext->sType) {
370         case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO:
371             vn_encode_simple_pointer(enc, pnext);
372             vn_encode_VkStructureType(enc, &pnext->sType);
373             vn_encode_VkMemoryAllocateInfo_pnext(enc, pnext->pNext);
374             vn_encode_VkExportMemoryAllocateInfo_self(enc, (const VkExportMemoryAllocateInfo *)pnext);
375             return;
376         case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO:
377             vn_encode_simple_pointer(enc, pnext);
378             vn_encode_VkStructureType(enc, &pnext->sType);
379             vn_encode_VkMemoryAllocateInfo_pnext(enc, pnext->pNext);
380             vn_encode_VkMemoryAllocateFlagsInfo_self(enc, (const VkMemoryAllocateFlagsInfo *)pnext);
381             return;
382         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
383             vn_encode_simple_pointer(enc, pnext);
384             vn_encode_VkStructureType(enc, &pnext->sType);
385             vn_encode_VkMemoryAllocateInfo_pnext(enc, pnext->pNext);
386             vn_encode_VkMemoryDedicatedAllocateInfo_self(enc, (const VkMemoryDedicatedAllocateInfo *)pnext);
387             return;
388         case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO:
389             vn_encode_simple_pointer(enc, pnext);
390             vn_encode_VkStructureType(enc, &pnext->sType);
391             vn_encode_VkMemoryAllocateInfo_pnext(enc, pnext->pNext);
392             vn_encode_VkMemoryOpaqueCaptureAddressAllocateInfo_self(enc, (const VkMemoryOpaqueCaptureAddressAllocateInfo *)pnext);
393             return;
394         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA:
395             vn_encode_simple_pointer(enc, pnext);
396             vn_encode_VkStructureType(enc, &pnext->sType);
397             vn_encode_VkMemoryAllocateInfo_pnext(enc, pnext->pNext);
398             vn_encode_VkImportMemoryResourceInfoMESA_self(enc, (const VkImportMemoryResourceInfoMESA *)pnext);
399             return;
400         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
401         default:
402             /* ignore unknown/unsupported struct */
403             break;
404         }
405         pnext = pnext->pNext;
406     }
407 
408     vn_encode_simple_pointer(enc, NULL);
409 }
410 
411 static inline void
vn_encode_VkMemoryAllocateInfo_self(struct vn_cs_encoder * enc,const VkMemoryAllocateInfo * val)412 vn_encode_VkMemoryAllocateInfo_self(struct vn_cs_encoder *enc, const VkMemoryAllocateInfo *val)
413 {
414     /* skip val->{sType,pNext} */
415     vn_encode_VkDeviceSize(enc, &val->allocationSize);
416     vn_encode_uint32_t(enc, &val->memoryTypeIndex);
417 }
418 
419 static inline void
vn_encode_VkMemoryAllocateInfo(struct vn_cs_encoder * enc,const VkMemoryAllocateInfo * val)420 vn_encode_VkMemoryAllocateInfo(struct vn_cs_encoder *enc, const VkMemoryAllocateInfo *val)
421 {
422     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO);
423     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO });
424     vn_encode_VkMemoryAllocateInfo_pnext(enc, val->pNext);
425     vn_encode_VkMemoryAllocateInfo_self(enc, val);
426 }
427 
428 /* struct VkMappedMemoryRange chain */
429 
430 static inline size_t
vn_sizeof_VkMappedMemoryRange_pnext(const void * val)431 vn_sizeof_VkMappedMemoryRange_pnext(const void *val)
432 {
433     /* no known/supported struct */
434     return vn_sizeof_simple_pointer(NULL);
435 }
436 
437 static inline size_t
vn_sizeof_VkMappedMemoryRange_self(const VkMappedMemoryRange * val)438 vn_sizeof_VkMappedMemoryRange_self(const VkMappedMemoryRange *val)
439 {
440     size_t size = 0;
441     /* skip val->{sType,pNext} */
442     size += vn_sizeof_VkDeviceMemory(&val->memory);
443     size += vn_sizeof_VkDeviceSize(&val->offset);
444     size += vn_sizeof_VkDeviceSize(&val->size);
445     return size;
446 }
447 
448 static inline size_t
vn_sizeof_VkMappedMemoryRange(const VkMappedMemoryRange * val)449 vn_sizeof_VkMappedMemoryRange(const VkMappedMemoryRange *val)
450 {
451     size_t size = 0;
452 
453     size += vn_sizeof_VkStructureType(&val->sType);
454     size += vn_sizeof_VkMappedMemoryRange_pnext(val->pNext);
455     size += vn_sizeof_VkMappedMemoryRange_self(val);
456 
457     return size;
458 }
459 
460 static inline void
vn_encode_VkMappedMemoryRange_pnext(struct vn_cs_encoder * enc,const void * val)461 vn_encode_VkMappedMemoryRange_pnext(struct vn_cs_encoder *enc, const void *val)
462 {
463     /* no known/supported struct */
464     vn_encode_simple_pointer(enc, NULL);
465 }
466 
467 static inline void
vn_encode_VkMappedMemoryRange_self(struct vn_cs_encoder * enc,const VkMappedMemoryRange * val)468 vn_encode_VkMappedMemoryRange_self(struct vn_cs_encoder *enc, const VkMappedMemoryRange *val)
469 {
470     /* skip val->{sType,pNext} */
471     vn_encode_VkDeviceMemory(enc, &val->memory);
472     vn_encode_VkDeviceSize(enc, &val->offset);
473     vn_encode_VkDeviceSize(enc, &val->size);
474 }
475 
476 static inline void
vn_encode_VkMappedMemoryRange(struct vn_cs_encoder * enc,const VkMappedMemoryRange * val)477 vn_encode_VkMappedMemoryRange(struct vn_cs_encoder *enc, const VkMappedMemoryRange *val)
478 {
479     assert(val->sType == VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE);
480     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE });
481     vn_encode_VkMappedMemoryRange_pnext(enc, val->pNext);
482     vn_encode_VkMappedMemoryRange_self(enc, val);
483 }
484 
485 /* struct VkDeviceMemoryOpaqueCaptureAddressInfo chain */
486 
487 static inline size_t
vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(const void * val)488 vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(const void *val)
489 {
490     /* no known/supported struct */
491     return vn_sizeof_simple_pointer(NULL);
492 }
493 
494 static inline size_t
vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo_self(const VkDeviceMemoryOpaqueCaptureAddressInfo * val)495 vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo_self(const VkDeviceMemoryOpaqueCaptureAddressInfo *val)
496 {
497     size_t size = 0;
498     /* skip val->{sType,pNext} */
499     size += vn_sizeof_VkDeviceMemory(&val->memory);
500     return size;
501 }
502 
503 static inline size_t
vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo(const VkDeviceMemoryOpaqueCaptureAddressInfo * val)504 vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo(const VkDeviceMemoryOpaqueCaptureAddressInfo *val)
505 {
506     size_t size = 0;
507 
508     size += vn_sizeof_VkStructureType(&val->sType);
509     size += vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(val->pNext);
510     size += vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo_self(val);
511 
512     return size;
513 }
514 
515 static inline void
vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(struct vn_cs_encoder * enc,const void * val)516 vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(struct vn_cs_encoder *enc, const void *val)
517 {
518     /* no known/supported struct */
519     vn_encode_simple_pointer(enc, NULL);
520 }
521 
522 static inline void
vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_self(struct vn_cs_encoder * enc,const VkDeviceMemoryOpaqueCaptureAddressInfo * val)523 vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_self(struct vn_cs_encoder *enc, const VkDeviceMemoryOpaqueCaptureAddressInfo *val)
524 {
525     /* skip val->{sType,pNext} */
526     vn_encode_VkDeviceMemory(enc, &val->memory);
527 }
528 
529 static inline void
vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo(struct vn_cs_encoder * enc,const VkDeviceMemoryOpaqueCaptureAddressInfo * val)530 vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo(struct vn_cs_encoder *enc, const VkDeviceMemoryOpaqueCaptureAddressInfo *val)
531 {
532     assert(val->sType == VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO);
533     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO });
534     vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(enc, val->pNext);
535     vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_self(enc, val);
536 }
537 
vn_sizeof_vkAllocateMemory(VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)538 static inline size_t vn_sizeof_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
539 {
540     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateMemory_EXT;
541     const VkFlags cmd_flags = 0;
542     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
543 
544     cmd_size += vn_sizeof_VkDevice(&device);
545     cmd_size += vn_sizeof_simple_pointer(pAllocateInfo);
546     if (pAllocateInfo)
547         cmd_size += vn_sizeof_VkMemoryAllocateInfo(pAllocateInfo);
548     cmd_size += vn_sizeof_simple_pointer(pAllocator);
549     if (pAllocator)
550         assert(false);
551     cmd_size += vn_sizeof_simple_pointer(pMemory);
552     if (pMemory)
553         cmd_size += vn_sizeof_VkDeviceMemory(pMemory);
554 
555     return cmd_size;
556 }
557 
vn_encode_vkAllocateMemory(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)558 static inline void vn_encode_vkAllocateMemory(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
559 {
560     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateMemory_EXT;
561 
562     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
563     vn_encode_VkFlags(enc, &cmd_flags);
564 
565     vn_encode_VkDevice(enc, &device);
566     if (vn_encode_simple_pointer(enc, pAllocateInfo))
567         vn_encode_VkMemoryAllocateInfo(enc, pAllocateInfo);
568     if (vn_encode_simple_pointer(enc, pAllocator))
569         assert(false);
570     if (vn_encode_simple_pointer(enc, pMemory))
571         vn_encode_VkDeviceMemory(enc, pMemory);
572 }
573 
vn_sizeof_vkAllocateMemory_reply(VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)574 static inline size_t vn_sizeof_vkAllocateMemory_reply(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
575 {
576     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateMemory_EXT;
577     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
578 
579     VkResult ret;
580     cmd_size += vn_sizeof_VkResult(&ret);
581     /* skip device */
582     /* skip pAllocateInfo */
583     /* skip pAllocator */
584     cmd_size += vn_sizeof_simple_pointer(pMemory);
585     if (pMemory)
586         cmd_size += vn_sizeof_VkDeviceMemory(pMemory);
587 
588     return cmd_size;
589 }
590 
vn_decode_vkAllocateMemory_reply(struct vn_cs_decoder * dec,VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)591 static inline VkResult vn_decode_vkAllocateMemory_reply(struct vn_cs_decoder *dec, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
592 {
593     VkCommandTypeEXT command_type;
594     vn_decode_VkCommandTypeEXT(dec, &command_type);
595     assert(command_type == VK_COMMAND_TYPE_vkAllocateMemory_EXT);
596 
597     VkResult ret;
598     vn_decode_VkResult(dec, &ret);
599     /* skip device */
600     /* skip pAllocateInfo */
601     /* skip pAllocator */
602     if (vn_decode_simple_pointer(dec)) {
603         vn_decode_VkDeviceMemory(dec, pMemory);
604     } else {
605         pMemory = NULL;
606     }
607 
608     return ret;
609 }
610 
vn_sizeof_vkFreeMemory(VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)611 static inline size_t vn_sizeof_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
612 {
613     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFreeMemory_EXT;
614     const VkFlags cmd_flags = 0;
615     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
616 
617     cmd_size += vn_sizeof_VkDevice(&device);
618     cmd_size += vn_sizeof_VkDeviceMemory(&memory);
619     cmd_size += vn_sizeof_simple_pointer(pAllocator);
620     if (pAllocator)
621         assert(false);
622 
623     return cmd_size;
624 }
625 
vn_encode_vkFreeMemory(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)626 static inline void vn_encode_vkFreeMemory(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
627 {
628     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFreeMemory_EXT;
629 
630     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
631     vn_encode_VkFlags(enc, &cmd_flags);
632 
633     vn_encode_VkDevice(enc, &device);
634     vn_encode_VkDeviceMemory(enc, &memory);
635     if (vn_encode_simple_pointer(enc, pAllocator))
636         assert(false);
637 }
638 
vn_sizeof_vkFreeMemory_reply(VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)639 static inline size_t vn_sizeof_vkFreeMemory_reply(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
640 {
641     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFreeMemory_EXT;
642     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
643 
644     /* skip device */
645     /* skip memory */
646     /* skip pAllocator */
647 
648     return cmd_size;
649 }
650 
vn_decode_vkFreeMemory_reply(struct vn_cs_decoder * dec,VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)651 static inline void vn_decode_vkFreeMemory_reply(struct vn_cs_decoder *dec, VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
652 {
653     VkCommandTypeEXT command_type;
654     vn_decode_VkCommandTypeEXT(dec, &command_type);
655     assert(command_type == VK_COMMAND_TYPE_vkFreeMemory_EXT);
656 
657     /* skip device */
658     /* skip memory */
659     /* skip pAllocator */
660 }
661 
vn_sizeof_vkUnmapMemory(VkDevice device,VkDeviceMemory memory)662 static inline size_t vn_sizeof_vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
663 {
664     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUnmapMemory_EXT;
665     const VkFlags cmd_flags = 0;
666     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
667 
668     cmd_size += vn_sizeof_VkDevice(&device);
669     cmd_size += vn_sizeof_VkDeviceMemory(&memory);
670 
671     return cmd_size;
672 }
673 
vn_encode_vkUnmapMemory(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkDeviceMemory memory)674 static inline void vn_encode_vkUnmapMemory(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDeviceMemory memory)
675 {
676     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUnmapMemory_EXT;
677 
678     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
679     vn_encode_VkFlags(enc, &cmd_flags);
680 
681     vn_encode_VkDevice(enc, &device);
682     vn_encode_VkDeviceMemory(enc, &memory);
683 }
684 
vn_sizeof_vkUnmapMemory_reply(VkDevice device,VkDeviceMemory memory)685 static inline size_t vn_sizeof_vkUnmapMemory_reply(VkDevice device, VkDeviceMemory memory)
686 {
687     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUnmapMemory_EXT;
688     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
689 
690     /* skip device */
691     /* skip memory */
692 
693     return cmd_size;
694 }
695 
vn_decode_vkUnmapMemory_reply(struct vn_cs_decoder * dec,VkDevice device,VkDeviceMemory memory)696 static inline void vn_decode_vkUnmapMemory_reply(struct vn_cs_decoder *dec, VkDevice device, VkDeviceMemory memory)
697 {
698     VkCommandTypeEXT command_type;
699     vn_decode_VkCommandTypeEXT(dec, &command_type);
700     assert(command_type == VK_COMMAND_TYPE_vkUnmapMemory_EXT);
701 
702     /* skip device */
703     /* skip memory */
704 }
705 
vn_sizeof_vkFlushMappedMemoryRanges(VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)706 static inline size_t vn_sizeof_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
707 {
708     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFlushMappedMemoryRanges_EXT;
709     const VkFlags cmd_flags = 0;
710     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
711 
712     cmd_size += vn_sizeof_VkDevice(&device);
713     cmd_size += vn_sizeof_uint32_t(&memoryRangeCount);
714     if (pMemoryRanges) {
715         cmd_size += vn_sizeof_array_size(memoryRangeCount);
716         for (uint32_t i = 0; i < memoryRangeCount; i++)
717             cmd_size += vn_sizeof_VkMappedMemoryRange(&pMemoryRanges[i]);
718     } else {
719         cmd_size += vn_sizeof_array_size(0);
720     }
721 
722     return cmd_size;
723 }
724 
vn_encode_vkFlushMappedMemoryRanges(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)725 static inline void vn_encode_vkFlushMappedMemoryRanges(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
726 {
727     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFlushMappedMemoryRanges_EXT;
728 
729     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
730     vn_encode_VkFlags(enc, &cmd_flags);
731 
732     vn_encode_VkDevice(enc, &device);
733     vn_encode_uint32_t(enc, &memoryRangeCount);
734     if (pMemoryRanges) {
735         vn_encode_array_size(enc, memoryRangeCount);
736         for (uint32_t i = 0; i < memoryRangeCount; i++)
737             vn_encode_VkMappedMemoryRange(enc, &pMemoryRanges[i]);
738     } else {
739         vn_encode_array_size(enc, 0);
740     }
741 }
742 
vn_sizeof_vkFlushMappedMemoryRanges_reply(VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)743 static inline size_t vn_sizeof_vkFlushMappedMemoryRanges_reply(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
744 {
745     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFlushMappedMemoryRanges_EXT;
746     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
747 
748     VkResult ret;
749     cmd_size += vn_sizeof_VkResult(&ret);
750     /* skip device */
751     /* skip memoryRangeCount */
752     /* skip pMemoryRanges */
753 
754     return cmd_size;
755 }
756 
vn_decode_vkFlushMappedMemoryRanges_reply(struct vn_cs_decoder * dec,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)757 static inline VkResult vn_decode_vkFlushMappedMemoryRanges_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
758 {
759     VkCommandTypeEXT command_type;
760     vn_decode_VkCommandTypeEXT(dec, &command_type);
761     assert(command_type == VK_COMMAND_TYPE_vkFlushMappedMemoryRanges_EXT);
762 
763     VkResult ret;
764     vn_decode_VkResult(dec, &ret);
765     /* skip device */
766     /* skip memoryRangeCount */
767     /* skip pMemoryRanges */
768 
769     return ret;
770 }
771 
vn_sizeof_vkInvalidateMappedMemoryRanges(VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)772 static inline size_t vn_sizeof_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
773 {
774     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkInvalidateMappedMemoryRanges_EXT;
775     const VkFlags cmd_flags = 0;
776     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
777 
778     cmd_size += vn_sizeof_VkDevice(&device);
779     cmd_size += vn_sizeof_uint32_t(&memoryRangeCount);
780     if (pMemoryRanges) {
781         cmd_size += vn_sizeof_array_size(memoryRangeCount);
782         for (uint32_t i = 0; i < memoryRangeCount; i++)
783             cmd_size += vn_sizeof_VkMappedMemoryRange(&pMemoryRanges[i]);
784     } else {
785         cmd_size += vn_sizeof_array_size(0);
786     }
787 
788     return cmd_size;
789 }
790 
vn_encode_vkInvalidateMappedMemoryRanges(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)791 static inline void vn_encode_vkInvalidateMappedMemoryRanges(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
792 {
793     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkInvalidateMappedMemoryRanges_EXT;
794 
795     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
796     vn_encode_VkFlags(enc, &cmd_flags);
797 
798     vn_encode_VkDevice(enc, &device);
799     vn_encode_uint32_t(enc, &memoryRangeCount);
800     if (pMemoryRanges) {
801         vn_encode_array_size(enc, memoryRangeCount);
802         for (uint32_t i = 0; i < memoryRangeCount; i++)
803             vn_encode_VkMappedMemoryRange(enc, &pMemoryRanges[i]);
804     } else {
805         vn_encode_array_size(enc, 0);
806     }
807 }
808 
vn_sizeof_vkInvalidateMappedMemoryRanges_reply(VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)809 static inline size_t vn_sizeof_vkInvalidateMappedMemoryRanges_reply(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
810 {
811     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkInvalidateMappedMemoryRanges_EXT;
812     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
813 
814     VkResult ret;
815     cmd_size += vn_sizeof_VkResult(&ret);
816     /* skip device */
817     /* skip memoryRangeCount */
818     /* skip pMemoryRanges */
819 
820     return cmd_size;
821 }
822 
vn_decode_vkInvalidateMappedMemoryRanges_reply(struct vn_cs_decoder * dec,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)823 static inline VkResult vn_decode_vkInvalidateMappedMemoryRanges_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
824 {
825     VkCommandTypeEXT command_type;
826     vn_decode_VkCommandTypeEXT(dec, &command_type);
827     assert(command_type == VK_COMMAND_TYPE_vkInvalidateMappedMemoryRanges_EXT);
828 
829     VkResult ret;
830     vn_decode_VkResult(dec, &ret);
831     /* skip device */
832     /* skip memoryRangeCount */
833     /* skip pMemoryRanges */
834 
835     return ret;
836 }
837 
vn_sizeof_vkGetDeviceMemoryCommitment(VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)838 static inline size_t vn_sizeof_vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
839 {
840     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDeviceMemoryCommitment_EXT;
841     const VkFlags cmd_flags = 0;
842     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
843 
844     cmd_size += vn_sizeof_VkDevice(&device);
845     cmd_size += vn_sizeof_VkDeviceMemory(&memory);
846     cmd_size += vn_sizeof_simple_pointer(pCommittedMemoryInBytes); /* out */
847 
848     return cmd_size;
849 }
850 
vn_encode_vkGetDeviceMemoryCommitment(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)851 static inline void vn_encode_vkGetDeviceMemoryCommitment(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
852 {
853     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDeviceMemoryCommitment_EXT;
854 
855     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
856     vn_encode_VkFlags(enc, &cmd_flags);
857 
858     vn_encode_VkDevice(enc, &device);
859     vn_encode_VkDeviceMemory(enc, &memory);
860     vn_encode_simple_pointer(enc, pCommittedMemoryInBytes); /* out */
861 }
862 
vn_sizeof_vkGetDeviceMemoryCommitment_reply(VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)863 static inline size_t vn_sizeof_vkGetDeviceMemoryCommitment_reply(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
864 {
865     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDeviceMemoryCommitment_EXT;
866     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
867 
868     /* skip device */
869     /* skip memory */
870     cmd_size += vn_sizeof_simple_pointer(pCommittedMemoryInBytes);
871     if (pCommittedMemoryInBytes)
872         cmd_size += vn_sizeof_VkDeviceSize(pCommittedMemoryInBytes);
873 
874     return cmd_size;
875 }
876 
vn_decode_vkGetDeviceMemoryCommitment_reply(struct vn_cs_decoder * dec,VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)877 static inline void vn_decode_vkGetDeviceMemoryCommitment_reply(struct vn_cs_decoder *dec, VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
878 {
879     VkCommandTypeEXT command_type;
880     vn_decode_VkCommandTypeEXT(dec, &command_type);
881     assert(command_type == VK_COMMAND_TYPE_vkGetDeviceMemoryCommitment_EXT);
882 
883     /* skip device */
884     /* skip memory */
885     if (vn_decode_simple_pointer(dec)) {
886         vn_decode_VkDeviceSize(dec, pCommittedMemoryInBytes);
887     } else {
888         pCommittedMemoryInBytes = NULL;
889     }
890 }
891 
vn_sizeof_vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo)892 static inline size_t vn_sizeof_vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
893 {
894     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddress_EXT;
895     const VkFlags cmd_flags = 0;
896     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
897 
898     cmd_size += vn_sizeof_VkDevice(&device);
899     cmd_size += vn_sizeof_simple_pointer(pInfo);
900     if (pInfo)
901         cmd_size += vn_sizeof_VkDeviceMemoryOpaqueCaptureAddressInfo(pInfo);
902 
903     return cmd_size;
904 }
905 
vn_encode_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo)906 static inline void vn_encode_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
907 {
908     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddress_EXT;
909 
910     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
911     vn_encode_VkFlags(enc, &cmd_flags);
912 
913     vn_encode_VkDevice(enc, &device);
914     if (vn_encode_simple_pointer(enc, pInfo))
915         vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo(enc, pInfo);
916 }
917 
vn_sizeof_vkGetDeviceMemoryOpaqueCaptureAddress_reply(VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo)918 static inline size_t vn_sizeof_vkGetDeviceMemoryOpaqueCaptureAddress_reply(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
919 {
920     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddress_EXT;
921     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
922 
923     uint64_t ret;
924     cmd_size += vn_sizeof_uint64_t(&ret);
925     /* skip device */
926     /* skip pInfo */
927 
928     return cmd_size;
929 }
930 
vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(struct vn_cs_decoder * dec,VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo)931 static inline uint64_t vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(struct vn_cs_decoder *dec, VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
932 {
933     VkCommandTypeEXT command_type;
934     vn_decode_VkCommandTypeEXT(dec, &command_type);
935     assert(command_type == VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddress_EXT);
936 
937     uint64_t ret;
938     vn_decode_uint64_t(dec, &ret);
939     /* skip device */
940     /* skip pInfo */
941 
942     return ret;
943 }
944 
vn_submit_vkAllocateMemory(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory,struct vn_instance_submit_command * submit)945 static inline void vn_submit_vkAllocateMemory(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory, struct vn_instance_submit_command *submit)
946 {
947     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
948     void *cmd_data = local_cmd_data;
949     size_t cmd_size = vn_sizeof_vkAllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
950     if (cmd_size > sizeof(local_cmd_data)) {
951         cmd_data = malloc(cmd_size);
952         if (!cmd_data)
953             cmd_size = 0;
954     }
955     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkAllocateMemory_reply(device, pAllocateInfo, pAllocator, pMemory) : 0;
956 
957     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
958     if (cmd_size) {
959         vn_encode_vkAllocateMemory(enc, cmd_flags, device, pAllocateInfo, pAllocator, pMemory);
960         vn_instance_submit_command(vn_instance, submit);
961         if (cmd_data != local_cmd_data)
962             free(cmd_data);
963     }
964 }
965 
vn_submit_vkFreeMemory(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)966 static inline void vn_submit_vkFreeMemory(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
967 {
968     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
969     void *cmd_data = local_cmd_data;
970     size_t cmd_size = vn_sizeof_vkFreeMemory(device, memory, pAllocator);
971     if (cmd_size > sizeof(local_cmd_data)) {
972         cmd_data = malloc(cmd_size);
973         if (!cmd_data)
974             cmd_size = 0;
975     }
976     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkFreeMemory_reply(device, memory, pAllocator) : 0;
977 
978     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
979     if (cmd_size) {
980         vn_encode_vkFreeMemory(enc, cmd_flags, device, memory, pAllocator);
981         vn_instance_submit_command(vn_instance, submit);
982         if (cmd_data != local_cmd_data)
983             free(cmd_data);
984     }
985 }
986 
vn_submit_vkUnmapMemory(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkDeviceMemory memory,struct vn_instance_submit_command * submit)987 static inline void vn_submit_vkUnmapMemory(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDeviceMemory memory, struct vn_instance_submit_command *submit)
988 {
989     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
990     void *cmd_data = local_cmd_data;
991     size_t cmd_size = vn_sizeof_vkUnmapMemory(device, memory);
992     if (cmd_size > sizeof(local_cmd_data)) {
993         cmd_data = malloc(cmd_size);
994         if (!cmd_data)
995             cmd_size = 0;
996     }
997     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkUnmapMemory_reply(device, memory) : 0;
998 
999     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1000     if (cmd_size) {
1001         vn_encode_vkUnmapMemory(enc, cmd_flags, device, memory);
1002         vn_instance_submit_command(vn_instance, submit);
1003         if (cmd_data != local_cmd_data)
1004             free(cmd_data);
1005     }
1006 }
1007 
vn_submit_vkFlushMappedMemoryRanges(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges,struct vn_instance_submit_command * submit)1008 static inline void vn_submit_vkFlushMappedMemoryRanges(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges, struct vn_instance_submit_command *submit)
1009 {
1010     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1011     void *cmd_data = local_cmd_data;
1012     size_t cmd_size = vn_sizeof_vkFlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
1013     if (cmd_size > sizeof(local_cmd_data)) {
1014         cmd_data = malloc(cmd_size);
1015         if (!cmd_data)
1016             cmd_size = 0;
1017     }
1018     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkFlushMappedMemoryRanges_reply(device, memoryRangeCount, pMemoryRanges) : 0;
1019 
1020     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1021     if (cmd_size) {
1022         vn_encode_vkFlushMappedMemoryRanges(enc, cmd_flags, device, memoryRangeCount, pMemoryRanges);
1023         vn_instance_submit_command(vn_instance, submit);
1024         if (cmd_data != local_cmd_data)
1025             free(cmd_data);
1026     }
1027 }
1028 
vn_submit_vkInvalidateMappedMemoryRanges(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges,struct vn_instance_submit_command * submit)1029 static inline void vn_submit_vkInvalidateMappedMemoryRanges(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges, struct vn_instance_submit_command *submit)
1030 {
1031     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1032     void *cmd_data = local_cmd_data;
1033     size_t cmd_size = vn_sizeof_vkInvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
1034     if (cmd_size > sizeof(local_cmd_data)) {
1035         cmd_data = malloc(cmd_size);
1036         if (!cmd_data)
1037             cmd_size = 0;
1038     }
1039     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkInvalidateMappedMemoryRanges_reply(device, memoryRangeCount, pMemoryRanges) : 0;
1040 
1041     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1042     if (cmd_size) {
1043         vn_encode_vkInvalidateMappedMemoryRanges(enc, cmd_flags, device, memoryRangeCount, pMemoryRanges);
1044         vn_instance_submit_command(vn_instance, submit);
1045         if (cmd_data != local_cmd_data)
1046             free(cmd_data);
1047     }
1048 }
1049 
vn_submit_vkGetDeviceMemoryCommitment(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes,struct vn_instance_submit_command * submit)1050 static inline void vn_submit_vkGetDeviceMemoryCommitment(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes, struct vn_instance_submit_command *submit)
1051 {
1052     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1053     void *cmd_data = local_cmd_data;
1054     size_t cmd_size = vn_sizeof_vkGetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
1055     if (cmd_size > sizeof(local_cmd_data)) {
1056         cmd_data = malloc(cmd_size);
1057         if (!cmd_data)
1058             cmd_size = 0;
1059     }
1060     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetDeviceMemoryCommitment_reply(device, memory, pCommittedMemoryInBytes) : 0;
1061 
1062     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1063     if (cmd_size) {
1064         vn_encode_vkGetDeviceMemoryCommitment(enc, cmd_flags, device, memory, pCommittedMemoryInBytes);
1065         vn_instance_submit_command(vn_instance, submit);
1066         if (cmd_data != local_cmd_data)
1067             free(cmd_data);
1068     }
1069 }
1070 
vn_submit_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo,struct vn_instance_submit_command * submit)1071 static inline void vn_submit_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo, struct vn_instance_submit_command *submit)
1072 {
1073     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1074     void *cmd_data = local_cmd_data;
1075     size_t cmd_size = vn_sizeof_vkGetDeviceMemoryOpaqueCaptureAddress(device, pInfo);
1076     if (cmd_size > sizeof(local_cmd_data)) {
1077         cmd_data = malloc(cmd_size);
1078         if (!cmd_data)
1079             cmd_size = 0;
1080     }
1081     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetDeviceMemoryOpaqueCaptureAddress_reply(device, pInfo) : 0;
1082 
1083     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1084     if (cmd_size) {
1085         vn_encode_vkGetDeviceMemoryOpaqueCaptureAddress(enc, cmd_flags, device, pInfo);
1086         vn_instance_submit_command(vn_instance, submit);
1087         if (cmd_data != local_cmd_data)
1088             free(cmd_data);
1089     }
1090 }
1091 
vn_call_vkAllocateMemory(struct vn_instance * vn_instance,VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)1092 static inline VkResult vn_call_vkAllocateMemory(struct vn_instance *vn_instance, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
1093 {
1094     VN_TRACE_FUNC();
1095 
1096     struct vn_instance_submit_command submit;
1097     vn_submit_vkAllocateMemory(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pAllocateInfo, pAllocator, pMemory, &submit);
1098     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1099     if (dec) {
1100         const VkResult ret = vn_decode_vkAllocateMemory_reply(dec, device, pAllocateInfo, pAllocator, pMemory);
1101         vn_instance_free_command_reply(vn_instance, &submit);
1102         return ret;
1103     } else {
1104         return VK_ERROR_OUT_OF_HOST_MEMORY;
1105     }
1106 }
1107 
vn_async_vkAllocateMemory(struct vn_instance * vn_instance,VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)1108 static inline void vn_async_vkAllocateMemory(struct vn_instance *vn_instance, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
1109 {
1110     struct vn_instance_submit_command submit;
1111     vn_submit_vkAllocateMemory(vn_instance, 0, device, pAllocateInfo, pAllocator, pMemory, &submit);
1112 }
1113 
vn_call_vkFreeMemory(struct vn_instance * vn_instance,VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)1114 static inline void vn_call_vkFreeMemory(struct vn_instance *vn_instance, VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
1115 {
1116     VN_TRACE_FUNC();
1117 
1118     struct vn_instance_submit_command submit;
1119     vn_submit_vkFreeMemory(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, memory, pAllocator, &submit);
1120     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1121     if (dec) {
1122         vn_decode_vkFreeMemory_reply(dec, device, memory, pAllocator);
1123         vn_instance_free_command_reply(vn_instance, &submit);
1124     }
1125 }
1126 
vn_async_vkFreeMemory(struct vn_instance * vn_instance,VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)1127 static inline void vn_async_vkFreeMemory(struct vn_instance *vn_instance, VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
1128 {
1129     struct vn_instance_submit_command submit;
1130     vn_submit_vkFreeMemory(vn_instance, 0, device, memory, pAllocator, &submit);
1131 }
1132 
vn_call_vkUnmapMemory(struct vn_instance * vn_instance,VkDevice device,VkDeviceMemory memory)1133 static inline void vn_call_vkUnmapMemory(struct vn_instance *vn_instance, VkDevice device, VkDeviceMemory memory)
1134 {
1135     VN_TRACE_FUNC();
1136 
1137     struct vn_instance_submit_command submit;
1138     vn_submit_vkUnmapMemory(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, memory, &submit);
1139     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1140     if (dec) {
1141         vn_decode_vkUnmapMemory_reply(dec, device, memory);
1142         vn_instance_free_command_reply(vn_instance, &submit);
1143     }
1144 }
1145 
vn_async_vkUnmapMemory(struct vn_instance * vn_instance,VkDevice device,VkDeviceMemory memory)1146 static inline void vn_async_vkUnmapMemory(struct vn_instance *vn_instance, VkDevice device, VkDeviceMemory memory)
1147 {
1148     struct vn_instance_submit_command submit;
1149     vn_submit_vkUnmapMemory(vn_instance, 0, device, memory, &submit);
1150 }
1151 
vn_call_vkFlushMappedMemoryRanges(struct vn_instance * vn_instance,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)1152 static inline VkResult vn_call_vkFlushMappedMemoryRanges(struct vn_instance *vn_instance, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
1153 {
1154     VN_TRACE_FUNC();
1155 
1156     struct vn_instance_submit_command submit;
1157     vn_submit_vkFlushMappedMemoryRanges(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, memoryRangeCount, pMemoryRanges, &submit);
1158     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1159     if (dec) {
1160         const VkResult ret = vn_decode_vkFlushMappedMemoryRanges_reply(dec, device, memoryRangeCount, pMemoryRanges);
1161         vn_instance_free_command_reply(vn_instance, &submit);
1162         return ret;
1163     } else {
1164         return VK_ERROR_OUT_OF_HOST_MEMORY;
1165     }
1166 }
1167 
vn_async_vkFlushMappedMemoryRanges(struct vn_instance * vn_instance,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)1168 static inline void vn_async_vkFlushMappedMemoryRanges(struct vn_instance *vn_instance, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
1169 {
1170     struct vn_instance_submit_command submit;
1171     vn_submit_vkFlushMappedMemoryRanges(vn_instance, 0, device, memoryRangeCount, pMemoryRanges, &submit);
1172 }
1173 
vn_call_vkInvalidateMappedMemoryRanges(struct vn_instance * vn_instance,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)1174 static inline VkResult vn_call_vkInvalidateMappedMemoryRanges(struct vn_instance *vn_instance, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
1175 {
1176     VN_TRACE_FUNC();
1177 
1178     struct vn_instance_submit_command submit;
1179     vn_submit_vkInvalidateMappedMemoryRanges(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, memoryRangeCount, pMemoryRanges, &submit);
1180     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1181     if (dec) {
1182         const VkResult ret = vn_decode_vkInvalidateMappedMemoryRanges_reply(dec, device, memoryRangeCount, pMemoryRanges);
1183         vn_instance_free_command_reply(vn_instance, &submit);
1184         return ret;
1185     } else {
1186         return VK_ERROR_OUT_OF_HOST_MEMORY;
1187     }
1188 }
1189 
vn_async_vkInvalidateMappedMemoryRanges(struct vn_instance * vn_instance,VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)1190 static inline void vn_async_vkInvalidateMappedMemoryRanges(struct vn_instance *vn_instance, VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
1191 {
1192     struct vn_instance_submit_command submit;
1193     vn_submit_vkInvalidateMappedMemoryRanges(vn_instance, 0, device, memoryRangeCount, pMemoryRanges, &submit);
1194 }
1195 
vn_call_vkGetDeviceMemoryCommitment(struct vn_instance * vn_instance,VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)1196 static inline void vn_call_vkGetDeviceMemoryCommitment(struct vn_instance *vn_instance, VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
1197 {
1198     VN_TRACE_FUNC();
1199 
1200     struct vn_instance_submit_command submit;
1201     vn_submit_vkGetDeviceMemoryCommitment(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, memory, pCommittedMemoryInBytes, &submit);
1202     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1203     if (dec) {
1204         vn_decode_vkGetDeviceMemoryCommitment_reply(dec, device, memory, pCommittedMemoryInBytes);
1205         vn_instance_free_command_reply(vn_instance, &submit);
1206     }
1207 }
1208 
vn_async_vkGetDeviceMemoryCommitment(struct vn_instance * vn_instance,VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)1209 static inline void vn_async_vkGetDeviceMemoryCommitment(struct vn_instance *vn_instance, VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
1210 {
1211     struct vn_instance_submit_command submit;
1212     vn_submit_vkGetDeviceMemoryCommitment(vn_instance, 0, device, memory, pCommittedMemoryInBytes, &submit);
1213 }
1214 
vn_call_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_instance * vn_instance,VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo)1215 static inline uint64_t vn_call_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_instance *vn_instance, VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
1216 {
1217     VN_TRACE_FUNC();
1218 
1219     struct vn_instance_submit_command submit;
1220     vn_submit_vkGetDeviceMemoryOpaqueCaptureAddress(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pInfo, &submit);
1221     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1222     if (dec) {
1223         const uint64_t ret = vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(dec, device, pInfo);
1224         vn_instance_free_command_reply(vn_instance, &submit);
1225         return ret;
1226     } else {
1227         return VK_ERROR_OUT_OF_HOST_MEMORY;
1228     }
1229 }
1230 
vn_async_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_instance * vn_instance,VkDevice device,const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo)1231 static inline void vn_async_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_instance *vn_instance, VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
1232 {
1233     struct vn_instance_submit_command submit;
1234     vn_submit_vkGetDeviceMemoryOpaqueCaptureAddress(vn_instance, 0, device, pInfo, &submit);
1235 }
1236 
1237 #endif /* VN_PROTOCOL_DRIVER_DEVICE_MEMORY_H */
1238