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_SAMPLER_YCBCR_CONVERSION_H
9 #define VN_PROTOCOL_RENDERER_SAMPLER_YCBCR_CONVERSION_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 VkSamplerYcbcrConversionCreateInfo chain */
18 
19 static inline void *
vn_decode_VkSamplerYcbcrConversionCreateInfo_pnext_temp(struct vn_cs_decoder * dec)20 vn_decode_VkSamplerYcbcrConversionCreateInfo_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_VkSamplerYcbcrConversionCreateInfo_self_temp(struct vn_cs_decoder * dec,VkSamplerYcbcrConversionCreateInfo * val)29 vn_decode_VkSamplerYcbcrConversionCreateInfo_self_temp(struct vn_cs_decoder *dec, VkSamplerYcbcrConversionCreateInfo *val)
30 {
31     /* skip val->{sType,pNext} */
32     vn_decode_VkFormat(dec, &val->format);
33     vn_decode_VkSamplerYcbcrModelConversion(dec, &val->ycbcrModel);
34     vn_decode_VkSamplerYcbcrRange(dec, &val->ycbcrRange);
35     vn_decode_VkComponentMapping_temp(dec, &val->components);
36     vn_decode_VkChromaLocation(dec, &val->xChromaOffset);
37     vn_decode_VkChromaLocation(dec, &val->yChromaOffset);
38     vn_decode_VkFilter(dec, &val->chromaFilter);
39     vn_decode_VkBool32(dec, &val->forceExplicitReconstruction);
40 }
41 
42 static inline void
vn_decode_VkSamplerYcbcrConversionCreateInfo_temp(struct vn_cs_decoder * dec,VkSamplerYcbcrConversionCreateInfo * val)43 vn_decode_VkSamplerYcbcrConversionCreateInfo_temp(struct vn_cs_decoder *dec, VkSamplerYcbcrConversionCreateInfo *val)
44 {
45     VkStructureType stype;
46     vn_decode_VkStructureType(dec, &stype);
47     if (stype != VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO)
48         vn_cs_decoder_set_fatal(dec);
49 
50     val->sType = stype;
51     val->pNext = vn_decode_VkSamplerYcbcrConversionCreateInfo_pnext_temp(dec);
52     vn_decode_VkSamplerYcbcrConversionCreateInfo_self_temp(dec, val);
53 }
54 
55 static inline void
vn_replace_VkSamplerYcbcrConversionCreateInfo_handle_self(VkSamplerYcbcrConversionCreateInfo * val)56 vn_replace_VkSamplerYcbcrConversionCreateInfo_handle_self(VkSamplerYcbcrConversionCreateInfo *val)
57 {
58     /* skip val->sType */
59     /* skip val->pNext */
60     /* skip val->format */
61     /* skip val->ycbcrModel */
62     /* skip val->ycbcrRange */
63     vn_replace_VkComponentMapping_handle(&val->components);
64     /* skip val->xChromaOffset */
65     /* skip val->yChromaOffset */
66     /* skip val->chromaFilter */
67     /* skip val->forceExplicitReconstruction */
68 }
69 
70 static inline void
vn_replace_VkSamplerYcbcrConversionCreateInfo_handle(VkSamplerYcbcrConversionCreateInfo * val)71 vn_replace_VkSamplerYcbcrConversionCreateInfo_handle(VkSamplerYcbcrConversionCreateInfo *val)
72 {
73     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
74 
75     do {
76         switch ((int32_t)pnext->sType) {
77         case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO:
78             vn_replace_VkSamplerYcbcrConversionCreateInfo_handle_self((VkSamplerYcbcrConversionCreateInfo *)pnext);
79             break;
80         default:
81             /* ignore unknown/unsupported struct */
82             break;
83         }
84         pnext = pnext->pNext;
85     } while (pnext);
86 }
87 
vn_decode_vkCreateSamplerYcbcrConversion_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateSamplerYcbcrConversion * args)88 static inline void vn_decode_vkCreateSamplerYcbcrConversion_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateSamplerYcbcrConversion *args)
89 {
90     vn_decode_VkDevice_lookup(dec, &args->device);
91     if (vn_decode_simple_pointer(dec)) {
92         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
93         if (!args->pCreateInfo) return;
94         vn_decode_VkSamplerYcbcrConversionCreateInfo_temp(dec, (VkSamplerYcbcrConversionCreateInfo *)args->pCreateInfo);
95     } else {
96         args->pCreateInfo = NULL;
97         vn_cs_decoder_set_fatal(dec);
98     }
99     if (vn_decode_simple_pointer(dec)) {
100         vn_cs_decoder_set_fatal(dec);
101     } else {
102         args->pAllocator = NULL;
103     }
104     if (vn_decode_simple_pointer(dec)) {
105         args->pYcbcrConversion = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pYcbcrConversion));
106         if (!args->pYcbcrConversion) return;
107         vn_decode_VkSamplerYcbcrConversion(dec, args->pYcbcrConversion);
108     } else {
109         args->pYcbcrConversion = NULL;
110         vn_cs_decoder_set_fatal(dec);
111     }
112 }
113 
vn_replace_vkCreateSamplerYcbcrConversion_args_handle(struct vn_command_vkCreateSamplerYcbcrConversion * args)114 static inline void vn_replace_vkCreateSamplerYcbcrConversion_args_handle(struct vn_command_vkCreateSamplerYcbcrConversion *args)
115 {
116     vn_replace_VkDevice_handle(&args->device);
117     if (args->pCreateInfo)
118         vn_replace_VkSamplerYcbcrConversionCreateInfo_handle((VkSamplerYcbcrConversionCreateInfo *)args->pCreateInfo);
119     /* skip args->pAllocator */
120     /* skip args->pYcbcrConversion */
121 }
122 
vn_encode_vkCreateSamplerYcbcrConversion_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateSamplerYcbcrConversion * args)123 static inline void vn_encode_vkCreateSamplerYcbcrConversion_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateSamplerYcbcrConversion *args)
124 {
125     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_EXT});
126 
127     vn_encode_VkResult(enc, &args->ret);
128     /* skip args->device */
129     /* skip args->pCreateInfo */
130     /* skip args->pAllocator */
131     if (vn_encode_simple_pointer(enc, args->pYcbcrConversion))
132         vn_encode_VkSamplerYcbcrConversion(enc, args->pYcbcrConversion);
133 }
134 
vn_decode_vkDestroySamplerYcbcrConversion_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroySamplerYcbcrConversion * args)135 static inline void vn_decode_vkDestroySamplerYcbcrConversion_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroySamplerYcbcrConversion *args)
136 {
137     vn_decode_VkDevice_lookup(dec, &args->device);
138     vn_decode_VkSamplerYcbcrConversion_lookup(dec, &args->ycbcrConversion);
139     if (vn_decode_simple_pointer(dec)) {
140         vn_cs_decoder_set_fatal(dec);
141     } else {
142         args->pAllocator = NULL;
143     }
144 }
145 
vn_replace_vkDestroySamplerYcbcrConversion_args_handle(struct vn_command_vkDestroySamplerYcbcrConversion * args)146 static inline void vn_replace_vkDestroySamplerYcbcrConversion_args_handle(struct vn_command_vkDestroySamplerYcbcrConversion *args)
147 {
148     vn_replace_VkDevice_handle(&args->device);
149     vn_replace_VkSamplerYcbcrConversion_handle(&args->ycbcrConversion);
150     /* skip args->pAllocator */
151 }
152 
vn_encode_vkDestroySamplerYcbcrConversion_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroySamplerYcbcrConversion * args)153 static inline void vn_encode_vkDestroySamplerYcbcrConversion_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroySamplerYcbcrConversion *args)
154 {
155     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT});
156 
157     /* skip args->device */
158     /* skip args->ycbcrConversion */
159     /* skip args->pAllocator */
160 }
161 
vn_dispatch_vkCreateSamplerYcbcrConversion(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)162 static inline void vn_dispatch_vkCreateSamplerYcbcrConversion(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
163 {
164     struct vn_command_vkCreateSamplerYcbcrConversion args;
165 
166     if (!ctx->dispatch_vkCreateSamplerYcbcrConversion) {
167         vn_cs_decoder_set_fatal(ctx->decoder);
168         return;
169     }
170 
171     vn_decode_vkCreateSamplerYcbcrConversion_args_temp(ctx->decoder, &args);
172     if (!args.device) {
173         vn_cs_decoder_set_fatal(ctx->decoder);
174         return;
175     }
176 
177     if (!vn_cs_decoder_get_fatal(ctx->decoder))
178         ctx->dispatch_vkCreateSamplerYcbcrConversion(ctx, &args);
179 
180 #ifdef DEBUG
181     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
182         vn_dispatch_debug_log(ctx, "vkCreateSamplerYcbcrConversion returned %d", args.ret);
183 #endif
184 
185     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
186        vn_encode_vkCreateSamplerYcbcrConversion_reply(ctx->encoder, &args);
187 
188     vn_cs_decoder_reset_temp_pool(ctx->decoder);
189 }
190 
vn_dispatch_vkDestroySamplerYcbcrConversion(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)191 static inline void vn_dispatch_vkDestroySamplerYcbcrConversion(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
192 {
193     struct vn_command_vkDestroySamplerYcbcrConversion args;
194 
195     if (!ctx->dispatch_vkDestroySamplerYcbcrConversion) {
196         vn_cs_decoder_set_fatal(ctx->decoder);
197         return;
198     }
199 
200     vn_decode_vkDestroySamplerYcbcrConversion_args_temp(ctx->decoder, &args);
201     if (!args.device) {
202         vn_cs_decoder_set_fatal(ctx->decoder);
203         return;
204     }
205 
206     if (!vn_cs_decoder_get_fatal(ctx->decoder))
207         ctx->dispatch_vkDestroySamplerYcbcrConversion(ctx, &args);
208 
209 
210     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
211        vn_encode_vkDestroySamplerYcbcrConversion_reply(ctx->encoder, &args);
212 
213     vn_cs_decoder_reset_temp_pool(ctx->decoder);
214 }
215 
216 #pragma GCC diagnostic pop
217 
218 #endif /* VN_PROTOCOL_RENDERER_SAMPLER_YCBCR_CONVERSION_H */
219