xref: /aosp_15_r20/external/virglrenderer/src/venus/venus-protocol/vn_protocol_renderer_device_memory.h (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1 /* This file is generated by venus-protocol.  See vn_protocol_renderer.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_RENDERER_DEVICE_MEMORY_H
9 #define VN_PROTOCOL_RENDERER_DEVICE_MEMORY_H
10 
11 #include "vn_protocol_renderer_structs.h"
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wpointer-arith"
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 /*
18  * These structs/unions/commands are not included
19  *
20  *   VkImportMemoryFdInfoKHR
21  *   vkMapMemory
22  *   vkGetMemoryFdKHR
23  *   vkGetMemoryFdPropertiesKHR
24  */
25 
26 /* struct VkExportMemoryAllocateInfo chain */
27 
28 static inline void *
vn_decode_VkExportMemoryAllocateInfo_pnext_temp(struct vn_cs_decoder * dec)29 vn_decode_VkExportMemoryAllocateInfo_pnext_temp(struct vn_cs_decoder *dec)
30 {
31     /* no known/supported struct */
32     if (vn_decode_simple_pointer(dec))
33         vn_cs_decoder_set_fatal(dec);
34     return NULL;
35 }
36 
37 static inline void
vn_decode_VkExportMemoryAllocateInfo_self_temp(struct vn_cs_decoder * dec,VkExportMemoryAllocateInfo * val)38 vn_decode_VkExportMemoryAllocateInfo_self_temp(struct vn_cs_decoder *dec, VkExportMemoryAllocateInfo *val)
39 {
40     /* skip val->{sType,pNext} */
41     vn_decode_VkFlags(dec, &val->handleTypes);
42 }
43 
44 static inline void
vn_decode_VkExportMemoryAllocateInfo_temp(struct vn_cs_decoder * dec,VkExportMemoryAllocateInfo * val)45 vn_decode_VkExportMemoryAllocateInfo_temp(struct vn_cs_decoder *dec, VkExportMemoryAllocateInfo *val)
46 {
47     VkStructureType stype;
48     vn_decode_VkStructureType(dec, &stype);
49     if (stype != VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO)
50         vn_cs_decoder_set_fatal(dec);
51 
52     val->sType = stype;
53     val->pNext = vn_decode_VkExportMemoryAllocateInfo_pnext_temp(dec);
54     vn_decode_VkExportMemoryAllocateInfo_self_temp(dec, val);
55 }
56 
57 static inline void
vn_replace_VkExportMemoryAllocateInfo_handle_self(VkExportMemoryAllocateInfo * val)58 vn_replace_VkExportMemoryAllocateInfo_handle_self(VkExportMemoryAllocateInfo *val)
59 {
60     /* skip val->sType */
61     /* skip val->pNext */
62     /* skip val->handleTypes */
63 }
64 
65 static inline void
vn_replace_VkExportMemoryAllocateInfo_handle(VkExportMemoryAllocateInfo * val)66 vn_replace_VkExportMemoryAllocateInfo_handle(VkExportMemoryAllocateInfo *val)
67 {
68     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
69 
70     do {
71         switch ((int32_t)pnext->sType) {
72         case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO:
73             vn_replace_VkExportMemoryAllocateInfo_handle_self((VkExportMemoryAllocateInfo *)pnext);
74             break;
75         default:
76             /* ignore unknown/unsupported struct */
77             break;
78         }
79         pnext = pnext->pNext;
80     } while (pnext);
81 }
82 
83 /* struct VkMemoryAllocateFlagsInfo chain */
84 
85 static inline void *
vn_decode_VkMemoryAllocateFlagsInfo_pnext_temp(struct vn_cs_decoder * dec)86 vn_decode_VkMemoryAllocateFlagsInfo_pnext_temp(struct vn_cs_decoder *dec)
87 {
88     /* no known/supported struct */
89     if (vn_decode_simple_pointer(dec))
90         vn_cs_decoder_set_fatal(dec);
91     return NULL;
92 }
93 
94 static inline void
vn_decode_VkMemoryAllocateFlagsInfo_self_temp(struct vn_cs_decoder * dec,VkMemoryAllocateFlagsInfo * val)95 vn_decode_VkMemoryAllocateFlagsInfo_self_temp(struct vn_cs_decoder *dec, VkMemoryAllocateFlagsInfo *val)
96 {
97     /* skip val->{sType,pNext} */
98     vn_decode_VkFlags(dec, &val->flags);
99     vn_decode_uint32_t(dec, &val->deviceMask);
100 }
101 
102 static inline void
vn_decode_VkMemoryAllocateFlagsInfo_temp(struct vn_cs_decoder * dec,VkMemoryAllocateFlagsInfo * val)103 vn_decode_VkMemoryAllocateFlagsInfo_temp(struct vn_cs_decoder *dec, VkMemoryAllocateFlagsInfo *val)
104 {
105     VkStructureType stype;
106     vn_decode_VkStructureType(dec, &stype);
107     if (stype != VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO)
108         vn_cs_decoder_set_fatal(dec);
109 
110     val->sType = stype;
111     val->pNext = vn_decode_VkMemoryAllocateFlagsInfo_pnext_temp(dec);
112     vn_decode_VkMemoryAllocateFlagsInfo_self_temp(dec, val);
113 }
114 
115 static inline void
vn_replace_VkMemoryAllocateFlagsInfo_handle_self(VkMemoryAllocateFlagsInfo * val)116 vn_replace_VkMemoryAllocateFlagsInfo_handle_self(VkMemoryAllocateFlagsInfo *val)
117 {
118     /* skip val->sType */
119     /* skip val->pNext */
120     /* skip val->flags */
121     /* skip val->deviceMask */
122 }
123 
124 static inline void
vn_replace_VkMemoryAllocateFlagsInfo_handle(VkMemoryAllocateFlagsInfo * val)125 vn_replace_VkMemoryAllocateFlagsInfo_handle(VkMemoryAllocateFlagsInfo *val)
126 {
127     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
128 
129     do {
130         switch ((int32_t)pnext->sType) {
131         case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO:
132             vn_replace_VkMemoryAllocateFlagsInfo_handle_self((VkMemoryAllocateFlagsInfo *)pnext);
133             break;
134         default:
135             /* ignore unknown/unsupported struct */
136             break;
137         }
138         pnext = pnext->pNext;
139     } while (pnext);
140 }
141 
142 /* struct VkMemoryDedicatedAllocateInfo chain */
143 
144 static inline void *
vn_decode_VkMemoryDedicatedAllocateInfo_pnext_temp(struct vn_cs_decoder * dec)145 vn_decode_VkMemoryDedicatedAllocateInfo_pnext_temp(struct vn_cs_decoder *dec)
146 {
147     /* no known/supported struct */
148     if (vn_decode_simple_pointer(dec))
149         vn_cs_decoder_set_fatal(dec);
150     return NULL;
151 }
152 
153 static inline void
vn_decode_VkMemoryDedicatedAllocateInfo_self_temp(struct vn_cs_decoder * dec,VkMemoryDedicatedAllocateInfo * val)154 vn_decode_VkMemoryDedicatedAllocateInfo_self_temp(struct vn_cs_decoder *dec, VkMemoryDedicatedAllocateInfo *val)
155 {
156     /* skip val->{sType,pNext} */
157     vn_decode_VkImage_lookup(dec, &val->image);
158     vn_decode_VkBuffer_lookup(dec, &val->buffer);
159 }
160 
161 static inline void
vn_decode_VkMemoryDedicatedAllocateInfo_temp(struct vn_cs_decoder * dec,VkMemoryDedicatedAllocateInfo * val)162 vn_decode_VkMemoryDedicatedAllocateInfo_temp(struct vn_cs_decoder *dec, VkMemoryDedicatedAllocateInfo *val)
163 {
164     VkStructureType stype;
165     vn_decode_VkStructureType(dec, &stype);
166     if (stype != VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO)
167         vn_cs_decoder_set_fatal(dec);
168 
169     val->sType = stype;
170     val->pNext = vn_decode_VkMemoryDedicatedAllocateInfo_pnext_temp(dec);
171     vn_decode_VkMemoryDedicatedAllocateInfo_self_temp(dec, val);
172 }
173 
174 static inline void
vn_replace_VkMemoryDedicatedAllocateInfo_handle_self(VkMemoryDedicatedAllocateInfo * val)175 vn_replace_VkMemoryDedicatedAllocateInfo_handle_self(VkMemoryDedicatedAllocateInfo *val)
176 {
177     /* skip val->sType */
178     /* skip val->pNext */
179     vn_replace_VkImage_handle(&val->image);
180     vn_replace_VkBuffer_handle(&val->buffer);
181 }
182 
183 static inline void
vn_replace_VkMemoryDedicatedAllocateInfo_handle(VkMemoryDedicatedAllocateInfo * val)184 vn_replace_VkMemoryDedicatedAllocateInfo_handle(VkMemoryDedicatedAllocateInfo *val)
185 {
186     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
187 
188     do {
189         switch ((int32_t)pnext->sType) {
190         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
191             vn_replace_VkMemoryDedicatedAllocateInfo_handle_self((VkMemoryDedicatedAllocateInfo *)pnext);
192             break;
193         default:
194             /* ignore unknown/unsupported struct */
195             break;
196         }
197         pnext = pnext->pNext;
198     } while (pnext);
199 }
200 
201 /* struct VkMemoryOpaqueCaptureAddressAllocateInfo chain */
202 
203 static inline void *
vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext_temp(struct vn_cs_decoder * dec)204 vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext_temp(struct vn_cs_decoder *dec)
205 {
206     /* no known/supported struct */
207     if (vn_decode_simple_pointer(dec))
208         vn_cs_decoder_set_fatal(dec);
209     return NULL;
210 }
211 
212 static inline void
vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_self_temp(struct vn_cs_decoder * dec,VkMemoryOpaqueCaptureAddressAllocateInfo * val)213 vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_self_temp(struct vn_cs_decoder *dec, VkMemoryOpaqueCaptureAddressAllocateInfo *val)
214 {
215     /* skip val->{sType,pNext} */
216     vn_decode_uint64_t(dec, &val->opaqueCaptureAddress);
217 }
218 
219 static inline void
vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_temp(struct vn_cs_decoder * dec,VkMemoryOpaqueCaptureAddressAllocateInfo * val)220 vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_temp(struct vn_cs_decoder *dec, VkMemoryOpaqueCaptureAddressAllocateInfo *val)
221 {
222     VkStructureType stype;
223     vn_decode_VkStructureType(dec, &stype);
224     if (stype != VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO)
225         vn_cs_decoder_set_fatal(dec);
226 
227     val->sType = stype;
228     val->pNext = vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_pnext_temp(dec);
229     vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_self_temp(dec, val);
230 }
231 
232 static inline void
vn_replace_VkMemoryOpaqueCaptureAddressAllocateInfo_handle_self(VkMemoryOpaqueCaptureAddressAllocateInfo * val)233 vn_replace_VkMemoryOpaqueCaptureAddressAllocateInfo_handle_self(VkMemoryOpaqueCaptureAddressAllocateInfo *val)
234 {
235     /* skip val->sType */
236     /* skip val->pNext */
237     /* skip val->opaqueCaptureAddress */
238 }
239 
240 static inline void
vn_replace_VkMemoryOpaqueCaptureAddressAllocateInfo_handle(VkMemoryOpaqueCaptureAddressAllocateInfo * val)241 vn_replace_VkMemoryOpaqueCaptureAddressAllocateInfo_handle(VkMemoryOpaqueCaptureAddressAllocateInfo *val)
242 {
243     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
244 
245     do {
246         switch ((int32_t)pnext->sType) {
247         case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO:
248             vn_replace_VkMemoryOpaqueCaptureAddressAllocateInfo_handle_self((VkMemoryOpaqueCaptureAddressAllocateInfo *)pnext);
249             break;
250         default:
251             /* ignore unknown/unsupported struct */
252             break;
253         }
254         pnext = pnext->pNext;
255     } while (pnext);
256 }
257 
258 /* struct VkImportMemoryResourceInfoMESA chain */
259 
260 static inline void *
vn_decode_VkImportMemoryResourceInfoMESA_pnext_temp(struct vn_cs_decoder * dec)261 vn_decode_VkImportMemoryResourceInfoMESA_pnext_temp(struct vn_cs_decoder *dec)
262 {
263     /* no known/supported struct */
264     if (vn_decode_simple_pointer(dec))
265         vn_cs_decoder_set_fatal(dec);
266     return NULL;
267 }
268 
269 static inline void
vn_decode_VkImportMemoryResourceInfoMESA_self_temp(struct vn_cs_decoder * dec,VkImportMemoryResourceInfoMESA * val)270 vn_decode_VkImportMemoryResourceInfoMESA_self_temp(struct vn_cs_decoder *dec, VkImportMemoryResourceInfoMESA *val)
271 {
272     /* skip val->{sType,pNext} */
273     vn_decode_uint32_t(dec, &val->resourceId);
274 }
275 
276 static inline void
vn_decode_VkImportMemoryResourceInfoMESA_temp(struct vn_cs_decoder * dec,VkImportMemoryResourceInfoMESA * val)277 vn_decode_VkImportMemoryResourceInfoMESA_temp(struct vn_cs_decoder *dec, VkImportMemoryResourceInfoMESA *val)
278 {
279     VkStructureType stype;
280     vn_decode_VkStructureType(dec, &stype);
281     if (stype != VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA)
282         vn_cs_decoder_set_fatal(dec);
283 
284     val->sType = stype;
285     val->pNext = vn_decode_VkImportMemoryResourceInfoMESA_pnext_temp(dec);
286     vn_decode_VkImportMemoryResourceInfoMESA_self_temp(dec, val);
287 }
288 
289 static inline void
vn_replace_VkImportMemoryResourceInfoMESA_handle_self(VkImportMemoryResourceInfoMESA * val)290 vn_replace_VkImportMemoryResourceInfoMESA_handle_self(VkImportMemoryResourceInfoMESA *val)
291 {
292     /* skip val->sType */
293     /* skip val->pNext */
294     /* skip val->resourceId */
295 }
296 
297 static inline void
vn_replace_VkImportMemoryResourceInfoMESA_handle(VkImportMemoryResourceInfoMESA * val)298 vn_replace_VkImportMemoryResourceInfoMESA_handle(VkImportMemoryResourceInfoMESA *val)
299 {
300     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
301 
302     do {
303         switch ((int32_t)pnext->sType) {
304         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA:
305             vn_replace_VkImportMemoryResourceInfoMESA_handle_self((VkImportMemoryResourceInfoMESA *)pnext);
306             break;
307         default:
308             /* ignore unknown/unsupported struct */
309             break;
310         }
311         pnext = pnext->pNext;
312     } while (pnext);
313 }
314 
315 /* struct VkMemoryAllocateInfo chain */
316 
317 static inline void *
vn_decode_VkMemoryAllocateInfo_pnext_temp(struct vn_cs_decoder * dec)318 vn_decode_VkMemoryAllocateInfo_pnext_temp(struct vn_cs_decoder *dec)
319 {
320     VkBaseOutStructure *pnext;
321     VkStructureType stype;
322 
323     if (!vn_decode_simple_pointer(dec))
324         return NULL;
325 
326     vn_decode_VkStructureType(dec, &stype);
327     switch ((int32_t)stype) {
328     case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO:
329         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkExportMemoryAllocateInfo));
330         if (pnext) {
331             pnext->sType = stype;
332             pnext->pNext = vn_decode_VkMemoryAllocateInfo_pnext_temp(dec);
333             vn_decode_VkExportMemoryAllocateInfo_self_temp(dec, (VkExportMemoryAllocateInfo *)pnext);
334         }
335         break;
336     case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO:
337         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMemoryAllocateFlagsInfo));
338         if (pnext) {
339             pnext->sType = stype;
340             pnext->pNext = vn_decode_VkMemoryAllocateInfo_pnext_temp(dec);
341             vn_decode_VkMemoryAllocateFlagsInfo_self_temp(dec, (VkMemoryAllocateFlagsInfo *)pnext);
342         }
343         break;
344     case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
345         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMemoryDedicatedAllocateInfo));
346         if (pnext) {
347             pnext->sType = stype;
348             pnext->pNext = vn_decode_VkMemoryAllocateInfo_pnext_temp(dec);
349             vn_decode_VkMemoryDedicatedAllocateInfo_self_temp(dec, (VkMemoryDedicatedAllocateInfo *)pnext);
350         }
351         break;
352     case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO:
353         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMemoryOpaqueCaptureAddressAllocateInfo));
354         if (pnext) {
355             pnext->sType = stype;
356             pnext->pNext = vn_decode_VkMemoryAllocateInfo_pnext_temp(dec);
357             vn_decode_VkMemoryOpaqueCaptureAddressAllocateInfo_self_temp(dec, (VkMemoryOpaqueCaptureAddressAllocateInfo *)pnext);
358         }
359         break;
360     case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA:
361         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkImportMemoryResourceInfoMESA));
362         if (pnext) {
363             pnext->sType = stype;
364             pnext->pNext = vn_decode_VkMemoryAllocateInfo_pnext_temp(dec);
365             vn_decode_VkImportMemoryResourceInfoMESA_self_temp(dec, (VkImportMemoryResourceInfoMESA *)pnext);
366         }
367         break;
368     case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
369     default:
370         /* unexpected struct */
371         pnext = NULL;
372         vn_cs_decoder_set_fatal(dec);
373         break;
374     }
375 
376     return pnext;
377 }
378 
379 static inline void
vn_decode_VkMemoryAllocateInfo_self_temp(struct vn_cs_decoder * dec,VkMemoryAllocateInfo * val)380 vn_decode_VkMemoryAllocateInfo_self_temp(struct vn_cs_decoder *dec, VkMemoryAllocateInfo *val)
381 {
382     /* skip val->{sType,pNext} */
383     vn_decode_VkDeviceSize(dec, &val->allocationSize);
384     vn_decode_uint32_t(dec, &val->memoryTypeIndex);
385 }
386 
387 static inline void
vn_decode_VkMemoryAllocateInfo_temp(struct vn_cs_decoder * dec,VkMemoryAllocateInfo * val)388 vn_decode_VkMemoryAllocateInfo_temp(struct vn_cs_decoder *dec, VkMemoryAllocateInfo *val)
389 {
390     VkStructureType stype;
391     vn_decode_VkStructureType(dec, &stype);
392     if (stype != VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO)
393         vn_cs_decoder_set_fatal(dec);
394 
395     val->sType = stype;
396     val->pNext = vn_decode_VkMemoryAllocateInfo_pnext_temp(dec);
397     vn_decode_VkMemoryAllocateInfo_self_temp(dec, val);
398 }
399 
400 static inline void
vn_replace_VkMemoryAllocateInfo_handle_self(VkMemoryAllocateInfo * val)401 vn_replace_VkMemoryAllocateInfo_handle_self(VkMemoryAllocateInfo *val)
402 {
403     /* skip val->sType */
404     /* skip val->pNext */
405     /* skip val->allocationSize */
406     /* skip val->memoryTypeIndex */
407 }
408 
409 static inline void
vn_replace_VkMemoryAllocateInfo_handle(VkMemoryAllocateInfo * val)410 vn_replace_VkMemoryAllocateInfo_handle(VkMemoryAllocateInfo *val)
411 {
412     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
413 
414     do {
415         switch ((int32_t)pnext->sType) {
416         case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO:
417             vn_replace_VkMemoryAllocateInfo_handle_self((VkMemoryAllocateInfo *)pnext);
418             break;
419         case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO:
420             vn_replace_VkExportMemoryAllocateInfo_handle_self((VkExportMemoryAllocateInfo *)pnext);
421             break;
422         case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO:
423             vn_replace_VkMemoryAllocateFlagsInfo_handle_self((VkMemoryAllocateFlagsInfo *)pnext);
424             break;
425         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
426             vn_replace_VkMemoryDedicatedAllocateInfo_handle_self((VkMemoryDedicatedAllocateInfo *)pnext);
427             break;
428         case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO:
429             vn_replace_VkMemoryOpaqueCaptureAddressAllocateInfo_handle_self((VkMemoryOpaqueCaptureAddressAllocateInfo *)pnext);
430             break;
431         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA:
432             vn_replace_VkImportMemoryResourceInfoMESA_handle_self((VkImportMemoryResourceInfoMESA *)pnext);
433             break;
434         case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
435         default:
436             /* ignore unknown/unsupported struct */
437             break;
438         }
439         pnext = pnext->pNext;
440     } while (pnext);
441 }
442 
443 /* struct VkMappedMemoryRange chain */
444 
445 static inline void *
vn_decode_VkMappedMemoryRange_pnext_temp(struct vn_cs_decoder * dec)446 vn_decode_VkMappedMemoryRange_pnext_temp(struct vn_cs_decoder *dec)
447 {
448     /* no known/supported struct */
449     if (vn_decode_simple_pointer(dec))
450         vn_cs_decoder_set_fatal(dec);
451     return NULL;
452 }
453 
454 static inline void
vn_decode_VkMappedMemoryRange_self_temp(struct vn_cs_decoder * dec,VkMappedMemoryRange * val)455 vn_decode_VkMappedMemoryRange_self_temp(struct vn_cs_decoder *dec, VkMappedMemoryRange *val)
456 {
457     /* skip val->{sType,pNext} */
458     vn_decode_VkDeviceMemory_lookup(dec, &val->memory);
459     vn_decode_VkDeviceSize(dec, &val->offset);
460     vn_decode_VkDeviceSize(dec, &val->size);
461 }
462 
463 static inline void
vn_decode_VkMappedMemoryRange_temp(struct vn_cs_decoder * dec,VkMappedMemoryRange * val)464 vn_decode_VkMappedMemoryRange_temp(struct vn_cs_decoder *dec, VkMappedMemoryRange *val)
465 {
466     VkStructureType stype;
467     vn_decode_VkStructureType(dec, &stype);
468     if (stype != VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE)
469         vn_cs_decoder_set_fatal(dec);
470 
471     val->sType = stype;
472     val->pNext = vn_decode_VkMappedMemoryRange_pnext_temp(dec);
473     vn_decode_VkMappedMemoryRange_self_temp(dec, val);
474 }
475 
476 static inline void
vn_replace_VkMappedMemoryRange_handle_self(VkMappedMemoryRange * val)477 vn_replace_VkMappedMemoryRange_handle_self(VkMappedMemoryRange *val)
478 {
479     /* skip val->sType */
480     /* skip val->pNext */
481     vn_replace_VkDeviceMemory_handle(&val->memory);
482     /* skip val->offset */
483     /* skip val->size */
484 }
485 
486 static inline void
vn_replace_VkMappedMemoryRange_handle(VkMappedMemoryRange * val)487 vn_replace_VkMappedMemoryRange_handle(VkMappedMemoryRange *val)
488 {
489     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
490 
491     do {
492         switch ((int32_t)pnext->sType) {
493         case VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE:
494             vn_replace_VkMappedMemoryRange_handle_self((VkMappedMemoryRange *)pnext);
495             break;
496         default:
497             /* ignore unknown/unsupported struct */
498             break;
499         }
500         pnext = pnext->pNext;
501     } while (pnext);
502 }
503 
504 /* struct VkDeviceMemoryOpaqueCaptureAddressInfo chain */
505 
506 static inline void *
vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext_temp(struct vn_cs_decoder * dec)507 vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext_temp(struct vn_cs_decoder *dec)
508 {
509     /* no known/supported struct */
510     if (vn_decode_simple_pointer(dec))
511         vn_cs_decoder_set_fatal(dec);
512     return NULL;
513 }
514 
515 static inline void
vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_self_temp(struct vn_cs_decoder * dec,VkDeviceMemoryOpaqueCaptureAddressInfo * val)516 vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_self_temp(struct vn_cs_decoder *dec, VkDeviceMemoryOpaqueCaptureAddressInfo *val)
517 {
518     /* skip val->{sType,pNext} */
519     vn_decode_VkDeviceMemory_lookup(dec, &val->memory);
520 }
521 
522 static inline void
vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_temp(struct vn_cs_decoder * dec,VkDeviceMemoryOpaqueCaptureAddressInfo * val)523 vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_temp(struct vn_cs_decoder *dec, VkDeviceMemoryOpaqueCaptureAddressInfo *val)
524 {
525     VkStructureType stype;
526     vn_decode_VkStructureType(dec, &stype);
527     if (stype != VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO)
528         vn_cs_decoder_set_fatal(dec);
529 
530     val->sType = stype;
531     val->pNext = vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext_temp(dec);
532     vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_self_temp(dec, val);
533 }
534 
535 static inline void
vn_replace_VkDeviceMemoryOpaqueCaptureAddressInfo_handle_self(VkDeviceMemoryOpaqueCaptureAddressInfo * val)536 vn_replace_VkDeviceMemoryOpaqueCaptureAddressInfo_handle_self(VkDeviceMemoryOpaqueCaptureAddressInfo *val)
537 {
538     /* skip val->sType */
539     /* skip val->pNext */
540     vn_replace_VkDeviceMemory_handle(&val->memory);
541 }
542 
543 static inline void
vn_replace_VkDeviceMemoryOpaqueCaptureAddressInfo_handle(VkDeviceMemoryOpaqueCaptureAddressInfo * val)544 vn_replace_VkDeviceMemoryOpaqueCaptureAddressInfo_handle(VkDeviceMemoryOpaqueCaptureAddressInfo *val)
545 {
546     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
547 
548     do {
549         switch ((int32_t)pnext->sType) {
550         case VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO:
551             vn_replace_VkDeviceMemoryOpaqueCaptureAddressInfo_handle_self((VkDeviceMemoryOpaqueCaptureAddressInfo *)pnext);
552             break;
553         default:
554             /* ignore unknown/unsupported struct */
555             break;
556         }
557         pnext = pnext->pNext;
558     } while (pnext);
559 }
560 
561 /* struct VkMemoryResourceAllocationSizeProperties100000MESA chain */
562 
563 static inline void
vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(struct vn_cs_encoder * enc,const void * val)564 vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(struct vn_cs_encoder *enc, const void *val)
565 {
566     /* no known/supported struct */
567     vn_encode_simple_pointer(enc, NULL);
568 }
569 
570 static inline void
vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self(struct vn_cs_encoder * enc,const VkMemoryResourceAllocationSizeProperties100000MESA * val)571 vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self(struct vn_cs_encoder *enc, const VkMemoryResourceAllocationSizeProperties100000MESA *val)
572 {
573     /* skip val->{sType,pNext} */
574     vn_encode_uint64_t(enc, &val->allocationSize);
575 }
576 
577 static inline void
vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA(struct vn_cs_encoder * enc,const VkMemoryResourceAllocationSizeProperties100000MESA * val)578 vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA(struct vn_cs_encoder *enc, const VkMemoryResourceAllocationSizeProperties100000MESA *val)
579 {
580     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA);
581     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA });
582     vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(enc, val->pNext);
583     vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self(enc, val);
584 }
585 
586 static inline void *
vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial_temp(struct vn_cs_decoder * dec)587 vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial_temp(struct vn_cs_decoder *dec)
588 {
589     /* no known/supported struct */
590     if (vn_decode_simple_pointer(dec))
591         vn_cs_decoder_set_fatal(dec);
592     return NULL;
593 }
594 
595 static inline void
vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial_temp(struct vn_cs_decoder * dec,VkMemoryResourceAllocationSizeProperties100000MESA * val)596 vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial_temp(struct vn_cs_decoder *dec, VkMemoryResourceAllocationSizeProperties100000MESA *val)
597 {
598     /* skip val->{sType,pNext} */
599     /* skip val->allocationSize */
600 }
601 
602 static inline void
vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_partial_temp(struct vn_cs_decoder * dec,VkMemoryResourceAllocationSizeProperties100000MESA * val)603 vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_partial_temp(struct vn_cs_decoder *dec, VkMemoryResourceAllocationSizeProperties100000MESA *val)
604 {
605     VkStructureType stype;
606     vn_decode_VkStructureType(dec, &stype);
607     if (stype != VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA)
608         vn_cs_decoder_set_fatal(dec);
609 
610     val->sType = stype;
611     val->pNext = vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial_temp(dec);
612     vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial_temp(dec, val);
613 }
614 
615 /* struct VkMemoryResourcePropertiesMESA chain */
616 
617 static inline void
vn_encode_VkMemoryResourcePropertiesMESA_pnext(struct vn_cs_encoder * enc,const void * val)618 vn_encode_VkMemoryResourcePropertiesMESA_pnext(struct vn_cs_encoder *enc, const void *val)
619 {
620     const VkBaseInStructure *pnext = val;
621 
622     while (pnext) {
623         switch ((int32_t)pnext->sType) {
624         case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA:
625             vn_encode_simple_pointer(enc, pnext);
626             vn_encode_VkStructureType(enc, &pnext->sType);
627             vn_encode_VkMemoryResourcePropertiesMESA_pnext(enc, pnext->pNext);
628             vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self(enc, (const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext);
629             return;
630         default:
631             /* ignore unknown/unsupported struct */
632             break;
633         }
634         pnext = pnext->pNext;
635     }
636 
637     vn_encode_simple_pointer(enc, NULL);
638 }
639 
640 static inline void
vn_encode_VkMemoryResourcePropertiesMESA_self(struct vn_cs_encoder * enc,const VkMemoryResourcePropertiesMESA * val)641 vn_encode_VkMemoryResourcePropertiesMESA_self(struct vn_cs_encoder *enc, const VkMemoryResourcePropertiesMESA *val)
642 {
643     /* skip val->{sType,pNext} */
644     vn_encode_uint32_t(enc, &val->memoryTypeBits);
645 }
646 
647 static inline void
vn_encode_VkMemoryResourcePropertiesMESA(struct vn_cs_encoder * enc,const VkMemoryResourcePropertiesMESA * val)648 vn_encode_VkMemoryResourcePropertiesMESA(struct vn_cs_encoder *enc, const VkMemoryResourcePropertiesMESA *val)
649 {
650     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA);
651     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA });
652     vn_encode_VkMemoryResourcePropertiesMESA_pnext(enc, val->pNext);
653     vn_encode_VkMemoryResourcePropertiesMESA_self(enc, val);
654 }
655 
656 static inline void *
vn_decode_VkMemoryResourcePropertiesMESA_pnext_partial_temp(struct vn_cs_decoder * dec)657 vn_decode_VkMemoryResourcePropertiesMESA_pnext_partial_temp(struct vn_cs_decoder *dec)
658 {
659     VkBaseOutStructure *pnext;
660     VkStructureType stype;
661 
662     if (!vn_decode_simple_pointer(dec))
663         return NULL;
664 
665     vn_decode_VkStructureType(dec, &stype);
666     switch ((int32_t)stype) {
667     case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA:
668         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMemoryResourceAllocationSizeProperties100000MESA));
669         if (pnext) {
670             pnext->sType = stype;
671             pnext->pNext = vn_decode_VkMemoryResourcePropertiesMESA_pnext_partial_temp(dec);
672             vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial_temp(dec, (VkMemoryResourceAllocationSizeProperties100000MESA *)pnext);
673         }
674         break;
675     default:
676         /* unexpected struct */
677         pnext = NULL;
678         vn_cs_decoder_set_fatal(dec);
679         break;
680     }
681 
682     return pnext;
683 }
684 
685 static inline void
vn_decode_VkMemoryResourcePropertiesMESA_self_partial_temp(struct vn_cs_decoder * dec,VkMemoryResourcePropertiesMESA * val)686 vn_decode_VkMemoryResourcePropertiesMESA_self_partial_temp(struct vn_cs_decoder *dec, VkMemoryResourcePropertiesMESA *val)
687 {
688     /* skip val->{sType,pNext} */
689     /* skip val->memoryTypeBits */
690 }
691 
692 static inline void
vn_decode_VkMemoryResourcePropertiesMESA_partial_temp(struct vn_cs_decoder * dec,VkMemoryResourcePropertiesMESA * val)693 vn_decode_VkMemoryResourcePropertiesMESA_partial_temp(struct vn_cs_decoder *dec, VkMemoryResourcePropertiesMESA *val)
694 {
695     VkStructureType stype;
696     vn_decode_VkStructureType(dec, &stype);
697     if (stype != VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA)
698         vn_cs_decoder_set_fatal(dec);
699 
700     val->sType = stype;
701     val->pNext = vn_decode_VkMemoryResourcePropertiesMESA_pnext_partial_temp(dec);
702     vn_decode_VkMemoryResourcePropertiesMESA_self_partial_temp(dec, val);
703 }
704 
vn_decode_vkAllocateMemory_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkAllocateMemory * args)705 static inline void vn_decode_vkAllocateMemory_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkAllocateMemory *args)
706 {
707     vn_decode_VkDevice_lookup(dec, &args->device);
708     if (vn_decode_simple_pointer(dec)) {
709         args->pAllocateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pAllocateInfo));
710         if (!args->pAllocateInfo) return;
711         vn_decode_VkMemoryAllocateInfo_temp(dec, (VkMemoryAllocateInfo *)args->pAllocateInfo);
712     } else {
713         args->pAllocateInfo = NULL;
714         vn_cs_decoder_set_fatal(dec);
715     }
716     if (vn_decode_simple_pointer(dec)) {
717         vn_cs_decoder_set_fatal(dec);
718     } else {
719         args->pAllocator = NULL;
720     }
721     if (vn_decode_simple_pointer(dec)) {
722         args->pMemory = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pMemory));
723         if (!args->pMemory) return;
724         vn_decode_VkDeviceMemory(dec, args->pMemory);
725     } else {
726         args->pMemory = NULL;
727         vn_cs_decoder_set_fatal(dec);
728     }
729 }
730 
vn_replace_vkAllocateMemory_args_handle(struct vn_command_vkAllocateMemory * args)731 static inline void vn_replace_vkAllocateMemory_args_handle(struct vn_command_vkAllocateMemory *args)
732 {
733     vn_replace_VkDevice_handle(&args->device);
734     if (args->pAllocateInfo)
735         vn_replace_VkMemoryAllocateInfo_handle((VkMemoryAllocateInfo *)args->pAllocateInfo);
736     /* skip args->pAllocator */
737     /* skip args->pMemory */
738 }
739 
vn_encode_vkAllocateMemory_reply(struct vn_cs_encoder * enc,const struct vn_command_vkAllocateMemory * args)740 static inline void vn_encode_vkAllocateMemory_reply(struct vn_cs_encoder *enc, const struct vn_command_vkAllocateMemory *args)
741 {
742     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkAllocateMemory_EXT});
743 
744     vn_encode_VkResult(enc, &args->ret);
745     /* skip args->device */
746     /* skip args->pAllocateInfo */
747     /* skip args->pAllocator */
748     if (vn_encode_simple_pointer(enc, args->pMemory))
749         vn_encode_VkDeviceMemory(enc, args->pMemory);
750 }
751 
vn_decode_vkFreeMemory_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkFreeMemory * args)752 static inline void vn_decode_vkFreeMemory_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkFreeMemory *args)
753 {
754     vn_decode_VkDevice_lookup(dec, &args->device);
755     vn_decode_VkDeviceMemory_lookup(dec, &args->memory);
756     if (vn_decode_simple_pointer(dec)) {
757         vn_cs_decoder_set_fatal(dec);
758     } else {
759         args->pAllocator = NULL;
760     }
761 }
762 
vn_replace_vkFreeMemory_args_handle(struct vn_command_vkFreeMemory * args)763 static inline void vn_replace_vkFreeMemory_args_handle(struct vn_command_vkFreeMemory *args)
764 {
765     vn_replace_VkDevice_handle(&args->device);
766     vn_replace_VkDeviceMemory_handle(&args->memory);
767     /* skip args->pAllocator */
768 }
769 
vn_encode_vkFreeMemory_reply(struct vn_cs_encoder * enc,const struct vn_command_vkFreeMemory * args)770 static inline void vn_encode_vkFreeMemory_reply(struct vn_cs_encoder *enc, const struct vn_command_vkFreeMemory *args)
771 {
772     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkFreeMemory_EXT});
773 
774     /* skip args->device */
775     /* skip args->memory */
776     /* skip args->pAllocator */
777 }
778 
vn_decode_vkUnmapMemory_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkUnmapMemory * args)779 static inline void vn_decode_vkUnmapMemory_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkUnmapMemory *args)
780 {
781     vn_decode_VkDevice_lookup(dec, &args->device);
782     vn_decode_VkDeviceMemory_lookup(dec, &args->memory);
783 }
784 
vn_replace_vkUnmapMemory_args_handle(struct vn_command_vkUnmapMemory * args)785 static inline void vn_replace_vkUnmapMemory_args_handle(struct vn_command_vkUnmapMemory *args)
786 {
787     vn_replace_VkDevice_handle(&args->device);
788     vn_replace_VkDeviceMemory_handle(&args->memory);
789 }
790 
vn_encode_vkUnmapMemory_reply(struct vn_cs_encoder * enc,const struct vn_command_vkUnmapMemory * args)791 static inline void vn_encode_vkUnmapMemory_reply(struct vn_cs_encoder *enc, const struct vn_command_vkUnmapMemory *args)
792 {
793     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkUnmapMemory_EXT});
794 
795     /* skip args->device */
796     /* skip args->memory */
797 }
798 
vn_decode_vkFlushMappedMemoryRanges_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkFlushMappedMemoryRanges * args)799 static inline void vn_decode_vkFlushMappedMemoryRanges_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkFlushMappedMemoryRanges *args)
800 {
801     vn_decode_VkDevice_lookup(dec, &args->device);
802     vn_decode_uint32_t(dec, &args->memoryRangeCount);
803     if (vn_peek_array_size(dec)) {
804         const uint32_t iter_count = vn_decode_array_size(dec, args->memoryRangeCount);
805         args->pMemoryRanges = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pMemoryRanges) * iter_count);
806         if (!args->pMemoryRanges) return;
807         for (uint32_t i = 0; i < iter_count; i++)
808             vn_decode_VkMappedMemoryRange_temp(dec, &((VkMappedMemoryRange *)args->pMemoryRanges)[i]);
809     } else {
810         vn_decode_array_size(dec, args->memoryRangeCount);
811         args->pMemoryRanges = NULL;
812     }
813 }
814 
vn_replace_vkFlushMappedMemoryRanges_args_handle(struct vn_command_vkFlushMappedMemoryRanges * args)815 static inline void vn_replace_vkFlushMappedMemoryRanges_args_handle(struct vn_command_vkFlushMappedMemoryRanges *args)
816 {
817     vn_replace_VkDevice_handle(&args->device);
818     /* skip args->memoryRangeCount */
819     if (args->pMemoryRanges) {
820        for (uint32_t i = 0; i < args->memoryRangeCount; i++)
821             vn_replace_VkMappedMemoryRange_handle(&((VkMappedMemoryRange *)args->pMemoryRanges)[i]);
822     }
823 }
824 
vn_encode_vkFlushMappedMemoryRanges_reply(struct vn_cs_encoder * enc,const struct vn_command_vkFlushMappedMemoryRanges * args)825 static inline void vn_encode_vkFlushMappedMemoryRanges_reply(struct vn_cs_encoder *enc, const struct vn_command_vkFlushMappedMemoryRanges *args)
826 {
827     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkFlushMappedMemoryRanges_EXT});
828 
829     vn_encode_VkResult(enc, &args->ret);
830     /* skip args->device */
831     /* skip args->memoryRangeCount */
832     /* skip args->pMemoryRanges */
833 }
834 
vn_decode_vkInvalidateMappedMemoryRanges_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkInvalidateMappedMemoryRanges * args)835 static inline void vn_decode_vkInvalidateMappedMemoryRanges_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkInvalidateMappedMemoryRanges *args)
836 {
837     vn_decode_VkDevice_lookup(dec, &args->device);
838     vn_decode_uint32_t(dec, &args->memoryRangeCount);
839     if (vn_peek_array_size(dec)) {
840         const uint32_t iter_count = vn_decode_array_size(dec, args->memoryRangeCount);
841         args->pMemoryRanges = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pMemoryRanges) * iter_count);
842         if (!args->pMemoryRanges) return;
843         for (uint32_t i = 0; i < iter_count; i++)
844             vn_decode_VkMappedMemoryRange_temp(dec, &((VkMappedMemoryRange *)args->pMemoryRanges)[i]);
845     } else {
846         vn_decode_array_size(dec, args->memoryRangeCount);
847         args->pMemoryRanges = NULL;
848     }
849 }
850 
vn_replace_vkInvalidateMappedMemoryRanges_args_handle(struct vn_command_vkInvalidateMappedMemoryRanges * args)851 static inline void vn_replace_vkInvalidateMappedMemoryRanges_args_handle(struct vn_command_vkInvalidateMappedMemoryRanges *args)
852 {
853     vn_replace_VkDevice_handle(&args->device);
854     /* skip args->memoryRangeCount */
855     if (args->pMemoryRanges) {
856        for (uint32_t i = 0; i < args->memoryRangeCount; i++)
857             vn_replace_VkMappedMemoryRange_handle(&((VkMappedMemoryRange *)args->pMemoryRanges)[i]);
858     }
859 }
860 
vn_encode_vkInvalidateMappedMemoryRanges_reply(struct vn_cs_encoder * enc,const struct vn_command_vkInvalidateMappedMemoryRanges * args)861 static inline void vn_encode_vkInvalidateMappedMemoryRanges_reply(struct vn_cs_encoder *enc, const struct vn_command_vkInvalidateMappedMemoryRanges *args)
862 {
863     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkInvalidateMappedMemoryRanges_EXT});
864 
865     vn_encode_VkResult(enc, &args->ret);
866     /* skip args->device */
867     /* skip args->memoryRangeCount */
868     /* skip args->pMemoryRanges */
869 }
870 
vn_decode_vkGetDeviceMemoryCommitment_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetDeviceMemoryCommitment * args)871 static inline void vn_decode_vkGetDeviceMemoryCommitment_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetDeviceMemoryCommitment *args)
872 {
873     vn_decode_VkDevice_lookup(dec, &args->device);
874     vn_decode_VkDeviceMemory_lookup(dec, &args->memory);
875     if (vn_decode_simple_pointer(dec)) {
876         args->pCommittedMemoryInBytes = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCommittedMemoryInBytes));
877         if (!args->pCommittedMemoryInBytes) return;
878     } else {
879         args->pCommittedMemoryInBytes = NULL;
880         vn_cs_decoder_set_fatal(dec);
881     }
882 }
883 
vn_replace_vkGetDeviceMemoryCommitment_args_handle(struct vn_command_vkGetDeviceMemoryCommitment * args)884 static inline void vn_replace_vkGetDeviceMemoryCommitment_args_handle(struct vn_command_vkGetDeviceMemoryCommitment *args)
885 {
886     vn_replace_VkDevice_handle(&args->device);
887     vn_replace_VkDeviceMemory_handle(&args->memory);
888     /* skip args->pCommittedMemoryInBytes */
889 }
890 
vn_encode_vkGetDeviceMemoryCommitment_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetDeviceMemoryCommitment * args)891 static inline void vn_encode_vkGetDeviceMemoryCommitment_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetDeviceMemoryCommitment *args)
892 {
893     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetDeviceMemoryCommitment_EXT});
894 
895     /* skip args->device */
896     /* skip args->memory */
897     if (vn_encode_simple_pointer(enc, args->pCommittedMemoryInBytes))
898         vn_encode_VkDeviceSize(enc, args->pCommittedMemoryInBytes);
899 }
900 
vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress * args)901 static inline void vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress *args)
902 {
903     vn_decode_VkDevice_lookup(dec, &args->device);
904     if (vn_decode_simple_pointer(dec)) {
905         args->pInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pInfo));
906         if (!args->pInfo) return;
907         vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_temp(dec, (VkDeviceMemoryOpaqueCaptureAddressInfo *)args->pInfo);
908     } else {
909         args->pInfo = NULL;
910         vn_cs_decoder_set_fatal(dec);
911     }
912 }
913 
vn_replace_vkGetDeviceMemoryOpaqueCaptureAddress_args_handle(struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress * args)914 static inline void vn_replace_vkGetDeviceMemoryOpaqueCaptureAddress_args_handle(struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress *args)
915 {
916     vn_replace_VkDevice_handle(&args->device);
917     if (args->pInfo)
918         vn_replace_VkDeviceMemoryOpaqueCaptureAddressInfo_handle((VkDeviceMemoryOpaqueCaptureAddressInfo *)args->pInfo);
919 }
920 
vn_encode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress * args)921 static inline void vn_encode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress *args)
922 {
923     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddress_EXT});
924 
925     vn_encode_uint64_t(enc, &args->ret);
926     /* skip args->device */
927     /* skip args->pInfo */
928 }
929 
vn_decode_vkGetMemoryResourcePropertiesMESA_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetMemoryResourcePropertiesMESA * args)930 static inline void vn_decode_vkGetMemoryResourcePropertiesMESA_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetMemoryResourcePropertiesMESA *args)
931 {
932     vn_decode_VkDevice_lookup(dec, &args->device);
933     vn_decode_uint32_t(dec, &args->resourceId);
934     if (vn_decode_simple_pointer(dec)) {
935         args->pMemoryResourceProperties = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pMemoryResourceProperties));
936         if (!args->pMemoryResourceProperties) return;
937         vn_decode_VkMemoryResourcePropertiesMESA_partial_temp(dec, args->pMemoryResourceProperties);
938     } else {
939         args->pMemoryResourceProperties = NULL;
940         vn_cs_decoder_set_fatal(dec);
941     }
942 }
943 
vn_replace_vkGetMemoryResourcePropertiesMESA_args_handle(struct vn_command_vkGetMemoryResourcePropertiesMESA * args)944 static inline void vn_replace_vkGetMemoryResourcePropertiesMESA_args_handle(struct vn_command_vkGetMemoryResourcePropertiesMESA *args)
945 {
946     vn_replace_VkDevice_handle(&args->device);
947     /* skip args->resourceId */
948     /* skip args->pMemoryResourceProperties */
949 }
950 
vn_encode_vkGetMemoryResourcePropertiesMESA_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetMemoryResourcePropertiesMESA * args)951 static inline void vn_encode_vkGetMemoryResourcePropertiesMESA_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetMemoryResourcePropertiesMESA *args)
952 {
953     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT});
954 
955     vn_encode_VkResult(enc, &args->ret);
956     /* skip args->device */
957     /* skip args->resourceId */
958     if (vn_encode_simple_pointer(enc, args->pMemoryResourceProperties))
959         vn_encode_VkMemoryResourcePropertiesMESA(enc, args->pMemoryResourceProperties);
960 }
961 
vn_dispatch_vkAllocateMemory(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)962 static inline void vn_dispatch_vkAllocateMemory(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
963 {
964     struct vn_command_vkAllocateMemory args;
965 
966     if (!ctx->dispatch_vkAllocateMemory) {
967         vn_cs_decoder_set_fatal(ctx->decoder);
968         return;
969     }
970 
971     vn_decode_vkAllocateMemory_args_temp(ctx->decoder, &args);
972     if (!args.device) {
973         vn_cs_decoder_set_fatal(ctx->decoder);
974         return;
975     }
976 
977     if (!vn_cs_decoder_get_fatal(ctx->decoder))
978         ctx->dispatch_vkAllocateMemory(ctx, &args);
979 
980 #ifdef DEBUG
981     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
982         vn_dispatch_debug_log(ctx, "vkAllocateMemory returned %d", args.ret);
983 #endif
984 
985     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
986        vn_encode_vkAllocateMemory_reply(ctx->encoder, &args);
987 
988     vn_cs_decoder_reset_temp_pool(ctx->decoder);
989 }
990 
vn_dispatch_vkFreeMemory(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)991 static inline void vn_dispatch_vkFreeMemory(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
992 {
993     struct vn_command_vkFreeMemory args;
994 
995     if (!ctx->dispatch_vkFreeMemory) {
996         vn_cs_decoder_set_fatal(ctx->decoder);
997         return;
998     }
999 
1000     vn_decode_vkFreeMemory_args_temp(ctx->decoder, &args);
1001     if (!args.device) {
1002         vn_cs_decoder_set_fatal(ctx->decoder);
1003         return;
1004     }
1005 
1006     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1007         ctx->dispatch_vkFreeMemory(ctx, &args);
1008 
1009 
1010     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1011        vn_encode_vkFreeMemory_reply(ctx->encoder, &args);
1012 
1013     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1014 }
1015 
vn_dispatch_vkUnmapMemory(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1016 static inline void vn_dispatch_vkUnmapMemory(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1017 {
1018     struct vn_command_vkUnmapMemory args;
1019 
1020     if (!ctx->dispatch_vkUnmapMemory) {
1021         vn_cs_decoder_set_fatal(ctx->decoder);
1022         return;
1023     }
1024 
1025     vn_decode_vkUnmapMemory_args_temp(ctx->decoder, &args);
1026     if (!args.device) {
1027         vn_cs_decoder_set_fatal(ctx->decoder);
1028         return;
1029     }
1030 
1031     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1032         ctx->dispatch_vkUnmapMemory(ctx, &args);
1033 
1034 
1035     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1036        vn_encode_vkUnmapMemory_reply(ctx->encoder, &args);
1037 
1038     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1039 }
1040 
vn_dispatch_vkFlushMappedMemoryRanges(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1041 static inline void vn_dispatch_vkFlushMappedMemoryRanges(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1042 {
1043     struct vn_command_vkFlushMappedMemoryRanges args;
1044 
1045     if (!ctx->dispatch_vkFlushMappedMemoryRanges) {
1046         vn_cs_decoder_set_fatal(ctx->decoder);
1047         return;
1048     }
1049 
1050     vn_decode_vkFlushMappedMemoryRanges_args_temp(ctx->decoder, &args);
1051     if (!args.device) {
1052         vn_cs_decoder_set_fatal(ctx->decoder);
1053         return;
1054     }
1055 
1056     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1057         ctx->dispatch_vkFlushMappedMemoryRanges(ctx, &args);
1058 
1059 #ifdef DEBUG
1060     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
1061         vn_dispatch_debug_log(ctx, "vkFlushMappedMemoryRanges returned %d", args.ret);
1062 #endif
1063 
1064     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1065        vn_encode_vkFlushMappedMemoryRanges_reply(ctx->encoder, &args);
1066 
1067     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1068 }
1069 
vn_dispatch_vkInvalidateMappedMemoryRanges(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1070 static inline void vn_dispatch_vkInvalidateMappedMemoryRanges(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1071 {
1072     struct vn_command_vkInvalidateMappedMemoryRanges args;
1073 
1074     if (!ctx->dispatch_vkInvalidateMappedMemoryRanges) {
1075         vn_cs_decoder_set_fatal(ctx->decoder);
1076         return;
1077     }
1078 
1079     vn_decode_vkInvalidateMappedMemoryRanges_args_temp(ctx->decoder, &args);
1080     if (!args.device) {
1081         vn_cs_decoder_set_fatal(ctx->decoder);
1082         return;
1083     }
1084 
1085     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1086         ctx->dispatch_vkInvalidateMappedMemoryRanges(ctx, &args);
1087 
1088 #ifdef DEBUG
1089     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
1090         vn_dispatch_debug_log(ctx, "vkInvalidateMappedMemoryRanges returned %d", args.ret);
1091 #endif
1092 
1093     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1094        vn_encode_vkInvalidateMappedMemoryRanges_reply(ctx->encoder, &args);
1095 
1096     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1097 }
1098 
vn_dispatch_vkGetDeviceMemoryCommitment(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1099 static inline void vn_dispatch_vkGetDeviceMemoryCommitment(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1100 {
1101     struct vn_command_vkGetDeviceMemoryCommitment args;
1102 
1103     if (!ctx->dispatch_vkGetDeviceMemoryCommitment) {
1104         vn_cs_decoder_set_fatal(ctx->decoder);
1105         return;
1106     }
1107 
1108     vn_decode_vkGetDeviceMemoryCommitment_args_temp(ctx->decoder, &args);
1109     if (!args.device) {
1110         vn_cs_decoder_set_fatal(ctx->decoder);
1111         return;
1112     }
1113 
1114     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1115         ctx->dispatch_vkGetDeviceMemoryCommitment(ctx, &args);
1116 
1117 
1118     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1119        vn_encode_vkGetDeviceMemoryCommitment_reply(ctx->encoder, &args);
1120 
1121     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1122 }
1123 
vn_dispatch_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1124 static inline void vn_dispatch_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1125 {
1126     struct vn_command_vkGetDeviceMemoryOpaqueCaptureAddress args;
1127 
1128     if (!ctx->dispatch_vkGetDeviceMemoryOpaqueCaptureAddress) {
1129         vn_cs_decoder_set_fatal(ctx->decoder);
1130         return;
1131     }
1132 
1133     vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_args_temp(ctx->decoder, &args);
1134     if (!args.device) {
1135         vn_cs_decoder_set_fatal(ctx->decoder);
1136         return;
1137     }
1138 
1139     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1140         ctx->dispatch_vkGetDeviceMemoryOpaqueCaptureAddress(ctx, &args);
1141 
1142 
1143     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1144        vn_encode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(ctx->encoder, &args);
1145 
1146     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1147 }
1148 
vn_dispatch_vkGetMemoryResourcePropertiesMESA(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1149 static inline void vn_dispatch_vkGetMemoryResourcePropertiesMESA(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1150 {
1151     struct vn_command_vkGetMemoryResourcePropertiesMESA args;
1152 
1153     if (!ctx->dispatch_vkGetMemoryResourcePropertiesMESA) {
1154         vn_cs_decoder_set_fatal(ctx->decoder);
1155         return;
1156     }
1157 
1158     vn_decode_vkGetMemoryResourcePropertiesMESA_args_temp(ctx->decoder, &args);
1159     if (!args.device) {
1160         vn_cs_decoder_set_fatal(ctx->decoder);
1161         return;
1162     }
1163 
1164     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1165         ctx->dispatch_vkGetMemoryResourcePropertiesMESA(ctx, &args);
1166 
1167 #ifdef DEBUG
1168     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
1169         vn_dispatch_debug_log(ctx, "vkGetMemoryResourcePropertiesMESA returned %d", args.ret);
1170 #endif
1171 
1172     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1173        vn_encode_vkGetMemoryResourcePropertiesMESA_reply(ctx->encoder, &args);
1174 
1175     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1176 }
1177 
1178 #pragma GCC diagnostic pop
1179 
1180 #endif /* VN_PROTOCOL_RENDERER_DEVICE_MEMORY_H */
1181