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_COMMAND_POOL_H
9 #define VN_PROTOCOL_RENDERER_COMMAND_POOL_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 VkCommandPoolCreateInfo chain */
18
19 static inline void *
vn_decode_VkCommandPoolCreateInfo_pnext_temp(struct vn_cs_decoder * dec)20 vn_decode_VkCommandPoolCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
21 {
22 /* no known/supported struct */
23 if (vn_decode_simple_pointer(dec))
24 vn_cs_decoder_set_fatal(dec);
25 return NULL;
26 }
27
28 static inline void
vn_decode_VkCommandPoolCreateInfo_self_temp(struct vn_cs_decoder * dec,VkCommandPoolCreateInfo * val)29 vn_decode_VkCommandPoolCreateInfo_self_temp(struct vn_cs_decoder *dec, VkCommandPoolCreateInfo *val)
30 {
31 /* skip val->{sType,pNext} */
32 vn_decode_VkFlags(dec, &val->flags);
33 vn_decode_uint32_t(dec, &val->queueFamilyIndex);
34 }
35
36 static inline void
vn_decode_VkCommandPoolCreateInfo_temp(struct vn_cs_decoder * dec,VkCommandPoolCreateInfo * val)37 vn_decode_VkCommandPoolCreateInfo_temp(struct vn_cs_decoder *dec, VkCommandPoolCreateInfo *val)
38 {
39 VkStructureType stype;
40 vn_decode_VkStructureType(dec, &stype);
41 if (stype != VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
42 vn_cs_decoder_set_fatal(dec);
43
44 val->sType = stype;
45 val->pNext = vn_decode_VkCommandPoolCreateInfo_pnext_temp(dec);
46 vn_decode_VkCommandPoolCreateInfo_self_temp(dec, val);
47 }
48
49 static inline void
vn_replace_VkCommandPoolCreateInfo_handle_self(VkCommandPoolCreateInfo * val)50 vn_replace_VkCommandPoolCreateInfo_handle_self(VkCommandPoolCreateInfo *val)
51 {
52 /* skip val->sType */
53 /* skip val->pNext */
54 /* skip val->flags */
55 /* skip val->queueFamilyIndex */
56 }
57
58 static inline void
vn_replace_VkCommandPoolCreateInfo_handle(VkCommandPoolCreateInfo * val)59 vn_replace_VkCommandPoolCreateInfo_handle(VkCommandPoolCreateInfo *val)
60 {
61 struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
62
63 do {
64 switch ((int32_t)pnext->sType) {
65 case VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO:
66 vn_replace_VkCommandPoolCreateInfo_handle_self((VkCommandPoolCreateInfo *)pnext);
67 break;
68 default:
69 /* ignore unknown/unsupported struct */
70 break;
71 }
72 pnext = pnext->pNext;
73 } while (pnext);
74 }
75
vn_decode_vkCreateCommandPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateCommandPool * args)76 static inline void vn_decode_vkCreateCommandPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateCommandPool *args)
77 {
78 vn_decode_VkDevice_lookup(dec, &args->device);
79 if (vn_decode_simple_pointer(dec)) {
80 args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
81 if (!args->pCreateInfo) return;
82 vn_decode_VkCommandPoolCreateInfo_temp(dec, (VkCommandPoolCreateInfo *)args->pCreateInfo);
83 } else {
84 args->pCreateInfo = NULL;
85 vn_cs_decoder_set_fatal(dec);
86 }
87 if (vn_decode_simple_pointer(dec)) {
88 vn_cs_decoder_set_fatal(dec);
89 } else {
90 args->pAllocator = NULL;
91 }
92 if (vn_decode_simple_pointer(dec)) {
93 args->pCommandPool = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCommandPool));
94 if (!args->pCommandPool) return;
95 vn_decode_VkCommandPool(dec, args->pCommandPool);
96 } else {
97 args->pCommandPool = NULL;
98 vn_cs_decoder_set_fatal(dec);
99 }
100 }
101
vn_replace_vkCreateCommandPool_args_handle(struct vn_command_vkCreateCommandPool * args)102 static inline void vn_replace_vkCreateCommandPool_args_handle(struct vn_command_vkCreateCommandPool *args)
103 {
104 vn_replace_VkDevice_handle(&args->device);
105 if (args->pCreateInfo)
106 vn_replace_VkCommandPoolCreateInfo_handle((VkCommandPoolCreateInfo *)args->pCreateInfo);
107 /* skip args->pAllocator */
108 /* skip args->pCommandPool */
109 }
110
vn_encode_vkCreateCommandPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateCommandPool * args)111 static inline void vn_encode_vkCreateCommandPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateCommandPool *args)
112 {
113 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateCommandPool_EXT});
114
115 vn_encode_VkResult(enc, &args->ret);
116 /* skip args->device */
117 /* skip args->pCreateInfo */
118 /* skip args->pAllocator */
119 if (vn_encode_simple_pointer(enc, args->pCommandPool))
120 vn_encode_VkCommandPool(enc, args->pCommandPool);
121 }
122
vn_decode_vkDestroyCommandPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroyCommandPool * args)123 static inline void vn_decode_vkDestroyCommandPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroyCommandPool *args)
124 {
125 vn_decode_VkDevice_lookup(dec, &args->device);
126 vn_decode_VkCommandPool_lookup(dec, &args->commandPool);
127 if (vn_decode_simple_pointer(dec)) {
128 vn_cs_decoder_set_fatal(dec);
129 } else {
130 args->pAllocator = NULL;
131 }
132 }
133
vn_replace_vkDestroyCommandPool_args_handle(struct vn_command_vkDestroyCommandPool * args)134 static inline void vn_replace_vkDestroyCommandPool_args_handle(struct vn_command_vkDestroyCommandPool *args)
135 {
136 vn_replace_VkDevice_handle(&args->device);
137 vn_replace_VkCommandPool_handle(&args->commandPool);
138 /* skip args->pAllocator */
139 }
140
vn_encode_vkDestroyCommandPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroyCommandPool * args)141 static inline void vn_encode_vkDestroyCommandPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroyCommandPool *args)
142 {
143 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroyCommandPool_EXT});
144
145 /* skip args->device */
146 /* skip args->commandPool */
147 /* skip args->pAllocator */
148 }
149
vn_decode_vkResetCommandPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkResetCommandPool * args)150 static inline void vn_decode_vkResetCommandPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkResetCommandPool *args)
151 {
152 vn_decode_VkDevice_lookup(dec, &args->device);
153 vn_decode_VkCommandPool_lookup(dec, &args->commandPool);
154 vn_decode_VkFlags(dec, &args->flags);
155 }
156
vn_replace_vkResetCommandPool_args_handle(struct vn_command_vkResetCommandPool * args)157 static inline void vn_replace_vkResetCommandPool_args_handle(struct vn_command_vkResetCommandPool *args)
158 {
159 vn_replace_VkDevice_handle(&args->device);
160 vn_replace_VkCommandPool_handle(&args->commandPool);
161 /* skip args->flags */
162 }
163
vn_encode_vkResetCommandPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkResetCommandPool * args)164 static inline void vn_encode_vkResetCommandPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkResetCommandPool *args)
165 {
166 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkResetCommandPool_EXT});
167
168 vn_encode_VkResult(enc, &args->ret);
169 /* skip args->device */
170 /* skip args->commandPool */
171 /* skip args->flags */
172 }
173
vn_decode_vkTrimCommandPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkTrimCommandPool * args)174 static inline void vn_decode_vkTrimCommandPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkTrimCommandPool *args)
175 {
176 vn_decode_VkDevice_lookup(dec, &args->device);
177 vn_decode_VkCommandPool_lookup(dec, &args->commandPool);
178 vn_decode_VkFlags(dec, &args->flags);
179 }
180
vn_replace_vkTrimCommandPool_args_handle(struct vn_command_vkTrimCommandPool * args)181 static inline void vn_replace_vkTrimCommandPool_args_handle(struct vn_command_vkTrimCommandPool *args)
182 {
183 vn_replace_VkDevice_handle(&args->device);
184 vn_replace_VkCommandPool_handle(&args->commandPool);
185 /* skip args->flags */
186 }
187
vn_encode_vkTrimCommandPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkTrimCommandPool * args)188 static inline void vn_encode_vkTrimCommandPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkTrimCommandPool *args)
189 {
190 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkTrimCommandPool_EXT});
191
192 /* skip args->device */
193 /* skip args->commandPool */
194 /* skip args->flags */
195 }
196
vn_dispatch_vkCreateCommandPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)197 static inline void vn_dispatch_vkCreateCommandPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
198 {
199 struct vn_command_vkCreateCommandPool args;
200
201 if (!ctx->dispatch_vkCreateCommandPool) {
202 vn_cs_decoder_set_fatal(ctx->decoder);
203 return;
204 }
205
206 vn_decode_vkCreateCommandPool_args_temp(ctx->decoder, &args);
207 if (!args.device) {
208 vn_cs_decoder_set_fatal(ctx->decoder);
209 return;
210 }
211
212 if (!vn_cs_decoder_get_fatal(ctx->decoder))
213 ctx->dispatch_vkCreateCommandPool(ctx, &args);
214
215 #ifdef DEBUG
216 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
217 vn_dispatch_debug_log(ctx, "vkCreateCommandPool returned %d", args.ret);
218 #endif
219
220 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
221 vn_encode_vkCreateCommandPool_reply(ctx->encoder, &args);
222
223 vn_cs_decoder_reset_temp_pool(ctx->decoder);
224 }
225
vn_dispatch_vkDestroyCommandPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)226 static inline void vn_dispatch_vkDestroyCommandPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
227 {
228 struct vn_command_vkDestroyCommandPool args;
229
230 if (!ctx->dispatch_vkDestroyCommandPool) {
231 vn_cs_decoder_set_fatal(ctx->decoder);
232 return;
233 }
234
235 vn_decode_vkDestroyCommandPool_args_temp(ctx->decoder, &args);
236 if (!args.device) {
237 vn_cs_decoder_set_fatal(ctx->decoder);
238 return;
239 }
240
241 if (!vn_cs_decoder_get_fatal(ctx->decoder))
242 ctx->dispatch_vkDestroyCommandPool(ctx, &args);
243
244
245 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
246 vn_encode_vkDestroyCommandPool_reply(ctx->encoder, &args);
247
248 vn_cs_decoder_reset_temp_pool(ctx->decoder);
249 }
250
vn_dispatch_vkResetCommandPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)251 static inline void vn_dispatch_vkResetCommandPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
252 {
253 struct vn_command_vkResetCommandPool args;
254
255 if (!ctx->dispatch_vkResetCommandPool) {
256 vn_cs_decoder_set_fatal(ctx->decoder);
257 return;
258 }
259
260 vn_decode_vkResetCommandPool_args_temp(ctx->decoder, &args);
261 if (!args.device) {
262 vn_cs_decoder_set_fatal(ctx->decoder);
263 return;
264 }
265
266 if (!vn_cs_decoder_get_fatal(ctx->decoder))
267 ctx->dispatch_vkResetCommandPool(ctx, &args);
268
269 #ifdef DEBUG
270 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
271 vn_dispatch_debug_log(ctx, "vkResetCommandPool returned %d", args.ret);
272 #endif
273
274 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
275 vn_encode_vkResetCommandPool_reply(ctx->encoder, &args);
276
277 vn_cs_decoder_reset_temp_pool(ctx->decoder);
278 }
279
vn_dispatch_vkTrimCommandPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)280 static inline void vn_dispatch_vkTrimCommandPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
281 {
282 struct vn_command_vkTrimCommandPool args;
283
284 if (!ctx->dispatch_vkTrimCommandPool) {
285 vn_cs_decoder_set_fatal(ctx->decoder);
286 return;
287 }
288
289 vn_decode_vkTrimCommandPool_args_temp(ctx->decoder, &args);
290 if (!args.device) {
291 vn_cs_decoder_set_fatal(ctx->decoder);
292 return;
293 }
294
295 if (!vn_cs_decoder_get_fatal(ctx->decoder))
296 ctx->dispatch_vkTrimCommandPool(ctx, &args);
297
298
299 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
300 vn_encode_vkTrimCommandPool_reply(ctx->encoder, &args);
301
302 vn_cs_decoder_reset_temp_pool(ctx->decoder);
303 }
304
305 #pragma GCC diagnostic pop
306
307 #endif /* VN_PROTOCOL_RENDERER_COMMAND_POOL_H */
308