• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PRIVATE_DATA_SLOT_H
9 #define VN_PROTOCOL_DRIVER_PRIVATE_DATA_SLOT_H
10 
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13 
14 /* struct VkPrivateDataSlotCreateInfo chain */
15 
16 static inline size_t
vn_sizeof_VkPrivateDataSlotCreateInfo_pnext(const void * val)17 vn_sizeof_VkPrivateDataSlotCreateInfo_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_VkPrivateDataSlotCreateInfo_self(const VkPrivateDataSlotCreateInfo * val)24 vn_sizeof_VkPrivateDataSlotCreateInfo_self(const VkPrivateDataSlotCreateInfo *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_VkPrivateDataSlotCreateInfo(const VkPrivateDataSlotCreateInfo * val)33 vn_sizeof_VkPrivateDataSlotCreateInfo(const VkPrivateDataSlotCreateInfo *val)
34 {
35     size_t size = 0;
36 
37     size += vn_sizeof_VkStructureType(&val->sType);
38     size += vn_sizeof_VkPrivateDataSlotCreateInfo_pnext(val->pNext);
39     size += vn_sizeof_VkPrivateDataSlotCreateInfo_self(val);
40 
41     return size;
42 }
43 
44 static inline void
vn_encode_VkPrivateDataSlotCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)45 vn_encode_VkPrivateDataSlotCreateInfo_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_VkPrivateDataSlotCreateInfo_self(struct vn_cs_encoder * enc,const VkPrivateDataSlotCreateInfo * val)52 vn_encode_VkPrivateDataSlotCreateInfo_self(struct vn_cs_encoder *enc, const VkPrivateDataSlotCreateInfo *val)
53 {
54     /* skip val->{sType,pNext} */
55     vn_encode_VkFlags(enc, &val->flags);
56 }
57 
58 static inline void
vn_encode_VkPrivateDataSlotCreateInfo(struct vn_cs_encoder * enc,const VkPrivateDataSlotCreateInfo * val)59 vn_encode_VkPrivateDataSlotCreateInfo(struct vn_cs_encoder *enc, const VkPrivateDataSlotCreateInfo *val)
60 {
61     assert(val->sType == VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO);
62     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO });
63     vn_encode_VkPrivateDataSlotCreateInfo_pnext(enc, val->pNext);
64     vn_encode_VkPrivateDataSlotCreateInfo_self(enc, val);
65 }
66 
vn_sizeof_vkCreatePrivateDataSlot(VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot)67 static inline size_t vn_sizeof_vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
68 {
69     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePrivateDataSlot_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_VkPrivateDataSlotCreateInfo(pCreateInfo);
77     cmd_size += vn_sizeof_simple_pointer(pAllocator);
78     if (pAllocator)
79         assert(false);
80     cmd_size += vn_sizeof_simple_pointer(pPrivateDataSlot);
81     if (pPrivateDataSlot)
82         cmd_size += vn_sizeof_VkPrivateDataSlot(pPrivateDataSlot);
83 
84     return cmd_size;
85 }
86 
vn_encode_vkCreatePrivateDataSlot(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot)87 static inline void vn_encode_vkCreatePrivateDataSlot(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
88 {
89     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePrivateDataSlot_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_VkPrivateDataSlotCreateInfo(enc, pCreateInfo);
97     if (vn_encode_simple_pointer(enc, pAllocator))
98         assert(false);
99     if (vn_encode_simple_pointer(enc, pPrivateDataSlot))
100         vn_encode_VkPrivateDataSlot(enc, pPrivateDataSlot);
101 }
102 
vn_sizeof_vkCreatePrivateDataSlot_reply(VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot)103 static inline size_t vn_sizeof_vkCreatePrivateDataSlot_reply(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
104 {
105     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePrivateDataSlot_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(pPrivateDataSlot);
114     if (pPrivateDataSlot)
115         cmd_size += vn_sizeof_VkPrivateDataSlot(pPrivateDataSlot);
116 
117     return cmd_size;
118 }
119 
vn_decode_vkCreatePrivateDataSlot_reply(struct vn_cs_decoder * dec,VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot)120 static inline VkResult vn_decode_vkCreatePrivateDataSlot_reply(struct vn_cs_decoder *dec, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
121 {
122     VkCommandTypeEXT command_type;
123     vn_decode_VkCommandTypeEXT(dec, &command_type);
124     assert(command_type == VK_COMMAND_TYPE_vkCreatePrivateDataSlot_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_VkPrivateDataSlot(dec, pPrivateDataSlot);
133     } else {
134         pPrivateDataSlot = NULL;
135     }
136 
137     return ret;
138 }
139 
vn_sizeof_vkDestroyPrivateDataSlot(VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator)140 static inline size_t vn_sizeof_vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
141 {
142     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_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_VkPrivateDataSlot(&privateDataSlot);
148     cmd_size += vn_sizeof_simple_pointer(pAllocator);
149     if (pAllocator)
150         assert(false);
151 
152     return cmd_size;
153 }
154 
vn_encode_vkDestroyPrivateDataSlot(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator)155 static inline void vn_encode_vkDestroyPrivateDataSlot(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
156 {
157     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_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_VkPrivateDataSlot(enc, &privateDataSlot);
164     if (vn_encode_simple_pointer(enc, pAllocator))
165         assert(false);
166 }
167 
vn_sizeof_vkDestroyPrivateDataSlot_reply(VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator)168 static inline size_t vn_sizeof_vkDestroyPrivateDataSlot_reply(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
169 {
170     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT;
171     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
172 
173     /* skip device */
174     /* skip privateDataSlot */
175     /* skip pAllocator */
176 
177     return cmd_size;
178 }
179 
vn_decode_vkDestroyPrivateDataSlot_reply(struct vn_cs_decoder * dec,VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator)180 static inline void vn_decode_vkDestroyPrivateDataSlot_reply(struct vn_cs_decoder *dec, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
181 {
182     VkCommandTypeEXT command_type;
183     vn_decode_VkCommandTypeEXT(dec, &command_type);
184     assert(command_type == VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT);
185 
186     /* skip device */
187     /* skip privateDataSlot */
188     /* skip pAllocator */
189 }
190 
vn_sizeof_vkSetPrivateData(VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data)191 static inline size_t vn_sizeof_vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
192 {
193     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetPrivateData_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_VkObjectType(&objectType);
199     cmd_size += vn_sizeof_uint64_t(&objectHandle);
200     cmd_size += vn_sizeof_VkPrivateDataSlot(&privateDataSlot);
201     cmd_size += vn_sizeof_uint64_t(&data);
202 
203     return cmd_size;
204 }
205 
vn_encode_vkSetPrivateData(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data)206 static inline void vn_encode_vkSetPrivateData(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
207 {
208     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetPrivateData_EXT;
209 
210     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
211     vn_encode_VkFlags(enc, &cmd_flags);
212 
213     vn_encode_VkDevice(enc, &device);
214     vn_encode_VkObjectType(enc, &objectType);
215     vn_encode_uint64_t(enc, &objectHandle);
216     vn_encode_VkPrivateDataSlot(enc, &privateDataSlot);
217     vn_encode_uint64_t(enc, &data);
218 }
219 
vn_sizeof_vkSetPrivateData_reply(VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data)220 static inline size_t vn_sizeof_vkSetPrivateData_reply(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
221 {
222     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetPrivateData_EXT;
223     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
224 
225     VkResult ret;
226     cmd_size += vn_sizeof_VkResult(&ret);
227     /* skip device */
228     /* skip objectType */
229     /* skip objectHandle */
230     /* skip privateDataSlot */
231     /* skip data */
232 
233     return cmd_size;
234 }
235 
vn_decode_vkSetPrivateData_reply(struct vn_cs_decoder * dec,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data)236 static inline VkResult vn_decode_vkSetPrivateData_reply(struct vn_cs_decoder *dec, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
237 {
238     VkCommandTypeEXT command_type;
239     vn_decode_VkCommandTypeEXT(dec, &command_type);
240     assert(command_type == VK_COMMAND_TYPE_vkSetPrivateData_EXT);
241 
242     VkResult ret;
243     vn_decode_VkResult(dec, &ret);
244     /* skip device */
245     /* skip objectType */
246     /* skip objectHandle */
247     /* skip privateDataSlot */
248     /* skip data */
249 
250     return ret;
251 }
252 
vn_sizeof_vkGetPrivateData(VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData)253 static inline size_t vn_sizeof_vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
254 {
255     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPrivateData_EXT;
256     const VkFlags cmd_flags = 0;
257     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
258 
259     cmd_size += vn_sizeof_VkDevice(&device);
260     cmd_size += vn_sizeof_VkObjectType(&objectType);
261     cmd_size += vn_sizeof_uint64_t(&objectHandle);
262     cmd_size += vn_sizeof_VkPrivateDataSlot(&privateDataSlot);
263     cmd_size += vn_sizeof_simple_pointer(pData); /* out */
264 
265     return cmd_size;
266 }
267 
vn_encode_vkGetPrivateData(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData)268 static inline void vn_encode_vkGetPrivateData(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
269 {
270     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPrivateData_EXT;
271 
272     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
273     vn_encode_VkFlags(enc, &cmd_flags);
274 
275     vn_encode_VkDevice(enc, &device);
276     vn_encode_VkObjectType(enc, &objectType);
277     vn_encode_uint64_t(enc, &objectHandle);
278     vn_encode_VkPrivateDataSlot(enc, &privateDataSlot);
279     vn_encode_simple_pointer(enc, pData); /* out */
280 }
281 
vn_sizeof_vkGetPrivateData_reply(VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData)282 static inline size_t vn_sizeof_vkGetPrivateData_reply(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
283 {
284     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPrivateData_EXT;
285     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
286 
287     /* skip device */
288     /* skip objectType */
289     /* skip objectHandle */
290     /* skip privateDataSlot */
291     cmd_size += vn_sizeof_simple_pointer(pData);
292     if (pData)
293         cmd_size += vn_sizeof_uint64_t(pData);
294 
295     return cmd_size;
296 }
297 
vn_decode_vkGetPrivateData_reply(struct vn_cs_decoder * dec,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData)298 static inline void vn_decode_vkGetPrivateData_reply(struct vn_cs_decoder *dec, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
299 {
300     VkCommandTypeEXT command_type;
301     vn_decode_VkCommandTypeEXT(dec, &command_type);
302     assert(command_type == VK_COMMAND_TYPE_vkGetPrivateData_EXT);
303 
304     /* skip device */
305     /* skip objectType */
306     /* skip objectHandle */
307     /* skip privateDataSlot */
308     if (vn_decode_simple_pointer(dec)) {
309         vn_decode_uint64_t(dec, pData);
310     } else {
311         pData = NULL;
312     }
313 }
314 
vn_submit_vkCreatePrivateDataSlot(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot,struct vn_instance_submit_command * submit)315 static inline void vn_submit_vkCreatePrivateDataSlot(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot, struct vn_instance_submit_command *submit)
316 {
317     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
318     void *cmd_data = local_cmd_data;
319     size_t cmd_size = vn_sizeof_vkCreatePrivateDataSlot(device, pCreateInfo, pAllocator, pPrivateDataSlot);
320     if (cmd_size > sizeof(local_cmd_data)) {
321         cmd_data = malloc(cmd_size);
322         if (!cmd_data)
323             cmd_size = 0;
324     }
325     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreatePrivateDataSlot_reply(device, pCreateInfo, pAllocator, pPrivateDataSlot) : 0;
326 
327     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
328     if (cmd_size) {
329         vn_encode_vkCreatePrivateDataSlot(enc, cmd_flags, device, pCreateInfo, pAllocator, pPrivateDataSlot);
330         vn_instance_submit_command(vn_instance, submit);
331         if (cmd_data != local_cmd_data)
332             free(cmd_data);
333     }
334 }
335 
vn_submit_vkDestroyPrivateDataSlot(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)336 static inline void vn_submit_vkDestroyPrivateDataSlot(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
337 {
338     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
339     void *cmd_data = local_cmd_data;
340     size_t cmd_size = vn_sizeof_vkDestroyPrivateDataSlot(device, privateDataSlot, pAllocator);
341     if (cmd_size > sizeof(local_cmd_data)) {
342         cmd_data = malloc(cmd_size);
343         if (!cmd_data)
344             cmd_size = 0;
345     }
346     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyPrivateDataSlot_reply(device, privateDataSlot, pAllocator) : 0;
347 
348     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
349     if (cmd_size) {
350         vn_encode_vkDestroyPrivateDataSlot(enc, cmd_flags, device, privateDataSlot, pAllocator);
351         vn_instance_submit_command(vn_instance, submit);
352         if (cmd_data != local_cmd_data)
353             free(cmd_data);
354     }
355 }
356 
vn_submit_vkSetPrivateData(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data,struct vn_instance_submit_command * submit)357 static inline void vn_submit_vkSetPrivateData(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data, struct vn_instance_submit_command *submit)
358 {
359     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
360     void *cmd_data = local_cmd_data;
361     size_t cmd_size = vn_sizeof_vkSetPrivateData(device, objectType, objectHandle, privateDataSlot, data);
362     if (cmd_size > sizeof(local_cmd_data)) {
363         cmd_data = malloc(cmd_size);
364         if (!cmd_data)
365             cmd_size = 0;
366     }
367     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkSetPrivateData_reply(device, objectType, objectHandle, privateDataSlot, data) : 0;
368 
369     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
370     if (cmd_size) {
371         vn_encode_vkSetPrivateData(enc, cmd_flags, device, objectType, objectHandle, privateDataSlot, data);
372         vn_instance_submit_command(vn_instance, submit);
373         if (cmd_data != local_cmd_data)
374             free(cmd_data);
375     }
376 }
377 
vn_submit_vkGetPrivateData(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData,struct vn_instance_submit_command * submit)378 static inline void vn_submit_vkGetPrivateData(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData, struct vn_instance_submit_command *submit)
379 {
380     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
381     void *cmd_data = local_cmd_data;
382     size_t cmd_size = vn_sizeof_vkGetPrivateData(device, objectType, objectHandle, privateDataSlot, pData);
383     if (cmd_size > sizeof(local_cmd_data)) {
384         cmd_data = malloc(cmd_size);
385         if (!cmd_data)
386             cmd_size = 0;
387     }
388     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetPrivateData_reply(device, objectType, objectHandle, privateDataSlot, pData) : 0;
389 
390     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
391     if (cmd_size) {
392         vn_encode_vkGetPrivateData(enc, cmd_flags, device, objectType, objectHandle, privateDataSlot, pData);
393         vn_instance_submit_command(vn_instance, submit);
394         if (cmd_data != local_cmd_data)
395             free(cmd_data);
396     }
397 }
398 
vn_call_vkCreatePrivateDataSlot(struct vn_instance * vn_instance,VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot)399 static inline VkResult vn_call_vkCreatePrivateDataSlot(struct vn_instance *vn_instance, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
400 {
401     VN_TRACE_FUNC();
402 
403     struct vn_instance_submit_command submit;
404     vn_submit_vkCreatePrivateDataSlot(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pPrivateDataSlot, &submit);
405     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
406     if (dec) {
407         const VkResult ret = vn_decode_vkCreatePrivateDataSlot_reply(dec, device, pCreateInfo, pAllocator, pPrivateDataSlot);
408         vn_instance_free_command_reply(vn_instance, &submit);
409         return ret;
410     } else {
411         return VK_ERROR_OUT_OF_HOST_MEMORY;
412     }
413 }
414 
vn_async_vkCreatePrivateDataSlot(struct vn_instance * vn_instance,VkDevice device,const VkPrivateDataSlotCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPrivateDataSlot * pPrivateDataSlot)415 static inline void vn_async_vkCreatePrivateDataSlot(struct vn_instance *vn_instance, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
416 {
417     struct vn_instance_submit_command submit;
418     vn_submit_vkCreatePrivateDataSlot(vn_instance, 0, device, pCreateInfo, pAllocator, pPrivateDataSlot, &submit);
419 }
420 
vn_call_vkDestroyPrivateDataSlot(struct vn_instance * vn_instance,VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator)421 static inline void vn_call_vkDestroyPrivateDataSlot(struct vn_instance *vn_instance, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
422 {
423     VN_TRACE_FUNC();
424 
425     struct vn_instance_submit_command submit;
426     vn_submit_vkDestroyPrivateDataSlot(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, privateDataSlot, pAllocator, &submit);
427     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
428     if (dec) {
429         vn_decode_vkDestroyPrivateDataSlot_reply(dec, device, privateDataSlot, pAllocator);
430         vn_instance_free_command_reply(vn_instance, &submit);
431     }
432 }
433 
vn_async_vkDestroyPrivateDataSlot(struct vn_instance * vn_instance,VkDevice device,VkPrivateDataSlot privateDataSlot,const VkAllocationCallbacks * pAllocator)434 static inline void vn_async_vkDestroyPrivateDataSlot(struct vn_instance *vn_instance, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
435 {
436     struct vn_instance_submit_command submit;
437     vn_submit_vkDestroyPrivateDataSlot(vn_instance, 0, device, privateDataSlot, pAllocator, &submit);
438 }
439 
vn_call_vkSetPrivateData(struct vn_instance * vn_instance,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data)440 static inline VkResult vn_call_vkSetPrivateData(struct vn_instance *vn_instance, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
441 {
442     VN_TRACE_FUNC();
443 
444     struct vn_instance_submit_command submit;
445     vn_submit_vkSetPrivateData(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, objectType, objectHandle, privateDataSlot, data, &submit);
446     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
447     if (dec) {
448         const VkResult ret = vn_decode_vkSetPrivateData_reply(dec, device, objectType, objectHandle, privateDataSlot, data);
449         vn_instance_free_command_reply(vn_instance, &submit);
450         return ret;
451     } else {
452         return VK_ERROR_OUT_OF_HOST_MEMORY;
453     }
454 }
455 
vn_async_vkSetPrivateData(struct vn_instance * vn_instance,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t data)456 static inline void vn_async_vkSetPrivateData(struct vn_instance *vn_instance, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
457 {
458     struct vn_instance_submit_command submit;
459     vn_submit_vkSetPrivateData(vn_instance, 0, device, objectType, objectHandle, privateDataSlot, data, &submit);
460 }
461 
vn_call_vkGetPrivateData(struct vn_instance * vn_instance,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData)462 static inline void vn_call_vkGetPrivateData(struct vn_instance *vn_instance, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
463 {
464     VN_TRACE_FUNC();
465 
466     struct vn_instance_submit_command submit;
467     vn_submit_vkGetPrivateData(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, objectType, objectHandle, privateDataSlot, pData, &submit);
468     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
469     if (dec) {
470         vn_decode_vkGetPrivateData_reply(dec, device, objectType, objectHandle, privateDataSlot, pData);
471         vn_instance_free_command_reply(vn_instance, &submit);
472     }
473 }
474 
vn_async_vkGetPrivateData(struct vn_instance * vn_instance,VkDevice device,VkObjectType objectType,uint64_t objectHandle,VkPrivateDataSlot privateDataSlot,uint64_t * pData)475 static inline void vn_async_vkGetPrivateData(struct vn_instance *vn_instance, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
476 {
477     struct vn_instance_submit_command submit;
478     vn_submit_vkGetPrivateData(vn_instance, 0, device, objectType, objectHandle, privateDataSlot, pData, &submit);
479 }
480 
481 #endif /* VN_PROTOCOL_DRIVER_PRIVATE_DATA_SLOT_H */
482