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_FRAMEBUFFER_H
9 #define VN_PROTOCOL_DRIVER_FRAMEBUFFER_H
10
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13
14 /* struct VkFramebufferAttachmentImageInfo chain */
15
16 static inline size_t
vn_sizeof_VkFramebufferAttachmentImageInfo_pnext(const void * val)17 vn_sizeof_VkFramebufferAttachmentImageInfo_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_VkFramebufferAttachmentImageInfo_self(const VkFramebufferAttachmentImageInfo * val)24 vn_sizeof_VkFramebufferAttachmentImageInfo_self(const VkFramebufferAttachmentImageInfo *val)
25 {
26 size_t size = 0;
27 /* skip val->{sType,pNext} */
28 size += vn_sizeof_VkFlags(&val->flags);
29 size += vn_sizeof_VkFlags(&val->usage);
30 size += vn_sizeof_uint32_t(&val->width);
31 size += vn_sizeof_uint32_t(&val->height);
32 size += vn_sizeof_uint32_t(&val->layerCount);
33 size += vn_sizeof_uint32_t(&val->viewFormatCount);
34 if (val->pViewFormats) {
35 size += vn_sizeof_array_size(val->viewFormatCount);
36 size += vn_sizeof_VkFormat_array(val->pViewFormats, val->viewFormatCount);
37 } else {
38 size += vn_sizeof_array_size(0);
39 }
40 return size;
41 }
42
43 static inline size_t
vn_sizeof_VkFramebufferAttachmentImageInfo(const VkFramebufferAttachmentImageInfo * val)44 vn_sizeof_VkFramebufferAttachmentImageInfo(const VkFramebufferAttachmentImageInfo *val)
45 {
46 size_t size = 0;
47
48 size += vn_sizeof_VkStructureType(&val->sType);
49 size += vn_sizeof_VkFramebufferAttachmentImageInfo_pnext(val->pNext);
50 size += vn_sizeof_VkFramebufferAttachmentImageInfo_self(val);
51
52 return size;
53 }
54
55 static inline void
vn_encode_VkFramebufferAttachmentImageInfo_pnext(struct vn_cs_encoder * enc,const void * val)56 vn_encode_VkFramebufferAttachmentImageInfo_pnext(struct vn_cs_encoder *enc, const void *val)
57 {
58 /* no known/supported struct */
59 vn_encode_simple_pointer(enc, NULL);
60 }
61
62 static inline void
vn_encode_VkFramebufferAttachmentImageInfo_self(struct vn_cs_encoder * enc,const VkFramebufferAttachmentImageInfo * val)63 vn_encode_VkFramebufferAttachmentImageInfo_self(struct vn_cs_encoder *enc, const VkFramebufferAttachmentImageInfo *val)
64 {
65 /* skip val->{sType,pNext} */
66 vn_encode_VkFlags(enc, &val->flags);
67 vn_encode_VkFlags(enc, &val->usage);
68 vn_encode_uint32_t(enc, &val->width);
69 vn_encode_uint32_t(enc, &val->height);
70 vn_encode_uint32_t(enc, &val->layerCount);
71 vn_encode_uint32_t(enc, &val->viewFormatCount);
72 if (val->pViewFormats) {
73 vn_encode_array_size(enc, val->viewFormatCount);
74 vn_encode_VkFormat_array(enc, val->pViewFormats, val->viewFormatCount);
75 } else {
76 vn_encode_array_size(enc, 0);
77 }
78 }
79
80 static inline void
vn_encode_VkFramebufferAttachmentImageInfo(struct vn_cs_encoder * enc,const VkFramebufferAttachmentImageInfo * val)81 vn_encode_VkFramebufferAttachmentImageInfo(struct vn_cs_encoder *enc, const VkFramebufferAttachmentImageInfo *val)
82 {
83 assert(val->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO);
84 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO });
85 vn_encode_VkFramebufferAttachmentImageInfo_pnext(enc, val->pNext);
86 vn_encode_VkFramebufferAttachmentImageInfo_self(enc, val);
87 }
88
89 /* struct VkFramebufferAttachmentsCreateInfo chain */
90
91 static inline size_t
vn_sizeof_VkFramebufferAttachmentsCreateInfo_pnext(const void * val)92 vn_sizeof_VkFramebufferAttachmentsCreateInfo_pnext(const void *val)
93 {
94 /* no known/supported struct */
95 return vn_sizeof_simple_pointer(NULL);
96 }
97
98 static inline size_t
vn_sizeof_VkFramebufferAttachmentsCreateInfo_self(const VkFramebufferAttachmentsCreateInfo * val)99 vn_sizeof_VkFramebufferAttachmentsCreateInfo_self(const VkFramebufferAttachmentsCreateInfo *val)
100 {
101 size_t size = 0;
102 /* skip val->{sType,pNext} */
103 size += vn_sizeof_uint32_t(&val->attachmentImageInfoCount);
104 if (val->pAttachmentImageInfos) {
105 size += vn_sizeof_array_size(val->attachmentImageInfoCount);
106 for (uint32_t i = 0; i < val->attachmentImageInfoCount; i++)
107 size += vn_sizeof_VkFramebufferAttachmentImageInfo(&val->pAttachmentImageInfos[i]);
108 } else {
109 size += vn_sizeof_array_size(0);
110 }
111 return size;
112 }
113
114 static inline size_t
vn_sizeof_VkFramebufferAttachmentsCreateInfo(const VkFramebufferAttachmentsCreateInfo * val)115 vn_sizeof_VkFramebufferAttachmentsCreateInfo(const VkFramebufferAttachmentsCreateInfo *val)
116 {
117 size_t size = 0;
118
119 size += vn_sizeof_VkStructureType(&val->sType);
120 size += vn_sizeof_VkFramebufferAttachmentsCreateInfo_pnext(val->pNext);
121 size += vn_sizeof_VkFramebufferAttachmentsCreateInfo_self(val);
122
123 return size;
124 }
125
126 static inline void
vn_encode_VkFramebufferAttachmentsCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)127 vn_encode_VkFramebufferAttachmentsCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
128 {
129 /* no known/supported struct */
130 vn_encode_simple_pointer(enc, NULL);
131 }
132
133 static inline void
vn_encode_VkFramebufferAttachmentsCreateInfo_self(struct vn_cs_encoder * enc,const VkFramebufferAttachmentsCreateInfo * val)134 vn_encode_VkFramebufferAttachmentsCreateInfo_self(struct vn_cs_encoder *enc, const VkFramebufferAttachmentsCreateInfo *val)
135 {
136 /* skip val->{sType,pNext} */
137 vn_encode_uint32_t(enc, &val->attachmentImageInfoCount);
138 if (val->pAttachmentImageInfos) {
139 vn_encode_array_size(enc, val->attachmentImageInfoCount);
140 for (uint32_t i = 0; i < val->attachmentImageInfoCount; i++)
141 vn_encode_VkFramebufferAttachmentImageInfo(enc, &val->pAttachmentImageInfos[i]);
142 } else {
143 vn_encode_array_size(enc, 0);
144 }
145 }
146
147 static inline void
vn_encode_VkFramebufferAttachmentsCreateInfo(struct vn_cs_encoder * enc,const VkFramebufferAttachmentsCreateInfo * val)148 vn_encode_VkFramebufferAttachmentsCreateInfo(struct vn_cs_encoder *enc, const VkFramebufferAttachmentsCreateInfo *val)
149 {
150 assert(val->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO);
151 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO });
152 vn_encode_VkFramebufferAttachmentsCreateInfo_pnext(enc, val->pNext);
153 vn_encode_VkFramebufferAttachmentsCreateInfo_self(enc, val);
154 }
155
156 /* struct VkFramebufferCreateInfo chain */
157
158 static inline size_t
vn_sizeof_VkFramebufferCreateInfo_pnext(const void * val)159 vn_sizeof_VkFramebufferCreateInfo_pnext(const void *val)
160 {
161 const VkBaseInStructure *pnext = val;
162 size_t size = 0;
163
164 while (pnext) {
165 switch ((int32_t)pnext->sType) {
166 case VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO:
167 size += vn_sizeof_simple_pointer(pnext);
168 size += vn_sizeof_VkStructureType(&pnext->sType);
169 size += vn_sizeof_VkFramebufferCreateInfo_pnext(pnext->pNext);
170 size += vn_sizeof_VkFramebufferAttachmentsCreateInfo_self((const VkFramebufferAttachmentsCreateInfo *)pnext);
171 return size;
172 default:
173 /* ignore unknown/unsupported struct */
174 break;
175 }
176 pnext = pnext->pNext;
177 }
178
179 return vn_sizeof_simple_pointer(NULL);
180 }
181
182 static inline size_t
vn_sizeof_VkFramebufferCreateInfo_self(const VkFramebufferCreateInfo * val)183 vn_sizeof_VkFramebufferCreateInfo_self(const VkFramebufferCreateInfo *val)
184 {
185 size_t size = 0;
186 /* skip val->{sType,pNext} */
187 size += vn_sizeof_VkFlags(&val->flags);
188 size += vn_sizeof_VkRenderPass(&val->renderPass);
189 size += vn_sizeof_uint32_t(&val->attachmentCount);
190 if (val->pAttachments) {
191 size += vn_sizeof_array_size(val->attachmentCount);
192 for (uint32_t i = 0; i < val->attachmentCount; i++)
193 size += vn_sizeof_VkImageView(&val->pAttachments[i]);
194 } else {
195 size += vn_sizeof_array_size(0);
196 }
197 size += vn_sizeof_uint32_t(&val->width);
198 size += vn_sizeof_uint32_t(&val->height);
199 size += vn_sizeof_uint32_t(&val->layers);
200 return size;
201 }
202
203 static inline size_t
vn_sizeof_VkFramebufferCreateInfo(const VkFramebufferCreateInfo * val)204 vn_sizeof_VkFramebufferCreateInfo(const VkFramebufferCreateInfo *val)
205 {
206 size_t size = 0;
207
208 size += vn_sizeof_VkStructureType(&val->sType);
209 size += vn_sizeof_VkFramebufferCreateInfo_pnext(val->pNext);
210 size += vn_sizeof_VkFramebufferCreateInfo_self(val);
211
212 return size;
213 }
214
215 static inline void
vn_encode_VkFramebufferCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)216 vn_encode_VkFramebufferCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
217 {
218 const VkBaseInStructure *pnext = val;
219
220 while (pnext) {
221 switch ((int32_t)pnext->sType) {
222 case VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO:
223 vn_encode_simple_pointer(enc, pnext);
224 vn_encode_VkStructureType(enc, &pnext->sType);
225 vn_encode_VkFramebufferCreateInfo_pnext(enc, pnext->pNext);
226 vn_encode_VkFramebufferAttachmentsCreateInfo_self(enc, (const VkFramebufferAttachmentsCreateInfo *)pnext);
227 return;
228 default:
229 /* ignore unknown/unsupported struct */
230 break;
231 }
232 pnext = pnext->pNext;
233 }
234
235 vn_encode_simple_pointer(enc, NULL);
236 }
237
238 static inline void
vn_encode_VkFramebufferCreateInfo_self(struct vn_cs_encoder * enc,const VkFramebufferCreateInfo * val)239 vn_encode_VkFramebufferCreateInfo_self(struct vn_cs_encoder *enc, const VkFramebufferCreateInfo *val)
240 {
241 /* skip val->{sType,pNext} */
242 vn_encode_VkFlags(enc, &val->flags);
243 vn_encode_VkRenderPass(enc, &val->renderPass);
244 vn_encode_uint32_t(enc, &val->attachmentCount);
245 if (val->pAttachments) {
246 vn_encode_array_size(enc, val->attachmentCount);
247 for (uint32_t i = 0; i < val->attachmentCount; i++)
248 vn_encode_VkImageView(enc, &val->pAttachments[i]);
249 } else {
250 vn_encode_array_size(enc, 0);
251 }
252 vn_encode_uint32_t(enc, &val->width);
253 vn_encode_uint32_t(enc, &val->height);
254 vn_encode_uint32_t(enc, &val->layers);
255 }
256
257 static inline void
vn_encode_VkFramebufferCreateInfo(struct vn_cs_encoder * enc,const VkFramebufferCreateInfo * val)258 vn_encode_VkFramebufferCreateInfo(struct vn_cs_encoder *enc, const VkFramebufferCreateInfo *val)
259 {
260 assert(val->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO);
261 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO });
262 vn_encode_VkFramebufferCreateInfo_pnext(enc, val->pNext);
263 vn_encode_VkFramebufferCreateInfo_self(enc, val);
264 }
265
vn_sizeof_vkCreateFramebuffer(VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)266 static inline size_t vn_sizeof_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
267 {
268 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFramebuffer_EXT;
269 const VkFlags cmd_flags = 0;
270 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
271
272 cmd_size += vn_sizeof_VkDevice(&device);
273 cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
274 if (pCreateInfo)
275 cmd_size += vn_sizeof_VkFramebufferCreateInfo(pCreateInfo);
276 cmd_size += vn_sizeof_simple_pointer(pAllocator);
277 if (pAllocator)
278 assert(false);
279 cmd_size += vn_sizeof_simple_pointer(pFramebuffer);
280 if (pFramebuffer)
281 cmd_size += vn_sizeof_VkFramebuffer(pFramebuffer);
282
283 return cmd_size;
284 }
285
vn_encode_vkCreateFramebuffer(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)286 static inline void vn_encode_vkCreateFramebuffer(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
287 {
288 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFramebuffer_EXT;
289
290 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
291 vn_encode_VkFlags(enc, &cmd_flags);
292
293 vn_encode_VkDevice(enc, &device);
294 if (vn_encode_simple_pointer(enc, pCreateInfo))
295 vn_encode_VkFramebufferCreateInfo(enc, pCreateInfo);
296 if (vn_encode_simple_pointer(enc, pAllocator))
297 assert(false);
298 if (vn_encode_simple_pointer(enc, pFramebuffer))
299 vn_encode_VkFramebuffer(enc, pFramebuffer);
300 }
301
vn_sizeof_vkCreateFramebuffer_reply(VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)302 static inline size_t vn_sizeof_vkCreateFramebuffer_reply(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
303 {
304 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFramebuffer_EXT;
305 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
306
307 VkResult ret;
308 cmd_size += vn_sizeof_VkResult(&ret);
309 /* skip device */
310 /* skip pCreateInfo */
311 /* skip pAllocator */
312 cmd_size += vn_sizeof_simple_pointer(pFramebuffer);
313 if (pFramebuffer)
314 cmd_size += vn_sizeof_VkFramebuffer(pFramebuffer);
315
316 return cmd_size;
317 }
318
vn_decode_vkCreateFramebuffer_reply(struct vn_cs_decoder * dec,VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)319 static inline VkResult vn_decode_vkCreateFramebuffer_reply(struct vn_cs_decoder *dec, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
320 {
321 VkCommandTypeEXT command_type;
322 vn_decode_VkCommandTypeEXT(dec, &command_type);
323 assert(command_type == VK_COMMAND_TYPE_vkCreateFramebuffer_EXT);
324
325 VkResult ret;
326 vn_decode_VkResult(dec, &ret);
327 /* skip device */
328 /* skip pCreateInfo */
329 /* skip pAllocator */
330 if (vn_decode_simple_pointer(dec)) {
331 vn_decode_VkFramebuffer(dec, pFramebuffer);
332 } else {
333 pFramebuffer = NULL;
334 }
335
336 return ret;
337 }
338
vn_sizeof_vkDestroyFramebuffer(VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)339 static inline size_t vn_sizeof_vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
340 {
341 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT;
342 const VkFlags cmd_flags = 0;
343 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
344
345 cmd_size += vn_sizeof_VkDevice(&device);
346 cmd_size += vn_sizeof_VkFramebuffer(&framebuffer);
347 cmd_size += vn_sizeof_simple_pointer(pAllocator);
348 if (pAllocator)
349 assert(false);
350
351 return cmd_size;
352 }
353
vn_encode_vkDestroyFramebuffer(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)354 static inline void vn_encode_vkDestroyFramebuffer(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
355 {
356 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT;
357
358 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
359 vn_encode_VkFlags(enc, &cmd_flags);
360
361 vn_encode_VkDevice(enc, &device);
362 vn_encode_VkFramebuffer(enc, &framebuffer);
363 if (vn_encode_simple_pointer(enc, pAllocator))
364 assert(false);
365 }
366
vn_sizeof_vkDestroyFramebuffer_reply(VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)367 static inline size_t vn_sizeof_vkDestroyFramebuffer_reply(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
368 {
369 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT;
370 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
371
372 /* skip device */
373 /* skip framebuffer */
374 /* skip pAllocator */
375
376 return cmd_size;
377 }
378
vn_decode_vkDestroyFramebuffer_reply(struct vn_cs_decoder * dec,VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)379 static inline void vn_decode_vkDestroyFramebuffer_reply(struct vn_cs_decoder *dec, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
380 {
381 VkCommandTypeEXT command_type;
382 vn_decode_VkCommandTypeEXT(dec, &command_type);
383 assert(command_type == VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT);
384
385 /* skip device */
386 /* skip framebuffer */
387 /* skip pAllocator */
388 }
389
vn_submit_vkCreateFramebuffer(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer,struct vn_instance_submit_command * submit)390 static inline void vn_submit_vkCreateFramebuffer(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer, struct vn_instance_submit_command *submit)
391 {
392 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
393 void *cmd_data = local_cmd_data;
394 size_t cmd_size = vn_sizeof_vkCreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
395 if (cmd_size > sizeof(local_cmd_data)) {
396 cmd_data = malloc(cmd_size);
397 if (!cmd_data)
398 cmd_size = 0;
399 }
400 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateFramebuffer_reply(device, pCreateInfo, pAllocator, pFramebuffer) : 0;
401
402 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
403 if (cmd_size) {
404 vn_encode_vkCreateFramebuffer(enc, cmd_flags, device, pCreateInfo, pAllocator, pFramebuffer);
405 vn_instance_submit_command(vn_instance, submit);
406 if (cmd_data != local_cmd_data)
407 free(cmd_data);
408 }
409 }
410
vn_submit_vkDestroyFramebuffer(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)411 static inline void vn_submit_vkDestroyFramebuffer(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
412 {
413 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
414 void *cmd_data = local_cmd_data;
415 size_t cmd_size = vn_sizeof_vkDestroyFramebuffer(device, framebuffer, pAllocator);
416 if (cmd_size > sizeof(local_cmd_data)) {
417 cmd_data = malloc(cmd_size);
418 if (!cmd_data)
419 cmd_size = 0;
420 }
421 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyFramebuffer_reply(device, framebuffer, pAllocator) : 0;
422
423 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
424 if (cmd_size) {
425 vn_encode_vkDestroyFramebuffer(enc, cmd_flags, device, framebuffer, pAllocator);
426 vn_instance_submit_command(vn_instance, submit);
427 if (cmd_data != local_cmd_data)
428 free(cmd_data);
429 }
430 }
431
vn_call_vkCreateFramebuffer(struct vn_instance * vn_instance,VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)432 static inline VkResult vn_call_vkCreateFramebuffer(struct vn_instance *vn_instance, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
433 {
434 VN_TRACE_FUNC();
435
436 struct vn_instance_submit_command submit;
437 vn_submit_vkCreateFramebuffer(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pFramebuffer, &submit);
438 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
439 if (dec) {
440 const VkResult ret = vn_decode_vkCreateFramebuffer_reply(dec, device, pCreateInfo, pAllocator, pFramebuffer);
441 vn_instance_free_command_reply(vn_instance, &submit);
442 return ret;
443 } else {
444 return VK_ERROR_OUT_OF_HOST_MEMORY;
445 }
446 }
447
vn_async_vkCreateFramebuffer(struct vn_instance * vn_instance,VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)448 static inline void vn_async_vkCreateFramebuffer(struct vn_instance *vn_instance, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
449 {
450 struct vn_instance_submit_command submit;
451 vn_submit_vkCreateFramebuffer(vn_instance, 0, device, pCreateInfo, pAllocator, pFramebuffer, &submit);
452 }
453
vn_call_vkDestroyFramebuffer(struct vn_instance * vn_instance,VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)454 static inline void vn_call_vkDestroyFramebuffer(struct vn_instance *vn_instance, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
455 {
456 VN_TRACE_FUNC();
457
458 struct vn_instance_submit_command submit;
459 vn_submit_vkDestroyFramebuffer(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, framebuffer, pAllocator, &submit);
460 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
461 if (dec) {
462 vn_decode_vkDestroyFramebuffer_reply(dec, device, framebuffer, pAllocator);
463 vn_instance_free_command_reply(vn_instance, &submit);
464 }
465 }
466
vn_async_vkDestroyFramebuffer(struct vn_instance * vn_instance,VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)467 static inline void vn_async_vkDestroyFramebuffer(struct vn_instance *vn_instance, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
468 {
469 struct vn_instance_submit_command submit;
470 vn_submit_vkDestroyFramebuffer(vn_instance, 0, device, framebuffer, pAllocator, &submit);
471 }
472
473 #endif /* VN_PROTOCOL_DRIVER_FRAMEBUFFER_H */
474