1 /* This file is generated by venus-protocol.  See vn_protocol_renderer.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_RENDERER_DESCRIPTOR_SET_LAYOUT_H
9 #define VN_PROTOCOL_RENDERER_DESCRIPTOR_SET_LAYOUT_H
10 
11 #include "vn_protocol_renderer_structs.h"
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wpointer-arith"
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 /* struct VkDescriptorSetLayoutBinding */
18 
19 static inline void
vn_decode_VkDescriptorSetLayoutBinding_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutBinding * val)20 vn_decode_VkDescriptorSetLayoutBinding_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutBinding *val)
21 {
22     vn_decode_uint32_t(dec, &val->binding);
23     vn_decode_VkDescriptorType(dec, &val->descriptorType);
24     vn_decode_uint32_t(dec, &val->descriptorCount);
25     vn_decode_VkFlags(dec, &val->stageFlags);
26     if (vn_peek_array_size(dec)) {
27         const uint32_t iter_count = vn_decode_array_size(dec, val->descriptorCount);
28         val->pImmutableSamplers = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pImmutableSamplers) * iter_count);
29         if (!val->pImmutableSamplers) return;
30         for (uint32_t i = 0; i < iter_count; i++)
31             vn_decode_VkSampler_lookup(dec, &((VkSampler *)val->pImmutableSamplers)[i]);
32     } else {
33         vn_decode_array_size_unchecked(dec);
34         val->pImmutableSamplers = NULL;
35     }
36 }
37 
38 static inline void
vn_replace_VkDescriptorSetLayoutBinding_handle(VkDescriptorSetLayoutBinding * val)39 vn_replace_VkDescriptorSetLayoutBinding_handle(VkDescriptorSetLayoutBinding *val)
40 {
41     /* skip val->binding */
42     /* skip val->descriptorType */
43     /* skip val->descriptorCount */
44     /* skip val->stageFlags */
45     if (val->pImmutableSamplers) {
46        for (uint32_t i = 0; i < val->descriptorCount; i++)
47             vn_replace_VkSampler_handle(&((VkSampler *)val->pImmutableSamplers)[i]);
48     }
49 }
50 
51 /* struct VkDescriptorSetLayoutBindingFlagsCreateInfo chain */
52 
53 static inline void *
vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext_temp(struct vn_cs_decoder * dec)54 vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
55 {
56     /* no known/supported struct */
57     if (vn_decode_simple_pointer(dec))
58         vn_cs_decoder_set_fatal(dec);
59     return NULL;
60 }
61 
62 static inline void
vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutBindingFlagsCreateInfo * val)63 vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
64 {
65     /* skip val->{sType,pNext} */
66     vn_decode_uint32_t(dec, &val->bindingCount);
67     if (vn_peek_array_size(dec)) {
68         const uint32_t iter_count = vn_decode_array_size(dec, val->bindingCount);
69         val->pBindingFlags = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pBindingFlags) * iter_count);
70         if (!val->pBindingFlags) return;
71         for (uint32_t i = 0; i < iter_count; i++)
72             vn_decode_VkFlags(dec, &((VkDescriptorBindingFlags *)val->pBindingFlags)[i]);
73     } else {
74         vn_decode_array_size(dec, val->bindingCount);
75         val->pBindingFlags = NULL;
76     }
77 }
78 
79 static inline void
vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutBindingFlagsCreateInfo * val)80 vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
81 {
82     VkStructureType stype;
83     vn_decode_VkStructureType(dec, &stype);
84     if (stype != VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO)
85         vn_cs_decoder_set_fatal(dec);
86 
87     val->sType = stype;
88     val->pNext = vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext_temp(dec);
89     vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self_temp(dec, val);
90 }
91 
92 static inline void
vn_replace_VkDescriptorSetLayoutBindingFlagsCreateInfo_handle_self(VkDescriptorSetLayoutBindingFlagsCreateInfo * val)93 vn_replace_VkDescriptorSetLayoutBindingFlagsCreateInfo_handle_self(VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
94 {
95     /* skip val->sType */
96     /* skip val->pNext */
97     /* skip val->bindingCount */
98     /* skip val->pBindingFlags */
99 }
100 
101 static inline void
vn_replace_VkDescriptorSetLayoutBindingFlagsCreateInfo_handle(VkDescriptorSetLayoutBindingFlagsCreateInfo * val)102 vn_replace_VkDescriptorSetLayoutBindingFlagsCreateInfo_handle(VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
103 {
104     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
105 
106     do {
107         switch ((int32_t)pnext->sType) {
108         case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO:
109             vn_replace_VkDescriptorSetLayoutBindingFlagsCreateInfo_handle_self((VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext);
110             break;
111         default:
112             /* ignore unknown/unsupported struct */
113             break;
114         }
115         pnext = pnext->pNext;
116     } while (pnext);
117 }
118 
119 /* struct VkDescriptorSetLayoutCreateInfo chain */
120 
121 static inline void *
vn_decode_VkDescriptorSetLayoutCreateInfo_pnext_temp(struct vn_cs_decoder * dec)122 vn_decode_VkDescriptorSetLayoutCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
123 {
124     VkBaseOutStructure *pnext;
125     VkStructureType stype;
126 
127     if (!vn_decode_simple_pointer(dec))
128         return NULL;
129 
130     vn_decode_VkStructureType(dec, &stype);
131     switch ((int32_t)stype) {
132     case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO:
133         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkDescriptorSetLayoutBindingFlagsCreateInfo));
134         if (pnext) {
135             pnext->sType = stype;
136             pnext->pNext = vn_decode_VkDescriptorSetLayoutCreateInfo_pnext_temp(dec);
137             vn_decode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self_temp(dec, (VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext);
138         }
139         break;
140     case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT:
141         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkMutableDescriptorTypeCreateInfoEXT));
142         if (pnext) {
143             pnext->sType = stype;
144             pnext->pNext = vn_decode_VkDescriptorSetLayoutCreateInfo_pnext_temp(dec);
145             vn_decode_VkMutableDescriptorTypeCreateInfoEXT_self_temp(dec, (VkMutableDescriptorTypeCreateInfoEXT *)pnext);
146         }
147         break;
148     default:
149         /* unexpected struct */
150         pnext = NULL;
151         vn_cs_decoder_set_fatal(dec);
152         break;
153     }
154 
155     return pnext;
156 }
157 
158 static inline void
vn_decode_VkDescriptorSetLayoutCreateInfo_self_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutCreateInfo * val)159 vn_decode_VkDescriptorSetLayoutCreateInfo_self_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutCreateInfo *val)
160 {
161     /* skip val->{sType,pNext} */
162     vn_decode_VkFlags(dec, &val->flags);
163     vn_decode_uint32_t(dec, &val->bindingCount);
164     if (vn_peek_array_size(dec)) {
165         const uint32_t iter_count = vn_decode_array_size(dec, val->bindingCount);
166         val->pBindings = vn_cs_decoder_alloc_temp(dec, sizeof(*val->pBindings) * iter_count);
167         if (!val->pBindings) return;
168         for (uint32_t i = 0; i < iter_count; i++)
169             vn_decode_VkDescriptorSetLayoutBinding_temp(dec, &((VkDescriptorSetLayoutBinding *)val->pBindings)[i]);
170     } else {
171         vn_decode_array_size(dec, val->bindingCount);
172         val->pBindings = NULL;
173     }
174 }
175 
176 static inline void
vn_decode_VkDescriptorSetLayoutCreateInfo_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutCreateInfo * val)177 vn_decode_VkDescriptorSetLayoutCreateInfo_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutCreateInfo *val)
178 {
179     VkStructureType stype;
180     vn_decode_VkStructureType(dec, &stype);
181     if (stype != VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
182         vn_cs_decoder_set_fatal(dec);
183 
184     val->sType = stype;
185     val->pNext = vn_decode_VkDescriptorSetLayoutCreateInfo_pnext_temp(dec);
186     vn_decode_VkDescriptorSetLayoutCreateInfo_self_temp(dec, val);
187 }
188 
189 static inline void
vn_replace_VkDescriptorSetLayoutCreateInfo_handle_self(VkDescriptorSetLayoutCreateInfo * val)190 vn_replace_VkDescriptorSetLayoutCreateInfo_handle_self(VkDescriptorSetLayoutCreateInfo *val)
191 {
192     /* skip val->sType */
193     /* skip val->pNext */
194     /* skip val->flags */
195     /* skip val->bindingCount */
196     if (val->pBindings) {
197        for (uint32_t i = 0; i < val->bindingCount; i++)
198             vn_replace_VkDescriptorSetLayoutBinding_handle(&((VkDescriptorSetLayoutBinding *)val->pBindings)[i]);
199     }
200 }
201 
202 static inline void
vn_replace_VkDescriptorSetLayoutCreateInfo_handle(VkDescriptorSetLayoutCreateInfo * val)203 vn_replace_VkDescriptorSetLayoutCreateInfo_handle(VkDescriptorSetLayoutCreateInfo *val)
204 {
205     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
206 
207     do {
208         switch ((int32_t)pnext->sType) {
209         case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO:
210             vn_replace_VkDescriptorSetLayoutCreateInfo_handle_self((VkDescriptorSetLayoutCreateInfo *)pnext);
211             break;
212         case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO:
213             vn_replace_VkDescriptorSetLayoutBindingFlagsCreateInfo_handle_self((VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext);
214             break;
215         case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT:
216             vn_replace_VkMutableDescriptorTypeCreateInfoEXT_handle_self((VkMutableDescriptorTypeCreateInfoEXT *)pnext);
217             break;
218         default:
219             /* ignore unknown/unsupported struct */
220             break;
221         }
222         pnext = pnext->pNext;
223     } while (pnext);
224 }
225 
226 /* struct VkDescriptorSetVariableDescriptorCountLayoutSupport chain */
227 
228 static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(struct vn_cs_encoder * enc,const void * val)229 vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(struct vn_cs_encoder *enc, const void *val)
230 {
231     /* no known/supported struct */
232     vn_encode_simple_pointer(enc, NULL);
233 }
234 
235 static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(struct vn_cs_encoder * enc,const VkDescriptorSetVariableDescriptorCountLayoutSupport * val)236 vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(struct vn_cs_encoder *enc, const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
237 {
238     /* skip val->{sType,pNext} */
239     vn_encode_uint32_t(enc, &val->maxVariableDescriptorCount);
240 }
241 
242 static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport(struct vn_cs_encoder * enc,const VkDescriptorSetVariableDescriptorCountLayoutSupport * val)243 vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport(struct vn_cs_encoder *enc, const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
244 {
245     assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT);
246     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT });
247     vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(enc, val->pNext);
248     vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(enc, val);
249 }
250 
251 static inline void *
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial_temp(struct vn_cs_decoder * dec)252 vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial_temp(struct vn_cs_decoder *dec)
253 {
254     /* no known/supported struct */
255     if (vn_decode_simple_pointer(dec))
256         vn_cs_decoder_set_fatal(dec);
257     return NULL;
258 }
259 
260 static inline void
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial_temp(struct vn_cs_decoder * dec,VkDescriptorSetVariableDescriptorCountLayoutSupport * val)261 vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial_temp(struct vn_cs_decoder *dec, VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
262 {
263     /* skip val->{sType,pNext} */
264     /* skip val->maxVariableDescriptorCount */
265 }
266 
267 static inline void
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_partial_temp(struct vn_cs_decoder * dec,VkDescriptorSetVariableDescriptorCountLayoutSupport * val)268 vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_partial_temp(struct vn_cs_decoder *dec, VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
269 {
270     VkStructureType stype;
271     vn_decode_VkStructureType(dec, &stype);
272     if (stype != VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT)
273         vn_cs_decoder_set_fatal(dec);
274 
275     val->sType = stype;
276     val->pNext = vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial_temp(dec);
277     vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial_temp(dec, val);
278 }
279 
280 /* struct VkDescriptorSetLayoutSupport chain */
281 
282 static inline void
vn_encode_VkDescriptorSetLayoutSupport_pnext(struct vn_cs_encoder * enc,const void * val)283 vn_encode_VkDescriptorSetLayoutSupport_pnext(struct vn_cs_encoder *enc, const void *val)
284 {
285     const VkBaseInStructure *pnext = val;
286 
287     while (pnext) {
288         switch ((int32_t)pnext->sType) {
289         case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT:
290             vn_encode_simple_pointer(enc, pnext);
291             vn_encode_VkStructureType(enc, &pnext->sType);
292             vn_encode_VkDescriptorSetLayoutSupport_pnext(enc, pnext->pNext);
293             vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(enc, (const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext);
294             return;
295         default:
296             /* ignore unknown/unsupported struct */
297             break;
298         }
299         pnext = pnext->pNext;
300     }
301 
302     vn_encode_simple_pointer(enc, NULL);
303 }
304 
305 static inline void
vn_encode_VkDescriptorSetLayoutSupport_self(struct vn_cs_encoder * enc,const VkDescriptorSetLayoutSupport * val)306 vn_encode_VkDescriptorSetLayoutSupport_self(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutSupport *val)
307 {
308     /* skip val->{sType,pNext} */
309     vn_encode_VkBool32(enc, &val->supported);
310 }
311 
312 static inline void
vn_encode_VkDescriptorSetLayoutSupport(struct vn_cs_encoder * enc,const VkDescriptorSetLayoutSupport * val)313 vn_encode_VkDescriptorSetLayoutSupport(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutSupport *val)
314 {
315     assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT);
316     vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT });
317     vn_encode_VkDescriptorSetLayoutSupport_pnext(enc, val->pNext);
318     vn_encode_VkDescriptorSetLayoutSupport_self(enc, val);
319 }
320 
321 static inline void *
vn_decode_VkDescriptorSetLayoutSupport_pnext_partial_temp(struct vn_cs_decoder * dec)322 vn_decode_VkDescriptorSetLayoutSupport_pnext_partial_temp(struct vn_cs_decoder *dec)
323 {
324     VkBaseOutStructure *pnext;
325     VkStructureType stype;
326 
327     if (!vn_decode_simple_pointer(dec))
328         return NULL;
329 
330     vn_decode_VkStructureType(dec, &stype);
331     switch ((int32_t)stype) {
332     case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT:
333         pnext = vn_cs_decoder_alloc_temp(dec, sizeof(VkDescriptorSetVariableDescriptorCountLayoutSupport));
334         if (pnext) {
335             pnext->sType = stype;
336             pnext->pNext = vn_decode_VkDescriptorSetLayoutSupport_pnext_partial_temp(dec);
337             vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial_temp(dec, (VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext);
338         }
339         break;
340     default:
341         /* unexpected struct */
342         pnext = NULL;
343         vn_cs_decoder_set_fatal(dec);
344         break;
345     }
346 
347     return pnext;
348 }
349 
350 static inline void
vn_decode_VkDescriptorSetLayoutSupport_self_partial_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutSupport * val)351 vn_decode_VkDescriptorSetLayoutSupport_self_partial_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutSupport *val)
352 {
353     /* skip val->{sType,pNext} */
354     /* skip val->supported */
355 }
356 
357 static inline void
vn_decode_VkDescriptorSetLayoutSupport_partial_temp(struct vn_cs_decoder * dec,VkDescriptorSetLayoutSupport * val)358 vn_decode_VkDescriptorSetLayoutSupport_partial_temp(struct vn_cs_decoder *dec, VkDescriptorSetLayoutSupport *val)
359 {
360     VkStructureType stype;
361     vn_decode_VkStructureType(dec, &stype);
362     if (stype != VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT)
363         vn_cs_decoder_set_fatal(dec);
364 
365     val->sType = stype;
366     val->pNext = vn_decode_VkDescriptorSetLayoutSupport_pnext_partial_temp(dec);
367     vn_decode_VkDescriptorSetLayoutSupport_self_partial_temp(dec, val);
368 }
369 
vn_decode_vkCreateDescriptorSetLayout_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateDescriptorSetLayout * args)370 static inline void vn_decode_vkCreateDescriptorSetLayout_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateDescriptorSetLayout *args)
371 {
372     vn_decode_VkDevice_lookup(dec, &args->device);
373     if (vn_decode_simple_pointer(dec)) {
374         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
375         if (!args->pCreateInfo) return;
376         vn_decode_VkDescriptorSetLayoutCreateInfo_temp(dec, (VkDescriptorSetLayoutCreateInfo *)args->pCreateInfo);
377     } else {
378         args->pCreateInfo = NULL;
379         vn_cs_decoder_set_fatal(dec);
380     }
381     if (vn_decode_simple_pointer(dec)) {
382         vn_cs_decoder_set_fatal(dec);
383     } else {
384         args->pAllocator = NULL;
385     }
386     if (vn_decode_simple_pointer(dec)) {
387         args->pSetLayout = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSetLayout));
388         if (!args->pSetLayout) return;
389         vn_decode_VkDescriptorSetLayout(dec, args->pSetLayout);
390     } else {
391         args->pSetLayout = NULL;
392         vn_cs_decoder_set_fatal(dec);
393     }
394 }
395 
vn_replace_vkCreateDescriptorSetLayout_args_handle(struct vn_command_vkCreateDescriptorSetLayout * args)396 static inline void vn_replace_vkCreateDescriptorSetLayout_args_handle(struct vn_command_vkCreateDescriptorSetLayout *args)
397 {
398     vn_replace_VkDevice_handle(&args->device);
399     if (args->pCreateInfo)
400         vn_replace_VkDescriptorSetLayoutCreateInfo_handle((VkDescriptorSetLayoutCreateInfo *)args->pCreateInfo);
401     /* skip args->pAllocator */
402     /* skip args->pSetLayout */
403 }
404 
vn_encode_vkCreateDescriptorSetLayout_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateDescriptorSetLayout * args)405 static inline void vn_encode_vkCreateDescriptorSetLayout_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateDescriptorSetLayout *args)
406 {
407     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateDescriptorSetLayout_EXT});
408 
409     vn_encode_VkResult(enc, &args->ret);
410     /* skip args->device */
411     /* skip args->pCreateInfo */
412     /* skip args->pAllocator */
413     if (vn_encode_simple_pointer(enc, args->pSetLayout))
414         vn_encode_VkDescriptorSetLayout(enc, args->pSetLayout);
415 }
416 
vn_decode_vkDestroyDescriptorSetLayout_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroyDescriptorSetLayout * args)417 static inline void vn_decode_vkDestroyDescriptorSetLayout_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroyDescriptorSetLayout *args)
418 {
419     vn_decode_VkDevice_lookup(dec, &args->device);
420     vn_decode_VkDescriptorSetLayout_lookup(dec, &args->descriptorSetLayout);
421     if (vn_decode_simple_pointer(dec)) {
422         vn_cs_decoder_set_fatal(dec);
423     } else {
424         args->pAllocator = NULL;
425     }
426 }
427 
vn_replace_vkDestroyDescriptorSetLayout_args_handle(struct vn_command_vkDestroyDescriptorSetLayout * args)428 static inline void vn_replace_vkDestroyDescriptorSetLayout_args_handle(struct vn_command_vkDestroyDescriptorSetLayout *args)
429 {
430     vn_replace_VkDevice_handle(&args->device);
431     vn_replace_VkDescriptorSetLayout_handle(&args->descriptorSetLayout);
432     /* skip args->pAllocator */
433 }
434 
vn_encode_vkDestroyDescriptorSetLayout_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroyDescriptorSetLayout * args)435 static inline void vn_encode_vkDestroyDescriptorSetLayout_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroyDescriptorSetLayout *args)
436 {
437     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroyDescriptorSetLayout_EXT});
438 
439     /* skip args->device */
440     /* skip args->descriptorSetLayout */
441     /* skip args->pAllocator */
442 }
443 
vn_decode_vkGetDescriptorSetLayoutSupport_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetDescriptorSetLayoutSupport * args)444 static inline void vn_decode_vkGetDescriptorSetLayoutSupport_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetDescriptorSetLayoutSupport *args)
445 {
446     vn_decode_VkDevice_lookup(dec, &args->device);
447     if (vn_decode_simple_pointer(dec)) {
448         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
449         if (!args->pCreateInfo) return;
450         vn_decode_VkDescriptorSetLayoutCreateInfo_temp(dec, (VkDescriptorSetLayoutCreateInfo *)args->pCreateInfo);
451     } else {
452         args->pCreateInfo = NULL;
453         vn_cs_decoder_set_fatal(dec);
454     }
455     if (vn_decode_simple_pointer(dec)) {
456         args->pSupport = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pSupport));
457         if (!args->pSupport) return;
458         vn_decode_VkDescriptorSetLayoutSupport_partial_temp(dec, args->pSupport);
459     } else {
460         args->pSupport = NULL;
461         vn_cs_decoder_set_fatal(dec);
462     }
463 }
464 
vn_replace_vkGetDescriptorSetLayoutSupport_args_handle(struct vn_command_vkGetDescriptorSetLayoutSupport * args)465 static inline void vn_replace_vkGetDescriptorSetLayoutSupport_args_handle(struct vn_command_vkGetDescriptorSetLayoutSupport *args)
466 {
467     vn_replace_VkDevice_handle(&args->device);
468     if (args->pCreateInfo)
469         vn_replace_VkDescriptorSetLayoutCreateInfo_handle((VkDescriptorSetLayoutCreateInfo *)args->pCreateInfo);
470     /* skip args->pSupport */
471 }
472 
vn_encode_vkGetDescriptorSetLayoutSupport_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetDescriptorSetLayoutSupport * args)473 static inline void vn_encode_vkGetDescriptorSetLayoutSupport_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetDescriptorSetLayoutSupport *args)
474 {
475     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupport_EXT});
476 
477     /* skip args->device */
478     /* skip args->pCreateInfo */
479     if (vn_encode_simple_pointer(enc, args->pSupport))
480         vn_encode_VkDescriptorSetLayoutSupport(enc, args->pSupport);
481 }
482 
vn_dispatch_vkCreateDescriptorSetLayout(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)483 static inline void vn_dispatch_vkCreateDescriptorSetLayout(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
484 {
485     struct vn_command_vkCreateDescriptorSetLayout args;
486 
487     if (!ctx->dispatch_vkCreateDescriptorSetLayout) {
488         vn_cs_decoder_set_fatal(ctx->decoder);
489         return;
490     }
491 
492     vn_decode_vkCreateDescriptorSetLayout_args_temp(ctx->decoder, &args);
493     if (!args.device) {
494         vn_cs_decoder_set_fatal(ctx->decoder);
495         return;
496     }
497 
498     if (!vn_cs_decoder_get_fatal(ctx->decoder))
499         ctx->dispatch_vkCreateDescriptorSetLayout(ctx, &args);
500 
501 #ifdef DEBUG
502     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
503         vn_dispatch_debug_log(ctx, "vkCreateDescriptorSetLayout returned %d", args.ret);
504 #endif
505 
506     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
507        vn_encode_vkCreateDescriptorSetLayout_reply(ctx->encoder, &args);
508 
509     vn_cs_decoder_reset_temp_pool(ctx->decoder);
510 }
511 
vn_dispatch_vkDestroyDescriptorSetLayout(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)512 static inline void vn_dispatch_vkDestroyDescriptorSetLayout(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
513 {
514     struct vn_command_vkDestroyDescriptorSetLayout args;
515 
516     if (!ctx->dispatch_vkDestroyDescriptorSetLayout) {
517         vn_cs_decoder_set_fatal(ctx->decoder);
518         return;
519     }
520 
521     vn_decode_vkDestroyDescriptorSetLayout_args_temp(ctx->decoder, &args);
522     if (!args.device) {
523         vn_cs_decoder_set_fatal(ctx->decoder);
524         return;
525     }
526 
527     if (!vn_cs_decoder_get_fatal(ctx->decoder))
528         ctx->dispatch_vkDestroyDescriptorSetLayout(ctx, &args);
529 
530 
531     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
532        vn_encode_vkDestroyDescriptorSetLayout_reply(ctx->encoder, &args);
533 
534     vn_cs_decoder_reset_temp_pool(ctx->decoder);
535 }
536 
vn_dispatch_vkGetDescriptorSetLayoutSupport(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)537 static inline void vn_dispatch_vkGetDescriptorSetLayoutSupport(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
538 {
539     struct vn_command_vkGetDescriptorSetLayoutSupport args;
540 
541     if (!ctx->dispatch_vkGetDescriptorSetLayoutSupport) {
542         vn_cs_decoder_set_fatal(ctx->decoder);
543         return;
544     }
545 
546     vn_decode_vkGetDescriptorSetLayoutSupport_args_temp(ctx->decoder, &args);
547     if (!args.device) {
548         vn_cs_decoder_set_fatal(ctx->decoder);
549         return;
550     }
551 
552     if (!vn_cs_decoder_get_fatal(ctx->decoder))
553         ctx->dispatch_vkGetDescriptorSetLayoutSupport(ctx, &args);
554 
555 
556     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
557        vn_encode_vkGetDescriptorSetLayoutSupport_reply(ctx->encoder, &args);
558 
559     vn_cs_decoder_reset_temp_pool(ctx->decoder);
560 }
561 
562 #pragma GCC diagnostic pop
563 
564 #endif /* VN_PROTOCOL_RENDERER_DESCRIPTOR_SET_LAYOUT_H */
565