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_SAMPLER_YCBCR_CONVERSION_H
9 #define VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H
10
11 #include "vn_instance.h"
12 #include "vn_protocol_driver_structs.h"
13
14 /* struct VkSamplerYcbcrConversionCreateInfo chain */
15
16 static inline size_t
vn_sizeof_VkSamplerYcbcrConversionCreateInfo_pnext(const void * val)17 vn_sizeof_VkSamplerYcbcrConversionCreateInfo_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_VkSamplerYcbcrConversionCreateInfo_self(const VkSamplerYcbcrConversionCreateInfo * val)24 vn_sizeof_VkSamplerYcbcrConversionCreateInfo_self(const VkSamplerYcbcrConversionCreateInfo *val)
25 {
26 size_t size = 0;
27 /* skip val->{sType,pNext} */
28 size += vn_sizeof_VkFormat(&val->format);
29 size += vn_sizeof_VkSamplerYcbcrModelConversion(&val->ycbcrModel);
30 size += vn_sizeof_VkSamplerYcbcrRange(&val->ycbcrRange);
31 size += vn_sizeof_VkComponentMapping(&val->components);
32 size += vn_sizeof_VkChromaLocation(&val->xChromaOffset);
33 size += vn_sizeof_VkChromaLocation(&val->yChromaOffset);
34 size += vn_sizeof_VkFilter(&val->chromaFilter);
35 size += vn_sizeof_VkBool32(&val->forceExplicitReconstruction);
36 return size;
37 }
38
39 static inline size_t
vn_sizeof_VkSamplerYcbcrConversionCreateInfo(const VkSamplerYcbcrConversionCreateInfo * val)40 vn_sizeof_VkSamplerYcbcrConversionCreateInfo(const VkSamplerYcbcrConversionCreateInfo *val)
41 {
42 size_t size = 0;
43
44 size += vn_sizeof_VkStructureType(&val->sType);
45 size += vn_sizeof_VkSamplerYcbcrConversionCreateInfo_pnext(val->pNext);
46 size += vn_sizeof_VkSamplerYcbcrConversionCreateInfo_self(val);
47
48 return size;
49 }
50
51 static inline void
vn_encode_VkSamplerYcbcrConversionCreateInfo_pnext(struct vn_cs_encoder * enc,const void * val)52 vn_encode_VkSamplerYcbcrConversionCreateInfo_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_VkSamplerYcbcrConversionCreateInfo_self(struct vn_cs_encoder * enc,const VkSamplerYcbcrConversionCreateInfo * val)59 vn_encode_VkSamplerYcbcrConversionCreateInfo_self(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversionCreateInfo *val)
60 {
61 /* skip val->{sType,pNext} */
62 vn_encode_VkFormat(enc, &val->format);
63 vn_encode_VkSamplerYcbcrModelConversion(enc, &val->ycbcrModel);
64 vn_encode_VkSamplerYcbcrRange(enc, &val->ycbcrRange);
65 vn_encode_VkComponentMapping(enc, &val->components);
66 vn_encode_VkChromaLocation(enc, &val->xChromaOffset);
67 vn_encode_VkChromaLocation(enc, &val->yChromaOffset);
68 vn_encode_VkFilter(enc, &val->chromaFilter);
69 vn_encode_VkBool32(enc, &val->forceExplicitReconstruction);
70 }
71
72 static inline void
vn_encode_VkSamplerYcbcrConversionCreateInfo(struct vn_cs_encoder * enc,const VkSamplerYcbcrConversionCreateInfo * val)73 vn_encode_VkSamplerYcbcrConversionCreateInfo(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversionCreateInfo *val)
74 {
75 assert(val->sType == VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO);
76 vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO });
77 vn_encode_VkSamplerYcbcrConversionCreateInfo_pnext(enc, val->pNext);
78 vn_encode_VkSamplerYcbcrConversionCreateInfo_self(enc, val);
79 }
80
vn_sizeof_vkCreateSamplerYcbcrConversion(VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion)81 static inline size_t vn_sizeof_vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
82 {
83 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_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_VkSamplerYcbcrConversionCreateInfo(pCreateInfo);
91 cmd_size += vn_sizeof_simple_pointer(pAllocator);
92 if (pAllocator)
93 assert(false);
94 cmd_size += vn_sizeof_simple_pointer(pYcbcrConversion);
95 if (pYcbcrConversion)
96 cmd_size += vn_sizeof_VkSamplerYcbcrConversion(pYcbcrConversion);
97
98 return cmd_size;
99 }
100
vn_encode_vkCreateSamplerYcbcrConversion(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion)101 static inline void vn_encode_vkCreateSamplerYcbcrConversion(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
102 {
103 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_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_VkSamplerYcbcrConversionCreateInfo(enc, pCreateInfo);
111 if (vn_encode_simple_pointer(enc, pAllocator))
112 assert(false);
113 if (vn_encode_simple_pointer(enc, pYcbcrConversion))
114 vn_encode_VkSamplerYcbcrConversion(enc, pYcbcrConversion);
115 }
116
vn_sizeof_vkCreateSamplerYcbcrConversion_reply(VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion)117 static inline size_t vn_sizeof_vkCreateSamplerYcbcrConversion_reply(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
118 {
119 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_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(pYcbcrConversion);
128 if (pYcbcrConversion)
129 cmd_size += vn_sizeof_VkSamplerYcbcrConversion(pYcbcrConversion);
130
131 return cmd_size;
132 }
133
vn_decode_vkCreateSamplerYcbcrConversion_reply(struct vn_cs_decoder * dec,VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion)134 static inline VkResult vn_decode_vkCreateSamplerYcbcrConversion_reply(struct vn_cs_decoder *dec, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
135 {
136 VkCommandTypeEXT command_type;
137 vn_decode_VkCommandTypeEXT(dec, &command_type);
138 assert(command_type == VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_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_VkSamplerYcbcrConversion(dec, pYcbcrConversion);
147 } else {
148 pYcbcrConversion = NULL;
149 }
150
151 return ret;
152 }
153
vn_sizeof_vkDestroySamplerYcbcrConversion(VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator)154 static inline size_t vn_sizeof_vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
155 {
156 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_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_VkSamplerYcbcrConversion(&ycbcrConversion);
162 cmd_size += vn_sizeof_simple_pointer(pAllocator);
163 if (pAllocator)
164 assert(false);
165
166 return cmd_size;
167 }
168
vn_encode_vkDestroySamplerYcbcrConversion(struct vn_cs_encoder * enc,VkCommandFlagsEXT cmd_flags,VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator)169 static inline void vn_encode_vkDestroySamplerYcbcrConversion(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
170 {
171 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_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_VkSamplerYcbcrConversion(enc, &ycbcrConversion);
178 if (vn_encode_simple_pointer(enc, pAllocator))
179 assert(false);
180 }
181
vn_sizeof_vkDestroySamplerYcbcrConversion_reply(VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator)182 static inline size_t vn_sizeof_vkDestroySamplerYcbcrConversion_reply(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
183 {
184 const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT;
185 size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
186
187 /* skip device */
188 /* skip ycbcrConversion */
189 /* skip pAllocator */
190
191 return cmd_size;
192 }
193
vn_decode_vkDestroySamplerYcbcrConversion_reply(struct vn_cs_decoder * dec,VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator)194 static inline void vn_decode_vkDestroySamplerYcbcrConversion_reply(struct vn_cs_decoder *dec, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
195 {
196 VkCommandTypeEXT command_type;
197 vn_decode_VkCommandTypeEXT(dec, &command_type);
198 assert(command_type == VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT);
199
200 /* skip device */
201 /* skip ycbcrConversion */
202 /* skip pAllocator */
203 }
204
vn_submit_vkCreateSamplerYcbcrConversion(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion,struct vn_instance_submit_command * submit)205 static inline void vn_submit_vkCreateSamplerYcbcrConversion(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion, struct vn_instance_submit_command *submit)
206 {
207 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
208 void *cmd_data = local_cmd_data;
209 size_t cmd_size = vn_sizeof_vkCreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion);
210 if (cmd_size > sizeof(local_cmd_data)) {
211 cmd_data = malloc(cmd_size);
212 if (!cmd_data)
213 cmd_size = 0;
214 }
215 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateSamplerYcbcrConversion_reply(device, pCreateInfo, pAllocator, pYcbcrConversion) : 0;
216
217 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
218 if (cmd_size) {
219 vn_encode_vkCreateSamplerYcbcrConversion(enc, cmd_flags, device, pCreateInfo, pAllocator, pYcbcrConversion);
220 vn_instance_submit_command(vn_instance, submit);
221 if (cmd_data != local_cmd_data)
222 free(cmd_data);
223 }
224 }
225
vn_submit_vkDestroySamplerYcbcrConversion(struct vn_instance * vn_instance,VkCommandFlagsEXT cmd_flags,VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator,struct vn_instance_submit_command * submit)226 static inline void vn_submit_vkDestroySamplerYcbcrConversion(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator, struct vn_instance_submit_command *submit)
227 {
228 uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
229 void *cmd_data = local_cmd_data;
230 size_t cmd_size = vn_sizeof_vkDestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator);
231 if (cmd_size > sizeof(local_cmd_data)) {
232 cmd_data = malloc(cmd_size);
233 if (!cmd_data)
234 cmd_size = 0;
235 }
236 const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroySamplerYcbcrConversion_reply(device, ycbcrConversion, pAllocator) : 0;
237
238 struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size);
239 if (cmd_size) {
240 vn_encode_vkDestroySamplerYcbcrConversion(enc, cmd_flags, device, ycbcrConversion, pAllocator);
241 vn_instance_submit_command(vn_instance, submit);
242 if (cmd_data != local_cmd_data)
243 free(cmd_data);
244 }
245 }
246
vn_call_vkCreateSamplerYcbcrConversion(struct vn_instance * vn_instance,VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion)247 static inline VkResult vn_call_vkCreateSamplerYcbcrConversion(struct vn_instance *vn_instance, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
248 {
249 VN_TRACE_FUNC();
250
251 struct vn_instance_submit_command submit;
252 vn_submit_vkCreateSamplerYcbcrConversion(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pYcbcrConversion, &submit);
253 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
254 if (dec) {
255 const VkResult ret = vn_decode_vkCreateSamplerYcbcrConversion_reply(dec, device, pCreateInfo, pAllocator, pYcbcrConversion);
256 vn_instance_free_command_reply(vn_instance, &submit);
257 return ret;
258 } else {
259 return VK_ERROR_OUT_OF_HOST_MEMORY;
260 }
261 }
262
vn_async_vkCreateSamplerYcbcrConversion(struct vn_instance * vn_instance,VkDevice device,const VkSamplerYcbcrConversionCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSamplerYcbcrConversion * pYcbcrConversion)263 static inline void vn_async_vkCreateSamplerYcbcrConversion(struct vn_instance *vn_instance, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
264 {
265 struct vn_instance_submit_command submit;
266 vn_submit_vkCreateSamplerYcbcrConversion(vn_instance, 0, device, pCreateInfo, pAllocator, pYcbcrConversion, &submit);
267 }
268
vn_call_vkDestroySamplerYcbcrConversion(struct vn_instance * vn_instance,VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator)269 static inline void vn_call_vkDestroySamplerYcbcrConversion(struct vn_instance *vn_instance, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
270 {
271 VN_TRACE_FUNC();
272
273 struct vn_instance_submit_command submit;
274 vn_submit_vkDestroySamplerYcbcrConversion(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, ycbcrConversion, pAllocator, &submit);
275 struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit);
276 if (dec) {
277 vn_decode_vkDestroySamplerYcbcrConversion_reply(dec, device, ycbcrConversion, pAllocator);
278 vn_instance_free_command_reply(vn_instance, &submit);
279 }
280 }
281
vn_async_vkDestroySamplerYcbcrConversion(struct vn_instance * vn_instance,VkDevice device,VkSamplerYcbcrConversion ycbcrConversion,const VkAllocationCallbacks * pAllocator)282 static inline void vn_async_vkDestroySamplerYcbcrConversion(struct vn_instance *vn_instance, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
283 {
284 struct vn_instance_submit_command submit;
285 vn_submit_vkDestroySamplerYcbcrConversion(vn_instance, 0, device, ycbcrConversion, pAllocator, &submit);
286 }
287
288 #endif /* VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H */
289