xref: /aosp_15_r20/external/virglrenderer/src/venus/venus-protocol/vn_protocol_renderer_render_pass.h (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1 /* This file is generated by venus-protocol.  See vn_protocol_renderer.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_RENDERER_RENDER_PASS_H
9 #define VN_PROTOCOL_RENDERER_RENDER_PASS_H
10 
11 #include "vn_protocol_renderer_structs.h"
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wpointer-arith"
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 /* struct VkAttachmentDescription */
18 
19 static inline void
vn_decode_VkAttachmentDescription_temp(struct vn_cs_decoder * dec,VkAttachmentDescription * val)20 vn_decode_VkAttachmentDescription_temp(struct vn_cs_decoder *dec, VkAttachmentDescription *val)
21 {
22     vn_decode_VkFlags(dec, &val->flags);
23     vn_decode_VkFormat(dec, &val->format);
24     vn_decode_VkSampleCountFlagBits(dec, &val->samples);
25     vn_decode_VkAttachmentLoadOp(dec, &val->loadOp);
26     vn_decode_VkAttachmentStoreOp(dec, &val->storeOp);
27     vn_decode_VkAttachmentLoadOp(dec, &val->stencilLoadOp);
28     vn_decode_VkAttachmentStoreOp(dec, &val->stencilStoreOp);
29     vn_decode_VkImageLayout(dec, &val->initialLayout);
30     vn_decode_VkImageLayout(dec, &val->finalLayout);
31 }
32 
33 static inline void
vn_replace_VkAttachmentDescription_handle(VkAttachmentDescription * val)34 vn_replace_VkAttachmentDescription_handle(VkAttachmentDescription *val)
35 {
36     /* skip val->flags */
37     /* skip val->format */
38     /* skip val->samples */
39     /* skip val->loadOp */
40     /* skip val->storeOp */
41     /* skip val->stencilLoadOp */
42     /* skip val->stencilStoreOp */
43     /* skip val->initialLayout */
44     /* skip val->finalLayout */
45 }
46 
47 /* struct VkAttachmentReference */
48 
49 static inline void
vn_decode_VkAttachmentReference_temp(struct vn_cs_decoder * dec,VkAttachmentReference * val)50 vn_decode_VkAttachmentReference_temp(struct vn_cs_decoder *dec, VkAttachmentReference *val)
51 {
52     vn_decode_uint32_t(dec, &val->attachment);
53     vn_decode_VkImageLayout(dec, &val->layout);
54 }
55 
56 static inline void
vn_replace_VkAttachmentReference_handle(VkAttachmentReference * val)57 vn_replace_VkAttachmentReference_handle(VkAttachmentReference *val)
58 {
59     /* skip val->attachment */
60     /* skip val->layout */
61 }
62 
63 /* struct VkSubpassDescription */
64 
65 static inline void
vn_decode_VkSubpassDescription_temp(struct vn_cs_decoder * dec,VkSubpassDescription * val)66 vn_decode_VkSubpassDescription_temp(struct vn_cs_decoder *dec, VkSubpassDescription *val)
67 {
68     vn_decode_VkFlags(dec, &val->flags);
69     vn_decode_VkPipelineBindPoint(dec, &val->pipelineBindPoint);
70     vn_decode_uint32_t(dec, &val->inputAttachmentCount);
71     if (vn_peek_array_size(dec)) {
72         const uint32_t iter_count = vn_decode_array_size(dec, val->inputAttachmentCount);
73         val->pInputAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pInputAttachments) * iter_count);
74         if (!val->pInputAttachments) return;
75         for (uint32_t i = 0; i < iter_count; i++)
76             vn_decode_VkAttachmentReference_temp(dec, &((VkAttachmentReference *)val->pInputAttachments)[i]);
77     } else {
78         vn_decode_array_size(dec, val->inputAttachmentCount);
79         val->pInputAttachments = NULL;
80     }
81     vn_decode_uint32_t(dec, &val->colorAttachmentCount);
82     if (vn_peek_array_size(dec)) {
83         const uint32_t iter_count = vn_decode_array_size(dec, val->colorAttachmentCount);
84         val->pColorAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pColorAttachments) * iter_count);
85         if (!val->pColorAttachments) return;
86         for (uint32_t i = 0; i < iter_count; i++)
87             vn_decode_VkAttachmentReference_temp(dec, &((VkAttachmentReference *)val->pColorAttachments)[i]);
88     } else {
89         vn_decode_array_size(dec, val->colorAttachmentCount);
90         val->pColorAttachments = NULL;
91     }
92     if (vn_peek_array_size(dec)) {
93         const uint32_t iter_count = vn_decode_array_size(dec, val->colorAttachmentCount);
94         val->pResolveAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pResolveAttachments) * iter_count);
95         if (!val->pResolveAttachments) return;
96         for (uint32_t i = 0; i < iter_count; i++)
97             vn_decode_VkAttachmentReference_temp(dec, &((VkAttachmentReference *)val->pResolveAttachments)[i]);
98     } else {
99         vn_decode_array_size_unchecked(dec);
100         val->pResolveAttachments = NULL;
101     }
102     if (vn_decode_simple_pointer(dec)) {
103         val->pDepthStencilAttachment = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pDepthStencilAttachment));
104         if (!val->pDepthStencilAttachment) return;
105         vn_decode_VkAttachmentReference_temp(dec, (VkAttachmentReference *)val->pDepthStencilAttachment);
106     } else {
107         val->pDepthStencilAttachment = NULL;
108     }
109     vn_decode_uint32_t(dec, &val->preserveAttachmentCount);
110     if (vn_peek_array_size(dec)) {
111         const size_t array_size = vn_decode_array_size(dec, val->preserveAttachmentCount);
112         val->pPreserveAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pPreserveAttachments) * array_size);
113         if (!val->pPreserveAttachments) return;
114         vn_decode_uint32_t_array(dec, (uint32_t *)val->pPreserveAttachments, array_size);
115     } else {
116         vn_decode_array_size(dec, val->preserveAttachmentCount);
117         val->pPreserveAttachments = NULL;
118     }
119 }
120 
121 static inline void
vn_replace_VkSubpassDescription_handle(VkSubpassDescription * val)122 vn_replace_VkSubpassDescription_handle(VkSubpassDescription *val)
123 {
124     /* skip val->flags */
125     /* skip val->pipelineBindPoint */
126     /* skip val->inputAttachmentCount */
127     if (val->pInputAttachments) {
128        for (uint32_t i = 0; i < val->inputAttachmentCount; i++)
129             vn_replace_VkAttachmentReference_handle(&((VkAttachmentReference *)val->pInputAttachments)[i]);
130     }
131     /* skip val->colorAttachmentCount */
132     if (val->pColorAttachments) {
133        for (uint32_t i = 0; i < val->colorAttachmentCount; i++)
134             vn_replace_VkAttachmentReference_handle(&((VkAttachmentReference *)val->pColorAttachments)[i]);
135     }
136     if (val->pResolveAttachments) {
137        for (uint32_t i = 0; i < val->colorAttachmentCount; i++)
138             vn_replace_VkAttachmentReference_handle(&((VkAttachmentReference *)val->pResolveAttachments)[i]);
139     }
140     if (val->pDepthStencilAttachment)
141         vn_replace_VkAttachmentReference_handle((VkAttachmentReference *)val->pDepthStencilAttachment);
142     /* skip val->preserveAttachmentCount */
143     /* skip val->pPreserveAttachments */
144 }
145 
146 /* struct VkSubpassDependency */
147 
148 static inline void
vn_decode_VkSubpassDependency_temp(struct vn_cs_decoder * dec,VkSubpassDependency * val)149 vn_decode_VkSubpassDependency_temp(struct vn_cs_decoder *dec, VkSubpassDependency *val)
150 {
151     vn_decode_uint32_t(dec, &val->srcSubpass);
152     vn_decode_uint32_t(dec, &val->dstSubpass);
153     vn_decode_VkFlags(dec, &val->srcStageMask);
154     vn_decode_VkFlags(dec, &val->dstStageMask);
155     vn_decode_VkFlags(dec, &val->srcAccessMask);
156     vn_decode_VkFlags(dec, &val->dstAccessMask);
157     vn_decode_VkFlags(dec, &val->dependencyFlags);
158 }
159 
160 static inline void
vn_replace_VkSubpassDependency_handle(VkSubpassDependency * val)161 vn_replace_VkSubpassDependency_handle(VkSubpassDependency *val)
162 {
163     /* skip val->srcSubpass */
164     /* skip val->dstSubpass */
165     /* skip val->srcStageMask */
166     /* skip val->dstStageMask */
167     /* skip val->srcAccessMask */
168     /* skip val->dstAccessMask */
169     /* skip val->dependencyFlags */
170 }
171 
172 /* struct VkRenderPassMultiviewCreateInfo chain */
173 
174 static inline void *
vn_decode_VkRenderPassMultiviewCreateInfo_pnext_temp(struct vn_cs_decoder * dec)175 vn_decode_VkRenderPassMultiviewCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
176 {
177     /* no known/supported struct */
178     if (vn_decode_simple_pointer(dec))
179         vn_cs_decoder_set_fatal(dec);
180     return NULL;
181 }
182 
183 static inline void
vn_decode_VkRenderPassMultiviewCreateInfo_self_temp(struct vn_cs_decoder * dec,VkRenderPassMultiviewCreateInfo * val)184 vn_decode_VkRenderPassMultiviewCreateInfo_self_temp(struct vn_cs_decoder *dec, VkRenderPassMultiviewCreateInfo *val)
185 {
186     /* skip val->{sType,pNext} */
187     vn_decode_uint32_t(dec, &val->subpassCount);
188     if (vn_peek_array_size(dec)) {
189         const size_t array_size = vn_decode_array_size(dec, val->subpassCount);
190         val->pViewMasks = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pViewMasks) * array_size);
191         if (!val->pViewMasks) return;
192         vn_decode_uint32_t_array(dec, (uint32_t *)val->pViewMasks, array_size);
193     } else {
194         vn_decode_array_size(dec, val->subpassCount);
195         val->pViewMasks = NULL;
196     }
197     vn_decode_uint32_t(dec, &val->dependencyCount);
198     if (vn_peek_array_size(dec)) {
199         const size_t array_size = vn_decode_array_size(dec, val->dependencyCount);
200         val->pViewOffsets = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pViewOffsets) * array_size);
201         if (!val->pViewOffsets) return;
202         vn_decode_int32_t_array(dec, (int32_t *)val->pViewOffsets, array_size);
203     } else {
204         vn_decode_array_size(dec, val->dependencyCount);
205         val->pViewOffsets = NULL;
206     }
207     vn_decode_uint32_t(dec, &val->correlationMaskCount);
208     if (vn_peek_array_size(dec)) {
209         const size_t array_size = vn_decode_array_size(dec, val->correlationMaskCount);
210         val->pCorrelationMasks = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pCorrelationMasks) * array_size);
211         if (!val->pCorrelationMasks) return;
212         vn_decode_uint32_t_array(dec, (uint32_t *)val->pCorrelationMasks, array_size);
213     } else {
214         vn_decode_array_size(dec, val->correlationMaskCount);
215         val->pCorrelationMasks = NULL;
216     }
217 }
218 
219 static inline void
vn_decode_VkRenderPassMultiviewCreateInfo_temp(struct vn_cs_decoder * dec,VkRenderPassMultiviewCreateInfo * val)220 vn_decode_VkRenderPassMultiviewCreateInfo_temp(struct vn_cs_decoder *dec, VkRenderPassMultiviewCreateInfo *val)
221 {
222     VkStructureType stype;
223     vn_decode_VkStructureType(dec, &stype);
224     if (stype != VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO)
225         vn_cs_decoder_set_fatal(dec);
226 
227     val->sType = stype;
228     val->pNext = vn_decode_VkRenderPassMultiviewCreateInfo_pnext_temp(dec);
229     vn_decode_VkRenderPassMultiviewCreateInfo_self_temp(dec, val);
230 }
231 
232 static inline void
vn_replace_VkRenderPassMultiviewCreateInfo_handle_self(VkRenderPassMultiviewCreateInfo * val)233 vn_replace_VkRenderPassMultiviewCreateInfo_handle_self(VkRenderPassMultiviewCreateInfo *val)
234 {
235     /* skip val->sType */
236     /* skip val->pNext */
237     /* skip val->subpassCount */
238     /* skip val->pViewMasks */
239     /* skip val->dependencyCount */
240     /* skip val->pViewOffsets */
241     /* skip val->correlationMaskCount */
242     /* skip val->pCorrelationMasks */
243 }
244 
245 static inline void
vn_replace_VkRenderPassMultiviewCreateInfo_handle(VkRenderPassMultiviewCreateInfo * val)246 vn_replace_VkRenderPassMultiviewCreateInfo_handle(VkRenderPassMultiviewCreateInfo *val)
247 {
248     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
249 
250     do {
251         switch ((int32_t)pnext->sType) {
252         case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO:
253             vn_replace_VkRenderPassMultiviewCreateInfo_handle_self((VkRenderPassMultiviewCreateInfo *)pnext);
254             break;
255         default:
256             /* ignore unknown/unsupported struct */
257             break;
258         }
259         pnext = pnext->pNext;
260     } while (pnext);
261 }
262 
263 /* struct VkInputAttachmentAspectReference */
264 
265 static inline void
vn_decode_VkInputAttachmentAspectReference_temp(struct vn_cs_decoder * dec,VkInputAttachmentAspectReference * val)266 vn_decode_VkInputAttachmentAspectReference_temp(struct vn_cs_decoder *dec, VkInputAttachmentAspectReference *val)
267 {
268     vn_decode_uint32_t(dec, &val->subpass);
269     vn_decode_uint32_t(dec, &val->inputAttachmentIndex);
270     vn_decode_VkFlags(dec, &val->aspectMask);
271 }
272 
273 static inline void
vn_replace_VkInputAttachmentAspectReference_handle(VkInputAttachmentAspectReference * val)274 vn_replace_VkInputAttachmentAspectReference_handle(VkInputAttachmentAspectReference *val)
275 {
276     /* skip val->subpass */
277     /* skip val->inputAttachmentIndex */
278     /* skip val->aspectMask */
279 }
280 
281 /* struct VkRenderPassInputAttachmentAspectCreateInfo chain */
282 
283 static inline void *
vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_pnext_temp(struct vn_cs_decoder * dec)284 vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
285 {
286     /* no known/supported struct */
287     if (vn_decode_simple_pointer(dec))
288         vn_cs_decoder_set_fatal(dec);
289     return NULL;
290 }
291 
292 static inline void
vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_self_temp(struct vn_cs_decoder * dec,VkRenderPassInputAttachmentAspectCreateInfo * val)293 vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_self_temp(struct vn_cs_decoder *dec, VkRenderPassInputAttachmentAspectCreateInfo *val)
294 {
295     /* skip val->{sType,pNext} */
296     vn_decode_uint32_t(dec, &val->aspectReferenceCount);
297     if (vn_peek_array_size(dec)) {
298         const uint32_t iter_count = vn_decode_array_size(dec, val->aspectReferenceCount);
299         val->pAspectReferences = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pAspectReferences) * iter_count);
300         if (!val->pAspectReferences) return;
301         for (uint32_t i = 0; i < iter_count; i++)
302             vn_decode_VkInputAttachmentAspectReference_temp(dec, &((VkInputAttachmentAspectReference *)val->pAspectReferences)[i]);
303     } else {
304         vn_decode_array_size(dec, val->aspectReferenceCount);
305         val->pAspectReferences = NULL;
306     }
307 }
308 
309 static inline void
vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_temp(struct vn_cs_decoder * dec,VkRenderPassInputAttachmentAspectCreateInfo * val)310 vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_temp(struct vn_cs_decoder *dec, VkRenderPassInputAttachmentAspectCreateInfo *val)
311 {
312     VkStructureType stype;
313     vn_decode_VkStructureType(dec, &stype);
314     if (stype != VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO)
315         vn_cs_decoder_set_fatal(dec);
316 
317     val->sType = stype;
318     val->pNext = vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_pnext_temp(dec);
319     vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_self_temp(dec, val);
320 }
321 
322 static inline void
vn_replace_VkRenderPassInputAttachmentAspectCreateInfo_handle_self(VkRenderPassInputAttachmentAspectCreateInfo * val)323 vn_replace_VkRenderPassInputAttachmentAspectCreateInfo_handle_self(VkRenderPassInputAttachmentAspectCreateInfo *val)
324 {
325     /* skip val->sType */
326     /* skip val->pNext */
327     /* skip val->aspectReferenceCount */
328     if (val->pAspectReferences) {
329        for (uint32_t i = 0; i < val->aspectReferenceCount; i++)
330             vn_replace_VkInputAttachmentAspectReference_handle(&((VkInputAttachmentAspectReference *)val->pAspectReferences)[i]);
331     }
332 }
333 
334 static inline void
vn_replace_VkRenderPassInputAttachmentAspectCreateInfo_handle(VkRenderPassInputAttachmentAspectCreateInfo * val)335 vn_replace_VkRenderPassInputAttachmentAspectCreateInfo_handle(VkRenderPassInputAttachmentAspectCreateInfo *val)
336 {
337     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
338 
339     do {
340         switch ((int32_t)pnext->sType) {
341         case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO:
342             vn_replace_VkRenderPassInputAttachmentAspectCreateInfo_handle_self((VkRenderPassInputAttachmentAspectCreateInfo *)pnext);
343             break;
344         default:
345             /* ignore unknown/unsupported struct */
346             break;
347         }
348         pnext = pnext->pNext;
349     } while (pnext);
350 }
351 
352 /* struct VkRenderPassCreateInfo chain */
353 
354 static inline void *
vn_decode_VkRenderPassCreateInfo_pnext_temp(struct vn_cs_decoder * dec)355 vn_decode_VkRenderPassCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
356 {
357     VkBaseOutStructure *pnext;
358     VkStructureType stype;
359 
360     if (!vn_decode_simple_pointer(dec))
361         return NULL;
362 
363     vn_decode_VkStructureType(dec, &stype);
364     switch ((int32_t)stype) {
365     case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO:
366         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkRenderPassMultiviewCreateInfo));
367         if (pnext) {
368             pnext->sType = stype;
369             pnext->pNext = vn_decode_VkRenderPassCreateInfo_pnext_temp(dec);
370             vn_decode_VkRenderPassMultiviewCreateInfo_self_temp(dec, (VkRenderPassMultiviewCreateInfo *)pnext);
371         }
372         break;
373     case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO:
374         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkRenderPassInputAttachmentAspectCreateInfo));
375         if (pnext) {
376             pnext->sType = stype;
377             pnext->pNext = vn_decode_VkRenderPassCreateInfo_pnext_temp(dec);
378             vn_decode_VkRenderPassInputAttachmentAspectCreateInfo_self_temp(dec, (VkRenderPassInputAttachmentAspectCreateInfo *)pnext);
379         }
380         break;
381     default:
382         /* unexpected struct */
383         pnext = NULL;
384         vn_cs_decoder_set_fatal(dec);
385         break;
386     }
387 
388     return pnext;
389 }
390 
391 static inline void
vn_decode_VkRenderPassCreateInfo_self_temp(struct vn_cs_decoder * dec,VkRenderPassCreateInfo * val)392 vn_decode_VkRenderPassCreateInfo_self_temp(struct vn_cs_decoder *dec, VkRenderPassCreateInfo *val)
393 {
394     /* skip val->{sType,pNext} */
395     vn_decode_VkFlags(dec, &val->flags);
396     vn_decode_uint32_t(dec, &val->attachmentCount);
397     if (vn_peek_array_size(dec)) {
398         const uint32_t iter_count = vn_decode_array_size(dec, val->attachmentCount);
399         val->pAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pAttachments) * iter_count);
400         if (!val->pAttachments) return;
401         for (uint32_t i = 0; i < iter_count; i++)
402             vn_decode_VkAttachmentDescription_temp(dec, &((VkAttachmentDescription *)val->pAttachments)[i]);
403     } else {
404         vn_decode_array_size(dec, val->attachmentCount);
405         val->pAttachments = NULL;
406     }
407     vn_decode_uint32_t(dec, &val->subpassCount);
408     if (vn_peek_array_size(dec)) {
409         const uint32_t iter_count = vn_decode_array_size(dec, val->subpassCount);
410         val->pSubpasses = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSubpasses) * iter_count);
411         if (!val->pSubpasses) return;
412         for (uint32_t i = 0; i < iter_count; i++)
413             vn_decode_VkSubpassDescription_temp(dec, &((VkSubpassDescription *)val->pSubpasses)[i]);
414     } else {
415         vn_decode_array_size(dec, val->subpassCount);
416         val->pSubpasses = NULL;
417     }
418     vn_decode_uint32_t(dec, &val->dependencyCount);
419     if (vn_peek_array_size(dec)) {
420         const uint32_t iter_count = vn_decode_array_size(dec, val->dependencyCount);
421         val->pDependencies = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pDependencies) * iter_count);
422         if (!val->pDependencies) return;
423         for (uint32_t i = 0; i < iter_count; i++)
424             vn_decode_VkSubpassDependency_temp(dec, &((VkSubpassDependency *)val->pDependencies)[i]);
425     } else {
426         vn_decode_array_size(dec, val->dependencyCount);
427         val->pDependencies = NULL;
428     }
429 }
430 
431 static inline void
vn_decode_VkRenderPassCreateInfo_temp(struct vn_cs_decoder * dec,VkRenderPassCreateInfo * val)432 vn_decode_VkRenderPassCreateInfo_temp(struct vn_cs_decoder *dec, VkRenderPassCreateInfo *val)
433 {
434     VkStructureType stype;
435     vn_decode_VkStructureType(dec, &stype);
436     if (stype != VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
437         vn_cs_decoder_set_fatal(dec);
438 
439     val->sType = stype;
440     val->pNext = vn_decode_VkRenderPassCreateInfo_pnext_temp(dec);
441     vn_decode_VkRenderPassCreateInfo_self_temp(dec, val);
442 }
443 
444 static inline void
vn_replace_VkRenderPassCreateInfo_handle_self(VkRenderPassCreateInfo * val)445 vn_replace_VkRenderPassCreateInfo_handle_self(VkRenderPassCreateInfo *val)
446 {
447     /* skip val->sType */
448     /* skip val->pNext */
449     /* skip val->flags */
450     /* skip val->attachmentCount */
451     if (val->pAttachments) {
452        for (uint32_t i = 0; i < val->attachmentCount; i++)
453             vn_replace_VkAttachmentDescription_handle(&((VkAttachmentDescription *)val->pAttachments)[i]);
454     }
455     /* skip val->subpassCount */
456     if (val->pSubpasses) {
457        for (uint32_t i = 0; i < val->subpassCount; i++)
458             vn_replace_VkSubpassDescription_handle(&((VkSubpassDescription *)val->pSubpasses)[i]);
459     }
460     /* skip val->dependencyCount */
461     if (val->pDependencies) {
462        for (uint32_t i = 0; i < val->dependencyCount; i++)
463             vn_replace_VkSubpassDependency_handle(&((VkSubpassDependency *)val->pDependencies)[i]);
464     }
465 }
466 
467 static inline void
vn_replace_VkRenderPassCreateInfo_handle(VkRenderPassCreateInfo * val)468 vn_replace_VkRenderPassCreateInfo_handle(VkRenderPassCreateInfo *val)
469 {
470     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
471 
472     do {
473         switch ((int32_t)pnext->sType) {
474         case VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO:
475             vn_replace_VkRenderPassCreateInfo_handle_self((VkRenderPassCreateInfo *)pnext);
476             break;
477         case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO:
478             vn_replace_VkRenderPassMultiviewCreateInfo_handle_self((VkRenderPassMultiviewCreateInfo *)pnext);
479             break;
480         case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO:
481             vn_replace_VkRenderPassInputAttachmentAspectCreateInfo_handle_self((VkRenderPassInputAttachmentAspectCreateInfo *)pnext);
482             break;
483         default:
484             /* ignore unknown/unsupported struct */
485             break;
486         }
487         pnext = pnext->pNext;
488     } while (pnext);
489 }
490 
491 /* struct VkAttachmentDescriptionStencilLayout chain */
492 
493 static inline void *
vn_decode_VkAttachmentDescriptionStencilLayout_pnext_temp(struct vn_cs_decoder * dec)494 vn_decode_VkAttachmentDescriptionStencilLayout_pnext_temp(struct vn_cs_decoder *dec)
495 {
496     /* no known/supported struct */
497     if (vn_decode_simple_pointer(dec))
498         vn_cs_decoder_set_fatal(dec);
499     return NULL;
500 }
501 
502 static inline void
vn_decode_VkAttachmentDescriptionStencilLayout_self_temp(struct vn_cs_decoder * dec,VkAttachmentDescriptionStencilLayout * val)503 vn_decode_VkAttachmentDescriptionStencilLayout_self_temp(struct vn_cs_decoder *dec, VkAttachmentDescriptionStencilLayout *val)
504 {
505     /* skip val->{sType,pNext} */
506     vn_decode_VkImageLayout(dec, &val->stencilInitialLayout);
507     vn_decode_VkImageLayout(dec, &val->stencilFinalLayout);
508 }
509 
510 static inline void
vn_decode_VkAttachmentDescriptionStencilLayout_temp(struct vn_cs_decoder * dec,VkAttachmentDescriptionStencilLayout * val)511 vn_decode_VkAttachmentDescriptionStencilLayout_temp(struct vn_cs_decoder *dec, VkAttachmentDescriptionStencilLayout *val)
512 {
513     VkStructureType stype;
514     vn_decode_VkStructureType(dec, &stype);
515     if (stype != VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT)
516         vn_cs_decoder_set_fatal(dec);
517 
518     val->sType = stype;
519     val->pNext = vn_decode_VkAttachmentDescriptionStencilLayout_pnext_temp(dec);
520     vn_decode_VkAttachmentDescriptionStencilLayout_self_temp(dec, val);
521 }
522 
523 static inline void
vn_replace_VkAttachmentDescriptionStencilLayout_handle_self(VkAttachmentDescriptionStencilLayout * val)524 vn_replace_VkAttachmentDescriptionStencilLayout_handle_self(VkAttachmentDescriptionStencilLayout *val)
525 {
526     /* skip val->sType */
527     /* skip val->pNext */
528     /* skip val->stencilInitialLayout */
529     /* skip val->stencilFinalLayout */
530 }
531 
532 static inline void
vn_replace_VkAttachmentDescriptionStencilLayout_handle(VkAttachmentDescriptionStencilLayout * val)533 vn_replace_VkAttachmentDescriptionStencilLayout_handle(VkAttachmentDescriptionStencilLayout *val)
534 {
535     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
536 
537     do {
538         switch ((int32_t)pnext->sType) {
539         case VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT:
540             vn_replace_VkAttachmentDescriptionStencilLayout_handle_self((VkAttachmentDescriptionStencilLayout *)pnext);
541             break;
542         default:
543             /* ignore unknown/unsupported struct */
544             break;
545         }
546         pnext = pnext->pNext;
547     } while (pnext);
548 }
549 
550 /* struct VkAttachmentDescription2 chain */
551 
552 static inline void *
vn_decode_VkAttachmentDescription2_pnext_temp(struct vn_cs_decoder * dec)553 vn_decode_VkAttachmentDescription2_pnext_temp(struct vn_cs_decoder *dec)
554 {
555     VkBaseOutStructure *pnext;
556     VkStructureType stype;
557 
558     if (!vn_decode_simple_pointer(dec))
559         return NULL;
560 
561     vn_decode_VkStructureType(dec, &stype);
562     switch ((int32_t)stype) {
563     case VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT:
564         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkAttachmentDescriptionStencilLayout));
565         if (pnext) {
566             pnext->sType = stype;
567             pnext->pNext = vn_decode_VkAttachmentDescription2_pnext_temp(dec);
568             vn_decode_VkAttachmentDescriptionStencilLayout_self_temp(dec, (VkAttachmentDescriptionStencilLayout *)pnext);
569         }
570         break;
571     default:
572         /* unexpected struct */
573         pnext = NULL;
574         vn_cs_decoder_set_fatal(dec);
575         break;
576     }
577 
578     return pnext;
579 }
580 
581 static inline void
vn_decode_VkAttachmentDescription2_self_temp(struct vn_cs_decoder * dec,VkAttachmentDescription2 * val)582 vn_decode_VkAttachmentDescription2_self_temp(struct vn_cs_decoder *dec, VkAttachmentDescription2 *val)
583 {
584     /* skip val->{sType,pNext} */
585     vn_decode_VkFlags(dec, &val->flags);
586     vn_decode_VkFormat(dec, &val->format);
587     vn_decode_VkSampleCountFlagBits(dec, &val->samples);
588     vn_decode_VkAttachmentLoadOp(dec, &val->loadOp);
589     vn_decode_VkAttachmentStoreOp(dec, &val->storeOp);
590     vn_decode_VkAttachmentLoadOp(dec, &val->stencilLoadOp);
591     vn_decode_VkAttachmentStoreOp(dec, &val->stencilStoreOp);
592     vn_decode_VkImageLayout(dec, &val->initialLayout);
593     vn_decode_VkImageLayout(dec, &val->finalLayout);
594 }
595 
596 static inline void
vn_decode_VkAttachmentDescription2_temp(struct vn_cs_decoder * dec,VkAttachmentDescription2 * val)597 vn_decode_VkAttachmentDescription2_temp(struct vn_cs_decoder *dec, VkAttachmentDescription2 *val)
598 {
599     VkStructureType stype;
600     vn_decode_VkStructureType(dec, &stype);
601     if (stype != VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2)
602         vn_cs_decoder_set_fatal(dec);
603 
604     val->sType = stype;
605     val->pNext = vn_decode_VkAttachmentDescription2_pnext_temp(dec);
606     vn_decode_VkAttachmentDescription2_self_temp(dec, val);
607 }
608 
609 static inline void
vn_replace_VkAttachmentDescription2_handle_self(VkAttachmentDescription2 * val)610 vn_replace_VkAttachmentDescription2_handle_self(VkAttachmentDescription2 *val)
611 {
612     /* skip val->sType */
613     /* skip val->pNext */
614     /* skip val->flags */
615     /* skip val->format */
616     /* skip val->samples */
617     /* skip val->loadOp */
618     /* skip val->storeOp */
619     /* skip val->stencilLoadOp */
620     /* skip val->stencilStoreOp */
621     /* skip val->initialLayout */
622     /* skip val->finalLayout */
623 }
624 
625 static inline void
vn_replace_VkAttachmentDescription2_handle(VkAttachmentDescription2 * val)626 vn_replace_VkAttachmentDescription2_handle(VkAttachmentDescription2 *val)
627 {
628     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
629 
630     do {
631         switch ((int32_t)pnext->sType) {
632         case VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2:
633             vn_replace_VkAttachmentDescription2_handle_self((VkAttachmentDescription2 *)pnext);
634             break;
635         case VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT:
636             vn_replace_VkAttachmentDescriptionStencilLayout_handle_self((VkAttachmentDescriptionStencilLayout *)pnext);
637             break;
638         default:
639             /* ignore unknown/unsupported struct */
640             break;
641         }
642         pnext = pnext->pNext;
643     } while (pnext);
644 }
645 
646 /* struct VkAttachmentReferenceStencilLayout chain */
647 
648 static inline void *
vn_decode_VkAttachmentReferenceStencilLayout_pnext_temp(struct vn_cs_decoder * dec)649 vn_decode_VkAttachmentReferenceStencilLayout_pnext_temp(struct vn_cs_decoder *dec)
650 {
651     /* no known/supported struct */
652     if (vn_decode_simple_pointer(dec))
653         vn_cs_decoder_set_fatal(dec);
654     return NULL;
655 }
656 
657 static inline void
vn_decode_VkAttachmentReferenceStencilLayout_self_temp(struct vn_cs_decoder * dec,VkAttachmentReferenceStencilLayout * val)658 vn_decode_VkAttachmentReferenceStencilLayout_self_temp(struct vn_cs_decoder *dec, VkAttachmentReferenceStencilLayout *val)
659 {
660     /* skip val->{sType,pNext} */
661     vn_decode_VkImageLayout(dec, &val->stencilLayout);
662 }
663 
664 static inline void
vn_decode_VkAttachmentReferenceStencilLayout_temp(struct vn_cs_decoder * dec,VkAttachmentReferenceStencilLayout * val)665 vn_decode_VkAttachmentReferenceStencilLayout_temp(struct vn_cs_decoder *dec, VkAttachmentReferenceStencilLayout *val)
666 {
667     VkStructureType stype;
668     vn_decode_VkStructureType(dec, &stype);
669     if (stype != VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT)
670         vn_cs_decoder_set_fatal(dec);
671 
672     val->sType = stype;
673     val->pNext = vn_decode_VkAttachmentReferenceStencilLayout_pnext_temp(dec);
674     vn_decode_VkAttachmentReferenceStencilLayout_self_temp(dec, val);
675 }
676 
677 static inline void
vn_replace_VkAttachmentReferenceStencilLayout_handle_self(VkAttachmentReferenceStencilLayout * val)678 vn_replace_VkAttachmentReferenceStencilLayout_handle_self(VkAttachmentReferenceStencilLayout *val)
679 {
680     /* skip val->sType */
681     /* skip val->pNext */
682     /* skip val->stencilLayout */
683 }
684 
685 static inline void
vn_replace_VkAttachmentReferenceStencilLayout_handle(VkAttachmentReferenceStencilLayout * val)686 vn_replace_VkAttachmentReferenceStencilLayout_handle(VkAttachmentReferenceStencilLayout *val)
687 {
688     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
689 
690     do {
691         switch ((int32_t)pnext->sType) {
692         case VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT:
693             vn_replace_VkAttachmentReferenceStencilLayout_handle_self((VkAttachmentReferenceStencilLayout *)pnext);
694             break;
695         default:
696             /* ignore unknown/unsupported struct */
697             break;
698         }
699         pnext = pnext->pNext;
700     } while (pnext);
701 }
702 
703 /* struct VkAttachmentReference2 chain */
704 
705 static inline void *
vn_decode_VkAttachmentReference2_pnext_temp(struct vn_cs_decoder * dec)706 vn_decode_VkAttachmentReference2_pnext_temp(struct vn_cs_decoder *dec)
707 {
708     VkBaseOutStructure *pnext;
709     VkStructureType stype;
710 
711     if (!vn_decode_simple_pointer(dec))
712         return NULL;
713 
714     vn_decode_VkStructureType(dec, &stype);
715     switch ((int32_t)stype) {
716     case VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT:
717         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkAttachmentReferenceStencilLayout));
718         if (pnext) {
719             pnext->sType = stype;
720             pnext->pNext = vn_decode_VkAttachmentReference2_pnext_temp(dec);
721             vn_decode_VkAttachmentReferenceStencilLayout_self_temp(dec, (VkAttachmentReferenceStencilLayout *)pnext);
722         }
723         break;
724     default:
725         /* unexpected struct */
726         pnext = NULL;
727         vn_cs_decoder_set_fatal(dec);
728         break;
729     }
730 
731     return pnext;
732 }
733 
734 static inline void
vn_decode_VkAttachmentReference2_self_temp(struct vn_cs_decoder * dec,VkAttachmentReference2 * val)735 vn_decode_VkAttachmentReference2_self_temp(struct vn_cs_decoder *dec, VkAttachmentReference2 *val)
736 {
737     /* skip val->{sType,pNext} */
738     vn_decode_uint32_t(dec, &val->attachment);
739     vn_decode_VkImageLayout(dec, &val->layout);
740     vn_decode_VkFlags(dec, &val->aspectMask);
741 }
742 
743 static inline void
vn_decode_VkAttachmentReference2_temp(struct vn_cs_decoder * dec,VkAttachmentReference2 * val)744 vn_decode_VkAttachmentReference2_temp(struct vn_cs_decoder *dec, VkAttachmentReference2 *val)
745 {
746     VkStructureType stype;
747     vn_decode_VkStructureType(dec, &stype);
748     if (stype != VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2)
749         vn_cs_decoder_set_fatal(dec);
750 
751     val->sType = stype;
752     val->pNext = vn_decode_VkAttachmentReference2_pnext_temp(dec);
753     vn_decode_VkAttachmentReference2_self_temp(dec, val);
754 }
755 
756 static inline void
vn_replace_VkAttachmentReference2_handle_self(VkAttachmentReference2 * val)757 vn_replace_VkAttachmentReference2_handle_self(VkAttachmentReference2 *val)
758 {
759     /* skip val->sType */
760     /* skip val->pNext */
761     /* skip val->attachment */
762     /* skip val->layout */
763     /* skip val->aspectMask */
764 }
765 
766 static inline void
vn_replace_VkAttachmentReference2_handle(VkAttachmentReference2 * val)767 vn_replace_VkAttachmentReference2_handle(VkAttachmentReference2 *val)
768 {
769     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
770 
771     do {
772         switch ((int32_t)pnext->sType) {
773         case VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2:
774             vn_replace_VkAttachmentReference2_handle_self((VkAttachmentReference2 *)pnext);
775             break;
776         case VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT:
777             vn_replace_VkAttachmentReferenceStencilLayout_handle_self((VkAttachmentReferenceStencilLayout *)pnext);
778             break;
779         default:
780             /* ignore unknown/unsupported struct */
781             break;
782         }
783         pnext = pnext->pNext;
784     } while (pnext);
785 }
786 
787 /* struct VkSubpassDescriptionDepthStencilResolve chain */
788 
789 static inline void *
vn_decode_VkSubpassDescriptionDepthStencilResolve_pnext_temp(struct vn_cs_decoder * dec)790 vn_decode_VkSubpassDescriptionDepthStencilResolve_pnext_temp(struct vn_cs_decoder *dec)
791 {
792     /* no known/supported struct */
793     if (vn_decode_simple_pointer(dec))
794         vn_cs_decoder_set_fatal(dec);
795     return NULL;
796 }
797 
798 static inline void
vn_decode_VkSubpassDescriptionDepthStencilResolve_self_temp(struct vn_cs_decoder * dec,VkSubpassDescriptionDepthStencilResolve * val)799 vn_decode_VkSubpassDescriptionDepthStencilResolve_self_temp(struct vn_cs_decoder *dec, VkSubpassDescriptionDepthStencilResolve *val)
800 {
801     /* skip val->{sType,pNext} */
802     vn_decode_VkResolveModeFlagBits(dec, &val->depthResolveMode);
803     vn_decode_VkResolveModeFlagBits(dec, &val->stencilResolveMode);
804     if (vn_decode_simple_pointer(dec)) {
805         val->pDepthStencilResolveAttachment = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pDepthStencilResolveAttachment));
806         if (!val->pDepthStencilResolveAttachment) return;
807         vn_decode_VkAttachmentReference2_temp(dec, (VkAttachmentReference2 *)val->pDepthStencilResolveAttachment);
808     } else {
809         val->pDepthStencilResolveAttachment = NULL;
810     }
811 }
812 
813 static inline void
vn_decode_VkSubpassDescriptionDepthStencilResolve_temp(struct vn_cs_decoder * dec,VkSubpassDescriptionDepthStencilResolve * val)814 vn_decode_VkSubpassDescriptionDepthStencilResolve_temp(struct vn_cs_decoder *dec, VkSubpassDescriptionDepthStencilResolve *val)
815 {
816     VkStructureType stype;
817     vn_decode_VkStructureType(dec, &stype);
818     if (stype != VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE)
819         vn_cs_decoder_set_fatal(dec);
820 
821     val->sType = stype;
822     val->pNext = vn_decode_VkSubpassDescriptionDepthStencilResolve_pnext_temp(dec);
823     vn_decode_VkSubpassDescriptionDepthStencilResolve_self_temp(dec, val);
824 }
825 
826 static inline void
vn_replace_VkSubpassDescriptionDepthStencilResolve_handle_self(VkSubpassDescriptionDepthStencilResolve * val)827 vn_replace_VkSubpassDescriptionDepthStencilResolve_handle_self(VkSubpassDescriptionDepthStencilResolve *val)
828 {
829     /* skip val->sType */
830     /* skip val->pNext */
831     /* skip val->depthResolveMode */
832     /* skip val->stencilResolveMode */
833     if (val->pDepthStencilResolveAttachment)
834         vn_replace_VkAttachmentReference2_handle((VkAttachmentReference2 *)val->pDepthStencilResolveAttachment);
835 }
836 
837 static inline void
vn_replace_VkSubpassDescriptionDepthStencilResolve_handle(VkSubpassDescriptionDepthStencilResolve * val)838 vn_replace_VkSubpassDescriptionDepthStencilResolve_handle(VkSubpassDescriptionDepthStencilResolve *val)
839 {
840     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
841 
842     do {
843         switch ((int32_t)pnext->sType) {
844         case VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE:
845             vn_replace_VkSubpassDescriptionDepthStencilResolve_handle_self((VkSubpassDescriptionDepthStencilResolve *)pnext);
846             break;
847         default:
848             /* ignore unknown/unsupported struct */
849             break;
850         }
851         pnext = pnext->pNext;
852     } while (pnext);
853 }
854 
855 /* struct VkSubpassDescription2 chain */
856 
857 static inline void *
vn_decode_VkSubpassDescription2_pnext_temp(struct vn_cs_decoder * dec)858 vn_decode_VkSubpassDescription2_pnext_temp(struct vn_cs_decoder *dec)
859 {
860     VkBaseOutStructure *pnext;
861     VkStructureType stype;
862 
863     if (!vn_decode_simple_pointer(dec))
864         return NULL;
865 
866     vn_decode_VkStructureType(dec, &stype);
867     switch ((int32_t)stype) {
868     case VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE:
869         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkSubpassDescriptionDepthStencilResolve));
870         if (pnext) {
871             pnext->sType = stype;
872             pnext->pNext = vn_decode_VkSubpassDescription2_pnext_temp(dec);
873             vn_decode_VkSubpassDescriptionDepthStencilResolve_self_temp(dec, (VkSubpassDescriptionDepthStencilResolve *)pnext);
874         }
875         break;
876     default:
877         /* unexpected struct */
878         pnext = NULL;
879         vn_cs_decoder_set_fatal(dec);
880         break;
881     }
882 
883     return pnext;
884 }
885 
886 static inline void
vn_decode_VkSubpassDescription2_self_temp(struct vn_cs_decoder * dec,VkSubpassDescription2 * val)887 vn_decode_VkSubpassDescription2_self_temp(struct vn_cs_decoder *dec, VkSubpassDescription2 *val)
888 {
889     /* skip val->{sType,pNext} */
890     vn_decode_VkFlags(dec, &val->flags);
891     vn_decode_VkPipelineBindPoint(dec, &val->pipelineBindPoint);
892     vn_decode_uint32_t(dec, &val->viewMask);
893     vn_decode_uint32_t(dec, &val->inputAttachmentCount);
894     if (vn_peek_array_size(dec)) {
895         const uint32_t iter_count = vn_decode_array_size(dec, val->inputAttachmentCount);
896         val->pInputAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pInputAttachments) * iter_count);
897         if (!val->pInputAttachments) return;
898         for (uint32_t i = 0; i < iter_count; i++)
899             vn_decode_VkAttachmentReference2_temp(dec, &((VkAttachmentReference2 *)val->pInputAttachments)[i]);
900     } else {
901         vn_decode_array_size(dec, val->inputAttachmentCount);
902         val->pInputAttachments = NULL;
903     }
904     vn_decode_uint32_t(dec, &val->colorAttachmentCount);
905     if (vn_peek_array_size(dec)) {
906         const uint32_t iter_count = vn_decode_array_size(dec, val->colorAttachmentCount);
907         val->pColorAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pColorAttachments) * iter_count);
908         if (!val->pColorAttachments) return;
909         for (uint32_t i = 0; i < iter_count; i++)
910             vn_decode_VkAttachmentReference2_temp(dec, &((VkAttachmentReference2 *)val->pColorAttachments)[i]);
911     } else {
912         vn_decode_array_size(dec, val->colorAttachmentCount);
913         val->pColorAttachments = NULL;
914     }
915     if (vn_peek_array_size(dec)) {
916         const uint32_t iter_count = vn_decode_array_size(dec, val->colorAttachmentCount);
917         val->pResolveAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pResolveAttachments) * iter_count);
918         if (!val->pResolveAttachments) return;
919         for (uint32_t i = 0; i < iter_count; i++)
920             vn_decode_VkAttachmentReference2_temp(dec, &((VkAttachmentReference2 *)val->pResolveAttachments)[i]);
921     } else {
922         vn_decode_array_size_unchecked(dec);
923         val->pResolveAttachments = NULL;
924     }
925     if (vn_decode_simple_pointer(dec)) {
926         val->pDepthStencilAttachment = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pDepthStencilAttachment));
927         if (!val->pDepthStencilAttachment) return;
928         vn_decode_VkAttachmentReference2_temp(dec, (VkAttachmentReference2 *)val->pDepthStencilAttachment);
929     } else {
930         val->pDepthStencilAttachment = NULL;
931     }
932     vn_decode_uint32_t(dec, &val->preserveAttachmentCount);
933     if (vn_peek_array_size(dec)) {
934         const size_t array_size = vn_decode_array_size(dec, val->preserveAttachmentCount);
935         val->pPreserveAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pPreserveAttachments) * array_size);
936         if (!val->pPreserveAttachments) return;
937         vn_decode_uint32_t_array(dec, (uint32_t *)val->pPreserveAttachments, array_size);
938     } else {
939         vn_decode_array_size(dec, val->preserveAttachmentCount);
940         val->pPreserveAttachments = NULL;
941     }
942 }
943 
944 static inline void
vn_decode_VkSubpassDescription2_temp(struct vn_cs_decoder * dec,VkSubpassDescription2 * val)945 vn_decode_VkSubpassDescription2_temp(struct vn_cs_decoder *dec, VkSubpassDescription2 *val)
946 {
947     VkStructureType stype;
948     vn_decode_VkStructureType(dec, &stype);
949     if (stype != VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2)
950         vn_cs_decoder_set_fatal(dec);
951 
952     val->sType = stype;
953     val->pNext = vn_decode_VkSubpassDescription2_pnext_temp(dec);
954     vn_decode_VkSubpassDescription2_self_temp(dec, val);
955 }
956 
957 static inline void
vn_replace_VkSubpassDescription2_handle_self(VkSubpassDescription2 * val)958 vn_replace_VkSubpassDescription2_handle_self(VkSubpassDescription2 *val)
959 {
960     /* skip val->sType */
961     /* skip val->pNext */
962     /* skip val->flags */
963     /* skip val->pipelineBindPoint */
964     /* skip val->viewMask */
965     /* skip val->inputAttachmentCount */
966     if (val->pInputAttachments) {
967        for (uint32_t i = 0; i < val->inputAttachmentCount; i++)
968             vn_replace_VkAttachmentReference2_handle(&((VkAttachmentReference2 *)val->pInputAttachments)[i]);
969     }
970     /* skip val->colorAttachmentCount */
971     if (val->pColorAttachments) {
972        for (uint32_t i = 0; i < val->colorAttachmentCount; i++)
973             vn_replace_VkAttachmentReference2_handle(&((VkAttachmentReference2 *)val->pColorAttachments)[i]);
974     }
975     if (val->pResolveAttachments) {
976        for (uint32_t i = 0; i < val->colorAttachmentCount; i++)
977             vn_replace_VkAttachmentReference2_handle(&((VkAttachmentReference2 *)val->pResolveAttachments)[i]);
978     }
979     if (val->pDepthStencilAttachment)
980         vn_replace_VkAttachmentReference2_handle((VkAttachmentReference2 *)val->pDepthStencilAttachment);
981     /* skip val->preserveAttachmentCount */
982     /* skip val->pPreserveAttachments */
983 }
984 
985 static inline void
vn_replace_VkSubpassDescription2_handle(VkSubpassDescription2 * val)986 vn_replace_VkSubpassDescription2_handle(VkSubpassDescription2 *val)
987 {
988     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
989 
990     do {
991         switch ((int32_t)pnext->sType) {
992         case VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2:
993             vn_replace_VkSubpassDescription2_handle_self((VkSubpassDescription2 *)pnext);
994             break;
995         case VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE:
996             vn_replace_VkSubpassDescriptionDepthStencilResolve_handle_self((VkSubpassDescriptionDepthStencilResolve *)pnext);
997             break;
998         default:
999             /* ignore unknown/unsupported struct */
1000             break;
1001         }
1002         pnext = pnext->pNext;
1003     } while (pnext);
1004 }
1005 
1006 /* struct VkSubpassDependency2 chain */
1007 
1008 static inline void *
vn_decode_VkSubpassDependency2_pnext_temp(struct vn_cs_decoder * dec)1009 vn_decode_VkSubpassDependency2_pnext_temp(struct vn_cs_decoder *dec)
1010 {
1011     VkBaseOutStructure *pnext;
1012     VkStructureType stype;
1013 
1014     if (!vn_decode_simple_pointer(dec))
1015         return NULL;
1016 
1017     vn_decode_VkStructureType(dec, &stype);
1018     switch ((int32_t)stype) {
1019     case VK_STRUCTURE_TYPE_MEMORY_BARRIER_2:
1020         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMemoryBarrier2));
1021         if (pnext) {
1022             pnext->sType = stype;
1023             pnext->pNext = vn_decode_VkSubpassDependency2_pnext_temp(dec);
1024             vn_decode_VkMemoryBarrier2_self_temp(dec, (VkMemoryBarrier2 *)pnext);
1025         }
1026         break;
1027     default:
1028         /* unexpected struct */
1029         pnext = NULL;
1030         vn_cs_decoder_set_fatal(dec);
1031         break;
1032     }
1033 
1034     return pnext;
1035 }
1036 
1037 static inline void
vn_decode_VkSubpassDependency2_self_temp(struct vn_cs_decoder * dec,VkSubpassDependency2 * val)1038 vn_decode_VkSubpassDependency2_self_temp(struct vn_cs_decoder *dec, VkSubpassDependency2 *val)
1039 {
1040     /* skip val->{sType,pNext} */
1041     vn_decode_uint32_t(dec, &val->srcSubpass);
1042     vn_decode_uint32_t(dec, &val->dstSubpass);
1043     vn_decode_VkFlags(dec, &val->srcStageMask);
1044     vn_decode_VkFlags(dec, &val->dstStageMask);
1045     vn_decode_VkFlags(dec, &val->srcAccessMask);
1046     vn_decode_VkFlags(dec, &val->dstAccessMask);
1047     vn_decode_VkFlags(dec, &val->dependencyFlags);
1048     vn_decode_int32_t(dec, &val->viewOffset);
1049 }
1050 
1051 static inline void
vn_decode_VkSubpassDependency2_temp(struct vn_cs_decoder * dec,VkSubpassDependency2 * val)1052 vn_decode_VkSubpassDependency2_temp(struct vn_cs_decoder *dec, VkSubpassDependency2 *val)
1053 {
1054     VkStructureType stype;
1055     vn_decode_VkStructureType(dec, &stype);
1056     if (stype != VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2)
1057         vn_cs_decoder_set_fatal(dec);
1058 
1059     val->sType = stype;
1060     val->pNext = vn_decode_VkSubpassDependency2_pnext_temp(dec);
1061     vn_decode_VkSubpassDependency2_self_temp(dec, val);
1062 }
1063 
1064 static inline void
vn_replace_VkSubpassDependency2_handle_self(VkSubpassDependency2 * val)1065 vn_replace_VkSubpassDependency2_handle_self(VkSubpassDependency2 *val)
1066 {
1067     /* skip val->sType */
1068     /* skip val->pNext */
1069     /* skip val->srcSubpass */
1070     /* skip val->dstSubpass */
1071     /* skip val->srcStageMask */
1072     /* skip val->dstStageMask */
1073     /* skip val->srcAccessMask */
1074     /* skip val->dstAccessMask */
1075     /* skip val->dependencyFlags */
1076     /* skip val->viewOffset */
1077 }
1078 
1079 static inline void
vn_replace_VkSubpassDependency2_handle(VkSubpassDependency2 * val)1080 vn_replace_VkSubpassDependency2_handle(VkSubpassDependency2 *val)
1081 {
1082     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
1083 
1084     do {
1085         switch ((int32_t)pnext->sType) {
1086         case VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2:
1087             vn_replace_VkSubpassDependency2_handle_self((VkSubpassDependency2 *)pnext);
1088             break;
1089         case VK_STRUCTURE_TYPE_MEMORY_BARRIER_2:
1090             vn_replace_VkMemoryBarrier2_handle_self((VkMemoryBarrier2 *)pnext);
1091             break;
1092         default:
1093             /* ignore unknown/unsupported struct */
1094             break;
1095         }
1096         pnext = pnext->pNext;
1097     } while (pnext);
1098 }
1099 
1100 /* struct VkRenderPassCreateInfo2 chain */
1101 
1102 static inline void *
vn_decode_VkRenderPassCreateInfo2_pnext_temp(struct vn_cs_decoder * dec)1103 vn_decode_VkRenderPassCreateInfo2_pnext_temp(struct vn_cs_decoder *dec)
1104 {
1105     /* no known/supported struct */
1106     if (vn_decode_simple_pointer(dec))
1107         vn_cs_decoder_set_fatal(dec);
1108     return NULL;
1109 }
1110 
1111 static inline void
vn_decode_VkRenderPassCreateInfo2_self_temp(struct vn_cs_decoder * dec,VkRenderPassCreateInfo2 * val)1112 vn_decode_VkRenderPassCreateInfo2_self_temp(struct vn_cs_decoder *dec, VkRenderPassCreateInfo2 *val)
1113 {
1114     /* skip val->{sType,pNext} */
1115     vn_decode_VkFlags(dec, &val->flags);
1116     vn_decode_uint32_t(dec, &val->attachmentCount);
1117     if (vn_peek_array_size(dec)) {
1118         const uint32_t iter_count = vn_decode_array_size(dec, val->attachmentCount);
1119         val->pAttachments = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pAttachments) * iter_count);
1120         if (!val->pAttachments) return;
1121         for (uint32_t i = 0; i < iter_count; i++)
1122             vn_decode_VkAttachmentDescription2_temp(dec, &((VkAttachmentDescription2 *)val->pAttachments)[i]);
1123     } else {
1124         vn_decode_array_size(dec, val->attachmentCount);
1125         val->pAttachments = NULL;
1126     }
1127     vn_decode_uint32_t(dec, &val->subpassCount);
1128     if (vn_peek_array_size(dec)) {
1129         const uint32_t iter_count = vn_decode_array_size(dec, val->subpassCount);
1130         val->pSubpasses = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSubpasses) * iter_count);
1131         if (!val->pSubpasses) return;
1132         for (uint32_t i = 0; i < iter_count; i++)
1133             vn_decode_VkSubpassDescription2_temp(dec, &((VkSubpassDescription2 *)val->pSubpasses)[i]);
1134     } else {
1135         vn_decode_array_size(dec, val->subpassCount);
1136         val->pSubpasses = NULL;
1137     }
1138     vn_decode_uint32_t(dec, &val->dependencyCount);
1139     if (vn_peek_array_size(dec)) {
1140         const uint32_t iter_count = vn_decode_array_size(dec, val->dependencyCount);
1141         val->pDependencies = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pDependencies) * iter_count);
1142         if (!val->pDependencies) return;
1143         for (uint32_t i = 0; i < iter_count; i++)
1144             vn_decode_VkSubpassDependency2_temp(dec, &((VkSubpassDependency2 *)val->pDependencies)[i]);
1145     } else {
1146         vn_decode_array_size(dec, val->dependencyCount);
1147         val->pDependencies = NULL;
1148     }
1149     vn_decode_uint32_t(dec, &val->correlatedViewMaskCount);
1150     if (vn_peek_array_size(dec)) {
1151         const size_t array_size = vn_decode_array_size(dec, val->correlatedViewMaskCount);
1152         val->pCorrelatedViewMasks = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pCorrelatedViewMasks) * array_size);
1153         if (!val->pCorrelatedViewMasks) return;
1154         vn_decode_uint32_t_array(dec, (uint32_t *)val->pCorrelatedViewMasks, array_size);
1155     } else {
1156         vn_decode_array_size(dec, val->correlatedViewMaskCount);
1157         val->pCorrelatedViewMasks = NULL;
1158     }
1159 }
1160 
1161 static inline void
vn_decode_VkRenderPassCreateInfo2_temp(struct vn_cs_decoder * dec,VkRenderPassCreateInfo2 * val)1162 vn_decode_VkRenderPassCreateInfo2_temp(struct vn_cs_decoder *dec, VkRenderPassCreateInfo2 *val)
1163 {
1164     VkStructureType stype;
1165     vn_decode_VkStructureType(dec, &stype);
1166     if (stype != VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2)
1167         vn_cs_decoder_set_fatal(dec);
1168 
1169     val->sType = stype;
1170     val->pNext = vn_decode_VkRenderPassCreateInfo2_pnext_temp(dec);
1171     vn_decode_VkRenderPassCreateInfo2_self_temp(dec, val);
1172 }
1173 
1174 static inline void
vn_replace_VkRenderPassCreateInfo2_handle_self(VkRenderPassCreateInfo2 * val)1175 vn_replace_VkRenderPassCreateInfo2_handle_self(VkRenderPassCreateInfo2 *val)
1176 {
1177     /* skip val->sType */
1178     /* skip val->pNext */
1179     /* skip val->flags */
1180     /* skip val->attachmentCount */
1181     if (val->pAttachments) {
1182        for (uint32_t i = 0; i < val->attachmentCount; i++)
1183             vn_replace_VkAttachmentDescription2_handle(&((VkAttachmentDescription2 *)val->pAttachments)[i]);
1184     }
1185     /* skip val->subpassCount */
1186     if (val->pSubpasses) {
1187        for (uint32_t i = 0; i < val->subpassCount; i++)
1188             vn_replace_VkSubpassDescription2_handle(&((VkSubpassDescription2 *)val->pSubpasses)[i]);
1189     }
1190     /* skip val->dependencyCount */
1191     if (val->pDependencies) {
1192        for (uint32_t i = 0; i < val->dependencyCount; i++)
1193             vn_replace_VkSubpassDependency2_handle(&((VkSubpassDependency2 *)val->pDependencies)[i]);
1194     }
1195     /* skip val->correlatedViewMaskCount */
1196     /* skip val->pCorrelatedViewMasks */
1197 }
1198 
1199 static inline void
vn_replace_VkRenderPassCreateInfo2_handle(VkRenderPassCreateInfo2 * val)1200 vn_replace_VkRenderPassCreateInfo2_handle(VkRenderPassCreateInfo2 *val)
1201 {
1202     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
1203 
1204     do {
1205         switch ((int32_t)pnext->sType) {
1206         case VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2:
1207             vn_replace_VkRenderPassCreateInfo2_handle_self((VkRenderPassCreateInfo2 *)pnext);
1208             break;
1209         default:
1210             /* ignore unknown/unsupported struct */
1211             break;
1212         }
1213         pnext = pnext->pNext;
1214     } while (pnext);
1215 }
1216 
vn_decode_vkCreateRenderPass_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateRenderPass * args)1217 static inline void vn_decode_vkCreateRenderPass_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateRenderPass *args)
1218 {
1219     vn_decode_VkDevice_lookup(dec, &args->device);
1220     if (vn_decode_simple_pointer(dec)) {
1221         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
1222         if (!args->pCreateInfo) return;
1223         vn_decode_VkRenderPassCreateInfo_temp(dec, (VkRenderPassCreateInfo *)args->pCreateInfo);
1224     } else {
1225         args->pCreateInfo = NULL;
1226         vn_cs_decoder_set_fatal(dec);
1227     }
1228     if (vn_decode_simple_pointer(dec)) {
1229         vn_cs_decoder_set_fatal(dec);
1230     } else {
1231         args->pAllocator = NULL;
1232     }
1233     if (vn_decode_simple_pointer(dec)) {
1234         args->pRenderPass = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pRenderPass));
1235         if (!args->pRenderPass) return;
1236         vn_decode_VkRenderPass(dec, args->pRenderPass);
1237     } else {
1238         args->pRenderPass = NULL;
1239         vn_cs_decoder_set_fatal(dec);
1240     }
1241 }
1242 
vn_replace_vkCreateRenderPass_args_handle(struct vn_command_vkCreateRenderPass * args)1243 static inline void vn_replace_vkCreateRenderPass_args_handle(struct vn_command_vkCreateRenderPass *args)
1244 {
1245     vn_replace_VkDevice_handle(&args->device);
1246     if (args->pCreateInfo)
1247         vn_replace_VkRenderPassCreateInfo_handle((VkRenderPassCreateInfo *)args->pCreateInfo);
1248     /* skip args->pAllocator */
1249     /* skip args->pRenderPass */
1250 }
1251 
vn_encode_vkCreateRenderPass_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateRenderPass * args)1252 static inline void vn_encode_vkCreateRenderPass_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateRenderPass *args)
1253 {
1254     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateRenderPass_EXT});
1255 
1256     vn_encode_VkResult(enc, &args->ret);
1257     /* skip args->device */
1258     /* skip args->pCreateInfo */
1259     /* skip args->pAllocator */
1260     if (vn_encode_simple_pointer(enc, args->pRenderPass))
1261         vn_encode_VkRenderPass(enc, args->pRenderPass);
1262 }
1263 
vn_decode_vkDestroyRenderPass_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroyRenderPass * args)1264 static inline void vn_decode_vkDestroyRenderPass_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroyRenderPass *args)
1265 {
1266     vn_decode_VkDevice_lookup(dec, &args->device);
1267     vn_decode_VkRenderPass_lookup(dec, &args->renderPass);
1268     if (vn_decode_simple_pointer(dec)) {
1269         vn_cs_decoder_set_fatal(dec);
1270     } else {
1271         args->pAllocator = NULL;
1272     }
1273 }
1274 
vn_replace_vkDestroyRenderPass_args_handle(struct vn_command_vkDestroyRenderPass * args)1275 static inline void vn_replace_vkDestroyRenderPass_args_handle(struct vn_command_vkDestroyRenderPass *args)
1276 {
1277     vn_replace_VkDevice_handle(&args->device);
1278     vn_replace_VkRenderPass_handle(&args->renderPass);
1279     /* skip args->pAllocator */
1280 }
1281 
vn_encode_vkDestroyRenderPass_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroyRenderPass * args)1282 static inline void vn_encode_vkDestroyRenderPass_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroyRenderPass *args)
1283 {
1284     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroyRenderPass_EXT});
1285 
1286     /* skip args->device */
1287     /* skip args->renderPass */
1288     /* skip args->pAllocator */
1289 }
1290 
vn_decode_vkGetRenderAreaGranularity_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetRenderAreaGranularity * args)1291 static inline void vn_decode_vkGetRenderAreaGranularity_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetRenderAreaGranularity *args)
1292 {
1293     vn_decode_VkDevice_lookup(dec, &args->device);
1294     vn_decode_VkRenderPass_lookup(dec, &args->renderPass);
1295     if (vn_decode_simple_pointer(dec)) {
1296         args->pGranularity = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pGranularity));
1297         if (!args->pGranularity) return;
1298         vn_decode_VkExtent2D_partial_temp(dec, args->pGranularity);
1299     } else {
1300         args->pGranularity = NULL;
1301         vn_cs_decoder_set_fatal(dec);
1302     }
1303 }
1304 
vn_replace_vkGetRenderAreaGranularity_args_handle(struct vn_command_vkGetRenderAreaGranularity * args)1305 static inline void vn_replace_vkGetRenderAreaGranularity_args_handle(struct vn_command_vkGetRenderAreaGranularity *args)
1306 {
1307     vn_replace_VkDevice_handle(&args->device);
1308     vn_replace_VkRenderPass_handle(&args->renderPass);
1309     /* skip args->pGranularity */
1310 }
1311 
vn_encode_vkGetRenderAreaGranularity_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetRenderAreaGranularity * args)1312 static inline void vn_encode_vkGetRenderAreaGranularity_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetRenderAreaGranularity *args)
1313 {
1314     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetRenderAreaGranularity_EXT});
1315 
1316     /* skip args->device */
1317     /* skip args->renderPass */
1318     if (vn_encode_simple_pointer(enc, args->pGranularity))
1319         vn_encode_VkExtent2D(enc, args->pGranularity);
1320 }
1321 
vn_decode_vkCreateRenderPass2_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateRenderPass2 * args)1322 static inline void vn_decode_vkCreateRenderPass2_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateRenderPass2 *args)
1323 {
1324     vn_decode_VkDevice_lookup(dec, &args->device);
1325     if (vn_decode_simple_pointer(dec)) {
1326         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
1327         if (!args->pCreateInfo) return;
1328         vn_decode_VkRenderPassCreateInfo2_temp(dec, (VkRenderPassCreateInfo2 *)args->pCreateInfo);
1329     } else {
1330         args->pCreateInfo = NULL;
1331         vn_cs_decoder_set_fatal(dec);
1332     }
1333     if (vn_decode_simple_pointer(dec)) {
1334         vn_cs_decoder_set_fatal(dec);
1335     } else {
1336         args->pAllocator = NULL;
1337     }
1338     if (vn_decode_simple_pointer(dec)) {
1339         args->pRenderPass = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pRenderPass));
1340         if (!args->pRenderPass) return;
1341         vn_decode_VkRenderPass(dec, args->pRenderPass);
1342     } else {
1343         args->pRenderPass = NULL;
1344         vn_cs_decoder_set_fatal(dec);
1345     }
1346 }
1347 
vn_replace_vkCreateRenderPass2_args_handle(struct vn_command_vkCreateRenderPass2 * args)1348 static inline void vn_replace_vkCreateRenderPass2_args_handle(struct vn_command_vkCreateRenderPass2 *args)
1349 {
1350     vn_replace_VkDevice_handle(&args->device);
1351     if (args->pCreateInfo)
1352         vn_replace_VkRenderPassCreateInfo2_handle((VkRenderPassCreateInfo2 *)args->pCreateInfo);
1353     /* skip args->pAllocator */
1354     /* skip args->pRenderPass */
1355 }
1356 
vn_encode_vkCreateRenderPass2_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateRenderPass2 * args)1357 static inline void vn_encode_vkCreateRenderPass2_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateRenderPass2 *args)
1358 {
1359     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateRenderPass2_EXT});
1360 
1361     vn_encode_VkResult(enc, &args->ret);
1362     /* skip args->device */
1363     /* skip args->pCreateInfo */
1364     /* skip args->pAllocator */
1365     if (vn_encode_simple_pointer(enc, args->pRenderPass))
1366         vn_encode_VkRenderPass(enc, args->pRenderPass);
1367 }
1368 
vn_dispatch_vkCreateRenderPass(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1369 static inline void vn_dispatch_vkCreateRenderPass(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1370 {
1371     struct vn_command_vkCreateRenderPass args;
1372 
1373     if (!ctx->dispatch_vkCreateRenderPass) {
1374         vn_cs_decoder_set_fatal(ctx->decoder);
1375         return;
1376     }
1377 
1378     vn_decode_vkCreateRenderPass_args_temp(ctx->decoder, &args);
1379     if (!args.device) {
1380         vn_cs_decoder_set_fatal(ctx->decoder);
1381         return;
1382     }
1383 
1384     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1385         ctx->dispatch_vkCreateRenderPass(ctx, &args);
1386 
1387 #ifdef DEBUG
1388     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
1389         vn_dispatch_debug_log(ctx, "vkCreateRenderPass returned %d", args.ret);
1390 #endif
1391 
1392     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1393        vn_encode_vkCreateRenderPass_reply(ctx->encoder, &args);
1394 
1395     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1396 }
1397 
vn_dispatch_vkDestroyRenderPass(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1398 static inline void vn_dispatch_vkDestroyRenderPass(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1399 {
1400     struct vn_command_vkDestroyRenderPass args;
1401 
1402     if (!ctx->dispatch_vkDestroyRenderPass) {
1403         vn_cs_decoder_set_fatal(ctx->decoder);
1404         return;
1405     }
1406 
1407     vn_decode_vkDestroyRenderPass_args_temp(ctx->decoder, &args);
1408     if (!args.device) {
1409         vn_cs_decoder_set_fatal(ctx->decoder);
1410         return;
1411     }
1412 
1413     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1414         ctx->dispatch_vkDestroyRenderPass(ctx, &args);
1415 
1416 
1417     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1418        vn_encode_vkDestroyRenderPass_reply(ctx->encoder, &args);
1419 
1420     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1421 }
1422 
vn_dispatch_vkGetRenderAreaGranularity(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1423 static inline void vn_dispatch_vkGetRenderAreaGranularity(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1424 {
1425     struct vn_command_vkGetRenderAreaGranularity args;
1426 
1427     if (!ctx->dispatch_vkGetRenderAreaGranularity) {
1428         vn_cs_decoder_set_fatal(ctx->decoder);
1429         return;
1430     }
1431 
1432     vn_decode_vkGetRenderAreaGranularity_args_temp(ctx->decoder, &args);
1433     if (!args.device) {
1434         vn_cs_decoder_set_fatal(ctx->decoder);
1435         return;
1436     }
1437 
1438     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1439         ctx->dispatch_vkGetRenderAreaGranularity(ctx, &args);
1440 
1441 
1442     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1443        vn_encode_vkGetRenderAreaGranularity_reply(ctx->encoder, &args);
1444 
1445     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1446 }
1447 
vn_dispatch_vkCreateRenderPass2(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)1448 static inline void vn_dispatch_vkCreateRenderPass2(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
1449 {
1450     struct vn_command_vkCreateRenderPass2 args;
1451 
1452     if (!ctx->dispatch_vkCreateRenderPass2) {
1453         vn_cs_decoder_set_fatal(ctx->decoder);
1454         return;
1455     }
1456 
1457     vn_decode_vkCreateRenderPass2_args_temp(ctx->decoder, &args);
1458     if (!args.device) {
1459         vn_cs_decoder_set_fatal(ctx->decoder);
1460         return;
1461     }
1462 
1463     if (!vn_cs_decoder_get_fatal(ctx->decoder))
1464         ctx->dispatch_vkCreateRenderPass2(ctx, &args);
1465 
1466 #ifdef DEBUG
1467     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
1468         vn_dispatch_debug_log(ctx, "vkCreateRenderPass2 returned %d", args.ret);
1469 #endif
1470 
1471     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
1472        vn_encode_vkCreateRenderPass2_reply(ctx->encoder, &args);
1473 
1474     vn_cs_decoder_reset_temp_pool(ctx->decoder);
1475 }
1476 
1477 #pragma GCC diagnostic pop
1478 
1479 #endif /* VN_PROTOCOL_RENDERER_RENDER_PASS_H */
1480