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