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_BUFFER_H
9#define VN_PROTOCOL_DRIVER_BUFFER_H
10
11#include "vn_instance.h"
12#include "vn_protocol_driver_structs.h"
13
14/* struct VkExternalMemoryBufferCreateInfo chain */
15
16static inline size_t
17vn_sizeof_VkExternalMemoryBufferCreateInfo_pnext(const void *val)
18{
19    /* no known/supported struct */
20    return vn_sizeof_simple_pointer(NULL);
21}
22
23static inline size_t
24vn_sizeof_VkExternalMemoryBufferCreateInfo_self(const VkExternalMemoryBufferCreateInfo *val)
25{
26    size_t size = 0;
27    /* skip val->{sType,pNext} */
28    size += vn_sizeof_VkFlags(&val->handleTypes);
29    return size;
30}
31
32static inline size_t
33vn_sizeof_VkExternalMemoryBufferCreateInfo(const VkExternalMemoryBufferCreateInfo *val)
34{
35    size_t size = 0;
36
37    size += vn_sizeof_VkStructureType(&val->sType);
38    size += vn_sizeof_VkExternalMemoryBufferCreateInfo_pnext(val->pNext);
39    size += vn_sizeof_VkExternalMemoryBufferCreateInfo_self(val);
40
41    return size;
42}
43
44static inline void
45vn_encode_VkExternalMemoryBufferCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
46{
47    /* no known/supported struct */
48    vn_encode_simple_pointer(enc, NULL);
49}
50
51static inline void
52vn_encode_VkExternalMemoryBufferCreateInfo_self(struct vn_cs_encoder *enc, const VkExternalMemoryBufferCreateInfo *val)
53{
54    /* skip val->{sType,pNext} */
55    vn_encode_VkFlags(enc, &val->handleTypes);
56}
57
58static inline void
59vn_encode_VkExternalMemoryBufferCreateInfo(struct vn_cs_encoder *enc, const VkExternalMemoryBufferCreateInfo *val)
60{
61    assert(val->sType == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO);
62    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO });
63    vn_encode_VkExternalMemoryBufferCreateInfo_pnext(enc, val->pNext);
64    vn_encode_VkExternalMemoryBufferCreateInfo_self(enc, val);
65}
66
67/* struct VkBufferOpaqueCaptureAddressCreateInfo chain */
68
69static inline size_t
70vn_sizeof_VkBufferOpaqueCaptureAddressCreateInfo_pnext(const void *val)
71{
72    /* no known/supported struct */
73    return vn_sizeof_simple_pointer(NULL);
74}
75
76static inline size_t
77vn_sizeof_VkBufferOpaqueCaptureAddressCreateInfo_self(const VkBufferOpaqueCaptureAddressCreateInfo *val)
78{
79    size_t size = 0;
80    /* skip val->{sType,pNext} */
81    size += vn_sizeof_uint64_t(&val->opaqueCaptureAddress);
82    return size;
83}
84
85static inline size_t
86vn_sizeof_VkBufferOpaqueCaptureAddressCreateInfo(const VkBufferOpaqueCaptureAddressCreateInfo *val)
87{
88    size_t size = 0;
89
90    size += vn_sizeof_VkStructureType(&val->sType);
91    size += vn_sizeof_VkBufferOpaqueCaptureAddressCreateInfo_pnext(val->pNext);
92    size += vn_sizeof_VkBufferOpaqueCaptureAddressCreateInfo_self(val);
93
94    return size;
95}
96
97static inline void
98vn_encode_VkBufferOpaqueCaptureAddressCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
99{
100    /* no known/supported struct */
101    vn_encode_simple_pointer(enc, NULL);
102}
103
104static inline void
105vn_encode_VkBufferOpaqueCaptureAddressCreateInfo_self(struct vn_cs_encoder *enc, const VkBufferOpaqueCaptureAddressCreateInfo *val)
106{
107    /* skip val->{sType,pNext} */
108    vn_encode_uint64_t(enc, &val->opaqueCaptureAddress);
109}
110
111static inline void
112vn_encode_VkBufferOpaqueCaptureAddressCreateInfo(struct vn_cs_encoder *enc, const VkBufferOpaqueCaptureAddressCreateInfo *val)
113{
114    assert(val->sType == VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO);
115    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO });
116    vn_encode_VkBufferOpaqueCaptureAddressCreateInfo_pnext(enc, val->pNext);
117    vn_encode_VkBufferOpaqueCaptureAddressCreateInfo_self(enc, val);
118}
119
120/* struct VkBufferCreateInfo chain */
121
122static inline size_t
123vn_sizeof_VkBufferCreateInfo_pnext(const void *val)
124{
125    const VkBaseInStructure *pnext = val;
126    size_t size = 0;
127
128    while (pnext) {
129        switch ((int32_t)pnext->sType) {
130        case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO:
131            size += vn_sizeof_simple_pointer(pnext);
132            size += vn_sizeof_VkStructureType(&pnext->sType);
133            size += vn_sizeof_VkBufferCreateInfo_pnext(pnext->pNext);
134            size += vn_sizeof_VkExternalMemoryBufferCreateInfo_self((const VkExternalMemoryBufferCreateInfo *)pnext);
135            return size;
136        case VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO:
137            size += vn_sizeof_simple_pointer(pnext);
138            size += vn_sizeof_VkStructureType(&pnext->sType);
139            size += vn_sizeof_VkBufferCreateInfo_pnext(pnext->pNext);
140            size += vn_sizeof_VkBufferOpaqueCaptureAddressCreateInfo_self((const VkBufferOpaqueCaptureAddressCreateInfo *)pnext);
141            return size;
142        default:
143            /* ignore unknown/unsupported struct */
144            break;
145        }
146        pnext = pnext->pNext;
147    }
148
149    return vn_sizeof_simple_pointer(NULL);
150}
151
152static inline size_t
153vn_sizeof_VkBufferCreateInfo_self(const VkBufferCreateInfo *val)
154{
155    size_t size = 0;
156    /* skip val->{sType,pNext} */
157    size += vn_sizeof_VkFlags(&val->flags);
158    size += vn_sizeof_VkDeviceSize(&val->size);
159    size += vn_sizeof_VkFlags(&val->usage);
160    size += vn_sizeof_VkSharingMode(&val->sharingMode);
161    size += vn_sizeof_uint32_t(&val->queueFamilyIndexCount);
162    if (val->pQueueFamilyIndices) {
163        size += vn_sizeof_array_size(val->queueFamilyIndexCount);
164        size += vn_sizeof_uint32_t_array(val->pQueueFamilyIndices, val->queueFamilyIndexCount);
165    } else {
166        size += vn_sizeof_array_size(0);
167    }
168    return size;
169}
170
171static inline size_t
172vn_sizeof_VkBufferCreateInfo(const VkBufferCreateInfo *val)
173{
174    size_t size = 0;
175
176    size += vn_sizeof_VkStructureType(&val->sType);
177    size += vn_sizeof_VkBufferCreateInfo_pnext(val->pNext);
178    size += vn_sizeof_VkBufferCreateInfo_self(val);
179
180    return size;
181}
182
183static inline void
184vn_encode_VkBufferCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
185{
186    const VkBaseInStructure *pnext = val;
187
188    while (pnext) {
189        switch ((int32_t)pnext->sType) {
190        case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO:
191            vn_encode_simple_pointer(enc, pnext);
192            vn_encode_VkStructureType(enc, &pnext->sType);
193            vn_encode_VkBufferCreateInfo_pnext(enc, pnext->pNext);
194            vn_encode_VkExternalMemoryBufferCreateInfo_self(enc, (const VkExternalMemoryBufferCreateInfo *)pnext);
195            return;
196        case VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO:
197            vn_encode_simple_pointer(enc, pnext);
198            vn_encode_VkStructureType(enc, &pnext->sType);
199            vn_encode_VkBufferCreateInfo_pnext(enc, pnext->pNext);
200            vn_encode_VkBufferOpaqueCaptureAddressCreateInfo_self(enc, (const VkBufferOpaqueCaptureAddressCreateInfo *)pnext);
201            return;
202        default:
203            /* ignore unknown/unsupported struct */
204            break;
205        }
206        pnext = pnext->pNext;
207    }
208
209    vn_encode_simple_pointer(enc, NULL);
210}
211
212static inline void
213vn_encode_VkBufferCreateInfo_self(struct vn_cs_encoder *enc, const VkBufferCreateInfo *val)
214{
215    /* skip val->{sType,pNext} */
216    vn_encode_VkFlags(enc, &val->flags);
217    vn_encode_VkDeviceSize(enc, &val->size);
218    vn_encode_VkFlags(enc, &val->usage);
219    vn_encode_VkSharingMode(enc, &val->sharingMode);
220    vn_encode_uint32_t(enc, &val->queueFamilyIndexCount);
221    if (val->pQueueFamilyIndices) {
222        vn_encode_array_size(enc, val->queueFamilyIndexCount);
223        vn_encode_uint32_t_array(enc, val->pQueueFamilyIndices, val->queueFamilyIndexCount);
224    } else {
225        vn_encode_array_size(enc, 0);
226    }
227}
228
229static inline void
230vn_encode_VkBufferCreateInfo(struct vn_cs_encoder *enc, const VkBufferCreateInfo *val)
231{
232    assert(val->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
233    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO });
234    vn_encode_VkBufferCreateInfo_pnext(enc, val->pNext);
235    vn_encode_VkBufferCreateInfo_self(enc, val);
236}
237
238/* struct VkBindBufferMemoryDeviceGroupInfo chain */
239
240static inline size_t
241vn_sizeof_VkBindBufferMemoryDeviceGroupInfo_pnext(const void *val)
242{
243    /* no known/supported struct */
244    return vn_sizeof_simple_pointer(NULL);
245}
246
247static inline size_t
248vn_sizeof_VkBindBufferMemoryDeviceGroupInfo_self(const VkBindBufferMemoryDeviceGroupInfo *val)
249{
250    size_t size = 0;
251    /* skip val->{sType,pNext} */
252    size += vn_sizeof_uint32_t(&val->deviceIndexCount);
253    if (val->pDeviceIndices) {
254        size += vn_sizeof_array_size(val->deviceIndexCount);
255        size += vn_sizeof_uint32_t_array(val->pDeviceIndices, val->deviceIndexCount);
256    } else {
257        size += vn_sizeof_array_size(0);
258    }
259    return size;
260}
261
262static inline size_t
263vn_sizeof_VkBindBufferMemoryDeviceGroupInfo(const VkBindBufferMemoryDeviceGroupInfo *val)
264{
265    size_t size = 0;
266
267    size += vn_sizeof_VkStructureType(&val->sType);
268    size += vn_sizeof_VkBindBufferMemoryDeviceGroupInfo_pnext(val->pNext);
269    size += vn_sizeof_VkBindBufferMemoryDeviceGroupInfo_self(val);
270
271    return size;
272}
273
274static inline void
275vn_encode_VkBindBufferMemoryDeviceGroupInfo_pnext(struct vn_cs_encoder *enc, const void *val)
276{
277    /* no known/supported struct */
278    vn_encode_simple_pointer(enc, NULL);
279}
280
281static inline void
282vn_encode_VkBindBufferMemoryDeviceGroupInfo_self(struct vn_cs_encoder *enc, const VkBindBufferMemoryDeviceGroupInfo *val)
283{
284    /* skip val->{sType,pNext} */
285    vn_encode_uint32_t(enc, &val->deviceIndexCount);
286    if (val->pDeviceIndices) {
287        vn_encode_array_size(enc, val->deviceIndexCount);
288        vn_encode_uint32_t_array(enc, val->pDeviceIndices, val->deviceIndexCount);
289    } else {
290        vn_encode_array_size(enc, 0);
291    }
292}
293
294static inline void
295vn_encode_VkBindBufferMemoryDeviceGroupInfo(struct vn_cs_encoder *enc, const VkBindBufferMemoryDeviceGroupInfo *val)
296{
297    assert(val->sType == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO);
298    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO });
299    vn_encode_VkBindBufferMemoryDeviceGroupInfo_pnext(enc, val->pNext);
300    vn_encode_VkBindBufferMemoryDeviceGroupInfo_self(enc, val);
301}
302
303static inline void
304vn_decode_VkBindBufferMemoryDeviceGroupInfo_pnext(struct vn_cs_decoder *dec, const void *val)
305{
306    /* no known/supported struct */
307    if (vn_decode_simple_pointer(dec))
308        assert(false);
309}
310
311static inline void
312vn_decode_VkBindBufferMemoryDeviceGroupInfo_self(struct vn_cs_decoder *dec, VkBindBufferMemoryDeviceGroupInfo *val)
313{
314    /* skip val->{sType,pNext} */
315    vn_decode_uint32_t(dec, &val->deviceIndexCount);
316    if (vn_peek_array_size(dec)) {
317        const size_t array_size = vn_decode_array_size(dec, val->deviceIndexCount);
318        vn_decode_uint32_t_array(dec, (uint32_t *)val->pDeviceIndices, array_size);
319    } else {
320        vn_decode_array_size_unchecked(dec);
321        val->pDeviceIndices = NULL;
322    }
323}
324
325static inline void
326vn_decode_VkBindBufferMemoryDeviceGroupInfo(struct vn_cs_decoder *dec, VkBindBufferMemoryDeviceGroupInfo *val)
327{
328    VkStructureType stype;
329    vn_decode_VkStructureType(dec, &stype);
330    assert(stype == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO);
331
332    assert(val->sType == stype);
333    vn_decode_VkBindBufferMemoryDeviceGroupInfo_pnext(dec, val->pNext);
334    vn_decode_VkBindBufferMemoryDeviceGroupInfo_self(dec, val);
335}
336
337/* struct VkBindBufferMemoryInfo chain */
338
339static inline size_t
340vn_sizeof_VkBindBufferMemoryInfo_pnext(const void *val)
341{
342    const VkBaseInStructure *pnext = val;
343    size_t size = 0;
344
345    while (pnext) {
346        switch ((int32_t)pnext->sType) {
347        case VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO:
348            size += vn_sizeof_simple_pointer(pnext);
349            size += vn_sizeof_VkStructureType(&pnext->sType);
350            size += vn_sizeof_VkBindBufferMemoryInfo_pnext(pnext->pNext);
351            size += vn_sizeof_VkBindBufferMemoryDeviceGroupInfo_self((const VkBindBufferMemoryDeviceGroupInfo *)pnext);
352            return size;
353        default:
354            /* ignore unknown/unsupported struct */
355            break;
356        }
357        pnext = pnext->pNext;
358    }
359
360    return vn_sizeof_simple_pointer(NULL);
361}
362
363static inline size_t
364vn_sizeof_VkBindBufferMemoryInfo_self(const VkBindBufferMemoryInfo *val)
365{
366    size_t size = 0;
367    /* skip val->{sType,pNext} */
368    size += vn_sizeof_VkBuffer(&val->buffer);
369    size += vn_sizeof_VkDeviceMemory(&val->memory);
370    size += vn_sizeof_VkDeviceSize(&val->memoryOffset);
371    return size;
372}
373
374static inline size_t
375vn_sizeof_VkBindBufferMemoryInfo(const VkBindBufferMemoryInfo *val)
376{
377    size_t size = 0;
378
379    size += vn_sizeof_VkStructureType(&val->sType);
380    size += vn_sizeof_VkBindBufferMemoryInfo_pnext(val->pNext);
381    size += vn_sizeof_VkBindBufferMemoryInfo_self(val);
382
383    return size;
384}
385
386static inline void
387vn_encode_VkBindBufferMemoryInfo_pnext(struct vn_cs_encoder *enc, const void *val)
388{
389    const VkBaseInStructure *pnext = val;
390
391    while (pnext) {
392        switch ((int32_t)pnext->sType) {
393        case VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO:
394            vn_encode_simple_pointer(enc, pnext);
395            vn_encode_VkStructureType(enc, &pnext->sType);
396            vn_encode_VkBindBufferMemoryInfo_pnext(enc, pnext->pNext);
397            vn_encode_VkBindBufferMemoryDeviceGroupInfo_self(enc, (const VkBindBufferMemoryDeviceGroupInfo *)pnext);
398            return;
399        default:
400            /* ignore unknown/unsupported struct */
401            break;
402        }
403        pnext = pnext->pNext;
404    }
405
406    vn_encode_simple_pointer(enc, NULL);
407}
408
409static inline void
410vn_encode_VkBindBufferMemoryInfo_self(struct vn_cs_encoder *enc, const VkBindBufferMemoryInfo *val)
411{
412    /* skip val->{sType,pNext} */
413    vn_encode_VkBuffer(enc, &val->buffer);
414    vn_encode_VkDeviceMemory(enc, &val->memory);
415    vn_encode_VkDeviceSize(enc, &val->memoryOffset);
416}
417
418static inline void
419vn_encode_VkBindBufferMemoryInfo(struct vn_cs_encoder *enc, const VkBindBufferMemoryInfo *val)
420{
421    assert(val->sType == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO);
422    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO });
423    vn_encode_VkBindBufferMemoryInfo_pnext(enc, val->pNext);
424    vn_encode_VkBindBufferMemoryInfo_self(enc, val);
425}
426
427static inline void
428vn_decode_VkBindBufferMemoryInfo_pnext(struct vn_cs_decoder *dec, const void *val)
429{
430    VkBaseOutStructure *pnext = (VkBaseOutStructure *)val;
431    VkStructureType stype;
432
433    if (!vn_decode_simple_pointer(dec))
434        return;
435
436    vn_decode_VkStructureType(dec, &stype);
437    while (true) {
438        assert(pnext);
439        if (pnext->sType == stype)
440            break;
441    }
442
443    switch ((int32_t)pnext->sType) {
444    case VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO:
445        vn_decode_VkBindBufferMemoryInfo_pnext(dec, pnext->pNext);
446        vn_decode_VkBindBufferMemoryDeviceGroupInfo_self(dec, (VkBindBufferMemoryDeviceGroupInfo *)pnext);
447        break;
448    default:
449        assert(false);
450        break;
451    }
452}
453
454static inline void
455vn_decode_VkBindBufferMemoryInfo_self(struct vn_cs_decoder *dec, VkBindBufferMemoryInfo *val)
456{
457    /* skip val->{sType,pNext} */
458    vn_decode_VkBuffer(dec, &val->buffer);
459    vn_decode_VkDeviceMemory(dec, &val->memory);
460    vn_decode_VkDeviceSize(dec, &val->memoryOffset);
461}
462
463static inline void
464vn_decode_VkBindBufferMemoryInfo(struct vn_cs_decoder *dec, VkBindBufferMemoryInfo *val)
465{
466    VkStructureType stype;
467    vn_decode_VkStructureType(dec, &stype);
468    assert(stype == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO);
469
470    assert(val->sType == stype);
471    vn_decode_VkBindBufferMemoryInfo_pnext(dec, val->pNext);
472    vn_decode_VkBindBufferMemoryInfo_self(dec, val);
473}
474
475/* struct VkBufferMemoryRequirementsInfo2 chain */
476
477static inline size_t
478vn_sizeof_VkBufferMemoryRequirementsInfo2_pnext(const void *val)
479{
480    /* no known/supported struct */
481    return vn_sizeof_simple_pointer(NULL);
482}
483
484static inline size_t
485vn_sizeof_VkBufferMemoryRequirementsInfo2_self(const VkBufferMemoryRequirementsInfo2 *val)
486{
487    size_t size = 0;
488    /* skip val->{sType,pNext} */
489    size += vn_sizeof_VkBuffer(&val->buffer);
490    return size;
491}
492
493static inline size_t
494vn_sizeof_VkBufferMemoryRequirementsInfo2(const VkBufferMemoryRequirementsInfo2 *val)
495{
496    size_t size = 0;
497
498    size += vn_sizeof_VkStructureType(&val->sType);
499    size += vn_sizeof_VkBufferMemoryRequirementsInfo2_pnext(val->pNext);
500    size += vn_sizeof_VkBufferMemoryRequirementsInfo2_self(val);
501
502    return size;
503}
504
505static inline void
506vn_encode_VkBufferMemoryRequirementsInfo2_pnext(struct vn_cs_encoder *enc, const void *val)
507{
508    /* no known/supported struct */
509    vn_encode_simple_pointer(enc, NULL);
510}
511
512static inline void
513vn_encode_VkBufferMemoryRequirementsInfo2_self(struct vn_cs_encoder *enc, const VkBufferMemoryRequirementsInfo2 *val)
514{
515    /* skip val->{sType,pNext} */
516    vn_encode_VkBuffer(enc, &val->buffer);
517}
518
519static inline void
520vn_encode_VkBufferMemoryRequirementsInfo2(struct vn_cs_encoder *enc, const VkBufferMemoryRequirementsInfo2 *val)
521{
522    assert(val->sType == VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2);
523    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2 });
524    vn_encode_VkBufferMemoryRequirementsInfo2_pnext(enc, val->pNext);
525    vn_encode_VkBufferMemoryRequirementsInfo2_self(enc, val);
526}
527
528/* struct VkBufferDeviceAddressInfo chain */
529
530static inline size_t
531vn_sizeof_VkBufferDeviceAddressInfo_pnext(const void *val)
532{
533    /* no known/supported struct */
534    return vn_sizeof_simple_pointer(NULL);
535}
536
537static inline size_t
538vn_sizeof_VkBufferDeviceAddressInfo_self(const VkBufferDeviceAddressInfo *val)
539{
540    size_t size = 0;
541    /* skip val->{sType,pNext} */
542    size += vn_sizeof_VkBuffer(&val->buffer);
543    return size;
544}
545
546static inline size_t
547vn_sizeof_VkBufferDeviceAddressInfo(const VkBufferDeviceAddressInfo *val)
548{
549    size_t size = 0;
550
551    size += vn_sizeof_VkStructureType(&val->sType);
552    size += vn_sizeof_VkBufferDeviceAddressInfo_pnext(val->pNext);
553    size += vn_sizeof_VkBufferDeviceAddressInfo_self(val);
554
555    return size;
556}
557
558static inline void
559vn_encode_VkBufferDeviceAddressInfo_pnext(struct vn_cs_encoder *enc, const void *val)
560{
561    /* no known/supported struct */
562    vn_encode_simple_pointer(enc, NULL);
563}
564
565static inline void
566vn_encode_VkBufferDeviceAddressInfo_self(struct vn_cs_encoder *enc, const VkBufferDeviceAddressInfo *val)
567{
568    /* skip val->{sType,pNext} */
569    vn_encode_VkBuffer(enc, &val->buffer);
570}
571
572static inline void
573vn_encode_VkBufferDeviceAddressInfo(struct vn_cs_encoder *enc, const VkBufferDeviceAddressInfo *val)
574{
575    assert(val->sType == VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO);
576    vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO });
577    vn_encode_VkBufferDeviceAddressInfo_pnext(enc, val->pNext);
578    vn_encode_VkBufferDeviceAddressInfo_self(enc, val);
579}
580
581static inline void
582vn_decode_VkBufferDeviceAddressInfo_pnext(struct vn_cs_decoder *dec, const void *val)
583{
584    /* no known/supported struct */
585    if (vn_decode_simple_pointer(dec))
586        assert(false);
587}
588
589static inline void
590vn_decode_VkBufferDeviceAddressInfo_self(struct vn_cs_decoder *dec, VkBufferDeviceAddressInfo *val)
591{
592    /* skip val->{sType,pNext} */
593    vn_decode_VkBuffer(dec, &val->buffer);
594}
595
596static inline void
597vn_decode_VkBufferDeviceAddressInfo(struct vn_cs_decoder *dec, VkBufferDeviceAddressInfo *val)
598{
599    VkStructureType stype;
600    vn_decode_VkStructureType(dec, &stype);
601    assert(stype == VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO);
602
603    assert(val->sType == stype);
604    vn_decode_VkBufferDeviceAddressInfo_pnext(dec, val->pNext);
605    vn_decode_VkBufferDeviceAddressInfo_self(dec, val);
606}
607
608static inline size_t vn_sizeof_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
609{
610    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements_EXT;
611    const VkFlags cmd_flags = 0;
612    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
613
614    cmd_size += vn_sizeof_VkDevice(&device);
615    cmd_size += vn_sizeof_VkBuffer(&buffer);
616    cmd_size += vn_sizeof_simple_pointer(pMemoryRequirements);
617    if (pMemoryRequirements)
618        cmd_size += vn_sizeof_VkMemoryRequirements_partial(pMemoryRequirements);
619
620    return cmd_size;
621}
622
623static inline void vn_encode_vkGetBufferMemoryRequirements(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
624{
625    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements_EXT;
626
627    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
628    vn_encode_VkFlags(enc, &cmd_flags);
629
630    vn_encode_VkDevice(enc, &device);
631    vn_encode_VkBuffer(enc, &buffer);
632    if (vn_encode_simple_pointer(enc, pMemoryRequirements))
633        vn_encode_VkMemoryRequirements_partial(enc, pMemoryRequirements);
634}
635
636static inline size_t vn_sizeof_vkGetBufferMemoryRequirements_reply(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
637{
638    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements_EXT;
639    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
640
641    /* skip device */
642    /* skip buffer */
643    cmd_size += vn_sizeof_simple_pointer(pMemoryRequirements);
644    if (pMemoryRequirements)
645        cmd_size += vn_sizeof_VkMemoryRequirements(pMemoryRequirements);
646
647    return cmd_size;
648}
649
650static inline void vn_decode_vkGetBufferMemoryRequirements_reply(struct vn_cs_decoder *dec, VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
651{
652    VkCommandTypeEXT command_type;
653    vn_decode_VkCommandTypeEXT(dec, &command_type);
654    assert(command_type == VK_COMMAND_TYPE_vkGetBufferMemoryRequirements_EXT);
655
656    /* skip device */
657    /* skip buffer */
658    if (vn_decode_simple_pointer(dec)) {
659        vn_decode_VkMemoryRequirements(dec, pMemoryRequirements);
660    } else {
661        pMemoryRequirements = NULL;
662    }
663}
664
665static inline size_t vn_sizeof_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
666{
667    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkBindBufferMemory_EXT;
668    const VkFlags cmd_flags = 0;
669    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
670
671    cmd_size += vn_sizeof_VkDevice(&device);
672    cmd_size += vn_sizeof_VkBuffer(&buffer);
673    cmd_size += vn_sizeof_VkDeviceMemory(&memory);
674    cmd_size += vn_sizeof_VkDeviceSize(&memoryOffset);
675
676    return cmd_size;
677}
678
679static inline void vn_encode_vkBindBufferMemory(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
680{
681    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkBindBufferMemory_EXT;
682
683    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
684    vn_encode_VkFlags(enc, &cmd_flags);
685
686    vn_encode_VkDevice(enc, &device);
687    vn_encode_VkBuffer(enc, &buffer);
688    vn_encode_VkDeviceMemory(enc, &memory);
689    vn_encode_VkDeviceSize(enc, &memoryOffset);
690}
691
692static inline size_t vn_sizeof_vkBindBufferMemory_reply(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
693{
694    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkBindBufferMemory_EXT;
695    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
696
697    VkResult ret;
698    cmd_size += vn_sizeof_VkResult(&ret);
699    /* skip device */
700    /* skip buffer */
701    /* skip memory */
702    /* skip memoryOffset */
703
704    return cmd_size;
705}
706
707static inline VkResult vn_decode_vkBindBufferMemory_reply(struct vn_cs_decoder *dec, VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
708{
709    VkCommandTypeEXT command_type;
710    vn_decode_VkCommandTypeEXT(dec, &command_type);
711    assert(command_type == VK_COMMAND_TYPE_vkBindBufferMemory_EXT);
712
713    VkResult ret;
714    vn_decode_VkResult(dec, &ret);
715    /* skip device */
716    /* skip buffer */
717    /* skip memory */
718    /* skip memoryOffset */
719
720    return ret;
721}
722
723static inline size_t vn_sizeof_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
724{
725    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateBuffer_EXT;
726    const VkFlags cmd_flags = 0;
727    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
728
729    cmd_size += vn_sizeof_VkDevice(&device);
730    cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
731    if (pCreateInfo)
732        cmd_size += vn_sizeof_VkBufferCreateInfo(pCreateInfo);
733    cmd_size += vn_sizeof_simple_pointer(pAllocator);
734    if (pAllocator)
735        assert(false);
736    cmd_size += vn_sizeof_simple_pointer(pBuffer);
737    if (pBuffer)
738        cmd_size += vn_sizeof_VkBuffer(pBuffer);
739
740    return cmd_size;
741}
742
743static inline void vn_encode_vkCreateBuffer(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
744{
745    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateBuffer_EXT;
746
747    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
748    vn_encode_VkFlags(enc, &cmd_flags);
749
750    vn_encode_VkDevice(enc, &device);
751    if (vn_encode_simple_pointer(enc, pCreateInfo))
752        vn_encode_VkBufferCreateInfo(enc, pCreateInfo);
753    if (vn_encode_simple_pointer(enc, pAllocator))
754        assert(false);
755    if (vn_encode_simple_pointer(enc, pBuffer))
756        vn_encode_VkBuffer(enc, pBuffer);
757}
758
759static inline size_t vn_sizeof_vkCreateBuffer_reply(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
760{
761    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateBuffer_EXT;
762    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
763
764    VkResult ret;
765    cmd_size += vn_sizeof_VkResult(&ret);
766    /* skip device */
767    /* skip pCreateInfo */
768    /* skip pAllocator */
769    cmd_size += vn_sizeof_simple_pointer(pBuffer);
770    if (pBuffer)
771        cmd_size += vn_sizeof_VkBuffer(pBuffer);
772
773    return cmd_size;
774}
775
776static inline VkResult vn_decode_vkCreateBuffer_reply(struct vn_cs_decoder *dec, VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
777{
778    VkCommandTypeEXT command_type;
779    vn_decode_VkCommandTypeEXT(dec, &command_type);
780    assert(command_type == VK_COMMAND_TYPE_vkCreateBuffer_EXT);
781
782    VkResult ret;
783    vn_decode_VkResult(dec, &ret);
784    /* skip device */
785    /* skip pCreateInfo */
786    /* skip pAllocator */
787    if (vn_decode_simple_pointer(dec)) {
788        vn_decode_VkBuffer(dec, pBuffer);
789    } else {
790        pBuffer = NULL;
791    }
792
793    return ret;
794}
795
796static inline size_t vn_sizeof_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
797{
798    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyBuffer_EXT;
799    const VkFlags cmd_flags = 0;
800    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
801
802    cmd_size += vn_sizeof_VkDevice(&device);
803    cmd_size += vn_sizeof_VkBuffer(&buffer);
804    cmd_size += vn_sizeof_simple_pointer(pAllocator);
805    if (pAllocator)
806        assert(false);
807
808    return cmd_size;
809}
810
811static inline void vn_encode_vkDestroyBuffer(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
812{
813    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyBuffer_EXT;
814
815    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
816    vn_encode_VkFlags(enc, &cmd_flags);
817
818    vn_encode_VkDevice(enc, &device);
819    vn_encode_VkBuffer(enc, &buffer);
820    if (vn_encode_simple_pointer(enc, pAllocator))
821        assert(false);
822}
823
824static inline size_t vn_sizeof_vkDestroyBuffer_reply(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
825{
826    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyBuffer_EXT;
827    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
828
829    /* skip device */
830    /* skip buffer */
831    /* skip pAllocator */
832
833    return cmd_size;
834}
835
836static inline void vn_decode_vkDestroyBuffer_reply(struct vn_cs_decoder *dec, VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
837{
838    VkCommandTypeEXT command_type;
839    vn_decode_VkCommandTypeEXT(dec, &command_type);
840    assert(command_type == VK_COMMAND_TYPE_vkDestroyBuffer_EXT);
841
842    /* skip device */
843    /* skip buffer */
844    /* skip pAllocator */
845}
846
847static inline size_t vn_sizeof_vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
848{
849    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkBindBufferMemory2_EXT;
850    const VkFlags cmd_flags = 0;
851    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
852
853    cmd_size += vn_sizeof_VkDevice(&device);
854    cmd_size += vn_sizeof_uint32_t(&bindInfoCount);
855    if (pBindInfos) {
856        cmd_size += vn_sizeof_array_size(bindInfoCount);
857        for (uint32_t i = 0; i < bindInfoCount; i++)
858            cmd_size += vn_sizeof_VkBindBufferMemoryInfo(&pBindInfos[i]);
859    } else {
860        cmd_size += vn_sizeof_array_size(0);
861    }
862
863    return cmd_size;
864}
865
866static inline void vn_encode_vkBindBufferMemory2(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
867{
868    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkBindBufferMemory2_EXT;
869
870    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
871    vn_encode_VkFlags(enc, &cmd_flags);
872
873    vn_encode_VkDevice(enc, &device);
874    vn_encode_uint32_t(enc, &bindInfoCount);
875    if (pBindInfos) {
876        vn_encode_array_size(enc, bindInfoCount);
877        for (uint32_t i = 0; i < bindInfoCount; i++)
878            vn_encode_VkBindBufferMemoryInfo(enc, &pBindInfos[i]);
879    } else {
880        vn_encode_array_size(enc, 0);
881    }
882}
883
884static inline size_t vn_sizeof_vkBindBufferMemory2_reply(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
885{
886    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkBindBufferMemory2_EXT;
887    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
888
889    VkResult ret;
890    cmd_size += vn_sizeof_VkResult(&ret);
891    /* skip device */
892    /* skip bindInfoCount */
893    /* skip pBindInfos */
894
895    return cmd_size;
896}
897
898static inline VkResult vn_decode_vkBindBufferMemory2_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
899{
900    VkCommandTypeEXT command_type;
901    vn_decode_VkCommandTypeEXT(dec, &command_type);
902    assert(command_type == VK_COMMAND_TYPE_vkBindBufferMemory2_EXT);
903
904    VkResult ret;
905    vn_decode_VkResult(dec, &ret);
906    /* skip device */
907    /* skip bindInfoCount */
908    /* skip pBindInfos */
909
910    return ret;
911}
912
913static inline size_t vn_sizeof_vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
914{
915    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements2_EXT;
916    const VkFlags cmd_flags = 0;
917    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
918
919    cmd_size += vn_sizeof_VkDevice(&device);
920    cmd_size += vn_sizeof_simple_pointer(pInfo);
921    if (pInfo)
922        cmd_size += vn_sizeof_VkBufferMemoryRequirementsInfo2(pInfo);
923    cmd_size += vn_sizeof_simple_pointer(pMemoryRequirements);
924    if (pMemoryRequirements)
925        cmd_size += vn_sizeof_VkMemoryRequirements2_partial(pMemoryRequirements);
926
927    return cmd_size;
928}
929
930static inline void vn_encode_vkGetBufferMemoryRequirements2(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
931{
932    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements2_EXT;
933
934    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
935    vn_encode_VkFlags(enc, &cmd_flags);
936
937    vn_encode_VkDevice(enc, &device);
938    if (vn_encode_simple_pointer(enc, pInfo))
939        vn_encode_VkBufferMemoryRequirementsInfo2(enc, pInfo);
940    if (vn_encode_simple_pointer(enc, pMemoryRequirements))
941        vn_encode_VkMemoryRequirements2_partial(enc, pMemoryRequirements);
942}
943
944static inline size_t vn_sizeof_vkGetBufferMemoryRequirements2_reply(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
945{
946    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements2_EXT;
947    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
948
949    /* skip device */
950    /* skip pInfo */
951    cmd_size += vn_sizeof_simple_pointer(pMemoryRequirements);
952    if (pMemoryRequirements)
953        cmd_size += vn_sizeof_VkMemoryRequirements2(pMemoryRequirements);
954
955    return cmd_size;
956}
957
958static inline void vn_decode_vkGetBufferMemoryRequirements2_reply(struct vn_cs_decoder *dec, VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
959{
960    VkCommandTypeEXT command_type;
961    vn_decode_VkCommandTypeEXT(dec, &command_type);
962    assert(command_type == VK_COMMAND_TYPE_vkGetBufferMemoryRequirements2_EXT);
963
964    /* skip device */
965    /* skip pInfo */
966    if (vn_decode_simple_pointer(dec)) {
967        vn_decode_VkMemoryRequirements2(dec, pMemoryRequirements);
968    } else {
969        pMemoryRequirements = NULL;
970    }
971}
972
973static inline size_t vn_sizeof_vkGetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
974{
975    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferOpaqueCaptureAddress_EXT;
976    const VkFlags cmd_flags = 0;
977    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
978
979    cmd_size += vn_sizeof_VkDevice(&device);
980    cmd_size += vn_sizeof_simple_pointer(pInfo);
981    if (pInfo)
982        cmd_size += vn_sizeof_VkBufferDeviceAddressInfo(pInfo);
983
984    return cmd_size;
985}
986
987static inline void vn_encode_vkGetBufferOpaqueCaptureAddress(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
988{
989    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferOpaqueCaptureAddress_EXT;
990
991    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
992    vn_encode_VkFlags(enc, &cmd_flags);
993
994    vn_encode_VkDevice(enc, &device);
995    if (vn_encode_simple_pointer(enc, pInfo))
996        vn_encode_VkBufferDeviceAddressInfo(enc, pInfo);
997}
998
999static inline size_t vn_sizeof_vkGetBufferOpaqueCaptureAddress_reply(VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1000{
1001    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferOpaqueCaptureAddress_EXT;
1002    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
1003
1004    uint64_t ret;
1005    cmd_size += vn_sizeof_uint64_t(&ret);
1006    /* skip device */
1007    /* skip pInfo */
1008
1009    return cmd_size;
1010}
1011
1012static inline uint64_t vn_decode_vkGetBufferOpaqueCaptureAddress_reply(struct vn_cs_decoder *dec, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1013{
1014    VkCommandTypeEXT command_type;
1015    vn_decode_VkCommandTypeEXT(dec, &command_type);
1016    assert(command_type == VK_COMMAND_TYPE_vkGetBufferOpaqueCaptureAddress_EXT);
1017
1018    uint64_t ret;
1019    vn_decode_uint64_t(dec, &ret);
1020    /* skip device */
1021    /* skip pInfo */
1022
1023    return ret;
1024}
1025
1026static inline size_t vn_sizeof_vkGetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1027{
1028    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferDeviceAddress_EXT;
1029    const VkFlags cmd_flags = 0;
1030    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
1031
1032    cmd_size += vn_sizeof_VkDevice(&device);
1033    cmd_size += vn_sizeof_simple_pointer(pInfo);
1034    if (pInfo)
1035        cmd_size += vn_sizeof_VkBufferDeviceAddressInfo(pInfo);
1036
1037    return cmd_size;
1038}
1039
1040static inline void vn_encode_vkGetBufferDeviceAddress(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1041{
1042    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferDeviceAddress_EXT;
1043
1044    vn_encode_VkCommandTypeEXT(enc, &cmd_type);
1045    vn_encode_VkFlags(enc, &cmd_flags);
1046
1047    vn_encode_VkDevice(enc, &device);
1048    if (vn_encode_simple_pointer(enc, pInfo))
1049        vn_encode_VkBufferDeviceAddressInfo(enc, pInfo);
1050}
1051
1052static inline size_t vn_sizeof_vkGetBufferDeviceAddress_reply(VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1053{
1054    const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferDeviceAddress_EXT;
1055    size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
1056
1057    VkDeviceAddress ret;
1058    cmd_size += vn_sizeof_VkDeviceAddress(&ret);
1059    /* skip device */
1060    /* skip pInfo */
1061
1062    return cmd_size;
1063}
1064
1065static inline VkDeviceAddress vn_decode_vkGetBufferDeviceAddress_reply(struct vn_cs_decoder *dec, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1066{
1067    VkCommandTypeEXT command_type;
1068    vn_decode_VkCommandTypeEXT(dec, &command_type);
1069    assert(command_type == VK_COMMAND_TYPE_vkGetBufferDeviceAddress_EXT);
1070
1071    VkDeviceAddress ret;
1072    vn_decode_VkDeviceAddress(dec, &ret);
1073    /* skip device */
1074    /* skip pInfo */
1075
1076    return ret;
1077}
1078
1079static inline void vn_submit_vkGetBufferMemoryRequirements(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements, struct vn_instance_submit_command *submit)
1080{
1081    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1082    void *cmd_data = local_cmd_data;
1083    size_t cmd_size = vn_sizeof_vkGetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
1084    if (cmd_size > sizeof(local_cmd_data)) {
1085        cmd_data = malloc(cmd_size);
1086        if (!cmd_data)
1087            cmd_size = 0;
1088    }
1089    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetBufferMemoryRequirements_reply(device, buffer, pMemoryRequirements) : 0;
1090
1091    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1092    if (cmd_size) {
1093        vn_encode_vkGetBufferMemoryRequirements(enc, cmd_flags, device, buffer, pMemoryRequirements);
1094        vn_instance_submit_command(vn_instance, submit);
1095        if (cmd_data != local_cmd_data)
1096            free(cmd_data);
1097    }
1098}
1099
1100static inline void vn_submit_vkBindBufferMemory(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset, struct vn_instance_submit_command *submit)
1101{
1102    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1103    void *cmd_data = local_cmd_data;
1104    size_t cmd_size = vn_sizeof_vkBindBufferMemory(device, buffer, memory, memoryOffset);
1105    if (cmd_size > sizeof(local_cmd_data)) {
1106        cmd_data = malloc(cmd_size);
1107        if (!cmd_data)
1108            cmd_size = 0;
1109    }
1110    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkBindBufferMemory_reply(device, buffer, memory, memoryOffset) : 0;
1111
1112    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1113    if (cmd_size) {
1114        vn_encode_vkBindBufferMemory(enc, cmd_flags, device, buffer, memory, memoryOffset);
1115        vn_instance_submit_command(vn_instance, submit);
1116        if (cmd_data != local_cmd_data)
1117            free(cmd_data);
1118    }
1119}
1120
1121static inline void vn_submit_vkCreateBuffer(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer, struct vn_instance_submit_command *submit)
1122{
1123    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1124    void *cmd_data = local_cmd_data;
1125    size_t cmd_size = vn_sizeof_vkCreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
1126    if (cmd_size > sizeof(local_cmd_data)) {
1127        cmd_data = malloc(cmd_size);
1128        if (!cmd_data)
1129            cmd_size = 0;
1130    }
1131    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateBuffer_reply(device, pCreateInfo, pAllocator, pBuffer) : 0;
1132
1133    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1134    if (cmd_size) {
1135        vn_encode_vkCreateBuffer(enc, cmd_flags, device, pCreateInfo, pAllocator, pBuffer);
1136        vn_instance_submit_command(vn_instance, submit);
1137        if (cmd_data != local_cmd_data)
1138            free(cmd_data);
1139    }
1140}
1141
1142static inline void vn_submit_vkDestroyBuffer(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
1143{
1144    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1145    void *cmd_data = local_cmd_data;
1146    size_t cmd_size = vn_sizeof_vkDestroyBuffer(device, buffer, pAllocator);
1147    if (cmd_size > sizeof(local_cmd_data)) {
1148        cmd_data = malloc(cmd_size);
1149        if (!cmd_data)
1150            cmd_size = 0;
1151    }
1152    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyBuffer_reply(device, buffer, pAllocator) : 0;
1153
1154    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1155    if (cmd_size) {
1156        vn_encode_vkDestroyBuffer(enc, cmd_flags, device, buffer, pAllocator);
1157        vn_instance_submit_command(vn_instance, submit);
1158        if (cmd_data != local_cmd_data)
1159            free(cmd_data);
1160    }
1161}
1162
1163static inline void vn_submit_vkBindBufferMemory2(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos, struct vn_instance_submit_command *submit)
1164{
1165    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1166    void *cmd_data = local_cmd_data;
1167    size_t cmd_size = vn_sizeof_vkBindBufferMemory2(device, bindInfoCount, pBindInfos);
1168    if (cmd_size > sizeof(local_cmd_data)) {
1169        cmd_data = malloc(cmd_size);
1170        if (!cmd_data)
1171            cmd_size = 0;
1172    }
1173    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkBindBufferMemory2_reply(device, bindInfoCount, pBindInfos) : 0;
1174
1175    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1176    if (cmd_size) {
1177        vn_encode_vkBindBufferMemory2(enc, cmd_flags, device, bindInfoCount, pBindInfos);
1178        vn_instance_submit_command(vn_instance, submit);
1179        if (cmd_data != local_cmd_data)
1180            free(cmd_data);
1181    }
1182}
1183
1184static inline void vn_submit_vkGetBufferMemoryRequirements2(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements, struct vn_instance_submit_command *submit)
1185{
1186    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1187    void *cmd_data = local_cmd_data;
1188    size_t cmd_size = vn_sizeof_vkGetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements);
1189    if (cmd_size > sizeof(local_cmd_data)) {
1190        cmd_data = malloc(cmd_size);
1191        if (!cmd_data)
1192            cmd_size = 0;
1193    }
1194    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetBufferMemoryRequirements2_reply(device, pInfo, pMemoryRequirements) : 0;
1195
1196    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1197    if (cmd_size) {
1198        vn_encode_vkGetBufferMemoryRequirements2(enc, cmd_flags, device, pInfo, pMemoryRequirements);
1199        vn_instance_submit_command(vn_instance, submit);
1200        if (cmd_data != local_cmd_data)
1201            free(cmd_data);
1202    }
1203}
1204
1205static inline void vn_submit_vkGetBufferOpaqueCaptureAddress(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferDeviceAddressInfo* pInfo, struct vn_instance_submit_command *submit)
1206{
1207    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1208    void *cmd_data = local_cmd_data;
1209    size_t cmd_size = vn_sizeof_vkGetBufferOpaqueCaptureAddress(device, pInfo);
1210    if (cmd_size > sizeof(local_cmd_data)) {
1211        cmd_data = malloc(cmd_size);
1212        if (!cmd_data)
1213            cmd_size = 0;
1214    }
1215    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetBufferOpaqueCaptureAddress_reply(device, pInfo) : 0;
1216
1217    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1218    if (cmd_size) {
1219        vn_encode_vkGetBufferOpaqueCaptureAddress(enc, cmd_flags, device, pInfo);
1220        vn_instance_submit_command(vn_instance, submit);
1221        if (cmd_data != local_cmd_data)
1222            free(cmd_data);
1223    }
1224}
1225
1226static inline void vn_submit_vkGetBufferDeviceAddress(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferDeviceAddressInfo* pInfo, struct vn_instance_submit_command *submit)
1227{
1228    uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
1229    void *cmd_data = local_cmd_data;
1230    size_t cmd_size = vn_sizeof_vkGetBufferDeviceAddress(device, pInfo);
1231    if (cmd_size > sizeof(local_cmd_data)) {
1232        cmd_data = malloc(cmd_size);
1233        if (!cmd_data)
1234            cmd_size = 0;
1235    }
1236    const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetBufferDeviceAddress_reply(device, pInfo) : 0;
1237
1238    struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
1239    if (cmd_size) {
1240        vn_encode_vkGetBufferDeviceAddress(enc, cmd_flags, device, pInfo);
1241        vn_instance_submit_command(vn_instance, submit);
1242        if (cmd_data != local_cmd_data)
1243            free(cmd_data);
1244    }
1245}
1246
1247static inline void vn_call_vkGetBufferMemoryRequirements(struct vn_instance *vn_instance, VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
1248{
1249    VN_TRACE_FUNC();
1250
1251    struct vn_instance_submit_command submit;
1252    vn_submit_vkGetBufferMemoryRequirements(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, buffer, pMemoryRequirements, &submit);
1253    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1254    if (dec) {
1255        vn_decode_vkGetBufferMemoryRequirements_reply(dec, device, buffer, pMemoryRequirements);
1256        vn_instance_free_command_reply(vn_instance, &submit);
1257    }
1258}
1259
1260static inline void vn_async_vkGetBufferMemoryRequirements(struct vn_instance *vn_instance, VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
1261{
1262    struct vn_instance_submit_command submit;
1263    vn_submit_vkGetBufferMemoryRequirements(vn_instance, 0, device, buffer, pMemoryRequirements, &submit);
1264}
1265
1266static inline VkResult vn_call_vkBindBufferMemory(struct vn_instance *vn_instance, VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
1267{
1268    VN_TRACE_FUNC();
1269
1270    struct vn_instance_submit_command submit;
1271    vn_submit_vkBindBufferMemory(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, buffer, memory, memoryOffset, &submit);
1272    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1273    if (dec) {
1274        const VkResult ret = vn_decode_vkBindBufferMemory_reply(dec, device, buffer, memory, memoryOffset);
1275        vn_instance_free_command_reply(vn_instance, &submit);
1276        return ret;
1277    } else {
1278        return VK_ERROR_OUT_OF_HOST_MEMORY;
1279    }
1280}
1281
1282static inline void vn_async_vkBindBufferMemory(struct vn_instance *vn_instance, VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
1283{
1284    struct vn_instance_submit_command submit;
1285    vn_submit_vkBindBufferMemory(vn_instance, 0, device, buffer, memory, memoryOffset, &submit);
1286}
1287
1288static inline VkResult vn_call_vkCreateBuffer(struct vn_instance *vn_instance, VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
1289{
1290    VN_TRACE_FUNC();
1291
1292    struct vn_instance_submit_command submit;
1293    vn_submit_vkCreateBuffer(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pBuffer, &submit);
1294    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1295    if (dec) {
1296        const VkResult ret = vn_decode_vkCreateBuffer_reply(dec, device, pCreateInfo, pAllocator, pBuffer);
1297        vn_instance_free_command_reply(vn_instance, &submit);
1298        return ret;
1299    } else {
1300        return VK_ERROR_OUT_OF_HOST_MEMORY;
1301    }
1302}
1303
1304static inline void vn_async_vkCreateBuffer(struct vn_instance *vn_instance, VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
1305{
1306    struct vn_instance_submit_command submit;
1307    vn_submit_vkCreateBuffer(vn_instance, 0, device, pCreateInfo, pAllocator, pBuffer, &submit);
1308}
1309
1310static inline void vn_call_vkDestroyBuffer(struct vn_instance *vn_instance, VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
1311{
1312    VN_TRACE_FUNC();
1313
1314    struct vn_instance_submit_command submit;
1315    vn_submit_vkDestroyBuffer(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, buffer, pAllocator, &submit);
1316    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1317    if (dec) {
1318        vn_decode_vkDestroyBuffer_reply(dec, device, buffer, pAllocator);
1319        vn_instance_free_command_reply(vn_instance, &submit);
1320    }
1321}
1322
1323static inline void vn_async_vkDestroyBuffer(struct vn_instance *vn_instance, VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
1324{
1325    struct vn_instance_submit_command submit;
1326    vn_submit_vkDestroyBuffer(vn_instance, 0, device, buffer, pAllocator, &submit);
1327}
1328
1329static inline VkResult vn_call_vkBindBufferMemory2(struct vn_instance *vn_instance, VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
1330{
1331    VN_TRACE_FUNC();
1332
1333    struct vn_instance_submit_command submit;
1334    vn_submit_vkBindBufferMemory2(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, bindInfoCount, pBindInfos, &submit);
1335    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1336    if (dec) {
1337        const VkResult ret = vn_decode_vkBindBufferMemory2_reply(dec, device, bindInfoCount, pBindInfos);
1338        vn_instance_free_command_reply(vn_instance, &submit);
1339        return ret;
1340    } else {
1341        return VK_ERROR_OUT_OF_HOST_MEMORY;
1342    }
1343}
1344
1345static inline void vn_async_vkBindBufferMemory2(struct vn_instance *vn_instance, VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
1346{
1347    struct vn_instance_submit_command submit;
1348    vn_submit_vkBindBufferMemory2(vn_instance, 0, device, bindInfoCount, pBindInfos, &submit);
1349}
1350
1351static inline void vn_call_vkGetBufferMemoryRequirements2(struct vn_instance *vn_instance, VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
1352{
1353    VN_TRACE_FUNC();
1354
1355    struct vn_instance_submit_command submit;
1356    vn_submit_vkGetBufferMemoryRequirements2(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pInfo, pMemoryRequirements, &submit);
1357    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1358    if (dec) {
1359        vn_decode_vkGetBufferMemoryRequirements2_reply(dec, device, pInfo, pMemoryRequirements);
1360        vn_instance_free_command_reply(vn_instance, &submit);
1361    }
1362}
1363
1364static inline void vn_async_vkGetBufferMemoryRequirements2(struct vn_instance *vn_instance, VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
1365{
1366    struct vn_instance_submit_command submit;
1367    vn_submit_vkGetBufferMemoryRequirements2(vn_instance, 0, device, pInfo, pMemoryRequirements, &submit);
1368}
1369
1370static inline uint64_t vn_call_vkGetBufferOpaqueCaptureAddress(struct vn_instance *vn_instance, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1371{
1372    VN_TRACE_FUNC();
1373
1374    struct vn_instance_submit_command submit;
1375    vn_submit_vkGetBufferOpaqueCaptureAddress(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pInfo, &submit);
1376    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1377    if (dec) {
1378        const uint64_t ret = vn_decode_vkGetBufferOpaqueCaptureAddress_reply(dec, device, pInfo);
1379        vn_instance_free_command_reply(vn_instance, &submit);
1380        return ret;
1381    } else {
1382        return VK_ERROR_OUT_OF_HOST_MEMORY;
1383    }
1384}
1385
1386static inline void vn_async_vkGetBufferOpaqueCaptureAddress(struct vn_instance *vn_instance, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1387{
1388    struct vn_instance_submit_command submit;
1389    vn_submit_vkGetBufferOpaqueCaptureAddress(vn_instance, 0, device, pInfo, &submit);
1390}
1391
1392static inline VkDeviceAddress vn_call_vkGetBufferDeviceAddress(struct vn_instance *vn_instance, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1393{
1394    VN_TRACE_FUNC();
1395
1396    struct vn_instance_submit_command submit;
1397    vn_submit_vkGetBufferDeviceAddress(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pInfo, &submit);
1398    struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
1399    if (dec) {
1400        const VkDeviceAddress ret = vn_decode_vkGetBufferDeviceAddress_reply(dec, device, pInfo);
1401        vn_instance_free_command_reply(vn_instance, &submit);
1402        return ret;
1403    } else {
1404        return VK_ERROR_OUT_OF_HOST_MEMORY;
1405    }
1406}
1407
1408static inline void vn_async_vkGetBufferDeviceAddress(struct vn_instance *vn_instance, VkDevice device, const VkBufferDeviceAddressInfo* pInfo)
1409{
1410    struct vn_instance_submit_command submit;
1411    vn_submit_vkGetBufferDeviceAddress(vn_instance, 0, device, pInfo, &submit);
1412}
1413
1414#endif /* VN_PROTOCOL_DRIVER_BUFFER_H */
1415