• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This file is generated by venus-protocol.  See vn_protocol_driver.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_DRIVER_STRUCTS_H
9 #define VN_PROTOCOL_DRIVER_STRUCTS_H
10 
11 #include "vn_protocol_driver_handles.h"
12 
13 /*
14  * These structs/unions/commands are not included
15  *
16  *   VkAllocationCallbacks
17  */
18 
19 /* struct VkExtent3D */
20 
21 static inline size_t
vn_sizeof_VkExtent3D(const VkExtent3D * val)22 vn_sizeof_VkExtent3D(const VkExtent3D *val)
23 {
24     size_t size = 0;
25     size += vn_sizeof_uint32_t(&val->width);
26     size += vn_sizeof_uint32_t(&val->height);
27     size += vn_sizeof_uint32_t(&val->depth);
28     return size;
29 }
30 
31 static inline void
vn_encode_VkExtent3D(struct vn_cs_encoder * enc,const VkExtent3D * val)32 vn_encode_VkExtent3D(struct vn_cs_encoder *enc, const VkExtent3D *val)
33 {
34     vn_encode_uint32_t(enc, &val->width);
35     vn_encode_uint32_t(enc, &val->height);
36     vn_encode_uint32_t(enc, &val->depth);
37 }
38 
39 static inline void
vn_decode_VkExtent3D(struct vn_cs_decoder * dec,VkExtent3D * val)40 vn_decode_VkExtent3D(struct vn_cs_decoder *dec, VkExtent3D *val)
41 {
42     vn_decode_uint32_t(dec, &val->width);
43     vn_decode_uint32_t(dec, &val->height);
44     vn_decode_uint32_t(dec, &val->depth);
45 }
46 
47 static inline size_t
vn_sizeof_VkExtent3D_partial(const VkExtent3D * val)48 vn_sizeof_VkExtent3D_partial(const VkExtent3D *val)
49 {
50     size_t size = 0;
51     /* skip val->width */
52     /* skip val->height */
53     /* skip val->depth */
54     return size;
55 }
56 
57 static inline void
vn_encode_VkExtent3D_partial(struct vn_cs_encoder * enc,const VkExtent3D * val)58 vn_encode_VkExtent3D_partial(struct vn_cs_encoder *enc, const VkExtent3D *val)
59 {
60     /* skip val->width */
61     /* skip val->height */
62     /* skip val->depth */
63 }
64 
65 /* struct VkLayerProperties */
66 
67 static inline size_t
vn_sizeof_VkLayerProperties(const VkLayerProperties * val)68 vn_sizeof_VkLayerProperties(const VkLayerProperties *val)
69 {
70     size_t size = 0;
71     size += vn_sizeof_array_size(VK_MAX_EXTENSION_NAME_SIZE);
72     size += vn_sizeof_char_array(val->layerName, VK_MAX_EXTENSION_NAME_SIZE);
73     size += vn_sizeof_uint32_t(&val->specVersion);
74     size += vn_sizeof_uint32_t(&val->implementationVersion);
75     size += vn_sizeof_array_size(VK_MAX_DESCRIPTION_SIZE);
76     size += vn_sizeof_char_array(val->description, VK_MAX_DESCRIPTION_SIZE);
77     return size;
78 }
79 
80 static inline void
vn_decode_VkLayerProperties(struct vn_cs_decoder * dec,VkLayerProperties * val)81 vn_decode_VkLayerProperties(struct vn_cs_decoder *dec, VkLayerProperties *val)
82 {
83     {
84         const size_t array_size = vn_decode_array_size(dec, VK_MAX_EXTENSION_NAME_SIZE);
85         vn_decode_char_array(dec, val->layerName, array_size);
86     }
87     vn_decode_uint32_t(dec, &val->specVersion);
88     vn_decode_uint32_t(dec, &val->implementationVersion);
89     {
90         const size_t array_size = vn_decode_array_size(dec, VK_MAX_DESCRIPTION_SIZE);
91         vn_decode_char_array(dec, val->description, array_size);
92     }
93 }
94 
95 static inline size_t
vn_sizeof_VkLayerProperties_partial(const VkLayerProperties * val)96 vn_sizeof_VkLayerProperties_partial(const VkLayerProperties *val)
97 {
98     size_t size = 0;
99     /* skip val->layerName */
100     /* skip val->specVersion */
101     /* skip val->implementationVersion */
102     /* skip val->description */
103     return size;
104 }
105 
106 static inline void
vn_encode_VkLayerProperties_partial(struct vn_cs_encoder * enc,const VkLayerProperties * val)107 vn_encode_VkLayerProperties_partial(struct vn_cs_encoder *enc, const VkLayerProperties *val)
108 {
109     /* skip val->layerName */
110     /* skip val->specVersion */
111     /* skip val->implementationVersion */
112     /* skip val->description */
113 }
114 
115 /* struct VkExtensionProperties */
116 
117 static inline size_t
vn_sizeof_VkExtensionProperties(const VkExtensionProperties * val)118 vn_sizeof_VkExtensionProperties(const VkExtensionProperties *val)
119 {
120     size_t size = 0;
121     size += vn_sizeof_array_size(VK_MAX_EXTENSION_NAME_SIZE);
122     size += vn_sizeof_char_array(val->extensionName, VK_MAX_EXTENSION_NAME_SIZE);
123     size += vn_sizeof_uint32_t(&val->specVersion);
124     return size;
125 }
126 
127 static inline void
vn_encode_VkExtensionProperties(struct vn_cs_encoder * enc,const VkExtensionProperties * val)128 vn_encode_VkExtensionProperties(struct vn_cs_encoder *enc, const VkExtensionProperties *val)
129 {
130     vn_encode_array_size(enc, VK_MAX_EXTENSION_NAME_SIZE);
131     vn_encode_char_array(enc, val->extensionName, VK_MAX_EXTENSION_NAME_SIZE);
132     vn_encode_uint32_t(enc, &val->specVersion);
133 }
134 
135 static inline void
vn_decode_VkExtensionProperties(struct vn_cs_decoder * dec,VkExtensionProperties * val)136 vn_decode_VkExtensionProperties(struct vn_cs_decoder *dec, VkExtensionProperties *val)
137 {
138     {
139         const size_t array_size = vn_decode_array_size(dec, VK_MAX_EXTENSION_NAME_SIZE);
140         vn_decode_char_array(dec, val->extensionName, array_size);
141     }
142     vn_decode_uint32_t(dec, &val->specVersion);
143 }
144 
145 static inline size_t
vn_sizeof_VkExtensionProperties_partial(const VkExtensionProperties * val)146 vn_sizeof_VkExtensionProperties_partial(const VkExtensionProperties *val)
147 {
148     size_t size = 0;
149     /* skip val->extensionName */
150     /* skip val->specVersion */
151     return size;
152 }
153 
154 static inline void
vn_encode_VkExtensionProperties_partial(struct vn_cs_encoder * enc,const VkExtensionProperties * val)155 vn_encode_VkExtensionProperties_partial(struct vn_cs_encoder *enc, const VkExtensionProperties *val)
156 {
157     /* skip val->extensionName */
158     /* skip val->specVersion */
159 }
160 
161 /* struct VkMemoryRequirements */
162 
163 static inline size_t
vn_sizeof_VkMemoryRequirements(const VkMemoryRequirements * val)164 vn_sizeof_VkMemoryRequirements(const VkMemoryRequirements *val)
165 {
166     size_t size = 0;
167     size += vn_sizeof_VkDeviceSize(&val->size);
168     size += vn_sizeof_VkDeviceSize(&val->alignment);
169     size += vn_sizeof_uint32_t(&val->memoryTypeBits);
170     return size;
171 }
172 
173 static inline void
vn_decode_VkMemoryRequirements(struct vn_cs_decoder * dec,VkMemoryRequirements * val)174 vn_decode_VkMemoryRequirements(struct vn_cs_decoder *dec, VkMemoryRequirements *val)
175 {
176     vn_decode_VkDeviceSize(dec, &val->size);
177     vn_decode_VkDeviceSize(dec, &val->alignment);
178     vn_decode_uint32_t(dec, &val->memoryTypeBits);
179 }
180 
181 static inline size_t
vn_sizeof_VkMemoryRequirements_partial(const VkMemoryRequirements * val)182 vn_sizeof_VkMemoryRequirements_partial(const VkMemoryRequirements *val)
183 {
184     size_t size = 0;
185     /* skip val->size */
186     /* skip val->alignment */
187     /* skip val->memoryTypeBits */
188     return size;
189 }
190 
191 static inline void
vn_encode_VkMemoryRequirements_partial(struct vn_cs_encoder * enc,const VkMemoryRequirements * val)192 vn_encode_VkMemoryRequirements_partial(struct vn_cs_encoder *enc, const VkMemoryRequirements *val)
193 {
194     /* skip val->size */
195     /* skip val->alignment */
196     /* skip val->memoryTypeBits */
197 }
198 
199 /* struct VkSparseImageFormatProperties */
200 
201 static inline size_t
vn_sizeof_VkSparseImageFormatProperties(const VkSparseImageFormatProperties * val)202 vn_sizeof_VkSparseImageFormatProperties(const VkSparseImageFormatProperties *val)
203 {
204     size_t size = 0;
205     size += vn_sizeof_VkFlags(&val->aspectMask);
206     size += vn_sizeof_VkExtent3D(&val->imageGranularity);
207     size += vn_sizeof_VkFlags(&val->flags);
208     return size;
209 }
210 
211 static inline void
vn_decode_VkSparseImageFormatProperties(struct vn_cs_decoder * dec,VkSparseImageFormatProperties * val)212 vn_decode_VkSparseImageFormatProperties(struct vn_cs_decoder *dec, VkSparseImageFormatProperties *val)
213 {
214     vn_decode_VkFlags(dec, &val->aspectMask);
215     vn_decode_VkExtent3D(dec, &val->imageGranularity);
216     vn_decode_VkFlags(dec, &val->flags);
217 }
218 
219 static inline size_t
vn_sizeof_VkSparseImageFormatProperties_partial(const VkSparseImageFormatProperties * val)220 vn_sizeof_VkSparseImageFormatProperties_partial(const VkSparseImageFormatProperties *val)
221 {
222     size_t size = 0;
223     /* skip val->aspectMask */
224     size += vn_sizeof_VkExtent3D_partial(&val->imageGranularity);
225     /* skip val->flags */
226     return size;
227 }
228 
229 static inline void
vn_encode_VkSparseImageFormatProperties_partial(struct vn_cs_encoder * enc,const VkSparseImageFormatProperties * val)230 vn_encode_VkSparseImageFormatProperties_partial(struct vn_cs_encoder *enc, const VkSparseImageFormatProperties *val)
231 {
232     /* skip val->aspectMask */
233     vn_encode_VkExtent3D_partial(enc, &val->imageGranularity);
234     /* skip val->flags */
235 }
236 
237 /* struct VkImageSubresource */
238 
239 static inline size_t
vn_sizeof_VkImageSubresource(const VkImageSubresource * val)240 vn_sizeof_VkImageSubresource(const VkImageSubresource *val)
241 {
242     size_t size = 0;
243     size += vn_sizeof_VkFlags(&val->aspectMask);
244     size += vn_sizeof_uint32_t(&val->mipLevel);
245     size += vn_sizeof_uint32_t(&val->arrayLayer);
246     return size;
247 }
248 
249 static inline void
vn_encode_VkImageSubresource(struct vn_cs_encoder * enc,const VkImageSubresource * val)250 vn_encode_VkImageSubresource(struct vn_cs_encoder *enc, const VkImageSubresource *val)
251 {
252     vn_encode_VkFlags(enc, &val->aspectMask);
253     vn_encode_uint32_t(enc, &val->mipLevel);
254     vn_encode_uint32_t(enc, &val->arrayLayer);
255 }
256 
257 /* struct VkOffset3D */
258 
259 static inline size_t
vn_sizeof_VkOffset3D(const VkOffset3D * val)260 vn_sizeof_VkOffset3D(const VkOffset3D *val)
261 {
262     size_t size = 0;
263     size += vn_sizeof_int32_t(&val->x);
264     size += vn_sizeof_int32_t(&val->y);
265     size += vn_sizeof_int32_t(&val->z);
266     return size;
267 }
268 
269 static inline void
vn_encode_VkOffset3D(struct vn_cs_encoder * enc,const VkOffset3D * val)270 vn_encode_VkOffset3D(struct vn_cs_encoder *enc, const VkOffset3D *val)
271 {
272     vn_encode_int32_t(enc, &val->x);
273     vn_encode_int32_t(enc, &val->y);
274     vn_encode_int32_t(enc, &val->z);
275 }
276 
277 /* struct VkSemaphoreTypeCreateInfo chain */
278 
279 static inline size_t
vn_sizeof_VkSemaphoreTypeCreateInfo_pnext(const void * val)280 vn_sizeof_VkSemaphoreTypeCreateInfo_pnext(const void *val)
281 {
282     /* no known/supported struct */
283     return vn_sizeof_simple_pointer(NULL);
284 }
285 
286 static inline size_t
vn_sizeof_VkSemaphoreTypeCreateInfo_self(const VkSemaphoreTypeCreateInfo * val)287 vn_sizeof_VkSemaphoreTypeCreateInfo_self(const VkSemaphoreTypeCreateInfo *val)
288 {
289     size_t size = 0;
290     /* skip val->{sType,pNext} */
291     size += vn_sizeof_VkSemaphoreType(&val->semaphoreType);
292     size += vn_sizeof_uint64_t(&val->initialValue);
293     return size;
294 }
295 
296 static inline size_t
vn_sizeof_VkSemaphoreTypeCreateInfo(const VkSemaphoreTypeCreateInfo * val)297 vn_sizeof_VkSemaphoreTypeCreateInfo(const VkSemaphoreTypeCreateInfo *val)
298 {
299     size_t size = 0;
300 
301     size += vn_sizeof_VkStructureType(&val->sType);
302     size += vn_sizeof_VkSemaphoreTypeCreateInfo_pnext(val->pNext);
303     size += vn_sizeof_VkSemaphoreTypeCreateInfo_self(val);
304 
305     return size;
306 }
307 
308 static inline void
vn_encode_VkSemaphoreTypeCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)309 vn_encode_VkSemaphoreTypeCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
310 {
311     /* no known/supported struct */
312     vn_encode_simple_pointer(enc, NULL);
313 }
314 
315 static inline void
vn_encode_VkSemaphoreTypeCreateInfo_self(struct vn_cs_encoder * enc,const VkSemaphoreTypeCreateInfo * val)316 vn_encode_VkSemaphoreTypeCreateInfo_self(struct vn_cs_encoder *enc, const VkSemaphoreTypeCreateInfo *val)
317 {
318     /* skip val->{sType,pNext} */
319     vn_encode_VkSemaphoreType(enc, &val->semaphoreType);
320     vn_encode_uint64_t(enc, &val->initialValue);
321 }
322 
323 static inline void
vn_encode_VkSemaphoreTypeCreateInfo(struct vn_cs_encoder * enc,const VkSemaphoreTypeCreateInfo * val)324 vn_encode_VkSemaphoreTypeCreateInfo(struct vn_cs_encoder *enc, const VkSemaphoreTypeCreateInfo *val)
325 {
326     assert(val->sType == VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO);
327     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO });
328     vn_encode_VkSemaphoreTypeCreateInfo_pnext(enc, val->pNext);
329     vn_encode_VkSemaphoreTypeCreateInfo_self(enc, val);
330 }
331 
332 /* struct VkImageFormatListCreateInfo chain */
333 
334 static inline size_t
vn_sizeof_VkImageFormatListCreateInfo_pnext(const void * val)335 vn_sizeof_VkImageFormatListCreateInfo_pnext(const void *val)
336 {
337     /* no known/supported struct */
338     return vn_sizeof_simple_pointer(NULL);
339 }
340 
341 static inline size_t
vn_sizeof_VkImageFormatListCreateInfo_self(const VkImageFormatListCreateInfo * val)342 vn_sizeof_VkImageFormatListCreateInfo_self(const VkImageFormatListCreateInfo *val)
343 {
344     size_t size = 0;
345     /* skip val->{sType,pNext} */
346     size += vn_sizeof_uint32_t(&val->viewFormatCount);
347     if (val->pViewFormats) {
348         size += vn_sizeof_array_size(val->viewFormatCount);
349         size += vn_sizeof_VkFormat_array(val->pViewFormats, val->viewFormatCount);
350     } else {
351         size += vn_sizeof_array_size(0);
352     }
353     return size;
354 }
355 
356 static inline size_t
vn_sizeof_VkImageFormatListCreateInfo(const VkImageFormatListCreateInfo * val)357 vn_sizeof_VkImageFormatListCreateInfo(const VkImageFormatListCreateInfo *val)
358 {
359     size_t size = 0;
360 
361     size += vn_sizeof_VkStructureType(&val->sType);
362     size += vn_sizeof_VkImageFormatListCreateInfo_pnext(val->pNext);
363     size += vn_sizeof_VkImageFormatListCreateInfo_self(val);
364 
365     return size;
366 }
367 
368 static inline void
vn_encode_VkImageFormatListCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)369 vn_encode_VkImageFormatListCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
370 {
371     /* no known/supported struct */
372     vn_encode_simple_pointer(enc, NULL);
373 }
374 
375 static inline void
vn_encode_VkImageFormatListCreateInfo_self(struct vn_cs_encoder * enc,const VkImageFormatListCreateInfo * val)376 vn_encode_VkImageFormatListCreateInfo_self(struct vn_cs_encoder *enc, const VkImageFormatListCreateInfo *val)
377 {
378     /* skip val->{sType,pNext} */
379     vn_encode_uint32_t(enc, &val->viewFormatCount);
380     if (val->pViewFormats) {
381         vn_encode_array_size(enc, val->viewFormatCount);
382         vn_encode_VkFormat_array(enc, val->pViewFormats, val->viewFormatCount);
383     } else {
384         vn_encode_array_size(enc, 0);
385     }
386 }
387 
388 static inline void
vn_encode_VkImageFormatListCreateInfo(struct vn_cs_encoder * enc,const VkImageFormatListCreateInfo * val)389 vn_encode_VkImageFormatListCreateInfo(struct vn_cs_encoder *enc, const VkImageFormatListCreateInfo *val)
390 {
391     assert(val->sType == VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO);
392     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO });
393     vn_encode_VkImageFormatListCreateInfo_pnext(enc, val->pNext);
394     vn_encode_VkImageFormatListCreateInfo_self(enc, val);
395 }
396 
397 /* struct VkImageStencilUsageCreateInfo chain */
398 
399 static inline size_t
vn_sizeof_VkImageStencilUsageCreateInfo_pnext(const void * val)400 vn_sizeof_VkImageStencilUsageCreateInfo_pnext(const void *val)
401 {
402     /* no known/supported struct */
403     return vn_sizeof_simple_pointer(NULL);
404 }
405 
406 static inline size_t
vn_sizeof_VkImageStencilUsageCreateInfo_self(const VkImageStencilUsageCreateInfo * val)407 vn_sizeof_VkImageStencilUsageCreateInfo_self(const VkImageStencilUsageCreateInfo *val)
408 {
409     size_t size = 0;
410     /* skip val->{sType,pNext} */
411     size += vn_sizeof_VkFlags(&val->stencilUsage);
412     return size;
413 }
414 
415 static inline size_t
vn_sizeof_VkImageStencilUsageCreateInfo(const VkImageStencilUsageCreateInfo * val)416 vn_sizeof_VkImageStencilUsageCreateInfo(const VkImageStencilUsageCreateInfo *val)
417 {
418     size_t size = 0;
419 
420     size += vn_sizeof_VkStructureType(&val->sType);
421     size += vn_sizeof_VkImageStencilUsageCreateInfo_pnext(val->pNext);
422     size += vn_sizeof_VkImageStencilUsageCreateInfo_self(val);
423 
424     return size;
425 }
426 
427 static inline void
vn_encode_VkImageStencilUsageCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)428 vn_encode_VkImageStencilUsageCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
429 {
430     /* no known/supported struct */
431     vn_encode_simple_pointer(enc, NULL);
432 }
433 
434 static inline void
vn_encode_VkImageStencilUsageCreateInfo_self(struct vn_cs_encoder * enc,const VkImageStencilUsageCreateInfo * val)435 vn_encode_VkImageStencilUsageCreateInfo_self(struct vn_cs_encoder *enc, const VkImageStencilUsageCreateInfo *val)
436 {
437     /* skip val->{sType,pNext} */
438     vn_encode_VkFlags(enc, &val->stencilUsage);
439 }
440 
441 static inline void
vn_encode_VkImageStencilUsageCreateInfo(struct vn_cs_encoder * enc,const VkImageStencilUsageCreateInfo * val)442 vn_encode_VkImageStencilUsageCreateInfo(struct vn_cs_encoder *enc, const VkImageStencilUsageCreateInfo *val)
443 {
444     assert(val->sType == VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO);
445     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO });
446     vn_encode_VkImageStencilUsageCreateInfo_pnext(enc, val->pNext);
447     vn_encode_VkImageStencilUsageCreateInfo_self(enc, val);
448 }
449 
450 /* struct VkComponentMapping */
451 
452 static inline size_t
vn_sizeof_VkComponentMapping(const VkComponentMapping * val)453 vn_sizeof_VkComponentMapping(const VkComponentMapping *val)
454 {
455     size_t size = 0;
456     size += vn_sizeof_VkComponentSwizzle(&val->r);
457     size += vn_sizeof_VkComponentSwizzle(&val->g);
458     size += vn_sizeof_VkComponentSwizzle(&val->b);
459     size += vn_sizeof_VkComponentSwizzle(&val->a);
460     return size;
461 }
462 
463 static inline void
vn_encode_VkComponentMapping(struct vn_cs_encoder * enc,const VkComponentMapping * val)464 vn_encode_VkComponentMapping(struct vn_cs_encoder *enc, const VkComponentMapping *val)
465 {
466     vn_encode_VkComponentSwizzle(enc, &val->r);
467     vn_encode_VkComponentSwizzle(enc, &val->g);
468     vn_encode_VkComponentSwizzle(enc, &val->b);
469     vn_encode_VkComponentSwizzle(enc, &val->a);
470 }
471 
472 static inline void
vn_decode_VkComponentMapping(struct vn_cs_decoder * dec,VkComponentMapping * val)473 vn_decode_VkComponentMapping(struct vn_cs_decoder *dec, VkComponentMapping *val)
474 {
475     vn_decode_VkComponentSwizzle(dec, &val->r);
476     vn_decode_VkComponentSwizzle(dec, &val->g);
477     vn_decode_VkComponentSwizzle(dec, &val->b);
478     vn_decode_VkComponentSwizzle(dec, &val->a);
479 }
480 
481 static inline size_t
vn_sizeof_VkComponentMapping_partial(const VkComponentMapping * val)482 vn_sizeof_VkComponentMapping_partial(const VkComponentMapping *val)
483 {
484     size_t size = 0;
485     /* skip val->r */
486     /* skip val->g */
487     /* skip val->b */
488     /* skip val->a */
489     return size;
490 }
491 
492 static inline void
vn_encode_VkComponentMapping_partial(struct vn_cs_encoder * enc,const VkComponentMapping * val)493 vn_encode_VkComponentMapping_partial(struct vn_cs_encoder *enc, const VkComponentMapping *val)
494 {
495     /* skip val->r */
496     /* skip val->g */
497     /* skip val->b */
498     /* skip val->a */
499 }
500 
501 /* struct VkImageSubresourceRange */
502 
503 static inline size_t
vn_sizeof_VkImageSubresourceRange(const VkImageSubresourceRange * val)504 vn_sizeof_VkImageSubresourceRange(const VkImageSubresourceRange *val)
505 {
506     size_t size = 0;
507     size += vn_sizeof_VkFlags(&val->aspectMask);
508     size += vn_sizeof_uint32_t(&val->baseMipLevel);
509     size += vn_sizeof_uint32_t(&val->levelCount);
510     size += vn_sizeof_uint32_t(&val->baseArrayLayer);
511     size += vn_sizeof_uint32_t(&val->layerCount);
512     return size;
513 }
514 
515 static inline void
vn_encode_VkImageSubresourceRange(struct vn_cs_encoder * enc,const VkImageSubresourceRange * val)516 vn_encode_VkImageSubresourceRange(struct vn_cs_encoder *enc, const VkImageSubresourceRange *val)
517 {
518     vn_encode_VkFlags(enc, &val->aspectMask);
519     vn_encode_uint32_t(enc, &val->baseMipLevel);
520     vn_encode_uint32_t(enc, &val->levelCount);
521     vn_encode_uint32_t(enc, &val->baseArrayLayer);
522     vn_encode_uint32_t(enc, &val->layerCount);
523 }
524 
525 /* struct VkSamplerYcbcrConversionInfo chain */
526 
527 static inline size_t
vn_sizeof_VkSamplerYcbcrConversionInfo_pnext(const void * val)528 vn_sizeof_VkSamplerYcbcrConversionInfo_pnext(const void *val)
529 {
530     /* no known/supported struct */
531     return vn_sizeof_simple_pointer(NULL);
532 }
533 
534 static inline size_t
vn_sizeof_VkSamplerYcbcrConversionInfo_self(const VkSamplerYcbcrConversionInfo * val)535 vn_sizeof_VkSamplerYcbcrConversionInfo_self(const VkSamplerYcbcrConversionInfo *val)
536 {
537     size_t size = 0;
538     /* skip val->{sType,pNext} */
539     size += vn_sizeof_VkSamplerYcbcrConversion(&val->conversion);
540     return size;
541 }
542 
543 static inline size_t
vn_sizeof_VkSamplerYcbcrConversionInfo(const VkSamplerYcbcrConversionInfo * val)544 vn_sizeof_VkSamplerYcbcrConversionInfo(const VkSamplerYcbcrConversionInfo *val)
545 {
546     size_t size = 0;
547 
548     size += vn_sizeof_VkStructureType(&val->sType);
549     size += vn_sizeof_VkSamplerYcbcrConversionInfo_pnext(val->pNext);
550     size += vn_sizeof_VkSamplerYcbcrConversionInfo_self(val);
551 
552     return size;
553 }
554 
555 static inline void
vn_encode_VkSamplerYcbcrConversionInfo_pnext(struct vn_cs_encoder * enc,const void * val)556 vn_encode_VkSamplerYcbcrConversionInfo_pnext(struct vn_cs_encoder *enc, const void *val)
557 {
558     /* no known/supported struct */
559     vn_encode_simple_pointer(enc, NULL);
560 }
561 
562 static inline void
vn_encode_VkSamplerYcbcrConversionInfo_self(struct vn_cs_encoder * enc,const VkSamplerYcbcrConversionInfo * val)563 vn_encode_VkSamplerYcbcrConversionInfo_self(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversionInfo *val)
564 {
565     /* skip val->{sType,pNext} */
566     vn_encode_VkSamplerYcbcrConversion(enc, &val->conversion);
567 }
568 
569 static inline void
vn_encode_VkSamplerYcbcrConversionInfo(struct vn_cs_encoder * enc,const VkSamplerYcbcrConversionInfo * val)570 vn_encode_VkSamplerYcbcrConversionInfo(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversionInfo *val)
571 {
572     assert(val->sType == VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO);
573     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO });
574     vn_encode_VkSamplerYcbcrConversionInfo_pnext(enc, val->pNext);
575     vn_encode_VkSamplerYcbcrConversionInfo_self(enc, val);
576 }
577 
578 /* struct VkViewport */
579 
580 static inline size_t
vn_sizeof_VkViewport(const VkViewport * val)581 vn_sizeof_VkViewport(const VkViewport *val)
582 {
583     size_t size = 0;
584     size += vn_sizeof_float(&val->x);
585     size += vn_sizeof_float(&val->y);
586     size += vn_sizeof_float(&val->width);
587     size += vn_sizeof_float(&val->height);
588     size += vn_sizeof_float(&val->minDepth);
589     size += vn_sizeof_float(&val->maxDepth);
590     return size;
591 }
592 
593 static inline void
vn_encode_VkViewport(struct vn_cs_encoder * enc,const VkViewport * val)594 vn_encode_VkViewport(struct vn_cs_encoder *enc, const VkViewport *val)
595 {
596     vn_encode_float(enc, &val->x);
597     vn_encode_float(enc, &val->y);
598     vn_encode_float(enc, &val->width);
599     vn_encode_float(enc, &val->height);
600     vn_encode_float(enc, &val->minDepth);
601     vn_encode_float(enc, &val->maxDepth);
602 }
603 
604 /* struct VkOffset2D */
605 
606 static inline size_t
vn_sizeof_VkOffset2D(const VkOffset2D * val)607 vn_sizeof_VkOffset2D(const VkOffset2D *val)
608 {
609     size_t size = 0;
610     size += vn_sizeof_int32_t(&val->x);
611     size += vn_sizeof_int32_t(&val->y);
612     return size;
613 }
614 
615 static inline void
vn_encode_VkOffset2D(struct vn_cs_encoder * enc,const VkOffset2D * val)616 vn_encode_VkOffset2D(struct vn_cs_encoder *enc, const VkOffset2D *val)
617 {
618     vn_encode_int32_t(enc, &val->x);
619     vn_encode_int32_t(enc, &val->y);
620 }
621 
622 static inline void
vn_decode_VkOffset2D(struct vn_cs_decoder * dec,VkOffset2D * val)623 vn_decode_VkOffset2D(struct vn_cs_decoder *dec, VkOffset2D *val)
624 {
625     vn_decode_int32_t(dec, &val->x);
626     vn_decode_int32_t(dec, &val->y);
627 }
628 
629 static inline size_t
vn_sizeof_VkOffset2D_partial(const VkOffset2D * val)630 vn_sizeof_VkOffset2D_partial(const VkOffset2D *val)
631 {
632     size_t size = 0;
633     /* skip val->x */
634     /* skip val->y */
635     return size;
636 }
637 
638 static inline void
vn_encode_VkOffset2D_partial(struct vn_cs_encoder * enc,const VkOffset2D * val)639 vn_encode_VkOffset2D_partial(struct vn_cs_encoder *enc, const VkOffset2D *val)
640 {
641     /* skip val->x */
642     /* skip val->y */
643 }
644 
645 /* struct VkExtent2D */
646 
647 static inline size_t
vn_sizeof_VkExtent2D(const VkExtent2D * val)648 vn_sizeof_VkExtent2D(const VkExtent2D *val)
649 {
650     size_t size = 0;
651     size += vn_sizeof_uint32_t(&val->width);
652     size += vn_sizeof_uint32_t(&val->height);
653     return size;
654 }
655 
656 static inline void
vn_encode_VkExtent2D(struct vn_cs_encoder * enc,const VkExtent2D * val)657 vn_encode_VkExtent2D(struct vn_cs_encoder *enc, const VkExtent2D *val)
658 {
659     vn_encode_uint32_t(enc, &val->width);
660     vn_encode_uint32_t(enc, &val->height);
661 }
662 
663 static inline void
vn_decode_VkExtent2D(struct vn_cs_decoder * dec,VkExtent2D * val)664 vn_decode_VkExtent2D(struct vn_cs_decoder *dec, VkExtent2D *val)
665 {
666     vn_decode_uint32_t(dec, &val->width);
667     vn_decode_uint32_t(dec, &val->height);
668 }
669 
670 static inline size_t
vn_sizeof_VkExtent2D_partial(const VkExtent2D * val)671 vn_sizeof_VkExtent2D_partial(const VkExtent2D *val)
672 {
673     size_t size = 0;
674     /* skip val->width */
675     /* skip val->height */
676     return size;
677 }
678 
679 static inline void
vn_encode_VkExtent2D_partial(struct vn_cs_encoder * enc,const VkExtent2D * val)680 vn_encode_VkExtent2D_partial(struct vn_cs_encoder *enc, const VkExtent2D *val)
681 {
682     /* skip val->width */
683     /* skip val->height */
684 }
685 
686 /* struct VkRect2D */
687 
688 static inline size_t
vn_sizeof_VkRect2D(const VkRect2D * val)689 vn_sizeof_VkRect2D(const VkRect2D *val)
690 {
691     size_t size = 0;
692     size += vn_sizeof_VkOffset2D(&val->offset);
693     size += vn_sizeof_VkExtent2D(&val->extent);
694     return size;
695 }
696 
697 static inline void
vn_encode_VkRect2D(struct vn_cs_encoder * enc,const VkRect2D * val)698 vn_encode_VkRect2D(struct vn_cs_encoder *enc, const VkRect2D *val)
699 {
700     vn_encode_VkOffset2D(enc, &val->offset);
701     vn_encode_VkExtent2D(enc, &val->extent);
702 }
703 
704 static inline void
vn_decode_VkRect2D(struct vn_cs_decoder * dec,VkRect2D * val)705 vn_decode_VkRect2D(struct vn_cs_decoder *dec, VkRect2D *val)
706 {
707     vn_decode_VkOffset2D(dec, &val->offset);
708     vn_decode_VkExtent2D(dec, &val->extent);
709 }
710 
711 static inline size_t
vn_sizeof_VkRect2D_partial(const VkRect2D * val)712 vn_sizeof_VkRect2D_partial(const VkRect2D *val)
713 {
714     size_t size = 0;
715     size += vn_sizeof_VkOffset2D_partial(&val->offset);
716     size += vn_sizeof_VkExtent2D_partial(&val->extent);
717     return size;
718 }
719 
720 static inline void
vn_encode_VkRect2D_partial(struct vn_cs_encoder * enc,const VkRect2D * val)721 vn_encode_VkRect2D_partial(struct vn_cs_encoder *enc, const VkRect2D *val)
722 {
723     vn_encode_VkOffset2D_partial(enc, &val->offset);
724     vn_encode_VkExtent2D_partial(enc, &val->extent);
725 }
726 
727 /* union VkClearColorValue */
728 
729 static inline size_t
vn_sizeof_VkClearColorValue_tag(const VkClearColorValue * val,uint32_t tag)730 vn_sizeof_VkClearColorValue_tag(const VkClearColorValue *val, uint32_t tag)
731 {
732     size_t size = vn_sizeof_uint32_t(&tag);
733     switch (tag) {
734     case 0:
735         size += vn_sizeof_array_size(4);
736     size += vn_sizeof_float_array(val->float32, 4);
737         break;
738     case 1:
739         size += vn_sizeof_array_size(4);
740     size += vn_sizeof_int32_t_array(val->int32, 4);
741         break;
742     case 2:
743         size += vn_sizeof_array_size(4);
744     size += vn_sizeof_uint32_t_array(val->uint32, 4);
745         break;
746     default:
747         assert(false);
748         break;
749     }
750     return size;
751 }
752 
753 static inline size_t
vn_sizeof_VkClearColorValue(const VkClearColorValue * val)754 vn_sizeof_VkClearColorValue(const VkClearColorValue *val)
755 {
756     return vn_sizeof_VkClearColorValue_tag(val, 2);
757 }
758 
759 static inline void
vn_encode_VkClearColorValue_tag(struct vn_cs_encoder * enc,const VkClearColorValue * val,uint32_t tag)760 vn_encode_VkClearColorValue_tag(struct vn_cs_encoder *enc, const VkClearColorValue *val, uint32_t tag)
761 {
762     vn_encode_uint32_t(enc, &tag);
763     switch (tag) {
764     case 0:
765         vn_encode_array_size(enc, 4);
766     vn_encode_float_array(enc, val->float32, 4);
767         break;
768     case 1:
769         vn_encode_array_size(enc, 4);
770     vn_encode_int32_t_array(enc, val->int32, 4);
771         break;
772     case 2:
773         vn_encode_array_size(enc, 4);
774     vn_encode_uint32_t_array(enc, val->uint32, 4);
775         break;
776     default:
777         assert(false);
778         break;
779     }
780 }
781 
782 static inline void
vn_encode_VkClearColorValue(struct vn_cs_encoder * enc,const VkClearColorValue * val)783 vn_encode_VkClearColorValue(struct vn_cs_encoder *enc, const VkClearColorValue *val)
784 {
785     vn_encode_VkClearColorValue_tag(enc, val, 2); /* union with default tag */
786 }
787 
788 /* struct VkMemoryDedicatedRequirements chain */
789 
790 static inline size_t
vn_sizeof_VkMemoryDedicatedRequirements_pnext(const void * val)791 vn_sizeof_VkMemoryDedicatedRequirements_pnext(const void *val)
792 {
793     /* no known/supported struct */
794     return vn_sizeof_simple_pointer(NULL);
795 }
796 
797 static inline size_t
vn_sizeof_VkMemoryDedicatedRequirements_self(const VkMemoryDedicatedRequirements * val)798 vn_sizeof_VkMemoryDedicatedRequirements_self(const VkMemoryDedicatedRequirements *val)
799 {
800     size_t size = 0;
801     /* skip val->{sType,pNext} */
802     size += vn_sizeof_VkBool32(&val->prefersDedicatedAllocation);
803     size += vn_sizeof_VkBool32(&val->requiresDedicatedAllocation);
804     return size;
805 }
806 
807 static inline size_t
vn_sizeof_VkMemoryDedicatedRequirements(const VkMemoryDedicatedRequirements * val)808 vn_sizeof_VkMemoryDedicatedRequirements(const VkMemoryDedicatedRequirements *val)
809 {
810     size_t size = 0;
811 
812     size += vn_sizeof_VkStructureType(&val->sType);
813     size += vn_sizeof_VkMemoryDedicatedRequirements_pnext(val->pNext);
814     size += vn_sizeof_VkMemoryDedicatedRequirements_self(val);
815 
816     return size;
817 }
818 
819 static inline void
vn_decode_VkMemoryDedicatedRequirements_pnext(struct vn_cs_decoder * dec,const void * val)820 vn_decode_VkMemoryDedicatedRequirements_pnext(struct vn_cs_decoder *dec, const void *val)
821 {
822     /* no known/supported struct */
823     if (vn_decode_simple_pointer(dec))
824         assert(false);
825 }
826 
827 static inline void
vn_decode_VkMemoryDedicatedRequirements_self(struct vn_cs_decoder * dec,VkMemoryDedicatedRequirements * val)828 vn_decode_VkMemoryDedicatedRequirements_self(struct vn_cs_decoder *dec, VkMemoryDedicatedRequirements *val)
829 {
830     /* skip val->{sType,pNext} */
831     vn_decode_VkBool32(dec, &val->prefersDedicatedAllocation);
832     vn_decode_VkBool32(dec, &val->requiresDedicatedAllocation);
833 }
834 
835 static inline void
vn_decode_VkMemoryDedicatedRequirements(struct vn_cs_decoder * dec,VkMemoryDedicatedRequirements * val)836 vn_decode_VkMemoryDedicatedRequirements(struct vn_cs_decoder *dec, VkMemoryDedicatedRequirements *val)
837 {
838     VkStructureType stype;
839     vn_decode_VkStructureType(dec, &stype);
840     assert(stype == VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS);
841 
842     assert(val->sType == stype);
843     vn_decode_VkMemoryDedicatedRequirements_pnext(dec, val->pNext);
844     vn_decode_VkMemoryDedicatedRequirements_self(dec, val);
845 }
846 
847 static inline size_t
vn_sizeof_VkMemoryDedicatedRequirements_pnext_partial(const void * val)848 vn_sizeof_VkMemoryDedicatedRequirements_pnext_partial(const void *val)
849 {
850     /* no known/supported struct */
851     return vn_sizeof_simple_pointer(NULL);
852 }
853 
854 static inline size_t
vn_sizeof_VkMemoryDedicatedRequirements_self_partial(const VkMemoryDedicatedRequirements * val)855 vn_sizeof_VkMemoryDedicatedRequirements_self_partial(const VkMemoryDedicatedRequirements *val)
856 {
857     size_t size = 0;
858     /* skip val->{sType,pNext} */
859     /* skip val->prefersDedicatedAllocation */
860     /* skip val->requiresDedicatedAllocation */
861     return size;
862 }
863 
864 static inline size_t
vn_sizeof_VkMemoryDedicatedRequirements_partial(const VkMemoryDedicatedRequirements * val)865 vn_sizeof_VkMemoryDedicatedRequirements_partial(const VkMemoryDedicatedRequirements *val)
866 {
867     size_t size = 0;
868 
869     size += vn_sizeof_VkStructureType(&val->sType);
870     size += vn_sizeof_VkMemoryDedicatedRequirements_pnext_partial(val->pNext);
871     size += vn_sizeof_VkMemoryDedicatedRequirements_self_partial(val);
872 
873     return size;
874 }
875 
876 static inline void
vn_encode_VkMemoryDedicatedRequirements_pnext_partial(struct vn_cs_encoder * enc,const void * val)877 vn_encode_VkMemoryDedicatedRequirements_pnext_partial(struct vn_cs_encoder *enc, const void *val)
878 {
879     /* no known/supported struct */
880     vn_encode_simple_pointer(enc, NULL);
881 }
882 
883 static inline void
vn_encode_VkMemoryDedicatedRequirements_self_partial(struct vn_cs_encoder * enc,const VkMemoryDedicatedRequirements * val)884 vn_encode_VkMemoryDedicatedRequirements_self_partial(struct vn_cs_encoder *enc, const VkMemoryDedicatedRequirements *val)
885 {
886     /* skip val->{sType,pNext} */
887     /* skip val->prefersDedicatedAllocation */
888     /* skip val->requiresDedicatedAllocation */
889 }
890 
891 static inline void
vn_encode_VkMemoryDedicatedRequirements_partial(struct vn_cs_encoder * enc,const VkMemoryDedicatedRequirements * val)892 vn_encode_VkMemoryDedicatedRequirements_partial(struct vn_cs_encoder *enc, const VkMemoryDedicatedRequirements *val)
893 {
894     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS);
895     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS });
896     vn_encode_VkMemoryDedicatedRequirements_pnext_partial(enc, val->pNext);
897     vn_encode_VkMemoryDedicatedRequirements_self_partial(enc, val);
898 }
899 
900 /* struct VkMemoryRequirements2 chain */
901 
902 static inline size_t
vn_sizeof_VkMemoryRequirements2_pnext(const void * val)903 vn_sizeof_VkMemoryRequirements2_pnext(const void *val)
904 {
905     const VkBaseInStructure *pnext = val;
906     size_t size = 0;
907 
908     while (pnext) {
909         switch ((int32_t)pnext->sType) {
910         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
911             size += vn_sizeof_simple_pointer(pnext);
912             size += vn_sizeof_VkStructureType(&pnext->sType);
913             size += vn_sizeof_VkMemoryRequirements2_pnext(pnext->pNext);
914             size += vn_sizeof_VkMemoryDedicatedRequirements_self((const VkMemoryDedicatedRequirements *)pnext);
915             return size;
916         default:
917             /* ignore unknown/unsupported struct */
918             break;
919         }
920         pnext = pnext->pNext;
921     }
922 
923     return vn_sizeof_simple_pointer(NULL);
924 }
925 
926 static inline size_t
vn_sizeof_VkMemoryRequirements2_self(const VkMemoryRequirements2 * val)927 vn_sizeof_VkMemoryRequirements2_self(const VkMemoryRequirements2 *val)
928 {
929     size_t size = 0;
930     /* skip val->{sType,pNext} */
931     size += vn_sizeof_VkMemoryRequirements(&val->memoryRequirements);
932     return size;
933 }
934 
935 static inline size_t
vn_sizeof_VkMemoryRequirements2(const VkMemoryRequirements2 * val)936 vn_sizeof_VkMemoryRequirements2(const VkMemoryRequirements2 *val)
937 {
938     size_t size = 0;
939 
940     size += vn_sizeof_VkStructureType(&val->sType);
941     size += vn_sizeof_VkMemoryRequirements2_pnext(val->pNext);
942     size += vn_sizeof_VkMemoryRequirements2_self(val);
943 
944     return size;
945 }
946 
947 static inline void
vn_decode_VkMemoryRequirements2_pnext(struct vn_cs_decoder * dec,const void * val)948 vn_decode_VkMemoryRequirements2_pnext(struct vn_cs_decoder *dec, const void *val)
949 {
950     VkBaseOutStructure *pnext = (VkBaseOutStructure *)val;
951     VkStructureType stype;
952 
953     if (!vn_decode_simple_pointer(dec))
954         return;
955 
956     vn_decode_VkStructureType(dec, &stype);
957     while (true) {
958         assert(pnext);
959         if (pnext->sType == stype)
960             break;
961 
962         pnext = pnext->pNext;
963     }
964 
965     switch ((int32_t)pnext->sType) {
966     case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
967         vn_decode_VkMemoryRequirements2_pnext(dec, pnext->pNext);
968         vn_decode_VkMemoryDedicatedRequirements_self(dec, (VkMemoryDedicatedRequirements *)pnext);
969         break;
970     default:
971         assert(false);
972         break;
973     }
974 }
975 
976 static inline void
vn_decode_VkMemoryRequirements2_self(struct vn_cs_decoder * dec,VkMemoryRequirements2 * val)977 vn_decode_VkMemoryRequirements2_self(struct vn_cs_decoder *dec, VkMemoryRequirements2 *val)
978 {
979     /* skip val->{sType,pNext} */
980     vn_decode_VkMemoryRequirements(dec, &val->memoryRequirements);
981 }
982 
983 static inline void
vn_decode_VkMemoryRequirements2(struct vn_cs_decoder * dec,VkMemoryRequirements2 * val)984 vn_decode_VkMemoryRequirements2(struct vn_cs_decoder *dec, VkMemoryRequirements2 *val)
985 {
986     VkStructureType stype;
987     vn_decode_VkStructureType(dec, &stype);
988     assert(stype == VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2);
989 
990     assert(val->sType == stype);
991     vn_decode_VkMemoryRequirements2_pnext(dec, val->pNext);
992     vn_decode_VkMemoryRequirements2_self(dec, val);
993 }
994 
995 static inline size_t
vn_sizeof_VkMemoryRequirements2_pnext_partial(const void * val)996 vn_sizeof_VkMemoryRequirements2_pnext_partial(const void *val)
997 {
998     const VkBaseInStructure *pnext = val;
999     size_t size = 0;
1000 
1001     while (pnext) {
1002         switch ((int32_t)pnext->sType) {
1003         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
1004             size += vn_sizeof_simple_pointer(pnext);
1005             size += vn_sizeof_VkStructureType(&pnext->sType);
1006             size += vn_sizeof_VkMemoryRequirements2_pnext_partial(pnext->pNext);
1007             size += vn_sizeof_VkMemoryDedicatedRequirements_self_partial((const VkMemoryDedicatedRequirements *)pnext);
1008             return size;
1009         default:
1010             /* ignore unknown/unsupported struct */
1011             break;
1012         }
1013         pnext = pnext->pNext;
1014     }
1015 
1016     return vn_sizeof_simple_pointer(NULL);
1017 }
1018 
1019 static inline size_t
vn_sizeof_VkMemoryRequirements2_self_partial(const VkMemoryRequirements2 * val)1020 vn_sizeof_VkMemoryRequirements2_self_partial(const VkMemoryRequirements2 *val)
1021 {
1022     size_t size = 0;
1023     /* skip val->{sType,pNext} */
1024     size += vn_sizeof_VkMemoryRequirements_partial(&val->memoryRequirements);
1025     return size;
1026 }
1027 
1028 static inline size_t
vn_sizeof_VkMemoryRequirements2_partial(const VkMemoryRequirements2 * val)1029 vn_sizeof_VkMemoryRequirements2_partial(const VkMemoryRequirements2 *val)
1030 {
1031     size_t size = 0;
1032 
1033     size += vn_sizeof_VkStructureType(&val->sType);
1034     size += vn_sizeof_VkMemoryRequirements2_pnext_partial(val->pNext);
1035     size += vn_sizeof_VkMemoryRequirements2_self_partial(val);
1036 
1037     return size;
1038 }
1039 
1040 static inline void
vn_encode_VkMemoryRequirements2_pnext_partial(struct vn_cs_encoder * enc,const void * val)1041 vn_encode_VkMemoryRequirements2_pnext_partial(struct vn_cs_encoder *enc, const void *val)
1042 {
1043     const VkBaseInStructure *pnext = val;
1044 
1045     while (pnext) {
1046         switch ((int32_t)pnext->sType) {
1047         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
1048             vn_encode_simple_pointer(enc, pnext);
1049             vn_encode_VkStructureType(enc, &pnext->sType);
1050             vn_encode_VkMemoryRequirements2_pnext_partial(enc, pnext->pNext);
1051             vn_encode_VkMemoryDedicatedRequirements_self_partial(enc, (const VkMemoryDedicatedRequirements *)pnext);
1052             return;
1053         default:
1054             /* ignore unknown/unsupported struct */
1055             break;
1056         }
1057         pnext = pnext->pNext;
1058     }
1059 
1060     vn_encode_simple_pointer(enc, NULL);
1061 }
1062 
1063 static inline void
vn_encode_VkMemoryRequirements2_self_partial(struct vn_cs_encoder * enc,const VkMemoryRequirements2 * val)1064 vn_encode_VkMemoryRequirements2_self_partial(struct vn_cs_encoder *enc, const VkMemoryRequirements2 *val)
1065 {
1066     /* skip val->{sType,pNext} */
1067     vn_encode_VkMemoryRequirements_partial(enc, &val->memoryRequirements);
1068 }
1069 
1070 static inline void
vn_encode_VkMemoryRequirements2_partial(struct vn_cs_encoder * enc,const VkMemoryRequirements2 * val)1071 vn_encode_VkMemoryRequirements2_partial(struct vn_cs_encoder *enc, const VkMemoryRequirements2 *val)
1072 {
1073     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2);
1074     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 });
1075     vn_encode_VkMemoryRequirements2_pnext_partial(enc, val->pNext);
1076     vn_encode_VkMemoryRequirements2_self_partial(enc, val);
1077 }
1078 
1079 /* struct VkMemoryBarrier2 chain */
1080 
1081 static inline size_t
vn_sizeof_VkMemoryBarrier2_pnext(const void * val)1082 vn_sizeof_VkMemoryBarrier2_pnext(const void *val)
1083 {
1084     /* no known/supported struct */
1085     return vn_sizeof_simple_pointer(NULL);
1086 }
1087 
1088 static inline size_t
vn_sizeof_VkMemoryBarrier2_self(const VkMemoryBarrier2 * val)1089 vn_sizeof_VkMemoryBarrier2_self(const VkMemoryBarrier2 *val)
1090 {
1091     size_t size = 0;
1092     /* skip val->{sType,pNext} */
1093     size += vn_sizeof_VkFlags64(&val->srcStageMask);
1094     size += vn_sizeof_VkFlags64(&val->srcAccessMask);
1095     size += vn_sizeof_VkFlags64(&val->dstStageMask);
1096     size += vn_sizeof_VkFlags64(&val->dstAccessMask);
1097     return size;
1098 }
1099 
1100 static inline size_t
vn_sizeof_VkMemoryBarrier2(const VkMemoryBarrier2 * val)1101 vn_sizeof_VkMemoryBarrier2(const VkMemoryBarrier2 *val)
1102 {
1103     size_t size = 0;
1104 
1105     size += vn_sizeof_VkStructureType(&val->sType);
1106     size += vn_sizeof_VkMemoryBarrier2_pnext(val->pNext);
1107     size += vn_sizeof_VkMemoryBarrier2_self(val);
1108 
1109     return size;
1110 }
1111 
1112 static inline void
vn_encode_VkMemoryBarrier2_pnext(struct vn_cs_encoder * enc,const void * val)1113 vn_encode_VkMemoryBarrier2_pnext(struct vn_cs_encoder *enc, const void *val)
1114 {
1115     /* no known/supported struct */
1116     vn_encode_simple_pointer(enc, NULL);
1117 }
1118 
1119 static inline void
vn_encode_VkMemoryBarrier2_self(struct vn_cs_encoder * enc,const VkMemoryBarrier2 * val)1120 vn_encode_VkMemoryBarrier2_self(struct vn_cs_encoder *enc, const VkMemoryBarrier2 *val)
1121 {
1122     /* skip val->{sType,pNext} */
1123     vn_encode_VkFlags64(enc, &val->srcStageMask);
1124     vn_encode_VkFlags64(enc, &val->srcAccessMask);
1125     vn_encode_VkFlags64(enc, &val->dstStageMask);
1126     vn_encode_VkFlags64(enc, &val->dstAccessMask);
1127 }
1128 
1129 static inline void
vn_encode_VkMemoryBarrier2(struct vn_cs_encoder * enc,const VkMemoryBarrier2 * val)1130 vn_encode_VkMemoryBarrier2(struct vn_cs_encoder *enc, const VkMemoryBarrier2 *val)
1131 {
1132     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_BARRIER_2);
1133     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_BARRIER_2 });
1134     vn_encode_VkMemoryBarrier2_pnext(enc, val->pNext);
1135     vn_encode_VkMemoryBarrier2_self(enc, val);
1136 }
1137 
1138 #endif /* VN_PROTOCOL_DRIVER_STRUCTS_H */
1139