1 /* This file is generated by venus-protocol. See vn_protocol_driver.h. */
2
3 /*
4 * Copyright 2020 Google LLC
5 * SPDX-License-Identifier: MIT
6 */
7
8 #ifndef VN_PROTOCOL_DRIVER_EVENT_H
9 #define VN_PROTOCOL_DRIVER_EVENT_H
10
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13
14 /* struct VkEventCreateInfo chain */
15
16 static inline size_t
vn_sizeof_VkEventCreateInfo_pnext(const void * val)17 vn_sizeof_VkEventCreateInfo_pnext(const void *val)
18 {
19 /* no known/supported struct */
20 return vn_sizeof_simple_pointer(NULL);
21 }
22
23 static inline size_t
vn_sizeof_VkEventCreateInfo_self(const VkEventCreateInfo * val)24 vn_sizeof_VkEventCreateInfo_self(const VkEventCreateInfo *val)
25 {
26 size_t size = 0;
27 /* skip val->{sType,pNext} */
28 size += vn_sizeof_VkFlags(&val->flags);
29 return size;
30 }
31
32 static inline size_t
vn_sizeof_VkEventCreateInfo(const VkEventCreateInfo * val)33 vn_sizeof_VkEventCreateInfo(const VkEventCreateInfo *val)
34 {
35 size_t size = 0;
36
37 size += vn_sizeof_VkStructureType(&val->sType);
38 size += vn_sizeof_VkEventCreateInfo_pnext(val->pNext);
39 size += vn_sizeof_VkEventCreateInfo_self(val);
40
41 return size;
42 }
43
44 static inline void
vn_encode_VkEventCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)45 vn_encode_VkEventCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
46 {
47 /* no known/supported struct */
48 vn_encode_simple_pointer(enc, NULL);
49 }
50
51 static inline void
vn_encode_VkEventCreateInfo_self(struct vn_cs_encoder * enc,const VkEventCreateInfo * val)52 vn_encode_VkEventCreateInfo_self(struct vn_cs_encoder *enc, const VkEventCreateInfo *val)
53 {
54 /* skip val->{sType,pNext} */
55 vn_encode_VkFlags(enc, &val->flags);
56 }
57
58 static inline void
vn_encode_VkEventCreateInfo(struct vn_cs_encoder * enc,const VkEventCreateInfo * val)59 vn_encode_VkEventCreateInfo(struct vn_cs_encoder *enc, const VkEventCreateInfo *val)
60 {
61 assert(val->sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO);
62 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO });
63 vn_encode_VkEventCreateInfo_pnext(enc, val->pNext);
64 vn_encode_VkEventCreateInfo_self(enc, val);
65 }
66
vn_sizeof_vkCreateEvent(VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)67 static inline size_t vn_sizeof_vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
68 {
69 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateEvent_EXT;
70 const VkFlags cmd_flags = 0;
71 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
72
73 cmd_size += vn_sizeof_VkDevice(&device);
74 cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
75 if (pCreateInfo)
76 cmd_size += vn_sizeof_VkEventCreateInfo(pCreateInfo);
77 cmd_size += vn_sizeof_simple_pointer(pAllocator);
78 if (pAllocator)
79 assert(false);
80 cmd_size += vn_sizeof_simple_pointer(pEvent);
81 if (pEvent)
82 cmd_size += vn_sizeof_VkEvent(pEvent);
83
84 return cmd_size;
85 }
86
vn_encode_vkCreateEvent(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)87 static inline void vn_encode_vkCreateEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
88 {
89 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateEvent_EXT;
90
91 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
92 vn_encode_VkFlags(enc, &cmd_flags);
93
94 vn_encode_VkDevice(enc, &device);
95 if (vn_encode_simple_pointer(enc, pCreateInfo))
96 vn_encode_VkEventCreateInfo(enc, pCreateInfo);
97 if (vn_encode_simple_pointer(enc, pAllocator))
98 assert(false);
99 if (vn_encode_simple_pointer(enc, pEvent))
100 vn_encode_VkEvent(enc, pEvent);
101 }
102
vn_sizeof_vkCreateEvent_reply(VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)103 static inline size_t vn_sizeof_vkCreateEvent_reply(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
104 {
105 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateEvent_EXT;
106 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
107
108 VkResult ret;
109 cmd_size += vn_sizeof_VkResult(&ret);
110 /* skip device */
111 /* skip pCreateInfo */
112 /* skip pAllocator */
113 cmd_size += vn_sizeof_simple_pointer(pEvent);
114 if (pEvent)
115 cmd_size += vn_sizeof_VkEvent(pEvent);
116
117 return cmd_size;
118 }
119
vn_decode_vkCreateEvent_reply(struct vn_cs_decoder * dec,VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)120 static inline VkResult vn_decode_vkCreateEvent_reply(struct vn_cs_decoder *dec, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
121 {
122 VkCommandTypeEXT command_type;
123 vn_decode_VkCommandTypeEXT(dec, &command_type);
124 assert(command_type == VK_COMMAND_TYPE_vkCreateEvent_EXT);
125
126 VkResult ret;
127 vn_decode_VkResult(dec, &ret);
128 /* skip device */
129 /* skip pCreateInfo */
130 /* skip pAllocator */
131 if (vn_decode_simple_pointer(dec)) {
132 vn_decode_VkEvent(dec, pEvent);
133 } else {
134 pEvent = NULL;
135 }
136
137 return ret;
138 }
139
vn_sizeof_vkDestroyEvent(VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)140 static inline size_t vn_sizeof_vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
141 {
142 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyEvent_EXT;
143 const VkFlags cmd_flags = 0;
144 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
145
146 cmd_size += vn_sizeof_VkDevice(&device);
147 cmd_size += vn_sizeof_VkEvent(&event);
148 cmd_size += vn_sizeof_simple_pointer(pAllocator);
149 if (pAllocator)
150 assert(false);
151
152 return cmd_size;
153 }
154
vn_encode_vkDestroyEvent(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)155 static inline void vn_encode_vkDestroyEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
156 {
157 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyEvent_EXT;
158
159 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
160 vn_encode_VkFlags(enc, &cmd_flags);
161
162 vn_encode_VkDevice(enc, &device);
163 vn_encode_VkEvent(enc, &event);
164 if (vn_encode_simple_pointer(enc, pAllocator))
165 assert(false);
166 }
167
vn_sizeof_vkDestroyEvent_reply(VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)168 static inline size_t vn_sizeof_vkDestroyEvent_reply(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
169 {
170 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyEvent_EXT;
171 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
172
173 /* skip device */
174 /* skip event */
175 /* skip pAllocator */
176
177 return cmd_size;
178 }
179
vn_decode_vkDestroyEvent_reply(struct vn_cs_decoder * dec,VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)180 static inline void vn_decode_vkDestroyEvent_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
181 {
182 VkCommandTypeEXT command_type;
183 vn_decode_VkCommandTypeEXT(dec, &command_type);
184 assert(command_type == VK_COMMAND_TYPE_vkDestroyEvent_EXT);
185
186 /* skip device */
187 /* skip event */
188 /* skip pAllocator */
189 }
190
vn_sizeof_vkGetEventStatus(VkDevice device,VkEvent event)191 static inline size_t vn_sizeof_vkGetEventStatus(VkDevice device, VkEvent event)
192 {
193 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetEventStatus_EXT;
194 const VkFlags cmd_flags = 0;
195 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
196
197 cmd_size += vn_sizeof_VkDevice(&device);
198 cmd_size += vn_sizeof_VkEvent(&event);
199
200 return cmd_size;
201 }
202
vn_encode_vkGetEventStatus(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event)203 static inline void vn_encode_vkGetEventStatus(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event)
204 {
205 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetEventStatus_EXT;
206
207 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
208 vn_encode_VkFlags(enc, &cmd_flags);
209
210 vn_encode_VkDevice(enc, &device);
211 vn_encode_VkEvent(enc, &event);
212 }
213
vn_sizeof_vkGetEventStatus_reply(VkDevice device,VkEvent event)214 static inline size_t vn_sizeof_vkGetEventStatus_reply(VkDevice device, VkEvent event)
215 {
216 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetEventStatus_EXT;
217 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
218
219 VkResult ret;
220 cmd_size += vn_sizeof_VkResult(&ret);
221 /* skip device */
222 /* skip event */
223
224 return cmd_size;
225 }
226
vn_decode_vkGetEventStatus_reply(struct vn_cs_decoder * dec,VkDevice device,VkEvent event)227 static inline VkResult vn_decode_vkGetEventStatus_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event)
228 {
229 VkCommandTypeEXT command_type;
230 vn_decode_VkCommandTypeEXT(dec, &command_type);
231 assert(command_type == VK_COMMAND_TYPE_vkGetEventStatus_EXT);
232
233 VkResult ret;
234 vn_decode_VkResult(dec, &ret);
235 /* skip device */
236 /* skip event */
237
238 return ret;
239 }
240
vn_sizeof_vkSetEvent(VkDevice device,VkEvent event)241 static inline size_t vn_sizeof_vkSetEvent(VkDevice device, VkEvent event)
242 {
243 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetEvent_EXT;
244 const VkFlags cmd_flags = 0;
245 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
246
247 cmd_size += vn_sizeof_VkDevice(&device);
248 cmd_size += vn_sizeof_VkEvent(&event);
249
250 return cmd_size;
251 }
252
vn_encode_vkSetEvent(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event)253 static inline void vn_encode_vkSetEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event)
254 {
255 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetEvent_EXT;
256
257 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
258 vn_encode_VkFlags(enc, &cmd_flags);
259
260 vn_encode_VkDevice(enc, &device);
261 vn_encode_VkEvent(enc, &event);
262 }
263
vn_sizeof_vkSetEvent_reply(VkDevice device,VkEvent event)264 static inline size_t vn_sizeof_vkSetEvent_reply(VkDevice device, VkEvent event)
265 {
266 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetEvent_EXT;
267 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
268
269 VkResult ret;
270 cmd_size += vn_sizeof_VkResult(&ret);
271 /* skip device */
272 /* skip event */
273
274 return cmd_size;
275 }
276
vn_decode_vkSetEvent_reply(struct vn_cs_decoder * dec,VkDevice device,VkEvent event)277 static inline VkResult vn_decode_vkSetEvent_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event)
278 {
279 VkCommandTypeEXT command_type;
280 vn_decode_VkCommandTypeEXT(dec, &command_type);
281 assert(command_type == VK_COMMAND_TYPE_vkSetEvent_EXT);
282
283 VkResult ret;
284 vn_decode_VkResult(dec, &ret);
285 /* skip device */
286 /* skip event */
287
288 return ret;
289 }
290
vn_sizeof_vkResetEvent(VkDevice device,VkEvent event)291 static inline size_t vn_sizeof_vkResetEvent(VkDevice device, VkEvent event)
292 {
293 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetEvent_EXT;
294 const VkFlags cmd_flags = 0;
295 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
296
297 cmd_size += vn_sizeof_VkDevice(&device);
298 cmd_size += vn_sizeof_VkEvent(&event);
299
300 return cmd_size;
301 }
302
vn_encode_vkResetEvent(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event)303 static inline void vn_encode_vkResetEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event)
304 {
305 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetEvent_EXT;
306
307 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
308 vn_encode_VkFlags(enc, &cmd_flags);
309
310 vn_encode_VkDevice(enc, &device);
311 vn_encode_VkEvent(enc, &event);
312 }
313
vn_sizeof_vkResetEvent_reply(VkDevice device,VkEvent event)314 static inline size_t vn_sizeof_vkResetEvent_reply(VkDevice device, VkEvent event)
315 {
316 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetEvent_EXT;
317 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
318
319 VkResult ret;
320 cmd_size += vn_sizeof_VkResult(&ret);
321 /* skip device */
322 /* skip event */
323
324 return cmd_size;
325 }
326
vn_decode_vkResetEvent_reply(struct vn_cs_decoder * dec,VkDevice device,VkEvent event)327 static inline VkResult vn_decode_vkResetEvent_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event)
328 {
329 VkCommandTypeEXT command_type;
330 vn_decode_VkCommandTypeEXT(dec, &command_type);
331 assert(command_type == VK_COMMAND_TYPE_vkResetEvent_EXT);
332
333 VkResult ret;
334 vn_decode_VkResult(dec, &ret);
335 /* skip device */
336 /* skip event */
337
338 return ret;
339 }
340
vn_submit_vkCreateEvent(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent,struct vn_instance_submit_command * submit)341 static inline void vn_submit_vkCreateEvent(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent, struct vn_instance_submit_command *submit)
342 {
343 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
344 void *cmd_data = local_cmd_data;
345 size_t cmd_size = vn_sizeof_vkCreateEvent(device, pCreateInfo, pAllocator, pEvent);
346 if (cmd_size > sizeof(local_cmd_data)) {
347 cmd_data = malloc(cmd_size);
348 if (!cmd_data)
349 cmd_size = 0;
350 }
351 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateEvent_reply(device, pCreateInfo, pAllocator, pEvent) : 0;
352
353 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
354 if (cmd_size) {
355 vn_encode_vkCreateEvent(enc, cmd_flags, device, pCreateInfo, pAllocator, pEvent);
356 vn_instance_submit_command(vn_instance, submit);
357 if (cmd_data != local_cmd_data)
358 free(cmd_data);
359 }
360 }
361
vn_submit_vkDestroyEvent(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)362 static inline void vn_submit_vkDestroyEvent(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
363 {
364 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
365 void *cmd_data = local_cmd_data;
366 size_t cmd_size = vn_sizeof_vkDestroyEvent(device, event, pAllocator);
367 if (cmd_size > sizeof(local_cmd_data)) {
368 cmd_data = malloc(cmd_size);
369 if (!cmd_data)
370 cmd_size = 0;
371 }
372 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyEvent_reply(device, event, pAllocator) : 0;
373
374 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
375 if (cmd_size) {
376 vn_encode_vkDestroyEvent(enc, cmd_flags, device, event, pAllocator);
377 vn_instance_submit_command(vn_instance, submit);
378 if (cmd_data != local_cmd_data)
379 free(cmd_data);
380 }
381 }
382
vn_submit_vkGetEventStatus(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event,struct vn_instance_submit_command * submit)383 static inline void vn_submit_vkGetEventStatus(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, struct vn_instance_submit_command *submit)
384 {
385 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
386 void *cmd_data = local_cmd_data;
387 size_t cmd_size = vn_sizeof_vkGetEventStatus(device, event);
388 if (cmd_size > sizeof(local_cmd_data)) {
389 cmd_data = malloc(cmd_size);
390 if (!cmd_data)
391 cmd_size = 0;
392 }
393 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetEventStatus_reply(device, event) : 0;
394
395 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
396 if (cmd_size) {
397 vn_encode_vkGetEventStatus(enc, cmd_flags, device, event);
398 vn_instance_submit_command(vn_instance, submit);
399 if (cmd_data != local_cmd_data)
400 free(cmd_data);
401 }
402 }
403
vn_submit_vkSetEvent(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event,struct vn_instance_submit_command * submit)404 static inline void vn_submit_vkSetEvent(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, struct vn_instance_submit_command *submit)
405 {
406 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
407 void *cmd_data = local_cmd_data;
408 size_t cmd_size = vn_sizeof_vkSetEvent(device, event);
409 if (cmd_size > sizeof(local_cmd_data)) {
410 cmd_data = malloc(cmd_size);
411 if (!cmd_data)
412 cmd_size = 0;
413 }
414 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkSetEvent_reply(device, event) : 0;
415
416 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
417 if (cmd_size) {
418 vn_encode_vkSetEvent(enc, cmd_flags, device, event);
419 vn_instance_submit_command(vn_instance, submit);
420 if (cmd_data != local_cmd_data)
421 free(cmd_data);
422 }
423 }
424
vn_submit_vkResetEvent(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkEvent event,struct vn_instance_submit_command * submit)425 static inline void vn_submit_vkResetEvent(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, struct vn_instance_submit_command *submit)
426 {
427 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
428 void *cmd_data = local_cmd_data;
429 size_t cmd_size = vn_sizeof_vkResetEvent(device, event);
430 if (cmd_size > sizeof(local_cmd_data)) {
431 cmd_data = malloc(cmd_size);
432 if (!cmd_data)
433 cmd_size = 0;
434 }
435 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetEvent_reply(device, event) : 0;
436
437 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
438 if (cmd_size) {
439 vn_encode_vkResetEvent(enc, cmd_flags, device, event);
440 vn_instance_submit_command(vn_instance, submit);
441 if (cmd_data != local_cmd_data)
442 free(cmd_data);
443 }
444 }
445
vn_call_vkCreateEvent(struct vn_instance * vn_instance,VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)446 static inline VkResult vn_call_vkCreateEvent(struct vn_instance *vn_instance, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
447 {
448 VN_TRACE_FUNC();
449
450 struct vn_instance_submit_command submit;
451 vn_submit_vkCreateEvent(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pEvent, &submit);
452 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
453 if (dec) {
454 const VkResult ret = vn_decode_vkCreateEvent_reply(dec, device, pCreateInfo, pAllocator, pEvent);
455 vn_instance_free_command_reply(vn_instance, &submit);
456 return ret;
457 } else {
458 return VK_ERROR_OUT_OF_HOST_MEMORY;
459 }
460 }
461
vn_async_vkCreateEvent(struct vn_instance * vn_instance,VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)462 static inline void vn_async_vkCreateEvent(struct vn_instance *vn_instance, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
463 {
464 struct vn_instance_submit_command submit;
465 vn_submit_vkCreateEvent(vn_instance, 0, device, pCreateInfo, pAllocator, pEvent, &submit);
466 }
467
vn_call_vkDestroyEvent(struct vn_instance * vn_instance,VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)468 static inline void vn_call_vkDestroyEvent(struct vn_instance *vn_instance, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
469 {
470 VN_TRACE_FUNC();
471
472 struct vn_instance_submit_command submit;
473 vn_submit_vkDestroyEvent(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, pAllocator, &submit);
474 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
475 if (dec) {
476 vn_decode_vkDestroyEvent_reply(dec, device, event, pAllocator);
477 vn_instance_free_command_reply(vn_instance, &submit);
478 }
479 }
480
vn_async_vkDestroyEvent(struct vn_instance * vn_instance,VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)481 static inline void vn_async_vkDestroyEvent(struct vn_instance *vn_instance, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
482 {
483 struct vn_instance_submit_command submit;
484 vn_submit_vkDestroyEvent(vn_instance, 0, device, event, pAllocator, &submit);
485 }
486
vn_call_vkGetEventStatus(struct vn_instance * vn_instance,VkDevice device,VkEvent event)487 static inline VkResult vn_call_vkGetEventStatus(struct vn_instance *vn_instance, VkDevice device, VkEvent event)
488 {
489 VN_TRACE_FUNC();
490
491 struct vn_instance_submit_command submit;
492 vn_submit_vkGetEventStatus(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, &submit);
493 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
494 if (dec) {
495 const VkResult ret = vn_decode_vkGetEventStatus_reply(dec, device, event);
496 vn_instance_free_command_reply(vn_instance, &submit);
497 return ret;
498 } else {
499 return VK_ERROR_OUT_OF_HOST_MEMORY;
500 }
501 }
502
vn_async_vkGetEventStatus(struct vn_instance * vn_instance,VkDevice device,VkEvent event)503 static inline void vn_async_vkGetEventStatus(struct vn_instance *vn_instance, VkDevice device, VkEvent event)
504 {
505 struct vn_instance_submit_command submit;
506 vn_submit_vkGetEventStatus(vn_instance, 0, device, event, &submit);
507 }
508
vn_call_vkSetEvent(struct vn_instance * vn_instance,VkDevice device,VkEvent event)509 static inline VkResult vn_call_vkSetEvent(struct vn_instance *vn_instance, VkDevice device, VkEvent event)
510 {
511 VN_TRACE_FUNC();
512
513 struct vn_instance_submit_command submit;
514 vn_submit_vkSetEvent(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, &submit);
515 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
516 if (dec) {
517 const VkResult ret = vn_decode_vkSetEvent_reply(dec, device, event);
518 vn_instance_free_command_reply(vn_instance, &submit);
519 return ret;
520 } else {
521 return VK_ERROR_OUT_OF_HOST_MEMORY;
522 }
523 }
524
vn_async_vkSetEvent(struct vn_instance * vn_instance,VkDevice device,VkEvent event)525 static inline void vn_async_vkSetEvent(struct vn_instance *vn_instance, VkDevice device, VkEvent event)
526 {
527 struct vn_instance_submit_command submit;
528 vn_submit_vkSetEvent(vn_instance, 0, device, event, &submit);
529 }
530
vn_call_vkResetEvent(struct vn_instance * vn_instance,VkDevice device,VkEvent event)531 static inline VkResult vn_call_vkResetEvent(struct vn_instance *vn_instance, VkDevice device, VkEvent event)
532 {
533 VN_TRACE_FUNC();
534
535 struct vn_instance_submit_command submit;
536 vn_submit_vkResetEvent(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, &submit);
537 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
538 if (dec) {
539 const VkResult ret = vn_decode_vkResetEvent_reply(dec, device, event);
540 vn_instance_free_command_reply(vn_instance, &submit);
541 return ret;
542 } else {
543 return VK_ERROR_OUT_OF_HOST_MEMORY;
544 }
545 }
546
vn_async_vkResetEvent(struct vn_instance * vn_instance,VkDevice device,VkEvent event)547 static inline void vn_async_vkResetEvent(struct vn_instance *vn_instance, VkDevice device, VkEvent event)
548 {
549 struct vn_instance_submit_command submit;
550 vn_submit_vkResetEvent(vn_instance, 0, device, event, &submit);
551 }
552
553 #endif /* VN_PROTOCOL_DRIVER_EVENT_H */
554