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 /* struct VkExportSemaphoreCreateInfo chain */
18
19 static inline void *
vn_decode_VkExportSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder * dec)20 vn_decode_VkExportSemaphoreCreateInfo_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_VkExportSemaphoreCreateInfo_self_temp(struct vn_cs_decoder * dec,VkExportSemaphoreCreateInfo * val)29 vn_decode_VkExportSemaphoreCreateInfo_self_temp(struct vn_cs_decoder *dec, VkExportSemaphoreCreateInfo *val)
30 {
31 /* skip val->{sType,pNext} */
32 vn_decode_VkFlags(dec, &val->handleTypes);
33 }
34
35 static inline void
vn_decode_VkExportSemaphoreCreateInfo_temp(struct vn_cs_decoder * dec,VkExportSemaphoreCreateInfo * val)36 vn_decode_VkExportSemaphoreCreateInfo_temp(struct vn_cs_decoder *dec, VkExportSemaphoreCreateInfo *val)
37 {
38 VkStructureType stype;
39 vn_decode_VkStructureType(dec, &stype);
40 if (stype != VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO)
41 vn_cs_decoder_set_fatal(dec);
42
43 val->sType = stype;
44 val->pNext = vn_decode_VkExportSemaphoreCreateInfo_pnext_temp(dec);
45 vn_decode_VkExportSemaphoreCreateInfo_self_temp(dec, val);
46 }
47
48 static inline void
vn_replace_VkExportSemaphoreCreateInfo_handle_self(VkExportSemaphoreCreateInfo * val)49 vn_replace_VkExportSemaphoreCreateInfo_handle_self(VkExportSemaphoreCreateInfo *val)
50 {
51 /* skip val->sType */
52 /* skip val->pNext */
53 /* skip val->handleTypes */
54 }
55
56 static inline void
vn_replace_VkExportSemaphoreCreateInfo_handle(VkExportSemaphoreCreateInfo * val)57 vn_replace_VkExportSemaphoreCreateInfo_handle(VkExportSemaphoreCreateInfo *val)
58 {
59 struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
60
61 do {
62 switch ((int32_t)pnext->sType) {
63 case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO:
64 vn_replace_VkExportSemaphoreCreateInfo_handle_self((VkExportSemaphoreCreateInfo *)pnext);
65 break;
66 default:
67 /* ignore unknown/unsupported struct */
68 break;
69 }
70 pnext = pnext->pNext;
71 } while (pnext);
72 }
73
74 /* struct VkSemaphoreCreateInfo chain */
75
76 static inline void *
vn_decode_VkSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder * dec)77 vn_decode_VkSemaphoreCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
78 {
79 VkBaseOutStructure *pnext;
80 VkStructureType stype;
81
82 if (!vn_decode_simple_pointer(dec))
83 return NULL;
84
85 vn_decode_VkStructureType(dec, &stype);
86 switch ((int32_t)stype) {
87 case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO:
88 pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkExportSemaphoreCreateInfo));
89 if (pnext) {
90 pnext->sType = stype;
91 pnext->pNext = vn_decode_VkSemaphoreCreateInfo_pnext_temp(dec);
92 vn_decode_VkExportSemaphoreCreateInfo_self_temp(dec, (VkExportSemaphoreCreateInfo *)pnext);
93 }
94 break;
95 case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO:
96 pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkSemaphoreTypeCreateInfo));
97 if (pnext) {
98 pnext->sType = stype;
99 pnext->pNext = vn_decode_VkSemaphoreCreateInfo_pnext_temp(dec);
100 vn_decode_VkSemaphoreTypeCreateInfo_self_temp(dec, (VkSemaphoreTypeCreateInfo *)pnext);
101 }
102 break;
103 default:
104 /* unexpected struct */
105 pnext = NULL;
106 vn_cs_decoder_set_fatal(dec);
107 break;
108 }
109
110 return pnext;
111 }
112
113 static inline void
vn_decode_VkSemaphoreCreateInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreCreateInfo * val)114 vn_decode_VkSemaphoreCreateInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreCreateInfo *val)
115 {
116 /* skip val->{sType,pNext} */
117 vn_decode_VkFlags(dec, &val->flags);
118 }
119
120 static inline void
vn_decode_VkSemaphoreCreateInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreCreateInfo * val)121 vn_decode_VkSemaphoreCreateInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreCreateInfo *val)
122 {
123 VkStructureType stype;
124 vn_decode_VkStructureType(dec, &stype);
125 if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
126 vn_cs_decoder_set_fatal(dec);
127
128 val->sType = stype;
129 val->pNext = vn_decode_VkSemaphoreCreateInfo_pnext_temp(dec);
130 vn_decode_VkSemaphoreCreateInfo_self_temp(dec, val);
131 }
132
133 static inline void
vn_replace_VkSemaphoreCreateInfo_handle_self(VkSemaphoreCreateInfo * val)134 vn_replace_VkSemaphoreCreateInfo_handle_self(VkSemaphoreCreateInfo *val)
135 {
136 /* skip val->sType */
137 /* skip val->pNext */
138 /* skip val->flags */
139 }
140
141 static inline void
vn_replace_VkSemaphoreCreateInfo_handle(VkSemaphoreCreateInfo * val)142 vn_replace_VkSemaphoreCreateInfo_handle(VkSemaphoreCreateInfo *val)
143 {
144 struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
145
146 do {
147 switch ((int32_t)pnext->sType) {
148 case VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO:
149 vn_replace_VkSemaphoreCreateInfo_handle_self((VkSemaphoreCreateInfo *)pnext);
150 break;
151 case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO:
152 vn_replace_VkExportSemaphoreCreateInfo_handle_self((VkExportSemaphoreCreateInfo *)pnext);
153 break;
154 case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO:
155 vn_replace_VkSemaphoreTypeCreateInfo_handle_self((VkSemaphoreTypeCreateInfo *)pnext);
156 break;
157 default:
158 /* ignore unknown/unsupported struct */
159 break;
160 }
161 pnext = pnext->pNext;
162 } while (pnext);
163 }
164
165 /* struct VkSemaphoreWaitInfo chain */
166
167 static inline void *
vn_decode_VkSemaphoreWaitInfo_pnext_temp(struct vn_cs_decoder * dec)168 vn_decode_VkSemaphoreWaitInfo_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_VkSemaphoreWaitInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreWaitInfo * val)177 vn_decode_VkSemaphoreWaitInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreWaitInfo *val)
178 {
179 /* skip val->{sType,pNext} */
180 vn_decode_VkFlags(dec, &val->flags);
181 vn_decode_uint32_t(dec, &val->semaphoreCount);
182 if (vn_peek_array_size(dec)) {
183 const uint32_t iter_count = vn_decode_array_size(dec, val->semaphoreCount);
184 val->pSemaphores = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pSemaphores) * iter_count);
185 if (!val->pSemaphores) return;
186 for (uint32_t i = 0; i < iter_count; i++)
187 vn_decode_VkSemaphore_lookup(dec, &((VkSemaphore *)val->pSemaphores)[i]);
188 } else {
189 vn_decode_array_size(dec, val->semaphoreCount);
190 val->pSemaphores = NULL;
191 }
192 if (vn_peek_array_size(dec)) {
193 const size_t array_size = vn_decode_array_size(dec, val->semaphoreCount);
194 val->pValues = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pValues) * array_size);
195 if (!val->pValues) return;
196 vn_decode_uint64_t_array(dec, (uint64_t *)val->pValues, array_size);
197 } else {
198 vn_decode_array_size(dec, val->semaphoreCount);
199 val->pValues = NULL;
200 }
201 }
202
203 static inline void
vn_decode_VkSemaphoreWaitInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreWaitInfo * val)204 vn_decode_VkSemaphoreWaitInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreWaitInfo *val)
205 {
206 VkStructureType stype;
207 vn_decode_VkStructureType(dec, &stype);
208 if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO)
209 vn_cs_decoder_set_fatal(dec);
210
211 val->sType = stype;
212 val->pNext = vn_decode_VkSemaphoreWaitInfo_pnext_temp(dec);
213 vn_decode_VkSemaphoreWaitInfo_self_temp(dec, val);
214 }
215
216 static inline void
vn_replace_VkSemaphoreWaitInfo_handle_self(VkSemaphoreWaitInfo * val)217 vn_replace_VkSemaphoreWaitInfo_handle_self(VkSemaphoreWaitInfo *val)
218 {
219 /* skip val->sType */
220 /* skip val->pNext */
221 /* skip val->flags */
222 /* skip val->semaphoreCount */
223 if (val->pSemaphores) {
224 for (uint32_t i = 0; i < val->semaphoreCount; i++)
225 vn_replace_VkSemaphore_handle(&((VkSemaphore *)val->pSemaphores)[i]);
226 }
227 /* skip val->pValues */
228 }
229
230 static inline void
vn_replace_VkSemaphoreWaitInfo_handle(VkSemaphoreWaitInfo * val)231 vn_replace_VkSemaphoreWaitInfo_handle(VkSemaphoreWaitInfo *val)
232 {
233 struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
234
235 do {
236 switch ((int32_t)pnext->sType) {
237 case VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO:
238 vn_replace_VkSemaphoreWaitInfo_handle_self((VkSemaphoreWaitInfo *)pnext);
239 break;
240 default:
241 /* ignore unknown/unsupported struct */
242 break;
243 }
244 pnext = pnext->pNext;
245 } while (pnext);
246 }
247
248 /* struct VkSemaphoreSignalInfo chain */
249
250 static inline void
vn_encode_VkSemaphoreSignalInfo_pnext(struct vn_cs_encoder * enc,const void * val)251 vn_encode_VkSemaphoreSignalInfo_pnext(struct vn_cs_encoder *enc, const void *val)
252 {
253 /* no known/supported struct */
254 vn_encode_simple_pointer(enc, NULL);
255 }
256
257 static inline void
vn_encode_VkSemaphoreSignalInfo_self(struct vn_cs_encoder * enc,const VkSemaphoreSignalInfo * val)258 vn_encode_VkSemaphoreSignalInfo_self(struct vn_cs_encoder *enc, const VkSemaphoreSignalInfo *val)
259 {
260 /* skip val->{sType,pNext} */
261 vn_encode_VkSemaphore(enc, &val->semaphore);
262 vn_encode_uint64_t(enc, &val->value);
263 }
264
265 static inline void
vn_encode_VkSemaphoreSignalInfo(struct vn_cs_encoder * enc,const VkSemaphoreSignalInfo * val)266 vn_encode_VkSemaphoreSignalInfo(struct vn_cs_encoder *enc, const VkSemaphoreSignalInfo *val)
267 {
268 assert(val->sType == VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO);
269 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO });
270 vn_encode_VkSemaphoreSignalInfo_pnext(enc, val->pNext);
271 vn_encode_VkSemaphoreSignalInfo_self(enc, val);
272 }
273
274 static inline void *
vn_decode_VkSemaphoreSignalInfo_pnext_temp(struct vn_cs_decoder * dec)275 vn_decode_VkSemaphoreSignalInfo_pnext_temp(struct vn_cs_decoder *dec)
276 {
277 /* no known/supported struct */
278 if (vn_decode_simple_pointer(dec))
279 vn_cs_decoder_set_fatal(dec);
280 return NULL;
281 }
282
283 static inline void
vn_decode_VkSemaphoreSignalInfo_self_temp(struct vn_cs_decoder * dec,VkSemaphoreSignalInfo * val)284 vn_decode_VkSemaphoreSignalInfo_self_temp(struct vn_cs_decoder *dec, VkSemaphoreSignalInfo *val)
285 {
286 /* skip val->{sType,pNext} */
287 vn_decode_VkSemaphore_lookup(dec, &val->semaphore);
288 vn_decode_uint64_t(dec, &val->value);
289 }
290
291 static inline void
vn_decode_VkSemaphoreSignalInfo_temp(struct vn_cs_decoder * dec,VkSemaphoreSignalInfo * val)292 vn_decode_VkSemaphoreSignalInfo_temp(struct vn_cs_decoder *dec, VkSemaphoreSignalInfo *val)
293 {
294 VkStructureType stype;
295 vn_decode_VkStructureType(dec, &stype);
296 if (stype != VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO)
297 vn_cs_decoder_set_fatal(dec);
298
299 val->sType = stype;
300 val->pNext = vn_decode_VkSemaphoreSignalInfo_pnext_temp(dec);
301 vn_decode_VkSemaphoreSignalInfo_self_temp(dec, val);
302 }
303
304 static inline void
vn_replace_VkSemaphoreSignalInfo_handle_self(VkSemaphoreSignalInfo * val)305 vn_replace_VkSemaphoreSignalInfo_handle_self(VkSemaphoreSignalInfo *val)
306 {
307 /* skip val->sType */
308 /* skip val->pNext */
309 vn_replace_VkSemaphore_handle(&val->semaphore);
310 /* skip val->value */
311 }
312
313 static inline void
vn_replace_VkSemaphoreSignalInfo_handle(VkSemaphoreSignalInfo * val)314 vn_replace_VkSemaphoreSignalInfo_handle(VkSemaphoreSignalInfo *val)
315 {
316 struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
317
318 do {
319 switch ((int32_t)pnext->sType) {
320 case VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO:
321 vn_replace_VkSemaphoreSignalInfo_handle_self((VkSemaphoreSignalInfo *)pnext);
322 break;
323 default:
324 /* ignore unknown/unsupported struct */
325 break;
326 }
327 pnext = pnext->pNext;
328 } while (pnext);
329 }
330
vn_decode_vkCreateSemaphore_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateSemaphore * args)331 static inline void vn_decode_vkCreateSemaphore_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateSemaphore *args)
332 {
333 vn_decode_VkDevice_lookup(dec, &args->device);
334 if (vn_decode_simple_pointer(dec)) {
335 args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
336 if (!args->pCreateInfo) return;
337 vn_decode_VkSemaphoreCreateInfo_temp(dec, (VkSemaphoreCreateInfo *)args->pCreateInfo);
338 } else {
339 args->pCreateInfo = NULL;
340 vn_cs_decoder_set_fatal(dec);
341 }
342 if (vn_decode_simple_pointer(dec)) {
343 vn_cs_decoder_set_fatal(dec);
344 } else {
345 args->pAllocator = NULL;
346 }
347 if (vn_decode_simple_pointer(dec)) {
348 args->pSemaphore = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSemaphore));
349 if (!args->pSemaphore) return;
350 vn_decode_VkSemaphore(dec, args->pSemaphore);
351 } else {
352 args->pSemaphore = NULL;
353 vn_cs_decoder_set_fatal(dec);
354 }
355 }
356
vn_replace_vkCreateSemaphore_args_handle(struct vn_command_vkCreateSemaphore * args)357 static inline void vn_replace_vkCreateSemaphore_args_handle(struct vn_command_vkCreateSemaphore *args)
358 {
359 vn_replace_VkDevice_handle(&args->device);
360 if (args->pCreateInfo)
361 vn_replace_VkSemaphoreCreateInfo_handle((VkSemaphoreCreateInfo *)args->pCreateInfo);
362 /* skip args->pAllocator */
363 /* skip args->pSemaphore */
364 }
365
vn_encode_vkCreateSemaphore_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateSemaphore * args)366 static inline void vn_encode_vkCreateSemaphore_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateSemaphore *args)
367 {
368 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateSemaphore_EXT});
369
370 vn_encode_VkResult(enc, &args->ret);
371 /* skip args->device */
372 /* skip args->pCreateInfo */
373 /* skip args->pAllocator */
374 if (vn_encode_simple_pointer(enc, args->pSemaphore))
375 vn_encode_VkSemaphore(enc, args->pSemaphore);
376 }
377
vn_decode_vkDestroySemaphore_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroySemaphore * args)378 static inline void vn_decode_vkDestroySemaphore_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroySemaphore *args)
379 {
380 vn_decode_VkDevice_lookup(dec, &args->device);
381 vn_decode_VkSemaphore_lookup(dec, &args->semaphore);
382 if (vn_decode_simple_pointer(dec)) {
383 vn_cs_decoder_set_fatal(dec);
384 } else {
385 args->pAllocator = NULL;
386 }
387 }
388
vn_replace_vkDestroySemaphore_args_handle(struct vn_command_vkDestroySemaphore * args)389 static inline void vn_replace_vkDestroySemaphore_args_handle(struct vn_command_vkDestroySemaphore *args)
390 {
391 vn_replace_VkDevice_handle(&args->device);
392 vn_replace_VkSemaphore_handle(&args->semaphore);
393 /* skip args->pAllocator */
394 }
395
vn_encode_vkDestroySemaphore_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroySemaphore * args)396 static inline void vn_encode_vkDestroySemaphore_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroySemaphore *args)
397 {
398 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroySemaphore_EXT});
399
400 /* skip args->device */
401 /* skip args->semaphore */
402 /* skip args->pAllocator */
403 }
404
vn_decode_vkGetSemaphoreCounterValue_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetSemaphoreCounterValue * args)405 static inline void vn_decode_vkGetSemaphoreCounterValue_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetSemaphoreCounterValue *args)
406 {
407 vn_decode_VkDevice_lookup(dec, &args->device);
408 vn_decode_VkSemaphore_lookup(dec, &args->semaphore);
409 if (vn_decode_simple_pointer(dec)) {
410 args->pValue = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pValue));
411 if (!args->pValue) return;
412 } else {
413 args->pValue = NULL;
414 vn_cs_decoder_set_fatal(dec);
415 }
416 }
417
vn_replace_vkGetSemaphoreCounterValue_args_handle(struct vn_command_vkGetSemaphoreCounterValue * args)418 static inline void vn_replace_vkGetSemaphoreCounterValue_args_handle(struct vn_command_vkGetSemaphoreCounterValue *args)
419 {
420 vn_replace_VkDevice_handle(&args->device);
421 vn_replace_VkSemaphore_handle(&args->semaphore);
422 /* skip args->pValue */
423 }
424
vn_encode_vkGetSemaphoreCounterValue_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetSemaphoreCounterValue * args)425 static inline void vn_encode_vkGetSemaphoreCounterValue_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetSemaphoreCounterValue *args)
426 {
427 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetSemaphoreCounterValue_EXT});
428
429 vn_encode_VkResult(enc, &args->ret);
430 /* skip args->device */
431 /* skip args->semaphore */
432 if (vn_encode_simple_pointer(enc, args->pValue))
433 vn_encode_uint64_t(enc, args->pValue);
434 }
435
vn_decode_vkWaitSemaphores_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkWaitSemaphores * args)436 static inline void vn_decode_vkWaitSemaphores_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkWaitSemaphores *args)
437 {
438 vn_decode_VkDevice_lookup(dec, &args->device);
439 if (vn_decode_simple_pointer(dec)) {
440 args->pWaitInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pWaitInfo));
441 if (!args->pWaitInfo) return;
442 vn_decode_VkSemaphoreWaitInfo_temp(dec, (VkSemaphoreWaitInfo *)args->pWaitInfo);
443 } else {
444 args->pWaitInfo = NULL;
445 vn_cs_decoder_set_fatal(dec);
446 }
447 vn_decode_uint64_t(dec, &args->timeout);
448 }
449
vn_replace_vkWaitSemaphores_args_handle(struct vn_command_vkWaitSemaphores * args)450 static inline void vn_replace_vkWaitSemaphores_args_handle(struct vn_command_vkWaitSemaphores *args)
451 {
452 vn_replace_VkDevice_handle(&args->device);
453 if (args->pWaitInfo)
454 vn_replace_VkSemaphoreWaitInfo_handle((VkSemaphoreWaitInfo *)args->pWaitInfo);
455 /* skip args->timeout */
456 }
457
vn_encode_vkWaitSemaphores_reply(struct vn_cs_encoder * enc,const struct vn_command_vkWaitSemaphores * args)458 static inline void vn_encode_vkWaitSemaphores_reply(struct vn_cs_encoder *enc, const struct vn_command_vkWaitSemaphores *args)
459 {
460 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkWaitSemaphores_EXT});
461
462 vn_encode_VkResult(enc, &args->ret);
463 /* skip args->device */
464 /* skip args->pWaitInfo */
465 /* skip args->timeout */
466 }
467
vn_decode_vkSignalSemaphore_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkSignalSemaphore * args)468 static inline void vn_decode_vkSignalSemaphore_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkSignalSemaphore *args)
469 {
470 vn_decode_VkDevice_lookup(dec, &args->device);
471 if (vn_decode_simple_pointer(dec)) {
472 args->pSignalInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSignalInfo));
473 if (!args->pSignalInfo) return;
474 vn_decode_VkSemaphoreSignalInfo_temp(dec, (VkSemaphoreSignalInfo *)args->pSignalInfo);
475 } else {
476 args->pSignalInfo = NULL;
477 vn_cs_decoder_set_fatal(dec);
478 }
479 }
480
vn_replace_vkSignalSemaphore_args_handle(struct vn_command_vkSignalSemaphore * args)481 static inline void vn_replace_vkSignalSemaphore_args_handle(struct vn_command_vkSignalSemaphore *args)
482 {
483 vn_replace_VkDevice_handle(&args->device);
484 if (args->pSignalInfo)
485 vn_replace_VkSemaphoreSignalInfo_handle((VkSemaphoreSignalInfo *)args->pSignalInfo);
486 }
487
vn_encode_vkSignalSemaphore_reply(struct vn_cs_encoder * enc,const struct vn_command_vkSignalSemaphore * args)488 static inline void vn_encode_vkSignalSemaphore_reply(struct vn_cs_encoder *enc, const struct vn_command_vkSignalSemaphore *args)
489 {
490 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkSignalSemaphore_EXT});
491
492 vn_encode_VkResult(enc, &args->ret);
493 /* skip args->device */
494 /* skip args->pSignalInfo */
495 }
496
vn_dispatch_vkCreateSemaphore(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)497 static inline void vn_dispatch_vkCreateSemaphore(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
498 {
499 struct vn_command_vkCreateSemaphore args;
500
501 if (!ctx->dispatch_vkCreateSemaphore) {
502 vn_cs_decoder_set_fatal(ctx->decoder);
503 return;
504 }
505
506 vn_decode_vkCreateSemaphore_args_temp(ctx->decoder, &args);
507 if (!args.device) {
508 vn_cs_decoder_set_fatal(ctx->decoder);
509 return;
510 }
511
512 if (!vn_cs_decoder_get_fatal(ctx->decoder))
513 ctx->dispatch_vkCreateSemaphore(ctx, &args);
514
515 #ifdef DEBUG
516 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
517 vn_dispatch_debug_log(ctx, "vkCreateSemaphore returned %d", args.ret);
518 #endif
519
520 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
521 vn_encode_vkCreateSemaphore_reply(ctx->encoder, &args);
522
523 vn_cs_decoder_reset_temp_pool(ctx->decoder);
524 }
525
vn_dispatch_vkDestroySemaphore(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)526 static inline void vn_dispatch_vkDestroySemaphore(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
527 {
528 struct vn_command_vkDestroySemaphore args;
529
530 if (!ctx->dispatch_vkDestroySemaphore) {
531 vn_cs_decoder_set_fatal(ctx->decoder);
532 return;
533 }
534
535 vn_decode_vkDestroySemaphore_args_temp(ctx->decoder, &args);
536 if (!args.device) {
537 vn_cs_decoder_set_fatal(ctx->decoder);
538 return;
539 }
540
541 if (!vn_cs_decoder_get_fatal(ctx->decoder))
542 ctx->dispatch_vkDestroySemaphore(ctx, &args);
543
544
545 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
546 vn_encode_vkDestroySemaphore_reply(ctx->encoder, &args);
547
548 vn_cs_decoder_reset_temp_pool(ctx->decoder);
549 }
550
vn_dispatch_vkGetSemaphoreCounterValue(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)551 static inline void vn_dispatch_vkGetSemaphoreCounterValue(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
552 {
553 struct vn_command_vkGetSemaphoreCounterValue args;
554
555 if (!ctx->dispatch_vkGetSemaphoreCounterValue) {
556 vn_cs_decoder_set_fatal(ctx->decoder);
557 return;
558 }
559
560 vn_decode_vkGetSemaphoreCounterValue_args_temp(ctx->decoder, &args);
561 if (!args.device) {
562 vn_cs_decoder_set_fatal(ctx->decoder);
563 return;
564 }
565
566 if (!vn_cs_decoder_get_fatal(ctx->decoder))
567 ctx->dispatch_vkGetSemaphoreCounterValue(ctx, &args);
568
569 #ifdef DEBUG
570 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
571 vn_dispatch_debug_log(ctx, "vkGetSemaphoreCounterValue returned %d", args.ret);
572 #endif
573
574 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
575 vn_encode_vkGetSemaphoreCounterValue_reply(ctx->encoder, &args);
576
577 vn_cs_decoder_reset_temp_pool(ctx->decoder);
578 }
579
vn_dispatch_vkWaitSemaphores(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)580 static inline void vn_dispatch_vkWaitSemaphores(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
581 {
582 struct vn_command_vkWaitSemaphores args;
583
584 if (!ctx->dispatch_vkWaitSemaphores) {
585 vn_cs_decoder_set_fatal(ctx->decoder);
586 return;
587 }
588
589 vn_decode_vkWaitSemaphores_args_temp(ctx->decoder, &args);
590 if (!args.device) {
591 vn_cs_decoder_set_fatal(ctx->decoder);
592 return;
593 }
594
595 if (!vn_cs_decoder_get_fatal(ctx->decoder))
596 ctx->dispatch_vkWaitSemaphores(ctx, &args);
597
598 #ifdef DEBUG
599 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
600 vn_dispatch_debug_log(ctx, "vkWaitSemaphores returned %d", args.ret);
601 #endif
602
603 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
604 vn_encode_vkWaitSemaphores_reply(ctx->encoder, &args);
605
606 vn_cs_decoder_reset_temp_pool(ctx->decoder);
607 }
608
vn_dispatch_vkSignalSemaphore(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)609 static inline void vn_dispatch_vkSignalSemaphore(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
610 {
611 struct vn_command_vkSignalSemaphore args;
612
613 if (!ctx->dispatch_vkSignalSemaphore) {
614 vn_cs_decoder_set_fatal(ctx->decoder);
615 return;
616 }
617
618 vn_decode_vkSignalSemaphore_args_temp(ctx->decoder, &args);
619 if (!args.device) {
620 vn_cs_decoder_set_fatal(ctx->decoder);
621 return;
622 }
623
624 if (!vn_cs_decoder_get_fatal(ctx->decoder))
625 ctx->dispatch_vkSignalSemaphore(ctx, &args);
626
627 #ifdef DEBUG
628 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
629 vn_dispatch_debug_log(ctx, "vkSignalSemaphore returned %d", args.ret);
630 #endif
631
632 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
633 vn_encode_vkSignalSemaphore_reply(ctx->encoder, &args);
634
635 vn_cs_decoder_reset_temp_pool(ctx->decoder);
636 }
637
638 #pragma GCC diagnostic pop
639
640 #endif /* VN_PROTOCOL_RENDERER_SEMAPHORE_H */
641