• 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_QUEUE_H
9 #define VN_PROTOCOL_RENDERER_QUEUE_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 VkDeviceGroupSubmitInfo chain */
18 
19 static inline void *
vn_decode_VkDeviceGroupSubmitInfo_pnext_temp(struct vn_cs_decoder * dec)20 vn_decode_VkDeviceGroupSubmitInfo_pnext_temp(struct vn_cs_decoder *dec)
21 {
22     /* no known/supported struct */
23     if (vn_decode_simple_pointer(dec))
24         vn_cs_decoder_set_fatal(dec);
25     return NULL;
26 }
27 
28 static inline void
vn_decode_VkDeviceGroupSubmitInfo_self_temp(struct vn_cs_decoder * dec,VkDeviceGroupSubmitInfo * val)29 vn_decode_VkDeviceGroupSubmitInfo_self_temp(struct vn_cs_decoder *dec, VkDeviceGroupSubmitInfo *val)
30 {
31     /* skip val->{sType,pNext} */
32     vn_decode_uint32_t(dec, &val->waitSemaphoreCount);
33     if (vn_peek_array_size(dec)) {
34         const size_t array_size = vn_decode_array_size(dec, val->waitSemaphoreCount);
35         val->pWaitSemaphoreDeviceIndices = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pWaitSemaphoreDeviceIndices) * array_size);
36         if (!val->pWaitSemaphoreDeviceIndices) return;
37         vn_decode_uint32_t_array(dec, (uint32_t *)val->pWaitSemaphoreDeviceIndices, array_size);
38     } else {
39         vn_decode_array_size(dec, val->waitSemaphoreCount);
40         val->pWaitSemaphoreDeviceIndices = NULL;
41     }
42     vn_decode_uint32_t(dec, &val->commandBufferCount);
43     if (vn_peek_array_size(dec)) {
44         const size_t array_size = vn_decode_array_size(dec, val->commandBufferCount);
45         val->pCommandBufferDeviceMasks = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pCommandBufferDeviceMasks) * array_size);
46         if (!val->pCommandBufferDeviceMasks) return;
47         vn_decode_uint32_t_array(dec, (uint32_t *)val->pCommandBufferDeviceMasks, array_size);
48     } else {
49         vn_decode_array_size(dec, val->commandBufferCount);
50         val->pCommandBufferDeviceMasks = NULL;
51     }
52     vn_decode_uint32_t(dec, &val->signalSemaphoreCount);
53     if (vn_peek_array_size(dec)) {
54         const size_t array_size = vn_decode_array_size(dec, val->signalSemaphoreCount);
55         val->pSignalSemaphoreDeviceIndices = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSignalSemaphoreDeviceIndices) * array_size);
56         if (!val->pSignalSemaphoreDeviceIndices) return;
57         vn_decode_uint32_t_array(dec, (uint32_t *)val->pSignalSemaphoreDeviceIndices, array_size);
58     } else {
59         vn_decode_array_size(dec, val->signalSemaphoreCount);
60         val->pSignalSemaphoreDeviceIndices = NULL;
61     }
62 }
63 
64 static inline void
vn_decode_VkDeviceGroupSubmitInfo_temp(struct vn_cs_decoder * dec,VkDeviceGroupSubmitInfo * val)65 vn_decode_VkDeviceGroupSubmitInfo_temp(struct vn_cs_decoder *dec, VkDeviceGroupSubmitInfo *val)
66 {
67     VkStructureType stype;
68     vn_decode_VkStructureType(dec, &stype);
69     if (stype != VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO)
70         vn_cs_decoder_set_fatal(dec);
71 
72     val->sType = stype;
73     val->pNext = vn_decode_VkDeviceGroupSubmitInfo_pnext_temp(dec);
74     vn_decode_VkDeviceGroupSubmitInfo_self_temp(dec, val);
75 }
76 
77 static inline void
vn_replace_VkDeviceGroupSubmitInfo_handle_self(VkDeviceGroupSubmitInfo * val)78 vn_replace_VkDeviceGroupSubmitInfo_handle_self(VkDeviceGroupSubmitInfo *val)
79 {
80     /* skip val->sType */
81     /* skip val->pNext */
82     /* skip val->waitSemaphoreCount */
83     /* skip val->pWaitSemaphoreDeviceIndices */
84     /* skip val->commandBufferCount */
85     /* skip val->pCommandBufferDeviceMasks */
86     /* skip val->signalSemaphoreCount */
87     /* skip val->pSignalSemaphoreDeviceIndices */
88 }
89 
90 static inline void
vn_replace_VkDeviceGroupSubmitInfo_handle(VkDeviceGroupSubmitInfo * val)91 vn_replace_VkDeviceGroupSubmitInfo_handle(VkDeviceGroupSubmitInfo *val)
92 {
93     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
94 
95     do {
96         switch ((int32_t)pnext->sType) {
97         case VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO:
98             vn_replace_VkDeviceGroupSubmitInfo_handle_self((VkDeviceGroupSubmitInfo *)pnext);
99             break;
100         default:
101             /* ignore unknown/unsupported struct */
102             break;
103         }
104         pnext = pnext->pNext;
105     } while (pnext);
106 }
107 
108 /* struct VkProtectedSubmitInfo chain */
109 
110 static inline void *
vn_decode_VkProtectedSubmitInfo_pnext_temp(struct vn_cs_decoder * dec)111 vn_decode_VkProtectedSubmitInfo_pnext_temp(struct vn_cs_decoder *dec)
112 {
113     /* no known/supported struct */
114     if (vn_decode_simple_pointer(dec))
115         vn_cs_decoder_set_fatal(dec);
116     return NULL;
117 }
118 
119 static inline void
vn_decode_VkProtectedSubmitInfo_self_temp(struct vn_cs_decoder * dec,VkProtectedSubmitInfo * val)120 vn_decode_VkProtectedSubmitInfo_self_temp(struct vn_cs_decoder *dec, VkProtectedSubmitInfo *val)
121 {
122     /* skip val->{sType,pNext} */
123     vn_decode_VkBool32(dec, &val->protectedSubmit);
124 }
125 
126 static inline void
vn_decode_VkProtectedSubmitInfo_temp(struct vn_cs_decoder * dec,VkProtectedSubmitInfo * val)127 vn_decode_VkProtectedSubmitInfo_temp(struct vn_cs_decoder *dec, VkProtectedSubmitInfo *val)
128 {
129     VkStructureType stype;
130     vn_decode_VkStructureType(dec, &stype);
131     if (stype != VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO)
132         vn_cs_decoder_set_fatal(dec);
133 
134     val->sType = stype;
135     val->pNext = vn_decode_VkProtectedSubmitInfo_pnext_temp(dec);
136     vn_decode_VkProtectedSubmitInfo_self_temp(dec, val);
137 }
138 
139 static inline void
vn_replace_VkProtectedSubmitInfo_handle_self(VkProtectedSubmitInfo * val)140 vn_replace_VkProtectedSubmitInfo_handle_self(VkProtectedSubmitInfo *val)
141 {
142     /* skip val->sType */
143     /* skip val->pNext */
144     /* skip val->protectedSubmit */
145 }
146 
147 static inline void
vn_replace_VkProtectedSubmitInfo_handle(VkProtectedSubmitInfo * val)148 vn_replace_VkProtectedSubmitInfo_handle(VkProtectedSubmitInfo *val)
149 {
150     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
151 
152     do {
153         switch ((int32_t)pnext->sType) {
154         case VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO:
155             vn_replace_VkProtectedSubmitInfo_handle_self((VkProtectedSubmitInfo *)pnext);
156             break;
157         default:
158             /* ignore unknown/unsupported struct */
159             break;
160         }
161         pnext = pnext->pNext;
162     } while (pnext);
163 }
164 
165 /* struct VkTimelineSemaphoreSubmitInfo chain */
166 
167 static inline void *
vn_decode_VkTimelineSemaphoreSubmitInfo_pnext_temp(struct vn_cs_decoder * dec)168 vn_decode_VkTimelineSemaphoreSubmitInfo_pnext_temp(struct vn_cs_decoder *dec)
169 {
170     /* no known/supported struct */
171     if (vn_decode_simple_pointer(dec))
172         vn_cs_decoder_set_fatal(dec);
173     return NULL;
174 }
175 
176 static inline void
vn_decode_VkTimelineSemaphoreSubmitInfo_self_temp(struct vn_cs_decoder * dec,VkTimelineSemaphoreSubmitInfo * val)177 vn_decode_VkTimelineSemaphoreSubmitInfo_self_temp(struct vn_cs_decoder *dec, VkTimelineSemaphoreSubmitInfo *val)
178 {
179     /* skip val->{sType,pNext} */
180     vn_decode_uint32_t(dec, &val->waitSemaphoreValueCount);
181     if (vn_peek_array_size(dec)) {
182         const size_t array_size = vn_decode_array_size(dec, val->waitSemaphoreValueCount);
183         val->pWaitSemaphoreValues = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pWaitSemaphoreValues) * array_size);
184         if (!val->pWaitSemaphoreValues) return;
185         vn_decode_uint64_t_array(dec, (uint64_t *)val->pWaitSemaphoreValues, array_size);
186     } else {
187         vn_decode_array_size_unchecked(dec);
188         val->pWaitSemaphoreValues = NULL;
189     }
190     vn_decode_uint32_t(dec, &val->signalSemaphoreValueCount);
191     if (vn_peek_array_size(dec)) {
192         const size_t array_size = vn_decode_array_size(dec, val->signalSemaphoreValueCount);
193         val->pSignalSemaphoreValues = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSignalSemaphoreValues) * array_size);
194         if (!val->pSignalSemaphoreValues) return;
195         vn_decode_uint64_t_array(dec, (uint64_t *)val->pSignalSemaphoreValues, array_size);
196     } else {
197         vn_decode_array_size_unchecked(dec);
198         val->pSignalSemaphoreValues = NULL;
199     }
200 }
201 
202 static inline void
vn_decode_VkTimelineSemaphoreSubmitInfo_temp(struct vn_cs_decoder * dec,VkTimelineSemaphoreSubmitInfo * val)203 vn_decode_VkTimelineSemaphoreSubmitInfo_temp(struct vn_cs_decoder *dec, VkTimelineSemaphoreSubmitInfo *val)
204 {
205     VkStructureType stype;
206     vn_decode_VkStructureType(dec, &stype);
207     if (stype != VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO)
208         vn_cs_decoder_set_fatal(dec);
209 
210     val->sType = stype;
211     val->pNext = vn_decode_VkTimelineSemaphoreSubmitInfo_pnext_temp(dec);
212     vn_decode_VkTimelineSemaphoreSubmitInfo_self_temp(dec, val);
213 }
214 
215 static inline void
vn_replace_VkTimelineSemaphoreSubmitInfo_handle_self(VkTimelineSemaphoreSubmitInfo * val)216 vn_replace_VkTimelineSemaphoreSubmitInfo_handle_self(VkTimelineSemaphoreSubmitInfo *val)
217 {
218     /* skip val->sType */
219     /* skip val->pNext */
220     /* skip val->waitSemaphoreValueCount */
221     /* skip val->pWaitSemaphoreValues */
222     /* skip val->signalSemaphoreValueCount */
223     /* skip val->pSignalSemaphoreValues */
224 }
225 
226 static inline void
vn_replace_VkTimelineSemaphoreSubmitInfo_handle(VkTimelineSemaphoreSubmitInfo * val)227 vn_replace_VkTimelineSemaphoreSubmitInfo_handle(VkTimelineSemaphoreSubmitInfo *val)
228 {
229     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
230 
231     do {
232         switch ((int32_t)pnext->sType) {
233         case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO:
234             vn_replace_VkTimelineSemaphoreSubmitInfo_handle_self((VkTimelineSemaphoreSubmitInfo *)pnext);
235             break;
236         default:
237             /* ignore unknown/unsupported struct */
238             break;
239         }
240         pnext = pnext->pNext;
241     } while (pnext);
242 }
243 
244 /* struct VkSubmitInfo chain */
245 
246 static inline void *
vn_decode_VkSubmitInfo_pnext_temp(struct vn_cs_decoder * dec)247 vn_decode_VkSubmitInfo_pnext_temp(struct vn_cs_decoder *dec)
248 {
249     VkBaseOutStructure *pnext;
250     VkStructureType stype;
251 
252     if (!vn_decode_simple_pointer(dec))
253         return NULL;
254 
255     vn_decode_VkStructureType(dec, &stype);
256     switch ((int32_t)stype) {
257     case VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO:
258         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkDeviceGroupSubmitInfo));
259         if (pnext) {
260             pnext->sType = stype;
261             pnext->pNext = vn_decode_VkSubmitInfo_pnext_temp(dec);
262             vn_decode_VkDeviceGroupSubmitInfo_self_temp(dec, (VkDeviceGroupSubmitInfo *)pnext);
263         }
264         break;
265     case VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO:
266         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkProtectedSubmitInfo));
267         if (pnext) {
268             pnext->sType = stype;
269             pnext->pNext = vn_decode_VkSubmitInfo_pnext_temp(dec);
270             vn_decode_VkProtectedSubmitInfo_self_temp(dec, (VkProtectedSubmitInfo *)pnext);
271         }
272         break;
273     case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO:
274         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkTimelineSemaphoreSubmitInfo));
275         if (pnext) {
276             pnext->sType = stype;
277             pnext->pNext = vn_decode_VkSubmitInfo_pnext_temp(dec);
278             vn_decode_VkTimelineSemaphoreSubmitInfo_self_temp(dec, (VkTimelineSemaphoreSubmitInfo *)pnext);
279         }
280         break;
281     default:
282         /* unexpected struct */
283         pnext = NULL;
284         vn_cs_decoder_set_fatal(dec);
285         break;
286     }
287 
288     return pnext;
289 }
290 
291 static inline void
vn_decode_VkSubmitInfo_self_temp(struct vn_cs_decoder * dec,VkSubmitInfo * val)292 vn_decode_VkSubmitInfo_self_temp(struct vn_cs_decoder *dec, VkSubmitInfo *val)
293 {
294     /* skip val->{sType,pNext} */
295     vn_decode_uint32_t(dec, &val->waitSemaphoreCount);
296     if (vn_peek_array_size(dec)) {
297         const uint32_t iter_count = vn_decode_array_size(dec, val->waitSemaphoreCount);
298         val->pWaitSemaphores = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pWaitSemaphores) * iter_count);
299         if (!val->pWaitSemaphores) return;
300         for (uint32_t i = 0; i < iter_count; i++)
301             vn_decode_VkSemaphore_lookup(dec, &((VkSemaphore *)val->pWaitSemaphores)[i]);
302     } else {
303         vn_decode_array_size(dec, val->waitSemaphoreCount);
304         val->pWaitSemaphores = NULL;
305     }
306     if (vn_peek_array_size(dec)) {
307         const uint32_t iter_count = vn_decode_array_size(dec, val->waitSemaphoreCount);
308         val->pWaitDstStageMask = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pWaitDstStageMask) * iter_count);
309         if (!val->pWaitDstStageMask) return;
310         for (uint32_t i = 0; i < iter_count; i++)
311             vn_decode_VkFlags(dec, &((VkPipelineStageFlags *)val->pWaitDstStageMask)[i]);
312     } else {
313         vn_decode_array_size(dec, val->waitSemaphoreCount);
314         val->pWaitDstStageMask = NULL;
315     }
316     vn_decode_uint32_t(dec, &val->commandBufferCount);
317     if (vn_peek_array_size(dec)) {
318         const uint32_t iter_count = vn_decode_array_size(dec, val->commandBufferCount);
319         val->pCommandBuffers = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pCommandBuffers) * iter_count);
320         if (!val->pCommandBuffers) return;
321         for (uint32_t i = 0; i < iter_count; i++)
322             vn_decode_VkCommandBuffer_lookup(dec, &((VkCommandBuffer *)val->pCommandBuffers)[i]);
323     } else {
324         vn_decode_array_size(dec, val->commandBufferCount);
325         val->pCommandBuffers = NULL;
326     }
327     vn_decode_uint32_t(dec, &val->signalSemaphoreCount);
328     if (vn_peek_array_size(dec)) {
329         const uint32_t iter_count = vn_decode_array_size(dec, val->signalSemaphoreCount);
330         val->pSignalSemaphores = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSignalSemaphores) * iter_count);
331         if (!val->pSignalSemaphores) return;
332         for (uint32_t i = 0; i < iter_count; i++)
333             vn_decode_VkSemaphore_lookup(dec, &((VkSemaphore *)val->pSignalSemaphores)[i]);
334     } else {
335         vn_decode_array_size(dec, val->signalSemaphoreCount);
336         val->pSignalSemaphores = NULL;
337     }
338 }
339 
340 static inline void
vn_decode_VkSubmitInfo_temp(struct vn_cs_decoder * dec,VkSubmitInfo * val)341 vn_decode_VkSubmitInfo_temp(struct vn_cs_decoder *dec, VkSubmitInfo *val)
342 {
343     VkStructureType stype;
344     vn_decode_VkStructureType(dec, &stype);
345     if (stype != VK_STRUCTURE_TYPE_SUBMIT_INFO)
346         vn_cs_decoder_set_fatal(dec);
347 
348     val->sType = stype;
349     val->pNext = vn_decode_VkSubmitInfo_pnext_temp(dec);
350     vn_decode_VkSubmitInfo_self_temp(dec, val);
351 }
352 
353 static inline void
vn_replace_VkSubmitInfo_handle_self(VkSubmitInfo * val)354 vn_replace_VkSubmitInfo_handle_self(VkSubmitInfo *val)
355 {
356     /* skip val->sType */
357     /* skip val->pNext */
358     /* skip val->waitSemaphoreCount */
359     if (val->pWaitSemaphores) {
360        for (uint32_t i = 0; i < val->waitSemaphoreCount; i++)
361             vn_replace_VkSemaphore_handle(&((VkSemaphore *)val->pWaitSemaphores)[i]);
362     }
363     /* skip val->pWaitDstStageMask */
364     /* skip val->commandBufferCount */
365     if (val->pCommandBuffers) {
366        for (uint32_t i = 0; i < val->commandBufferCount; i++)
367             vn_replace_VkCommandBuffer_handle(&((VkCommandBuffer *)val->pCommandBuffers)[i]);
368     }
369     /* skip val->signalSemaphoreCount */
370     if (val->pSignalSemaphores) {
371        for (uint32_t i = 0; i < val->signalSemaphoreCount; i++)
372             vn_replace_VkSemaphore_handle(&((VkSemaphore *)val->pSignalSemaphores)[i]);
373     }
374 }
375 
376 static inline void
vn_replace_VkSubmitInfo_handle(VkSubmitInfo * val)377 vn_replace_VkSubmitInfo_handle(VkSubmitInfo *val)
378 {
379     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
380 
381     do {
382         switch ((int32_t)pnext->sType) {
383         case VK_STRUCTURE_TYPE_SUBMIT_INFO:
384             vn_replace_VkSubmitInfo_handle_self((VkSubmitInfo *)pnext);
385             break;
386         case VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO:
387             vn_replace_VkDeviceGroupSubmitInfo_handle_self((VkDeviceGroupSubmitInfo *)pnext);
388             break;
389         case VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO:
390             vn_replace_VkProtectedSubmitInfo_handle_self((VkProtectedSubmitInfo *)pnext);
391             break;
392         case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO:
393             vn_replace_VkTimelineSemaphoreSubmitInfo_handle_self((VkTimelineSemaphoreSubmitInfo *)pnext);
394             break;
395         default:
396             /* ignore unknown/unsupported struct */
397             break;
398         }
399         pnext = pnext->pNext;
400     } while (pnext);
401 }
402 
403 /* struct VkSparseMemoryBind */
404 
405 static inline void
vn_decode_VkSparseMemoryBind_temp(struct vn_cs_decoder * dec,VkSparseMemoryBind * val)406 vn_decode_VkSparseMemoryBind_temp(struct vn_cs_decoder *dec, VkSparseMemoryBind *val)
407 {
408     vn_decode_VkDeviceSize(dec, &val->resourceOffset);
409     vn_decode_VkDeviceSize(dec, &val->size);
410     vn_decode_VkDeviceMemory_lookup(dec, &val->memory);
411     vn_decode_VkDeviceSize(dec, &val->memoryOffset);
412     vn_decode_VkFlags(dec, &val->flags);
413 }
414 
415 static inline void
vn_replace_VkSparseMemoryBind_handle(VkSparseMemoryBind * val)416 vn_replace_VkSparseMemoryBind_handle(VkSparseMemoryBind *val)
417 {
418     /* skip val->resourceOffset */
419     /* skip val->size */
420     vn_replace_VkDeviceMemory_handle(&val->memory);
421     /* skip val->memoryOffset */
422     /* skip val->flags */
423 }
424 
425 /* struct VkSparseBufferMemoryBindInfo */
426 
427 static inline void
vn_decode_VkSparseBufferMemoryBindInfo_temp(struct vn_cs_decoder * dec,VkSparseBufferMemoryBindInfo * val)428 vn_decode_VkSparseBufferMemoryBindInfo_temp(struct vn_cs_decoder *dec, VkSparseBufferMemoryBindInfo *val)
429 {
430     vn_decode_VkBuffer_lookup(dec, &val->buffer);
431     vn_decode_uint32_t(dec, &val->bindCount);
432     if (vn_peek_array_size(dec)) {
433         const uint32_t iter_count = vn_decode_array_size(dec, val->bindCount);
434         val->pBinds = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pBinds) * iter_count);
435         if (!val->pBinds) return;
436         for (uint32_t i = 0; i < iter_count; i++)
437             vn_decode_VkSparseMemoryBind_temp(dec, &((VkSparseMemoryBind *)val->pBinds)[i]);
438     } else {
439         vn_decode_array_size(dec, val->bindCount);
440         val->pBinds = NULL;
441     }
442 }
443 
444 static inline void
vn_replace_VkSparseBufferMemoryBindInfo_handle(VkSparseBufferMemoryBindInfo * val)445 vn_replace_VkSparseBufferMemoryBindInfo_handle(VkSparseBufferMemoryBindInfo *val)
446 {
447     vn_replace_VkBuffer_handle(&val->buffer);
448     /* skip val->bindCount */
449     if (val->pBinds) {
450        for (uint32_t i = 0; i < val->bindCount; i++)
451             vn_replace_VkSparseMemoryBind_handle(&((VkSparseMemoryBind *)val->pBinds)[i]);
452     }
453 }
454 
455 /* struct VkSparseImageOpaqueMemoryBindInfo */
456 
457 static inline void
vn_decode_VkSparseImageOpaqueMemoryBindInfo_temp(struct vn_cs_decoder * dec,VkSparseImageOpaqueMemoryBindInfo * val)458 vn_decode_VkSparseImageOpaqueMemoryBindInfo_temp(struct vn_cs_decoder *dec, VkSparseImageOpaqueMemoryBindInfo *val)
459 {
460     vn_decode_VkImage_lookup(dec, &val->image);
461     vn_decode_uint32_t(dec, &val->bindCount);
462     if (vn_peek_array_size(dec)) {
463         const uint32_t iter_count = vn_decode_array_size(dec, val->bindCount);
464         val->pBinds = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pBinds) * iter_count);
465         if (!val->pBinds) return;
466         for (uint32_t i = 0; i < iter_count; i++)
467             vn_decode_VkSparseMemoryBind_temp(dec, &((VkSparseMemoryBind *)val->pBinds)[i]);
468     } else {
469         vn_decode_array_size(dec, val->bindCount);
470         val->pBinds = NULL;
471     }
472 }
473 
474 static inline void
vn_replace_VkSparseImageOpaqueMemoryBindInfo_handle(VkSparseImageOpaqueMemoryBindInfo * val)475 vn_replace_VkSparseImageOpaqueMemoryBindInfo_handle(VkSparseImageOpaqueMemoryBindInfo *val)
476 {
477     vn_replace_VkImage_handle(&val->image);
478     /* skip val->bindCount */
479     if (val->pBinds) {
480        for (uint32_t i = 0; i < val->bindCount; i++)
481             vn_replace_VkSparseMemoryBind_handle(&((VkSparseMemoryBind *)val->pBinds)[i]);
482     }
483 }
484 
485 /* struct VkSparseImageMemoryBind */
486 
487 static inline void
vn_decode_VkSparseImageMemoryBind_temp(struct vn_cs_decoder * dec,VkSparseImageMemoryBind * val)488 vn_decode_VkSparseImageMemoryBind_temp(struct vn_cs_decoder *dec, VkSparseImageMemoryBind *val)
489 {
490     vn_decode_VkImageSubresource_temp(dec, &val->subresource);
491     vn_decode_VkOffset3D_temp(dec, &val->offset);
492     vn_decode_VkExtent3D_temp(dec, &val->extent);
493     vn_decode_VkDeviceMemory_lookup(dec, &val->memory);
494     vn_decode_VkDeviceSize(dec, &val->memoryOffset);
495     vn_decode_VkFlags(dec, &val->flags);
496 }
497 
498 static inline void
vn_replace_VkSparseImageMemoryBind_handle(VkSparseImageMemoryBind * val)499 vn_replace_VkSparseImageMemoryBind_handle(VkSparseImageMemoryBind *val)
500 {
501     vn_replace_VkImageSubresource_handle(&val->subresource);
502     vn_replace_VkOffset3D_handle(&val->offset);
503     vn_replace_VkExtent3D_handle(&val->extent);
504     vn_replace_VkDeviceMemory_handle(&val->memory);
505     /* skip val->memoryOffset */
506     /* skip val->flags */
507 }
508 
509 /* struct VkSparseImageMemoryBindInfo */
510 
511 static inline void
vn_decode_VkSparseImageMemoryBindInfo_temp(struct vn_cs_decoder * dec,VkSparseImageMemoryBindInfo * val)512 vn_decode_VkSparseImageMemoryBindInfo_temp(struct vn_cs_decoder *dec, VkSparseImageMemoryBindInfo *val)
513 {
514     vn_decode_VkImage_lookup(dec, &val->image);
515     vn_decode_uint32_t(dec, &val->bindCount);
516     if (vn_peek_array_size(dec)) {
517         const uint32_t iter_count = vn_decode_array_size(dec, val->bindCount);
518         val->pBinds = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pBinds) * iter_count);
519         if (!val->pBinds) return;
520         for (uint32_t i = 0; i < iter_count; i++)
521             vn_decode_VkSparseImageMemoryBind_temp(dec, &((VkSparseImageMemoryBind *)val->pBinds)[i]);
522     } else {
523         vn_decode_array_size(dec, val->bindCount);
524         val->pBinds = NULL;
525     }
526 }
527 
528 static inline void
vn_replace_VkSparseImageMemoryBindInfo_handle(VkSparseImageMemoryBindInfo * val)529 vn_replace_VkSparseImageMemoryBindInfo_handle(VkSparseImageMemoryBindInfo *val)
530 {
531     vn_replace_VkImage_handle(&val->image);
532     /* skip val->bindCount */
533     if (val->pBinds) {
534        for (uint32_t i = 0; i < val->bindCount; i++)
535             vn_replace_VkSparseImageMemoryBind_handle(&((VkSparseImageMemoryBind *)val->pBinds)[i]);
536     }
537 }
538 
539 /* struct VkDeviceGroupBindSparseInfo chain */
540 
541 static inline void *
vn_decode_VkDeviceGroupBindSparseInfo_pnext_temp(struct vn_cs_decoder * dec)542 vn_decode_VkDeviceGroupBindSparseInfo_pnext_temp(struct vn_cs_decoder *dec)
543 {
544     /* no known/supported struct */
545     if (vn_decode_simple_pointer(dec))
546         vn_cs_decoder_set_fatal(dec);
547     return NULL;
548 }
549 
550 static inline void
vn_decode_VkDeviceGroupBindSparseInfo_self_temp(struct vn_cs_decoder * dec,VkDeviceGroupBindSparseInfo * val)551 vn_decode_VkDeviceGroupBindSparseInfo_self_temp(struct vn_cs_decoder *dec, VkDeviceGroupBindSparseInfo *val)
552 {
553     /* skip val->{sType,pNext} */
554     vn_decode_uint32_t(dec, &val->resourceDeviceIndex);
555     vn_decode_uint32_t(dec, &val->memoryDeviceIndex);
556 }
557 
558 static inline void
vn_decode_VkDeviceGroupBindSparseInfo_temp(struct vn_cs_decoder * dec,VkDeviceGroupBindSparseInfo * val)559 vn_decode_VkDeviceGroupBindSparseInfo_temp(struct vn_cs_decoder *dec, VkDeviceGroupBindSparseInfo *val)
560 {
561     VkStructureType stype;
562     vn_decode_VkStructureType(dec, &stype);
563     if (stype != VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO)
564         vn_cs_decoder_set_fatal(dec);
565 
566     val->sType = stype;
567     val->pNext = vn_decode_VkDeviceGroupBindSparseInfo_pnext_temp(dec);
568     vn_decode_VkDeviceGroupBindSparseInfo_self_temp(dec, val);
569 }
570 
571 static inline void
vn_replace_VkDeviceGroupBindSparseInfo_handle_self(VkDeviceGroupBindSparseInfo * val)572 vn_replace_VkDeviceGroupBindSparseInfo_handle_self(VkDeviceGroupBindSparseInfo *val)
573 {
574     /* skip val->sType */
575     /* skip val->pNext */
576     /* skip val->resourceDeviceIndex */
577     /* skip val->memoryDeviceIndex */
578 }
579 
580 static inline void
vn_replace_VkDeviceGroupBindSparseInfo_handle(VkDeviceGroupBindSparseInfo * val)581 vn_replace_VkDeviceGroupBindSparseInfo_handle(VkDeviceGroupBindSparseInfo *val)
582 {
583     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
584 
585     do {
586         switch ((int32_t)pnext->sType) {
587         case VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO:
588             vn_replace_VkDeviceGroupBindSparseInfo_handle_self((VkDeviceGroupBindSparseInfo *)pnext);
589             break;
590         default:
591             /* ignore unknown/unsupported struct */
592             break;
593         }
594         pnext = pnext->pNext;
595     } while (pnext);
596 }
597 
598 /* struct VkBindSparseInfo chain */
599 
600 static inline void *
vn_decode_VkBindSparseInfo_pnext_temp(struct vn_cs_decoder * dec)601 vn_decode_VkBindSparseInfo_pnext_temp(struct vn_cs_decoder *dec)
602 {
603     VkBaseOutStructure *pnext;
604     VkStructureType stype;
605 
606     if (!vn_decode_simple_pointer(dec))
607         return NULL;
608 
609     vn_decode_VkStructureType(dec, &stype);
610     switch ((int32_t)stype) {
611     case VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO:
612         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkDeviceGroupBindSparseInfo));
613         if (pnext) {
614             pnext->sType = stype;
615             pnext->pNext = vn_decode_VkBindSparseInfo_pnext_temp(dec);
616             vn_decode_VkDeviceGroupBindSparseInfo_self_temp(dec, (VkDeviceGroupBindSparseInfo *)pnext);
617         }
618         break;
619     case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO:
620         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkTimelineSemaphoreSubmitInfo));
621         if (pnext) {
622             pnext->sType = stype;
623             pnext->pNext = vn_decode_VkBindSparseInfo_pnext_temp(dec);
624             vn_decode_VkTimelineSemaphoreSubmitInfo_self_temp(dec, (VkTimelineSemaphoreSubmitInfo *)pnext);
625         }
626         break;
627     default:
628         /* unexpected struct */
629         pnext = NULL;
630         vn_cs_decoder_set_fatal(dec);
631         break;
632     }
633 
634     return pnext;
635 }
636 
637 static inline void
vn_decode_VkBindSparseInfo_self_temp(struct vn_cs_decoder * dec,VkBindSparseInfo * val)638 vn_decode_VkBindSparseInfo_self_temp(struct vn_cs_decoder *dec, VkBindSparseInfo *val)
639 {
640     /* skip val->{sType,pNext} */
641     vn_decode_uint32_t(dec, &val->waitSemaphoreCount);
642     if (vn_peek_array_size(dec)) {
643         const uint32_t iter_count = vn_decode_array_size(dec, val->waitSemaphoreCount);
644         val->pWaitSemaphores = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pWaitSemaphores) * iter_count);
645         if (!val->pWaitSemaphores) return;
646         for (uint32_t i = 0; i < iter_count; i++)
647             vn_decode_VkSemaphore_lookup(dec, &((VkSemaphore *)val->pWaitSemaphores)[i]);
648     } else {
649         vn_decode_array_size(dec, val->waitSemaphoreCount);
650         val->pWaitSemaphores = NULL;
651     }
652     vn_decode_uint32_t(dec, &val->bufferBindCount);
653     if (vn_peek_array_size(dec)) {
654         const uint32_t iter_count = vn_decode_array_size(dec, val->bufferBindCount);
655         val->pBufferBinds = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pBufferBinds) * iter_count);
656         if (!val->pBufferBinds) return;
657         for (uint32_t i = 0; i < iter_count; i++)
658             vn_decode_VkSparseBufferMemoryBindInfo_temp(dec, &((VkSparseBufferMemoryBindInfo *)val->pBufferBinds)[i]);
659     } else {
660         vn_decode_array_size(dec, val->bufferBindCount);
661         val->pBufferBinds = NULL;
662     }
663     vn_decode_uint32_t(dec, &val->imageOpaqueBindCount);
664     if (vn_peek_array_size(dec)) {
665         const uint32_t iter_count = vn_decode_array_size(dec, val->imageOpaqueBindCount);
666         val->pImageOpaqueBinds = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pImageOpaqueBinds) * iter_count);
667         if (!val->pImageOpaqueBinds) return;
668         for (uint32_t i = 0; i < iter_count; i++)
669             vn_decode_VkSparseImageOpaqueMemoryBindInfo_temp(dec, &((VkSparseImageOpaqueMemoryBindInfo *)val->pImageOpaqueBinds)[i]);
670     } else {
671         vn_decode_array_size(dec, val->imageOpaqueBindCount);
672         val->pImageOpaqueBinds = NULL;
673     }
674     vn_decode_uint32_t(dec, &val->imageBindCount);
675     if (vn_peek_array_size(dec)) {
676         const uint32_t iter_count = vn_decode_array_size(dec, val->imageBindCount);
677         val->pImageBinds = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pImageBinds) * iter_count);
678         if (!val->pImageBinds) return;
679         for (uint32_t i = 0; i < iter_count; i++)
680             vn_decode_VkSparseImageMemoryBindInfo_temp(dec, &((VkSparseImageMemoryBindInfo *)val->pImageBinds)[i]);
681     } else {
682         vn_decode_array_size(dec, val->imageBindCount);
683         val->pImageBinds = NULL;
684     }
685     vn_decode_uint32_t(dec, &val->signalSemaphoreCount);
686     if (vn_peek_array_size(dec)) {
687         const uint32_t iter_count = vn_decode_array_size(dec, val->signalSemaphoreCount);
688         val->pSignalSemaphores = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSignalSemaphores) * iter_count);
689         if (!val->pSignalSemaphores) return;
690         for (uint32_t i = 0; i < iter_count; i++)
691             vn_decode_VkSemaphore_lookup(dec, &((VkSemaphore *)val->pSignalSemaphores)[i]);
692     } else {
693         vn_decode_array_size(dec, val->signalSemaphoreCount);
694         val->pSignalSemaphores = NULL;
695     }
696 }
697 
698 static inline void
vn_decode_VkBindSparseInfo_temp(struct vn_cs_decoder * dec,VkBindSparseInfo * val)699 vn_decode_VkBindSparseInfo_temp(struct vn_cs_decoder *dec, VkBindSparseInfo *val)
700 {
701     VkStructureType stype;
702     vn_decode_VkStructureType(dec, &stype);
703     if (stype != VK_STRUCTURE_TYPE_BIND_SPARSE_INFO)
704         vn_cs_decoder_set_fatal(dec);
705 
706     val->sType = stype;
707     val->pNext = vn_decode_VkBindSparseInfo_pnext_temp(dec);
708     vn_decode_VkBindSparseInfo_self_temp(dec, val);
709 }
710 
711 static inline void
vn_replace_VkBindSparseInfo_handle_self(VkBindSparseInfo * val)712 vn_replace_VkBindSparseInfo_handle_self(VkBindSparseInfo *val)
713 {
714     /* skip val->sType */
715     /* skip val->pNext */
716     /* skip val->waitSemaphoreCount */
717     if (val->pWaitSemaphores) {
718        for (uint32_t i = 0; i < val->waitSemaphoreCount; i++)
719             vn_replace_VkSemaphore_handle(&((VkSemaphore *)val->pWaitSemaphores)[i]);
720     }
721     /* skip val->bufferBindCount */
722     if (val->pBufferBinds) {
723        for (uint32_t i = 0; i < val->bufferBindCount; i++)
724             vn_replace_VkSparseBufferMemoryBindInfo_handle(&((VkSparseBufferMemoryBindInfo *)val->pBufferBinds)[i]);
725     }
726     /* skip val->imageOpaqueBindCount */
727     if (val->pImageOpaqueBinds) {
728        for (uint32_t i = 0; i < val->imageOpaqueBindCount; i++)
729             vn_replace_VkSparseImageOpaqueMemoryBindInfo_handle(&((VkSparseImageOpaqueMemoryBindInfo *)val->pImageOpaqueBinds)[i]);
730     }
731     /* skip val->imageBindCount */
732     if (val->pImageBinds) {
733        for (uint32_t i = 0; i < val->imageBindCount; i++)
734             vn_replace_VkSparseImageMemoryBindInfo_handle(&((VkSparseImageMemoryBindInfo *)val->pImageBinds)[i]);
735     }
736     /* skip val->signalSemaphoreCount */
737     if (val->pSignalSemaphores) {
738        for (uint32_t i = 0; i < val->signalSemaphoreCount; i++)
739             vn_replace_VkSemaphore_handle(&((VkSemaphore *)val->pSignalSemaphores)[i]);
740     }
741 }
742 
743 static inline void
vn_replace_VkBindSparseInfo_handle(VkBindSparseInfo * val)744 vn_replace_VkBindSparseInfo_handle(VkBindSparseInfo *val)
745 {
746     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
747 
748     do {
749         switch ((int32_t)pnext->sType) {
750         case VK_STRUCTURE_TYPE_BIND_SPARSE_INFO:
751             vn_replace_VkBindSparseInfo_handle_self((VkBindSparseInfo *)pnext);
752             break;
753         case VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO:
754             vn_replace_VkDeviceGroupBindSparseInfo_handle_self((VkDeviceGroupBindSparseInfo *)pnext);
755             break;
756         case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO:
757             vn_replace_VkTimelineSemaphoreSubmitInfo_handle_self((VkTimelineSemaphoreSubmitInfo *)pnext);
758             break;
759         default:
760             /* ignore unknown/unsupported struct */
761             break;
762         }
763         pnext = pnext->pNext;
764     } while (pnext);
765 }
766 
vn_decode_vkQueueSubmit_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkQueueSubmit * args)767 static inline void vn_decode_vkQueueSubmit_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkQueueSubmit *args)
768 {
769     vn_decode_VkQueue_lookup(dec, &args->queue);
770     vn_decode_uint32_t(dec, &args->submitCount);
771     if (vn_peek_array_size(dec)) {
772         const uint32_t iter_count = vn_decode_array_size(dec, args->submitCount);
773         args->pSubmits = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSubmits) * iter_count);
774         if (!args->pSubmits) return;
775         for (uint32_t i = 0; i < iter_count; i++)
776             vn_decode_VkSubmitInfo_temp(dec, &((VkSubmitInfo *)args->pSubmits)[i]);
777     } else {
778         vn_decode_array_size(dec, args->submitCount);
779         args->pSubmits = NULL;
780     }
781     vn_decode_VkFence_lookup(dec, &args->fence);
782 }
783 
vn_replace_vkQueueSubmit_args_handle(struct vn_command_vkQueueSubmit * args)784 static inline void vn_replace_vkQueueSubmit_args_handle(struct vn_command_vkQueueSubmit *args)
785 {
786     vn_replace_VkQueue_handle(&args->queue);
787     /* skip args->submitCount */
788     if (args->pSubmits) {
789        for (uint32_t i = 0; i < args->submitCount; i++)
790             vn_replace_VkSubmitInfo_handle(&((VkSubmitInfo *)args->pSubmits)[i]);
791     }
792     vn_replace_VkFence_handle(&args->fence);
793 }
794 
vn_encode_vkQueueSubmit_reply(struct vn_cs_encoder * enc,const struct vn_command_vkQueueSubmit * args)795 static inline void vn_encode_vkQueueSubmit_reply(struct vn_cs_encoder *enc, const struct vn_command_vkQueueSubmit *args)
796 {
797     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkQueueSubmit_EXT});
798 
799     vn_encode_VkResult(enc, &args->ret);
800     /* skip args->queue */
801     /* skip args->submitCount */
802     /* skip args->pSubmits */
803     /* skip args->fence */
804 }
805 
vn_decode_vkQueueWaitIdle_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkQueueWaitIdle * args)806 static inline void vn_decode_vkQueueWaitIdle_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkQueueWaitIdle *args)
807 {
808     vn_decode_VkQueue_lookup(dec, &args->queue);
809 }
810 
vn_replace_vkQueueWaitIdle_args_handle(struct vn_command_vkQueueWaitIdle * args)811 static inline void vn_replace_vkQueueWaitIdle_args_handle(struct vn_command_vkQueueWaitIdle *args)
812 {
813     vn_replace_VkQueue_handle(&args->queue);
814 }
815 
vn_encode_vkQueueWaitIdle_reply(struct vn_cs_encoder * enc,const struct vn_command_vkQueueWaitIdle * args)816 static inline void vn_encode_vkQueueWaitIdle_reply(struct vn_cs_encoder *enc, const struct vn_command_vkQueueWaitIdle *args)
817 {
818     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkQueueWaitIdle_EXT});
819 
820     vn_encode_VkResult(enc, &args->ret);
821     /* skip args->queue */
822 }
823 
vn_decode_vkQueueBindSparse_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkQueueBindSparse * args)824 static inline void vn_decode_vkQueueBindSparse_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkQueueBindSparse *args)
825 {
826     vn_decode_VkQueue_lookup(dec, &args->queue);
827     vn_decode_uint32_t(dec, &args->bindInfoCount);
828     if (vn_peek_array_size(dec)) {
829         const uint32_t iter_count = vn_decode_array_size(dec, args->bindInfoCount);
830         args->pBindInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pBindInfo) * iter_count);
831         if (!args->pBindInfo) return;
832         for (uint32_t i = 0; i < iter_count; i++)
833             vn_decode_VkBindSparseInfo_temp(dec, &((VkBindSparseInfo *)args->pBindInfo)[i]);
834     } else {
835         vn_decode_array_size(dec, args->bindInfoCount);
836         args->pBindInfo = NULL;
837     }
838     vn_decode_VkFence_lookup(dec, &args->fence);
839 }
840 
vn_replace_vkQueueBindSparse_args_handle(struct vn_command_vkQueueBindSparse * args)841 static inline void vn_replace_vkQueueBindSparse_args_handle(struct vn_command_vkQueueBindSparse *args)
842 {
843     vn_replace_VkQueue_handle(&args->queue);
844     /* skip args->bindInfoCount */
845     if (args->pBindInfo) {
846        for (uint32_t i = 0; i < args->bindInfoCount; i++)
847             vn_replace_VkBindSparseInfo_handle(&((VkBindSparseInfo *)args->pBindInfo)[i]);
848     }
849     vn_replace_VkFence_handle(&args->fence);
850 }
851 
vn_encode_vkQueueBindSparse_reply(struct vn_cs_encoder * enc,const struct vn_command_vkQueueBindSparse * args)852 static inline void vn_encode_vkQueueBindSparse_reply(struct vn_cs_encoder *enc, const struct vn_command_vkQueueBindSparse *args)
853 {
854     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkQueueBindSparse_EXT});
855 
856     vn_encode_VkResult(enc, &args->ret);
857     /* skip args->queue */
858     /* skip args->bindInfoCount */
859     /* skip args->pBindInfo */
860     /* skip args->fence */
861 }
862 
vn_dispatch_vkQueueSubmit(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)863 static inline void vn_dispatch_vkQueueSubmit(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
864 {
865     struct vn_command_vkQueueSubmit args;
866 
867     if (!ctx->dispatch_vkQueueSubmit) {
868         vn_cs_decoder_set_fatal(ctx->decoder);
869         return;
870     }
871 
872     vn_decode_vkQueueSubmit_args_temp(ctx->decoder, &args);
873     if (!args.queue) {
874         vn_cs_decoder_set_fatal(ctx->decoder);
875         return;
876     }
877 
878     if (!vn_cs_decoder_get_fatal(ctx->decoder))
879         ctx->dispatch_vkQueueSubmit(ctx, &args);
880 
881 #ifdef DEBUG
882     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
883         vn_dispatch_debug_log(ctx, "vkQueueSubmit returned %d", args.ret);
884 #endif
885 
886     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
887        vn_encode_vkQueueSubmit_reply(ctx->encoder, &args);
888 
889     vn_cs_decoder_reset_temp_pool(ctx->decoder);
890 }
891 
vn_dispatch_vkQueueWaitIdle(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)892 static inline void vn_dispatch_vkQueueWaitIdle(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
893 {
894     struct vn_command_vkQueueWaitIdle args;
895 
896     if (!ctx->dispatch_vkQueueWaitIdle) {
897         vn_cs_decoder_set_fatal(ctx->decoder);
898         return;
899     }
900 
901     vn_decode_vkQueueWaitIdle_args_temp(ctx->decoder, &args);
902     if (!args.queue) {
903         vn_cs_decoder_set_fatal(ctx->decoder);
904         return;
905     }
906 
907     if (!vn_cs_decoder_get_fatal(ctx->decoder))
908         ctx->dispatch_vkQueueWaitIdle(ctx, &args);
909 
910 #ifdef DEBUG
911     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
912         vn_dispatch_debug_log(ctx, "vkQueueWaitIdle returned %d", args.ret);
913 #endif
914 
915     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
916        vn_encode_vkQueueWaitIdle_reply(ctx->encoder, &args);
917 
918     vn_cs_decoder_reset_temp_pool(ctx->decoder);
919 }
920 
vn_dispatch_vkQueueBindSparse(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)921 static inline void vn_dispatch_vkQueueBindSparse(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
922 {
923     struct vn_command_vkQueueBindSparse args;
924 
925     if (!ctx->dispatch_vkQueueBindSparse) {
926         vn_cs_decoder_set_fatal(ctx->decoder);
927         return;
928     }
929 
930     vn_decode_vkQueueBindSparse_args_temp(ctx->decoder, &args);
931     if (!args.queue) {
932         vn_cs_decoder_set_fatal(ctx->decoder);
933         return;
934     }
935 
936     if (!vn_cs_decoder_get_fatal(ctx->decoder))
937         ctx->dispatch_vkQueueBindSparse(ctx, &args);
938 
939 #ifdef DEBUG
940     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
941         vn_dispatch_debug_log(ctx, "vkQueueBindSparse returned %d", args.ret);
942 #endif
943 
944     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
945        vn_encode_vkQueueBindSparse_reply(ctx->encoder, &args);
946 
947     vn_cs_decoder_reset_temp_pool(ctx->decoder);
948 }
949 
950 #pragma GCC diagnostic pop
951 
952 #endif /* VN_PROTOCOL_RENDERER_QUEUE_H */
953