• 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_PIPELINE_CACHE_H
9 #define VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H
10 
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13 
14 /* struct VkPipelineCacheCreateInfo chain */
15 
16 static inline size_t
vn_sizeof_VkPipelineCacheCreateInfo_pnext(const void * val)17 vn_sizeof_VkPipelineCacheCreateInfo_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_VkPipelineCacheCreateInfo_self(const VkPipelineCacheCreateInfo * val)24 vn_sizeof_VkPipelineCacheCreateInfo_self(const VkPipelineCacheCreateInfo *val)
25 {
26     size_t size = 0;
27     /* skip val->{sType,pNext} */
28     size += vn_sizeof_VkFlags(&val->flags);
29     size += vn_sizeof_size_t(&val->initialDataSize);
30     if (val->pInitialData) {
31         size += vn_sizeof_array_size(val->initialDataSize);
32         size += vn_sizeof_blob_array(val->pInitialData, val->initialDataSize);
33     } else {
34         size += vn_sizeof_array_size(0);
35     }
36     return size;
37 }
38 
39 static inline size_t
vn_sizeof_VkPipelineCacheCreateInfo(const VkPipelineCacheCreateInfo * val)40 vn_sizeof_VkPipelineCacheCreateInfo(const VkPipelineCacheCreateInfo *val)
41 {
42     size_t size = 0;
43 
44     size += vn_sizeof_VkStructureType(&val->sType);
45     size += vn_sizeof_VkPipelineCacheCreateInfo_pnext(val->pNext);
46     size += vn_sizeof_VkPipelineCacheCreateInfo_self(val);
47 
48     return size;
49 }
50 
51 static inline void
vn_encode_VkPipelineCacheCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)52 vn_encode_VkPipelineCacheCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
53 {
54     /* no known/supported struct */
55     vn_encode_simple_pointer(enc, NULL);
56 }
57 
58 static inline void
vn_encode_VkPipelineCacheCreateInfo_self(struct vn_cs_encoder * enc,const VkPipelineCacheCreateInfo * val)59 vn_encode_VkPipelineCacheCreateInfo_self(struct vn_cs_encoder *enc, const VkPipelineCacheCreateInfo *val)
60 {
61     /* skip val->{sType,pNext} */
62     vn_encode_VkFlags(enc, &val->flags);
63     vn_encode_size_t(enc, &val->initialDataSize);
64     if (val->pInitialData) {
65         vn_encode_array_size(enc, val->initialDataSize);
66         vn_encode_blob_array(enc, val->pInitialData, val->initialDataSize);
67     } else {
68         vn_encode_array_size(enc, 0);
69     }
70 }
71 
72 static inline void
vn_encode_VkPipelineCacheCreateInfo(struct vn_cs_encoder * enc,const VkPipelineCacheCreateInfo * val)73 vn_encode_VkPipelineCacheCreateInfo(struct vn_cs_encoder *enc, const VkPipelineCacheCreateInfo *val)
74 {
75     assert(val->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
76     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO });
77     vn_encode_VkPipelineCacheCreateInfo_pnext(enc, val->pNext);
78     vn_encode_VkPipelineCacheCreateInfo_self(enc, val);
79 }
80 
vn_sizeof_vkCreatePipelineCache(VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)81 static inline size_t vn_sizeof_vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
82 {
83     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineCache_EXT;
84     const VkFlags cmd_flags = 0;
85     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
86 
87     cmd_size += vn_sizeof_VkDevice(&device);
88     cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
89     if (pCreateInfo)
90         cmd_size += vn_sizeof_VkPipelineCacheCreateInfo(pCreateInfo);
91     cmd_size += vn_sizeof_simple_pointer(pAllocator);
92     if (pAllocator)
93         assert(false);
94     cmd_size += vn_sizeof_simple_pointer(pPipelineCache);
95     if (pPipelineCache)
96         cmd_size += vn_sizeof_VkPipelineCache(pPipelineCache);
97 
98     return cmd_size;
99 }
100 
vn_encode_vkCreatePipelineCache(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)101 static inline void vn_encode_vkCreatePipelineCache(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
102 {
103     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineCache_EXT;
104 
105     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
106     vn_encode_VkFlags(enc, &cmd_flags);
107 
108     vn_encode_VkDevice(enc, &device);
109     if (vn_encode_simple_pointer(enc, pCreateInfo))
110         vn_encode_VkPipelineCacheCreateInfo(enc, pCreateInfo);
111     if (vn_encode_simple_pointer(enc, pAllocator))
112         assert(false);
113     if (vn_encode_simple_pointer(enc, pPipelineCache))
114         vn_encode_VkPipelineCache(enc, pPipelineCache);
115 }
116 
vn_sizeof_vkCreatePipelineCache_reply(VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)117 static inline size_t vn_sizeof_vkCreatePipelineCache_reply(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
118 {
119     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineCache_EXT;
120     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
121 
122     VkResult ret;
123     cmd_size += vn_sizeof_VkResult(&ret);
124     /* skip device */
125     /* skip pCreateInfo */
126     /* skip pAllocator */
127     cmd_size += vn_sizeof_simple_pointer(pPipelineCache);
128     if (pPipelineCache)
129         cmd_size += vn_sizeof_VkPipelineCache(pPipelineCache);
130 
131     return cmd_size;
132 }
133 
vn_decode_vkCreatePipelineCache_reply(struct vn_cs_decoder * dec,VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)134 static inline VkResult vn_decode_vkCreatePipelineCache_reply(struct vn_cs_decoder *dec, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
135 {
136     VkCommandTypeEXT command_type;
137     vn_decode_VkCommandTypeEXT(dec, &command_type);
138     assert(command_type == VK_COMMAND_TYPE_vkCreatePipelineCache_EXT);
139 
140     VkResult ret;
141     vn_decode_VkResult(dec, &ret);
142     /* skip device */
143     /* skip pCreateInfo */
144     /* skip pAllocator */
145     if (vn_decode_simple_pointer(dec)) {
146         vn_decode_VkPipelineCache(dec, pPipelineCache);
147     } else {
148         pPipelineCache = NULL;
149     }
150 
151     return ret;
152 }
153 
vn_sizeof_vkDestroyPipelineCache(VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)154 static inline size_t vn_sizeof_vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
155 {
156     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT;
157     const VkFlags cmd_flags = 0;
158     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
159 
160     cmd_size += vn_sizeof_VkDevice(&device);
161     cmd_size += vn_sizeof_VkPipelineCache(&pipelineCache);
162     cmd_size += vn_sizeof_simple_pointer(pAllocator);
163     if (pAllocator)
164         assert(false);
165 
166     return cmd_size;
167 }
168 
vn_encode_vkDestroyPipelineCache(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)169 static inline void vn_encode_vkDestroyPipelineCache(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
170 {
171     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT;
172 
173     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
174     vn_encode_VkFlags(enc, &cmd_flags);
175 
176     vn_encode_VkDevice(enc, &device);
177     vn_encode_VkPipelineCache(enc, &pipelineCache);
178     if (vn_encode_simple_pointer(enc, pAllocator))
179         assert(false);
180 }
181 
vn_sizeof_vkDestroyPipelineCache_reply(VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)182 static inline size_t vn_sizeof_vkDestroyPipelineCache_reply(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
183 {
184     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT;
185     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
186 
187     /* skip device */
188     /* skip pipelineCache */
189     /* skip pAllocator */
190 
191     return cmd_size;
192 }
193 
vn_decode_vkDestroyPipelineCache_reply(struct vn_cs_decoder * dec,VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)194 static inline void vn_decode_vkDestroyPipelineCache_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
195 {
196     VkCommandTypeEXT command_type;
197     vn_decode_VkCommandTypeEXT(dec, &command_type);
198     assert(command_type == VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT);
199 
200     /* skip device */
201     /* skip pipelineCache */
202     /* skip pAllocator */
203 }
204 
vn_sizeof_vkGetPipelineCacheData(VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)205 static inline size_t vn_sizeof_vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
206 {
207     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT;
208     const VkFlags cmd_flags = 0;
209     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
210 
211     cmd_size += vn_sizeof_VkDevice(&device);
212     cmd_size += vn_sizeof_VkPipelineCache(&pipelineCache);
213     cmd_size += vn_sizeof_simple_pointer(pDataSize);
214     if (pDataSize)
215         cmd_size += vn_sizeof_size_t(pDataSize);
216     cmd_size += vn_sizeof_simple_pointer(pData); /* out */
217 
218     return cmd_size;
219 }
220 
vn_encode_vkGetPipelineCacheData(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)221 static inline void vn_encode_vkGetPipelineCacheData(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
222 {
223     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT;
224 
225     vn_encode_VkCommandTypeEXT(enc, &cmd_type);
226     vn_encode_VkFlags(enc, &cmd_flags);
227 
228     vn_encode_VkDevice(enc, &device);
229     vn_encode_VkPipelineCache(enc, &pipelineCache);
230     if (vn_encode_simple_pointer(enc, pDataSize))
231         vn_encode_size_t(enc, pDataSize);
232     vn_encode_array_size(enc, pData ? (pDataSize ? *pDataSize : 0) : 0); /* out */
233 }
234 
vn_sizeof_vkGetPipelineCacheData_reply(VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)235 static inline size_t vn_sizeof_vkGetPipelineCacheData_reply(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
236 {
237     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT;
238     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
239 
240     VkResult ret;
241     cmd_size += vn_sizeof_VkResult(&ret);
242     /* skip device */
243     /* skip pipelineCache */
244     cmd_size += vn_sizeof_simple_pointer(pDataSize);
245     if (pDataSize)
246         cmd_size += vn_sizeof_size_t(pDataSize);
247     if (pData) {
248         cmd_size += vn_sizeof_array_size((pDataSize ? *pDataSize : 0));
249         cmd_size += vn_sizeof_blob_array(pData, (pDataSize ? *pDataSize : 0));
250     } else {
251         cmd_size += vn_sizeof_array_size(0);
252     }
253 
254     return cmd_size;
255 }
256 
vn_decode_vkGetPipelineCacheData_reply(struct vn_cs_decoder * dec,VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)257 static inline VkResult vn_decode_vkGetPipelineCacheData_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
258 {
259     VkCommandTypeEXT command_type;
260     vn_decode_VkCommandTypeEXT(dec, &command_type);
261     assert(command_type == VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT);
262 
263     VkResult ret;
264     vn_decode_VkResult(dec, &ret);
265     /* skip device */
266     /* skip pipelineCache */
267     if (vn_decode_simple_pointer(dec)) {
268         vn_decode_size_t(dec, pDataSize);
269     } else {
270         pDataSize = NULL;
271     }
272     if (vn_peek_array_size(dec)) {
273         const size_t array_size = vn_decode_array_size(dec, (pDataSize ? *pDataSize : 0));
274         vn_decode_blob_array(dec, pData, array_size);
275     } else {
276         vn_decode_array_size_unchecked(dec);
277         pData = NULL;
278     }
279 
280     return ret;
281 }
282 
vn_sizeof_vkMergePipelineCaches(VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)283 static inline size_t vn_sizeof_vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
284 {
285     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkMergePipelineCaches_EXT;
286     const VkFlags cmd_flags = 0;
287     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
288 
289     cmd_size += vn_sizeof_VkDevice(&device);
290     cmd_size += vn_sizeof_VkPipelineCache(&dstCache);
291     cmd_size += vn_sizeof_uint32_t(&srcCacheCount);
292     if (pSrcCaches) {
293         cmd_size += vn_sizeof_array_size(srcCacheCount);
294         for (uint32_t i = 0; i < srcCacheCount; i++)
295             cmd_size += vn_sizeof_VkPipelineCache(&pSrcCaches[i]);
296     } else {
297         cmd_size += vn_sizeof_array_size(0);
298     }
299 
300     return cmd_size;
301 }
302 
vn_encode_vkMergePipelineCaches(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)303 static inline void vn_encode_vkMergePipelineCaches(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
304 {
305     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkMergePipelineCaches_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_VkPipelineCache(enc, &dstCache);
312     vn_encode_uint32_t(enc, &srcCacheCount);
313     if (pSrcCaches) {
314         vn_encode_array_size(enc, srcCacheCount);
315         for (uint32_t i = 0; i < srcCacheCount; i++)
316             vn_encode_VkPipelineCache(enc, &pSrcCaches[i]);
317     } else {
318         vn_encode_array_size(enc, 0);
319     }
320 }
321 
vn_sizeof_vkMergePipelineCaches_reply(VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)322 static inline size_t vn_sizeof_vkMergePipelineCaches_reply(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
323 {
324     const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkMergePipelineCaches_EXT;
325     size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
326 
327     VkResult ret;
328     cmd_size += vn_sizeof_VkResult(&ret);
329     /* skip device */
330     /* skip dstCache */
331     /* skip srcCacheCount */
332     /* skip pSrcCaches */
333 
334     return cmd_size;
335 }
336 
vn_decode_vkMergePipelineCaches_reply(struct vn_cs_decoder * dec,VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)337 static inline VkResult vn_decode_vkMergePipelineCaches_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
338 {
339     VkCommandTypeEXT command_type;
340     vn_decode_VkCommandTypeEXT(dec, &command_type);
341     assert(command_type == VK_COMMAND_TYPE_vkMergePipelineCaches_EXT);
342 
343     VkResult ret;
344     vn_decode_VkResult(dec, &ret);
345     /* skip device */
346     /* skip dstCache */
347     /* skip srcCacheCount */
348     /* skip pSrcCaches */
349 
350     return ret;
351 }
352 
vn_submit_vkCreatePipelineCache(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache,struct vn_instance_submit_command * submit)353 static inline void vn_submit_vkCreatePipelineCache(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache, struct vn_instance_submit_command *submit)
354 {
355     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
356     void *cmd_data = local_cmd_data;
357     size_t cmd_size = vn_sizeof_vkCreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
358     if (cmd_size > sizeof(local_cmd_data)) {
359         cmd_data = malloc(cmd_size);
360         if (!cmd_data)
361             cmd_size = 0;
362     }
363     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreatePipelineCache_reply(device, pCreateInfo, pAllocator, pPipelineCache) : 0;
364 
365     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
366     if (cmd_size) {
367         vn_encode_vkCreatePipelineCache(enc, cmd_flags, device, pCreateInfo, pAllocator, pPipelineCache);
368         vn_instance_submit_command(vn_instance, submit);
369         if (cmd_data != local_cmd_data)
370             free(cmd_data);
371     }
372 }
373 
vn_submit_vkDestroyPipelineCache(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)374 static inline void vn_submit_vkDestroyPipelineCache(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
375 {
376     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
377     void *cmd_data = local_cmd_data;
378     size_t cmd_size = vn_sizeof_vkDestroyPipelineCache(device, pipelineCache, pAllocator);
379     if (cmd_size > sizeof(local_cmd_data)) {
380         cmd_data = malloc(cmd_size);
381         if (!cmd_data)
382             cmd_size = 0;
383     }
384     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyPipelineCache_reply(device, pipelineCache, pAllocator) : 0;
385 
386     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
387     if (cmd_size) {
388         vn_encode_vkDestroyPipelineCache(enc, cmd_flags, device, pipelineCache, pAllocator);
389         vn_instance_submit_command(vn_instance, submit);
390         if (cmd_data != local_cmd_data)
391             free(cmd_data);
392     }
393 }
394 
vn_submit_vkGetPipelineCacheData(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData,struct vn_instance_submit_command * submit)395 static inline void vn_submit_vkGetPipelineCacheData(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData, struct vn_instance_submit_command *submit)
396 {
397     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
398     void *cmd_data = local_cmd_data;
399     size_t cmd_size = vn_sizeof_vkGetPipelineCacheData(device, pipelineCache, pDataSize, pData);
400     if (cmd_size > sizeof(local_cmd_data)) {
401         cmd_data = malloc(cmd_size);
402         if (!cmd_data)
403             cmd_size = 0;
404     }
405     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetPipelineCacheData_reply(device, pipelineCache, pDataSize, pData) : 0;
406 
407     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
408     if (cmd_size) {
409         vn_encode_vkGetPipelineCacheData(enc, cmd_flags, device, pipelineCache, pDataSize, pData);
410         vn_instance_submit_command(vn_instance, submit);
411         if (cmd_data != local_cmd_data)
412             free(cmd_data);
413     }
414 }
415 
vn_submit_vkMergePipelineCaches(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches,struct vn_instance_submit_command * submit)416 static inline void vn_submit_vkMergePipelineCaches(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches, struct vn_instance_submit_command *submit)
417 {
418     uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
419     void *cmd_data = local_cmd_data;
420     size_t cmd_size = vn_sizeof_vkMergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
421     if (cmd_size > sizeof(local_cmd_data)) {
422         cmd_data = malloc(cmd_size);
423         if (!cmd_data)
424             cmd_size = 0;
425     }
426     const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkMergePipelineCaches_reply(device, dstCache, srcCacheCount, pSrcCaches) : 0;
427 
428     struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
429     if (cmd_size) {
430         vn_encode_vkMergePipelineCaches(enc, cmd_flags, device, dstCache, srcCacheCount, pSrcCaches);
431         vn_instance_submit_command(vn_instance, submit);
432         if (cmd_data != local_cmd_data)
433             free(cmd_data);
434     }
435 }
436 
vn_call_vkCreatePipelineCache(struct vn_instance * vn_instance,VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)437 static inline VkResult vn_call_vkCreatePipelineCache(struct vn_instance *vn_instance, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
438 {
439     VN_TRACE_FUNC();
440 
441     struct vn_instance_submit_command submit;
442     vn_submit_vkCreatePipelineCache(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pPipelineCache, &submit);
443     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
444     if (dec) {
445         const VkResult ret = vn_decode_vkCreatePipelineCache_reply(dec, device, pCreateInfo, pAllocator, pPipelineCache);
446         vn_instance_free_command_reply(vn_instance, &submit);
447         return ret;
448     } else {
449         return VK_ERROR_OUT_OF_HOST_MEMORY;
450     }
451 }
452 
vn_async_vkCreatePipelineCache(struct vn_instance * vn_instance,VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)453 static inline void vn_async_vkCreatePipelineCache(struct vn_instance *vn_instance, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
454 {
455     struct vn_instance_submit_command submit;
456     vn_submit_vkCreatePipelineCache(vn_instance, 0, device, pCreateInfo, pAllocator, pPipelineCache, &submit);
457 }
458 
vn_call_vkDestroyPipelineCache(struct vn_instance * vn_instance,VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)459 static inline void vn_call_vkDestroyPipelineCache(struct vn_instance *vn_instance, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
460 {
461     VN_TRACE_FUNC();
462 
463     struct vn_instance_submit_command submit;
464     vn_submit_vkDestroyPipelineCache(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pipelineCache, pAllocator, &submit);
465     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
466     if (dec) {
467         vn_decode_vkDestroyPipelineCache_reply(dec, device, pipelineCache, pAllocator);
468         vn_instance_free_command_reply(vn_instance, &submit);
469     }
470 }
471 
vn_async_vkDestroyPipelineCache(struct vn_instance * vn_instance,VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)472 static inline void vn_async_vkDestroyPipelineCache(struct vn_instance *vn_instance, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
473 {
474     struct vn_instance_submit_command submit;
475     vn_submit_vkDestroyPipelineCache(vn_instance, 0, device, pipelineCache, pAllocator, &submit);
476 }
477 
vn_call_vkGetPipelineCacheData(struct vn_instance * vn_instance,VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)478 static inline VkResult vn_call_vkGetPipelineCacheData(struct vn_instance *vn_instance, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
479 {
480     VN_TRACE_FUNC();
481 
482     struct vn_instance_submit_command submit;
483     vn_submit_vkGetPipelineCacheData(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pipelineCache, pDataSize, pData, &submit);
484     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
485     if (dec) {
486         const VkResult ret = vn_decode_vkGetPipelineCacheData_reply(dec, device, pipelineCache, pDataSize, pData);
487         vn_instance_free_command_reply(vn_instance, &submit);
488         return ret;
489     } else {
490         return VK_ERROR_OUT_OF_HOST_MEMORY;
491     }
492 }
493 
vn_async_vkGetPipelineCacheData(struct vn_instance * vn_instance,VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)494 static inline void vn_async_vkGetPipelineCacheData(struct vn_instance *vn_instance, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
495 {
496     struct vn_instance_submit_command submit;
497     vn_submit_vkGetPipelineCacheData(vn_instance, 0, device, pipelineCache, pDataSize, pData, &submit);
498 }
499 
vn_call_vkMergePipelineCaches(struct vn_instance * vn_instance,VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)500 static inline VkResult vn_call_vkMergePipelineCaches(struct vn_instance *vn_instance, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
501 {
502     VN_TRACE_FUNC();
503 
504     struct vn_instance_submit_command submit;
505     vn_submit_vkMergePipelineCaches(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, dstCache, srcCacheCount, pSrcCaches, &submit);
506     struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
507     if (dec) {
508         const VkResult ret = vn_decode_vkMergePipelineCaches_reply(dec, device, dstCache, srcCacheCount, pSrcCaches);
509         vn_instance_free_command_reply(vn_instance, &submit);
510         return ret;
511     } else {
512         return VK_ERROR_OUT_OF_HOST_MEMORY;
513     }
514 }
515 
vn_async_vkMergePipelineCaches(struct vn_instance * vn_instance,VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)516 static inline void vn_async_vkMergePipelineCaches(struct vn_instance *vn_instance, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
517 {
518     struct vn_instance_submit_command submit;
519     vn_submit_vkMergePipelineCaches(vn_instance, 0, device, dstCache, srcCacheCount, pSrcCaches, &submit);
520 }
521 
522 #endif /* VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H */
523