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_QUERY_POOL_H
9 #define VN_PROTOCOL_DRIVER_QUERY_POOL_H
10
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13
14 /* struct VkQueryPoolCreateInfo chain */
15
16 static inline size_t
vn_sizeof_VkQueryPoolCreateInfo_pnext(const void * val)17 vn_sizeof_VkQueryPoolCreateInfo_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_VkQueryPoolCreateInfo_self(const VkQueryPoolCreateInfo * val)24 vn_sizeof_VkQueryPoolCreateInfo_self(const VkQueryPoolCreateInfo *val)
25 {
26 size_t size = 0;
27 /* skip val->{sType,pNext} */
28 size += vn_sizeof_VkFlags(&val->flags);
29 size += vn_sizeof_VkQueryType(&val->queryType);
30 size += vn_sizeof_uint32_t(&val->queryCount);
31 size += vn_sizeof_VkFlags(&val->pipelineStatistics);
32 return size;
33 }
34
35 static inline size_t
vn_sizeof_VkQueryPoolCreateInfo(const VkQueryPoolCreateInfo * val)36 vn_sizeof_VkQueryPoolCreateInfo(const VkQueryPoolCreateInfo *val)
37 {
38 size_t size = 0;
39
40 size += vn_sizeof_VkStructureType(&val->sType);
41 size += vn_sizeof_VkQueryPoolCreateInfo_pnext(val->pNext);
42 size += vn_sizeof_VkQueryPoolCreateInfo_self(val);
43
44 return size;
45 }
46
47 static inline void
vn_encode_VkQueryPoolCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)48 vn_encode_VkQueryPoolCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
49 {
50 /* no known/supported struct */
51 vn_encode_simple_pointer(enc, NULL);
52 }
53
54 static inline void
vn_encode_VkQueryPoolCreateInfo_self(struct vn_cs_encoder * enc,const VkQueryPoolCreateInfo * val)55 vn_encode_VkQueryPoolCreateInfo_self(struct vn_cs_encoder *enc, const VkQueryPoolCreateInfo *val)
56 {
57 /* skip val->{sType,pNext} */
58 vn_encode_VkFlags(enc, &val->flags);
59 vn_encode_VkQueryType(enc, &val->queryType);
60 vn_encode_uint32_t(enc, &val->queryCount);
61 vn_encode_VkFlags(enc, &val->pipelineStatistics);
62 }
63
64 static inline void
vn_encode_VkQueryPoolCreateInfo(struct vn_cs_encoder * enc,const VkQueryPoolCreateInfo * val)65 vn_encode_VkQueryPoolCreateInfo(struct vn_cs_encoder *enc, const VkQueryPoolCreateInfo *val)
66 {
67 assert(val->sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO);
68 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO });
69 vn_encode_VkQueryPoolCreateInfo_pnext(enc, val->pNext);
70 vn_encode_VkQueryPoolCreateInfo_self(enc, val);
71 }
72
vn_sizeof_vkCreateQueryPool(VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)73 static inline size_t vn_sizeof_vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
74 {
75 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateQueryPool_EXT;
76 const VkFlags cmd_flags = 0;
77 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
78
79 cmd_size += vn_sizeof_VkDevice(&device);
80 cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
81 if (pCreateInfo)
82 cmd_size += vn_sizeof_VkQueryPoolCreateInfo(pCreateInfo);
83 cmd_size += vn_sizeof_simple_pointer(pAllocator);
84 if (pAllocator)
85 assert(false);
86 cmd_size += vn_sizeof_simple_pointer(pQueryPool);
87 if (pQueryPool)
88 cmd_size += vn_sizeof_VkQueryPool(pQueryPool);
89
90 return cmd_size;
91 }
92
vn_encode_vkCreateQueryPool(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)93 static inline void vn_encode_vkCreateQueryPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
94 {
95 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateQueryPool_EXT;
96
97 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
98 vn_encode_VkFlags(enc, &cmd_flags);
99
100 vn_encode_VkDevice(enc, &device);
101 if (vn_encode_simple_pointer(enc, pCreateInfo))
102 vn_encode_VkQueryPoolCreateInfo(enc, pCreateInfo);
103 if (vn_encode_simple_pointer(enc, pAllocator))
104 assert(false);
105 if (vn_encode_simple_pointer(enc, pQueryPool))
106 vn_encode_VkQueryPool(enc, pQueryPool);
107 }
108
vn_sizeof_vkCreateQueryPool_reply(VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)109 static inline size_t vn_sizeof_vkCreateQueryPool_reply(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
110 {
111 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateQueryPool_EXT;
112 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
113
114 VkResult ret;
115 cmd_size += vn_sizeof_VkResult(&ret);
116 /* skip device */
117 /* skip pCreateInfo */
118 /* skip pAllocator */
119 cmd_size += vn_sizeof_simple_pointer(pQueryPool);
120 if (pQueryPool)
121 cmd_size += vn_sizeof_VkQueryPool(pQueryPool);
122
123 return cmd_size;
124 }
125
vn_decode_vkCreateQueryPool_reply(struct vn_cs_decoder * dec,VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)126 static inline VkResult vn_decode_vkCreateQueryPool_reply(struct vn_cs_decoder *dec, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
127 {
128 VkCommandTypeEXT command_type;
129 vn_decode_VkCommandTypeEXT(dec, &command_type);
130 assert(command_type == VK_COMMAND_TYPE_vkCreateQueryPool_EXT);
131
132 VkResult ret;
133 vn_decode_VkResult(dec, &ret);
134 /* skip device */
135 /* skip pCreateInfo */
136 /* skip pAllocator */
137 if (vn_decode_simple_pointer(dec)) {
138 vn_decode_VkQueryPool(dec, pQueryPool);
139 } else {
140 pQueryPool = NULL;
141 }
142
143 return ret;
144 }
145
vn_sizeof_vkDestroyQueryPool(VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)146 static inline size_t vn_sizeof_vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
147 {
148 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyQueryPool_EXT;
149 const VkFlags cmd_flags = 0;
150 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
151
152 cmd_size += vn_sizeof_VkDevice(&device);
153 cmd_size += vn_sizeof_VkQueryPool(&queryPool);
154 cmd_size += vn_sizeof_simple_pointer(pAllocator);
155 if (pAllocator)
156 assert(false);
157
158 return cmd_size;
159 }
160
vn_encode_vkDestroyQueryPool(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)161 static inline void vn_encode_vkDestroyQueryPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
162 {
163 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyQueryPool_EXT;
164
165 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
166 vn_encode_VkFlags(enc, &cmd_flags);
167
168 vn_encode_VkDevice(enc, &device);
169 vn_encode_VkQueryPool(enc, &queryPool);
170 if (vn_encode_simple_pointer(enc, pAllocator))
171 assert(false);
172 }
173
vn_sizeof_vkDestroyQueryPool_reply(VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)174 static inline size_t vn_sizeof_vkDestroyQueryPool_reply(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
175 {
176 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyQueryPool_EXT;
177 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
178
179 /* skip device */
180 /* skip queryPool */
181 /* skip pAllocator */
182
183 return cmd_size;
184 }
185
vn_decode_vkDestroyQueryPool_reply(struct vn_cs_decoder * dec,VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)186 static inline void vn_decode_vkDestroyQueryPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
187 {
188 VkCommandTypeEXT command_type;
189 vn_decode_VkCommandTypeEXT(dec, &command_type);
190 assert(command_type == VK_COMMAND_TYPE_vkDestroyQueryPool_EXT);
191
192 /* skip device */
193 /* skip queryPool */
194 /* skip pAllocator */
195 }
196
vn_sizeof_vkGetQueryPoolResults(VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)197 static inline size_t vn_sizeof_vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
198 {
199 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT;
200 const VkFlags cmd_flags = 0;
201 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
202
203 cmd_size += vn_sizeof_VkDevice(&device);
204 cmd_size += vn_sizeof_VkQueryPool(&queryPool);
205 cmd_size += vn_sizeof_uint32_t(&firstQuery);
206 cmd_size += vn_sizeof_uint32_t(&queryCount);
207 cmd_size += vn_sizeof_size_t(&dataSize);
208 cmd_size += vn_sizeof_simple_pointer(pData); /* out */
209 cmd_size += vn_sizeof_VkDeviceSize(&stride);
210 cmd_size += vn_sizeof_VkFlags(&flags);
211
212 return cmd_size;
213 }
214
vn_encode_vkGetQueryPoolResults(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)215 static inline void vn_encode_vkGetQueryPoolResults(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
216 {
217 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT;
218
219 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
220 vn_encode_VkFlags(enc, &cmd_flags);
221
222 vn_encode_VkDevice(enc, &device);
223 vn_encode_VkQueryPool(enc, &queryPool);
224 vn_encode_uint32_t(enc, &firstQuery);
225 vn_encode_uint32_t(enc, &queryCount);
226 vn_encode_size_t(enc, &dataSize);
227 vn_encode_array_size(enc, pData ? dataSize : 0); /* out */
228 vn_encode_VkDeviceSize(enc, &stride);
229 vn_encode_VkFlags(enc, &flags);
230 }
231
vn_sizeof_vkGetQueryPoolResults_reply(VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)232 static inline size_t vn_sizeof_vkGetQueryPoolResults_reply(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
233 {
234 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT;
235 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
236
237 VkResult ret;
238 cmd_size += vn_sizeof_VkResult(&ret);
239 /* skip device */
240 /* skip queryPool */
241 /* skip firstQuery */
242 /* skip queryCount */
243 /* skip dataSize */
244 if (pData) {
245 cmd_size += vn_sizeof_array_size(dataSize);
246 cmd_size += vn_sizeof_blob_array(pData, dataSize);
247 } else {
248 cmd_size += vn_sizeof_array_size(0);
249 }
250 /* skip stride */
251 /* skip flags */
252
253 return cmd_size;
254 }
255
vn_decode_vkGetQueryPoolResults_reply(struct vn_cs_decoder * dec,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)256 static inline VkResult vn_decode_vkGetQueryPoolResults_reply(struct vn_cs_decoder *dec, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
257 {
258 VkCommandTypeEXT command_type;
259 vn_decode_VkCommandTypeEXT(dec, &command_type);
260 assert(command_type == VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT);
261
262 VkResult ret;
263 vn_decode_VkResult(dec, &ret);
264 /* skip device */
265 /* skip queryPool */
266 /* skip firstQuery */
267 /* skip queryCount */
268 /* skip dataSize */
269 if (vn_peek_array_size(dec)) {
270 const size_t array_size = vn_decode_array_size(dec, dataSize);
271 vn_decode_blob_array(dec, pData, array_size);
272 } else {
273 vn_decode_array_size_unchecked(dec);
274 pData = NULL;
275 }
276 /* skip stride */
277 /* skip flags */
278
279 return ret;
280 }
281
vn_sizeof_vkResetQueryPool(VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)282 static inline size_t vn_sizeof_vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
283 {
284 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetQueryPool_EXT;
285 const VkFlags cmd_flags = 0;
286 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
287
288 cmd_size += vn_sizeof_VkDevice(&device);
289 cmd_size += vn_sizeof_VkQueryPool(&queryPool);
290 cmd_size += vn_sizeof_uint32_t(&firstQuery);
291 cmd_size += vn_sizeof_uint32_t(&queryCount);
292
293 return cmd_size;
294 }
295
vn_encode_vkResetQueryPool(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)296 static inline void vn_encode_vkResetQueryPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
297 {
298 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetQueryPool_EXT;
299
300 vn_encode_VkCommandTypeEXT(enc, &cmd_type);
301 vn_encode_VkFlags(enc, &cmd_flags);
302
303 vn_encode_VkDevice(enc, &device);
304 vn_encode_VkQueryPool(enc, &queryPool);
305 vn_encode_uint32_t(enc, &firstQuery);
306 vn_encode_uint32_t(enc, &queryCount);
307 }
308
vn_sizeof_vkResetQueryPool_reply(VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)309 static inline size_t vn_sizeof_vkResetQueryPool_reply(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
310 {
311 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetQueryPool_EXT;
312 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
313
314 /* skip device */
315 /* skip queryPool */
316 /* skip firstQuery */
317 /* skip queryCount */
318
319 return cmd_size;
320 }
321
vn_decode_vkResetQueryPool_reply(struct vn_cs_decoder * dec,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)322 static inline void vn_decode_vkResetQueryPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
323 {
324 VkCommandTypeEXT command_type;
325 vn_decode_VkCommandTypeEXT(dec, &command_type);
326 assert(command_type == VK_COMMAND_TYPE_vkResetQueryPool_EXT);
327
328 /* skip device */
329 /* skip queryPool */
330 /* skip firstQuery */
331 /* skip queryCount */
332 }
333
vn_submit_vkCreateQueryPool(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool,struct vn_instance_submit_command * submit)334 static inline void vn_submit_vkCreateQueryPool(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool, struct vn_instance_submit_command *submit)
335 {
336 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
337 void *cmd_data = local_cmd_data;
338 size_t cmd_size = vn_sizeof_vkCreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
339 if (cmd_size > sizeof(local_cmd_data)) {
340 cmd_data = malloc(cmd_size);
341 if (!cmd_data)
342 cmd_size = 0;
343 }
344 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateQueryPool_reply(device, pCreateInfo, pAllocator, pQueryPool) : 0;
345
346 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
347 if (cmd_size) {
348 vn_encode_vkCreateQueryPool(enc, cmd_flags, device, pCreateInfo, pAllocator, pQueryPool);
349 vn_instance_submit_command(vn_instance, submit);
350 if (cmd_data != local_cmd_data)
351 free(cmd_data);
352 }
353 }
354
vn_submit_vkDestroyQueryPool(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)355 static inline void vn_submit_vkDestroyQueryPool(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
356 {
357 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
358 void *cmd_data = local_cmd_data;
359 size_t cmd_size = vn_sizeof_vkDestroyQueryPool(device, queryPool, pAllocator);
360 if (cmd_size > sizeof(local_cmd_data)) {
361 cmd_data = malloc(cmd_size);
362 if (!cmd_data)
363 cmd_size = 0;
364 }
365 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyQueryPool_reply(device, queryPool, pAllocator) : 0;
366
367 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
368 if (cmd_size) {
369 vn_encode_vkDestroyQueryPool(enc, cmd_flags, device, queryPool, pAllocator);
370 vn_instance_submit_command(vn_instance, submit);
371 if (cmd_data != local_cmd_data)
372 free(cmd_data);
373 }
374 }
375
vn_submit_vkGetQueryPoolResults(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags,struct vn_instance_submit_command * submit)376 static inline void vn_submit_vkGetQueryPoolResults(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags, struct vn_instance_submit_command *submit)
377 {
378 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
379 void *cmd_data = local_cmd_data;
380 size_t cmd_size = vn_sizeof_vkGetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
381 if (cmd_size > sizeof(local_cmd_data)) {
382 cmd_data = malloc(cmd_size);
383 if (!cmd_data)
384 cmd_size = 0;
385 }
386 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetQueryPoolResults_reply(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags) : 0;
387
388 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
389 if (cmd_size) {
390 vn_encode_vkGetQueryPoolResults(enc, cmd_flags, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
391 vn_instance_submit_command(vn_instance, submit);
392 if (cmd_data != local_cmd_data)
393 free(cmd_data);
394 }
395 }
396
vn_submit_vkResetQueryPool(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,struct vn_instance_submit_command * submit)397 static inline void vn_submit_vkResetQueryPool(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, struct vn_instance_submit_command *submit)
398 {
399 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
400 void *cmd_data = local_cmd_data;
401 size_t cmd_size = vn_sizeof_vkResetQueryPool(device, queryPool, firstQuery, queryCount);
402 if (cmd_size > sizeof(local_cmd_data)) {
403 cmd_data = malloc(cmd_size);
404 if (!cmd_data)
405 cmd_size = 0;
406 }
407 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetQueryPool_reply(device, queryPool, firstQuery, queryCount) : 0;
408
409 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
410 if (cmd_size) {
411 vn_encode_vkResetQueryPool(enc, cmd_flags, device, queryPool, firstQuery, queryCount);
412 vn_instance_submit_command(vn_instance, submit);
413 if (cmd_data != local_cmd_data)
414 free(cmd_data);
415 }
416 }
417
vn_call_vkCreateQueryPool(struct vn_instance * vn_instance,VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)418 static inline VkResult vn_call_vkCreateQueryPool(struct vn_instance *vn_instance, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
419 {
420 VN_TRACE_FUNC();
421
422 struct vn_instance_submit_command submit;
423 vn_submit_vkCreateQueryPool(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pQueryPool, &submit);
424 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
425 if (dec) {
426 const VkResult ret = vn_decode_vkCreateQueryPool_reply(dec, device, pCreateInfo, pAllocator, pQueryPool);
427 vn_instance_free_command_reply(vn_instance, &submit);
428 return ret;
429 } else {
430 return VK_ERROR_OUT_OF_HOST_MEMORY;
431 }
432 }
433
vn_async_vkCreateQueryPool(struct vn_instance * vn_instance,VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)434 static inline void vn_async_vkCreateQueryPool(struct vn_instance *vn_instance, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
435 {
436 struct vn_instance_submit_command submit;
437 vn_submit_vkCreateQueryPool(vn_instance, 0, device, pCreateInfo, pAllocator, pQueryPool, &submit);
438 }
439
vn_call_vkDestroyQueryPool(struct vn_instance * vn_instance,VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)440 static inline void vn_call_vkDestroyQueryPool(struct vn_instance *vn_instance, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
441 {
442 VN_TRACE_FUNC();
443
444 struct vn_instance_submit_command submit;
445 vn_submit_vkDestroyQueryPool(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, queryPool, pAllocator, &submit);
446 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
447 if (dec) {
448 vn_decode_vkDestroyQueryPool_reply(dec, device, queryPool, pAllocator);
449 vn_instance_free_command_reply(vn_instance, &submit);
450 }
451 }
452
vn_async_vkDestroyQueryPool(struct vn_instance * vn_instance,VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)453 static inline void vn_async_vkDestroyQueryPool(struct vn_instance *vn_instance, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
454 {
455 struct vn_instance_submit_command submit;
456 vn_submit_vkDestroyQueryPool(vn_instance, 0, device, queryPool, pAllocator, &submit);
457 }
458
vn_call_vkGetQueryPoolResults(struct vn_instance * vn_instance,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)459 static inline VkResult vn_call_vkGetQueryPoolResults(struct vn_instance *vn_instance, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
460 {
461 VN_TRACE_FUNC();
462
463 struct vn_instance_submit_command submit;
464 vn_submit_vkGetQueryPoolResults(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags, &submit);
465 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
466 if (dec) {
467 const VkResult ret = vn_decode_vkGetQueryPoolResults_reply(dec, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
468 vn_instance_free_command_reply(vn_instance, &submit);
469 return ret;
470 } else {
471 return VK_ERROR_OUT_OF_HOST_MEMORY;
472 }
473 }
474
vn_async_vkGetQueryPoolResults(struct vn_instance * vn_instance,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)475 static inline void vn_async_vkGetQueryPoolResults(struct vn_instance *vn_instance, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
476 {
477 struct vn_instance_submit_command submit;
478 vn_submit_vkGetQueryPoolResults(vn_instance, 0, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags, &submit);
479 }
480
vn_call_vkResetQueryPool(struct vn_instance * vn_instance,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)481 static inline void vn_call_vkResetQueryPool(struct vn_instance *vn_instance, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
482 {
483 VN_TRACE_FUNC();
484
485 struct vn_instance_submit_command submit;
486 vn_submit_vkResetQueryPool(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, queryPool, firstQuery, queryCount, &submit);
487 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
488 if (dec) {
489 vn_decode_vkResetQueryPool_reply(dec, device, queryPool, firstQuery, queryCount);
490 vn_instance_free_command_reply(vn_instance, &submit);
491 }
492 }
493
vn_async_vkResetQueryPool(struct vn_instance * vn_instance,VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)494 static inline void vn_async_vkResetQueryPool(struct vn_instance *vn_instance, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
495 {
496 struct vn_instance_submit_command submit;
497 vn_submit_vkResetQueryPool(vn_instance, 0, device, queryPool, firstQuery, queryCount, &submit);
498 }
499
500 #endif /* VN_PROTOCOL_DRIVER_QUERY_POOL_H */
501