xref: /aosp_15_r20/external/virglrenderer/src/venus/venus-protocol/vn_protocol_renderer_semaphore.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_SEMAPHORE_H
9 #define VN_PROTOCOL_RENDERER_SEMAPHORE_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 /*
18  * These structs/unions/commands are not included
19  *
20  *   vkGetSemaphoreFdKHR
21  *   vkImportSemaphoreFdKHR
22  */
23 
24 /* struct VkExportSemaphoreCreateInfo chain */
25 
26 static inline void *
vn_decode_VkExportSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder * dec)27 vn_decode_VkExportSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
28 {
29     /* no known/supported struct */
30     if (vn_decode_simple_pointer(dec))
31         vn_cs_decoder_set_fatal(dec);
32     return NULL;
33 }
34 
35 static inline void
vn_decode_VkExportSemaphoreCreateInfo_self_temp(struct vn_cs_decoder * dec,VkExportSemaphoreCreateInfo * val)36 vn_decode_VkExportSemaphoreCreateInfo_self_temp(struct vn_cs_decoder *dec, VkExportSemaphoreCreateInfo *val)
37 {
38     /* skip val->{sType,pNext} */
39     vn_decode_VkFlags(dec, &val->handleTypes);
40 }
41 
42 static inline void
vn_decode_VkExportSemaphoreCreateInfo_temp(struct vn_cs_decoder * dec,VkExportSemaphoreCreateInfo * val)43 vn_decode_VkExportSemaphoreCreateInfo_temp(struct vn_cs_decoder *dec, VkExportSemaphoreCreateInfo *val)
44 {
45     VkStructureType stype;
46     vn_decode_VkStructureType(dec, &stype);
47     if (stype != VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO)
48         vn_cs_decoder_set_fatal(dec);
49 
50     val->sType = stype;
51     val->pNext = vn_decode_VkExportSemaphoreCreateInfo_pnext_temp(dec);
52     vn_decode_VkExportSemaphoreCreateInfo_self_temp(dec, val);
53 }
54 
55 static inline void
vn_replace_VkExportSemaphoreCreateInfo_handle_self(VkExportSemaphoreCreateInfo * val)56 vn_replace_VkExportSemaphoreCreateInfo_handle_self(VkExportSemaphoreCreateInfo *val)
57 {
58     /* skip val->sType */
59     /* skip val->pNext */
60     /* skip val->handleTypes */
61 }
62 
63 static inline void
vn_replace_VkExportSemaphoreCreateInfo_handle(VkExportSemaphoreCreateInfo * val)64 vn_replace_VkExportSemaphoreCreateInfo_handle(VkExportSemaphoreCreateInfo *val)
65 {
66     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
67 
68     do {
69         switch ((int32_t)pnext->sType) {
70         case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO:
71             vn_replace_VkExportSemaphoreCreateInfo_handle_self((VkExportSemaphoreCreateInfo *)pnext);
72             break;
73         default:
74             /* ignore unknown/unsupported struct */
75             break;
76         }
77         pnext = pnext->pNext;
78     } while (pnext);
79 }
80 
81 /* struct VkSemaphoreCreateInfo chain */
82 
83 static inline void *
vn_decode_VkSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder * dec)84 vn_decode_VkSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
85 {
86     VkBaseOutStructure *pnext;
87     VkStructureType stype;
88 
89     if (!vn_decode_simple_pointer(dec))
90         return NULL;
91 
92     vn_decode_VkStructureType(dec, &stype);
93     switch ((int32_t)stype) {
94     case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO:
95         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkExportSemaphoreCreateInfo));
96         if (pnext) {
97             pnext->sType = stype;
98             pnext->pNext = vn_decode_VkSemaphoreCreateInfo_pnext_temp(dec);
99             vn_decode_VkExportSemaphoreCreateInfo_self_temp(dec, (VkExportSemaphoreCreateInfo *)pnext);
100         }
101         break;
102     case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO:
103         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkSemaphoreTypeCreateInfo));
104         if (pnext) {
105             pnext->sType = stype;
106             pnext->pNext = vn_decode_VkSemaphoreCreateInfo_pnext_temp(dec);
107             vn_decode_VkSemaphoreTypeCreateInfo_self_temp(dec, (VkSemaphoreTypeCreateInfo *)pnext);
108         }
109         break;
110     default:
111         /* unexpected struct */
112         pnext = NULL;
113         vn_cs_decoder_set_fatal(dec);
114         break;
115     }
116 
117     return pnext;
118 }
119 
120 static inline void
vn_decode_VkSemaphoreCreateInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreCreateInfo * val)121 vn_decode_VkSemaphoreCreateInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreCreateInfo *val)
122 {
123     /* skip val->{sType,pNext} */
124     vn_decode_VkFlags(dec, &val->flags);
125 }
126 
127 static inline void
vn_decode_VkSemaphoreCreateInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreCreateInfo * val)128 vn_decode_VkSemaphoreCreateInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreCreateInfo *val)
129 {
130     VkStructureType stype;
131     vn_decode_VkStructureType(dec, &stype);
132     if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
133         vn_cs_decoder_set_fatal(dec);
134 
135     val->sType = stype;
136     val->pNext = vn_decode_VkSemaphoreCreateInfo_pnext_temp(dec);
137     vn_decode_VkSemaphoreCreateInfo_self_temp(dec, val);
138 }
139 
140 static inline void
vn_replace_VkSemaphoreCreateInfo_handle_self(VkSemaphoreCreateInfo * val)141 vn_replace_VkSemaphoreCreateInfo_handle_self(VkSemaphoreCreateInfo *val)
142 {
143     /* skip val->sType */
144     /* skip val->pNext */
145     /* skip val->flags */
146 }
147 
148 static inline void
vn_replace_VkSemaphoreCreateInfo_handle(VkSemaphoreCreateInfo * val)149 vn_replace_VkSemaphoreCreateInfo_handle(VkSemaphoreCreateInfo *val)
150 {
151     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
152 
153     do {
154         switch ((int32_t)pnext->sType) {
155         case VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO:
156             vn_replace_VkSemaphoreCreateInfo_handle_self((VkSemaphoreCreateInfo *)pnext);
157             break;
158         case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO:
159             vn_replace_VkExportSemaphoreCreateInfo_handle_self((VkExportSemaphoreCreateInfo *)pnext);
160             break;
161         case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO:
162             vn_replace_VkSemaphoreTypeCreateInfo_handle_self((VkSemaphoreTypeCreateInfo *)pnext);
163             break;
164         default:
165             /* ignore unknown/unsupported struct */
166             break;
167         }
168         pnext = pnext->pNext;
169     } while (pnext);
170 }
171 
172 /* struct VkSemaphoreWaitInfo chain */
173 
174 static inline void *
vn_decode_VkSemaphoreWaitInfo_pnext_temp(struct vn_cs_decoder * dec)175 vn_decode_VkSemaphoreWaitInfo_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_VkSemaphoreWaitInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreWaitInfo * val)184 vn_decode_VkSemaphoreWaitInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreWaitInfo *val)
185 {
186     /* skip val->{sType,pNext} */
187     vn_decode_VkFlags(dec, &val->flags);
188     vn_decode_uint32_t(dec, &val->semaphoreCount);
189     if (vn_peek_array_size(dec)) {
190         const uint32_t iter_count = vn_decode_array_size(dec, val->semaphoreCount);
191         val->pSemaphores = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSemaphores) * iter_count);
192         if (!val->pSemaphores) return;
193         for (uint32_t i = 0; i < iter_count; i++)
194             vn_decode_VkSemaphore_lookup(dec, &((VkSemaphore *)val->pSemaphores)[i]);
195     } else {
196         vn_decode_array_size(dec, val->semaphoreCount);
197         val->pSemaphores = NULL;
198     }
199     if (vn_peek_array_size(dec)) {
200         const size_t array_size = vn_decode_array_size(dec, val->semaphoreCount);
201         val->pValues = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pValues) * array_size);
202         if (!val->pValues) return;
203         vn_decode_uint64_t_array(dec, (uint64_t *)val->pValues, array_size);
204     } else {
205         vn_decode_array_size(dec, val->semaphoreCount);
206         val->pValues = NULL;
207     }
208 }
209 
210 static inline void
vn_decode_VkSemaphoreWaitInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreWaitInfo * val)211 vn_decode_VkSemaphoreWaitInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreWaitInfo *val)
212 {
213     VkStructureType stype;
214     vn_decode_VkStructureType(dec, &stype);
215     if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO)
216         vn_cs_decoder_set_fatal(dec);
217 
218     val->sType = stype;
219     val->pNext = vn_decode_VkSemaphoreWaitInfo_pnext_temp(dec);
220     vn_decode_VkSemaphoreWaitInfo_self_temp(dec, val);
221 }
222 
223 static inline void
vn_replace_VkSemaphoreWaitInfo_handle_self(VkSemaphoreWaitInfo * val)224 vn_replace_VkSemaphoreWaitInfo_handle_self(VkSemaphoreWaitInfo *val)
225 {
226     /* skip val->sType */
227     /* skip val->pNext */
228     /* skip val->flags */
229     /* skip val->semaphoreCount */
230     if (val->pSemaphores) {
231        for (uint32_t i = 0; i < val->semaphoreCount; i++)
232             vn_replace_VkSemaphore_handle(&((VkSemaphore *)val->pSemaphores)[i]);
233     }
234     /* skip val->pValues */
235 }
236 
237 static inline void
vn_replace_VkSemaphoreWaitInfo_handle(VkSemaphoreWaitInfo * val)238 vn_replace_VkSemaphoreWaitInfo_handle(VkSemaphoreWaitInfo *val)
239 {
240     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
241 
242     do {
243         switch ((int32_t)pnext->sType) {
244         case VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO:
245             vn_replace_VkSemaphoreWaitInfo_handle_self((VkSemaphoreWaitInfo *)pnext);
246             break;
247         default:
248             /* ignore unknown/unsupported struct */
249             break;
250         }
251         pnext = pnext->pNext;
252     } while (pnext);
253 }
254 
255 /* struct VkSemaphoreSignalInfo chain */
256 
257 static inline void *
vn_decode_VkSemaphoreSignalInfo_pnext_temp(struct vn_cs_decoder * dec)258 vn_decode_VkSemaphoreSignalInfo_pnext_temp(struct vn_cs_decoder *dec)
259 {
260     /* no known/supported struct */
261     if (vn_decode_simple_pointer(dec))
262         vn_cs_decoder_set_fatal(dec);
263     return NULL;
264 }
265 
266 static inline void
vn_decode_VkSemaphoreSignalInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreSignalInfo * val)267 vn_decode_VkSemaphoreSignalInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreSignalInfo *val)
268 {
269     /* skip val->{sType,pNext} */
270     vn_decode_VkSemaphore_lookup(dec, &val->semaphore);
271     vn_decode_uint64_t(dec, &val->value);
272 }
273 
274 static inline void
vn_decode_VkSemaphoreSignalInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreSignalInfo * val)275 vn_decode_VkSemaphoreSignalInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreSignalInfo *val)
276 {
277     VkStructureType stype;
278     vn_decode_VkStructureType(dec, &stype);
279     if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO)
280         vn_cs_decoder_set_fatal(dec);
281 
282     val->sType = stype;
283     val->pNext = vn_decode_VkSemaphoreSignalInfo_pnext_temp(dec);
284     vn_decode_VkSemaphoreSignalInfo_self_temp(dec, val);
285 }
286 
287 static inline void
vn_replace_VkSemaphoreSignalInfo_handle_self(VkSemaphoreSignalInfo * val)288 vn_replace_VkSemaphoreSignalInfo_handle_self(VkSemaphoreSignalInfo *val)
289 {
290     /* skip val->sType */
291     /* skip val->pNext */
292     vn_replace_VkSemaphore_handle(&val->semaphore);
293     /* skip val->value */
294 }
295 
296 static inline void
vn_replace_VkSemaphoreSignalInfo_handle(VkSemaphoreSignalInfo * val)297 vn_replace_VkSemaphoreSignalInfo_handle(VkSemaphoreSignalInfo *val)
298 {
299     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
300 
301     do {
302         switch ((int32_t)pnext->sType) {
303         case VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO:
304             vn_replace_VkSemaphoreSignalInfo_handle_self((VkSemaphoreSignalInfo *)pnext);
305             break;
306         default:
307             /* ignore unknown/unsupported struct */
308             break;
309         }
310         pnext = pnext->pNext;
311     } while (pnext);
312 }
313 
314 /* struct VkImportSemaphoreResourceInfo100000MESA chain */
315 
316 static inline void *
vn_decode_VkImportSemaphoreResourceInfo100000MESA_pnext_temp(struct vn_cs_decoder * dec)317 vn_decode_VkImportSemaphoreResourceInfo100000MESA_pnext_temp(struct vn_cs_decoder *dec)
318 {
319     /* no known/supported struct */
320     if (vn_decode_simple_pointer(dec))
321         vn_cs_decoder_set_fatal(dec);
322     return NULL;
323 }
324 
325 static inline void
vn_decode_VkImportSemaphoreResourceInfo100000MESA_self_temp(struct vn_cs_decoder * dec,VkImportSemaphoreResourceInfo100000MESA * val)326 vn_decode_VkImportSemaphoreResourceInfo100000MESA_self_temp(struct vn_cs_decoder *dec, VkImportSemaphoreResourceInfo100000MESA *val)
327 {
328     /* skip val->{sType,pNext} */
329     vn_decode_VkSemaphore_lookup(dec, &val->semaphore);
330     vn_decode_uint32_t(dec, &val->resourceId);
331 }
332 
333 static inline void
vn_decode_VkImportSemaphoreResourceInfo100000MESA_temp(struct vn_cs_decoder * dec,VkImportSemaphoreResourceInfo100000MESA * val)334 vn_decode_VkImportSemaphoreResourceInfo100000MESA_temp(struct vn_cs_decoder *dec, VkImportSemaphoreResourceInfo100000MESA *val)
335 {
336     VkStructureType stype;
337     vn_decode_VkStructureType(dec, &stype);
338     if (stype != VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_RESOURCE_INFO_100000_MESA)
339         vn_cs_decoder_set_fatal(dec);
340 
341     val->sType = stype;
342     val->pNext = vn_decode_VkImportSemaphoreResourceInfo100000MESA_pnext_temp(dec);
343     vn_decode_VkImportSemaphoreResourceInfo100000MESA_self_temp(dec, val);
344 }
345 
346 static inline void
vn_replace_VkImportSemaphoreResourceInfo100000MESA_handle_self(VkImportSemaphoreResourceInfo100000MESA * val)347 vn_replace_VkImportSemaphoreResourceInfo100000MESA_handle_self(VkImportSemaphoreResourceInfo100000MESA *val)
348 {
349     /* skip val->sType */
350     /* skip val->pNext */
351     vn_replace_VkSemaphore_handle(&val->semaphore);
352     /* skip val->resourceId */
353 }
354 
355 static inline void
vn_replace_VkImportSemaphoreResourceInfo100000MESA_handle(VkImportSemaphoreResourceInfo100000MESA * val)356 vn_replace_VkImportSemaphoreResourceInfo100000MESA_handle(VkImportSemaphoreResourceInfo100000MESA *val)
357 {
358     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
359 
360     do {
361         switch ((int32_t)pnext->sType) {
362         case VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_RESOURCE_INFO_100000_MESA:
363             vn_replace_VkImportSemaphoreResourceInfo100000MESA_handle_self((VkImportSemaphoreResourceInfo100000MESA *)pnext);
364             break;
365         default:
366             /* ignore unknown/unsupported struct */
367             break;
368         }
369         pnext = pnext->pNext;
370     } while (pnext);
371 }
372 
vn_decode_vkCreateSemaphore_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateSemaphore * args)373 static inline void vn_decode_vkCreateSemaphore_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateSemaphore *args)
374 {
375     vn_decode_VkDevice_lookup(dec, &args->device);
376     if (vn_decode_simple_pointer(dec)) {
377         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
378         if (!args->pCreateInfo) return;
379         vn_decode_VkSemaphoreCreateInfo_temp(dec, (VkSemaphoreCreateInfo *)args->pCreateInfo);
380     } else {
381         args->pCreateInfo = NULL;
382         vn_cs_decoder_set_fatal(dec);
383     }
384     if (vn_decode_simple_pointer(dec)) {
385         vn_cs_decoder_set_fatal(dec);
386     } else {
387         args->pAllocator = NULL;
388     }
389     if (vn_decode_simple_pointer(dec)) {
390         args->pSemaphore = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSemaphore));
391         if (!args->pSemaphore) return;
392         vn_decode_VkSemaphore(dec, args->pSemaphore);
393     } else {
394         args->pSemaphore = NULL;
395         vn_cs_decoder_set_fatal(dec);
396     }
397 }
398 
vn_replace_vkCreateSemaphore_args_handle(struct vn_command_vkCreateSemaphore * args)399 static inline void vn_replace_vkCreateSemaphore_args_handle(struct vn_command_vkCreateSemaphore *args)
400 {
401     vn_replace_VkDevice_handle(&args->device);
402     if (args->pCreateInfo)
403         vn_replace_VkSemaphoreCreateInfo_handle((VkSemaphoreCreateInfo *)args->pCreateInfo);
404     /* skip args->pAllocator */
405     /* skip args->pSemaphore */
406 }
407 
vn_encode_vkCreateSemaphore_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateSemaphore * args)408 static inline void vn_encode_vkCreateSemaphore_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateSemaphore *args)
409 {
410     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateSemaphore_EXT});
411 
412     vn_encode_VkResult(enc, &args->ret);
413     /* skip args->device */
414     /* skip args->pCreateInfo */
415     /* skip args->pAllocator */
416     if (vn_encode_simple_pointer(enc, args->pSemaphore))
417         vn_encode_VkSemaphore(enc, args->pSemaphore);
418 }
419 
vn_decode_vkDestroySemaphore_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroySemaphore * args)420 static inline void vn_decode_vkDestroySemaphore_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroySemaphore *args)
421 {
422     vn_decode_VkDevice_lookup(dec, &args->device);
423     vn_decode_VkSemaphore_lookup(dec, &args->semaphore);
424     if (vn_decode_simple_pointer(dec)) {
425         vn_cs_decoder_set_fatal(dec);
426     } else {
427         args->pAllocator = NULL;
428     }
429 }
430 
vn_replace_vkDestroySemaphore_args_handle(struct vn_command_vkDestroySemaphore * args)431 static inline void vn_replace_vkDestroySemaphore_args_handle(struct vn_command_vkDestroySemaphore *args)
432 {
433     vn_replace_VkDevice_handle(&args->device);
434     vn_replace_VkSemaphore_handle(&args->semaphore);
435     /* skip args->pAllocator */
436 }
437 
vn_encode_vkDestroySemaphore_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroySemaphore * args)438 static inline void vn_encode_vkDestroySemaphore_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroySemaphore *args)
439 {
440     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroySemaphore_EXT});
441 
442     /* skip args->device */
443     /* skip args->semaphore */
444     /* skip args->pAllocator */
445 }
446 
vn_decode_vkGetSemaphoreCounterValue_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetSemaphoreCounterValue * args)447 static inline void vn_decode_vkGetSemaphoreCounterValue_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetSemaphoreCounterValue *args)
448 {
449     vn_decode_VkDevice_lookup(dec, &args->device);
450     vn_decode_VkSemaphore_lookup(dec, &args->semaphore);
451     if (vn_decode_simple_pointer(dec)) {
452         args->pValue = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pValue));
453         if (!args->pValue) return;
454     } else {
455         args->pValue = NULL;
456         vn_cs_decoder_set_fatal(dec);
457     }
458 }
459 
vn_replace_vkGetSemaphoreCounterValue_args_handle(struct vn_command_vkGetSemaphoreCounterValue * args)460 static inline void vn_replace_vkGetSemaphoreCounterValue_args_handle(struct vn_command_vkGetSemaphoreCounterValue *args)
461 {
462     vn_replace_VkDevice_handle(&args->device);
463     vn_replace_VkSemaphore_handle(&args->semaphore);
464     /* skip args->pValue */
465 }
466 
vn_encode_vkGetSemaphoreCounterValue_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetSemaphoreCounterValue * args)467 static inline void vn_encode_vkGetSemaphoreCounterValue_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetSemaphoreCounterValue *args)
468 {
469     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetSemaphoreCounterValue_EXT});
470 
471     vn_encode_VkResult(enc, &args->ret);
472     /* skip args->device */
473     /* skip args->semaphore */
474     if (vn_encode_simple_pointer(enc, args->pValue))
475         vn_encode_uint64_t(enc, args->pValue);
476 }
477 
vn_decode_vkWaitSemaphores_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkWaitSemaphores * args)478 static inline void vn_decode_vkWaitSemaphores_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkWaitSemaphores *args)
479 {
480     vn_decode_VkDevice_lookup(dec, &args->device);
481     if (vn_decode_simple_pointer(dec)) {
482         args->pWaitInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pWaitInfo));
483         if (!args->pWaitInfo) return;
484         vn_decode_VkSemaphoreWaitInfo_temp(dec, (VkSemaphoreWaitInfo *)args->pWaitInfo);
485     } else {
486         args->pWaitInfo = NULL;
487         vn_cs_decoder_set_fatal(dec);
488     }
489     vn_decode_uint64_t(dec, &args->timeout);
490 }
491 
vn_replace_vkWaitSemaphores_args_handle(struct vn_command_vkWaitSemaphores * args)492 static inline void vn_replace_vkWaitSemaphores_args_handle(struct vn_command_vkWaitSemaphores *args)
493 {
494     vn_replace_VkDevice_handle(&args->device);
495     if (args->pWaitInfo)
496         vn_replace_VkSemaphoreWaitInfo_handle((VkSemaphoreWaitInfo *)args->pWaitInfo);
497     /* skip args->timeout */
498 }
499 
vn_encode_vkWaitSemaphores_reply(struct vn_cs_encoder * enc,const struct vn_command_vkWaitSemaphores * args)500 static inline void vn_encode_vkWaitSemaphores_reply(struct vn_cs_encoder *enc, const struct vn_command_vkWaitSemaphores *args)
501 {
502     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkWaitSemaphores_EXT});
503 
504     vn_encode_VkResult(enc, &args->ret);
505     /* skip args->device */
506     /* skip args->pWaitInfo */
507     /* skip args->timeout */
508 }
509 
vn_decode_vkSignalSemaphore_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkSignalSemaphore * args)510 static inline void vn_decode_vkSignalSemaphore_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkSignalSemaphore *args)
511 {
512     vn_decode_VkDevice_lookup(dec, &args->device);
513     if (vn_decode_simple_pointer(dec)) {
514         args->pSignalInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSignalInfo));
515         if (!args->pSignalInfo) return;
516         vn_decode_VkSemaphoreSignalInfo_temp(dec, (VkSemaphoreSignalInfo *)args->pSignalInfo);
517     } else {
518         args->pSignalInfo = NULL;
519         vn_cs_decoder_set_fatal(dec);
520     }
521 }
522 
vn_replace_vkSignalSemaphore_args_handle(struct vn_command_vkSignalSemaphore * args)523 static inline void vn_replace_vkSignalSemaphore_args_handle(struct vn_command_vkSignalSemaphore *args)
524 {
525     vn_replace_VkDevice_handle(&args->device);
526     if (args->pSignalInfo)
527         vn_replace_VkSemaphoreSignalInfo_handle((VkSemaphoreSignalInfo *)args->pSignalInfo);
528 }
529 
vn_encode_vkSignalSemaphore_reply(struct vn_cs_encoder * enc,const struct vn_command_vkSignalSemaphore * args)530 static inline void vn_encode_vkSignalSemaphore_reply(struct vn_cs_encoder *enc, const struct vn_command_vkSignalSemaphore *args)
531 {
532     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkSignalSemaphore_EXT});
533 
534     vn_encode_VkResult(enc, &args->ret);
535     /* skip args->device */
536     /* skip args->pSignalInfo */
537 }
538 
vn_decode_vkWaitSemaphoreResource100000MESA_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkWaitSemaphoreResource100000MESA * args)539 static inline void vn_decode_vkWaitSemaphoreResource100000MESA_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkWaitSemaphoreResource100000MESA *args)
540 {
541     vn_decode_VkDevice_lookup(dec, &args->device);
542     vn_decode_VkSemaphore_lookup(dec, &args->semaphore);
543 }
544 
vn_replace_vkWaitSemaphoreResource100000MESA_args_handle(struct vn_command_vkWaitSemaphoreResource100000MESA * args)545 static inline void vn_replace_vkWaitSemaphoreResource100000MESA_args_handle(struct vn_command_vkWaitSemaphoreResource100000MESA *args)
546 {
547     vn_replace_VkDevice_handle(&args->device);
548     vn_replace_VkSemaphore_handle(&args->semaphore);
549 }
550 
vn_encode_vkWaitSemaphoreResource100000MESA_reply(struct vn_cs_encoder * enc,const struct vn_command_vkWaitSemaphoreResource100000MESA * args)551 static inline void vn_encode_vkWaitSemaphoreResource100000MESA_reply(struct vn_cs_encoder *enc, const struct vn_command_vkWaitSemaphoreResource100000MESA *args)
552 {
553     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkWaitSemaphoreResource100000MESA_EXT});
554 
555     /* skip args->device */
556     /* skip args->semaphore */
557 }
558 
vn_decode_vkImportSemaphoreResource100000MESA_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkImportSemaphoreResource100000MESA * args)559 static inline void vn_decode_vkImportSemaphoreResource100000MESA_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkImportSemaphoreResource100000MESA *args)
560 {
561     vn_decode_VkDevice_lookup(dec, &args->device);
562     if (vn_decode_simple_pointer(dec)) {
563         args->pImportSemaphoreResourceInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pImportSemaphoreResourceInfo));
564         if (!args->pImportSemaphoreResourceInfo) return;
565         vn_decode_VkImportSemaphoreResourceInfo100000MESA_temp(dec, (VkImportSemaphoreResourceInfo100000MESA *)args->pImportSemaphoreResourceInfo);
566     } else {
567         args->pImportSemaphoreResourceInfo = NULL;
568         vn_cs_decoder_set_fatal(dec);
569     }
570 }
571 
vn_replace_vkImportSemaphoreResource100000MESA_args_handle(struct vn_command_vkImportSemaphoreResource100000MESA * args)572 static inline void vn_replace_vkImportSemaphoreResource100000MESA_args_handle(struct vn_command_vkImportSemaphoreResource100000MESA *args)
573 {
574     vn_replace_VkDevice_handle(&args->device);
575     if (args->pImportSemaphoreResourceInfo)
576         vn_replace_VkImportSemaphoreResourceInfo100000MESA_handle((VkImportSemaphoreResourceInfo100000MESA *)args->pImportSemaphoreResourceInfo);
577 }
578 
vn_encode_vkImportSemaphoreResource100000MESA_reply(struct vn_cs_encoder * enc,const struct vn_command_vkImportSemaphoreResource100000MESA * args)579 static inline void vn_encode_vkImportSemaphoreResource100000MESA_reply(struct vn_cs_encoder *enc, const struct vn_command_vkImportSemaphoreResource100000MESA *args)
580 {
581     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkImportSemaphoreResource100000MESA_EXT});
582 
583     /* skip args->device */
584     /* skip args->pImportSemaphoreResourceInfo */
585 }
586 
vn_dispatch_vkCreateSemaphore(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)587 static inline void vn_dispatch_vkCreateSemaphore(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
588 {
589     struct vn_command_vkCreateSemaphore args;
590 
591     if (!ctx->dispatch_vkCreateSemaphore) {
592         vn_cs_decoder_set_fatal(ctx->decoder);
593         return;
594     }
595 
596     vn_decode_vkCreateSemaphore_args_temp(ctx->decoder, &args);
597     if (!args.device) {
598         vn_cs_decoder_set_fatal(ctx->decoder);
599         return;
600     }
601 
602     if (!vn_cs_decoder_get_fatal(ctx->decoder))
603         ctx->dispatch_vkCreateSemaphore(ctx, &args);
604 
605 #ifdef DEBUG
606     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
607         vn_dispatch_debug_log(ctx, "vkCreateSemaphore returned %d", args.ret);
608 #endif
609 
610     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
611        vn_encode_vkCreateSemaphore_reply(ctx->encoder, &args);
612 
613     vn_cs_decoder_reset_temp_pool(ctx->decoder);
614 }
615 
vn_dispatch_vkDestroySemaphore(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)616 static inline void vn_dispatch_vkDestroySemaphore(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
617 {
618     struct vn_command_vkDestroySemaphore args;
619 
620     if (!ctx->dispatch_vkDestroySemaphore) {
621         vn_cs_decoder_set_fatal(ctx->decoder);
622         return;
623     }
624 
625     vn_decode_vkDestroySemaphore_args_temp(ctx->decoder, &args);
626     if (!args.device) {
627         vn_cs_decoder_set_fatal(ctx->decoder);
628         return;
629     }
630 
631     if (!vn_cs_decoder_get_fatal(ctx->decoder))
632         ctx->dispatch_vkDestroySemaphore(ctx, &args);
633 
634 
635     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
636        vn_encode_vkDestroySemaphore_reply(ctx->encoder, &args);
637 
638     vn_cs_decoder_reset_temp_pool(ctx->decoder);
639 }
640 
vn_dispatch_vkGetSemaphoreCounterValue(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)641 static inline void vn_dispatch_vkGetSemaphoreCounterValue(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
642 {
643     struct vn_command_vkGetSemaphoreCounterValue args;
644 
645     if (!ctx->dispatch_vkGetSemaphoreCounterValue) {
646         vn_cs_decoder_set_fatal(ctx->decoder);
647         return;
648     }
649 
650     vn_decode_vkGetSemaphoreCounterValue_args_temp(ctx->decoder, &args);
651     if (!args.device) {
652         vn_cs_decoder_set_fatal(ctx->decoder);
653         return;
654     }
655 
656     if (!vn_cs_decoder_get_fatal(ctx->decoder))
657         ctx->dispatch_vkGetSemaphoreCounterValue(ctx, &args);
658 
659 #ifdef DEBUG
660     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
661         vn_dispatch_debug_log(ctx, "vkGetSemaphoreCounterValue returned %d", args.ret);
662 #endif
663 
664     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
665        vn_encode_vkGetSemaphoreCounterValue_reply(ctx->encoder, &args);
666 
667     vn_cs_decoder_reset_temp_pool(ctx->decoder);
668 }
669 
vn_dispatch_vkWaitSemaphores(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)670 static inline void vn_dispatch_vkWaitSemaphores(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
671 {
672     struct vn_command_vkWaitSemaphores args;
673 
674     if (!ctx->dispatch_vkWaitSemaphores) {
675         vn_cs_decoder_set_fatal(ctx->decoder);
676         return;
677     }
678 
679     vn_decode_vkWaitSemaphores_args_temp(ctx->decoder, &args);
680     if (!args.device) {
681         vn_cs_decoder_set_fatal(ctx->decoder);
682         return;
683     }
684 
685     if (!vn_cs_decoder_get_fatal(ctx->decoder))
686         ctx->dispatch_vkWaitSemaphores(ctx, &args);
687 
688 #ifdef DEBUG
689     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
690         vn_dispatch_debug_log(ctx, "vkWaitSemaphores returned %d", args.ret);
691 #endif
692 
693     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
694        vn_encode_vkWaitSemaphores_reply(ctx->encoder, &args);
695 
696     vn_cs_decoder_reset_temp_pool(ctx->decoder);
697 }
698 
vn_dispatch_vkSignalSemaphore(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)699 static inline void vn_dispatch_vkSignalSemaphore(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
700 {
701     struct vn_command_vkSignalSemaphore args;
702 
703     if (!ctx->dispatch_vkSignalSemaphore) {
704         vn_cs_decoder_set_fatal(ctx->decoder);
705         return;
706     }
707 
708     vn_decode_vkSignalSemaphore_args_temp(ctx->decoder, &args);
709     if (!args.device) {
710         vn_cs_decoder_set_fatal(ctx->decoder);
711         return;
712     }
713 
714     if (!vn_cs_decoder_get_fatal(ctx->decoder))
715         ctx->dispatch_vkSignalSemaphore(ctx, &args);
716 
717 #ifdef DEBUG
718     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
719         vn_dispatch_debug_log(ctx, "vkSignalSemaphore returned %d", args.ret);
720 #endif
721 
722     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
723        vn_encode_vkSignalSemaphore_reply(ctx->encoder, &args);
724 
725     vn_cs_decoder_reset_temp_pool(ctx->decoder);
726 }
727 
vn_dispatch_vkWaitSemaphoreResource100000MESA(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)728 static inline void vn_dispatch_vkWaitSemaphoreResource100000MESA(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
729 {
730     struct vn_command_vkWaitSemaphoreResource100000MESA args;
731 
732     if (!ctx->dispatch_vkWaitSemaphoreResource100000MESA) {
733         vn_cs_decoder_set_fatal(ctx->decoder);
734         return;
735     }
736 
737     vn_decode_vkWaitSemaphoreResource100000MESA_args_temp(ctx->decoder, &args);
738     if (!args.device) {
739         vn_cs_decoder_set_fatal(ctx->decoder);
740         return;
741     }
742 
743     if (!vn_cs_decoder_get_fatal(ctx->decoder))
744         ctx->dispatch_vkWaitSemaphoreResource100000MESA(ctx, &args);
745 
746 
747     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
748        vn_encode_vkWaitSemaphoreResource100000MESA_reply(ctx->encoder, &args);
749 
750     vn_cs_decoder_reset_temp_pool(ctx->decoder);
751 }
752 
vn_dispatch_vkImportSemaphoreResource100000MESA(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)753 static inline void vn_dispatch_vkImportSemaphoreResource100000MESA(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
754 {
755     struct vn_command_vkImportSemaphoreResource100000MESA args;
756 
757     if (!ctx->dispatch_vkImportSemaphoreResource100000MESA) {
758         vn_cs_decoder_set_fatal(ctx->decoder);
759         return;
760     }
761 
762     vn_decode_vkImportSemaphoreResource100000MESA_args_temp(ctx->decoder, &args);
763     if (!args.device) {
764         vn_cs_decoder_set_fatal(ctx->decoder);
765         return;
766     }
767 
768     if (!vn_cs_decoder_get_fatal(ctx->decoder))
769         ctx->dispatch_vkImportSemaphoreResource100000MESA(ctx, &args);
770 
771 
772     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
773        vn_encode_vkImportSemaphoreResource100000MESA_reply(ctx->encoder, &args);
774 
775     vn_cs_decoder_reset_temp_pool(ctx->decoder);
776 }
777 
778 #pragma GCC diagnostic pop
779 
780 #endif /* VN_PROTOCOL_RENDERER_SEMAPHORE_H */
781