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_QUERY_POOL_H
9 #define VN_PROTOCOL_RENDERER_QUERY_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 VkQueryPoolCreateInfo chain */
18
19 static inline void *
vn_decode_VkQueryPoolCreateInfo_pnext_temp(struct vn_cs_decoder * dec)20 vn_decode_VkQueryPoolCreateInfo_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_VkQueryPoolCreateInfo_self_temp(struct vn_cs_decoder * dec,VkQueryPoolCreateInfo * val)29 vn_decode_VkQueryPoolCreateInfo_self_temp(struct vn_cs_decoder *dec, VkQueryPoolCreateInfo *val)
30 {
31 /* skip val->{sType,pNext} */
32 vn_decode_VkFlags(dec, &val->flags);
33 vn_decode_VkQueryType(dec, &val->queryType);
34 vn_decode_uint32_t(dec, &val->queryCount);
35 vn_decode_VkFlags(dec, &val->pipelineStatistics);
36 }
37
38 static inline void
vn_decode_VkQueryPoolCreateInfo_temp(struct vn_cs_decoder * dec,VkQueryPoolCreateInfo * val)39 vn_decode_VkQueryPoolCreateInfo_temp(struct vn_cs_decoder *dec, VkQueryPoolCreateInfo *val)
40 {
41 VkStructureType stype;
42 vn_decode_VkStructureType(dec, &stype);
43 if (stype != VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
44 vn_cs_decoder_set_fatal(dec);
45
46 val->sType = stype;
47 val->pNext = vn_decode_VkQueryPoolCreateInfo_pnext_temp(dec);
48 vn_decode_VkQueryPoolCreateInfo_self_temp(dec, val);
49 }
50
51 static inline void
vn_replace_VkQueryPoolCreateInfo_handle_self(VkQueryPoolCreateInfo * val)52 vn_replace_VkQueryPoolCreateInfo_handle_self(VkQueryPoolCreateInfo *val)
53 {
54 /* skip val->sType */
55 /* skip val->pNext */
56 /* skip val->flags */
57 /* skip val->queryType */
58 /* skip val->queryCount */
59 /* skip val->pipelineStatistics */
60 }
61
62 static inline void
vn_replace_VkQueryPoolCreateInfo_handle(VkQueryPoolCreateInfo * val)63 vn_replace_VkQueryPoolCreateInfo_handle(VkQueryPoolCreateInfo *val)
64 {
65 struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
66
67 do {
68 switch ((int32_t)pnext->sType) {
69 case VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO:
70 vn_replace_VkQueryPoolCreateInfo_handle_self((VkQueryPoolCreateInfo *)pnext);
71 break;
72 default:
73 /* ignore unknown/unsupported struct */
74 break;
75 }
76 pnext = pnext->pNext;
77 } while (pnext);
78 }
79
vn_decode_vkCreateQueryPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateQueryPool * args)80 static inline void vn_decode_vkCreateQueryPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateQueryPool *args)
81 {
82 vn_decode_VkDevice_lookup(dec, &args->device);
83 if (vn_decode_simple_pointer(dec)) {
84 args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
85 if (!args->pCreateInfo) return;
86 vn_decode_VkQueryPoolCreateInfo_temp(dec, (VkQueryPoolCreateInfo *)args->pCreateInfo);
87 } else {
88 args->pCreateInfo = NULL;
89 vn_cs_decoder_set_fatal(dec);
90 }
91 if (vn_decode_simple_pointer(dec)) {
92 vn_cs_decoder_set_fatal(dec);
93 } else {
94 args->pAllocator = NULL;
95 }
96 if (vn_decode_simple_pointer(dec)) {
97 args->pQueryPool = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pQueryPool));
98 if (!args->pQueryPool) return;
99 vn_decode_VkQueryPool(dec, args->pQueryPool);
100 } else {
101 args->pQueryPool = NULL;
102 vn_cs_decoder_set_fatal(dec);
103 }
104 }
105
vn_replace_vkCreateQueryPool_args_handle(struct vn_command_vkCreateQueryPool * args)106 static inline void vn_replace_vkCreateQueryPool_args_handle(struct vn_command_vkCreateQueryPool *args)
107 {
108 vn_replace_VkDevice_handle(&args->device);
109 if (args->pCreateInfo)
110 vn_replace_VkQueryPoolCreateInfo_handle((VkQueryPoolCreateInfo *)args->pCreateInfo);
111 /* skip args->pAllocator */
112 /* skip args->pQueryPool */
113 }
114
vn_encode_vkCreateQueryPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateQueryPool * args)115 static inline void vn_encode_vkCreateQueryPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateQueryPool *args)
116 {
117 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateQueryPool_EXT});
118
119 vn_encode_VkResult(enc, &args->ret);
120 /* skip args->device */
121 /* skip args->pCreateInfo */
122 /* skip args->pAllocator */
123 if (vn_encode_simple_pointer(enc, args->pQueryPool))
124 vn_encode_VkQueryPool(enc, args->pQueryPool);
125 }
126
vn_decode_vkDestroyQueryPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroyQueryPool * args)127 static inline void vn_decode_vkDestroyQueryPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroyQueryPool *args)
128 {
129 vn_decode_VkDevice_lookup(dec, &args->device);
130 vn_decode_VkQueryPool_lookup(dec, &args->queryPool);
131 if (vn_decode_simple_pointer(dec)) {
132 vn_cs_decoder_set_fatal(dec);
133 } else {
134 args->pAllocator = NULL;
135 }
136 }
137
vn_replace_vkDestroyQueryPool_args_handle(struct vn_command_vkDestroyQueryPool * args)138 static inline void vn_replace_vkDestroyQueryPool_args_handle(struct vn_command_vkDestroyQueryPool *args)
139 {
140 vn_replace_VkDevice_handle(&args->device);
141 vn_replace_VkQueryPool_handle(&args->queryPool);
142 /* skip args->pAllocator */
143 }
144
vn_encode_vkDestroyQueryPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroyQueryPool * args)145 static inline void vn_encode_vkDestroyQueryPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroyQueryPool *args)
146 {
147 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroyQueryPool_EXT});
148
149 /* skip args->device */
150 /* skip args->queryPool */
151 /* skip args->pAllocator */
152 }
153
vn_decode_vkGetQueryPoolResults_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetQueryPoolResults * args)154 static inline void vn_decode_vkGetQueryPoolResults_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetQueryPoolResults *args)
155 {
156 vn_decode_VkDevice_lookup(dec, &args->device);
157 vn_decode_VkQueryPool_lookup(dec, &args->queryPool);
158 vn_decode_uint32_t(dec, &args->firstQuery);
159 vn_decode_uint32_t(dec, &args->queryCount);
160 vn_decode_size_t(dec, &args->dataSize);
161 if (vn_peek_array_size(dec)) {
162 const size_t array_size = vn_decode_array_size(dec, args->dataSize);
163 args->pData = vn_cs_decoder_alloc_temp(dec, array_size);
164 if (!args->pData) return;
165 } else {
166 vn_decode_array_size(dec, args->dataSize);
167 args->pData = NULL;
168 }
169 vn_decode_VkDeviceSize(dec, &args->stride);
170 vn_decode_VkFlags(dec, &args->flags);
171 }
172
vn_replace_vkGetQueryPoolResults_args_handle(struct vn_command_vkGetQueryPoolResults * args)173 static inline void vn_replace_vkGetQueryPoolResults_args_handle(struct vn_command_vkGetQueryPoolResults *args)
174 {
175 vn_replace_VkDevice_handle(&args->device);
176 vn_replace_VkQueryPool_handle(&args->queryPool);
177 /* skip args->firstQuery */
178 /* skip args->queryCount */
179 /* skip args->dataSize */
180 /* skip args->pData */
181 /* skip args->stride */
182 /* skip args->flags */
183 }
184
vn_encode_vkGetQueryPoolResults_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetQueryPoolResults * args)185 static inline void vn_encode_vkGetQueryPoolResults_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetQueryPoolResults *args)
186 {
187 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT});
188
189 vn_encode_VkResult(enc, &args->ret);
190 /* skip args->device */
191 /* skip args->queryPool */
192 /* skip args->firstQuery */
193 /* skip args->queryCount */
194 /* skip args->dataSize */
195 if (args->pData) {
196 vn_encode_array_size(enc, args->dataSize);
197 vn_encode_blob_array(enc, args->pData, args->dataSize);
198 } else {
199 vn_encode_array_size(enc, 0);
200 }
201 /* skip args->stride */
202 /* skip args->flags */
203 }
204
vn_decode_vkResetQueryPool_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkResetQueryPool * args)205 static inline void vn_decode_vkResetQueryPool_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkResetQueryPool *args)
206 {
207 vn_decode_VkDevice_lookup(dec, &args->device);
208 vn_decode_VkQueryPool_lookup(dec, &args->queryPool);
209 vn_decode_uint32_t(dec, &args->firstQuery);
210 vn_decode_uint32_t(dec, &args->queryCount);
211 }
212
vn_replace_vkResetQueryPool_args_handle(struct vn_command_vkResetQueryPool * args)213 static inline void vn_replace_vkResetQueryPool_args_handle(struct vn_command_vkResetQueryPool *args)
214 {
215 vn_replace_VkDevice_handle(&args->device);
216 vn_replace_VkQueryPool_handle(&args->queryPool);
217 /* skip args->firstQuery */
218 /* skip args->queryCount */
219 }
220
vn_encode_vkResetQueryPool_reply(struct vn_cs_encoder * enc,const struct vn_command_vkResetQueryPool * args)221 static inline void vn_encode_vkResetQueryPool_reply(struct vn_cs_encoder *enc, const struct vn_command_vkResetQueryPool *args)
222 {
223 vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkResetQueryPool_EXT});
224
225 /* skip args->device */
226 /* skip args->queryPool */
227 /* skip args->firstQuery */
228 /* skip args->queryCount */
229 }
230
vn_dispatch_vkCreateQueryPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)231 static inline void vn_dispatch_vkCreateQueryPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
232 {
233 struct vn_command_vkCreateQueryPool args;
234
235 if (!ctx->dispatch_vkCreateQueryPool) {
236 vn_cs_decoder_set_fatal(ctx->decoder);
237 return;
238 }
239
240 vn_decode_vkCreateQueryPool_args_temp(ctx->decoder, &args);
241 if (!args.device) {
242 vn_cs_decoder_set_fatal(ctx->decoder);
243 return;
244 }
245
246 if (!vn_cs_decoder_get_fatal(ctx->decoder))
247 ctx->dispatch_vkCreateQueryPool(ctx, &args);
248
249 #ifdef DEBUG
250 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
251 vn_dispatch_debug_log(ctx, "vkCreateQueryPool returned %d", args.ret);
252 #endif
253
254 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
255 vn_encode_vkCreateQueryPool_reply(ctx->encoder, &args);
256
257 vn_cs_decoder_reset_temp_pool(ctx->decoder);
258 }
259
vn_dispatch_vkDestroyQueryPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)260 static inline void vn_dispatch_vkDestroyQueryPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
261 {
262 struct vn_command_vkDestroyQueryPool args;
263
264 if (!ctx->dispatch_vkDestroyQueryPool) {
265 vn_cs_decoder_set_fatal(ctx->decoder);
266 return;
267 }
268
269 vn_decode_vkDestroyQueryPool_args_temp(ctx->decoder, &args);
270 if (!args.device) {
271 vn_cs_decoder_set_fatal(ctx->decoder);
272 return;
273 }
274
275 if (!vn_cs_decoder_get_fatal(ctx->decoder))
276 ctx->dispatch_vkDestroyQueryPool(ctx, &args);
277
278
279 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
280 vn_encode_vkDestroyQueryPool_reply(ctx->encoder, &args);
281
282 vn_cs_decoder_reset_temp_pool(ctx->decoder);
283 }
284
vn_dispatch_vkGetQueryPoolResults(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)285 static inline void vn_dispatch_vkGetQueryPoolResults(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
286 {
287 struct vn_command_vkGetQueryPoolResults args;
288
289 if (!ctx->dispatch_vkGetQueryPoolResults) {
290 vn_cs_decoder_set_fatal(ctx->decoder);
291 return;
292 }
293
294 vn_decode_vkGetQueryPoolResults_args_temp(ctx->decoder, &args);
295 if (!args.device) {
296 vn_cs_decoder_set_fatal(ctx->decoder);
297 return;
298 }
299
300 if (!vn_cs_decoder_get_fatal(ctx->decoder))
301 ctx->dispatch_vkGetQueryPoolResults(ctx, &args);
302
303 #ifdef DEBUG
304 if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
305 vn_dispatch_debug_log(ctx, "vkGetQueryPoolResults returned %d", args.ret);
306 #endif
307
308 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
309 vn_encode_vkGetQueryPoolResults_reply(ctx->encoder, &args);
310
311 vn_cs_decoder_reset_temp_pool(ctx->decoder);
312 }
313
vn_dispatch_vkResetQueryPool(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)314 static inline void vn_dispatch_vkResetQueryPool(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
315 {
316 struct vn_command_vkResetQueryPool args;
317
318 if (!ctx->dispatch_vkResetQueryPool) {
319 vn_cs_decoder_set_fatal(ctx->decoder);
320 return;
321 }
322
323 vn_decode_vkResetQueryPool_args_temp(ctx->decoder, &args);
324 if (!args.device) {
325 vn_cs_decoder_set_fatal(ctx->decoder);
326 return;
327 }
328
329 if (!vn_cs_decoder_get_fatal(ctx->decoder))
330 ctx->dispatch_vkResetQueryPool(ctx, &args);
331
332
333 if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
334 vn_encode_vkResetQueryPool_reply(ctx->encoder, &args);
335
336 vn_cs_decoder_reset_temp_pool(ctx->decoder);
337 }
338
339 #pragma GCC diagnostic pop
340
341 #endif /* VN_PROTOCOL_RENDERER_QUERY_POOL_H */
342