• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This file is generated by venus-protocol.  See vn_protocol_renderer.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_RENDERER_STRUCTS_H
9 #define VN_PROTOCOL_RENDERER_STRUCTS_H
10 
11 #include "vn_protocol_renderer_handles.h"
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wpointer-arith"
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 /*
18  * These structs/unions/commands are not included
19  *
20  *   VkAllocationCallbacks
21  */
22 
23 /* struct VkExtent3D */
24 
25 static inline void
vn_encode_VkExtent3D(struct vn_cs_encoder * enc,const VkExtent3D * val)26 vn_encode_VkExtent3D(struct vn_cs_encoder *enc, const VkExtent3D *val)
27 {
28     vn_encode_uint32_t(enc, &val->width);
29     vn_encode_uint32_t(enc, &val->height);
30     vn_encode_uint32_t(enc, &val->depth);
31 }
32 
33 static inline void
vn_decode_VkExtent3D_temp(struct vn_cs_decoder * dec,VkExtent3D * val)34 vn_decode_VkExtent3D_temp(struct vn_cs_decoder *dec, VkExtent3D *val)
35 {
36     vn_decode_uint32_t(dec, &val->width);
37     vn_decode_uint32_t(dec, &val->height);
38     vn_decode_uint32_t(dec, &val->depth);
39 }
40 
41 static inline void
vn_decode_VkExtent3D_partial_temp(struct vn_cs_decoder * dec,VkExtent3D * val)42 vn_decode_VkExtent3D_partial_temp(struct vn_cs_decoder *dec, VkExtent3D *val)
43 {
44     /* skip val->width */
45     /* skip val->height */
46     /* skip val->depth */
47 }
48 
49 static inline void
vn_replace_VkExtent3D_handle(VkExtent3D * val)50 vn_replace_VkExtent3D_handle(VkExtent3D *val)
51 {
52     /* skip val->width */
53     /* skip val->height */
54     /* skip val->depth */
55 }
56 
57 /* struct VkLayerProperties */
58 
59 static inline void
vn_encode_VkLayerProperties(struct vn_cs_encoder * enc,const VkLayerProperties * val)60 vn_encode_VkLayerProperties(struct vn_cs_encoder *enc, const VkLayerProperties *val)
61 {
62     vn_encode_array_size(enc, VK_MAX_EXTENSION_NAME_SIZE);
63     vn_encode_char_array(enc, val->layerName, VK_MAX_EXTENSION_NAME_SIZE);
64     vn_encode_uint32_t(enc, &val->specVersion);
65     vn_encode_uint32_t(enc, &val->implementationVersion);
66     vn_encode_array_size(enc, VK_MAX_DESCRIPTION_SIZE);
67     vn_encode_char_array(enc, val->description, VK_MAX_DESCRIPTION_SIZE);
68 }
69 
70 static inline void
vn_decode_VkLayerProperties_partial_temp(struct vn_cs_decoder * dec,VkLayerProperties * val)71 vn_decode_VkLayerProperties_partial_temp(struct vn_cs_decoder *dec, VkLayerProperties *val)
72 {
73     /* skip val->layerName */
74     /* skip val->specVersion */
75     /* skip val->implementationVersion */
76     /* skip val->description */
77 }
78 
79 /* struct VkExtensionProperties */
80 
81 static inline void
vn_encode_VkExtensionProperties(struct vn_cs_encoder * enc,const VkExtensionProperties * val)82 vn_encode_VkExtensionProperties(struct vn_cs_encoder *enc, const VkExtensionProperties *val)
83 {
84     vn_encode_array_size(enc, VK_MAX_EXTENSION_NAME_SIZE);
85     vn_encode_char_array(enc, val->extensionName, VK_MAX_EXTENSION_NAME_SIZE);
86     vn_encode_uint32_t(enc, &val->specVersion);
87 }
88 
89 static inline void
vn_decode_VkExtensionProperties_temp(struct vn_cs_decoder * dec,VkExtensionProperties * val)90 vn_decode_VkExtensionProperties_temp(struct vn_cs_decoder *dec, VkExtensionProperties *val)
91 {
92     {
93         const size_t array_size = vn_decode_array_size(dec, VK_MAX_EXTENSION_NAME_SIZE);
94         vn_decode_char_array(dec, val->extensionName, array_size);
95     }
96     vn_decode_uint32_t(dec, &val->specVersion);
97 }
98 
99 static inline void
vn_decode_VkExtensionProperties_partial_temp(struct vn_cs_decoder * dec,VkExtensionProperties * val)100 vn_decode_VkExtensionProperties_partial_temp(struct vn_cs_decoder *dec, VkExtensionProperties *val)
101 {
102     /* skip val->extensionName */
103     /* skip val->specVersion */
104 }
105 
106 static inline void
vn_replace_VkExtensionProperties_handle(VkExtensionProperties * val)107 vn_replace_VkExtensionProperties_handle(VkExtensionProperties *val)
108 {
109     /* skip val->extensionName */
110     /* skip val->specVersion */
111 }
112 
113 /* struct VkMemoryRequirements */
114 
115 static inline void
vn_encode_VkMemoryRequirements(struct vn_cs_encoder * enc,const VkMemoryRequirements * val)116 vn_encode_VkMemoryRequirements(struct vn_cs_encoder *enc, const VkMemoryRequirements *val)
117 {
118     vn_encode_VkDeviceSize(enc, &val->size);
119     vn_encode_VkDeviceSize(enc, &val->alignment);
120     vn_encode_uint32_t(enc, &val->memoryTypeBits);
121 }
122 
123 static inline void
vn_decode_VkMemoryRequirements_partial_temp(struct vn_cs_decoder * dec,VkMemoryRequirements * val)124 vn_decode_VkMemoryRequirements_partial_temp(struct vn_cs_decoder *dec, VkMemoryRequirements *val)
125 {
126     /* skip val->size */
127     /* skip val->alignment */
128     /* skip val->memoryTypeBits */
129 }
130 
131 /* struct VkSparseImageFormatProperties */
132 
133 static inline void
vn_encode_VkSparseImageFormatProperties(struct vn_cs_encoder * enc,const VkSparseImageFormatProperties * val)134 vn_encode_VkSparseImageFormatProperties(struct vn_cs_encoder *enc, const VkSparseImageFormatProperties *val)
135 {
136     vn_encode_VkFlags(enc, &val->aspectMask);
137     vn_encode_VkExtent3D(enc, &val->imageGranularity);
138     vn_encode_VkFlags(enc, &val->flags);
139 }
140 
141 static inline void
vn_decode_VkSparseImageFormatProperties_partial_temp(struct vn_cs_decoder * dec,VkSparseImageFormatProperties * val)142 vn_decode_VkSparseImageFormatProperties_partial_temp(struct vn_cs_decoder *dec, VkSparseImageFormatProperties *val)
143 {
144     /* skip val->aspectMask */
145     vn_decode_VkExtent3D_partial_temp(dec, &val->imageGranularity);
146     /* skip val->flags */
147 }
148 
149 /* struct VkImageSubresource */
150 
151 static inline void
vn_decode_VkImageSubresource_temp(struct vn_cs_decoder * dec,VkImageSubresource * val)152 vn_decode_VkImageSubresource_temp(struct vn_cs_decoder *dec, VkImageSubresource *val)
153 {
154     vn_decode_VkFlags(dec, &val->aspectMask);
155     vn_decode_uint32_t(dec, &val->mipLevel);
156     vn_decode_uint32_t(dec, &val->arrayLayer);
157 }
158 
159 static inline void
vn_replace_VkImageSubresource_handle(VkImageSubresource * val)160 vn_replace_VkImageSubresource_handle(VkImageSubresource *val)
161 {
162     /* skip val->aspectMask */
163     /* skip val->mipLevel */
164     /* skip val->arrayLayer */
165 }
166 
167 /* struct VkOffset3D */
168 
169 static inline void
vn_decode_VkOffset3D_temp(struct vn_cs_decoder * dec,VkOffset3D * val)170 vn_decode_VkOffset3D_temp(struct vn_cs_decoder *dec, VkOffset3D *val)
171 {
172     vn_decode_int32_t(dec, &val->x);
173     vn_decode_int32_t(dec, &val->y);
174     vn_decode_int32_t(dec, &val->z);
175 }
176 
177 static inline void
vn_replace_VkOffset3D_handle(VkOffset3D * val)178 vn_replace_VkOffset3D_handle(VkOffset3D *val)
179 {
180     /* skip val->x */
181     /* skip val->y */
182     /* skip val->z */
183 }
184 
185 /* struct VkSemaphoreTypeCreateInfo chain */
186 
187 static inline void *
vn_decode_VkSemaphoreTypeCreateInfo_pnext_temp(struct vn_cs_decoder * dec)188 vn_decode_VkSemaphoreTypeCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
189 {
190     /* no known/supported struct */
191     if (vn_decode_simple_pointer(dec))
192         vn_cs_decoder_set_fatal(dec);
193     return NULL;
194 }
195 
196 static inline void
vn_decode_VkSemaphoreTypeCreateInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreTypeCreateInfo * val)197 vn_decode_VkSemaphoreTypeCreateInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreTypeCreateInfo *val)
198 {
199     /* skip val->{sType,pNext} */
200     vn_decode_VkSemaphoreType(dec, &val->semaphoreType);
201     vn_decode_uint64_t(dec, &val->initialValue);
202 }
203 
204 static inline void
vn_decode_VkSemaphoreTypeCreateInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreTypeCreateInfo * val)205 vn_decode_VkSemaphoreTypeCreateInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreTypeCreateInfo *val)
206 {
207     VkStructureType stype;
208     vn_decode_VkStructureType(dec, &stype);
209     if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO)
210         vn_cs_decoder_set_fatal(dec);
211 
212     val->sType = stype;
213     val->pNext = vn_decode_VkSemaphoreTypeCreateInfo_pnext_temp(dec);
214     vn_decode_VkSemaphoreTypeCreateInfo_self_temp(dec, val);
215 }
216 
217 static inline void
vn_replace_VkSemaphoreTypeCreateInfo_handle_self(VkSemaphoreTypeCreateInfo * val)218 vn_replace_VkSemaphoreTypeCreateInfo_handle_self(VkSemaphoreTypeCreateInfo *val)
219 {
220     /* skip val->sType */
221     /* skip val->pNext */
222     /* skip val->semaphoreType */
223     /* skip val->initialValue */
224 }
225 
226 static inline void
vn_replace_VkSemaphoreTypeCreateInfo_handle(VkSemaphoreTypeCreateInfo * val)227 vn_replace_VkSemaphoreTypeCreateInfo_handle(VkSemaphoreTypeCreateInfo *val)
228 {
229     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
230 
231     do {
232         switch ((int32_t)pnext->sType) {
233         case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO:
234             vn_replace_VkSemaphoreTypeCreateInfo_handle_self((VkSemaphoreTypeCreateInfo *)pnext);
235             break;
236         default:
237             /* ignore unknown/unsupported struct */
238             break;
239         }
240         pnext = pnext->pNext;
241     } while (pnext);
242 }
243 
244 /* struct VkImageFormatListCreateInfo chain */
245 
246 static inline void *
vn_decode_VkImageFormatListCreateInfo_pnext_temp(struct vn_cs_decoder * dec)247 vn_decode_VkImageFormatListCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
248 {
249     /* no known/supported struct */
250     if (vn_decode_simple_pointer(dec))
251         vn_cs_decoder_set_fatal(dec);
252     return NULL;
253 }
254 
255 static inline void
vn_decode_VkImageFormatListCreateInfo_self_temp(struct vn_cs_decoder * dec,VkImageFormatListCreateInfo * val)256 vn_decode_VkImageFormatListCreateInfo_self_temp(struct vn_cs_decoder *dec, VkImageFormatListCreateInfo *val)
257 {
258     /* skip val->{sType,pNext} */
259     vn_decode_uint32_t(dec, &val->viewFormatCount);
260     if (vn_peek_array_size(dec)) {
261         const size_t array_size = vn_decode_array_size(dec, val->viewFormatCount);
262         val->pViewFormats = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pViewFormats) * array_size);
263         if (!val->pViewFormats) return;
264         vn_decode_VkFormat_array(dec, (VkFormat *)val->pViewFormats, array_size);
265     } else {
266         vn_decode_array_size(dec, val->viewFormatCount);
267         val->pViewFormats = NULL;
268     }
269 }
270 
271 static inline void
vn_decode_VkImageFormatListCreateInfo_temp(struct vn_cs_decoder * dec,VkImageFormatListCreateInfo * val)272 vn_decode_VkImageFormatListCreateInfo_temp(struct vn_cs_decoder *dec, VkImageFormatListCreateInfo *val)
273 {
274     VkStructureType stype;
275     vn_decode_VkStructureType(dec, &stype);
276     if (stype != VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO)
277         vn_cs_decoder_set_fatal(dec);
278 
279     val->sType = stype;
280     val->pNext = vn_decode_VkImageFormatListCreateInfo_pnext_temp(dec);
281     vn_decode_VkImageFormatListCreateInfo_self_temp(dec, val);
282 }
283 
284 static inline void
vn_replace_VkImageFormatListCreateInfo_handle_self(VkImageFormatListCreateInfo * val)285 vn_replace_VkImageFormatListCreateInfo_handle_self(VkImageFormatListCreateInfo *val)
286 {
287     /* skip val->sType */
288     /* skip val->pNext */
289     /* skip val->viewFormatCount */
290     /* skip val->pViewFormats */
291 }
292 
293 static inline void
vn_replace_VkImageFormatListCreateInfo_handle(VkImageFormatListCreateInfo * val)294 vn_replace_VkImageFormatListCreateInfo_handle(VkImageFormatListCreateInfo *val)
295 {
296     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
297 
298     do {
299         switch ((int32_t)pnext->sType) {
300         case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO:
301             vn_replace_VkImageFormatListCreateInfo_handle_self((VkImageFormatListCreateInfo *)pnext);
302             break;
303         default:
304             /* ignore unknown/unsupported struct */
305             break;
306         }
307         pnext = pnext->pNext;
308     } while (pnext);
309 }
310 
311 /* struct VkImageStencilUsageCreateInfo chain */
312 
313 static inline void *
vn_decode_VkImageStencilUsageCreateInfo_pnext_temp(struct vn_cs_decoder * dec)314 vn_decode_VkImageStencilUsageCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
315 {
316     /* no known/supported struct */
317     if (vn_decode_simple_pointer(dec))
318         vn_cs_decoder_set_fatal(dec);
319     return NULL;
320 }
321 
322 static inline void
vn_decode_VkImageStencilUsageCreateInfo_self_temp(struct vn_cs_decoder * dec,VkImageStencilUsageCreateInfo * val)323 vn_decode_VkImageStencilUsageCreateInfo_self_temp(struct vn_cs_decoder *dec, VkImageStencilUsageCreateInfo *val)
324 {
325     /* skip val->{sType,pNext} */
326     vn_decode_VkFlags(dec, &val->stencilUsage);
327 }
328 
329 static inline void
vn_decode_VkImageStencilUsageCreateInfo_temp(struct vn_cs_decoder * dec,VkImageStencilUsageCreateInfo * val)330 vn_decode_VkImageStencilUsageCreateInfo_temp(struct vn_cs_decoder *dec, VkImageStencilUsageCreateInfo *val)
331 {
332     VkStructureType stype;
333     vn_decode_VkStructureType(dec, &stype);
334     if (stype != VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO)
335         vn_cs_decoder_set_fatal(dec);
336 
337     val->sType = stype;
338     val->pNext = vn_decode_VkImageStencilUsageCreateInfo_pnext_temp(dec);
339     vn_decode_VkImageStencilUsageCreateInfo_self_temp(dec, val);
340 }
341 
342 static inline void
vn_replace_VkImageStencilUsageCreateInfo_handle_self(VkImageStencilUsageCreateInfo * val)343 vn_replace_VkImageStencilUsageCreateInfo_handle_self(VkImageStencilUsageCreateInfo *val)
344 {
345     /* skip val->sType */
346     /* skip val->pNext */
347     /* skip val->stencilUsage */
348 }
349 
350 static inline void
vn_replace_VkImageStencilUsageCreateInfo_handle(VkImageStencilUsageCreateInfo * val)351 vn_replace_VkImageStencilUsageCreateInfo_handle(VkImageStencilUsageCreateInfo *val)
352 {
353     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
354 
355     do {
356         switch ((int32_t)pnext->sType) {
357         case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO:
358             vn_replace_VkImageStencilUsageCreateInfo_handle_self((VkImageStencilUsageCreateInfo *)pnext);
359             break;
360         default:
361             /* ignore unknown/unsupported struct */
362             break;
363         }
364         pnext = pnext->pNext;
365     } while (pnext);
366 }
367 
368 /* struct VkComponentMapping */
369 
370 static inline void
vn_encode_VkComponentMapping(struct vn_cs_encoder * enc,const VkComponentMapping * val)371 vn_encode_VkComponentMapping(struct vn_cs_encoder *enc, const VkComponentMapping *val)
372 {
373     vn_encode_VkComponentSwizzle(enc, &val->r);
374     vn_encode_VkComponentSwizzle(enc, &val->g);
375     vn_encode_VkComponentSwizzle(enc, &val->b);
376     vn_encode_VkComponentSwizzle(enc, &val->a);
377 }
378 
379 static inline void
vn_decode_VkComponentMapping_temp(struct vn_cs_decoder * dec,VkComponentMapping * val)380 vn_decode_VkComponentMapping_temp(struct vn_cs_decoder *dec, VkComponentMapping *val)
381 {
382     vn_decode_VkComponentSwizzle(dec, &val->r);
383     vn_decode_VkComponentSwizzle(dec, &val->g);
384     vn_decode_VkComponentSwizzle(dec, &val->b);
385     vn_decode_VkComponentSwizzle(dec, &val->a);
386 }
387 
388 static inline void
vn_decode_VkComponentMapping_partial_temp(struct vn_cs_decoder * dec,VkComponentMapping * val)389 vn_decode_VkComponentMapping_partial_temp(struct vn_cs_decoder *dec, VkComponentMapping *val)
390 {
391     /* skip val->r */
392     /* skip val->g */
393     /* skip val->b */
394     /* skip val->a */
395 }
396 
397 static inline void
vn_replace_VkComponentMapping_handle(VkComponentMapping * val)398 vn_replace_VkComponentMapping_handle(VkComponentMapping *val)
399 {
400     /* skip val->r */
401     /* skip val->g */
402     /* skip val->b */
403     /* skip val->a */
404 }
405 
406 /* struct VkImageSubresourceRange */
407 
408 static inline void
vn_decode_VkImageSubresourceRange_temp(struct vn_cs_decoder * dec,VkImageSubresourceRange * val)409 vn_decode_VkImageSubresourceRange_temp(struct vn_cs_decoder *dec, VkImageSubresourceRange *val)
410 {
411     vn_decode_VkFlags(dec, &val->aspectMask);
412     vn_decode_uint32_t(dec, &val->baseMipLevel);
413     vn_decode_uint32_t(dec, &val->levelCount);
414     vn_decode_uint32_t(dec, &val->baseArrayLayer);
415     vn_decode_uint32_t(dec, &val->layerCount);
416 }
417 
418 static inline void
vn_replace_VkImageSubresourceRange_handle(VkImageSubresourceRange * val)419 vn_replace_VkImageSubresourceRange_handle(VkImageSubresourceRange *val)
420 {
421     /* skip val->aspectMask */
422     /* skip val->baseMipLevel */
423     /* skip val->levelCount */
424     /* skip val->baseArrayLayer */
425     /* skip val->layerCount */
426 }
427 
428 /* struct VkSamplerYcbcrConversionInfo chain */
429 
430 static inline void *
vn_decode_VkSamplerYcbcrConversionInfo_pnext_temp(struct vn_cs_decoder * dec)431 vn_decode_VkSamplerYcbcrConversionInfo_pnext_temp(struct vn_cs_decoder *dec)
432 {
433     /* no known/supported struct */
434     if (vn_decode_simple_pointer(dec))
435         vn_cs_decoder_set_fatal(dec);
436     return NULL;
437 }
438 
439 static inline void
vn_decode_VkSamplerYcbcrConversionInfo_self_temp(struct vn_cs_decoder * dec,VkSamplerYcbcrConversionInfo * val)440 vn_decode_VkSamplerYcbcrConversionInfo_self_temp(struct vn_cs_decoder *dec, VkSamplerYcbcrConversionInfo *val)
441 {
442     /* skip val->{sType,pNext} */
443     vn_decode_VkSamplerYcbcrConversion_lookup(dec, &val->conversion);
444 }
445 
446 static inline void
vn_decode_VkSamplerYcbcrConversionInfo_temp(struct vn_cs_decoder * dec,VkSamplerYcbcrConversionInfo * val)447 vn_decode_VkSamplerYcbcrConversionInfo_temp(struct vn_cs_decoder *dec, VkSamplerYcbcrConversionInfo *val)
448 {
449     VkStructureType stype;
450     vn_decode_VkStructureType(dec, &stype);
451     if (stype != VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO)
452         vn_cs_decoder_set_fatal(dec);
453 
454     val->sType = stype;
455     val->pNext = vn_decode_VkSamplerYcbcrConversionInfo_pnext_temp(dec);
456     vn_decode_VkSamplerYcbcrConversionInfo_self_temp(dec, val);
457 }
458 
459 static inline void
vn_replace_VkSamplerYcbcrConversionInfo_handle_self(VkSamplerYcbcrConversionInfo * val)460 vn_replace_VkSamplerYcbcrConversionInfo_handle_self(VkSamplerYcbcrConversionInfo *val)
461 {
462     /* skip val->sType */
463     /* skip val->pNext */
464     vn_replace_VkSamplerYcbcrConversion_handle(&val->conversion);
465 }
466 
467 static inline void
vn_replace_VkSamplerYcbcrConversionInfo_handle(VkSamplerYcbcrConversionInfo * val)468 vn_replace_VkSamplerYcbcrConversionInfo_handle(VkSamplerYcbcrConversionInfo *val)
469 {
470     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
471 
472     do {
473         switch ((int32_t)pnext->sType) {
474         case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO:
475             vn_replace_VkSamplerYcbcrConversionInfo_handle_self((VkSamplerYcbcrConversionInfo *)pnext);
476             break;
477         default:
478             /* ignore unknown/unsupported struct */
479             break;
480         }
481         pnext = pnext->pNext;
482     } while (pnext);
483 }
484 
485 /* struct VkViewport */
486 
487 static inline void
vn_encode_VkViewport(struct vn_cs_encoder * enc,const VkViewport * val)488 vn_encode_VkViewport(struct vn_cs_encoder *enc, const VkViewport *val)
489 {
490     vn_encode_float(enc, &val->x);
491     vn_encode_float(enc, &val->y);
492     vn_encode_float(enc, &val->width);
493     vn_encode_float(enc, &val->height);
494     vn_encode_float(enc, &val->minDepth);
495     vn_encode_float(enc, &val->maxDepth);
496 }
497 
498 static inline void
vn_decode_VkViewport_temp(struct vn_cs_decoder * dec,VkViewport * val)499 vn_decode_VkViewport_temp(struct vn_cs_decoder *dec, VkViewport *val)
500 {
501     vn_decode_float(dec, &val->x);
502     vn_decode_float(dec, &val->y);
503     vn_decode_float(dec, &val->width);
504     vn_decode_float(dec, &val->height);
505     vn_decode_float(dec, &val->minDepth);
506     vn_decode_float(dec, &val->maxDepth);
507 }
508 
509 static inline void
vn_replace_VkViewport_handle(VkViewport * val)510 vn_replace_VkViewport_handle(VkViewport *val)
511 {
512     /* skip val->x */
513     /* skip val->y */
514     /* skip val->width */
515     /* skip val->height */
516     /* skip val->minDepth */
517     /* skip val->maxDepth */
518 }
519 
520 /* struct VkOffset2D */
521 
522 static inline void
vn_encode_VkOffset2D(struct vn_cs_encoder * enc,const VkOffset2D * val)523 vn_encode_VkOffset2D(struct vn_cs_encoder *enc, const VkOffset2D *val)
524 {
525     vn_encode_int32_t(enc, &val->x);
526     vn_encode_int32_t(enc, &val->y);
527 }
528 
529 static inline void
vn_decode_VkOffset2D_temp(struct vn_cs_decoder * dec,VkOffset2D * val)530 vn_decode_VkOffset2D_temp(struct vn_cs_decoder *dec, VkOffset2D *val)
531 {
532     vn_decode_int32_t(dec, &val->x);
533     vn_decode_int32_t(dec, &val->y);
534 }
535 
536 static inline void
vn_decode_VkOffset2D_partial_temp(struct vn_cs_decoder * dec,VkOffset2D * val)537 vn_decode_VkOffset2D_partial_temp(struct vn_cs_decoder *dec, VkOffset2D *val)
538 {
539     /* skip val->x */
540     /* skip val->y */
541 }
542 
543 static inline void
vn_replace_VkOffset2D_handle(VkOffset2D * val)544 vn_replace_VkOffset2D_handle(VkOffset2D *val)
545 {
546     /* skip val->x */
547     /* skip val->y */
548 }
549 
550 /* struct VkExtent2D */
551 
552 static inline void
vn_encode_VkExtent2D(struct vn_cs_encoder * enc,const VkExtent2D * val)553 vn_encode_VkExtent2D(struct vn_cs_encoder *enc, const VkExtent2D *val)
554 {
555     vn_encode_uint32_t(enc, &val->width);
556     vn_encode_uint32_t(enc, &val->height);
557 }
558 
559 static inline void
vn_decode_VkExtent2D_temp(struct vn_cs_decoder * dec,VkExtent2D * val)560 vn_decode_VkExtent2D_temp(struct vn_cs_decoder *dec, VkExtent2D *val)
561 {
562     vn_decode_uint32_t(dec, &val->width);
563     vn_decode_uint32_t(dec, &val->height);
564 }
565 
566 static inline void
vn_decode_VkExtent2D_partial_temp(struct vn_cs_decoder * dec,VkExtent2D * val)567 vn_decode_VkExtent2D_partial_temp(struct vn_cs_decoder *dec, VkExtent2D *val)
568 {
569     /* skip val->width */
570     /* skip val->height */
571 }
572 
573 static inline void
vn_replace_VkExtent2D_handle(VkExtent2D * val)574 vn_replace_VkExtent2D_handle(VkExtent2D *val)
575 {
576     /* skip val->width */
577     /* skip val->height */
578 }
579 
580 /* struct VkRect2D */
581 
582 static inline void
vn_encode_VkRect2D(struct vn_cs_encoder * enc,const VkRect2D * val)583 vn_encode_VkRect2D(struct vn_cs_encoder *enc, const VkRect2D *val)
584 {
585     vn_encode_VkOffset2D(enc, &val->offset);
586     vn_encode_VkExtent2D(enc, &val->extent);
587 }
588 
589 static inline void
vn_decode_VkRect2D_temp(struct vn_cs_decoder * dec,VkRect2D * val)590 vn_decode_VkRect2D_temp(struct vn_cs_decoder *dec, VkRect2D *val)
591 {
592     vn_decode_VkOffset2D_temp(dec, &val->offset);
593     vn_decode_VkExtent2D_temp(dec, &val->extent);
594 }
595 
596 static inline void
vn_decode_VkRect2D_partial_temp(struct vn_cs_decoder * dec,VkRect2D * val)597 vn_decode_VkRect2D_partial_temp(struct vn_cs_decoder *dec, VkRect2D *val)
598 {
599     vn_decode_VkOffset2D_partial_temp(dec, &val->offset);
600     vn_decode_VkExtent2D_partial_temp(dec, &val->extent);
601 }
602 
603 static inline void
vn_replace_VkRect2D_handle(VkRect2D * val)604 vn_replace_VkRect2D_handle(VkRect2D *val)
605 {
606     vn_replace_VkOffset2D_handle(&val->offset);
607     vn_replace_VkExtent2D_handle(&val->extent);
608 }
609 
610 /* struct VkMemoryDedicatedRequirements chain */
611 
612 static inline void
vn_encode_VkMemoryDedicatedRequirements_pnext(struct vn_cs_encoder * enc,const void * val)613 vn_encode_VkMemoryDedicatedRequirements_pnext(struct vn_cs_encoder *enc, const void *val)
614 {
615     /* no known/supported struct */
616     vn_encode_simple_pointer(enc, NULL);
617 }
618 
619 static inline void
vn_encode_VkMemoryDedicatedRequirements_self(struct vn_cs_encoder * enc,const VkMemoryDedicatedRequirements * val)620 vn_encode_VkMemoryDedicatedRequirements_self(struct vn_cs_encoder *enc, const VkMemoryDedicatedRequirements *val)
621 {
622     /* skip val->{sType,pNext} */
623     vn_encode_VkBool32(enc, &val->prefersDedicatedAllocation);
624     vn_encode_VkBool32(enc, &val->requiresDedicatedAllocation);
625 }
626 
627 static inline void
vn_encode_VkMemoryDedicatedRequirements(struct vn_cs_encoder * enc,const VkMemoryDedicatedRequirements * val)628 vn_encode_VkMemoryDedicatedRequirements(struct vn_cs_encoder *enc, const VkMemoryDedicatedRequirements *val)
629 {
630     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS);
631     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS });
632     vn_encode_VkMemoryDedicatedRequirements_pnext(enc, val->pNext);
633     vn_encode_VkMemoryDedicatedRequirements_self(enc, val);
634 }
635 
636 static inline void *
vn_decode_VkMemoryDedicatedRequirements_pnext_partial_temp(struct vn_cs_decoder * dec)637 vn_decode_VkMemoryDedicatedRequirements_pnext_partial_temp(struct vn_cs_decoder *dec)
638 {
639     /* no known/supported struct */
640     if (vn_decode_simple_pointer(dec))
641         vn_cs_decoder_set_fatal(dec);
642     return NULL;
643 }
644 
645 static inline void
vn_decode_VkMemoryDedicatedRequirements_self_partial_temp(struct vn_cs_decoder * dec,VkMemoryDedicatedRequirements * val)646 vn_decode_VkMemoryDedicatedRequirements_self_partial_temp(struct vn_cs_decoder *dec, VkMemoryDedicatedRequirements *val)
647 {
648     /* skip val->{sType,pNext} */
649     /* skip val->prefersDedicatedAllocation */
650     /* skip val->requiresDedicatedAllocation */
651 }
652 
653 static inline void
vn_decode_VkMemoryDedicatedRequirements_partial_temp(struct vn_cs_decoder * dec,VkMemoryDedicatedRequirements * val)654 vn_decode_VkMemoryDedicatedRequirements_partial_temp(struct vn_cs_decoder *dec, VkMemoryDedicatedRequirements *val)
655 {
656     VkStructureType stype;
657     vn_decode_VkStructureType(dec, &stype);
658     if (stype != VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS)
659         vn_cs_decoder_set_fatal(dec);
660 
661     val->sType = stype;
662     val->pNext = vn_decode_VkMemoryDedicatedRequirements_pnext_partial_temp(dec);
663     vn_decode_VkMemoryDedicatedRequirements_self_partial_temp(dec, val);
664 }
665 
666 /* struct VkMemoryRequirements2 chain */
667 
668 static inline void
vn_encode_VkMemoryRequirements2_pnext(struct vn_cs_encoder * enc,const void * val)669 vn_encode_VkMemoryRequirements2_pnext(struct vn_cs_encoder *enc, const void *val)
670 {
671     const VkBaseInStructure *pnext = val;
672 
673     while (pnext) {
674         switch ((int32_t)pnext->sType) {
675         case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
676             vn_encode_simple_pointer(enc, pnext);
677             vn_encode_VkStructureType(enc, &pnext->sType);
678             vn_encode_VkMemoryRequirements2_pnext(enc, pnext->pNext);
679             vn_encode_VkMemoryDedicatedRequirements_self(enc, (const VkMemoryDedicatedRequirements *)pnext);
680             return;
681         default:
682             /* ignore unknown/unsupported struct */
683             break;
684         }
685         pnext = pnext->pNext;
686     }
687 
688     vn_encode_simple_pointer(enc, NULL);
689 }
690 
691 static inline void
vn_encode_VkMemoryRequirements2_self(struct vn_cs_encoder * enc,const VkMemoryRequirements2 * val)692 vn_encode_VkMemoryRequirements2_self(struct vn_cs_encoder *enc, const VkMemoryRequirements2 *val)
693 {
694     /* skip val->{sType,pNext} */
695     vn_encode_VkMemoryRequirements(enc, &val->memoryRequirements);
696 }
697 
698 static inline void
vn_encode_VkMemoryRequirements2(struct vn_cs_encoder * enc,const VkMemoryRequirements2 * val)699 vn_encode_VkMemoryRequirements2(struct vn_cs_encoder *enc, const VkMemoryRequirements2 *val)
700 {
701     assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2);
702     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 });
703     vn_encode_VkMemoryRequirements2_pnext(enc, val->pNext);
704     vn_encode_VkMemoryRequirements2_self(enc, val);
705 }
706 
707 static inline void *
vn_decode_VkMemoryRequirements2_pnext_partial_temp(struct vn_cs_decoder * dec)708 vn_decode_VkMemoryRequirements2_pnext_partial_temp(struct vn_cs_decoder *dec)
709 {
710     VkBaseOutStructure *pnext;
711     VkStructureType stype;
712 
713     if (!vn_decode_simple_pointer(dec))
714         return NULL;
715 
716     vn_decode_VkStructureType(dec, &stype);
717     switch ((int32_t)stype) {
718     case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
719         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMemoryDedicatedRequirements));
720         if (pnext) {
721             pnext->sType = stype;
722             pnext->pNext = vn_decode_VkMemoryRequirements2_pnext_partial_temp(dec);
723             vn_decode_VkMemoryDedicatedRequirements_self_partial_temp(dec, (VkMemoryDedicatedRequirements *)pnext);
724         }
725         break;
726     default:
727         /* unexpected struct */
728         pnext = NULL;
729         vn_cs_decoder_set_fatal(dec);
730         break;
731     }
732 
733     return pnext;
734 }
735 
736 static inline void
vn_decode_VkMemoryRequirements2_self_partial_temp(struct vn_cs_decoder * dec,VkMemoryRequirements2 * val)737 vn_decode_VkMemoryRequirements2_self_partial_temp(struct vn_cs_decoder *dec, VkMemoryRequirements2 *val)
738 {
739     /* skip val->{sType,pNext} */
740     vn_decode_VkMemoryRequirements_partial_temp(dec, &val->memoryRequirements);
741 }
742 
743 static inline void
vn_decode_VkMemoryRequirements2_partial_temp(struct vn_cs_decoder * dec,VkMemoryRequirements2 * val)744 vn_decode_VkMemoryRequirements2_partial_temp(struct vn_cs_decoder *dec, VkMemoryRequirements2 *val)
745 {
746     VkStructureType stype;
747     vn_decode_VkStructureType(dec, &stype);
748     if (stype != VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2)
749         vn_cs_decoder_set_fatal(dec);
750 
751     val->sType = stype;
752     val->pNext = vn_decode_VkMemoryRequirements2_pnext_partial_temp(dec);
753     vn_decode_VkMemoryRequirements2_self_partial_temp(dec, val);
754 }
755 
756 #pragma GCC diagnostic pop
757 
758 #endif /* VN_PROTOCOL_RENDERER_STRUCTS_H */
759