• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from cl.xml and cl_angle_ext.xml.
3 //
4 // Copyright 2025 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // capture_cl_autogen.cpp:
9 //   Capture functions for the OpenCL  entry points.
10 
11 #include "libANGLE/capture/capture_cl_autogen.h"
12 
13 #include "common/gl_enum_utils.h"
14 #include "libANGLE/Context.h"
15 #include "libANGLE/capture/FrameCapture.h"
16 #include "libANGLE/validationCL_autogen.h"
17 
18 using namespace angle;
19 
20 namespace cl
21 {
22 
23 // CL 1.0
CaptureGetPlatformIDs(bool isCallValid,cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms,cl_int returnValue)24 CallCapture CaptureGetPlatformIDs(bool isCallValid,
25                                   cl_uint num_entries,
26                                   cl_platform_id *platforms,
27                                   cl_uint *num_platforms,
28                                   cl_int returnValue)
29 {
30     ParamBuffer paramBuffer;
31 
32     paramBuffer.addValueParam("num_entries", ParamType::Tcl_uint, num_entries);
33 
34     if (isCallValid)
35     {
36         ParamCapture platformsParam("platforms", ParamType::Tcl_platform_idPointer);
37         InitParamValue(ParamType::Tcl_platform_idPointer, platforms, &platformsParam.value);
38         CaptureGetPlatformIDs_platforms(isCallValid, num_entries, platforms, num_platforms,
39                                         &platformsParam);
40         paramBuffer.addParam(std::move(platformsParam));
41     }
42     else
43     {
44         ParamCapture platformsParam("platforms", ParamType::Tcl_platform_idPointer);
45         InitParamValue(ParamType::Tcl_platform_idPointer, static_cast<cl_platform_id *>(nullptr),
46                        &platformsParam.value);
47         paramBuffer.addParam(std::move(platformsParam));
48     }
49 
50     if (isCallValid)
51     {
52         ParamCapture num_platformsParam("num_platforms", ParamType::Tcl_uintPointer);
53         InitParamValue(ParamType::Tcl_uintPointer, num_platforms, &num_platformsParam.value);
54         CaptureGetPlatformIDs_num_platforms(isCallValid, num_entries, platforms, num_platforms,
55                                             &num_platformsParam);
56         paramBuffer.addParam(std::move(num_platformsParam));
57     }
58     else
59     {
60         ParamCapture num_platformsParam("num_platforms", ParamType::Tcl_uintPointer);
61         InitParamValue(ParamType::Tcl_uintPointer, static_cast<cl_uint *>(nullptr),
62                        &num_platformsParam.value);
63         paramBuffer.addParam(std::move(num_platformsParam));
64     }
65 
66     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
67     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
68     paramBuffer.addReturnValue(std::move(returnValueCapture));
69 
70     return CallCapture(angle::EntryPoint::CLGetPlatformIDs, std::move(paramBuffer));
71 }
72 
CaptureGetPlatformInfo(bool isCallValid,cl_platform_id platform,PlatformInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)73 CallCapture CaptureGetPlatformInfo(bool isCallValid,
74                                    cl_platform_id platform,
75                                    PlatformInfo param_namePacked,
76                                    size_t param_value_size,
77                                    void *param_value,
78                                    size_t *param_value_size_ret,
79                                    cl_int returnValue)
80 {
81     ParamBuffer paramBuffer;
82 
83     paramBuffer.addValueParam("platform", ParamType::Tcl_platform_id, platform);
84     paramBuffer.addValueParam("param_namePacked", ParamType::TPlatformInfo, param_namePacked);
85     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
86 
87     if (isCallValid)
88     {
89         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
90         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
91         CaptureGetPlatformInfo_param_value(isCallValid, platform, param_namePacked,
92                                            param_value_size, param_value, param_value_size_ret,
93                                            &param_valueParam);
94         paramBuffer.addParam(std::move(param_valueParam));
95     }
96     else
97     {
98         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
99         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
100                        &param_valueParam.value);
101         paramBuffer.addParam(std::move(param_valueParam));
102     }
103 
104     if (isCallValid)
105     {
106         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
107         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
108                        &param_value_size_retParam.value);
109         CaptureGetPlatformInfo_param_value_size_ret(
110             isCallValid, platform, param_namePacked, param_value_size, param_value,
111             param_value_size_ret, &param_value_size_retParam);
112         paramBuffer.addParam(std::move(param_value_size_retParam));
113     }
114     else
115     {
116         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
117         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
118                        &param_value_size_retParam.value);
119         paramBuffer.addParam(std::move(param_value_size_retParam));
120     }
121 
122     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
123     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
124     paramBuffer.addReturnValue(std::move(returnValueCapture));
125 
126     return CallCapture(angle::EntryPoint::CLGetPlatformInfo, std::move(paramBuffer));
127 }
128 
CaptureGetDeviceIDs(bool isCallValid,cl_platform_id platform,DeviceType device_typePacked,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices,cl_int returnValue)129 CallCapture CaptureGetDeviceIDs(bool isCallValid,
130                                 cl_platform_id platform,
131                                 DeviceType device_typePacked,
132                                 cl_uint num_entries,
133                                 cl_device_id *devices,
134                                 cl_uint *num_devices,
135                                 cl_int returnValue)
136 {
137     ParamBuffer paramBuffer;
138 
139     paramBuffer.addValueParam("platform", ParamType::Tcl_platform_id, platform);
140     paramBuffer.addValueParam("device_typePacked", ParamType::TDeviceType, device_typePacked);
141     paramBuffer.addValueParam("num_entries", ParamType::Tcl_uint, num_entries);
142 
143     if (isCallValid)
144     {
145         ParamCapture devicesParam("devices", ParamType::Tcl_device_idPointer);
146         InitParamValue(ParamType::Tcl_device_idPointer, devices, &devicesParam.value);
147         CaptureGetDeviceIDs_devices(isCallValid, platform, device_typePacked, num_entries, devices,
148                                     num_devices, &devicesParam);
149         paramBuffer.addParam(std::move(devicesParam));
150     }
151     else
152     {
153         ParamCapture devicesParam("devices", ParamType::Tcl_device_idPointer);
154         InitParamValue(ParamType::Tcl_device_idPointer, static_cast<cl_device_id *>(nullptr),
155                        &devicesParam.value);
156         paramBuffer.addParam(std::move(devicesParam));
157     }
158 
159     if (isCallValid)
160     {
161         ParamCapture num_devicesParam("num_devices", ParamType::Tcl_uintPointer);
162         InitParamValue(ParamType::Tcl_uintPointer, num_devices, &num_devicesParam.value);
163         CaptureGetDeviceIDs_num_devices(isCallValid, platform, device_typePacked, num_entries,
164                                         devices, num_devices, &num_devicesParam);
165         paramBuffer.addParam(std::move(num_devicesParam));
166     }
167     else
168     {
169         ParamCapture num_devicesParam("num_devices", ParamType::Tcl_uintPointer);
170         InitParamValue(ParamType::Tcl_uintPointer, static_cast<cl_uint *>(nullptr),
171                        &num_devicesParam.value);
172         paramBuffer.addParam(std::move(num_devicesParam));
173     }
174 
175     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
176     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
177     paramBuffer.addReturnValue(std::move(returnValueCapture));
178 
179     return CallCapture(angle::EntryPoint::CLGetDeviceIDs, std::move(paramBuffer));
180 }
181 
CaptureGetDeviceInfo(bool isCallValid,cl_device_id device,DeviceInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)182 CallCapture CaptureGetDeviceInfo(bool isCallValid,
183                                  cl_device_id device,
184                                  DeviceInfo param_namePacked,
185                                  size_t param_value_size,
186                                  void *param_value,
187                                  size_t *param_value_size_ret,
188                                  cl_int returnValue)
189 {
190     ParamBuffer paramBuffer;
191 
192     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
193     paramBuffer.addValueParam("param_namePacked", ParamType::TDeviceInfo, param_namePacked);
194     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
195 
196     if (isCallValid)
197     {
198         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
199         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
200         CaptureGetDeviceInfo_param_value(isCallValid, device, param_namePacked, param_value_size,
201                                          param_value, param_value_size_ret, &param_valueParam);
202         paramBuffer.addParam(std::move(param_valueParam));
203     }
204     else
205     {
206         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
207         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
208                        &param_valueParam.value);
209         paramBuffer.addParam(std::move(param_valueParam));
210     }
211 
212     if (isCallValid)
213     {
214         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
215         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
216                        &param_value_size_retParam.value);
217         CaptureGetDeviceInfo_param_value_size_ret(isCallValid, device, param_namePacked,
218                                                   param_value_size, param_value,
219                                                   param_value_size_ret, &param_value_size_retParam);
220         paramBuffer.addParam(std::move(param_value_size_retParam));
221     }
222     else
223     {
224         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
225         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
226                        &param_value_size_retParam.value);
227         paramBuffer.addParam(std::move(param_value_size_retParam));
228     }
229 
230     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
231     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
232     paramBuffer.addReturnValue(std::move(returnValueCapture));
233 
234     return CallCapture(angle::EntryPoint::CLGetDeviceInfo, std::move(paramBuffer));
235 }
236 
CaptureCreateContext(bool isCallValid,const cl_context_properties * properties,cl_uint num_devices,const cl_device_id * devices,void (CL_CALLBACK * pfn_notify)(const char * errinfo,const void * private_info,size_t cb,void * user_data),void * user_data,cl_int * errcode_ret,cl_context returnValue)237 CallCapture CaptureCreateContext(bool isCallValid,
238                                  const cl_context_properties *properties,
239                                  cl_uint num_devices,
240                                  const cl_device_id *devices,
241                                  void(CL_CALLBACK *pfn_notify)(const char *errinfo,
242                                                                const void *private_info,
243                                                                size_t cb,
244                                                                void *user_data),
245                                  void *user_data,
246                                  cl_int *errcode_ret,
247                                  cl_context returnValue)
248 {
249     ParamBuffer paramBuffer;
250 
251     if (isCallValid)
252     {
253         ParamCapture propertiesParam("properties", ParamType::Tcl_context_propertiesConstPointer);
254         InitParamValue(ParamType::Tcl_context_propertiesConstPointer, properties,
255                        &propertiesParam.value);
256         CaptureCreateContext_properties(isCallValid, properties, num_devices, devices, pfn_notify,
257                                         user_data, errcode_ret, &propertiesParam);
258         paramBuffer.addParam(std::move(propertiesParam));
259     }
260     else
261     {
262         ParamCapture propertiesParam("properties", ParamType::Tcl_context_propertiesConstPointer);
263         InitParamValue(ParamType::Tcl_context_propertiesConstPointer,
264                        static_cast<const cl_context_properties *>(nullptr), &propertiesParam.value);
265         paramBuffer.addParam(std::move(propertiesParam));
266     }
267 
268     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
269 
270     if (isCallValid)
271     {
272         ParamCapture devicesParam("devices", ParamType::Tcl_device_idConstPointer);
273         InitParamValue(ParamType::Tcl_device_idConstPointer, devices, &devicesParam.value);
274         CaptureCreateContext_devices(isCallValid, properties, num_devices, devices, pfn_notify,
275                                      user_data, errcode_ret, &devicesParam);
276         paramBuffer.addParam(std::move(devicesParam));
277     }
278     else
279     {
280         ParamCapture devicesParam("devices", ParamType::Tcl_device_idConstPointer);
281         InitParamValue(ParamType::Tcl_device_idConstPointer,
282                        static_cast<const cl_device_id *>(nullptr), &devicesParam.value);
283         paramBuffer.addParam(std::move(devicesParam));
284     }
285 
286     if (isCallValid)
287     {
288         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_context_func_type);
289         InitParamValue(ParamType::Tcl_context_func_type, pfn_notify, &pfn_notifyParam.value);
290         CaptureCreateContext_pfn_notify(isCallValid, properties, num_devices, devices, pfn_notify,
291                                         user_data, errcode_ret, &pfn_notifyParam);
292         paramBuffer.addParam(std::move(pfn_notifyParam));
293     }
294     else
295     {
296         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_context_func_type);
297         InitParamValue(
298             ParamType::Tcl_context_func_type,
299             static_cast<void(CL_CALLBACK *)(const char *errinfo, const void *private_info,
300                                             size_t cb, void *user_data)>(nullptr),
301             &pfn_notifyParam.value);
302         paramBuffer.addParam(std::move(pfn_notifyParam));
303     }
304 
305     if (isCallValid)
306     {
307         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
308         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
309         CaptureCreateContext_user_data(isCallValid, properties, num_devices, devices, pfn_notify,
310                                        user_data, errcode_ret, &user_dataParam);
311         paramBuffer.addParam(std::move(user_dataParam));
312     }
313     else
314     {
315         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
316         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
317                        &user_dataParam.value);
318         paramBuffer.addParam(std::move(user_dataParam));
319     }
320 
321     if (isCallValid)
322     {
323         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
324         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
325         CaptureCreateContext_errcode_ret(isCallValid, properties, num_devices, devices, pfn_notify,
326                                          user_data, errcode_ret, &errcode_retParam);
327         paramBuffer.addParam(std::move(errcode_retParam));
328     }
329     else
330     {
331         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
332         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
333                        &errcode_retParam.value);
334         paramBuffer.addParam(std::move(errcode_retParam));
335     }
336 
337     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_context);
338     InitParamValue(ParamType::Tcl_context, returnValue, &returnValueCapture.value);
339     paramBuffer.addReturnValue(std::move(returnValueCapture));
340 
341     return CallCapture(angle::EntryPoint::CLCreateContext, std::move(paramBuffer));
342 }
343 
CaptureCreateContextFromType(bool isCallValid,const cl_context_properties * properties,DeviceType device_typePacked,void (CL_CALLBACK * pfn_notify)(const char * errinfo,const void * private_info,size_t cb,void * user_data),void * user_data,cl_int * errcode_ret,cl_context returnValue)344 CallCapture CaptureCreateContextFromType(bool isCallValid,
345                                          const cl_context_properties *properties,
346                                          DeviceType device_typePacked,
347                                          void(CL_CALLBACK *pfn_notify)(const char *errinfo,
348                                                                        const void *private_info,
349                                                                        size_t cb,
350                                                                        void *user_data),
351                                          void *user_data,
352                                          cl_int *errcode_ret,
353                                          cl_context returnValue)
354 {
355     ParamBuffer paramBuffer;
356 
357     if (isCallValid)
358     {
359         ParamCapture propertiesParam("properties", ParamType::Tcl_context_propertiesConstPointer);
360         InitParamValue(ParamType::Tcl_context_propertiesConstPointer, properties,
361                        &propertiesParam.value);
362         CaptureCreateContextFromType_properties(isCallValid, properties, device_typePacked,
363                                                 pfn_notify, user_data, errcode_ret,
364                                                 &propertiesParam);
365         paramBuffer.addParam(std::move(propertiesParam));
366     }
367     else
368     {
369         ParamCapture propertiesParam("properties", ParamType::Tcl_context_propertiesConstPointer);
370         InitParamValue(ParamType::Tcl_context_propertiesConstPointer,
371                        static_cast<const cl_context_properties *>(nullptr), &propertiesParam.value);
372         paramBuffer.addParam(std::move(propertiesParam));
373     }
374 
375     paramBuffer.addValueParam("device_typePacked", ParamType::TDeviceType, device_typePacked);
376 
377     if (isCallValid)
378     {
379         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_context_func_type);
380         InitParamValue(ParamType::Tcl_context_func_type, pfn_notify, &pfn_notifyParam.value);
381         CaptureCreateContextFromType_pfn_notify(isCallValid, properties, device_typePacked,
382                                                 pfn_notify, user_data, errcode_ret,
383                                                 &pfn_notifyParam);
384         paramBuffer.addParam(std::move(pfn_notifyParam));
385     }
386     else
387     {
388         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_context_func_type);
389         InitParamValue(
390             ParamType::Tcl_context_func_type,
391             static_cast<void(CL_CALLBACK *)(const char *errinfo, const void *private_info,
392                                             size_t cb, void *user_data)>(nullptr),
393             &pfn_notifyParam.value);
394         paramBuffer.addParam(std::move(pfn_notifyParam));
395     }
396 
397     if (isCallValid)
398     {
399         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
400         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
401         CaptureCreateContextFromType_user_data(isCallValid, properties, device_typePacked,
402                                                pfn_notify, user_data, errcode_ret, &user_dataParam);
403         paramBuffer.addParam(std::move(user_dataParam));
404     }
405     else
406     {
407         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
408         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
409                        &user_dataParam.value);
410         paramBuffer.addParam(std::move(user_dataParam));
411     }
412 
413     if (isCallValid)
414     {
415         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
416         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
417         CaptureCreateContextFromType_errcode_ret(isCallValid, properties, device_typePacked,
418                                                  pfn_notify, user_data, errcode_ret,
419                                                  &errcode_retParam);
420         paramBuffer.addParam(std::move(errcode_retParam));
421     }
422     else
423     {
424         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
425         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
426                        &errcode_retParam.value);
427         paramBuffer.addParam(std::move(errcode_retParam));
428     }
429 
430     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_context);
431     InitParamValue(ParamType::Tcl_context, returnValue, &returnValueCapture.value);
432     paramBuffer.addReturnValue(std::move(returnValueCapture));
433 
434     return CallCapture(angle::EntryPoint::CLCreateContextFromType, std::move(paramBuffer));
435 }
436 
CaptureRetainContext(bool isCallValid,cl_context context,cl_int returnValue)437 CallCapture CaptureRetainContext(bool isCallValid, cl_context context, cl_int returnValue)
438 {
439     ParamBuffer paramBuffer;
440 
441     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
442 
443     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
444     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
445     paramBuffer.addReturnValue(std::move(returnValueCapture));
446 
447     return CallCapture(angle::EntryPoint::CLRetainContext, std::move(paramBuffer));
448 }
449 
CaptureReleaseContext(bool isCallValid,cl_context context,cl_int returnValue)450 CallCapture CaptureReleaseContext(bool isCallValid, cl_context context, cl_int returnValue)
451 {
452     ParamBuffer paramBuffer;
453 
454     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
455 
456     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
457     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
458     paramBuffer.addReturnValue(std::move(returnValueCapture));
459 
460     return CallCapture(angle::EntryPoint::CLReleaseContext, std::move(paramBuffer));
461 }
462 
CaptureGetContextInfo(bool isCallValid,cl_context context,ContextInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)463 CallCapture CaptureGetContextInfo(bool isCallValid,
464                                   cl_context context,
465                                   ContextInfo param_namePacked,
466                                   size_t param_value_size,
467                                   void *param_value,
468                                   size_t *param_value_size_ret,
469                                   cl_int returnValue)
470 {
471     ParamBuffer paramBuffer;
472 
473     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
474     paramBuffer.addValueParam("param_namePacked", ParamType::TContextInfo, param_namePacked);
475     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
476 
477     if (isCallValid)
478     {
479         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
480         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
481         CaptureGetContextInfo_param_value(isCallValid, context, param_namePacked, param_value_size,
482                                           param_value, param_value_size_ret, &param_valueParam);
483         paramBuffer.addParam(std::move(param_valueParam));
484     }
485     else
486     {
487         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
488         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
489                        &param_valueParam.value);
490         paramBuffer.addParam(std::move(param_valueParam));
491     }
492 
493     if (isCallValid)
494     {
495         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
496         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
497                        &param_value_size_retParam.value);
498         CaptureGetContextInfo_param_value_size_ret(
499             isCallValid, context, param_namePacked, param_value_size, param_value,
500             param_value_size_ret, &param_value_size_retParam);
501         paramBuffer.addParam(std::move(param_value_size_retParam));
502     }
503     else
504     {
505         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
506         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
507                        &param_value_size_retParam.value);
508         paramBuffer.addParam(std::move(param_value_size_retParam));
509     }
510 
511     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
512     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
513     paramBuffer.addReturnValue(std::move(returnValueCapture));
514 
515     return CallCapture(angle::EntryPoint::CLGetContextInfo, std::move(paramBuffer));
516 }
517 
CaptureRetainCommandQueue(bool isCallValid,cl_command_queue command_queue,cl_int returnValue)518 CallCapture CaptureRetainCommandQueue(bool isCallValid,
519                                       cl_command_queue command_queue,
520                                       cl_int returnValue)
521 {
522     ParamBuffer paramBuffer;
523 
524     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
525 
526     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
527     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
528     paramBuffer.addReturnValue(std::move(returnValueCapture));
529 
530     return CallCapture(angle::EntryPoint::CLRetainCommandQueue, std::move(paramBuffer));
531 }
532 
CaptureReleaseCommandQueue(bool isCallValid,cl_command_queue command_queue,cl_int returnValue)533 CallCapture CaptureReleaseCommandQueue(bool isCallValid,
534                                        cl_command_queue command_queue,
535                                        cl_int returnValue)
536 {
537     ParamBuffer paramBuffer;
538 
539     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
540 
541     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
542     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
543     paramBuffer.addReturnValue(std::move(returnValueCapture));
544 
545     return CallCapture(angle::EntryPoint::CLReleaseCommandQueue, std::move(paramBuffer));
546 }
547 
CaptureGetCommandQueueInfo(bool isCallValid,cl_command_queue command_queue,CommandQueueInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)548 CallCapture CaptureGetCommandQueueInfo(bool isCallValid,
549                                        cl_command_queue command_queue,
550                                        CommandQueueInfo param_namePacked,
551                                        size_t param_value_size,
552                                        void *param_value,
553                                        size_t *param_value_size_ret,
554                                        cl_int returnValue)
555 {
556     ParamBuffer paramBuffer;
557 
558     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
559     paramBuffer.addValueParam("param_namePacked", ParamType::TCommandQueueInfo, param_namePacked);
560     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
561 
562     if (isCallValid)
563     {
564         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
565         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
566         CaptureGetCommandQueueInfo_param_value(isCallValid, command_queue, param_namePacked,
567                                                param_value_size, param_value, param_value_size_ret,
568                                                &param_valueParam);
569         paramBuffer.addParam(std::move(param_valueParam));
570     }
571     else
572     {
573         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
574         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
575                        &param_valueParam.value);
576         paramBuffer.addParam(std::move(param_valueParam));
577     }
578 
579     if (isCallValid)
580     {
581         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
582         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
583                        &param_value_size_retParam.value);
584         CaptureGetCommandQueueInfo_param_value_size_ret(
585             isCallValid, command_queue, param_namePacked, param_value_size, param_value,
586             param_value_size_ret, &param_value_size_retParam);
587         paramBuffer.addParam(std::move(param_value_size_retParam));
588     }
589     else
590     {
591         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
592         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
593                        &param_value_size_retParam.value);
594         paramBuffer.addParam(std::move(param_value_size_retParam));
595     }
596 
597     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
598     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
599     paramBuffer.addReturnValue(std::move(returnValueCapture));
600 
601     return CallCapture(angle::EntryPoint::CLGetCommandQueueInfo, std::move(paramBuffer));
602 }
603 
CaptureCreateBuffer(bool isCallValid,cl_context context,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,cl_mem returnValue)604 CallCapture CaptureCreateBuffer(bool isCallValid,
605                                 cl_context context,
606                                 MemFlags flagsPacked,
607                                 size_t size,
608                                 void *host_ptr,
609                                 cl_int *errcode_ret,
610                                 cl_mem returnValue)
611 {
612     ParamBuffer paramBuffer;
613 
614     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
615     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
616     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
617 
618     if (isCallValid)
619     {
620         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
621         InitParamValue(ParamType::TvoidPointer, host_ptr, &host_ptrParam.value);
622         CaptureCreateBuffer_host_ptr(isCallValid, context, flagsPacked, size, host_ptr, errcode_ret,
623                                      &host_ptrParam);
624         paramBuffer.addParam(std::move(host_ptrParam));
625     }
626     else
627     {
628         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
629         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &host_ptrParam.value);
630         paramBuffer.addParam(std::move(host_ptrParam));
631     }
632 
633     if (isCallValid)
634     {
635         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
636         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
637         CaptureCreateBuffer_errcode_ret(isCallValid, context, flagsPacked, size, host_ptr,
638                                         errcode_ret, &errcode_retParam);
639         paramBuffer.addParam(std::move(errcode_retParam));
640     }
641     else
642     {
643         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
644         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
645                        &errcode_retParam.value);
646         paramBuffer.addParam(std::move(errcode_retParam));
647     }
648 
649     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
650     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
651     paramBuffer.addReturnValue(std::move(returnValueCapture));
652 
653     return CallCapture(angle::EntryPoint::CLCreateBuffer, std::move(paramBuffer));
654 }
655 
CaptureRetainMemObject(bool isCallValid,cl_mem memobj,cl_int returnValue)656 CallCapture CaptureRetainMemObject(bool isCallValid, cl_mem memobj, cl_int returnValue)
657 {
658     ParamBuffer paramBuffer;
659 
660     paramBuffer.addValueParam("memobj", ParamType::Tcl_mem, memobj);
661 
662     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
663     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
664     paramBuffer.addReturnValue(std::move(returnValueCapture));
665 
666     return CallCapture(angle::EntryPoint::CLRetainMemObject, std::move(paramBuffer));
667 }
668 
CaptureReleaseMemObject(bool isCallValid,cl_mem memobj,cl_int returnValue)669 CallCapture CaptureReleaseMemObject(bool isCallValid, cl_mem memobj, cl_int returnValue)
670 {
671     ParamBuffer paramBuffer;
672 
673     paramBuffer.addValueParam("memobj", ParamType::Tcl_mem, memobj);
674 
675     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
676     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
677     paramBuffer.addReturnValue(std::move(returnValueCapture));
678 
679     return CallCapture(angle::EntryPoint::CLReleaseMemObject, std::move(paramBuffer));
680 }
681 
CaptureGetSupportedImageFormats(bool isCallValid,cl_context context,MemFlags flagsPacked,MemObjectType image_typePacked,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats,cl_int returnValue)682 CallCapture CaptureGetSupportedImageFormats(bool isCallValid,
683                                             cl_context context,
684                                             MemFlags flagsPacked,
685                                             MemObjectType image_typePacked,
686                                             cl_uint num_entries,
687                                             cl_image_format *image_formats,
688                                             cl_uint *num_image_formats,
689                                             cl_int returnValue)
690 {
691     ParamBuffer paramBuffer;
692 
693     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
694     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
695     paramBuffer.addValueParam("image_typePacked", ParamType::TMemObjectType, image_typePacked);
696     paramBuffer.addValueParam("num_entries", ParamType::Tcl_uint, num_entries);
697 
698     if (isCallValid)
699     {
700         ParamCapture image_formatsParam("image_formats", ParamType::Tcl_image_formatPointer);
701         InitParamValue(ParamType::Tcl_image_formatPointer, image_formats,
702                        &image_formatsParam.value);
703         CaptureGetSupportedImageFormats_image_formats(isCallValid, context, flagsPacked,
704                                                       image_typePacked, num_entries, image_formats,
705                                                       num_image_formats, &image_formatsParam);
706         paramBuffer.addParam(std::move(image_formatsParam));
707     }
708     else
709     {
710         ParamCapture image_formatsParam("image_formats", ParamType::Tcl_image_formatPointer);
711         InitParamValue(ParamType::Tcl_image_formatPointer, static_cast<cl_image_format *>(nullptr),
712                        &image_formatsParam.value);
713         paramBuffer.addParam(std::move(image_formatsParam));
714     }
715 
716     if (isCallValid)
717     {
718         ParamCapture num_image_formatsParam("num_image_formats", ParamType::Tcl_uintPointer);
719         InitParamValue(ParamType::Tcl_uintPointer, num_image_formats,
720                        &num_image_formatsParam.value);
721         CaptureGetSupportedImageFormats_num_image_formats(
722             isCallValid, context, flagsPacked, image_typePacked, num_entries, image_formats,
723             num_image_formats, &num_image_formatsParam);
724         paramBuffer.addParam(std::move(num_image_formatsParam));
725     }
726     else
727     {
728         ParamCapture num_image_formatsParam("num_image_formats", ParamType::Tcl_uintPointer);
729         InitParamValue(ParamType::Tcl_uintPointer, static_cast<cl_uint *>(nullptr),
730                        &num_image_formatsParam.value);
731         paramBuffer.addParam(std::move(num_image_formatsParam));
732     }
733 
734     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
735     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
736     paramBuffer.addReturnValue(std::move(returnValueCapture));
737 
738     return CallCapture(angle::EntryPoint::CLGetSupportedImageFormats, std::move(paramBuffer));
739 }
740 
CaptureGetMemObjectInfo(bool isCallValid,cl_mem memobj,MemInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)741 CallCapture CaptureGetMemObjectInfo(bool isCallValid,
742                                     cl_mem memobj,
743                                     MemInfo param_namePacked,
744                                     size_t param_value_size,
745                                     void *param_value,
746                                     size_t *param_value_size_ret,
747                                     cl_int returnValue)
748 {
749     ParamBuffer paramBuffer;
750 
751     paramBuffer.addValueParam("memobj", ParamType::Tcl_mem, memobj);
752     paramBuffer.addValueParam("param_namePacked", ParamType::TMemInfo, param_namePacked);
753     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
754 
755     if (isCallValid)
756     {
757         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
758         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
759         CaptureGetMemObjectInfo_param_value(isCallValid, memobj, param_namePacked, param_value_size,
760                                             param_value, param_value_size_ret, &param_valueParam);
761         paramBuffer.addParam(std::move(param_valueParam));
762     }
763     else
764     {
765         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
766         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
767                        &param_valueParam.value);
768         paramBuffer.addParam(std::move(param_valueParam));
769     }
770 
771     if (isCallValid)
772     {
773         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
774         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
775                        &param_value_size_retParam.value);
776         CaptureGetMemObjectInfo_param_value_size_ret(
777             isCallValid, memobj, param_namePacked, param_value_size, param_value,
778             param_value_size_ret, &param_value_size_retParam);
779         paramBuffer.addParam(std::move(param_value_size_retParam));
780     }
781     else
782     {
783         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
784         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
785                        &param_value_size_retParam.value);
786         paramBuffer.addParam(std::move(param_value_size_retParam));
787     }
788 
789     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
790     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
791     paramBuffer.addReturnValue(std::move(returnValueCapture));
792 
793     return CallCapture(angle::EntryPoint::CLGetMemObjectInfo, std::move(paramBuffer));
794 }
795 
CaptureGetImageInfo(bool isCallValid,cl_mem image,ImageInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)796 CallCapture CaptureGetImageInfo(bool isCallValid,
797                                 cl_mem image,
798                                 ImageInfo param_namePacked,
799                                 size_t param_value_size,
800                                 void *param_value,
801                                 size_t *param_value_size_ret,
802                                 cl_int returnValue)
803 {
804     ParamBuffer paramBuffer;
805 
806     paramBuffer.addValueParam("image", ParamType::Tcl_mem, image);
807     paramBuffer.addValueParam("param_namePacked", ParamType::TImageInfo, param_namePacked);
808     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
809 
810     if (isCallValid)
811     {
812         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
813         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
814         CaptureGetImageInfo_param_value(isCallValid, image, param_namePacked, param_value_size,
815                                         param_value, param_value_size_ret, &param_valueParam);
816         paramBuffer.addParam(std::move(param_valueParam));
817     }
818     else
819     {
820         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
821         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
822                        &param_valueParam.value);
823         paramBuffer.addParam(std::move(param_valueParam));
824     }
825 
826     if (isCallValid)
827     {
828         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
829         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
830                        &param_value_size_retParam.value);
831         CaptureGetImageInfo_param_value_size_ret(isCallValid, image, param_namePacked,
832                                                  param_value_size, param_value,
833                                                  param_value_size_ret, &param_value_size_retParam);
834         paramBuffer.addParam(std::move(param_value_size_retParam));
835     }
836     else
837     {
838         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
839         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
840                        &param_value_size_retParam.value);
841         paramBuffer.addParam(std::move(param_value_size_retParam));
842     }
843 
844     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
845     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
846     paramBuffer.addReturnValue(std::move(returnValueCapture));
847 
848     return CallCapture(angle::EntryPoint::CLGetImageInfo, std::move(paramBuffer));
849 }
850 
CaptureRetainSampler(bool isCallValid,cl_sampler sampler,cl_int returnValue)851 CallCapture CaptureRetainSampler(bool isCallValid, cl_sampler sampler, cl_int returnValue)
852 {
853     ParamBuffer paramBuffer;
854 
855     paramBuffer.addValueParam("sampler", ParamType::Tcl_sampler, sampler);
856 
857     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
858     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
859     paramBuffer.addReturnValue(std::move(returnValueCapture));
860 
861     return CallCapture(angle::EntryPoint::CLRetainSampler, std::move(paramBuffer));
862 }
863 
CaptureReleaseSampler(bool isCallValid,cl_sampler sampler,cl_int returnValue)864 CallCapture CaptureReleaseSampler(bool isCallValid, cl_sampler sampler, cl_int returnValue)
865 {
866     ParamBuffer paramBuffer;
867 
868     paramBuffer.addValueParam("sampler", ParamType::Tcl_sampler, sampler);
869 
870     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
871     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
872     paramBuffer.addReturnValue(std::move(returnValueCapture));
873 
874     return CallCapture(angle::EntryPoint::CLReleaseSampler, std::move(paramBuffer));
875 }
876 
CaptureGetSamplerInfo(bool isCallValid,cl_sampler sampler,SamplerInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)877 CallCapture CaptureGetSamplerInfo(bool isCallValid,
878                                   cl_sampler sampler,
879                                   SamplerInfo param_namePacked,
880                                   size_t param_value_size,
881                                   void *param_value,
882                                   size_t *param_value_size_ret,
883                                   cl_int returnValue)
884 {
885     ParamBuffer paramBuffer;
886 
887     paramBuffer.addValueParam("sampler", ParamType::Tcl_sampler, sampler);
888     paramBuffer.addValueParam("param_namePacked", ParamType::TSamplerInfo, param_namePacked);
889     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
890 
891     if (isCallValid)
892     {
893         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
894         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
895         CaptureGetSamplerInfo_param_value(isCallValid, sampler, param_namePacked, param_value_size,
896                                           param_value, param_value_size_ret, &param_valueParam);
897         paramBuffer.addParam(std::move(param_valueParam));
898     }
899     else
900     {
901         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
902         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
903                        &param_valueParam.value);
904         paramBuffer.addParam(std::move(param_valueParam));
905     }
906 
907     if (isCallValid)
908     {
909         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
910         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
911                        &param_value_size_retParam.value);
912         CaptureGetSamplerInfo_param_value_size_ret(
913             isCallValid, sampler, param_namePacked, param_value_size, param_value,
914             param_value_size_ret, &param_value_size_retParam);
915         paramBuffer.addParam(std::move(param_value_size_retParam));
916     }
917     else
918     {
919         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
920         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
921                        &param_value_size_retParam.value);
922         paramBuffer.addParam(std::move(param_value_size_retParam));
923     }
924 
925     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
926     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
927     paramBuffer.addReturnValue(std::move(returnValueCapture));
928 
929     return CallCapture(angle::EntryPoint::CLGetSamplerInfo, std::move(paramBuffer));
930 }
931 
CaptureCreateProgramWithSource(bool isCallValid,cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret,cl_program returnValue)932 CallCapture CaptureCreateProgramWithSource(bool isCallValid,
933                                            cl_context context,
934                                            cl_uint count,
935                                            const char **strings,
936                                            const size_t *lengths,
937                                            cl_int *errcode_ret,
938                                            cl_program returnValue)
939 {
940     ParamBuffer paramBuffer;
941 
942     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
943     paramBuffer.addValueParam("count", ParamType::Tcl_uint, count);
944 
945     if (isCallValid)
946     {
947         ParamCapture stringsParam("strings", ParamType::TcharConstPointerPointer);
948         InitParamValue(ParamType::TcharConstPointerPointer, strings, &stringsParam.value);
949         CaptureCreateProgramWithSource_strings(isCallValid, context, count, strings, lengths,
950                                                errcode_ret, &stringsParam);
951         paramBuffer.addParam(std::move(stringsParam));
952     }
953     else
954     {
955         ParamCapture stringsParam("strings", ParamType::TcharConstPointerPointer);
956         InitParamValue(ParamType::TcharConstPointerPointer, static_cast<const char **>(nullptr),
957                        &stringsParam.value);
958         paramBuffer.addParam(std::move(stringsParam));
959     }
960 
961     if (isCallValid)
962     {
963         ParamCapture lengthsParam("lengths", ParamType::Tsize_tConstPointer);
964         InitParamValue(ParamType::Tsize_tConstPointer, lengths, &lengthsParam.value);
965         CaptureCreateProgramWithSource_lengths(isCallValid, context, count, strings, lengths,
966                                                errcode_ret, &lengthsParam);
967         paramBuffer.addParam(std::move(lengthsParam));
968     }
969     else
970     {
971         ParamCapture lengthsParam("lengths", ParamType::Tsize_tConstPointer);
972         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
973                        &lengthsParam.value);
974         paramBuffer.addParam(std::move(lengthsParam));
975     }
976 
977     if (isCallValid)
978     {
979         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
980         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
981         CaptureCreateProgramWithSource_errcode_ret(isCallValid, context, count, strings, lengths,
982                                                    errcode_ret, &errcode_retParam);
983         paramBuffer.addParam(std::move(errcode_retParam));
984     }
985     else
986     {
987         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
988         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
989                        &errcode_retParam.value);
990         paramBuffer.addParam(std::move(errcode_retParam));
991     }
992 
993     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_program);
994     InitParamValue(ParamType::Tcl_program, returnValue, &returnValueCapture.value);
995     paramBuffer.addReturnValue(std::move(returnValueCapture));
996 
997     return CallCapture(angle::EntryPoint::CLCreateProgramWithSource, std::move(paramBuffer));
998 }
999 
CaptureCreateProgramWithBinary(bool isCallValid,cl_context context,cl_uint num_devices,const cl_device_id * device_list,const size_t * lengths,const unsigned char ** binaries,cl_int * binary_status,cl_int * errcode_ret,cl_program returnValue)1000 CallCapture CaptureCreateProgramWithBinary(bool isCallValid,
1001                                            cl_context context,
1002                                            cl_uint num_devices,
1003                                            const cl_device_id *device_list,
1004                                            const size_t *lengths,
1005                                            const unsigned char **binaries,
1006                                            cl_int *binary_status,
1007                                            cl_int *errcode_ret,
1008                                            cl_program returnValue)
1009 {
1010     ParamBuffer paramBuffer;
1011 
1012     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
1013     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
1014 
1015     if (isCallValid)
1016     {
1017         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
1018         InitParamValue(ParamType::Tcl_device_idConstPointer, device_list, &device_listParam.value);
1019         CaptureCreateProgramWithBinary_device_list(isCallValid, context, num_devices, device_list,
1020                                                    lengths, binaries, binary_status, errcode_ret,
1021                                                    &device_listParam);
1022         paramBuffer.addParam(std::move(device_listParam));
1023     }
1024     else
1025     {
1026         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
1027         InitParamValue(ParamType::Tcl_device_idConstPointer,
1028                        static_cast<const cl_device_id *>(nullptr), &device_listParam.value);
1029         paramBuffer.addParam(std::move(device_listParam));
1030     }
1031 
1032     if (isCallValid)
1033     {
1034         ParamCapture lengthsParam("lengths", ParamType::Tsize_tConstPointer);
1035         InitParamValue(ParamType::Tsize_tConstPointer, lengths, &lengthsParam.value);
1036         CaptureCreateProgramWithBinary_lengths(isCallValid, context, num_devices, device_list,
1037                                                lengths, binaries, binary_status, errcode_ret,
1038                                                &lengthsParam);
1039         paramBuffer.addParam(std::move(lengthsParam));
1040     }
1041     else
1042     {
1043         ParamCapture lengthsParam("lengths", ParamType::Tsize_tConstPointer);
1044         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
1045                        &lengthsParam.value);
1046         paramBuffer.addParam(std::move(lengthsParam));
1047     }
1048 
1049     if (isCallValid)
1050     {
1051         ParamCapture binariesParam("binaries", ParamType::TcharUnsignedConstPointerPointer);
1052         InitParamValue(ParamType::TcharUnsignedConstPointerPointer, binaries, &binariesParam.value);
1053         CaptureCreateProgramWithBinary_binaries(isCallValid, context, num_devices, device_list,
1054                                                 lengths, binaries, binary_status, errcode_ret,
1055                                                 &binariesParam);
1056         paramBuffer.addParam(std::move(binariesParam));
1057     }
1058     else
1059     {
1060         ParamCapture binariesParam("binaries", ParamType::TcharUnsignedConstPointerPointer);
1061         InitParamValue(ParamType::TcharUnsignedConstPointerPointer,
1062                        static_cast<const unsigned char **>(nullptr), &binariesParam.value);
1063         paramBuffer.addParam(std::move(binariesParam));
1064     }
1065 
1066     if (isCallValid)
1067     {
1068         ParamCapture binary_statusParam("binary_status", ParamType::Tcl_intPointer);
1069         InitParamValue(ParamType::Tcl_intPointer, binary_status, &binary_statusParam.value);
1070         CaptureCreateProgramWithBinary_binary_status(isCallValid, context, num_devices, device_list,
1071                                                      lengths, binaries, binary_status, errcode_ret,
1072                                                      &binary_statusParam);
1073         paramBuffer.addParam(std::move(binary_statusParam));
1074     }
1075     else
1076     {
1077         ParamCapture binary_statusParam("binary_status", ParamType::Tcl_intPointer);
1078         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
1079                        &binary_statusParam.value);
1080         paramBuffer.addParam(std::move(binary_statusParam));
1081     }
1082 
1083     if (isCallValid)
1084     {
1085         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
1086         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
1087         CaptureCreateProgramWithBinary_errcode_ret(isCallValid, context, num_devices, device_list,
1088                                                    lengths, binaries, binary_status, errcode_ret,
1089                                                    &errcode_retParam);
1090         paramBuffer.addParam(std::move(errcode_retParam));
1091     }
1092     else
1093     {
1094         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
1095         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
1096                        &errcode_retParam.value);
1097         paramBuffer.addParam(std::move(errcode_retParam));
1098     }
1099 
1100     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_program);
1101     InitParamValue(ParamType::Tcl_program, returnValue, &returnValueCapture.value);
1102     paramBuffer.addReturnValue(std::move(returnValueCapture));
1103 
1104     return CallCapture(angle::EntryPoint::CLCreateProgramWithBinary, std::move(paramBuffer));
1105 }
1106 
CaptureRetainProgram(bool isCallValid,cl_program program,cl_int returnValue)1107 CallCapture CaptureRetainProgram(bool isCallValid, cl_program program, cl_int returnValue)
1108 {
1109     ParamBuffer paramBuffer;
1110 
1111     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1112 
1113     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1114     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1115     paramBuffer.addReturnValue(std::move(returnValueCapture));
1116 
1117     return CallCapture(angle::EntryPoint::CLRetainProgram, std::move(paramBuffer));
1118 }
1119 
CaptureReleaseProgram(bool isCallValid,cl_program program,cl_int returnValue)1120 CallCapture CaptureReleaseProgram(bool isCallValid, cl_program program, cl_int returnValue)
1121 {
1122     ParamBuffer paramBuffer;
1123 
1124     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1125 
1126     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1127     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1128     paramBuffer.addReturnValue(std::move(returnValueCapture));
1129 
1130     return CallCapture(angle::EntryPoint::CLReleaseProgram, std::move(paramBuffer));
1131 }
1132 
CaptureBuildProgram(bool isCallValid,cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,cl_int returnValue)1133 CallCapture CaptureBuildProgram(bool isCallValid,
1134                                 cl_program program,
1135                                 cl_uint num_devices,
1136                                 const cl_device_id *device_list,
1137                                 const char *options,
1138                                 void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
1139                                 void *user_data,
1140                                 cl_int returnValue)
1141 {
1142     ParamBuffer paramBuffer;
1143 
1144     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1145     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
1146 
1147     if (isCallValid)
1148     {
1149         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
1150         InitParamValue(ParamType::Tcl_device_idConstPointer, device_list, &device_listParam.value);
1151         CaptureBuildProgram_device_list(isCallValid, program, num_devices, device_list, options,
1152                                         pfn_notify, user_data, &device_listParam);
1153         paramBuffer.addParam(std::move(device_listParam));
1154     }
1155     else
1156     {
1157         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
1158         InitParamValue(ParamType::Tcl_device_idConstPointer,
1159                        static_cast<const cl_device_id *>(nullptr), &device_listParam.value);
1160         paramBuffer.addParam(std::move(device_listParam));
1161     }
1162 
1163     if (isCallValid)
1164     {
1165         ParamCapture optionsParam("options", ParamType::TcharConstPointer);
1166         InitParamValue(ParamType::TcharConstPointer, options, &optionsParam.value);
1167         CaptureBuildProgram_options(isCallValid, program, num_devices, device_list, options,
1168                                     pfn_notify, user_data, &optionsParam);
1169         paramBuffer.addParam(std::move(optionsParam));
1170     }
1171     else
1172     {
1173         ParamCapture optionsParam("options", ParamType::TcharConstPointer);
1174         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
1175                        &optionsParam.value);
1176         paramBuffer.addParam(std::move(optionsParam));
1177     }
1178 
1179     if (isCallValid)
1180     {
1181         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
1182         InitParamValue(ParamType::Tcl_program_func_type, pfn_notify, &pfn_notifyParam.value);
1183         CaptureBuildProgram_pfn_notify(isCallValid, program, num_devices, device_list, options,
1184                                        pfn_notify, user_data, &pfn_notifyParam);
1185         paramBuffer.addParam(std::move(pfn_notifyParam));
1186     }
1187     else
1188     {
1189         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
1190         InitParamValue(
1191             ParamType::Tcl_program_func_type,
1192             static_cast<void(CL_CALLBACK *)(cl_program program, void *user_data)>(nullptr),
1193             &pfn_notifyParam.value);
1194         paramBuffer.addParam(std::move(pfn_notifyParam));
1195     }
1196 
1197     if (isCallValid)
1198     {
1199         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
1200         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
1201         CaptureBuildProgram_user_data(isCallValid, program, num_devices, device_list, options,
1202                                       pfn_notify, user_data, &user_dataParam);
1203         paramBuffer.addParam(std::move(user_dataParam));
1204     }
1205     else
1206     {
1207         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
1208         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1209                        &user_dataParam.value);
1210         paramBuffer.addParam(std::move(user_dataParam));
1211     }
1212 
1213     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1214     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1215     paramBuffer.addReturnValue(std::move(returnValueCapture));
1216 
1217     return CallCapture(angle::EntryPoint::CLBuildProgram, std::move(paramBuffer));
1218 }
1219 
CaptureGetProgramInfo(bool isCallValid,cl_program program,ProgramInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)1220 CallCapture CaptureGetProgramInfo(bool isCallValid,
1221                                   cl_program program,
1222                                   ProgramInfo param_namePacked,
1223                                   size_t param_value_size,
1224                                   void *param_value,
1225                                   size_t *param_value_size_ret,
1226                                   cl_int returnValue)
1227 {
1228     ParamBuffer paramBuffer;
1229 
1230     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1231     paramBuffer.addValueParam("param_namePacked", ParamType::TProgramInfo, param_namePacked);
1232     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
1233 
1234     if (isCallValid)
1235     {
1236         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1237         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
1238         CaptureGetProgramInfo_param_value(isCallValid, program, param_namePacked, param_value_size,
1239                                           param_value, param_value_size_ret, &param_valueParam);
1240         paramBuffer.addParam(std::move(param_valueParam));
1241     }
1242     else
1243     {
1244         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1245         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1246                        &param_valueParam.value);
1247         paramBuffer.addParam(std::move(param_valueParam));
1248     }
1249 
1250     if (isCallValid)
1251     {
1252         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1253         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
1254                        &param_value_size_retParam.value);
1255         CaptureGetProgramInfo_param_value_size_ret(
1256             isCallValid, program, param_namePacked, param_value_size, param_value,
1257             param_value_size_ret, &param_value_size_retParam);
1258         paramBuffer.addParam(std::move(param_value_size_retParam));
1259     }
1260     else
1261     {
1262         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1263         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
1264                        &param_value_size_retParam.value);
1265         paramBuffer.addParam(std::move(param_value_size_retParam));
1266     }
1267 
1268     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1269     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1270     paramBuffer.addReturnValue(std::move(returnValueCapture));
1271 
1272     return CallCapture(angle::EntryPoint::CLGetProgramInfo, std::move(paramBuffer));
1273 }
1274 
CaptureGetProgramBuildInfo(bool isCallValid,cl_program program,cl_device_id device,ProgramBuildInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)1275 CallCapture CaptureGetProgramBuildInfo(bool isCallValid,
1276                                        cl_program program,
1277                                        cl_device_id device,
1278                                        ProgramBuildInfo param_namePacked,
1279                                        size_t param_value_size,
1280                                        void *param_value,
1281                                        size_t *param_value_size_ret,
1282                                        cl_int returnValue)
1283 {
1284     ParamBuffer paramBuffer;
1285 
1286     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1287     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
1288     paramBuffer.addValueParam("param_namePacked", ParamType::TProgramBuildInfo, param_namePacked);
1289     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
1290 
1291     if (isCallValid)
1292     {
1293         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1294         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
1295         CaptureGetProgramBuildInfo_param_value(isCallValid, program, device, param_namePacked,
1296                                                param_value_size, param_value, param_value_size_ret,
1297                                                &param_valueParam);
1298         paramBuffer.addParam(std::move(param_valueParam));
1299     }
1300     else
1301     {
1302         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1303         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1304                        &param_valueParam.value);
1305         paramBuffer.addParam(std::move(param_valueParam));
1306     }
1307 
1308     if (isCallValid)
1309     {
1310         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1311         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
1312                        &param_value_size_retParam.value);
1313         CaptureGetProgramBuildInfo_param_value_size_ret(
1314             isCallValid, program, device, param_namePacked, param_value_size, param_value,
1315             param_value_size_ret, &param_value_size_retParam);
1316         paramBuffer.addParam(std::move(param_value_size_retParam));
1317     }
1318     else
1319     {
1320         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1321         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
1322                        &param_value_size_retParam.value);
1323         paramBuffer.addParam(std::move(param_value_size_retParam));
1324     }
1325 
1326     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1327     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1328     paramBuffer.addReturnValue(std::move(returnValueCapture));
1329 
1330     return CallCapture(angle::EntryPoint::CLGetProgramBuildInfo, std::move(paramBuffer));
1331 }
1332 
CaptureCreateKernel(bool isCallValid,cl_program program,const char * kernel_name,cl_int * errcode_ret,cl_kernel returnValue)1333 CallCapture CaptureCreateKernel(bool isCallValid,
1334                                 cl_program program,
1335                                 const char *kernel_name,
1336                                 cl_int *errcode_ret,
1337                                 cl_kernel returnValue)
1338 {
1339     ParamBuffer paramBuffer;
1340 
1341     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1342 
1343     if (isCallValid)
1344     {
1345         ParamCapture kernel_nameParam("kernel_name", ParamType::TcharConstPointer);
1346         InitParamValue(ParamType::TcharConstPointer, kernel_name, &kernel_nameParam.value);
1347         CaptureCreateKernel_kernel_name(isCallValid, program, kernel_name, errcode_ret,
1348                                         &kernel_nameParam);
1349         paramBuffer.addParam(std::move(kernel_nameParam));
1350     }
1351     else
1352     {
1353         ParamCapture kernel_nameParam("kernel_name", ParamType::TcharConstPointer);
1354         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
1355                        &kernel_nameParam.value);
1356         paramBuffer.addParam(std::move(kernel_nameParam));
1357     }
1358 
1359     if (isCallValid)
1360     {
1361         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
1362         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
1363         CaptureCreateKernel_errcode_ret(isCallValid, program, kernel_name, errcode_ret,
1364                                         &errcode_retParam);
1365         paramBuffer.addParam(std::move(errcode_retParam));
1366     }
1367     else
1368     {
1369         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
1370         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
1371                        &errcode_retParam.value);
1372         paramBuffer.addParam(std::move(errcode_retParam));
1373     }
1374 
1375     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_kernel);
1376     InitParamValue(ParamType::Tcl_kernel, returnValue, &returnValueCapture.value);
1377     paramBuffer.addReturnValue(std::move(returnValueCapture));
1378 
1379     return CallCapture(angle::EntryPoint::CLCreateKernel, std::move(paramBuffer));
1380 }
1381 
CaptureCreateKernelsInProgram(bool isCallValid,cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret,cl_int returnValue)1382 CallCapture CaptureCreateKernelsInProgram(bool isCallValid,
1383                                           cl_program program,
1384                                           cl_uint num_kernels,
1385                                           cl_kernel *kernels,
1386                                           cl_uint *num_kernels_ret,
1387                                           cl_int returnValue)
1388 {
1389     ParamBuffer paramBuffer;
1390 
1391     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
1392     paramBuffer.addValueParam("num_kernels", ParamType::Tcl_uint, num_kernels);
1393 
1394     if (isCallValid)
1395     {
1396         ParamCapture kernelsParam("kernels", ParamType::Tcl_kernelPointer);
1397         InitParamValue(ParamType::Tcl_kernelPointer, kernels, &kernelsParam.value);
1398         CaptureCreateKernelsInProgram_kernels(isCallValid, program, num_kernels, kernels,
1399                                               num_kernels_ret, &kernelsParam);
1400         paramBuffer.addParam(std::move(kernelsParam));
1401     }
1402     else
1403     {
1404         ParamCapture kernelsParam("kernels", ParamType::Tcl_kernelPointer);
1405         InitParamValue(ParamType::Tcl_kernelPointer, static_cast<cl_kernel *>(nullptr),
1406                        &kernelsParam.value);
1407         paramBuffer.addParam(std::move(kernelsParam));
1408     }
1409 
1410     if (isCallValid)
1411     {
1412         ParamCapture num_kernels_retParam("num_kernels_ret", ParamType::Tcl_uintPointer);
1413         InitParamValue(ParamType::Tcl_uintPointer, num_kernels_ret, &num_kernels_retParam.value);
1414         CaptureCreateKernelsInProgram_num_kernels_ret(isCallValid, program, num_kernels, kernels,
1415                                                       num_kernels_ret, &num_kernels_retParam);
1416         paramBuffer.addParam(std::move(num_kernels_retParam));
1417     }
1418     else
1419     {
1420         ParamCapture num_kernels_retParam("num_kernels_ret", ParamType::Tcl_uintPointer);
1421         InitParamValue(ParamType::Tcl_uintPointer, static_cast<cl_uint *>(nullptr),
1422                        &num_kernels_retParam.value);
1423         paramBuffer.addParam(std::move(num_kernels_retParam));
1424     }
1425 
1426     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1427     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1428     paramBuffer.addReturnValue(std::move(returnValueCapture));
1429 
1430     return CallCapture(angle::EntryPoint::CLCreateKernelsInProgram, std::move(paramBuffer));
1431 }
1432 
CaptureRetainKernel(bool isCallValid,cl_kernel kernel,cl_int returnValue)1433 CallCapture CaptureRetainKernel(bool isCallValid, cl_kernel kernel, cl_int returnValue)
1434 {
1435     ParamBuffer paramBuffer;
1436 
1437     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
1438 
1439     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1440     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1441     paramBuffer.addReturnValue(std::move(returnValueCapture));
1442 
1443     return CallCapture(angle::EntryPoint::CLRetainKernel, std::move(paramBuffer));
1444 }
1445 
CaptureReleaseKernel(bool isCallValid,cl_kernel kernel,cl_int returnValue)1446 CallCapture CaptureReleaseKernel(bool isCallValid, cl_kernel kernel, cl_int returnValue)
1447 {
1448     ParamBuffer paramBuffer;
1449 
1450     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
1451 
1452     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1453     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1454     paramBuffer.addReturnValue(std::move(returnValueCapture));
1455 
1456     return CallCapture(angle::EntryPoint::CLReleaseKernel, std::move(paramBuffer));
1457 }
1458 
CaptureSetKernelArg(bool isCallValid,cl_kernel kernel,cl_uint arg_index,size_t arg_size,const void * arg_value,cl_int returnValue)1459 CallCapture CaptureSetKernelArg(bool isCallValid,
1460                                 cl_kernel kernel,
1461                                 cl_uint arg_index,
1462                                 size_t arg_size,
1463                                 const void *arg_value,
1464                                 cl_int returnValue)
1465 {
1466     ParamBuffer paramBuffer;
1467 
1468     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
1469     paramBuffer.addValueParam("arg_index", ParamType::Tcl_uint, arg_index);
1470     paramBuffer.addValueParam("arg_size", ParamType::Tsize_t, arg_size);
1471 
1472     if (isCallValid)
1473     {
1474         ParamCapture arg_valueParam("arg_value", ParamType::TvoidConstPointer);
1475         InitParamValue(ParamType::TvoidConstPointer, arg_value, &arg_valueParam.value);
1476         CaptureSetKernelArg_arg_value(isCallValid, kernel, arg_index, arg_size, arg_value,
1477                                       &arg_valueParam);
1478         paramBuffer.addParam(std::move(arg_valueParam));
1479     }
1480     else
1481     {
1482         ParamCapture arg_valueParam("arg_value", ParamType::TvoidConstPointer);
1483         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
1484                        &arg_valueParam.value);
1485         paramBuffer.addParam(std::move(arg_valueParam));
1486     }
1487 
1488     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1489     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1490     paramBuffer.addReturnValue(std::move(returnValueCapture));
1491 
1492     return CallCapture(angle::EntryPoint::CLSetKernelArg, std::move(paramBuffer));
1493 }
1494 
CaptureGetKernelInfo(bool isCallValid,cl_kernel kernel,KernelInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)1495 CallCapture CaptureGetKernelInfo(bool isCallValid,
1496                                  cl_kernel kernel,
1497                                  KernelInfo param_namePacked,
1498                                  size_t param_value_size,
1499                                  void *param_value,
1500                                  size_t *param_value_size_ret,
1501                                  cl_int returnValue)
1502 {
1503     ParamBuffer paramBuffer;
1504 
1505     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
1506     paramBuffer.addValueParam("param_namePacked", ParamType::TKernelInfo, param_namePacked);
1507     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
1508 
1509     if (isCallValid)
1510     {
1511         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1512         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
1513         CaptureGetKernelInfo_param_value(isCallValid, kernel, param_namePacked, param_value_size,
1514                                          param_value, param_value_size_ret, &param_valueParam);
1515         paramBuffer.addParam(std::move(param_valueParam));
1516     }
1517     else
1518     {
1519         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1520         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1521                        &param_valueParam.value);
1522         paramBuffer.addParam(std::move(param_valueParam));
1523     }
1524 
1525     if (isCallValid)
1526     {
1527         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1528         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
1529                        &param_value_size_retParam.value);
1530         CaptureGetKernelInfo_param_value_size_ret(isCallValid, kernel, param_namePacked,
1531                                                   param_value_size, param_value,
1532                                                   param_value_size_ret, &param_value_size_retParam);
1533         paramBuffer.addParam(std::move(param_value_size_retParam));
1534     }
1535     else
1536     {
1537         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1538         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
1539                        &param_value_size_retParam.value);
1540         paramBuffer.addParam(std::move(param_value_size_retParam));
1541     }
1542 
1543     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1544     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1545     paramBuffer.addReturnValue(std::move(returnValueCapture));
1546 
1547     return CallCapture(angle::EntryPoint::CLGetKernelInfo, std::move(paramBuffer));
1548 }
1549 
CaptureGetKernelWorkGroupInfo(bool isCallValid,cl_kernel kernel,cl_device_id device,KernelWorkGroupInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)1550 CallCapture CaptureGetKernelWorkGroupInfo(bool isCallValid,
1551                                           cl_kernel kernel,
1552                                           cl_device_id device,
1553                                           KernelWorkGroupInfo param_namePacked,
1554                                           size_t param_value_size,
1555                                           void *param_value,
1556                                           size_t *param_value_size_ret,
1557                                           cl_int returnValue)
1558 {
1559     ParamBuffer paramBuffer;
1560 
1561     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
1562     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
1563     paramBuffer.addValueParam("param_namePacked", ParamType::TKernelWorkGroupInfo,
1564                               param_namePacked);
1565     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
1566 
1567     if (isCallValid)
1568     {
1569         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1570         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
1571         CaptureGetKernelWorkGroupInfo_param_value(isCallValid, kernel, device, param_namePacked,
1572                                                   param_value_size, param_value,
1573                                                   param_value_size_ret, &param_valueParam);
1574         paramBuffer.addParam(std::move(param_valueParam));
1575     }
1576     else
1577     {
1578         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1579         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1580                        &param_valueParam.value);
1581         paramBuffer.addParam(std::move(param_valueParam));
1582     }
1583 
1584     if (isCallValid)
1585     {
1586         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1587         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
1588                        &param_value_size_retParam.value);
1589         CaptureGetKernelWorkGroupInfo_param_value_size_ret(
1590             isCallValid, kernel, device, param_namePacked, param_value_size, param_value,
1591             param_value_size_ret, &param_value_size_retParam);
1592         paramBuffer.addParam(std::move(param_value_size_retParam));
1593     }
1594     else
1595     {
1596         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1597         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
1598                        &param_value_size_retParam.value);
1599         paramBuffer.addParam(std::move(param_value_size_retParam));
1600     }
1601 
1602     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1603     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1604     paramBuffer.addReturnValue(std::move(returnValueCapture));
1605 
1606     return CallCapture(angle::EntryPoint::CLGetKernelWorkGroupInfo, std::move(paramBuffer));
1607 }
1608 
CaptureWaitForEvents(bool isCallValid,cl_uint num_events,const cl_event * event_list,cl_int returnValue)1609 CallCapture CaptureWaitForEvents(bool isCallValid,
1610                                  cl_uint num_events,
1611                                  const cl_event *event_list,
1612                                  cl_int returnValue)
1613 {
1614     ParamBuffer paramBuffer;
1615 
1616     paramBuffer.addValueParam("num_events", ParamType::Tcl_uint, num_events);
1617 
1618     if (isCallValid)
1619     {
1620         ParamCapture event_listParam("event_list", ParamType::Tcl_eventConstPointer);
1621         InitParamValue(ParamType::Tcl_eventConstPointer, event_list, &event_listParam.value);
1622         CaptureWaitForEvents_event_list(isCallValid, num_events, event_list, &event_listParam);
1623         paramBuffer.addParam(std::move(event_listParam));
1624     }
1625     else
1626     {
1627         ParamCapture event_listParam("event_list", ParamType::Tcl_eventConstPointer);
1628         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
1629                        &event_listParam.value);
1630         paramBuffer.addParam(std::move(event_listParam));
1631     }
1632 
1633     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1634     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1635     paramBuffer.addReturnValue(std::move(returnValueCapture));
1636 
1637     return CallCapture(angle::EntryPoint::CLWaitForEvents, std::move(paramBuffer));
1638 }
1639 
CaptureGetEventInfo(bool isCallValid,cl_event event,EventInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)1640 CallCapture CaptureGetEventInfo(bool isCallValid,
1641                                 cl_event event,
1642                                 EventInfo param_namePacked,
1643                                 size_t param_value_size,
1644                                 void *param_value,
1645                                 size_t *param_value_size_ret,
1646                                 cl_int returnValue)
1647 {
1648     ParamBuffer paramBuffer;
1649 
1650     paramBuffer.addValueParam("event", ParamType::Tcl_event, event);
1651     paramBuffer.addValueParam("param_namePacked", ParamType::TEventInfo, param_namePacked);
1652     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
1653 
1654     if (isCallValid)
1655     {
1656         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1657         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
1658         CaptureGetEventInfo_param_value(isCallValid, event, param_namePacked, param_value_size,
1659                                         param_value, param_value_size_ret, &param_valueParam);
1660         paramBuffer.addParam(std::move(param_valueParam));
1661     }
1662     else
1663     {
1664         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1665         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1666                        &param_valueParam.value);
1667         paramBuffer.addParam(std::move(param_valueParam));
1668     }
1669 
1670     if (isCallValid)
1671     {
1672         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1673         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
1674                        &param_value_size_retParam.value);
1675         CaptureGetEventInfo_param_value_size_ret(isCallValid, event, param_namePacked,
1676                                                  param_value_size, param_value,
1677                                                  param_value_size_ret, &param_value_size_retParam);
1678         paramBuffer.addParam(std::move(param_value_size_retParam));
1679     }
1680     else
1681     {
1682         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1683         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
1684                        &param_value_size_retParam.value);
1685         paramBuffer.addParam(std::move(param_value_size_retParam));
1686     }
1687 
1688     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1689     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1690     paramBuffer.addReturnValue(std::move(returnValueCapture));
1691 
1692     return CallCapture(angle::EntryPoint::CLGetEventInfo, std::move(paramBuffer));
1693 }
1694 
CaptureRetainEvent(bool isCallValid,cl_event event,cl_int returnValue)1695 CallCapture CaptureRetainEvent(bool isCallValid, cl_event event, cl_int returnValue)
1696 {
1697     ParamBuffer paramBuffer;
1698 
1699     paramBuffer.addValueParam("event", ParamType::Tcl_event, event);
1700 
1701     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1702     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1703     paramBuffer.addReturnValue(std::move(returnValueCapture));
1704 
1705     return CallCapture(angle::EntryPoint::CLRetainEvent, std::move(paramBuffer));
1706 }
1707 
CaptureReleaseEvent(bool isCallValid,cl_event event,cl_int returnValue)1708 CallCapture CaptureReleaseEvent(bool isCallValid, cl_event event, cl_int returnValue)
1709 {
1710     ParamBuffer paramBuffer;
1711 
1712     paramBuffer.addValueParam("event", ParamType::Tcl_event, event);
1713 
1714     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1715     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1716     paramBuffer.addReturnValue(std::move(returnValueCapture));
1717 
1718     return CallCapture(angle::EntryPoint::CLReleaseEvent, std::move(paramBuffer));
1719 }
1720 
CaptureGetEventProfilingInfo(bool isCallValid,cl_event event,ProfilingInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)1721 CallCapture CaptureGetEventProfilingInfo(bool isCallValid,
1722                                          cl_event event,
1723                                          ProfilingInfo param_namePacked,
1724                                          size_t param_value_size,
1725                                          void *param_value,
1726                                          size_t *param_value_size_ret,
1727                                          cl_int returnValue)
1728 {
1729     ParamBuffer paramBuffer;
1730 
1731     paramBuffer.addValueParam("event", ParamType::Tcl_event, event);
1732     paramBuffer.addValueParam("param_namePacked", ParamType::TProfilingInfo, param_namePacked);
1733     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
1734 
1735     if (isCallValid)
1736     {
1737         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1738         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
1739         CaptureGetEventProfilingInfo_param_value(isCallValid, event, param_namePacked,
1740                                                  param_value_size, param_value,
1741                                                  param_value_size_ret, &param_valueParam);
1742         paramBuffer.addParam(std::move(param_valueParam));
1743     }
1744     else
1745     {
1746         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
1747         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
1748                        &param_valueParam.value);
1749         paramBuffer.addParam(std::move(param_valueParam));
1750     }
1751 
1752     if (isCallValid)
1753     {
1754         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1755         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
1756                        &param_value_size_retParam.value);
1757         CaptureGetEventProfilingInfo_param_value_size_ret(
1758             isCallValid, event, param_namePacked, param_value_size, param_value,
1759             param_value_size_ret, &param_value_size_retParam);
1760         paramBuffer.addParam(std::move(param_value_size_retParam));
1761     }
1762     else
1763     {
1764         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
1765         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
1766                        &param_value_size_retParam.value);
1767         paramBuffer.addParam(std::move(param_value_size_retParam));
1768     }
1769 
1770     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1771     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1772     paramBuffer.addReturnValue(std::move(returnValueCapture));
1773 
1774     return CallCapture(angle::EntryPoint::CLGetEventProfilingInfo, std::move(paramBuffer));
1775 }
1776 
CaptureFlush(bool isCallValid,cl_command_queue command_queue,cl_int returnValue)1777 CallCapture CaptureFlush(bool isCallValid, cl_command_queue command_queue, cl_int returnValue)
1778 {
1779     ParamBuffer paramBuffer;
1780 
1781     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
1782 
1783     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1784     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1785     paramBuffer.addReturnValue(std::move(returnValueCapture));
1786 
1787     return CallCapture(angle::EntryPoint::CLFlush, std::move(paramBuffer));
1788 }
1789 
CaptureFinish(bool isCallValid,cl_command_queue command_queue,cl_int returnValue)1790 CallCapture CaptureFinish(bool isCallValid, cl_command_queue command_queue, cl_int returnValue)
1791 {
1792     ParamBuffer paramBuffer;
1793 
1794     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
1795 
1796     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1797     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1798     paramBuffer.addReturnValue(std::move(returnValueCapture));
1799 
1800     return CallCapture(angle::EntryPoint::CLFinish, std::move(paramBuffer));
1801 }
1802 
CaptureEnqueueReadBuffer(bool isCallValid,cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,size_t offset,size_t size,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)1803 CallCapture CaptureEnqueueReadBuffer(bool isCallValid,
1804                                      cl_command_queue command_queue,
1805                                      cl_mem buffer,
1806                                      cl_bool blocking_read,
1807                                      size_t offset,
1808                                      size_t size,
1809                                      void *ptr,
1810                                      cl_uint num_events_in_wait_list,
1811                                      const cl_event *event_wait_list,
1812                                      cl_event *event,
1813                                      cl_int returnValue)
1814 {
1815     ParamBuffer paramBuffer;
1816 
1817     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
1818     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
1819     paramBuffer.addValueParam("blocking_read", ParamType::Tcl_bool, blocking_read);
1820     paramBuffer.addValueParam("offset", ParamType::Tsize_t, offset);
1821     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
1822 
1823     if (isCallValid)
1824     {
1825         ParamCapture ptrParam("ptr", ParamType::TvoidPointer);
1826         InitParamValue(ParamType::TvoidPointer, ptr, &ptrParam.value);
1827         CaptureEnqueueReadBuffer_ptr(isCallValid, command_queue, buffer, blocking_read, offset,
1828                                      size, ptr, num_events_in_wait_list, event_wait_list, event,
1829                                      &ptrParam);
1830         paramBuffer.addParam(std::move(ptrParam));
1831     }
1832     else
1833     {
1834         ParamCapture ptrParam("ptr", ParamType::TvoidPointer);
1835         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &ptrParam.value);
1836         paramBuffer.addParam(std::move(ptrParam));
1837     }
1838 
1839     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
1840                               num_events_in_wait_list);
1841 
1842     if (isCallValid)
1843     {
1844         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
1845         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
1846                        &event_wait_listParam.value);
1847         CaptureEnqueueReadBuffer_event_wait_list(isCallValid, command_queue, buffer, blocking_read,
1848                                                  offset, size, ptr, num_events_in_wait_list,
1849                                                  event_wait_list, event, &event_wait_listParam);
1850         paramBuffer.addParam(std::move(event_wait_listParam));
1851     }
1852     else
1853     {
1854         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
1855         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
1856                        &event_wait_listParam.value);
1857         paramBuffer.addParam(std::move(event_wait_listParam));
1858     }
1859 
1860     if (isCallValid)
1861     {
1862         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
1863         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
1864         CaptureEnqueueReadBuffer_event(isCallValid, command_queue, buffer, blocking_read, offset,
1865                                        size, ptr, num_events_in_wait_list, event_wait_list, event,
1866                                        &eventParam);
1867         paramBuffer.addParam(std::move(eventParam));
1868     }
1869     else
1870     {
1871         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
1872         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
1873                        &eventParam.value);
1874         paramBuffer.addParam(std::move(eventParam));
1875     }
1876 
1877     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1878     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1879     paramBuffer.addReturnValue(std::move(returnValueCapture));
1880 
1881     return CallCapture(angle::EntryPoint::CLEnqueueReadBuffer, std::move(paramBuffer));
1882 }
1883 
CaptureEnqueueWriteBuffer(bool isCallValid,cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,size_t offset,size_t size,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)1884 CallCapture CaptureEnqueueWriteBuffer(bool isCallValid,
1885                                       cl_command_queue command_queue,
1886                                       cl_mem buffer,
1887                                       cl_bool blocking_write,
1888                                       size_t offset,
1889                                       size_t size,
1890                                       const void *ptr,
1891                                       cl_uint num_events_in_wait_list,
1892                                       const cl_event *event_wait_list,
1893                                       cl_event *event,
1894                                       cl_int returnValue)
1895 {
1896     ParamBuffer paramBuffer;
1897 
1898     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
1899     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
1900     paramBuffer.addValueParam("blocking_write", ParamType::Tcl_bool, blocking_write);
1901     paramBuffer.addValueParam("offset", ParamType::Tsize_t, offset);
1902     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
1903 
1904     if (isCallValid)
1905     {
1906         ParamCapture ptrParam("ptr", ParamType::TvoidConstPointer);
1907         InitParamValue(ParamType::TvoidConstPointer, ptr, &ptrParam.value);
1908         CaptureEnqueueWriteBuffer_ptr(isCallValid, command_queue, buffer, blocking_write, offset,
1909                                       size, ptr, num_events_in_wait_list, event_wait_list, event,
1910                                       &ptrParam);
1911         paramBuffer.addParam(std::move(ptrParam));
1912     }
1913     else
1914     {
1915         ParamCapture ptrParam("ptr", ParamType::TvoidConstPointer);
1916         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
1917                        &ptrParam.value);
1918         paramBuffer.addParam(std::move(ptrParam));
1919     }
1920 
1921     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
1922                               num_events_in_wait_list);
1923 
1924     if (isCallValid)
1925     {
1926         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
1927         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
1928                        &event_wait_listParam.value);
1929         CaptureEnqueueWriteBuffer_event_wait_list(
1930             isCallValid, command_queue, buffer, blocking_write, offset, size, ptr,
1931             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
1932         paramBuffer.addParam(std::move(event_wait_listParam));
1933     }
1934     else
1935     {
1936         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
1937         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
1938                        &event_wait_listParam.value);
1939         paramBuffer.addParam(std::move(event_wait_listParam));
1940     }
1941 
1942     if (isCallValid)
1943     {
1944         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
1945         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
1946         CaptureEnqueueWriteBuffer_event(isCallValid, command_queue, buffer, blocking_write, offset,
1947                                         size, ptr, num_events_in_wait_list, event_wait_list, event,
1948                                         &eventParam);
1949         paramBuffer.addParam(std::move(eventParam));
1950     }
1951     else
1952     {
1953         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
1954         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
1955                        &eventParam.value);
1956         paramBuffer.addParam(std::move(eventParam));
1957     }
1958 
1959     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
1960     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
1961     paramBuffer.addReturnValue(std::move(returnValueCapture));
1962 
1963     return CallCapture(angle::EntryPoint::CLEnqueueWriteBuffer, std::move(paramBuffer));
1964 }
1965 
CaptureEnqueueCopyBuffer(bool isCallValid,cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,size_t src_offset,size_t dst_offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)1966 CallCapture CaptureEnqueueCopyBuffer(bool isCallValid,
1967                                      cl_command_queue command_queue,
1968                                      cl_mem src_buffer,
1969                                      cl_mem dst_buffer,
1970                                      size_t src_offset,
1971                                      size_t dst_offset,
1972                                      size_t size,
1973                                      cl_uint num_events_in_wait_list,
1974                                      const cl_event *event_wait_list,
1975                                      cl_event *event,
1976                                      cl_int returnValue)
1977 {
1978     ParamBuffer paramBuffer;
1979 
1980     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
1981     paramBuffer.addValueParam("src_buffer", ParamType::Tcl_mem, src_buffer);
1982     paramBuffer.addValueParam("dst_buffer", ParamType::Tcl_mem, dst_buffer);
1983     paramBuffer.addValueParam("src_offset", ParamType::Tsize_t, src_offset);
1984     paramBuffer.addValueParam("dst_offset", ParamType::Tsize_t, dst_offset);
1985     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
1986     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
1987                               num_events_in_wait_list);
1988 
1989     if (isCallValid)
1990     {
1991         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
1992         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
1993                        &event_wait_listParam.value);
1994         CaptureEnqueueCopyBuffer_event_wait_list(
1995             isCallValid, command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size,
1996             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
1997         paramBuffer.addParam(std::move(event_wait_listParam));
1998     }
1999     else
2000     {
2001         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2002         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2003                        &event_wait_listParam.value);
2004         paramBuffer.addParam(std::move(event_wait_listParam));
2005     }
2006 
2007     if (isCallValid)
2008     {
2009         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2010         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2011         CaptureEnqueueCopyBuffer_event(isCallValid, command_queue, src_buffer, dst_buffer,
2012                                        src_offset, dst_offset, size, num_events_in_wait_list,
2013                                        event_wait_list, event, &eventParam);
2014         paramBuffer.addParam(std::move(eventParam));
2015     }
2016     else
2017     {
2018         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2019         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2020                        &eventParam.value);
2021         paramBuffer.addParam(std::move(eventParam));
2022     }
2023 
2024     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2025     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2026     paramBuffer.addReturnValue(std::move(returnValueCapture));
2027 
2028     return CallCapture(angle::EntryPoint::CLEnqueueCopyBuffer, std::move(paramBuffer));
2029 }
2030 
CaptureEnqueueReadImage(bool isCallValid,cl_command_queue command_queue,cl_mem image,cl_bool blocking_read,const size_t * origin,const size_t * region,size_t row_pitch,size_t slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2031 CallCapture CaptureEnqueueReadImage(bool isCallValid,
2032                                     cl_command_queue command_queue,
2033                                     cl_mem image,
2034                                     cl_bool blocking_read,
2035                                     const size_t *origin,
2036                                     const size_t *region,
2037                                     size_t row_pitch,
2038                                     size_t slice_pitch,
2039                                     void *ptr,
2040                                     cl_uint num_events_in_wait_list,
2041                                     const cl_event *event_wait_list,
2042                                     cl_event *event,
2043                                     cl_int returnValue)
2044 {
2045     ParamBuffer paramBuffer;
2046 
2047     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2048     paramBuffer.addValueParam("image", ParamType::Tcl_mem, image);
2049     paramBuffer.addValueParam("blocking_read", ParamType::Tcl_bool, blocking_read);
2050 
2051     if (isCallValid)
2052     {
2053         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
2054         InitParamValue(ParamType::Tsize_tConstPointer, origin, &originParam.value);
2055         CaptureEnqueueReadImage_origin(isCallValid, command_queue, image, blocking_read, origin,
2056                                        region, row_pitch, slice_pitch, ptr, num_events_in_wait_list,
2057                                        event_wait_list, event, &originParam);
2058         paramBuffer.addParam(std::move(originParam));
2059     }
2060     else
2061     {
2062         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
2063         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2064                        &originParam.value);
2065         paramBuffer.addParam(std::move(originParam));
2066     }
2067 
2068     if (isCallValid)
2069     {
2070         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2071         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
2072         CaptureEnqueueReadImage_region(isCallValid, command_queue, image, blocking_read, origin,
2073                                        region, row_pitch, slice_pitch, ptr, num_events_in_wait_list,
2074                                        event_wait_list, event, &regionParam);
2075         paramBuffer.addParam(std::move(regionParam));
2076     }
2077     else
2078     {
2079         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2080         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2081                        &regionParam.value);
2082         paramBuffer.addParam(std::move(regionParam));
2083     }
2084 
2085     paramBuffer.addValueParam("row_pitch", ParamType::Tsize_t, row_pitch);
2086     paramBuffer.addValueParam("slice_pitch", ParamType::Tsize_t, slice_pitch);
2087 
2088     if (isCallValid)
2089     {
2090         ParamCapture ptrParam("ptr", ParamType::TvoidPointer);
2091         InitParamValue(ParamType::TvoidPointer, ptr, &ptrParam.value);
2092         CaptureEnqueueReadImage_ptr(isCallValid, command_queue, image, blocking_read, origin,
2093                                     region, row_pitch, slice_pitch, ptr, num_events_in_wait_list,
2094                                     event_wait_list, event, &ptrParam);
2095         paramBuffer.addParam(std::move(ptrParam));
2096     }
2097     else
2098     {
2099         ParamCapture ptrParam("ptr", ParamType::TvoidPointer);
2100         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &ptrParam.value);
2101         paramBuffer.addParam(std::move(ptrParam));
2102     }
2103 
2104     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2105                               num_events_in_wait_list);
2106 
2107     if (isCallValid)
2108     {
2109         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2110         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2111                        &event_wait_listParam.value);
2112         CaptureEnqueueReadImage_event_wait_list(isCallValid, command_queue, image, blocking_read,
2113                                                 origin, region, row_pitch, slice_pitch, ptr,
2114                                                 num_events_in_wait_list, event_wait_list, event,
2115                                                 &event_wait_listParam);
2116         paramBuffer.addParam(std::move(event_wait_listParam));
2117     }
2118     else
2119     {
2120         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2121         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2122                        &event_wait_listParam.value);
2123         paramBuffer.addParam(std::move(event_wait_listParam));
2124     }
2125 
2126     if (isCallValid)
2127     {
2128         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2129         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2130         CaptureEnqueueReadImage_event(isCallValid, command_queue, image, blocking_read, origin,
2131                                       region, row_pitch, slice_pitch, ptr, num_events_in_wait_list,
2132                                       event_wait_list, event, &eventParam);
2133         paramBuffer.addParam(std::move(eventParam));
2134     }
2135     else
2136     {
2137         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2138         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2139                        &eventParam.value);
2140         paramBuffer.addParam(std::move(eventParam));
2141     }
2142 
2143     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2144     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2145     paramBuffer.addReturnValue(std::move(returnValueCapture));
2146 
2147     return CallCapture(angle::EntryPoint::CLEnqueueReadImage, std::move(paramBuffer));
2148 }
2149 
CaptureEnqueueWriteImage(bool isCallValid,cl_command_queue command_queue,cl_mem image,cl_bool blocking_write,const size_t * origin,const size_t * region,size_t input_row_pitch,size_t input_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2150 CallCapture CaptureEnqueueWriteImage(bool isCallValid,
2151                                      cl_command_queue command_queue,
2152                                      cl_mem image,
2153                                      cl_bool blocking_write,
2154                                      const size_t *origin,
2155                                      const size_t *region,
2156                                      size_t input_row_pitch,
2157                                      size_t input_slice_pitch,
2158                                      const void *ptr,
2159                                      cl_uint num_events_in_wait_list,
2160                                      const cl_event *event_wait_list,
2161                                      cl_event *event,
2162                                      cl_int returnValue)
2163 {
2164     ParamBuffer paramBuffer;
2165 
2166     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2167     paramBuffer.addValueParam("image", ParamType::Tcl_mem, image);
2168     paramBuffer.addValueParam("blocking_write", ParamType::Tcl_bool, blocking_write);
2169 
2170     if (isCallValid)
2171     {
2172         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
2173         InitParamValue(ParamType::Tsize_tConstPointer, origin, &originParam.value);
2174         CaptureEnqueueWriteImage_origin(
2175             isCallValid, command_queue, image, blocking_write, origin, region, input_row_pitch,
2176             input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event, &originParam);
2177         paramBuffer.addParam(std::move(originParam));
2178     }
2179     else
2180     {
2181         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
2182         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2183                        &originParam.value);
2184         paramBuffer.addParam(std::move(originParam));
2185     }
2186 
2187     if (isCallValid)
2188     {
2189         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2190         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
2191         CaptureEnqueueWriteImage_region(
2192             isCallValid, command_queue, image, blocking_write, origin, region, input_row_pitch,
2193             input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event, &regionParam);
2194         paramBuffer.addParam(std::move(regionParam));
2195     }
2196     else
2197     {
2198         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2199         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2200                        &regionParam.value);
2201         paramBuffer.addParam(std::move(regionParam));
2202     }
2203 
2204     paramBuffer.addValueParam("input_row_pitch", ParamType::Tsize_t, input_row_pitch);
2205     paramBuffer.addValueParam("input_slice_pitch", ParamType::Tsize_t, input_slice_pitch);
2206 
2207     if (isCallValid)
2208     {
2209         ParamCapture ptrParam("ptr", ParamType::TvoidConstPointer);
2210         InitParamValue(ParamType::TvoidConstPointer, ptr, &ptrParam.value);
2211         CaptureEnqueueWriteImage_ptr(isCallValid, command_queue, image, blocking_write, origin,
2212                                      region, input_row_pitch, input_slice_pitch, ptr,
2213                                      num_events_in_wait_list, event_wait_list, event, &ptrParam);
2214         paramBuffer.addParam(std::move(ptrParam));
2215     }
2216     else
2217     {
2218         ParamCapture ptrParam("ptr", ParamType::TvoidConstPointer);
2219         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
2220                        &ptrParam.value);
2221         paramBuffer.addParam(std::move(ptrParam));
2222     }
2223 
2224     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2225                               num_events_in_wait_list);
2226 
2227     if (isCallValid)
2228     {
2229         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2230         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2231                        &event_wait_listParam.value);
2232         CaptureEnqueueWriteImage_event_wait_list(isCallValid, command_queue, image, blocking_write,
2233                                                  origin, region, input_row_pitch, input_slice_pitch,
2234                                                  ptr, num_events_in_wait_list, event_wait_list,
2235                                                  event, &event_wait_listParam);
2236         paramBuffer.addParam(std::move(event_wait_listParam));
2237     }
2238     else
2239     {
2240         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2241         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2242                        &event_wait_listParam.value);
2243         paramBuffer.addParam(std::move(event_wait_listParam));
2244     }
2245 
2246     if (isCallValid)
2247     {
2248         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2249         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2250         CaptureEnqueueWriteImage_event(
2251             isCallValid, command_queue, image, blocking_write, origin, region, input_row_pitch,
2252             input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event, &eventParam);
2253         paramBuffer.addParam(std::move(eventParam));
2254     }
2255     else
2256     {
2257         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2258         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2259                        &eventParam.value);
2260         paramBuffer.addParam(std::move(eventParam));
2261     }
2262 
2263     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2264     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2265     paramBuffer.addReturnValue(std::move(returnValueCapture));
2266 
2267     return CallCapture(angle::EntryPoint::CLEnqueueWriteImage, std::move(paramBuffer));
2268 }
2269 
CaptureEnqueueCopyImage(bool isCallValid,cl_command_queue command_queue,cl_mem src_image,cl_mem dst_image,const size_t * src_origin,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2270 CallCapture CaptureEnqueueCopyImage(bool isCallValid,
2271                                     cl_command_queue command_queue,
2272                                     cl_mem src_image,
2273                                     cl_mem dst_image,
2274                                     const size_t *src_origin,
2275                                     const size_t *dst_origin,
2276                                     const size_t *region,
2277                                     cl_uint num_events_in_wait_list,
2278                                     const cl_event *event_wait_list,
2279                                     cl_event *event,
2280                                     cl_int returnValue)
2281 {
2282     ParamBuffer paramBuffer;
2283 
2284     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2285     paramBuffer.addValueParam("src_image", ParamType::Tcl_mem, src_image);
2286     paramBuffer.addValueParam("dst_image", ParamType::Tcl_mem, dst_image);
2287 
2288     if (isCallValid)
2289     {
2290         ParamCapture src_originParam("src_origin", ParamType::Tsize_tConstPointer);
2291         InitParamValue(ParamType::Tsize_tConstPointer, src_origin, &src_originParam.value);
2292         CaptureEnqueueCopyImage_src_origin(isCallValid, command_queue, src_image, dst_image,
2293                                            src_origin, dst_origin, region, num_events_in_wait_list,
2294                                            event_wait_list, event, &src_originParam);
2295         paramBuffer.addParam(std::move(src_originParam));
2296     }
2297     else
2298     {
2299         ParamCapture src_originParam("src_origin", ParamType::Tsize_tConstPointer);
2300         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2301                        &src_originParam.value);
2302         paramBuffer.addParam(std::move(src_originParam));
2303     }
2304 
2305     if (isCallValid)
2306     {
2307         ParamCapture dst_originParam("dst_origin", ParamType::Tsize_tConstPointer);
2308         InitParamValue(ParamType::Tsize_tConstPointer, dst_origin, &dst_originParam.value);
2309         CaptureEnqueueCopyImage_dst_origin(isCallValid, command_queue, src_image, dst_image,
2310                                            src_origin, dst_origin, region, num_events_in_wait_list,
2311                                            event_wait_list, event, &dst_originParam);
2312         paramBuffer.addParam(std::move(dst_originParam));
2313     }
2314     else
2315     {
2316         ParamCapture dst_originParam("dst_origin", ParamType::Tsize_tConstPointer);
2317         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2318                        &dst_originParam.value);
2319         paramBuffer.addParam(std::move(dst_originParam));
2320     }
2321 
2322     if (isCallValid)
2323     {
2324         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2325         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
2326         CaptureEnqueueCopyImage_region(isCallValid, command_queue, src_image, dst_image, src_origin,
2327                                        dst_origin, region, num_events_in_wait_list, event_wait_list,
2328                                        event, &regionParam);
2329         paramBuffer.addParam(std::move(regionParam));
2330     }
2331     else
2332     {
2333         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2334         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2335                        &regionParam.value);
2336         paramBuffer.addParam(std::move(regionParam));
2337     }
2338 
2339     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2340                               num_events_in_wait_list);
2341 
2342     if (isCallValid)
2343     {
2344         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2345         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2346                        &event_wait_listParam.value);
2347         CaptureEnqueueCopyImage_event_wait_list(
2348             isCallValid, command_queue, src_image, dst_image, src_origin, dst_origin, region,
2349             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
2350         paramBuffer.addParam(std::move(event_wait_listParam));
2351     }
2352     else
2353     {
2354         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2355         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2356                        &event_wait_listParam.value);
2357         paramBuffer.addParam(std::move(event_wait_listParam));
2358     }
2359 
2360     if (isCallValid)
2361     {
2362         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2363         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2364         CaptureEnqueueCopyImage_event(isCallValid, command_queue, src_image, dst_image, src_origin,
2365                                       dst_origin, region, num_events_in_wait_list, event_wait_list,
2366                                       event, &eventParam);
2367         paramBuffer.addParam(std::move(eventParam));
2368     }
2369     else
2370     {
2371         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2372         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2373                        &eventParam.value);
2374         paramBuffer.addParam(std::move(eventParam));
2375     }
2376 
2377     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2378     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2379     paramBuffer.addReturnValue(std::move(returnValueCapture));
2380 
2381     return CallCapture(angle::EntryPoint::CLEnqueueCopyImage, std::move(paramBuffer));
2382 }
2383 
CaptureEnqueueCopyImageToBuffer(bool isCallValid,cl_command_queue command_queue,cl_mem src_image,cl_mem dst_buffer,const size_t * src_origin,const size_t * region,size_t dst_offset,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2384 CallCapture CaptureEnqueueCopyImageToBuffer(bool isCallValid,
2385                                             cl_command_queue command_queue,
2386                                             cl_mem src_image,
2387                                             cl_mem dst_buffer,
2388                                             const size_t *src_origin,
2389                                             const size_t *region,
2390                                             size_t dst_offset,
2391                                             cl_uint num_events_in_wait_list,
2392                                             const cl_event *event_wait_list,
2393                                             cl_event *event,
2394                                             cl_int returnValue)
2395 {
2396     ParamBuffer paramBuffer;
2397 
2398     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2399     paramBuffer.addValueParam("src_image", ParamType::Tcl_mem, src_image);
2400     paramBuffer.addValueParam("dst_buffer", ParamType::Tcl_mem, dst_buffer);
2401 
2402     if (isCallValid)
2403     {
2404         ParamCapture src_originParam("src_origin", ParamType::Tsize_tConstPointer);
2405         InitParamValue(ParamType::Tsize_tConstPointer, src_origin, &src_originParam.value);
2406         CaptureEnqueueCopyImageToBuffer_src_origin(
2407             isCallValid, command_queue, src_image, dst_buffer, src_origin, region, dst_offset,
2408             num_events_in_wait_list, event_wait_list, event, &src_originParam);
2409         paramBuffer.addParam(std::move(src_originParam));
2410     }
2411     else
2412     {
2413         ParamCapture src_originParam("src_origin", ParamType::Tsize_tConstPointer);
2414         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2415                        &src_originParam.value);
2416         paramBuffer.addParam(std::move(src_originParam));
2417     }
2418 
2419     if (isCallValid)
2420     {
2421         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2422         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
2423         CaptureEnqueueCopyImageToBuffer_region(
2424             isCallValid, command_queue, src_image, dst_buffer, src_origin, region, dst_offset,
2425             num_events_in_wait_list, event_wait_list, event, &regionParam);
2426         paramBuffer.addParam(std::move(regionParam));
2427     }
2428     else
2429     {
2430         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2431         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2432                        &regionParam.value);
2433         paramBuffer.addParam(std::move(regionParam));
2434     }
2435 
2436     paramBuffer.addValueParam("dst_offset", ParamType::Tsize_t, dst_offset);
2437     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2438                               num_events_in_wait_list);
2439 
2440     if (isCallValid)
2441     {
2442         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2443         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2444                        &event_wait_listParam.value);
2445         CaptureEnqueueCopyImageToBuffer_event_wait_list(
2446             isCallValid, command_queue, src_image, dst_buffer, src_origin, region, dst_offset,
2447             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
2448         paramBuffer.addParam(std::move(event_wait_listParam));
2449     }
2450     else
2451     {
2452         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2453         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2454                        &event_wait_listParam.value);
2455         paramBuffer.addParam(std::move(event_wait_listParam));
2456     }
2457 
2458     if (isCallValid)
2459     {
2460         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2461         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2462         CaptureEnqueueCopyImageToBuffer_event(
2463             isCallValid, command_queue, src_image, dst_buffer, src_origin, region, dst_offset,
2464             num_events_in_wait_list, event_wait_list, event, &eventParam);
2465         paramBuffer.addParam(std::move(eventParam));
2466     }
2467     else
2468     {
2469         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2470         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2471                        &eventParam.value);
2472         paramBuffer.addParam(std::move(eventParam));
2473     }
2474 
2475     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2476     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2477     paramBuffer.addReturnValue(std::move(returnValueCapture));
2478 
2479     return CallCapture(angle::EntryPoint::CLEnqueueCopyImageToBuffer, std::move(paramBuffer));
2480 }
2481 
CaptureEnqueueCopyBufferToImage(bool isCallValid,cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_image,size_t src_offset,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2482 CallCapture CaptureEnqueueCopyBufferToImage(bool isCallValid,
2483                                             cl_command_queue command_queue,
2484                                             cl_mem src_buffer,
2485                                             cl_mem dst_image,
2486                                             size_t src_offset,
2487                                             const size_t *dst_origin,
2488                                             const size_t *region,
2489                                             cl_uint num_events_in_wait_list,
2490                                             const cl_event *event_wait_list,
2491                                             cl_event *event,
2492                                             cl_int returnValue)
2493 {
2494     ParamBuffer paramBuffer;
2495 
2496     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2497     paramBuffer.addValueParam("src_buffer", ParamType::Tcl_mem, src_buffer);
2498     paramBuffer.addValueParam("dst_image", ParamType::Tcl_mem, dst_image);
2499     paramBuffer.addValueParam("src_offset", ParamType::Tsize_t, src_offset);
2500 
2501     if (isCallValid)
2502     {
2503         ParamCapture dst_originParam("dst_origin", ParamType::Tsize_tConstPointer);
2504         InitParamValue(ParamType::Tsize_tConstPointer, dst_origin, &dst_originParam.value);
2505         CaptureEnqueueCopyBufferToImage_dst_origin(
2506             isCallValid, command_queue, src_buffer, dst_image, src_offset, dst_origin, region,
2507             num_events_in_wait_list, event_wait_list, event, &dst_originParam);
2508         paramBuffer.addParam(std::move(dst_originParam));
2509     }
2510     else
2511     {
2512         ParamCapture dst_originParam("dst_origin", ParamType::Tsize_tConstPointer);
2513         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2514                        &dst_originParam.value);
2515         paramBuffer.addParam(std::move(dst_originParam));
2516     }
2517 
2518     if (isCallValid)
2519     {
2520         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2521         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
2522         CaptureEnqueueCopyBufferToImage_region(
2523             isCallValid, command_queue, src_buffer, dst_image, src_offset, dst_origin, region,
2524             num_events_in_wait_list, event_wait_list, event, &regionParam);
2525         paramBuffer.addParam(std::move(regionParam));
2526     }
2527     else
2528     {
2529         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2530         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2531                        &regionParam.value);
2532         paramBuffer.addParam(std::move(regionParam));
2533     }
2534 
2535     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2536                               num_events_in_wait_list);
2537 
2538     if (isCallValid)
2539     {
2540         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2541         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2542                        &event_wait_listParam.value);
2543         CaptureEnqueueCopyBufferToImage_event_wait_list(
2544             isCallValid, command_queue, src_buffer, dst_image, src_offset, dst_origin, region,
2545             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
2546         paramBuffer.addParam(std::move(event_wait_listParam));
2547     }
2548     else
2549     {
2550         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2551         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2552                        &event_wait_listParam.value);
2553         paramBuffer.addParam(std::move(event_wait_listParam));
2554     }
2555 
2556     if (isCallValid)
2557     {
2558         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2559         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2560         CaptureEnqueueCopyBufferToImage_event(
2561             isCallValid, command_queue, src_buffer, dst_image, src_offset, dst_origin, region,
2562             num_events_in_wait_list, event_wait_list, event, &eventParam);
2563         paramBuffer.addParam(std::move(eventParam));
2564     }
2565     else
2566     {
2567         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2568         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2569                        &eventParam.value);
2570         paramBuffer.addParam(std::move(eventParam));
2571     }
2572 
2573     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2574     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2575     paramBuffer.addReturnValue(std::move(returnValueCapture));
2576 
2577     return CallCapture(angle::EntryPoint::CLEnqueueCopyBufferToImage, std::move(paramBuffer));
2578 }
2579 
CaptureEnqueueMapBuffer(bool isCallValid,cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_map,MapFlags map_flagsPacked,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret,void * returnValue)2580 CallCapture CaptureEnqueueMapBuffer(bool isCallValid,
2581                                     cl_command_queue command_queue,
2582                                     cl_mem buffer,
2583                                     cl_bool blocking_map,
2584                                     MapFlags map_flagsPacked,
2585                                     size_t offset,
2586                                     size_t size,
2587                                     cl_uint num_events_in_wait_list,
2588                                     const cl_event *event_wait_list,
2589                                     cl_event *event,
2590                                     cl_int *errcode_ret,
2591                                     void *returnValue)
2592 {
2593     ParamBuffer paramBuffer;
2594 
2595     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2596     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
2597     paramBuffer.addValueParam("blocking_map", ParamType::Tcl_bool, blocking_map);
2598     paramBuffer.addValueParam("map_flagsPacked", ParamType::TMapFlags, map_flagsPacked);
2599     paramBuffer.addValueParam("offset", ParamType::Tsize_t, offset);
2600     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
2601     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2602                               num_events_in_wait_list);
2603 
2604     if (isCallValid)
2605     {
2606         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2607         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2608                        &event_wait_listParam.value);
2609         CaptureEnqueueMapBuffer_event_wait_list(
2610             isCallValid, command_queue, buffer, blocking_map, map_flagsPacked, offset, size,
2611             num_events_in_wait_list, event_wait_list, event, errcode_ret, &event_wait_listParam);
2612         paramBuffer.addParam(std::move(event_wait_listParam));
2613     }
2614     else
2615     {
2616         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2617         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2618                        &event_wait_listParam.value);
2619         paramBuffer.addParam(std::move(event_wait_listParam));
2620     }
2621 
2622     if (isCallValid)
2623     {
2624         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2625         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2626         CaptureEnqueueMapBuffer_event(isCallValid, command_queue, buffer, blocking_map,
2627                                       map_flagsPacked, offset, size, num_events_in_wait_list,
2628                                       event_wait_list, event, errcode_ret, &eventParam);
2629         paramBuffer.addParam(std::move(eventParam));
2630     }
2631     else
2632     {
2633         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2634         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2635                        &eventParam.value);
2636         paramBuffer.addParam(std::move(eventParam));
2637     }
2638 
2639     if (isCallValid)
2640     {
2641         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
2642         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
2643         CaptureEnqueueMapBuffer_errcode_ret(isCallValid, command_queue, buffer, blocking_map,
2644                                             map_flagsPacked, offset, size, num_events_in_wait_list,
2645                                             event_wait_list, event, errcode_ret, &errcode_retParam);
2646         paramBuffer.addParam(std::move(errcode_retParam));
2647     }
2648     else
2649     {
2650         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
2651         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
2652                        &errcode_retParam.value);
2653         paramBuffer.addParam(std::move(errcode_retParam));
2654     }
2655 
2656     ParamCapture returnValueCapture("returnValue", ParamType::TvoidPointer);
2657     InitParamValue(ParamType::TvoidPointer, returnValue, &returnValueCapture.value);
2658     paramBuffer.addReturnValue(std::move(returnValueCapture));
2659 
2660     return CallCapture(angle::EntryPoint::CLEnqueueMapBuffer, std::move(paramBuffer));
2661 }
2662 
CaptureEnqueueMapImage(bool isCallValid,cl_command_queue command_queue,cl_mem image,cl_bool blocking_map,MapFlags map_flagsPacked,const size_t * origin,const size_t * region,size_t * image_row_pitch,size_t * image_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret,void * returnValue)2663 CallCapture CaptureEnqueueMapImage(bool isCallValid,
2664                                    cl_command_queue command_queue,
2665                                    cl_mem image,
2666                                    cl_bool blocking_map,
2667                                    MapFlags map_flagsPacked,
2668                                    const size_t *origin,
2669                                    const size_t *region,
2670                                    size_t *image_row_pitch,
2671                                    size_t *image_slice_pitch,
2672                                    cl_uint num_events_in_wait_list,
2673                                    const cl_event *event_wait_list,
2674                                    cl_event *event,
2675                                    cl_int *errcode_ret,
2676                                    void *returnValue)
2677 {
2678     ParamBuffer paramBuffer;
2679 
2680     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2681     paramBuffer.addValueParam("image", ParamType::Tcl_mem, image);
2682     paramBuffer.addValueParam("blocking_map", ParamType::Tcl_bool, blocking_map);
2683     paramBuffer.addValueParam("map_flagsPacked", ParamType::TMapFlags, map_flagsPacked);
2684 
2685     if (isCallValid)
2686     {
2687         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
2688         InitParamValue(ParamType::Tsize_tConstPointer, origin, &originParam.value);
2689         CaptureEnqueueMapImage_origin(isCallValid, command_queue, image, blocking_map,
2690                                       map_flagsPacked, origin, region, image_row_pitch,
2691                                       image_slice_pitch, num_events_in_wait_list, event_wait_list,
2692                                       event, errcode_ret, &originParam);
2693         paramBuffer.addParam(std::move(originParam));
2694     }
2695     else
2696     {
2697         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
2698         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2699                        &originParam.value);
2700         paramBuffer.addParam(std::move(originParam));
2701     }
2702 
2703     if (isCallValid)
2704     {
2705         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2706         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
2707         CaptureEnqueueMapImage_region(isCallValid, command_queue, image, blocking_map,
2708                                       map_flagsPacked, origin, region, image_row_pitch,
2709                                       image_slice_pitch, num_events_in_wait_list, event_wait_list,
2710                                       event, errcode_ret, &regionParam);
2711         paramBuffer.addParam(std::move(regionParam));
2712     }
2713     else
2714     {
2715         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
2716         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2717                        &regionParam.value);
2718         paramBuffer.addParam(std::move(regionParam));
2719     }
2720 
2721     if (isCallValid)
2722     {
2723         ParamCapture image_row_pitchParam("image_row_pitch", ParamType::Tsize_tPointer);
2724         InitParamValue(ParamType::Tsize_tPointer, image_row_pitch, &image_row_pitchParam.value);
2725         CaptureEnqueueMapImage_image_row_pitch(
2726             isCallValid, command_queue, image, blocking_map, map_flagsPacked, origin, region,
2727             image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event,
2728             errcode_ret, &image_row_pitchParam);
2729         paramBuffer.addParam(std::move(image_row_pitchParam));
2730     }
2731     else
2732     {
2733         ParamCapture image_row_pitchParam("image_row_pitch", ParamType::Tsize_tPointer);
2734         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
2735                        &image_row_pitchParam.value);
2736         paramBuffer.addParam(std::move(image_row_pitchParam));
2737     }
2738 
2739     if (isCallValid)
2740     {
2741         ParamCapture image_slice_pitchParam("image_slice_pitch", ParamType::Tsize_tPointer);
2742         InitParamValue(ParamType::Tsize_tPointer, image_slice_pitch, &image_slice_pitchParam.value);
2743         CaptureEnqueueMapImage_image_slice_pitch(
2744             isCallValid, command_queue, image, blocking_map, map_flagsPacked, origin, region,
2745             image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event,
2746             errcode_ret, &image_slice_pitchParam);
2747         paramBuffer.addParam(std::move(image_slice_pitchParam));
2748     }
2749     else
2750     {
2751         ParamCapture image_slice_pitchParam("image_slice_pitch", ParamType::Tsize_tPointer);
2752         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
2753                        &image_slice_pitchParam.value);
2754         paramBuffer.addParam(std::move(image_slice_pitchParam));
2755     }
2756 
2757     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2758                               num_events_in_wait_list);
2759 
2760     if (isCallValid)
2761     {
2762         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2763         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2764                        &event_wait_listParam.value);
2765         CaptureEnqueueMapImage_event_wait_list(
2766             isCallValid, command_queue, image, blocking_map, map_flagsPacked, origin, region,
2767             image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event,
2768             errcode_ret, &event_wait_listParam);
2769         paramBuffer.addParam(std::move(event_wait_listParam));
2770     }
2771     else
2772     {
2773         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2774         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2775                        &event_wait_listParam.value);
2776         paramBuffer.addParam(std::move(event_wait_listParam));
2777     }
2778 
2779     if (isCallValid)
2780     {
2781         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2782         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2783         CaptureEnqueueMapImage_event(isCallValid, command_queue, image, blocking_map,
2784                                      map_flagsPacked, origin, region, image_row_pitch,
2785                                      image_slice_pitch, num_events_in_wait_list, event_wait_list,
2786                                      event, errcode_ret, &eventParam);
2787         paramBuffer.addParam(std::move(eventParam));
2788     }
2789     else
2790     {
2791         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2792         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2793                        &eventParam.value);
2794         paramBuffer.addParam(std::move(eventParam));
2795     }
2796 
2797     if (isCallValid)
2798     {
2799         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
2800         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
2801         CaptureEnqueueMapImage_errcode_ret(isCallValid, command_queue, image, blocking_map,
2802                                            map_flagsPacked, origin, region, image_row_pitch,
2803                                            image_slice_pitch, num_events_in_wait_list,
2804                                            event_wait_list, event, errcode_ret, &errcode_retParam);
2805         paramBuffer.addParam(std::move(errcode_retParam));
2806     }
2807     else
2808     {
2809         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
2810         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
2811                        &errcode_retParam.value);
2812         paramBuffer.addParam(std::move(errcode_retParam));
2813     }
2814 
2815     ParamCapture returnValueCapture("returnValue", ParamType::TvoidPointer);
2816     InitParamValue(ParamType::TvoidPointer, returnValue, &returnValueCapture.value);
2817     paramBuffer.addReturnValue(std::move(returnValueCapture));
2818 
2819     return CallCapture(angle::EntryPoint::CLEnqueueMapImage, std::move(paramBuffer));
2820 }
2821 
CaptureEnqueueUnmapMemObject(bool isCallValid,cl_command_queue command_queue,cl_mem memobj,void * mapped_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2822 CallCapture CaptureEnqueueUnmapMemObject(bool isCallValid,
2823                                          cl_command_queue command_queue,
2824                                          cl_mem memobj,
2825                                          void *mapped_ptr,
2826                                          cl_uint num_events_in_wait_list,
2827                                          const cl_event *event_wait_list,
2828                                          cl_event *event,
2829                                          cl_int returnValue)
2830 {
2831     ParamBuffer paramBuffer;
2832 
2833     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2834     paramBuffer.addValueParam("memobj", ParamType::Tcl_mem, memobj);
2835 
2836     if (isCallValid)
2837     {
2838         ParamCapture mapped_ptrParam("mapped_ptr", ParamType::TvoidPointer);
2839         InitParamValue(ParamType::TvoidPointer, mapped_ptr, &mapped_ptrParam.value);
2840         CaptureEnqueueUnmapMemObject_mapped_ptr(isCallValid, command_queue, memobj, mapped_ptr,
2841                                                 num_events_in_wait_list, event_wait_list, event,
2842                                                 &mapped_ptrParam);
2843         paramBuffer.addParam(std::move(mapped_ptrParam));
2844     }
2845     else
2846     {
2847         ParamCapture mapped_ptrParam("mapped_ptr", ParamType::TvoidPointer);
2848         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
2849                        &mapped_ptrParam.value);
2850         paramBuffer.addParam(std::move(mapped_ptrParam));
2851     }
2852 
2853     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2854                               num_events_in_wait_list);
2855 
2856     if (isCallValid)
2857     {
2858         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2859         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2860                        &event_wait_listParam.value);
2861         CaptureEnqueueUnmapMemObject_event_wait_list(isCallValid, command_queue, memobj, mapped_ptr,
2862                                                      num_events_in_wait_list, event_wait_list,
2863                                                      event, &event_wait_listParam);
2864         paramBuffer.addParam(std::move(event_wait_listParam));
2865     }
2866     else
2867     {
2868         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2869         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2870                        &event_wait_listParam.value);
2871         paramBuffer.addParam(std::move(event_wait_listParam));
2872     }
2873 
2874     if (isCallValid)
2875     {
2876         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2877         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2878         CaptureEnqueueUnmapMemObject_event(isCallValid, command_queue, memobj, mapped_ptr,
2879                                            num_events_in_wait_list, event_wait_list, event,
2880                                            &eventParam);
2881         paramBuffer.addParam(std::move(eventParam));
2882     }
2883     else
2884     {
2885         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2886         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
2887                        &eventParam.value);
2888         paramBuffer.addParam(std::move(eventParam));
2889     }
2890 
2891     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
2892     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
2893     paramBuffer.addReturnValue(std::move(returnValueCapture));
2894 
2895     return CallCapture(angle::EntryPoint::CLEnqueueUnmapMemObject, std::move(paramBuffer));
2896 }
2897 
CaptureEnqueueNDRangeKernel(bool isCallValid,cl_command_queue command_queue,cl_kernel kernel,cl_uint work_dim,const size_t * global_work_offset,const size_t * global_work_size,const size_t * local_work_size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)2898 CallCapture CaptureEnqueueNDRangeKernel(bool isCallValid,
2899                                         cl_command_queue command_queue,
2900                                         cl_kernel kernel,
2901                                         cl_uint work_dim,
2902                                         const size_t *global_work_offset,
2903                                         const size_t *global_work_size,
2904                                         const size_t *local_work_size,
2905                                         cl_uint num_events_in_wait_list,
2906                                         const cl_event *event_wait_list,
2907                                         cl_event *event,
2908                                         cl_int returnValue)
2909 {
2910     ParamBuffer paramBuffer;
2911 
2912     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
2913     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
2914     paramBuffer.addValueParam("work_dim", ParamType::Tcl_uint, work_dim);
2915 
2916     if (isCallValid)
2917     {
2918         ParamCapture global_work_offsetParam("global_work_offset", ParamType::Tsize_tConstPointer);
2919         InitParamValue(ParamType::Tsize_tConstPointer, global_work_offset,
2920                        &global_work_offsetParam.value);
2921         CaptureEnqueueNDRangeKernel_global_work_offset(
2922             isCallValid, command_queue, kernel, work_dim, global_work_offset, global_work_size,
2923             local_work_size, num_events_in_wait_list, event_wait_list, event,
2924             &global_work_offsetParam);
2925         paramBuffer.addParam(std::move(global_work_offsetParam));
2926     }
2927     else
2928     {
2929         ParamCapture global_work_offsetParam("global_work_offset", ParamType::Tsize_tConstPointer);
2930         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2931                        &global_work_offsetParam.value);
2932         paramBuffer.addParam(std::move(global_work_offsetParam));
2933     }
2934 
2935     if (isCallValid)
2936     {
2937         ParamCapture global_work_sizeParam("global_work_size", ParamType::Tsize_tConstPointer);
2938         InitParamValue(ParamType::Tsize_tConstPointer, global_work_size,
2939                        &global_work_sizeParam.value);
2940         CaptureEnqueueNDRangeKernel_global_work_size(
2941             isCallValid, command_queue, kernel, work_dim, global_work_offset, global_work_size,
2942             local_work_size, num_events_in_wait_list, event_wait_list, event,
2943             &global_work_sizeParam);
2944         paramBuffer.addParam(std::move(global_work_sizeParam));
2945     }
2946     else
2947     {
2948         ParamCapture global_work_sizeParam("global_work_size", ParamType::Tsize_tConstPointer);
2949         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2950                        &global_work_sizeParam.value);
2951         paramBuffer.addParam(std::move(global_work_sizeParam));
2952     }
2953 
2954     if (isCallValid)
2955     {
2956         ParamCapture local_work_sizeParam("local_work_size", ParamType::Tsize_tConstPointer);
2957         InitParamValue(ParamType::Tsize_tConstPointer, local_work_size,
2958                        &local_work_sizeParam.value);
2959         CaptureEnqueueNDRangeKernel_local_work_size(isCallValid, command_queue, kernel, work_dim,
2960                                                     global_work_offset, global_work_size,
2961                                                     local_work_size, num_events_in_wait_list,
2962                                                     event_wait_list, event, &local_work_sizeParam);
2963         paramBuffer.addParam(std::move(local_work_sizeParam));
2964     }
2965     else
2966     {
2967         ParamCapture local_work_sizeParam("local_work_size", ParamType::Tsize_tConstPointer);
2968         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
2969                        &local_work_sizeParam.value);
2970         paramBuffer.addParam(std::move(local_work_sizeParam));
2971     }
2972 
2973     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
2974                               num_events_in_wait_list);
2975 
2976     if (isCallValid)
2977     {
2978         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2979         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
2980                        &event_wait_listParam.value);
2981         CaptureEnqueueNDRangeKernel_event_wait_list(isCallValid, command_queue, kernel, work_dim,
2982                                                     global_work_offset, global_work_size,
2983                                                     local_work_size, num_events_in_wait_list,
2984                                                     event_wait_list, event, &event_wait_listParam);
2985         paramBuffer.addParam(std::move(event_wait_listParam));
2986     }
2987     else
2988     {
2989         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
2990         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
2991                        &event_wait_listParam.value);
2992         paramBuffer.addParam(std::move(event_wait_listParam));
2993     }
2994 
2995     if (isCallValid)
2996     {
2997         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
2998         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
2999         CaptureEnqueueNDRangeKernel_event(
3000             isCallValid, command_queue, kernel, work_dim, global_work_offset, global_work_size,
3001             local_work_size, num_events_in_wait_list, event_wait_list, event, &eventParam);
3002         paramBuffer.addParam(std::move(eventParam));
3003     }
3004     else
3005     {
3006         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3007         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
3008                        &eventParam.value);
3009         paramBuffer.addParam(std::move(eventParam));
3010     }
3011 
3012     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3013     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3014     paramBuffer.addReturnValue(std::move(returnValueCapture));
3015 
3016     return CallCapture(angle::EntryPoint::CLEnqueueNDRangeKernel, std::move(paramBuffer));
3017 }
3018 
CaptureEnqueueNativeKernel(bool isCallValid,cl_command_queue command_queue,void (CL_CALLBACK * user_func)(void *),void * args,size_t cb_args,cl_uint num_mem_objects,const cl_mem * mem_list,const void ** args_mem_loc,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)3019 CallCapture CaptureEnqueueNativeKernel(bool isCallValid,
3020                                        cl_command_queue command_queue,
3021                                        void(CL_CALLBACK *user_func)(void *),
3022                                        void *args,
3023                                        size_t cb_args,
3024                                        cl_uint num_mem_objects,
3025                                        const cl_mem *mem_list,
3026                                        const void **args_mem_loc,
3027                                        cl_uint num_events_in_wait_list,
3028                                        const cl_event *event_wait_list,
3029                                        cl_event *event,
3030                                        cl_int returnValue)
3031 {
3032     ParamBuffer paramBuffer;
3033 
3034     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3035 
3036     if (isCallValid)
3037     {
3038         ParamCapture user_funcParam("user_func", ParamType::Tcl_void_func_type);
3039         InitParamValue(ParamType::Tcl_void_func_type, user_func, &user_funcParam.value);
3040         CaptureEnqueueNativeKernel_user_func(
3041             isCallValid, command_queue, user_func, args, cb_args, num_mem_objects, mem_list,
3042             args_mem_loc, num_events_in_wait_list, event_wait_list, event, &user_funcParam);
3043         paramBuffer.addParam(std::move(user_funcParam));
3044     }
3045     else
3046     {
3047         ParamCapture user_funcParam("user_func", ParamType::Tcl_void_func_type);
3048         InitParamValue(ParamType::Tcl_void_func_type,
3049                        static_cast<void(CL_CALLBACK *)(void *)>(nullptr), &user_funcParam.value);
3050         paramBuffer.addParam(std::move(user_funcParam));
3051     }
3052 
3053     if (isCallValid)
3054     {
3055         ParamCapture argsParam("args", ParamType::TvoidPointer);
3056         InitParamValue(ParamType::TvoidPointer, args, &argsParam.value);
3057         CaptureEnqueueNativeKernel_args(
3058             isCallValid, command_queue, user_func, args, cb_args, num_mem_objects, mem_list,
3059             args_mem_loc, num_events_in_wait_list, event_wait_list, event, &argsParam);
3060         paramBuffer.addParam(std::move(argsParam));
3061     }
3062     else
3063     {
3064         ParamCapture argsParam("args", ParamType::TvoidPointer);
3065         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &argsParam.value);
3066         paramBuffer.addParam(std::move(argsParam));
3067     }
3068 
3069     paramBuffer.addValueParam("cb_args", ParamType::Tsize_t, cb_args);
3070     paramBuffer.addValueParam("num_mem_objects", ParamType::Tcl_uint, num_mem_objects);
3071 
3072     if (isCallValid)
3073     {
3074         ParamCapture mem_listParam("mem_list", ParamType::Tcl_memConstPointer);
3075         InitParamValue(ParamType::Tcl_memConstPointer, mem_list, &mem_listParam.value);
3076         CaptureEnqueueNativeKernel_mem_list(
3077             isCallValid, command_queue, user_func, args, cb_args, num_mem_objects, mem_list,
3078             args_mem_loc, num_events_in_wait_list, event_wait_list, event, &mem_listParam);
3079         paramBuffer.addParam(std::move(mem_listParam));
3080     }
3081     else
3082     {
3083         ParamCapture mem_listParam("mem_list", ParamType::Tcl_memConstPointer);
3084         InitParamValue(ParamType::Tcl_memConstPointer, static_cast<const cl_mem *>(nullptr),
3085                        &mem_listParam.value);
3086         paramBuffer.addParam(std::move(mem_listParam));
3087     }
3088 
3089     if (isCallValid)
3090     {
3091         ParamCapture args_mem_locParam("args_mem_loc", ParamType::TvoidConstPointerPointer);
3092         InitParamValue(ParamType::TvoidConstPointerPointer, args_mem_loc, &args_mem_locParam.value);
3093         CaptureEnqueueNativeKernel_args_mem_loc(
3094             isCallValid, command_queue, user_func, args, cb_args, num_mem_objects, mem_list,
3095             args_mem_loc, num_events_in_wait_list, event_wait_list, event, &args_mem_locParam);
3096         paramBuffer.addParam(std::move(args_mem_locParam));
3097     }
3098     else
3099     {
3100         ParamCapture args_mem_locParam("args_mem_loc", ParamType::TvoidConstPointerPointer);
3101         InitParamValue(ParamType::TvoidConstPointerPointer, static_cast<const void **>(nullptr),
3102                        &args_mem_locParam.value);
3103         paramBuffer.addParam(std::move(args_mem_locParam));
3104     }
3105 
3106     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
3107                               num_events_in_wait_list);
3108 
3109     if (isCallValid)
3110     {
3111         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
3112         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
3113                        &event_wait_listParam.value);
3114         CaptureEnqueueNativeKernel_event_wait_list(
3115             isCallValid, command_queue, user_func, args, cb_args, num_mem_objects, mem_list,
3116             args_mem_loc, num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
3117         paramBuffer.addParam(std::move(event_wait_listParam));
3118     }
3119     else
3120     {
3121         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
3122         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
3123                        &event_wait_listParam.value);
3124         paramBuffer.addParam(std::move(event_wait_listParam));
3125     }
3126 
3127     if (isCallValid)
3128     {
3129         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3130         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
3131         CaptureEnqueueNativeKernel_event(
3132             isCallValid, command_queue, user_func, args, cb_args, num_mem_objects, mem_list,
3133             args_mem_loc, num_events_in_wait_list, event_wait_list, event, &eventParam);
3134         paramBuffer.addParam(std::move(eventParam));
3135     }
3136     else
3137     {
3138         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3139         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
3140                        &eventParam.value);
3141         paramBuffer.addParam(std::move(eventParam));
3142     }
3143 
3144     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3145     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3146     paramBuffer.addReturnValue(std::move(returnValueCapture));
3147 
3148     return CallCapture(angle::EntryPoint::CLEnqueueNativeKernel, std::move(paramBuffer));
3149 }
3150 
CaptureSetCommandQueueProperty(bool isCallValid,cl_command_queue command_queue,CommandQueueProperties propertiesPacked,cl_bool enable,cl_command_queue_properties * old_properties,cl_int returnValue)3151 CallCapture CaptureSetCommandQueueProperty(bool isCallValid,
3152                                            cl_command_queue command_queue,
3153                                            CommandQueueProperties propertiesPacked,
3154                                            cl_bool enable,
3155                                            cl_command_queue_properties *old_properties,
3156                                            cl_int returnValue)
3157 {
3158     ParamBuffer paramBuffer;
3159 
3160     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3161     paramBuffer.addValueParam("propertiesPacked", ParamType::TCommandQueueProperties,
3162                               propertiesPacked);
3163     paramBuffer.addValueParam("enable", ParamType::Tcl_bool, enable);
3164 
3165     if (isCallValid)
3166     {
3167         ParamCapture old_propertiesParam("old_properties",
3168                                          ParamType::Tcl_command_queue_propertiesPointer);
3169         InitParamValue(ParamType::Tcl_command_queue_propertiesPointer, old_properties,
3170                        &old_propertiesParam.value);
3171         CaptureSetCommandQueueProperty_old_properties(isCallValid, command_queue, propertiesPacked,
3172                                                       enable, old_properties, &old_propertiesParam);
3173         paramBuffer.addParam(std::move(old_propertiesParam));
3174     }
3175     else
3176     {
3177         ParamCapture old_propertiesParam("old_properties",
3178                                          ParamType::Tcl_command_queue_propertiesPointer);
3179         InitParamValue(ParamType::Tcl_command_queue_propertiesPointer,
3180                        static_cast<cl_command_queue_properties *>(nullptr),
3181                        &old_propertiesParam.value);
3182         paramBuffer.addParam(std::move(old_propertiesParam));
3183     }
3184 
3185     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3186     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3187     paramBuffer.addReturnValue(std::move(returnValueCapture));
3188 
3189     return CallCapture(angle::EntryPoint::CLSetCommandQueueProperty, std::move(paramBuffer));
3190 }
3191 
CaptureCreateImage2D(bool isCallValid,cl_context context,MemFlags flagsPacked,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_row_pitch,void * host_ptr,cl_int * errcode_ret,cl_mem returnValue)3192 CallCapture CaptureCreateImage2D(bool isCallValid,
3193                                  cl_context context,
3194                                  MemFlags flagsPacked,
3195                                  const cl_image_format *image_format,
3196                                  size_t image_width,
3197                                  size_t image_height,
3198                                  size_t image_row_pitch,
3199                                  void *host_ptr,
3200                                  cl_int *errcode_ret,
3201                                  cl_mem returnValue)
3202 {
3203     ParamBuffer paramBuffer;
3204 
3205     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
3206     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
3207 
3208     if (isCallValid)
3209     {
3210         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
3211         InitParamValue(ParamType::Tcl_image_formatConstPointer, image_format,
3212                        &image_formatParam.value);
3213         CaptureCreateImage2D_image_format(isCallValid, context, flagsPacked, image_format,
3214                                           image_width, image_height, image_row_pitch, host_ptr,
3215                                           errcode_ret, &image_formatParam);
3216         paramBuffer.addParam(std::move(image_formatParam));
3217     }
3218     else
3219     {
3220         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
3221         InitParamValue(ParamType::Tcl_image_formatConstPointer,
3222                        static_cast<const cl_image_format *>(nullptr), &image_formatParam.value);
3223         paramBuffer.addParam(std::move(image_formatParam));
3224     }
3225 
3226     paramBuffer.addValueParam("image_width", ParamType::Tsize_t, image_width);
3227     paramBuffer.addValueParam("image_height", ParamType::Tsize_t, image_height);
3228     paramBuffer.addValueParam("image_row_pitch", ParamType::Tsize_t, image_row_pitch);
3229 
3230     if (isCallValid)
3231     {
3232         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
3233         InitParamValue(ParamType::TvoidPointer, host_ptr, &host_ptrParam.value);
3234         CaptureCreateImage2D_host_ptr(isCallValid, context, flagsPacked, image_format, image_width,
3235                                       image_height, image_row_pitch, host_ptr, errcode_ret,
3236                                       &host_ptrParam);
3237         paramBuffer.addParam(std::move(host_ptrParam));
3238     }
3239     else
3240     {
3241         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
3242         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &host_ptrParam.value);
3243         paramBuffer.addParam(std::move(host_ptrParam));
3244     }
3245 
3246     if (isCallValid)
3247     {
3248         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3249         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
3250         CaptureCreateImage2D_errcode_ret(isCallValid, context, flagsPacked, image_format,
3251                                          image_width, image_height, image_row_pitch, host_ptr,
3252                                          errcode_ret, &errcode_retParam);
3253         paramBuffer.addParam(std::move(errcode_retParam));
3254     }
3255     else
3256     {
3257         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3258         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
3259                        &errcode_retParam.value);
3260         paramBuffer.addParam(std::move(errcode_retParam));
3261     }
3262 
3263     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
3264     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
3265     paramBuffer.addReturnValue(std::move(returnValueCapture));
3266 
3267     return CallCapture(angle::EntryPoint::CLCreateImage2D, std::move(paramBuffer));
3268 }
3269 
CaptureCreateImage3D(bool isCallValid,cl_context context,MemFlags flagsPacked,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_depth,size_t image_row_pitch,size_t image_slice_pitch,void * host_ptr,cl_int * errcode_ret,cl_mem returnValue)3270 CallCapture CaptureCreateImage3D(bool isCallValid,
3271                                  cl_context context,
3272                                  MemFlags flagsPacked,
3273                                  const cl_image_format *image_format,
3274                                  size_t image_width,
3275                                  size_t image_height,
3276                                  size_t image_depth,
3277                                  size_t image_row_pitch,
3278                                  size_t image_slice_pitch,
3279                                  void *host_ptr,
3280                                  cl_int *errcode_ret,
3281                                  cl_mem returnValue)
3282 {
3283     ParamBuffer paramBuffer;
3284 
3285     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
3286     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
3287 
3288     if (isCallValid)
3289     {
3290         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
3291         InitParamValue(ParamType::Tcl_image_formatConstPointer, image_format,
3292                        &image_formatParam.value);
3293         CaptureCreateImage3D_image_format(
3294             isCallValid, context, flagsPacked, image_format, image_width, image_height, image_depth,
3295             image_row_pitch, image_slice_pitch, host_ptr, errcode_ret, &image_formatParam);
3296         paramBuffer.addParam(std::move(image_formatParam));
3297     }
3298     else
3299     {
3300         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
3301         InitParamValue(ParamType::Tcl_image_formatConstPointer,
3302                        static_cast<const cl_image_format *>(nullptr), &image_formatParam.value);
3303         paramBuffer.addParam(std::move(image_formatParam));
3304     }
3305 
3306     paramBuffer.addValueParam("image_width", ParamType::Tsize_t, image_width);
3307     paramBuffer.addValueParam("image_height", ParamType::Tsize_t, image_height);
3308     paramBuffer.addValueParam("image_depth", ParamType::Tsize_t, image_depth);
3309     paramBuffer.addValueParam("image_row_pitch", ParamType::Tsize_t, image_row_pitch);
3310     paramBuffer.addValueParam("image_slice_pitch", ParamType::Tsize_t, image_slice_pitch);
3311 
3312     if (isCallValid)
3313     {
3314         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
3315         InitParamValue(ParamType::TvoidPointer, host_ptr, &host_ptrParam.value);
3316         CaptureCreateImage3D_host_ptr(isCallValid, context, flagsPacked, image_format, image_width,
3317                                       image_height, image_depth, image_row_pitch, image_slice_pitch,
3318                                       host_ptr, errcode_ret, &host_ptrParam);
3319         paramBuffer.addParam(std::move(host_ptrParam));
3320     }
3321     else
3322     {
3323         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
3324         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &host_ptrParam.value);
3325         paramBuffer.addParam(std::move(host_ptrParam));
3326     }
3327 
3328     if (isCallValid)
3329     {
3330         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3331         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
3332         CaptureCreateImage3D_errcode_ret(
3333             isCallValid, context, flagsPacked, image_format, image_width, image_height, image_depth,
3334             image_row_pitch, image_slice_pitch, host_ptr, errcode_ret, &errcode_retParam);
3335         paramBuffer.addParam(std::move(errcode_retParam));
3336     }
3337     else
3338     {
3339         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3340         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
3341                        &errcode_retParam.value);
3342         paramBuffer.addParam(std::move(errcode_retParam));
3343     }
3344 
3345     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
3346     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
3347     paramBuffer.addReturnValue(std::move(returnValueCapture));
3348 
3349     return CallCapture(angle::EntryPoint::CLCreateImage3D, std::move(paramBuffer));
3350 }
3351 
CaptureEnqueueMarker(bool isCallValid,cl_command_queue command_queue,cl_event * event,cl_int returnValue)3352 CallCapture CaptureEnqueueMarker(bool isCallValid,
3353                                  cl_command_queue command_queue,
3354                                  cl_event *event,
3355                                  cl_int returnValue)
3356 {
3357     ParamBuffer paramBuffer;
3358 
3359     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3360 
3361     if (isCallValid)
3362     {
3363         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3364         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
3365         CaptureEnqueueMarker_event(isCallValid, command_queue, event, &eventParam);
3366         paramBuffer.addParam(std::move(eventParam));
3367     }
3368     else
3369     {
3370         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3371         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
3372                        &eventParam.value);
3373         paramBuffer.addParam(std::move(eventParam));
3374     }
3375 
3376     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3377     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3378     paramBuffer.addReturnValue(std::move(returnValueCapture));
3379 
3380     return CallCapture(angle::EntryPoint::CLEnqueueMarker, std::move(paramBuffer));
3381 }
3382 
CaptureEnqueueWaitForEvents(bool isCallValid,cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list,cl_int returnValue)3383 CallCapture CaptureEnqueueWaitForEvents(bool isCallValid,
3384                                         cl_command_queue command_queue,
3385                                         cl_uint num_events,
3386                                         const cl_event *event_list,
3387                                         cl_int returnValue)
3388 {
3389     ParamBuffer paramBuffer;
3390 
3391     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3392     paramBuffer.addValueParam("num_events", ParamType::Tcl_uint, num_events);
3393 
3394     if (isCallValid)
3395     {
3396         ParamCapture event_listParam("event_list", ParamType::Tcl_eventConstPointer);
3397         InitParamValue(ParamType::Tcl_eventConstPointer, event_list, &event_listParam.value);
3398         CaptureEnqueueWaitForEvents_event_list(isCallValid, command_queue, num_events, event_list,
3399                                                &event_listParam);
3400         paramBuffer.addParam(std::move(event_listParam));
3401     }
3402     else
3403     {
3404         ParamCapture event_listParam("event_list", ParamType::Tcl_eventConstPointer);
3405         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
3406                        &event_listParam.value);
3407         paramBuffer.addParam(std::move(event_listParam));
3408     }
3409 
3410     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3411     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3412     paramBuffer.addReturnValue(std::move(returnValueCapture));
3413 
3414     return CallCapture(angle::EntryPoint::CLEnqueueWaitForEvents, std::move(paramBuffer));
3415 }
3416 
CaptureEnqueueBarrier(bool isCallValid,cl_command_queue command_queue,cl_int returnValue)3417 CallCapture CaptureEnqueueBarrier(bool isCallValid,
3418                                   cl_command_queue command_queue,
3419                                   cl_int returnValue)
3420 {
3421     ParamBuffer paramBuffer;
3422 
3423     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3424 
3425     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3426     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3427     paramBuffer.addReturnValue(std::move(returnValueCapture));
3428 
3429     return CallCapture(angle::EntryPoint::CLEnqueueBarrier, std::move(paramBuffer));
3430 }
3431 
CaptureUnloadCompiler(bool isCallValid,cl_int returnValue)3432 CallCapture CaptureUnloadCompiler(bool isCallValid, cl_int returnValue)
3433 {
3434     ParamBuffer paramBuffer;
3435 
3436     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3437     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3438     paramBuffer.addReturnValue(std::move(returnValueCapture));
3439 
3440     return CallCapture(angle::EntryPoint::CLUnloadCompiler, std::move(paramBuffer));
3441 }
3442 
CaptureGetExtensionFunctionAddress(bool isCallValid,const char * func_name,void * returnValue)3443 CallCapture CaptureGetExtensionFunctionAddress(bool isCallValid,
3444                                                const char *func_name,
3445                                                void *returnValue)
3446 {
3447     ParamBuffer paramBuffer;
3448 
3449     if (isCallValid)
3450     {
3451         ParamCapture func_nameParam("func_name", ParamType::TcharConstPointer);
3452         InitParamValue(ParamType::TcharConstPointer, func_name, &func_nameParam.value);
3453         CaptureGetExtensionFunctionAddress_func_name(isCallValid, func_name, &func_nameParam);
3454         paramBuffer.addParam(std::move(func_nameParam));
3455     }
3456     else
3457     {
3458         ParamCapture func_nameParam("func_name", ParamType::TcharConstPointer);
3459         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
3460                        &func_nameParam.value);
3461         paramBuffer.addParam(std::move(func_nameParam));
3462     }
3463 
3464     ParamCapture returnValueCapture("returnValue", ParamType::TvoidPointer);
3465     InitParamValue(ParamType::TvoidPointer, returnValue, &returnValueCapture.value);
3466     paramBuffer.addReturnValue(std::move(returnValueCapture));
3467 
3468     return CallCapture(angle::EntryPoint::CLGetExtensionFunctionAddress, std::move(paramBuffer));
3469 }
3470 
CaptureCreateCommandQueue(bool isCallValid,cl_context context,cl_device_id device,CommandQueueProperties propertiesPacked,cl_int * errcode_ret,cl_command_queue returnValue)3471 CallCapture CaptureCreateCommandQueue(bool isCallValid,
3472                                       cl_context context,
3473                                       cl_device_id device,
3474                                       CommandQueueProperties propertiesPacked,
3475                                       cl_int *errcode_ret,
3476                                       cl_command_queue returnValue)
3477 {
3478     ParamBuffer paramBuffer;
3479 
3480     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
3481     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
3482     paramBuffer.addValueParam("propertiesPacked", ParamType::TCommandQueueProperties,
3483                               propertiesPacked);
3484 
3485     if (isCallValid)
3486     {
3487         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3488         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
3489         CaptureCreateCommandQueue_errcode_ret(isCallValid, context, device, propertiesPacked,
3490                                               errcode_ret, &errcode_retParam);
3491         paramBuffer.addParam(std::move(errcode_retParam));
3492     }
3493     else
3494     {
3495         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3496         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
3497                        &errcode_retParam.value);
3498         paramBuffer.addParam(std::move(errcode_retParam));
3499     }
3500 
3501     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_command_queue);
3502     InitParamValue(ParamType::Tcl_command_queue, returnValue, &returnValueCapture.value);
3503     paramBuffer.addReturnValue(std::move(returnValueCapture));
3504 
3505     return CallCapture(angle::EntryPoint::CLCreateCommandQueue, std::move(paramBuffer));
3506 }
3507 
CaptureCreateSampler(bool isCallValid,cl_context context,cl_bool normalized_coords,AddressingMode addressing_modePacked,FilterMode filter_modePacked,cl_int * errcode_ret,cl_sampler returnValue)3508 CallCapture CaptureCreateSampler(bool isCallValid,
3509                                  cl_context context,
3510                                  cl_bool normalized_coords,
3511                                  AddressingMode addressing_modePacked,
3512                                  FilterMode filter_modePacked,
3513                                  cl_int *errcode_ret,
3514                                  cl_sampler returnValue)
3515 {
3516     ParamBuffer paramBuffer;
3517 
3518     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
3519     paramBuffer.addValueParam("normalized_coords", ParamType::Tcl_bool, normalized_coords);
3520     paramBuffer.addValueParam("addressing_modePacked", ParamType::TAddressingMode,
3521                               addressing_modePacked);
3522     paramBuffer.addValueParam("filter_modePacked", ParamType::TFilterMode, filter_modePacked);
3523 
3524     if (isCallValid)
3525     {
3526         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3527         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
3528         CaptureCreateSampler_errcode_ret(isCallValid, context, normalized_coords,
3529                                          addressing_modePacked, filter_modePacked, errcode_ret,
3530                                          &errcode_retParam);
3531         paramBuffer.addParam(std::move(errcode_retParam));
3532     }
3533     else
3534     {
3535         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3536         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
3537                        &errcode_retParam.value);
3538         paramBuffer.addParam(std::move(errcode_retParam));
3539     }
3540 
3541     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_sampler);
3542     InitParamValue(ParamType::Tcl_sampler, returnValue, &returnValueCapture.value);
3543     paramBuffer.addReturnValue(std::move(returnValueCapture));
3544 
3545     return CallCapture(angle::EntryPoint::CLCreateSampler, std::move(paramBuffer));
3546 }
3547 
CaptureEnqueueTask(bool isCallValid,cl_command_queue command_queue,cl_kernel kernel,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)3548 CallCapture CaptureEnqueueTask(bool isCallValid,
3549                                cl_command_queue command_queue,
3550                                cl_kernel kernel,
3551                                cl_uint num_events_in_wait_list,
3552                                const cl_event *event_wait_list,
3553                                cl_event *event,
3554                                cl_int returnValue)
3555 {
3556     ParamBuffer paramBuffer;
3557 
3558     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3559     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
3560     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
3561                               num_events_in_wait_list);
3562 
3563     if (isCallValid)
3564     {
3565         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
3566         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
3567                        &event_wait_listParam.value);
3568         CaptureEnqueueTask_event_wait_list(isCallValid, command_queue, kernel,
3569                                            num_events_in_wait_list, event_wait_list, event,
3570                                            &event_wait_listParam);
3571         paramBuffer.addParam(std::move(event_wait_listParam));
3572     }
3573     else
3574     {
3575         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
3576         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
3577                        &event_wait_listParam.value);
3578         paramBuffer.addParam(std::move(event_wait_listParam));
3579     }
3580 
3581     if (isCallValid)
3582     {
3583         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3584         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
3585         CaptureEnqueueTask_event(isCallValid, command_queue, kernel, num_events_in_wait_list,
3586                                  event_wait_list, event, &eventParam);
3587         paramBuffer.addParam(std::move(eventParam));
3588     }
3589     else
3590     {
3591         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3592         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
3593                        &eventParam.value);
3594         paramBuffer.addParam(std::move(eventParam));
3595     }
3596 
3597     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3598     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3599     paramBuffer.addReturnValue(std::move(returnValueCapture));
3600 
3601     return CallCapture(angle::EntryPoint::CLEnqueueTask, std::move(paramBuffer));
3602 }
3603 
3604 // CL 1.1
CaptureCreateSubBuffer(bool isCallValid,cl_mem buffer,MemFlags flagsPacked,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret,cl_mem returnValue)3605 CallCapture CaptureCreateSubBuffer(bool isCallValid,
3606                                    cl_mem buffer,
3607                                    MemFlags flagsPacked,
3608                                    cl_buffer_create_type buffer_create_type,
3609                                    const void *buffer_create_info,
3610                                    cl_int *errcode_ret,
3611                                    cl_mem returnValue)
3612 {
3613     ParamBuffer paramBuffer;
3614 
3615     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
3616     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
3617     paramBuffer.addValueParam("buffer_create_type", ParamType::Tcl_buffer_create_type,
3618                               buffer_create_type);
3619 
3620     if (isCallValid)
3621     {
3622         ParamCapture buffer_create_infoParam("buffer_create_info", ParamType::TvoidConstPointer);
3623         InitParamValue(ParamType::TvoidConstPointer, buffer_create_info,
3624                        &buffer_create_infoParam.value);
3625         CaptureCreateSubBuffer_buffer_create_info(isCallValid, buffer, flagsPacked,
3626                                                   buffer_create_type, buffer_create_info,
3627                                                   errcode_ret, &buffer_create_infoParam);
3628         paramBuffer.addParam(std::move(buffer_create_infoParam));
3629     }
3630     else
3631     {
3632         ParamCapture buffer_create_infoParam("buffer_create_info", ParamType::TvoidConstPointer);
3633         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
3634                        &buffer_create_infoParam.value);
3635         paramBuffer.addParam(std::move(buffer_create_infoParam));
3636     }
3637 
3638     if (isCallValid)
3639     {
3640         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3641         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
3642         CaptureCreateSubBuffer_errcode_ret(isCallValid, buffer, flagsPacked, buffer_create_type,
3643                                            buffer_create_info, errcode_ret, &errcode_retParam);
3644         paramBuffer.addParam(std::move(errcode_retParam));
3645     }
3646     else
3647     {
3648         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3649         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
3650                        &errcode_retParam.value);
3651         paramBuffer.addParam(std::move(errcode_retParam));
3652     }
3653 
3654     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
3655     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
3656     paramBuffer.addReturnValue(std::move(returnValueCapture));
3657 
3658     return CallCapture(angle::EntryPoint::CLCreateSubBuffer, std::move(paramBuffer));
3659 }
3660 
CaptureSetMemObjectDestructorCallback(bool isCallValid,cl_mem memobj,void (CL_CALLBACK * pfn_notify)(cl_mem memobj,void * user_data),void * user_data,cl_int returnValue)3661 CallCapture CaptureSetMemObjectDestructorCallback(bool isCallValid,
3662                                                   cl_mem memobj,
3663                                                   void(CL_CALLBACK *pfn_notify)(cl_mem memobj,
3664                                                                                 void *user_data),
3665                                                   void *user_data,
3666                                                   cl_int returnValue)
3667 {
3668     ParamBuffer paramBuffer;
3669 
3670     paramBuffer.addValueParam("memobj", ParamType::Tcl_mem, memobj);
3671 
3672     if (isCallValid)
3673     {
3674         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_mem_destructor_func_type);
3675         InitParamValue(ParamType::Tcl_mem_destructor_func_type, pfn_notify, &pfn_notifyParam.value);
3676         CaptureSetMemObjectDestructorCallback_pfn_notify(isCallValid, memobj, pfn_notify, user_data,
3677                                                          &pfn_notifyParam);
3678         paramBuffer.addParam(std::move(pfn_notifyParam));
3679     }
3680     else
3681     {
3682         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_mem_destructor_func_type);
3683         InitParamValue(ParamType::Tcl_mem_destructor_func_type,
3684                        static_cast<void(CL_CALLBACK *)(cl_mem memobj, void *user_data)>(nullptr),
3685                        &pfn_notifyParam.value);
3686         paramBuffer.addParam(std::move(pfn_notifyParam));
3687     }
3688 
3689     if (isCallValid)
3690     {
3691         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
3692         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
3693         CaptureSetMemObjectDestructorCallback_user_data(isCallValid, memobj, pfn_notify, user_data,
3694                                                         &user_dataParam);
3695         paramBuffer.addParam(std::move(user_dataParam));
3696     }
3697     else
3698     {
3699         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
3700         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
3701                        &user_dataParam.value);
3702         paramBuffer.addParam(std::move(user_dataParam));
3703     }
3704 
3705     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3706     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3707     paramBuffer.addReturnValue(std::move(returnValueCapture));
3708 
3709     return CallCapture(angle::EntryPoint::CLSetMemObjectDestructorCallback, std::move(paramBuffer));
3710 }
3711 
CaptureCreateUserEvent(bool isCallValid,cl_context context,cl_int * errcode_ret,cl_event returnValue)3712 CallCapture CaptureCreateUserEvent(bool isCallValid,
3713                                    cl_context context,
3714                                    cl_int *errcode_ret,
3715                                    cl_event returnValue)
3716 {
3717     ParamBuffer paramBuffer;
3718 
3719     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
3720 
3721     if (isCallValid)
3722     {
3723         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3724         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
3725         CaptureCreateUserEvent_errcode_ret(isCallValid, context, errcode_ret, &errcode_retParam);
3726         paramBuffer.addParam(std::move(errcode_retParam));
3727     }
3728     else
3729     {
3730         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
3731         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
3732                        &errcode_retParam.value);
3733         paramBuffer.addParam(std::move(errcode_retParam));
3734     }
3735 
3736     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_event);
3737     InitParamValue(ParamType::Tcl_event, returnValue, &returnValueCapture.value);
3738     paramBuffer.addReturnValue(std::move(returnValueCapture));
3739 
3740     return CallCapture(angle::EntryPoint::CLCreateUserEvent, std::move(paramBuffer));
3741 }
3742 
CaptureSetUserEventStatus(bool isCallValid,cl_event event,cl_int execution_status,cl_int returnValue)3743 CallCapture CaptureSetUserEventStatus(bool isCallValid,
3744                                       cl_event event,
3745                                       cl_int execution_status,
3746                                       cl_int returnValue)
3747 {
3748     ParamBuffer paramBuffer;
3749 
3750     paramBuffer.addValueParam("event", ParamType::Tcl_event, event);
3751     paramBuffer.addValueParam("execution_status", ParamType::Tcl_int, execution_status);
3752 
3753     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3754     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3755     paramBuffer.addReturnValue(std::move(returnValueCapture));
3756 
3757     return CallCapture(angle::EntryPoint::CLSetUserEventStatus, std::move(paramBuffer));
3758 }
3759 
CaptureSetEventCallback(bool isCallValid,cl_event event,cl_int command_exec_callback_type,void (CL_CALLBACK * pfn_notify)(cl_event event,cl_int event_command_status,void * user_data),void * user_data,cl_int returnValue)3760 CallCapture CaptureSetEventCallback(bool isCallValid,
3761                                     cl_event event,
3762                                     cl_int command_exec_callback_type,
3763                                     void(CL_CALLBACK *pfn_notify)(cl_event event,
3764                                                                   cl_int event_command_status,
3765                                                                   void *user_data),
3766                                     void *user_data,
3767                                     cl_int returnValue)
3768 {
3769     ParamBuffer paramBuffer;
3770 
3771     paramBuffer.addValueParam("event", ParamType::Tcl_event, event);
3772     paramBuffer.addValueParam("command_exec_callback_type", ParamType::Tcl_int,
3773                               command_exec_callback_type);
3774 
3775     if (isCallValid)
3776     {
3777         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_callback_func_type);
3778         InitParamValue(ParamType::Tcl_callback_func_type, pfn_notify, &pfn_notifyParam.value);
3779         CaptureSetEventCallback_pfn_notify(isCallValid, event, command_exec_callback_type,
3780                                            pfn_notify, user_data, &pfn_notifyParam);
3781         paramBuffer.addParam(std::move(pfn_notifyParam));
3782     }
3783     else
3784     {
3785         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_callback_func_type);
3786         InitParamValue(ParamType::Tcl_callback_func_type,
3787                        static_cast<void(CL_CALLBACK *)(cl_event event, cl_int event_command_status,
3788                                                        void *user_data)>(nullptr),
3789                        &pfn_notifyParam.value);
3790         paramBuffer.addParam(std::move(pfn_notifyParam));
3791     }
3792 
3793     if (isCallValid)
3794     {
3795         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
3796         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
3797         CaptureSetEventCallback_user_data(isCallValid, event, command_exec_callback_type,
3798                                           pfn_notify, user_data, &user_dataParam);
3799         paramBuffer.addParam(std::move(user_dataParam));
3800     }
3801     else
3802     {
3803         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
3804         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
3805                        &user_dataParam.value);
3806         paramBuffer.addParam(std::move(user_dataParam));
3807     }
3808 
3809     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3810     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3811     paramBuffer.addReturnValue(std::move(returnValueCapture));
3812 
3813     return CallCapture(angle::EntryPoint::CLSetEventCallback, std::move(paramBuffer));
3814 }
3815 
CaptureEnqueueReadBufferRect(bool isCallValid,cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,const size_t * buffer_origin,const size_t * host_origin,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)3816 CallCapture CaptureEnqueueReadBufferRect(bool isCallValid,
3817                                          cl_command_queue command_queue,
3818                                          cl_mem buffer,
3819                                          cl_bool blocking_read,
3820                                          const size_t *buffer_origin,
3821                                          const size_t *host_origin,
3822                                          const size_t *region,
3823                                          size_t buffer_row_pitch,
3824                                          size_t buffer_slice_pitch,
3825                                          size_t host_row_pitch,
3826                                          size_t host_slice_pitch,
3827                                          void *ptr,
3828                                          cl_uint num_events_in_wait_list,
3829                                          const cl_event *event_wait_list,
3830                                          cl_event *event,
3831                                          cl_int returnValue)
3832 {
3833     ParamBuffer paramBuffer;
3834 
3835     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3836     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
3837     paramBuffer.addValueParam("blocking_read", ParamType::Tcl_bool, blocking_read);
3838 
3839     if (isCallValid)
3840     {
3841         ParamCapture buffer_originParam("buffer_origin", ParamType::Tsize_tConstPointer);
3842         InitParamValue(ParamType::Tsize_tConstPointer, buffer_origin, &buffer_originParam.value);
3843         CaptureEnqueueReadBufferRect_buffer_origin(
3844             isCallValid, command_queue, buffer, blocking_read, buffer_origin, host_origin, region,
3845             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3846             num_events_in_wait_list, event_wait_list, event, &buffer_originParam);
3847         paramBuffer.addParam(std::move(buffer_originParam));
3848     }
3849     else
3850     {
3851         ParamCapture buffer_originParam("buffer_origin", ParamType::Tsize_tConstPointer);
3852         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
3853                        &buffer_originParam.value);
3854         paramBuffer.addParam(std::move(buffer_originParam));
3855     }
3856 
3857     if (isCallValid)
3858     {
3859         ParamCapture host_originParam("host_origin", ParamType::Tsize_tConstPointer);
3860         InitParamValue(ParamType::Tsize_tConstPointer, host_origin, &host_originParam.value);
3861         CaptureEnqueueReadBufferRect_host_origin(
3862             isCallValid, command_queue, buffer, blocking_read, buffer_origin, host_origin, region,
3863             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3864             num_events_in_wait_list, event_wait_list, event, &host_originParam);
3865         paramBuffer.addParam(std::move(host_originParam));
3866     }
3867     else
3868     {
3869         ParamCapture host_originParam("host_origin", ParamType::Tsize_tConstPointer);
3870         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
3871                        &host_originParam.value);
3872         paramBuffer.addParam(std::move(host_originParam));
3873     }
3874 
3875     if (isCallValid)
3876     {
3877         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
3878         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
3879         CaptureEnqueueReadBufferRect_region(
3880             isCallValid, command_queue, buffer, blocking_read, buffer_origin, host_origin, region,
3881             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3882             num_events_in_wait_list, event_wait_list, event, &regionParam);
3883         paramBuffer.addParam(std::move(regionParam));
3884     }
3885     else
3886     {
3887         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
3888         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
3889                        &regionParam.value);
3890         paramBuffer.addParam(std::move(regionParam));
3891     }
3892 
3893     paramBuffer.addValueParam("buffer_row_pitch", ParamType::Tsize_t, buffer_row_pitch);
3894     paramBuffer.addValueParam("buffer_slice_pitch", ParamType::Tsize_t, buffer_slice_pitch);
3895     paramBuffer.addValueParam("host_row_pitch", ParamType::Tsize_t, host_row_pitch);
3896     paramBuffer.addValueParam("host_slice_pitch", ParamType::Tsize_t, host_slice_pitch);
3897 
3898     if (isCallValid)
3899     {
3900         ParamCapture ptrParam("ptr", ParamType::TvoidPointer);
3901         InitParamValue(ParamType::TvoidPointer, ptr, &ptrParam.value);
3902         CaptureEnqueueReadBufferRect_ptr(
3903             isCallValid, command_queue, buffer, blocking_read, buffer_origin, host_origin, region,
3904             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3905             num_events_in_wait_list, event_wait_list, event, &ptrParam);
3906         paramBuffer.addParam(std::move(ptrParam));
3907     }
3908     else
3909     {
3910         ParamCapture ptrParam("ptr", ParamType::TvoidPointer);
3911         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &ptrParam.value);
3912         paramBuffer.addParam(std::move(ptrParam));
3913     }
3914 
3915     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
3916                               num_events_in_wait_list);
3917 
3918     if (isCallValid)
3919     {
3920         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
3921         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
3922                        &event_wait_listParam.value);
3923         CaptureEnqueueReadBufferRect_event_wait_list(
3924             isCallValid, command_queue, buffer, blocking_read, buffer_origin, host_origin, region,
3925             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3926             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
3927         paramBuffer.addParam(std::move(event_wait_listParam));
3928     }
3929     else
3930     {
3931         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
3932         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
3933                        &event_wait_listParam.value);
3934         paramBuffer.addParam(std::move(event_wait_listParam));
3935     }
3936 
3937     if (isCallValid)
3938     {
3939         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3940         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
3941         CaptureEnqueueReadBufferRect_event(
3942             isCallValid, command_queue, buffer, blocking_read, buffer_origin, host_origin, region,
3943             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3944             num_events_in_wait_list, event_wait_list, event, &eventParam);
3945         paramBuffer.addParam(std::move(eventParam));
3946     }
3947     else
3948     {
3949         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
3950         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
3951                        &eventParam.value);
3952         paramBuffer.addParam(std::move(eventParam));
3953     }
3954 
3955     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
3956     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
3957     paramBuffer.addReturnValue(std::move(returnValueCapture));
3958 
3959     return CallCapture(angle::EntryPoint::CLEnqueueReadBufferRect, std::move(paramBuffer));
3960 }
3961 
CaptureEnqueueWriteBufferRect(bool isCallValid,cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,const size_t * buffer_origin,const size_t * host_origin,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)3962 CallCapture CaptureEnqueueWriteBufferRect(bool isCallValid,
3963                                           cl_command_queue command_queue,
3964                                           cl_mem buffer,
3965                                           cl_bool blocking_write,
3966                                           const size_t *buffer_origin,
3967                                           const size_t *host_origin,
3968                                           const size_t *region,
3969                                           size_t buffer_row_pitch,
3970                                           size_t buffer_slice_pitch,
3971                                           size_t host_row_pitch,
3972                                           size_t host_slice_pitch,
3973                                           const void *ptr,
3974                                           cl_uint num_events_in_wait_list,
3975                                           const cl_event *event_wait_list,
3976                                           cl_event *event,
3977                                           cl_int returnValue)
3978 {
3979     ParamBuffer paramBuffer;
3980 
3981     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
3982     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
3983     paramBuffer.addValueParam("blocking_write", ParamType::Tcl_bool, blocking_write);
3984 
3985     if (isCallValid)
3986     {
3987         ParamCapture buffer_originParam("buffer_origin", ParamType::Tsize_tConstPointer);
3988         InitParamValue(ParamType::Tsize_tConstPointer, buffer_origin, &buffer_originParam.value);
3989         CaptureEnqueueWriteBufferRect_buffer_origin(
3990             isCallValid, command_queue, buffer, blocking_write, buffer_origin, host_origin, region,
3991             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
3992             num_events_in_wait_list, event_wait_list, event, &buffer_originParam);
3993         paramBuffer.addParam(std::move(buffer_originParam));
3994     }
3995     else
3996     {
3997         ParamCapture buffer_originParam("buffer_origin", ParamType::Tsize_tConstPointer);
3998         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
3999                        &buffer_originParam.value);
4000         paramBuffer.addParam(std::move(buffer_originParam));
4001     }
4002 
4003     if (isCallValid)
4004     {
4005         ParamCapture host_originParam("host_origin", ParamType::Tsize_tConstPointer);
4006         InitParamValue(ParamType::Tsize_tConstPointer, host_origin, &host_originParam.value);
4007         CaptureEnqueueWriteBufferRect_host_origin(
4008             isCallValid, command_queue, buffer, blocking_write, buffer_origin, host_origin, region,
4009             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
4010             num_events_in_wait_list, event_wait_list, event, &host_originParam);
4011         paramBuffer.addParam(std::move(host_originParam));
4012     }
4013     else
4014     {
4015         ParamCapture host_originParam("host_origin", ParamType::Tsize_tConstPointer);
4016         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4017                        &host_originParam.value);
4018         paramBuffer.addParam(std::move(host_originParam));
4019     }
4020 
4021     if (isCallValid)
4022     {
4023         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
4024         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
4025         CaptureEnqueueWriteBufferRect_region(
4026             isCallValid, command_queue, buffer, blocking_write, buffer_origin, host_origin, region,
4027             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
4028             num_events_in_wait_list, event_wait_list, event, &regionParam);
4029         paramBuffer.addParam(std::move(regionParam));
4030     }
4031     else
4032     {
4033         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
4034         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4035                        &regionParam.value);
4036         paramBuffer.addParam(std::move(regionParam));
4037     }
4038 
4039     paramBuffer.addValueParam("buffer_row_pitch", ParamType::Tsize_t, buffer_row_pitch);
4040     paramBuffer.addValueParam("buffer_slice_pitch", ParamType::Tsize_t, buffer_slice_pitch);
4041     paramBuffer.addValueParam("host_row_pitch", ParamType::Tsize_t, host_row_pitch);
4042     paramBuffer.addValueParam("host_slice_pitch", ParamType::Tsize_t, host_slice_pitch);
4043 
4044     if (isCallValid)
4045     {
4046         ParamCapture ptrParam("ptr", ParamType::TvoidConstPointer);
4047         InitParamValue(ParamType::TvoidConstPointer, ptr, &ptrParam.value);
4048         CaptureEnqueueWriteBufferRect_ptr(
4049             isCallValid, command_queue, buffer, blocking_write, buffer_origin, host_origin, region,
4050             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
4051             num_events_in_wait_list, event_wait_list, event, &ptrParam);
4052         paramBuffer.addParam(std::move(ptrParam));
4053     }
4054     else
4055     {
4056         ParamCapture ptrParam("ptr", ParamType::TvoidConstPointer);
4057         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
4058                        &ptrParam.value);
4059         paramBuffer.addParam(std::move(ptrParam));
4060     }
4061 
4062     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
4063                               num_events_in_wait_list);
4064 
4065     if (isCallValid)
4066     {
4067         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4068         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
4069                        &event_wait_listParam.value);
4070         CaptureEnqueueWriteBufferRect_event_wait_list(
4071             isCallValid, command_queue, buffer, blocking_write, buffer_origin, host_origin, region,
4072             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
4073             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
4074         paramBuffer.addParam(std::move(event_wait_listParam));
4075     }
4076     else
4077     {
4078         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4079         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
4080                        &event_wait_listParam.value);
4081         paramBuffer.addParam(std::move(event_wait_listParam));
4082     }
4083 
4084     if (isCallValid)
4085     {
4086         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
4087         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
4088         CaptureEnqueueWriteBufferRect_event(
4089             isCallValid, command_queue, buffer, blocking_write, buffer_origin, host_origin, region,
4090             buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr,
4091             num_events_in_wait_list, event_wait_list, event, &eventParam);
4092         paramBuffer.addParam(std::move(eventParam));
4093     }
4094     else
4095     {
4096         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
4097         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
4098                        &eventParam.value);
4099         paramBuffer.addParam(std::move(eventParam));
4100     }
4101 
4102     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4103     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4104     paramBuffer.addReturnValue(std::move(returnValueCapture));
4105 
4106     return CallCapture(angle::EntryPoint::CLEnqueueWriteBufferRect, std::move(paramBuffer));
4107 }
4108 
CaptureEnqueueCopyBufferRect(bool isCallValid,cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,const size_t * src_origin,const size_t * dst_origin,const size_t * region,size_t src_row_pitch,size_t src_slice_pitch,size_t dst_row_pitch,size_t dst_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)4109 CallCapture CaptureEnqueueCopyBufferRect(bool isCallValid,
4110                                          cl_command_queue command_queue,
4111                                          cl_mem src_buffer,
4112                                          cl_mem dst_buffer,
4113                                          const size_t *src_origin,
4114                                          const size_t *dst_origin,
4115                                          const size_t *region,
4116                                          size_t src_row_pitch,
4117                                          size_t src_slice_pitch,
4118                                          size_t dst_row_pitch,
4119                                          size_t dst_slice_pitch,
4120                                          cl_uint num_events_in_wait_list,
4121                                          const cl_event *event_wait_list,
4122                                          cl_event *event,
4123                                          cl_int returnValue)
4124 {
4125     ParamBuffer paramBuffer;
4126 
4127     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
4128     paramBuffer.addValueParam("src_buffer", ParamType::Tcl_mem, src_buffer);
4129     paramBuffer.addValueParam("dst_buffer", ParamType::Tcl_mem, dst_buffer);
4130 
4131     if (isCallValid)
4132     {
4133         ParamCapture src_originParam("src_origin", ParamType::Tsize_tConstPointer);
4134         InitParamValue(ParamType::Tsize_tConstPointer, src_origin, &src_originParam.value);
4135         CaptureEnqueueCopyBufferRect_src_origin(
4136             isCallValid, command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region,
4137             src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list,
4138             event_wait_list, event, &src_originParam);
4139         paramBuffer.addParam(std::move(src_originParam));
4140     }
4141     else
4142     {
4143         ParamCapture src_originParam("src_origin", ParamType::Tsize_tConstPointer);
4144         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4145                        &src_originParam.value);
4146         paramBuffer.addParam(std::move(src_originParam));
4147     }
4148 
4149     if (isCallValid)
4150     {
4151         ParamCapture dst_originParam("dst_origin", ParamType::Tsize_tConstPointer);
4152         InitParamValue(ParamType::Tsize_tConstPointer, dst_origin, &dst_originParam.value);
4153         CaptureEnqueueCopyBufferRect_dst_origin(
4154             isCallValid, command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region,
4155             src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list,
4156             event_wait_list, event, &dst_originParam);
4157         paramBuffer.addParam(std::move(dst_originParam));
4158     }
4159     else
4160     {
4161         ParamCapture dst_originParam("dst_origin", ParamType::Tsize_tConstPointer);
4162         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4163                        &dst_originParam.value);
4164         paramBuffer.addParam(std::move(dst_originParam));
4165     }
4166 
4167     if (isCallValid)
4168     {
4169         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
4170         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
4171         CaptureEnqueueCopyBufferRect_region(
4172             isCallValid, command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region,
4173             src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list,
4174             event_wait_list, event, &regionParam);
4175         paramBuffer.addParam(std::move(regionParam));
4176     }
4177     else
4178     {
4179         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
4180         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4181                        &regionParam.value);
4182         paramBuffer.addParam(std::move(regionParam));
4183     }
4184 
4185     paramBuffer.addValueParam("src_row_pitch", ParamType::Tsize_t, src_row_pitch);
4186     paramBuffer.addValueParam("src_slice_pitch", ParamType::Tsize_t, src_slice_pitch);
4187     paramBuffer.addValueParam("dst_row_pitch", ParamType::Tsize_t, dst_row_pitch);
4188     paramBuffer.addValueParam("dst_slice_pitch", ParamType::Tsize_t, dst_slice_pitch);
4189     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
4190                               num_events_in_wait_list);
4191 
4192     if (isCallValid)
4193     {
4194         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4195         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
4196                        &event_wait_listParam.value);
4197         CaptureEnqueueCopyBufferRect_event_wait_list(
4198             isCallValid, command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region,
4199             src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list,
4200             event_wait_list, event, &event_wait_listParam);
4201         paramBuffer.addParam(std::move(event_wait_listParam));
4202     }
4203     else
4204     {
4205         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4206         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
4207                        &event_wait_listParam.value);
4208         paramBuffer.addParam(std::move(event_wait_listParam));
4209     }
4210 
4211     if (isCallValid)
4212     {
4213         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
4214         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
4215         CaptureEnqueueCopyBufferRect_event(
4216             isCallValid, command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region,
4217             src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list,
4218             event_wait_list, event, &eventParam);
4219         paramBuffer.addParam(std::move(eventParam));
4220     }
4221     else
4222     {
4223         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
4224         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
4225                        &eventParam.value);
4226         paramBuffer.addParam(std::move(eventParam));
4227     }
4228 
4229     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4230     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4231     paramBuffer.addReturnValue(std::move(returnValueCapture));
4232 
4233     return CallCapture(angle::EntryPoint::CLEnqueueCopyBufferRect, std::move(paramBuffer));
4234 }
4235 
4236 // CL 1.2
CaptureCreateSubDevices(bool isCallValid,cl_device_id in_device,const cl_device_partition_property * properties,cl_uint num_devices,cl_device_id * out_devices,cl_uint * num_devices_ret,cl_int returnValue)4237 CallCapture CaptureCreateSubDevices(bool isCallValid,
4238                                     cl_device_id in_device,
4239                                     const cl_device_partition_property *properties,
4240                                     cl_uint num_devices,
4241                                     cl_device_id *out_devices,
4242                                     cl_uint *num_devices_ret,
4243                                     cl_int returnValue)
4244 {
4245     ParamBuffer paramBuffer;
4246 
4247     paramBuffer.addValueParam("in_device", ParamType::Tcl_device_id, in_device);
4248 
4249     if (isCallValid)
4250     {
4251         ParamCapture propertiesParam("properties",
4252                                      ParamType::Tcl_device_partition_propertyConstPointer);
4253         InitParamValue(ParamType::Tcl_device_partition_propertyConstPointer, properties,
4254                        &propertiesParam.value);
4255         CaptureCreateSubDevices_properties(isCallValid, in_device, properties, num_devices,
4256                                            out_devices, num_devices_ret, &propertiesParam);
4257         paramBuffer.addParam(std::move(propertiesParam));
4258     }
4259     else
4260     {
4261         ParamCapture propertiesParam("properties",
4262                                      ParamType::Tcl_device_partition_propertyConstPointer);
4263         InitParamValue(ParamType::Tcl_device_partition_propertyConstPointer,
4264                        static_cast<const cl_device_partition_property *>(nullptr),
4265                        &propertiesParam.value);
4266         paramBuffer.addParam(std::move(propertiesParam));
4267     }
4268 
4269     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
4270 
4271     if (isCallValid)
4272     {
4273         ParamCapture out_devicesParam("out_devices", ParamType::Tcl_device_idPointer);
4274         InitParamValue(ParamType::Tcl_device_idPointer, out_devices, &out_devicesParam.value);
4275         CaptureCreateSubDevices_out_devices(isCallValid, in_device, properties, num_devices,
4276                                             out_devices, num_devices_ret, &out_devicesParam);
4277         paramBuffer.addParam(std::move(out_devicesParam));
4278     }
4279     else
4280     {
4281         ParamCapture out_devicesParam("out_devices", ParamType::Tcl_device_idPointer);
4282         InitParamValue(ParamType::Tcl_device_idPointer, static_cast<cl_device_id *>(nullptr),
4283                        &out_devicesParam.value);
4284         paramBuffer.addParam(std::move(out_devicesParam));
4285     }
4286 
4287     if (isCallValid)
4288     {
4289         ParamCapture num_devices_retParam("num_devices_ret", ParamType::Tcl_uintPointer);
4290         InitParamValue(ParamType::Tcl_uintPointer, num_devices_ret, &num_devices_retParam.value);
4291         CaptureCreateSubDevices_num_devices_ret(isCallValid, in_device, properties, num_devices,
4292                                                 out_devices, num_devices_ret,
4293                                                 &num_devices_retParam);
4294         paramBuffer.addParam(std::move(num_devices_retParam));
4295     }
4296     else
4297     {
4298         ParamCapture num_devices_retParam("num_devices_ret", ParamType::Tcl_uintPointer);
4299         InitParamValue(ParamType::Tcl_uintPointer, static_cast<cl_uint *>(nullptr),
4300                        &num_devices_retParam.value);
4301         paramBuffer.addParam(std::move(num_devices_retParam));
4302     }
4303 
4304     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4305     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4306     paramBuffer.addReturnValue(std::move(returnValueCapture));
4307 
4308     return CallCapture(angle::EntryPoint::CLCreateSubDevices, std::move(paramBuffer));
4309 }
4310 
CaptureRetainDevice(bool isCallValid,cl_device_id device,cl_int returnValue)4311 CallCapture CaptureRetainDevice(bool isCallValid, cl_device_id device, cl_int returnValue)
4312 {
4313     ParamBuffer paramBuffer;
4314 
4315     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
4316 
4317     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4318     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4319     paramBuffer.addReturnValue(std::move(returnValueCapture));
4320 
4321     return CallCapture(angle::EntryPoint::CLRetainDevice, std::move(paramBuffer));
4322 }
4323 
CaptureReleaseDevice(bool isCallValid,cl_device_id device,cl_int returnValue)4324 CallCapture CaptureReleaseDevice(bool isCallValid, cl_device_id device, cl_int returnValue)
4325 {
4326     ParamBuffer paramBuffer;
4327 
4328     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
4329 
4330     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4331     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4332     paramBuffer.addReturnValue(std::move(returnValueCapture));
4333 
4334     return CallCapture(angle::EntryPoint::CLReleaseDevice, std::move(paramBuffer));
4335 }
4336 
CaptureCreateImage(bool isCallValid,cl_context context,MemFlags flagsPacked,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret,cl_mem returnValue)4337 CallCapture CaptureCreateImage(bool isCallValid,
4338                                cl_context context,
4339                                MemFlags flagsPacked,
4340                                const cl_image_format *image_format,
4341                                const cl_image_desc *image_desc,
4342                                void *host_ptr,
4343                                cl_int *errcode_ret,
4344                                cl_mem returnValue)
4345 {
4346     ParamBuffer paramBuffer;
4347 
4348     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
4349     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
4350 
4351     if (isCallValid)
4352     {
4353         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
4354         InitParamValue(ParamType::Tcl_image_formatConstPointer, image_format,
4355                        &image_formatParam.value);
4356         CaptureCreateImage_image_format(isCallValid, context, flagsPacked, image_format, image_desc,
4357                                         host_ptr, errcode_ret, &image_formatParam);
4358         paramBuffer.addParam(std::move(image_formatParam));
4359     }
4360     else
4361     {
4362         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
4363         InitParamValue(ParamType::Tcl_image_formatConstPointer,
4364                        static_cast<const cl_image_format *>(nullptr), &image_formatParam.value);
4365         paramBuffer.addParam(std::move(image_formatParam));
4366     }
4367 
4368     if (isCallValid)
4369     {
4370         ParamCapture image_descParam("image_desc", ParamType::Tcl_image_descConstPointer);
4371         InitParamValue(ParamType::Tcl_image_descConstPointer, image_desc, &image_descParam.value);
4372         CaptureCreateImage_image_desc(isCallValid, context, flagsPacked, image_format, image_desc,
4373                                       host_ptr, errcode_ret, &image_descParam);
4374         paramBuffer.addParam(std::move(image_descParam));
4375     }
4376     else
4377     {
4378         ParamCapture image_descParam("image_desc", ParamType::Tcl_image_descConstPointer);
4379         InitParamValue(ParamType::Tcl_image_descConstPointer,
4380                        static_cast<const cl_image_desc *>(nullptr), &image_descParam.value);
4381         paramBuffer.addParam(std::move(image_descParam));
4382     }
4383 
4384     if (isCallValid)
4385     {
4386         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
4387         InitParamValue(ParamType::TvoidPointer, host_ptr, &host_ptrParam.value);
4388         CaptureCreateImage_host_ptr(isCallValid, context, flagsPacked, image_format, image_desc,
4389                                     host_ptr, errcode_ret, &host_ptrParam);
4390         paramBuffer.addParam(std::move(host_ptrParam));
4391     }
4392     else
4393     {
4394         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
4395         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &host_ptrParam.value);
4396         paramBuffer.addParam(std::move(host_ptrParam));
4397     }
4398 
4399     if (isCallValid)
4400     {
4401         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
4402         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
4403         CaptureCreateImage_errcode_ret(isCallValid, context, flagsPacked, image_format, image_desc,
4404                                        host_ptr, errcode_ret, &errcode_retParam);
4405         paramBuffer.addParam(std::move(errcode_retParam));
4406     }
4407     else
4408     {
4409         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
4410         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
4411                        &errcode_retParam.value);
4412         paramBuffer.addParam(std::move(errcode_retParam));
4413     }
4414 
4415     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
4416     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
4417     paramBuffer.addReturnValue(std::move(returnValueCapture));
4418 
4419     return CallCapture(angle::EntryPoint::CLCreateImage, std::move(paramBuffer));
4420 }
4421 
CaptureCreateProgramWithBuiltInKernels(bool isCallValid,cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret,cl_program returnValue)4422 CallCapture CaptureCreateProgramWithBuiltInKernels(bool isCallValid,
4423                                                    cl_context context,
4424                                                    cl_uint num_devices,
4425                                                    const cl_device_id *device_list,
4426                                                    const char *kernel_names,
4427                                                    cl_int *errcode_ret,
4428                                                    cl_program returnValue)
4429 {
4430     ParamBuffer paramBuffer;
4431 
4432     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
4433     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
4434 
4435     if (isCallValid)
4436     {
4437         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
4438         InitParamValue(ParamType::Tcl_device_idConstPointer, device_list, &device_listParam.value);
4439         CaptureCreateProgramWithBuiltInKernels_device_list(isCallValid, context, num_devices,
4440                                                            device_list, kernel_names, errcode_ret,
4441                                                            &device_listParam);
4442         paramBuffer.addParam(std::move(device_listParam));
4443     }
4444     else
4445     {
4446         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
4447         InitParamValue(ParamType::Tcl_device_idConstPointer,
4448                        static_cast<const cl_device_id *>(nullptr), &device_listParam.value);
4449         paramBuffer.addParam(std::move(device_listParam));
4450     }
4451 
4452     if (isCallValid)
4453     {
4454         ParamCapture kernel_namesParam("kernel_names", ParamType::TcharConstPointer);
4455         InitParamValue(ParamType::TcharConstPointer, kernel_names, &kernel_namesParam.value);
4456         CaptureCreateProgramWithBuiltInKernels_kernel_names(isCallValid, context, num_devices,
4457                                                             device_list, kernel_names, errcode_ret,
4458                                                             &kernel_namesParam);
4459         paramBuffer.addParam(std::move(kernel_namesParam));
4460     }
4461     else
4462     {
4463         ParamCapture kernel_namesParam("kernel_names", ParamType::TcharConstPointer);
4464         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
4465                        &kernel_namesParam.value);
4466         paramBuffer.addParam(std::move(kernel_namesParam));
4467     }
4468 
4469     if (isCallValid)
4470     {
4471         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
4472         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
4473         CaptureCreateProgramWithBuiltInKernels_errcode_ret(isCallValid, context, num_devices,
4474                                                            device_list, kernel_names, errcode_ret,
4475                                                            &errcode_retParam);
4476         paramBuffer.addParam(std::move(errcode_retParam));
4477     }
4478     else
4479     {
4480         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
4481         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
4482                        &errcode_retParam.value);
4483         paramBuffer.addParam(std::move(errcode_retParam));
4484     }
4485 
4486     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_program);
4487     InitParamValue(ParamType::Tcl_program, returnValue, &returnValueCapture.value);
4488     paramBuffer.addReturnValue(std::move(returnValueCapture));
4489 
4490     return CallCapture(angle::EntryPoint::CLCreateProgramWithBuiltInKernels,
4491                        std::move(paramBuffer));
4492 }
4493 
CaptureCompileProgram(bool isCallValid,cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_headers,const cl_program * input_headers,const char ** header_include_names,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,cl_int returnValue)4494 CallCapture CaptureCompileProgram(bool isCallValid,
4495                                   cl_program program,
4496                                   cl_uint num_devices,
4497                                   const cl_device_id *device_list,
4498                                   const char *options,
4499                                   cl_uint num_input_headers,
4500                                   const cl_program *input_headers,
4501                                   const char **header_include_names,
4502                                   void(CL_CALLBACK *pfn_notify)(cl_program program,
4503                                                                 void *user_data),
4504                                   void *user_data,
4505                                   cl_int returnValue)
4506 {
4507     ParamBuffer paramBuffer;
4508 
4509     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
4510     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
4511 
4512     if (isCallValid)
4513     {
4514         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
4515         InitParamValue(ParamType::Tcl_device_idConstPointer, device_list, &device_listParam.value);
4516         CaptureCompileProgram_device_list(isCallValid, program, num_devices, device_list, options,
4517                                           num_input_headers, input_headers, header_include_names,
4518                                           pfn_notify, user_data, &device_listParam);
4519         paramBuffer.addParam(std::move(device_listParam));
4520     }
4521     else
4522     {
4523         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
4524         InitParamValue(ParamType::Tcl_device_idConstPointer,
4525                        static_cast<const cl_device_id *>(nullptr), &device_listParam.value);
4526         paramBuffer.addParam(std::move(device_listParam));
4527     }
4528 
4529     if (isCallValid)
4530     {
4531         ParamCapture optionsParam("options", ParamType::TcharConstPointer);
4532         InitParamValue(ParamType::TcharConstPointer, options, &optionsParam.value);
4533         CaptureCompileProgram_options(isCallValid, program, num_devices, device_list, options,
4534                                       num_input_headers, input_headers, header_include_names,
4535                                       pfn_notify, user_data, &optionsParam);
4536         paramBuffer.addParam(std::move(optionsParam));
4537     }
4538     else
4539     {
4540         ParamCapture optionsParam("options", ParamType::TcharConstPointer);
4541         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
4542                        &optionsParam.value);
4543         paramBuffer.addParam(std::move(optionsParam));
4544     }
4545 
4546     paramBuffer.addValueParam("num_input_headers", ParamType::Tcl_uint, num_input_headers);
4547 
4548     if (isCallValid)
4549     {
4550         ParamCapture input_headersParam("input_headers", ParamType::Tcl_programConstPointer);
4551         InitParamValue(ParamType::Tcl_programConstPointer, input_headers,
4552                        &input_headersParam.value);
4553         CaptureCompileProgram_input_headers(isCallValid, program, num_devices, device_list, options,
4554                                             num_input_headers, input_headers, header_include_names,
4555                                             pfn_notify, user_data, &input_headersParam);
4556         paramBuffer.addParam(std::move(input_headersParam));
4557     }
4558     else
4559     {
4560         ParamCapture input_headersParam("input_headers", ParamType::Tcl_programConstPointer);
4561         InitParamValue(ParamType::Tcl_programConstPointer, static_cast<const cl_program *>(nullptr),
4562                        &input_headersParam.value);
4563         paramBuffer.addParam(std::move(input_headersParam));
4564     }
4565 
4566     if (isCallValid)
4567     {
4568         ParamCapture header_include_namesParam("header_include_names",
4569                                                ParamType::TcharConstPointerPointer);
4570         InitParamValue(ParamType::TcharConstPointerPointer, header_include_names,
4571                        &header_include_namesParam.value);
4572         CaptureCompileProgram_header_include_names(
4573             isCallValid, program, num_devices, device_list, options, num_input_headers,
4574             input_headers, header_include_names, pfn_notify, user_data, &header_include_namesParam);
4575         paramBuffer.addParam(std::move(header_include_namesParam));
4576     }
4577     else
4578     {
4579         ParamCapture header_include_namesParam("header_include_names",
4580                                                ParamType::TcharConstPointerPointer);
4581         InitParamValue(ParamType::TcharConstPointerPointer, static_cast<const char **>(nullptr),
4582                        &header_include_namesParam.value);
4583         paramBuffer.addParam(std::move(header_include_namesParam));
4584     }
4585 
4586     if (isCallValid)
4587     {
4588         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
4589         InitParamValue(ParamType::Tcl_program_func_type, pfn_notify, &pfn_notifyParam.value);
4590         CaptureCompileProgram_pfn_notify(isCallValid, program, num_devices, device_list, options,
4591                                          num_input_headers, input_headers, header_include_names,
4592                                          pfn_notify, user_data, &pfn_notifyParam);
4593         paramBuffer.addParam(std::move(pfn_notifyParam));
4594     }
4595     else
4596     {
4597         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
4598         InitParamValue(
4599             ParamType::Tcl_program_func_type,
4600             static_cast<void(CL_CALLBACK *)(cl_program program, void *user_data)>(nullptr),
4601             &pfn_notifyParam.value);
4602         paramBuffer.addParam(std::move(pfn_notifyParam));
4603     }
4604 
4605     if (isCallValid)
4606     {
4607         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
4608         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
4609         CaptureCompileProgram_user_data(isCallValid, program, num_devices, device_list, options,
4610                                         num_input_headers, input_headers, header_include_names,
4611                                         pfn_notify, user_data, &user_dataParam);
4612         paramBuffer.addParam(std::move(user_dataParam));
4613     }
4614     else
4615     {
4616         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
4617         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
4618                        &user_dataParam.value);
4619         paramBuffer.addParam(std::move(user_dataParam));
4620     }
4621 
4622     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4623     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4624     paramBuffer.addReturnValue(std::move(returnValueCapture));
4625 
4626     return CallCapture(angle::EntryPoint::CLCompileProgram, std::move(paramBuffer));
4627 }
4628 
CaptureLinkProgram(bool isCallValid,cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_programs,const cl_program * input_programs,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,cl_int * errcode_ret,cl_program returnValue)4629 CallCapture CaptureLinkProgram(bool isCallValid,
4630                                cl_context context,
4631                                cl_uint num_devices,
4632                                const cl_device_id *device_list,
4633                                const char *options,
4634                                cl_uint num_input_programs,
4635                                const cl_program *input_programs,
4636                                void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
4637                                void *user_data,
4638                                cl_int *errcode_ret,
4639                                cl_program returnValue)
4640 {
4641     ParamBuffer paramBuffer;
4642 
4643     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
4644     paramBuffer.addValueParam("num_devices", ParamType::Tcl_uint, num_devices);
4645 
4646     if (isCallValid)
4647     {
4648         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
4649         InitParamValue(ParamType::Tcl_device_idConstPointer, device_list, &device_listParam.value);
4650         CaptureLinkProgram_device_list(isCallValid, context, num_devices, device_list, options,
4651                                        num_input_programs, input_programs, pfn_notify, user_data,
4652                                        errcode_ret, &device_listParam);
4653         paramBuffer.addParam(std::move(device_listParam));
4654     }
4655     else
4656     {
4657         ParamCapture device_listParam("device_list", ParamType::Tcl_device_idConstPointer);
4658         InitParamValue(ParamType::Tcl_device_idConstPointer,
4659                        static_cast<const cl_device_id *>(nullptr), &device_listParam.value);
4660         paramBuffer.addParam(std::move(device_listParam));
4661     }
4662 
4663     if (isCallValid)
4664     {
4665         ParamCapture optionsParam("options", ParamType::TcharConstPointer);
4666         InitParamValue(ParamType::TcharConstPointer, options, &optionsParam.value);
4667         CaptureLinkProgram_options(isCallValid, context, num_devices, device_list, options,
4668                                    num_input_programs, input_programs, pfn_notify, user_data,
4669                                    errcode_ret, &optionsParam);
4670         paramBuffer.addParam(std::move(optionsParam));
4671     }
4672     else
4673     {
4674         ParamCapture optionsParam("options", ParamType::TcharConstPointer);
4675         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
4676                        &optionsParam.value);
4677         paramBuffer.addParam(std::move(optionsParam));
4678     }
4679 
4680     paramBuffer.addValueParam("num_input_programs", ParamType::Tcl_uint, num_input_programs);
4681 
4682     if (isCallValid)
4683     {
4684         ParamCapture input_programsParam("input_programs", ParamType::Tcl_programConstPointer);
4685         InitParamValue(ParamType::Tcl_programConstPointer, input_programs,
4686                        &input_programsParam.value);
4687         CaptureLinkProgram_input_programs(isCallValid, context, num_devices, device_list, options,
4688                                           num_input_programs, input_programs, pfn_notify, user_data,
4689                                           errcode_ret, &input_programsParam);
4690         paramBuffer.addParam(std::move(input_programsParam));
4691     }
4692     else
4693     {
4694         ParamCapture input_programsParam("input_programs", ParamType::Tcl_programConstPointer);
4695         InitParamValue(ParamType::Tcl_programConstPointer, static_cast<const cl_program *>(nullptr),
4696                        &input_programsParam.value);
4697         paramBuffer.addParam(std::move(input_programsParam));
4698     }
4699 
4700     if (isCallValid)
4701     {
4702         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
4703         InitParamValue(ParamType::Tcl_program_func_type, pfn_notify, &pfn_notifyParam.value);
4704         CaptureLinkProgram_pfn_notify(isCallValid, context, num_devices, device_list, options,
4705                                       num_input_programs, input_programs, pfn_notify, user_data,
4706                                       errcode_ret, &pfn_notifyParam);
4707         paramBuffer.addParam(std::move(pfn_notifyParam));
4708     }
4709     else
4710     {
4711         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
4712         InitParamValue(
4713             ParamType::Tcl_program_func_type,
4714             static_cast<void(CL_CALLBACK *)(cl_program program, void *user_data)>(nullptr),
4715             &pfn_notifyParam.value);
4716         paramBuffer.addParam(std::move(pfn_notifyParam));
4717     }
4718 
4719     if (isCallValid)
4720     {
4721         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
4722         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
4723         CaptureLinkProgram_user_data(isCallValid, context, num_devices, device_list, options,
4724                                      num_input_programs, input_programs, pfn_notify, user_data,
4725                                      errcode_ret, &user_dataParam);
4726         paramBuffer.addParam(std::move(user_dataParam));
4727     }
4728     else
4729     {
4730         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
4731         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
4732                        &user_dataParam.value);
4733         paramBuffer.addParam(std::move(user_dataParam));
4734     }
4735 
4736     if (isCallValid)
4737     {
4738         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
4739         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
4740         CaptureLinkProgram_errcode_ret(isCallValid, context, num_devices, device_list, options,
4741                                        num_input_programs, input_programs, pfn_notify, user_data,
4742                                        errcode_ret, &errcode_retParam);
4743         paramBuffer.addParam(std::move(errcode_retParam));
4744     }
4745     else
4746     {
4747         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
4748         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
4749                        &errcode_retParam.value);
4750         paramBuffer.addParam(std::move(errcode_retParam));
4751     }
4752 
4753     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_program);
4754     InitParamValue(ParamType::Tcl_program, returnValue, &returnValueCapture.value);
4755     paramBuffer.addReturnValue(std::move(returnValueCapture));
4756 
4757     return CallCapture(angle::EntryPoint::CLLinkProgram, std::move(paramBuffer));
4758 }
4759 
CaptureUnloadPlatformCompiler(bool isCallValid,cl_platform_id platform,cl_int returnValue)4760 CallCapture CaptureUnloadPlatformCompiler(bool isCallValid,
4761                                           cl_platform_id platform,
4762                                           cl_int returnValue)
4763 {
4764     ParamBuffer paramBuffer;
4765 
4766     paramBuffer.addValueParam("platform", ParamType::Tcl_platform_id, platform);
4767 
4768     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4769     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4770     paramBuffer.addReturnValue(std::move(returnValueCapture));
4771 
4772     return CallCapture(angle::EntryPoint::CLUnloadPlatformCompiler, std::move(paramBuffer));
4773 }
4774 
CaptureGetKernelArgInfo(bool isCallValid,cl_kernel kernel,cl_uint arg_index,KernelArgInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)4775 CallCapture CaptureGetKernelArgInfo(bool isCallValid,
4776                                     cl_kernel kernel,
4777                                     cl_uint arg_index,
4778                                     KernelArgInfo param_namePacked,
4779                                     size_t param_value_size,
4780                                     void *param_value,
4781                                     size_t *param_value_size_ret,
4782                                     cl_int returnValue)
4783 {
4784     ParamBuffer paramBuffer;
4785 
4786     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
4787     paramBuffer.addValueParam("arg_index", ParamType::Tcl_uint, arg_index);
4788     paramBuffer.addValueParam("param_namePacked", ParamType::TKernelArgInfo, param_namePacked);
4789     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
4790 
4791     if (isCallValid)
4792     {
4793         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
4794         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
4795         CaptureGetKernelArgInfo_param_value(isCallValid, kernel, arg_index, param_namePacked,
4796                                             param_value_size, param_value, param_value_size_ret,
4797                                             &param_valueParam);
4798         paramBuffer.addParam(std::move(param_valueParam));
4799     }
4800     else
4801     {
4802         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
4803         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
4804                        &param_valueParam.value);
4805         paramBuffer.addParam(std::move(param_valueParam));
4806     }
4807 
4808     if (isCallValid)
4809     {
4810         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
4811         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
4812                        &param_value_size_retParam.value);
4813         CaptureGetKernelArgInfo_param_value_size_ret(
4814             isCallValid, kernel, arg_index, param_namePacked, param_value_size, param_value,
4815             param_value_size_ret, &param_value_size_retParam);
4816         paramBuffer.addParam(std::move(param_value_size_retParam));
4817     }
4818     else
4819     {
4820         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
4821         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
4822                        &param_value_size_retParam.value);
4823         paramBuffer.addParam(std::move(param_value_size_retParam));
4824     }
4825 
4826     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4827     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4828     paramBuffer.addReturnValue(std::move(returnValueCapture));
4829 
4830     return CallCapture(angle::EntryPoint::CLGetKernelArgInfo, std::move(paramBuffer));
4831 }
4832 
CaptureEnqueueFillBuffer(bool isCallValid,cl_command_queue command_queue,cl_mem buffer,const void * pattern,size_t pattern_size,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)4833 CallCapture CaptureEnqueueFillBuffer(bool isCallValid,
4834                                      cl_command_queue command_queue,
4835                                      cl_mem buffer,
4836                                      const void *pattern,
4837                                      size_t pattern_size,
4838                                      size_t offset,
4839                                      size_t size,
4840                                      cl_uint num_events_in_wait_list,
4841                                      const cl_event *event_wait_list,
4842                                      cl_event *event,
4843                                      cl_int returnValue)
4844 {
4845     ParamBuffer paramBuffer;
4846 
4847     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
4848     paramBuffer.addValueParam("buffer", ParamType::Tcl_mem, buffer);
4849 
4850     if (isCallValid)
4851     {
4852         ParamCapture patternParam("pattern", ParamType::TvoidConstPointer);
4853         InitParamValue(ParamType::TvoidConstPointer, pattern, &patternParam.value);
4854         CaptureEnqueueFillBuffer_pattern(isCallValid, command_queue, buffer, pattern, pattern_size,
4855                                          offset, size, num_events_in_wait_list, event_wait_list,
4856                                          event, &patternParam);
4857         paramBuffer.addParam(std::move(patternParam));
4858     }
4859     else
4860     {
4861         ParamCapture patternParam("pattern", ParamType::TvoidConstPointer);
4862         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
4863                        &patternParam.value);
4864         paramBuffer.addParam(std::move(patternParam));
4865     }
4866 
4867     paramBuffer.addValueParam("pattern_size", ParamType::Tsize_t, pattern_size);
4868     paramBuffer.addValueParam("offset", ParamType::Tsize_t, offset);
4869     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
4870     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
4871                               num_events_in_wait_list);
4872 
4873     if (isCallValid)
4874     {
4875         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4876         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
4877                        &event_wait_listParam.value);
4878         CaptureEnqueueFillBuffer_event_wait_list(
4879             isCallValid, command_queue, buffer, pattern, pattern_size, offset, size,
4880             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
4881         paramBuffer.addParam(std::move(event_wait_listParam));
4882     }
4883     else
4884     {
4885         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4886         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
4887                        &event_wait_listParam.value);
4888         paramBuffer.addParam(std::move(event_wait_listParam));
4889     }
4890 
4891     if (isCallValid)
4892     {
4893         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
4894         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
4895         CaptureEnqueueFillBuffer_event(isCallValid, command_queue, buffer, pattern, pattern_size,
4896                                        offset, size, num_events_in_wait_list, event_wait_list,
4897                                        event, &eventParam);
4898         paramBuffer.addParam(std::move(eventParam));
4899     }
4900     else
4901     {
4902         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
4903         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
4904                        &eventParam.value);
4905         paramBuffer.addParam(std::move(eventParam));
4906     }
4907 
4908     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
4909     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
4910     paramBuffer.addReturnValue(std::move(returnValueCapture));
4911 
4912     return CallCapture(angle::EntryPoint::CLEnqueueFillBuffer, std::move(paramBuffer));
4913 }
4914 
CaptureEnqueueFillImage(bool isCallValid,cl_command_queue command_queue,cl_mem image,const void * fill_color,const size_t * origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)4915 CallCapture CaptureEnqueueFillImage(bool isCallValid,
4916                                     cl_command_queue command_queue,
4917                                     cl_mem image,
4918                                     const void *fill_color,
4919                                     const size_t *origin,
4920                                     const size_t *region,
4921                                     cl_uint num_events_in_wait_list,
4922                                     const cl_event *event_wait_list,
4923                                     cl_event *event,
4924                                     cl_int returnValue)
4925 {
4926     ParamBuffer paramBuffer;
4927 
4928     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
4929     paramBuffer.addValueParam("image", ParamType::Tcl_mem, image);
4930 
4931     if (isCallValid)
4932     {
4933         ParamCapture fill_colorParam("fill_color", ParamType::TvoidConstPointer);
4934         InitParamValue(ParamType::TvoidConstPointer, fill_color, &fill_colorParam.value);
4935         CaptureEnqueueFillImage_fill_color(isCallValid, command_queue, image, fill_color, origin,
4936                                            region, num_events_in_wait_list, event_wait_list, event,
4937                                            &fill_colorParam);
4938         paramBuffer.addParam(std::move(fill_colorParam));
4939     }
4940     else
4941     {
4942         ParamCapture fill_colorParam("fill_color", ParamType::TvoidConstPointer);
4943         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
4944                        &fill_colorParam.value);
4945         paramBuffer.addParam(std::move(fill_colorParam));
4946     }
4947 
4948     if (isCallValid)
4949     {
4950         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
4951         InitParamValue(ParamType::Tsize_tConstPointer, origin, &originParam.value);
4952         CaptureEnqueueFillImage_origin(isCallValid, command_queue, image, fill_color, origin,
4953                                        region, num_events_in_wait_list, event_wait_list, event,
4954                                        &originParam);
4955         paramBuffer.addParam(std::move(originParam));
4956     }
4957     else
4958     {
4959         ParamCapture originParam("origin", ParamType::Tsize_tConstPointer);
4960         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4961                        &originParam.value);
4962         paramBuffer.addParam(std::move(originParam));
4963     }
4964 
4965     if (isCallValid)
4966     {
4967         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
4968         InitParamValue(ParamType::Tsize_tConstPointer, region, &regionParam.value);
4969         CaptureEnqueueFillImage_region(isCallValid, command_queue, image, fill_color, origin,
4970                                        region, num_events_in_wait_list, event_wait_list, event,
4971                                        &regionParam);
4972         paramBuffer.addParam(std::move(regionParam));
4973     }
4974     else
4975     {
4976         ParamCapture regionParam("region", ParamType::Tsize_tConstPointer);
4977         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
4978                        &regionParam.value);
4979         paramBuffer.addParam(std::move(regionParam));
4980     }
4981 
4982     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
4983                               num_events_in_wait_list);
4984 
4985     if (isCallValid)
4986     {
4987         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4988         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
4989                        &event_wait_listParam.value);
4990         CaptureEnqueueFillImage_event_wait_list(isCallValid, command_queue, image, fill_color,
4991                                                 origin, region, num_events_in_wait_list,
4992                                                 event_wait_list, event, &event_wait_listParam);
4993         paramBuffer.addParam(std::move(event_wait_listParam));
4994     }
4995     else
4996     {
4997         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
4998         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
4999                        &event_wait_listParam.value);
5000         paramBuffer.addParam(std::move(event_wait_listParam));
5001     }
5002 
5003     if (isCallValid)
5004     {
5005         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5006         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5007         CaptureEnqueueFillImage_event(isCallValid, command_queue, image, fill_color, origin, region,
5008                                       num_events_in_wait_list, event_wait_list, event, &eventParam);
5009         paramBuffer.addParam(std::move(eventParam));
5010     }
5011     else
5012     {
5013         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5014         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5015                        &eventParam.value);
5016         paramBuffer.addParam(std::move(eventParam));
5017     }
5018 
5019     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5020     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5021     paramBuffer.addReturnValue(std::move(returnValueCapture));
5022 
5023     return CallCapture(angle::EntryPoint::CLEnqueueFillImage, std::move(paramBuffer));
5024 }
5025 
CaptureEnqueueMigrateMemObjects(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,MemMigrationFlags flagsPacked,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5026 CallCapture CaptureEnqueueMigrateMemObjects(bool isCallValid,
5027                                             cl_command_queue command_queue,
5028                                             cl_uint num_mem_objects,
5029                                             const cl_mem *mem_objects,
5030                                             MemMigrationFlags flagsPacked,
5031                                             cl_uint num_events_in_wait_list,
5032                                             const cl_event *event_wait_list,
5033                                             cl_event *event,
5034                                             cl_int returnValue)
5035 {
5036     ParamBuffer paramBuffer;
5037 
5038     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5039     paramBuffer.addValueParam("num_mem_objects", ParamType::Tcl_uint, num_mem_objects);
5040 
5041     if (isCallValid)
5042     {
5043         ParamCapture mem_objectsParam("mem_objects", ParamType::Tcl_memConstPointer);
5044         InitParamValue(ParamType::Tcl_memConstPointer, mem_objects, &mem_objectsParam.value);
5045         CaptureEnqueueMigrateMemObjects_mem_objects(
5046             isCallValid, command_queue, num_mem_objects, mem_objects, flagsPacked,
5047             num_events_in_wait_list, event_wait_list, event, &mem_objectsParam);
5048         paramBuffer.addParam(std::move(mem_objectsParam));
5049     }
5050     else
5051     {
5052         ParamCapture mem_objectsParam("mem_objects", ParamType::Tcl_memConstPointer);
5053         InitParamValue(ParamType::Tcl_memConstPointer, static_cast<const cl_mem *>(nullptr),
5054                        &mem_objectsParam.value);
5055         paramBuffer.addParam(std::move(mem_objectsParam));
5056     }
5057 
5058     paramBuffer.addValueParam("flagsPacked", ParamType::TMemMigrationFlags, flagsPacked);
5059     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5060                               num_events_in_wait_list);
5061 
5062     if (isCallValid)
5063     {
5064         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5065         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5066                        &event_wait_listParam.value);
5067         CaptureEnqueueMigrateMemObjects_event_wait_list(
5068             isCallValid, command_queue, num_mem_objects, mem_objects, flagsPacked,
5069             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
5070         paramBuffer.addParam(std::move(event_wait_listParam));
5071     }
5072     else
5073     {
5074         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5075         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5076                        &event_wait_listParam.value);
5077         paramBuffer.addParam(std::move(event_wait_listParam));
5078     }
5079 
5080     if (isCallValid)
5081     {
5082         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5083         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5084         CaptureEnqueueMigrateMemObjects_event(isCallValid, command_queue, num_mem_objects,
5085                                               mem_objects, flagsPacked, num_events_in_wait_list,
5086                                               event_wait_list, event, &eventParam);
5087         paramBuffer.addParam(std::move(eventParam));
5088     }
5089     else
5090     {
5091         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5092         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5093                        &eventParam.value);
5094         paramBuffer.addParam(std::move(eventParam));
5095     }
5096 
5097     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5098     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5099     paramBuffer.addReturnValue(std::move(returnValueCapture));
5100 
5101     return CallCapture(angle::EntryPoint::CLEnqueueMigrateMemObjects, std::move(paramBuffer));
5102 }
5103 
CaptureEnqueueMarkerWithWaitList(bool isCallValid,cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5104 CallCapture CaptureEnqueueMarkerWithWaitList(bool isCallValid,
5105                                              cl_command_queue command_queue,
5106                                              cl_uint num_events_in_wait_list,
5107                                              const cl_event *event_wait_list,
5108                                              cl_event *event,
5109                                              cl_int returnValue)
5110 {
5111     ParamBuffer paramBuffer;
5112 
5113     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5114     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5115                               num_events_in_wait_list);
5116 
5117     if (isCallValid)
5118     {
5119         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5120         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5121                        &event_wait_listParam.value);
5122         CaptureEnqueueMarkerWithWaitList_event_wait_list(isCallValid, command_queue,
5123                                                          num_events_in_wait_list, event_wait_list,
5124                                                          event, &event_wait_listParam);
5125         paramBuffer.addParam(std::move(event_wait_listParam));
5126     }
5127     else
5128     {
5129         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5130         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5131                        &event_wait_listParam.value);
5132         paramBuffer.addParam(std::move(event_wait_listParam));
5133     }
5134 
5135     if (isCallValid)
5136     {
5137         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5138         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5139         CaptureEnqueueMarkerWithWaitList_event(isCallValid, command_queue, num_events_in_wait_list,
5140                                                event_wait_list, event, &eventParam);
5141         paramBuffer.addParam(std::move(eventParam));
5142     }
5143     else
5144     {
5145         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5146         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5147                        &eventParam.value);
5148         paramBuffer.addParam(std::move(eventParam));
5149     }
5150 
5151     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5152     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5153     paramBuffer.addReturnValue(std::move(returnValueCapture));
5154 
5155     return CallCapture(angle::EntryPoint::CLEnqueueMarkerWithWaitList, std::move(paramBuffer));
5156 }
5157 
CaptureEnqueueBarrierWithWaitList(bool isCallValid,cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5158 CallCapture CaptureEnqueueBarrierWithWaitList(bool isCallValid,
5159                                               cl_command_queue command_queue,
5160                                               cl_uint num_events_in_wait_list,
5161                                               const cl_event *event_wait_list,
5162                                               cl_event *event,
5163                                               cl_int returnValue)
5164 {
5165     ParamBuffer paramBuffer;
5166 
5167     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5168     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5169                               num_events_in_wait_list);
5170 
5171     if (isCallValid)
5172     {
5173         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5174         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5175                        &event_wait_listParam.value);
5176         CaptureEnqueueBarrierWithWaitList_event_wait_list(isCallValid, command_queue,
5177                                                           num_events_in_wait_list, event_wait_list,
5178                                                           event, &event_wait_listParam);
5179         paramBuffer.addParam(std::move(event_wait_listParam));
5180     }
5181     else
5182     {
5183         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5184         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5185                        &event_wait_listParam.value);
5186         paramBuffer.addParam(std::move(event_wait_listParam));
5187     }
5188 
5189     if (isCallValid)
5190     {
5191         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5192         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5193         CaptureEnqueueBarrierWithWaitList_event(isCallValid, command_queue, num_events_in_wait_list,
5194                                                 event_wait_list, event, &eventParam);
5195         paramBuffer.addParam(std::move(eventParam));
5196     }
5197     else
5198     {
5199         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5200         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5201                        &eventParam.value);
5202         paramBuffer.addParam(std::move(eventParam));
5203     }
5204 
5205     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5206     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5207     paramBuffer.addReturnValue(std::move(returnValueCapture));
5208 
5209     return CallCapture(angle::EntryPoint::CLEnqueueBarrierWithWaitList, std::move(paramBuffer));
5210 }
5211 
CaptureGetExtensionFunctionAddressForPlatform(bool isCallValid,cl_platform_id platform,const char * func_name,void * returnValue)5212 CallCapture CaptureGetExtensionFunctionAddressForPlatform(bool isCallValid,
5213                                                           cl_platform_id platform,
5214                                                           const char *func_name,
5215                                                           void *returnValue)
5216 {
5217     ParamBuffer paramBuffer;
5218 
5219     paramBuffer.addValueParam("platform", ParamType::Tcl_platform_id, platform);
5220 
5221     if (isCallValid)
5222     {
5223         ParamCapture func_nameParam("func_name", ParamType::TcharConstPointer);
5224         InitParamValue(ParamType::TcharConstPointer, func_name, &func_nameParam.value);
5225         CaptureGetExtensionFunctionAddressForPlatform_func_name(isCallValid, platform, func_name,
5226                                                                 &func_nameParam);
5227         paramBuffer.addParam(std::move(func_nameParam));
5228     }
5229     else
5230     {
5231         ParamCapture func_nameParam("func_name", ParamType::TcharConstPointer);
5232         InitParamValue(ParamType::TcharConstPointer, static_cast<const char *>(nullptr),
5233                        &func_nameParam.value);
5234         paramBuffer.addParam(std::move(func_nameParam));
5235     }
5236 
5237     ParamCapture returnValueCapture("returnValue", ParamType::TvoidPointer);
5238     InitParamValue(ParamType::TvoidPointer, returnValue, &returnValueCapture.value);
5239     paramBuffer.addReturnValue(std::move(returnValueCapture));
5240 
5241     return CallCapture(angle::EntryPoint::CLGetExtensionFunctionAddressForPlatform,
5242                        std::move(paramBuffer));
5243 }
5244 
5245 // CL 2.0
CaptureCreateCommandQueueWithProperties(bool isCallValid,cl_context context,cl_device_id device,const cl_queue_properties * properties,cl_int * errcode_ret,cl_command_queue returnValue)5246 CallCapture CaptureCreateCommandQueueWithProperties(bool isCallValid,
5247                                                     cl_context context,
5248                                                     cl_device_id device,
5249                                                     const cl_queue_properties *properties,
5250                                                     cl_int *errcode_ret,
5251                                                     cl_command_queue returnValue)
5252 {
5253     ParamBuffer paramBuffer;
5254 
5255     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
5256     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
5257 
5258     if (isCallValid)
5259     {
5260         ParamCapture propertiesParam("properties", ParamType::Tcl_queue_propertiesConstPointer);
5261         InitParamValue(ParamType::Tcl_queue_propertiesConstPointer, properties,
5262                        &propertiesParam.value);
5263         CaptureCreateCommandQueueWithProperties_properties(isCallValid, context, device, properties,
5264                                                            errcode_ret, &propertiesParam);
5265         paramBuffer.addParam(std::move(propertiesParam));
5266     }
5267     else
5268     {
5269         ParamCapture propertiesParam("properties", ParamType::Tcl_queue_propertiesConstPointer);
5270         InitParamValue(ParamType::Tcl_queue_propertiesConstPointer,
5271                        static_cast<const cl_queue_properties *>(nullptr), &propertiesParam.value);
5272         paramBuffer.addParam(std::move(propertiesParam));
5273     }
5274 
5275     if (isCallValid)
5276     {
5277         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
5278         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
5279         CaptureCreateCommandQueueWithProperties_errcode_ret(
5280             isCallValid, context, device, properties, errcode_ret, &errcode_retParam);
5281         paramBuffer.addParam(std::move(errcode_retParam));
5282     }
5283     else
5284     {
5285         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
5286         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
5287                        &errcode_retParam.value);
5288         paramBuffer.addParam(std::move(errcode_retParam));
5289     }
5290 
5291     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_command_queue);
5292     InitParamValue(ParamType::Tcl_command_queue, returnValue, &returnValueCapture.value);
5293     paramBuffer.addReturnValue(std::move(returnValueCapture));
5294 
5295     return CallCapture(angle::EntryPoint::CLCreateCommandQueueWithProperties,
5296                        std::move(paramBuffer));
5297 }
5298 
CaptureCreatePipe(bool isCallValid,cl_context context,MemFlags flagsPacked,cl_uint pipe_packet_size,cl_uint pipe_max_packets,const cl_pipe_properties * properties,cl_int * errcode_ret,cl_mem returnValue)5299 CallCapture CaptureCreatePipe(bool isCallValid,
5300                               cl_context context,
5301                               MemFlags flagsPacked,
5302                               cl_uint pipe_packet_size,
5303                               cl_uint pipe_max_packets,
5304                               const cl_pipe_properties *properties,
5305                               cl_int *errcode_ret,
5306                               cl_mem returnValue)
5307 {
5308     ParamBuffer paramBuffer;
5309 
5310     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
5311     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
5312     paramBuffer.addValueParam("pipe_packet_size", ParamType::Tcl_uint, pipe_packet_size);
5313     paramBuffer.addValueParam("pipe_max_packets", ParamType::Tcl_uint, pipe_max_packets);
5314 
5315     if (isCallValid)
5316     {
5317         ParamCapture propertiesParam("properties", ParamType::Tcl_pipe_propertiesConstPointer);
5318         InitParamValue(ParamType::Tcl_pipe_propertiesConstPointer, properties,
5319                        &propertiesParam.value);
5320         CaptureCreatePipe_properties(isCallValid, context, flagsPacked, pipe_packet_size,
5321                                      pipe_max_packets, properties, errcode_ret, &propertiesParam);
5322         paramBuffer.addParam(std::move(propertiesParam));
5323     }
5324     else
5325     {
5326         ParamCapture propertiesParam("properties", ParamType::Tcl_pipe_propertiesConstPointer);
5327         InitParamValue(ParamType::Tcl_pipe_propertiesConstPointer,
5328                        static_cast<const cl_pipe_properties *>(nullptr), &propertiesParam.value);
5329         paramBuffer.addParam(std::move(propertiesParam));
5330     }
5331 
5332     if (isCallValid)
5333     {
5334         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
5335         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
5336         CaptureCreatePipe_errcode_ret(isCallValid, context, flagsPacked, pipe_packet_size,
5337                                       pipe_max_packets, properties, errcode_ret, &errcode_retParam);
5338         paramBuffer.addParam(std::move(errcode_retParam));
5339     }
5340     else
5341     {
5342         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
5343         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
5344                        &errcode_retParam.value);
5345         paramBuffer.addParam(std::move(errcode_retParam));
5346     }
5347 
5348     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
5349     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
5350     paramBuffer.addReturnValue(std::move(returnValueCapture));
5351 
5352     return CallCapture(angle::EntryPoint::CLCreatePipe, std::move(paramBuffer));
5353 }
5354 
CaptureGetPipeInfo(bool isCallValid,cl_mem pipe,PipeInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)5355 CallCapture CaptureGetPipeInfo(bool isCallValid,
5356                                cl_mem pipe,
5357                                PipeInfo param_namePacked,
5358                                size_t param_value_size,
5359                                void *param_value,
5360                                size_t *param_value_size_ret,
5361                                cl_int returnValue)
5362 {
5363     ParamBuffer paramBuffer;
5364 
5365     paramBuffer.addValueParam("pipe", ParamType::Tcl_mem, pipe);
5366     paramBuffer.addValueParam("param_namePacked", ParamType::TPipeInfo, param_namePacked);
5367     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
5368 
5369     if (isCallValid)
5370     {
5371         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
5372         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
5373         CaptureGetPipeInfo_param_value(isCallValid, pipe, param_namePacked, param_value_size,
5374                                        param_value, param_value_size_ret, &param_valueParam);
5375         paramBuffer.addParam(std::move(param_valueParam));
5376     }
5377     else
5378     {
5379         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
5380         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
5381                        &param_valueParam.value);
5382         paramBuffer.addParam(std::move(param_valueParam));
5383     }
5384 
5385     if (isCallValid)
5386     {
5387         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
5388         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
5389                        &param_value_size_retParam.value);
5390         CaptureGetPipeInfo_param_value_size_ret(isCallValid, pipe, param_namePacked,
5391                                                 param_value_size, param_value, param_value_size_ret,
5392                                                 &param_value_size_retParam);
5393         paramBuffer.addParam(std::move(param_value_size_retParam));
5394     }
5395     else
5396     {
5397         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
5398         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
5399                        &param_value_size_retParam.value);
5400         paramBuffer.addParam(std::move(param_value_size_retParam));
5401     }
5402 
5403     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5404     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5405     paramBuffer.addReturnValue(std::move(returnValueCapture));
5406 
5407     return CallCapture(angle::EntryPoint::CLGetPipeInfo, std::move(paramBuffer));
5408 }
5409 
CaptureSVMAlloc(bool isCallValid,cl_context context,SVM_MemFlags flagsPacked,size_t size,cl_uint alignment,void * returnValue)5410 CallCapture CaptureSVMAlloc(bool isCallValid,
5411                             cl_context context,
5412                             SVM_MemFlags flagsPacked,
5413                             size_t size,
5414                             cl_uint alignment,
5415                             void *returnValue)
5416 {
5417     ParamBuffer paramBuffer;
5418 
5419     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
5420     paramBuffer.addValueParam("flagsPacked", ParamType::TSVM_MemFlags, flagsPacked);
5421     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
5422     paramBuffer.addValueParam("alignment", ParamType::Tcl_uint, alignment);
5423 
5424     ParamCapture returnValueCapture("returnValue", ParamType::TvoidPointer);
5425     InitParamValue(ParamType::TvoidPointer, returnValue, &returnValueCapture.value);
5426     paramBuffer.addReturnValue(std::move(returnValueCapture));
5427 
5428     return CallCapture(angle::EntryPoint::CLSVMAlloc, std::move(paramBuffer));
5429 }
5430 
CaptureSVMFree(bool isCallValid,cl_context context,void * svm_pointer)5431 CallCapture CaptureSVMFree(bool isCallValid, cl_context context, void *svm_pointer)
5432 {
5433     ParamBuffer paramBuffer;
5434 
5435     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
5436 
5437     if (isCallValid)
5438     {
5439         ParamCapture svm_pointerParam("svm_pointer", ParamType::TvoidPointer);
5440         InitParamValue(ParamType::TvoidPointer, svm_pointer, &svm_pointerParam.value);
5441         CaptureSVMFree_svm_pointer(isCallValid, context, svm_pointer, &svm_pointerParam);
5442         paramBuffer.addParam(std::move(svm_pointerParam));
5443     }
5444     else
5445     {
5446         ParamCapture svm_pointerParam("svm_pointer", ParamType::TvoidPointer);
5447         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
5448                        &svm_pointerParam.value);
5449         paramBuffer.addParam(std::move(svm_pointerParam));
5450     }
5451 
5452     return CallCapture(angle::EntryPoint::CLSVMFree, std::move(paramBuffer));
5453 }
5454 
CaptureCreateSamplerWithProperties(bool isCallValid,cl_context context,const cl_sampler_properties * sampler_properties,cl_int * errcode_ret,cl_sampler returnValue)5455 CallCapture CaptureCreateSamplerWithProperties(bool isCallValid,
5456                                                cl_context context,
5457                                                const cl_sampler_properties *sampler_properties,
5458                                                cl_int *errcode_ret,
5459                                                cl_sampler returnValue)
5460 {
5461     ParamBuffer paramBuffer;
5462 
5463     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
5464 
5465     if (isCallValid)
5466     {
5467         ParamCapture sampler_propertiesParam("sampler_properties",
5468                                              ParamType::Tcl_sampler_propertiesConstPointer);
5469         InitParamValue(ParamType::Tcl_sampler_propertiesConstPointer, sampler_properties,
5470                        &sampler_propertiesParam.value);
5471         CaptureCreateSamplerWithProperties_sampler_properties(
5472             isCallValid, context, sampler_properties, errcode_ret, &sampler_propertiesParam);
5473         paramBuffer.addParam(std::move(sampler_propertiesParam));
5474     }
5475     else
5476     {
5477         ParamCapture sampler_propertiesParam("sampler_properties",
5478                                              ParamType::Tcl_sampler_propertiesConstPointer);
5479         InitParamValue(ParamType::Tcl_sampler_propertiesConstPointer,
5480                        static_cast<const cl_sampler_properties *>(nullptr),
5481                        &sampler_propertiesParam.value);
5482         paramBuffer.addParam(std::move(sampler_propertiesParam));
5483     }
5484 
5485     if (isCallValid)
5486     {
5487         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
5488         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
5489         CaptureCreateSamplerWithProperties_errcode_ret(isCallValid, context, sampler_properties,
5490                                                        errcode_ret, &errcode_retParam);
5491         paramBuffer.addParam(std::move(errcode_retParam));
5492     }
5493     else
5494     {
5495         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
5496         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
5497                        &errcode_retParam.value);
5498         paramBuffer.addParam(std::move(errcode_retParam));
5499     }
5500 
5501     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_sampler);
5502     InitParamValue(ParamType::Tcl_sampler, returnValue, &returnValueCapture.value);
5503     paramBuffer.addReturnValue(std::move(returnValueCapture));
5504 
5505     return CallCapture(angle::EntryPoint::CLCreateSamplerWithProperties, std::move(paramBuffer));
5506 }
5507 
CaptureSetKernelArgSVMPointer(bool isCallValid,cl_kernel kernel,cl_uint arg_index,const void * arg_value,cl_int returnValue)5508 CallCapture CaptureSetKernelArgSVMPointer(bool isCallValid,
5509                                           cl_kernel kernel,
5510                                           cl_uint arg_index,
5511                                           const void *arg_value,
5512                                           cl_int returnValue)
5513 {
5514     ParamBuffer paramBuffer;
5515 
5516     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
5517     paramBuffer.addValueParam("arg_index", ParamType::Tcl_uint, arg_index);
5518 
5519     if (isCallValid)
5520     {
5521         ParamCapture arg_valueParam("arg_value", ParamType::TvoidConstPointer);
5522         InitParamValue(ParamType::TvoidConstPointer, arg_value, &arg_valueParam.value);
5523         CaptureSetKernelArgSVMPointer_arg_value(isCallValid, kernel, arg_index, arg_value,
5524                                                 &arg_valueParam);
5525         paramBuffer.addParam(std::move(arg_valueParam));
5526     }
5527     else
5528     {
5529         ParamCapture arg_valueParam("arg_value", ParamType::TvoidConstPointer);
5530         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
5531                        &arg_valueParam.value);
5532         paramBuffer.addParam(std::move(arg_valueParam));
5533     }
5534 
5535     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5536     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5537     paramBuffer.addReturnValue(std::move(returnValueCapture));
5538 
5539     return CallCapture(angle::EntryPoint::CLSetKernelArgSVMPointer, std::move(paramBuffer));
5540 }
5541 
CaptureSetKernelExecInfo(bool isCallValid,cl_kernel kernel,KernelExecInfo param_namePacked,size_t param_value_size,const void * param_value,cl_int returnValue)5542 CallCapture CaptureSetKernelExecInfo(bool isCallValid,
5543                                      cl_kernel kernel,
5544                                      KernelExecInfo param_namePacked,
5545                                      size_t param_value_size,
5546                                      const void *param_value,
5547                                      cl_int returnValue)
5548 {
5549     ParamBuffer paramBuffer;
5550 
5551     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
5552     paramBuffer.addValueParam("param_namePacked", ParamType::TKernelExecInfo, param_namePacked);
5553     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
5554 
5555     if (isCallValid)
5556     {
5557         ParamCapture param_valueParam("param_value", ParamType::TvoidConstPointer);
5558         InitParamValue(ParamType::TvoidConstPointer, param_value, &param_valueParam.value);
5559         CaptureSetKernelExecInfo_param_value(isCallValid, kernel, param_namePacked,
5560                                              param_value_size, param_value, &param_valueParam);
5561         paramBuffer.addParam(std::move(param_valueParam));
5562     }
5563     else
5564     {
5565         ParamCapture param_valueParam("param_value", ParamType::TvoidConstPointer);
5566         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
5567                        &param_valueParam.value);
5568         paramBuffer.addParam(std::move(param_valueParam));
5569     }
5570 
5571     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5572     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5573     paramBuffer.addReturnValue(std::move(returnValueCapture));
5574 
5575     return CallCapture(angle::EntryPoint::CLSetKernelExecInfo, std::move(paramBuffer));
5576 }
5577 
CaptureEnqueueSVMFree(bool isCallValid,cl_command_queue command_queue,cl_uint num_svm_pointers,void * svm_pointers[],void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue,cl_uint num_svm_pointers,void * svm_pointers[],void * user_data),void * user_data,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5578 CallCapture CaptureEnqueueSVMFree(bool isCallValid,
5579                                   cl_command_queue command_queue,
5580                                   cl_uint num_svm_pointers,
5581                                   void *svm_pointers[],
5582                                   void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
5583                                                                    cl_uint num_svm_pointers,
5584                                                                    void *svm_pointers[],
5585                                                                    void *user_data),
5586                                   void *user_data,
5587                                   cl_uint num_events_in_wait_list,
5588                                   const cl_event *event_wait_list,
5589                                   cl_event *event,
5590                                   cl_int returnValue)
5591 {
5592     ParamBuffer paramBuffer;
5593 
5594     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5595     paramBuffer.addValueParam("num_svm_pointers", ParamType::Tcl_uint, num_svm_pointers);
5596 
5597     if (isCallValid)
5598     {
5599         ParamCapture svm_pointersParam("svm_pointers", ParamType::TvoidPointerPointer);
5600         InitParamValue(ParamType::TvoidPointerPointer, svm_pointers, &svm_pointersParam.value);
5601         CaptureEnqueueSVMFree_svm_pointers(
5602             isCallValid, command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data,
5603             num_events_in_wait_list, event_wait_list, event, &svm_pointersParam);
5604         paramBuffer.addParam(std::move(svm_pointersParam));
5605     }
5606     else
5607     {
5608         ParamCapture svm_pointersParam("svm_pointers", ParamType::TvoidPointerPointer);
5609         InitParamValue(ParamType::TvoidPointerPointer, static_cast<void **>(nullptr),
5610                        &svm_pointersParam.value);
5611         paramBuffer.addParam(std::move(svm_pointersParam));
5612     }
5613 
5614     if (isCallValid)
5615     {
5616         ParamCapture pfn_free_funcParam("pfn_free_func",
5617                                         ParamType::Tcl_svm_free_callback_func_type);
5618         InitParamValue(ParamType::Tcl_svm_free_callback_func_type, pfn_free_func,
5619                        &pfn_free_funcParam.value);
5620         CaptureEnqueueSVMFree_pfn_free_func(
5621             isCallValid, command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data,
5622             num_events_in_wait_list, event_wait_list, event, &pfn_free_funcParam);
5623         paramBuffer.addParam(std::move(pfn_free_funcParam));
5624     }
5625     else
5626     {
5627         ParamCapture pfn_free_funcParam("pfn_free_func",
5628                                         ParamType::Tcl_svm_free_callback_func_type);
5629         InitParamValue(
5630             ParamType::Tcl_svm_free_callback_func_type,
5631             static_cast<void(CL_CALLBACK *)(cl_command_queue queue, cl_uint num_svm_pointers,
5632                                             void *svm_pointers[], void *user_data)>(nullptr),
5633             &pfn_free_funcParam.value);
5634         paramBuffer.addParam(std::move(pfn_free_funcParam));
5635     }
5636 
5637     if (isCallValid)
5638     {
5639         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
5640         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
5641         CaptureEnqueueSVMFree_user_data(isCallValid, command_queue, num_svm_pointers, svm_pointers,
5642                                         pfn_free_func, user_data, num_events_in_wait_list,
5643                                         event_wait_list, event, &user_dataParam);
5644         paramBuffer.addParam(std::move(user_dataParam));
5645     }
5646     else
5647     {
5648         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
5649         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
5650                        &user_dataParam.value);
5651         paramBuffer.addParam(std::move(user_dataParam));
5652     }
5653 
5654     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5655                               num_events_in_wait_list);
5656 
5657     if (isCallValid)
5658     {
5659         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5660         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5661                        &event_wait_listParam.value);
5662         CaptureEnqueueSVMFree_event_wait_list(
5663             isCallValid, command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data,
5664             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
5665         paramBuffer.addParam(std::move(event_wait_listParam));
5666     }
5667     else
5668     {
5669         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5670         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5671                        &event_wait_listParam.value);
5672         paramBuffer.addParam(std::move(event_wait_listParam));
5673     }
5674 
5675     if (isCallValid)
5676     {
5677         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5678         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5679         CaptureEnqueueSVMFree_event(isCallValid, command_queue, num_svm_pointers, svm_pointers,
5680                                     pfn_free_func, user_data, num_events_in_wait_list,
5681                                     event_wait_list, event, &eventParam);
5682         paramBuffer.addParam(std::move(eventParam));
5683     }
5684     else
5685     {
5686         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5687         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5688                        &eventParam.value);
5689         paramBuffer.addParam(std::move(eventParam));
5690     }
5691 
5692     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5693     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5694     paramBuffer.addReturnValue(std::move(returnValueCapture));
5695 
5696     return CallCapture(angle::EntryPoint::CLEnqueueSVMFree, std::move(paramBuffer));
5697 }
5698 
CaptureEnqueueSVMMemcpy(bool isCallValid,cl_command_queue command_queue,cl_bool blocking_copy,void * dst_ptr,const void * src_ptr,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5699 CallCapture CaptureEnqueueSVMMemcpy(bool isCallValid,
5700                                     cl_command_queue command_queue,
5701                                     cl_bool blocking_copy,
5702                                     void *dst_ptr,
5703                                     const void *src_ptr,
5704                                     size_t size,
5705                                     cl_uint num_events_in_wait_list,
5706                                     const cl_event *event_wait_list,
5707                                     cl_event *event,
5708                                     cl_int returnValue)
5709 {
5710     ParamBuffer paramBuffer;
5711 
5712     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5713     paramBuffer.addValueParam("blocking_copy", ParamType::Tcl_bool, blocking_copy);
5714 
5715     if (isCallValid)
5716     {
5717         ParamCapture dst_ptrParam("dst_ptr", ParamType::TvoidPointer);
5718         InitParamValue(ParamType::TvoidPointer, dst_ptr, &dst_ptrParam.value);
5719         CaptureEnqueueSVMMemcpy_dst_ptr(isCallValid, command_queue, blocking_copy, dst_ptr, src_ptr,
5720                                         size, num_events_in_wait_list, event_wait_list, event,
5721                                         &dst_ptrParam);
5722         paramBuffer.addParam(std::move(dst_ptrParam));
5723     }
5724     else
5725     {
5726         ParamCapture dst_ptrParam("dst_ptr", ParamType::TvoidPointer);
5727         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &dst_ptrParam.value);
5728         paramBuffer.addParam(std::move(dst_ptrParam));
5729     }
5730 
5731     if (isCallValid)
5732     {
5733         ParamCapture src_ptrParam("src_ptr", ParamType::TvoidConstPointer);
5734         InitParamValue(ParamType::TvoidConstPointer, src_ptr, &src_ptrParam.value);
5735         CaptureEnqueueSVMMemcpy_src_ptr(isCallValid, command_queue, blocking_copy, dst_ptr, src_ptr,
5736                                         size, num_events_in_wait_list, event_wait_list, event,
5737                                         &src_ptrParam);
5738         paramBuffer.addParam(std::move(src_ptrParam));
5739     }
5740     else
5741     {
5742         ParamCapture src_ptrParam("src_ptr", ParamType::TvoidConstPointer);
5743         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
5744                        &src_ptrParam.value);
5745         paramBuffer.addParam(std::move(src_ptrParam));
5746     }
5747 
5748     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
5749     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5750                               num_events_in_wait_list);
5751 
5752     if (isCallValid)
5753     {
5754         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5755         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5756                        &event_wait_listParam.value);
5757         CaptureEnqueueSVMMemcpy_event_wait_list(isCallValid, command_queue, blocking_copy, dst_ptr,
5758                                                 src_ptr, size, num_events_in_wait_list,
5759                                                 event_wait_list, event, &event_wait_listParam);
5760         paramBuffer.addParam(std::move(event_wait_listParam));
5761     }
5762     else
5763     {
5764         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5765         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5766                        &event_wait_listParam.value);
5767         paramBuffer.addParam(std::move(event_wait_listParam));
5768     }
5769 
5770     if (isCallValid)
5771     {
5772         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5773         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5774         CaptureEnqueueSVMMemcpy_event(isCallValid, command_queue, blocking_copy, dst_ptr, src_ptr,
5775                                       size, num_events_in_wait_list, event_wait_list, event,
5776                                       &eventParam);
5777         paramBuffer.addParam(std::move(eventParam));
5778     }
5779     else
5780     {
5781         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5782         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5783                        &eventParam.value);
5784         paramBuffer.addParam(std::move(eventParam));
5785     }
5786 
5787     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5788     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5789     paramBuffer.addReturnValue(std::move(returnValueCapture));
5790 
5791     return CallCapture(angle::EntryPoint::CLEnqueueSVMMemcpy, std::move(paramBuffer));
5792 }
5793 
CaptureEnqueueSVMMemFill(bool isCallValid,cl_command_queue command_queue,void * svm_ptr,const void * pattern,size_t pattern_size,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5794 CallCapture CaptureEnqueueSVMMemFill(bool isCallValid,
5795                                      cl_command_queue command_queue,
5796                                      void *svm_ptr,
5797                                      const void *pattern,
5798                                      size_t pattern_size,
5799                                      size_t size,
5800                                      cl_uint num_events_in_wait_list,
5801                                      const cl_event *event_wait_list,
5802                                      cl_event *event,
5803                                      cl_int returnValue)
5804 {
5805     ParamBuffer paramBuffer;
5806 
5807     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5808 
5809     if (isCallValid)
5810     {
5811         ParamCapture svm_ptrParam("svm_ptr", ParamType::TvoidPointer);
5812         InitParamValue(ParamType::TvoidPointer, svm_ptr, &svm_ptrParam.value);
5813         CaptureEnqueueSVMMemFill_svm_ptr(isCallValid, command_queue, svm_ptr, pattern, pattern_size,
5814                                          size, num_events_in_wait_list, event_wait_list, event,
5815                                          &svm_ptrParam);
5816         paramBuffer.addParam(std::move(svm_ptrParam));
5817     }
5818     else
5819     {
5820         ParamCapture svm_ptrParam("svm_ptr", ParamType::TvoidPointer);
5821         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &svm_ptrParam.value);
5822         paramBuffer.addParam(std::move(svm_ptrParam));
5823     }
5824 
5825     if (isCallValid)
5826     {
5827         ParamCapture patternParam("pattern", ParamType::TvoidConstPointer);
5828         InitParamValue(ParamType::TvoidConstPointer, pattern, &patternParam.value);
5829         CaptureEnqueueSVMMemFill_pattern(isCallValid, command_queue, svm_ptr, pattern, pattern_size,
5830                                          size, num_events_in_wait_list, event_wait_list, event,
5831                                          &patternParam);
5832         paramBuffer.addParam(std::move(patternParam));
5833     }
5834     else
5835     {
5836         ParamCapture patternParam("pattern", ParamType::TvoidConstPointer);
5837         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
5838                        &patternParam.value);
5839         paramBuffer.addParam(std::move(patternParam));
5840     }
5841 
5842     paramBuffer.addValueParam("pattern_size", ParamType::Tsize_t, pattern_size);
5843     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
5844     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5845                               num_events_in_wait_list);
5846 
5847     if (isCallValid)
5848     {
5849         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5850         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5851                        &event_wait_listParam.value);
5852         CaptureEnqueueSVMMemFill_event_wait_list(isCallValid, command_queue, svm_ptr, pattern,
5853                                                  pattern_size, size, num_events_in_wait_list,
5854                                                  event_wait_list, event, &event_wait_listParam);
5855         paramBuffer.addParam(std::move(event_wait_listParam));
5856     }
5857     else
5858     {
5859         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5860         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5861                        &event_wait_listParam.value);
5862         paramBuffer.addParam(std::move(event_wait_listParam));
5863     }
5864 
5865     if (isCallValid)
5866     {
5867         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5868         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5869         CaptureEnqueueSVMMemFill_event(isCallValid, command_queue, svm_ptr, pattern, pattern_size,
5870                                        size, num_events_in_wait_list, event_wait_list, event,
5871                                        &eventParam);
5872         paramBuffer.addParam(std::move(eventParam));
5873     }
5874     else
5875     {
5876         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5877         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5878                        &eventParam.value);
5879         paramBuffer.addParam(std::move(eventParam));
5880     }
5881 
5882     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5883     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5884     paramBuffer.addReturnValue(std::move(returnValueCapture));
5885 
5886     return CallCapture(angle::EntryPoint::CLEnqueueSVMMemFill, std::move(paramBuffer));
5887 }
5888 
CaptureEnqueueSVMMap(bool isCallValid,cl_command_queue command_queue,cl_bool blocking_map,MapFlags flagsPacked,void * svm_ptr,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5889 CallCapture CaptureEnqueueSVMMap(bool isCallValid,
5890                                  cl_command_queue command_queue,
5891                                  cl_bool blocking_map,
5892                                  MapFlags flagsPacked,
5893                                  void *svm_ptr,
5894                                  size_t size,
5895                                  cl_uint num_events_in_wait_list,
5896                                  const cl_event *event_wait_list,
5897                                  cl_event *event,
5898                                  cl_int returnValue)
5899 {
5900     ParamBuffer paramBuffer;
5901 
5902     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5903     paramBuffer.addValueParam("blocking_map", ParamType::Tcl_bool, blocking_map);
5904     paramBuffer.addValueParam("flagsPacked", ParamType::TMapFlags, flagsPacked);
5905 
5906     if (isCallValid)
5907     {
5908         ParamCapture svm_ptrParam("svm_ptr", ParamType::TvoidPointer);
5909         InitParamValue(ParamType::TvoidPointer, svm_ptr, &svm_ptrParam.value);
5910         CaptureEnqueueSVMMap_svm_ptr(isCallValid, command_queue, blocking_map, flagsPacked, svm_ptr,
5911                                      size, num_events_in_wait_list, event_wait_list, event,
5912                                      &svm_ptrParam);
5913         paramBuffer.addParam(std::move(svm_ptrParam));
5914     }
5915     else
5916     {
5917         ParamCapture svm_ptrParam("svm_ptr", ParamType::TvoidPointer);
5918         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &svm_ptrParam.value);
5919         paramBuffer.addParam(std::move(svm_ptrParam));
5920     }
5921 
5922     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
5923     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5924                               num_events_in_wait_list);
5925 
5926     if (isCallValid)
5927     {
5928         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5929         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
5930                        &event_wait_listParam.value);
5931         CaptureEnqueueSVMMap_event_wait_list(isCallValid, command_queue, blocking_map, flagsPacked,
5932                                              svm_ptr, size, num_events_in_wait_list,
5933                                              event_wait_list, event, &event_wait_listParam);
5934         paramBuffer.addParam(std::move(event_wait_listParam));
5935     }
5936     else
5937     {
5938         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
5939         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
5940                        &event_wait_listParam.value);
5941         paramBuffer.addParam(std::move(event_wait_listParam));
5942     }
5943 
5944     if (isCallValid)
5945     {
5946         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5947         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
5948         CaptureEnqueueSVMMap_event(isCallValid, command_queue, blocking_map, flagsPacked, svm_ptr,
5949                                    size, num_events_in_wait_list, event_wait_list, event,
5950                                    &eventParam);
5951         paramBuffer.addParam(std::move(eventParam));
5952     }
5953     else
5954     {
5955         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
5956         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
5957                        &eventParam.value);
5958         paramBuffer.addParam(std::move(eventParam));
5959     }
5960 
5961     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
5962     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
5963     paramBuffer.addReturnValue(std::move(returnValueCapture));
5964 
5965     return CallCapture(angle::EntryPoint::CLEnqueueSVMMap, std::move(paramBuffer));
5966 }
5967 
CaptureEnqueueSVMUnmap(bool isCallValid,cl_command_queue command_queue,void * svm_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)5968 CallCapture CaptureEnqueueSVMUnmap(bool isCallValid,
5969                                    cl_command_queue command_queue,
5970                                    void *svm_ptr,
5971                                    cl_uint num_events_in_wait_list,
5972                                    const cl_event *event_wait_list,
5973                                    cl_event *event,
5974                                    cl_int returnValue)
5975 {
5976     ParamBuffer paramBuffer;
5977 
5978     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
5979 
5980     if (isCallValid)
5981     {
5982         ParamCapture svm_ptrParam("svm_ptr", ParamType::TvoidPointer);
5983         InitParamValue(ParamType::TvoidPointer, svm_ptr, &svm_ptrParam.value);
5984         CaptureEnqueueSVMUnmap_svm_ptr(isCallValid, command_queue, svm_ptr, num_events_in_wait_list,
5985                                        event_wait_list, event, &svm_ptrParam);
5986         paramBuffer.addParam(std::move(svm_ptrParam));
5987     }
5988     else
5989     {
5990         ParamCapture svm_ptrParam("svm_ptr", ParamType::TvoidPointer);
5991         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &svm_ptrParam.value);
5992         paramBuffer.addParam(std::move(svm_ptrParam));
5993     }
5994 
5995     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
5996                               num_events_in_wait_list);
5997 
5998     if (isCallValid)
5999     {
6000         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
6001         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
6002                        &event_wait_listParam.value);
6003         CaptureEnqueueSVMUnmap_event_wait_list(isCallValid, command_queue, svm_ptr,
6004                                                num_events_in_wait_list, event_wait_list, event,
6005                                                &event_wait_listParam);
6006         paramBuffer.addParam(std::move(event_wait_listParam));
6007     }
6008     else
6009     {
6010         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
6011         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
6012                        &event_wait_listParam.value);
6013         paramBuffer.addParam(std::move(event_wait_listParam));
6014     }
6015 
6016     if (isCallValid)
6017     {
6018         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
6019         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
6020         CaptureEnqueueSVMUnmap_event(isCallValid, command_queue, svm_ptr, num_events_in_wait_list,
6021                                      event_wait_list, event, &eventParam);
6022         paramBuffer.addParam(std::move(eventParam));
6023     }
6024     else
6025     {
6026         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
6027         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
6028                        &eventParam.value);
6029         paramBuffer.addParam(std::move(eventParam));
6030     }
6031 
6032     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6033     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6034     paramBuffer.addReturnValue(std::move(returnValueCapture));
6035 
6036     return CallCapture(angle::EntryPoint::CLEnqueueSVMUnmap, std::move(paramBuffer));
6037 }
6038 
6039 // CL 2.1
CaptureSetDefaultDeviceCommandQueue(bool isCallValid,cl_context context,cl_device_id device,cl_command_queue command_queue,cl_int returnValue)6040 CallCapture CaptureSetDefaultDeviceCommandQueue(bool isCallValid,
6041                                                 cl_context context,
6042                                                 cl_device_id device,
6043                                                 cl_command_queue command_queue,
6044                                                 cl_int returnValue)
6045 {
6046     ParamBuffer paramBuffer;
6047 
6048     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
6049     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
6050     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
6051 
6052     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6053     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6054     paramBuffer.addReturnValue(std::move(returnValueCapture));
6055 
6056     return CallCapture(angle::EntryPoint::CLSetDefaultDeviceCommandQueue, std::move(paramBuffer));
6057 }
6058 
CaptureGetDeviceAndHostTimer(bool isCallValid,cl_device_id device,cl_ulong * device_timestamp,cl_ulong * host_timestamp,cl_int returnValue)6059 CallCapture CaptureGetDeviceAndHostTimer(bool isCallValid,
6060                                          cl_device_id device,
6061                                          cl_ulong *device_timestamp,
6062                                          cl_ulong *host_timestamp,
6063                                          cl_int returnValue)
6064 {
6065     ParamBuffer paramBuffer;
6066 
6067     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
6068 
6069     if (isCallValid)
6070     {
6071         ParamCapture device_timestampParam("device_timestamp", ParamType::Tcl_ulongPointer);
6072         InitParamValue(ParamType::Tcl_ulongPointer, device_timestamp, &device_timestampParam.value);
6073         CaptureGetDeviceAndHostTimer_device_timestamp(isCallValid, device, device_timestamp,
6074                                                       host_timestamp, &device_timestampParam);
6075         paramBuffer.addParam(std::move(device_timestampParam));
6076     }
6077     else
6078     {
6079         ParamCapture device_timestampParam("device_timestamp", ParamType::Tcl_ulongPointer);
6080         InitParamValue(ParamType::Tcl_ulongPointer, static_cast<cl_ulong *>(nullptr),
6081                        &device_timestampParam.value);
6082         paramBuffer.addParam(std::move(device_timestampParam));
6083     }
6084 
6085     if (isCallValid)
6086     {
6087         ParamCapture host_timestampParam("host_timestamp", ParamType::Tcl_ulongPointer);
6088         InitParamValue(ParamType::Tcl_ulongPointer, host_timestamp, &host_timestampParam.value);
6089         CaptureGetDeviceAndHostTimer_host_timestamp(isCallValid, device, device_timestamp,
6090                                                     host_timestamp, &host_timestampParam);
6091         paramBuffer.addParam(std::move(host_timestampParam));
6092     }
6093     else
6094     {
6095         ParamCapture host_timestampParam("host_timestamp", ParamType::Tcl_ulongPointer);
6096         InitParamValue(ParamType::Tcl_ulongPointer, static_cast<cl_ulong *>(nullptr),
6097                        &host_timestampParam.value);
6098         paramBuffer.addParam(std::move(host_timestampParam));
6099     }
6100 
6101     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6102     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6103     paramBuffer.addReturnValue(std::move(returnValueCapture));
6104 
6105     return CallCapture(angle::EntryPoint::CLGetDeviceAndHostTimer, std::move(paramBuffer));
6106 }
6107 
CaptureGetHostTimer(bool isCallValid,cl_device_id device,cl_ulong * host_timestamp,cl_int returnValue)6108 CallCapture CaptureGetHostTimer(bool isCallValid,
6109                                 cl_device_id device,
6110                                 cl_ulong *host_timestamp,
6111                                 cl_int returnValue)
6112 {
6113     ParamBuffer paramBuffer;
6114 
6115     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
6116 
6117     if (isCallValid)
6118     {
6119         ParamCapture host_timestampParam("host_timestamp", ParamType::Tcl_ulongPointer);
6120         InitParamValue(ParamType::Tcl_ulongPointer, host_timestamp, &host_timestampParam.value);
6121         CaptureGetHostTimer_host_timestamp(isCallValid, device, host_timestamp,
6122                                            &host_timestampParam);
6123         paramBuffer.addParam(std::move(host_timestampParam));
6124     }
6125     else
6126     {
6127         ParamCapture host_timestampParam("host_timestamp", ParamType::Tcl_ulongPointer);
6128         InitParamValue(ParamType::Tcl_ulongPointer, static_cast<cl_ulong *>(nullptr),
6129                        &host_timestampParam.value);
6130         paramBuffer.addParam(std::move(host_timestampParam));
6131     }
6132 
6133     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6134     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6135     paramBuffer.addReturnValue(std::move(returnValueCapture));
6136 
6137     return CallCapture(angle::EntryPoint::CLGetHostTimer, std::move(paramBuffer));
6138 }
6139 
CaptureCreateProgramWithIL(bool isCallValid,cl_context context,const void * il,size_t length,cl_int * errcode_ret,cl_program returnValue)6140 CallCapture CaptureCreateProgramWithIL(bool isCallValid,
6141                                        cl_context context,
6142                                        const void *il,
6143                                        size_t length,
6144                                        cl_int *errcode_ret,
6145                                        cl_program returnValue)
6146 {
6147     ParamBuffer paramBuffer;
6148 
6149     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
6150 
6151     if (isCallValid)
6152     {
6153         ParamCapture ilParam("il", ParamType::TvoidConstPointer);
6154         InitParamValue(ParamType::TvoidConstPointer, il, &ilParam.value);
6155         CaptureCreateProgramWithIL_il(isCallValid, context, il, length, errcode_ret, &ilParam);
6156         paramBuffer.addParam(std::move(ilParam));
6157     }
6158     else
6159     {
6160         ParamCapture ilParam("il", ParamType::TvoidConstPointer);
6161         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
6162                        &ilParam.value);
6163         paramBuffer.addParam(std::move(ilParam));
6164     }
6165 
6166     paramBuffer.addValueParam("length", ParamType::Tsize_t, length);
6167 
6168     if (isCallValid)
6169     {
6170         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6171         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
6172         CaptureCreateProgramWithIL_errcode_ret(isCallValid, context, il, length, errcode_ret,
6173                                                &errcode_retParam);
6174         paramBuffer.addParam(std::move(errcode_retParam));
6175     }
6176     else
6177     {
6178         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6179         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
6180                        &errcode_retParam.value);
6181         paramBuffer.addParam(std::move(errcode_retParam));
6182     }
6183 
6184     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_program);
6185     InitParamValue(ParamType::Tcl_program, returnValue, &returnValueCapture.value);
6186     paramBuffer.addReturnValue(std::move(returnValueCapture));
6187 
6188     return CallCapture(angle::EntryPoint::CLCreateProgramWithIL, std::move(paramBuffer));
6189 }
6190 
CaptureCloneKernel(bool isCallValid,cl_kernel source_kernel,cl_int * errcode_ret,cl_kernel returnValue)6191 CallCapture CaptureCloneKernel(bool isCallValid,
6192                                cl_kernel source_kernel,
6193                                cl_int *errcode_ret,
6194                                cl_kernel returnValue)
6195 {
6196     ParamBuffer paramBuffer;
6197 
6198     paramBuffer.addValueParam("source_kernel", ParamType::Tcl_kernel, source_kernel);
6199 
6200     if (isCallValid)
6201     {
6202         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6203         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
6204         CaptureCloneKernel_errcode_ret(isCallValid, source_kernel, errcode_ret, &errcode_retParam);
6205         paramBuffer.addParam(std::move(errcode_retParam));
6206     }
6207     else
6208     {
6209         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6210         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
6211                        &errcode_retParam.value);
6212         paramBuffer.addParam(std::move(errcode_retParam));
6213     }
6214 
6215     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_kernel);
6216     InitParamValue(ParamType::Tcl_kernel, returnValue, &returnValueCapture.value);
6217     paramBuffer.addReturnValue(std::move(returnValueCapture));
6218 
6219     return CallCapture(angle::EntryPoint::CLCloneKernel, std::move(paramBuffer));
6220 }
6221 
CaptureGetKernelSubGroupInfo(bool isCallValid,cl_kernel kernel,cl_device_id device,KernelSubGroupInfo param_namePacked,size_t input_value_size,const void * input_value,size_t param_value_size,void * param_value,size_t * param_value_size_ret,cl_int returnValue)6222 CallCapture CaptureGetKernelSubGroupInfo(bool isCallValid,
6223                                          cl_kernel kernel,
6224                                          cl_device_id device,
6225                                          KernelSubGroupInfo param_namePacked,
6226                                          size_t input_value_size,
6227                                          const void *input_value,
6228                                          size_t param_value_size,
6229                                          void *param_value,
6230                                          size_t *param_value_size_ret,
6231                                          cl_int returnValue)
6232 {
6233     ParamBuffer paramBuffer;
6234 
6235     paramBuffer.addValueParam("kernel", ParamType::Tcl_kernel, kernel);
6236     paramBuffer.addValueParam("device", ParamType::Tcl_device_id, device);
6237     paramBuffer.addValueParam("param_namePacked", ParamType::TKernelSubGroupInfo, param_namePacked);
6238     paramBuffer.addValueParam("input_value_size", ParamType::Tsize_t, input_value_size);
6239 
6240     if (isCallValid)
6241     {
6242         ParamCapture input_valueParam("input_value", ParamType::TvoidConstPointer);
6243         InitParamValue(ParamType::TvoidConstPointer, input_value, &input_valueParam.value);
6244         CaptureGetKernelSubGroupInfo_input_value(
6245             isCallValid, kernel, device, param_namePacked, input_value_size, input_value,
6246             param_value_size, param_value, param_value_size_ret, &input_valueParam);
6247         paramBuffer.addParam(std::move(input_valueParam));
6248     }
6249     else
6250     {
6251         ParamCapture input_valueParam("input_value", ParamType::TvoidConstPointer);
6252         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
6253                        &input_valueParam.value);
6254         paramBuffer.addParam(std::move(input_valueParam));
6255     }
6256 
6257     paramBuffer.addValueParam("param_value_size", ParamType::Tsize_t, param_value_size);
6258 
6259     if (isCallValid)
6260     {
6261         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
6262         InitParamValue(ParamType::TvoidPointer, param_value, &param_valueParam.value);
6263         CaptureGetKernelSubGroupInfo_param_value(
6264             isCallValid, kernel, device, param_namePacked, input_value_size, input_value,
6265             param_value_size, param_value, param_value_size_ret, &param_valueParam);
6266         paramBuffer.addParam(std::move(param_valueParam));
6267     }
6268     else
6269     {
6270         ParamCapture param_valueParam("param_value", ParamType::TvoidPointer);
6271         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
6272                        &param_valueParam.value);
6273         paramBuffer.addParam(std::move(param_valueParam));
6274     }
6275 
6276     if (isCallValid)
6277     {
6278         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
6279         InitParamValue(ParamType::Tsize_tPointer, param_value_size_ret,
6280                        &param_value_size_retParam.value);
6281         CaptureGetKernelSubGroupInfo_param_value_size_ret(
6282             isCallValid, kernel, device, param_namePacked, input_value_size, input_value,
6283             param_value_size, param_value, param_value_size_ret, &param_value_size_retParam);
6284         paramBuffer.addParam(std::move(param_value_size_retParam));
6285     }
6286     else
6287     {
6288         ParamCapture param_value_size_retParam("param_value_size_ret", ParamType::Tsize_tPointer);
6289         InitParamValue(ParamType::Tsize_tPointer, static_cast<size_t *>(nullptr),
6290                        &param_value_size_retParam.value);
6291         paramBuffer.addParam(std::move(param_value_size_retParam));
6292     }
6293 
6294     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6295     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6296     paramBuffer.addReturnValue(std::move(returnValueCapture));
6297 
6298     return CallCapture(angle::EntryPoint::CLGetKernelSubGroupInfo, std::move(paramBuffer));
6299 }
6300 
CaptureEnqueueSVMMigrateMem(bool isCallValid,cl_command_queue command_queue,cl_uint num_svm_pointers,const void ** svm_pointers,const size_t * sizes,MemMigrationFlags flagsPacked,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int returnValue)6301 CallCapture CaptureEnqueueSVMMigrateMem(bool isCallValid,
6302                                         cl_command_queue command_queue,
6303                                         cl_uint num_svm_pointers,
6304                                         const void **svm_pointers,
6305                                         const size_t *sizes,
6306                                         MemMigrationFlags flagsPacked,
6307                                         cl_uint num_events_in_wait_list,
6308                                         const cl_event *event_wait_list,
6309                                         cl_event *event,
6310                                         cl_int returnValue)
6311 {
6312     ParamBuffer paramBuffer;
6313 
6314     paramBuffer.addValueParam("command_queue", ParamType::Tcl_command_queue, command_queue);
6315     paramBuffer.addValueParam("num_svm_pointers", ParamType::Tcl_uint, num_svm_pointers);
6316 
6317     if (isCallValid)
6318     {
6319         ParamCapture svm_pointersParam("svm_pointers", ParamType::TvoidConstPointerPointer);
6320         InitParamValue(ParamType::TvoidConstPointerPointer, svm_pointers, &svm_pointersParam.value);
6321         CaptureEnqueueSVMMigrateMem_svm_pointers(
6322             isCallValid, command_queue, num_svm_pointers, svm_pointers, sizes, flagsPacked,
6323             num_events_in_wait_list, event_wait_list, event, &svm_pointersParam);
6324         paramBuffer.addParam(std::move(svm_pointersParam));
6325     }
6326     else
6327     {
6328         ParamCapture svm_pointersParam("svm_pointers", ParamType::TvoidConstPointerPointer);
6329         InitParamValue(ParamType::TvoidConstPointerPointer, static_cast<const void **>(nullptr),
6330                        &svm_pointersParam.value);
6331         paramBuffer.addParam(std::move(svm_pointersParam));
6332     }
6333 
6334     if (isCallValid)
6335     {
6336         ParamCapture sizesParam("sizes", ParamType::Tsize_tConstPointer);
6337         InitParamValue(ParamType::Tsize_tConstPointer, sizes, &sizesParam.value);
6338         CaptureEnqueueSVMMigrateMem_sizes(isCallValid, command_queue, num_svm_pointers,
6339                                           svm_pointers, sizes, flagsPacked, num_events_in_wait_list,
6340                                           event_wait_list, event, &sizesParam);
6341         paramBuffer.addParam(std::move(sizesParam));
6342     }
6343     else
6344     {
6345         ParamCapture sizesParam("sizes", ParamType::Tsize_tConstPointer);
6346         InitParamValue(ParamType::Tsize_tConstPointer, static_cast<const size_t *>(nullptr),
6347                        &sizesParam.value);
6348         paramBuffer.addParam(std::move(sizesParam));
6349     }
6350 
6351     paramBuffer.addValueParam("flagsPacked", ParamType::TMemMigrationFlags, flagsPacked);
6352     paramBuffer.addValueParam("num_events_in_wait_list", ParamType::Tcl_uint,
6353                               num_events_in_wait_list);
6354 
6355     if (isCallValid)
6356     {
6357         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
6358         InitParamValue(ParamType::Tcl_eventConstPointer, event_wait_list,
6359                        &event_wait_listParam.value);
6360         CaptureEnqueueSVMMigrateMem_event_wait_list(
6361             isCallValid, command_queue, num_svm_pointers, svm_pointers, sizes, flagsPacked,
6362             num_events_in_wait_list, event_wait_list, event, &event_wait_listParam);
6363         paramBuffer.addParam(std::move(event_wait_listParam));
6364     }
6365     else
6366     {
6367         ParamCapture event_wait_listParam("event_wait_list", ParamType::Tcl_eventConstPointer);
6368         InitParamValue(ParamType::Tcl_eventConstPointer, static_cast<const cl_event *>(nullptr),
6369                        &event_wait_listParam.value);
6370         paramBuffer.addParam(std::move(event_wait_listParam));
6371     }
6372 
6373     if (isCallValid)
6374     {
6375         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
6376         InitParamValue(ParamType::Tcl_eventPointer, event, &eventParam.value);
6377         CaptureEnqueueSVMMigrateMem_event(isCallValid, command_queue, num_svm_pointers,
6378                                           svm_pointers, sizes, flagsPacked, num_events_in_wait_list,
6379                                           event_wait_list, event, &eventParam);
6380         paramBuffer.addParam(std::move(eventParam));
6381     }
6382     else
6383     {
6384         ParamCapture eventParam("event", ParamType::Tcl_eventPointer);
6385         InitParamValue(ParamType::Tcl_eventPointer, static_cast<cl_event *>(nullptr),
6386                        &eventParam.value);
6387         paramBuffer.addParam(std::move(eventParam));
6388     }
6389 
6390     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6391     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6392     paramBuffer.addReturnValue(std::move(returnValueCapture));
6393 
6394     return CallCapture(angle::EntryPoint::CLEnqueueSVMMigrateMem, std::move(paramBuffer));
6395 }
6396 
6397 // CL 2.2
CaptureSetProgramReleaseCallback(bool isCallValid,cl_program program,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,cl_int returnValue)6398 CallCapture CaptureSetProgramReleaseCallback(bool isCallValid,
6399                                              cl_program program,
6400                                              void(CL_CALLBACK *pfn_notify)(cl_program program,
6401                                                                            void *user_data),
6402                                              void *user_data,
6403                                              cl_int returnValue)
6404 {
6405     ParamBuffer paramBuffer;
6406 
6407     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
6408 
6409     if (isCallValid)
6410     {
6411         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
6412         InitParamValue(ParamType::Tcl_program_func_type, pfn_notify, &pfn_notifyParam.value);
6413         CaptureSetProgramReleaseCallback_pfn_notify(isCallValid, program, pfn_notify, user_data,
6414                                                     &pfn_notifyParam);
6415         paramBuffer.addParam(std::move(pfn_notifyParam));
6416     }
6417     else
6418     {
6419         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_program_func_type);
6420         InitParamValue(
6421             ParamType::Tcl_program_func_type,
6422             static_cast<void(CL_CALLBACK *)(cl_program program, void *user_data)>(nullptr),
6423             &pfn_notifyParam.value);
6424         paramBuffer.addParam(std::move(pfn_notifyParam));
6425     }
6426 
6427     if (isCallValid)
6428     {
6429         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
6430         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
6431         CaptureSetProgramReleaseCallback_user_data(isCallValid, program, pfn_notify, user_data,
6432                                                    &user_dataParam);
6433         paramBuffer.addParam(std::move(user_dataParam));
6434     }
6435     else
6436     {
6437         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
6438         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
6439                        &user_dataParam.value);
6440         paramBuffer.addParam(std::move(user_dataParam));
6441     }
6442 
6443     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6444     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6445     paramBuffer.addReturnValue(std::move(returnValueCapture));
6446 
6447     return CallCapture(angle::EntryPoint::CLSetProgramReleaseCallback, std::move(paramBuffer));
6448 }
6449 
CaptureSetProgramSpecializationConstant(bool isCallValid,cl_program program,cl_uint spec_id,size_t spec_size,const void * spec_value,cl_int returnValue)6450 CallCapture CaptureSetProgramSpecializationConstant(bool isCallValid,
6451                                                     cl_program program,
6452                                                     cl_uint spec_id,
6453                                                     size_t spec_size,
6454                                                     const void *spec_value,
6455                                                     cl_int returnValue)
6456 {
6457     ParamBuffer paramBuffer;
6458 
6459     paramBuffer.addValueParam("program", ParamType::Tcl_program, program);
6460     paramBuffer.addValueParam("spec_id", ParamType::Tcl_uint, spec_id);
6461     paramBuffer.addValueParam("spec_size", ParamType::Tsize_t, spec_size);
6462 
6463     if (isCallValid)
6464     {
6465         ParamCapture spec_valueParam("spec_value", ParamType::TvoidConstPointer);
6466         InitParamValue(ParamType::TvoidConstPointer, spec_value, &spec_valueParam.value);
6467         CaptureSetProgramSpecializationConstant_spec_value(isCallValid, program, spec_id, spec_size,
6468                                                            spec_value, &spec_valueParam);
6469         paramBuffer.addParam(std::move(spec_valueParam));
6470     }
6471     else
6472     {
6473         ParamCapture spec_valueParam("spec_value", ParamType::TvoidConstPointer);
6474         InitParamValue(ParamType::TvoidConstPointer, static_cast<const void *>(nullptr),
6475                        &spec_valueParam.value);
6476         paramBuffer.addParam(std::move(spec_valueParam));
6477     }
6478 
6479     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6480     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6481     paramBuffer.addReturnValue(std::move(returnValueCapture));
6482 
6483     return CallCapture(angle::EntryPoint::CLSetProgramSpecializationConstant,
6484                        std::move(paramBuffer));
6485 }
6486 
6487 // CL 3.0
CaptureSetContextDestructorCallback(bool isCallValid,cl_context context,void (CL_CALLBACK * pfn_notify)(cl_context context,void * user_data),void * user_data,cl_int returnValue)6488 CallCapture CaptureSetContextDestructorCallback(bool isCallValid,
6489                                                 cl_context context,
6490                                                 void(CL_CALLBACK *pfn_notify)(cl_context context,
6491                                                                               void *user_data),
6492                                                 void *user_data,
6493                                                 cl_int returnValue)
6494 {
6495     ParamBuffer paramBuffer;
6496 
6497     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
6498 
6499     if (isCallValid)
6500     {
6501         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_context_destructor_func_type);
6502         InitParamValue(ParamType::Tcl_context_destructor_func_type, pfn_notify,
6503                        &pfn_notifyParam.value);
6504         CaptureSetContextDestructorCallback_pfn_notify(isCallValid, context, pfn_notify, user_data,
6505                                                        &pfn_notifyParam);
6506         paramBuffer.addParam(std::move(pfn_notifyParam));
6507     }
6508     else
6509     {
6510         ParamCapture pfn_notifyParam("pfn_notify", ParamType::Tcl_context_destructor_func_type);
6511         InitParamValue(
6512             ParamType::Tcl_context_destructor_func_type,
6513             static_cast<void(CL_CALLBACK *)(cl_context context, void *user_data)>(nullptr),
6514             &pfn_notifyParam.value);
6515         paramBuffer.addParam(std::move(pfn_notifyParam));
6516     }
6517 
6518     if (isCallValid)
6519     {
6520         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
6521         InitParamValue(ParamType::TvoidPointer, user_data, &user_dataParam.value);
6522         CaptureSetContextDestructorCallback_user_data(isCallValid, context, pfn_notify, user_data,
6523                                                       &user_dataParam);
6524         paramBuffer.addParam(std::move(user_dataParam));
6525     }
6526     else
6527     {
6528         ParamCapture user_dataParam("user_data", ParamType::TvoidPointer);
6529         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr),
6530                        &user_dataParam.value);
6531         paramBuffer.addParam(std::move(user_dataParam));
6532     }
6533 
6534     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6535     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6536     paramBuffer.addReturnValue(std::move(returnValueCapture));
6537 
6538     return CallCapture(angle::EntryPoint::CLSetContextDestructorCallback, std::move(paramBuffer));
6539 }
6540 
CaptureCreateBufferWithProperties(bool isCallValid,cl_context context,const cl_mem_properties * properties,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,cl_mem returnValue)6541 CallCapture CaptureCreateBufferWithProperties(bool isCallValid,
6542                                               cl_context context,
6543                                               const cl_mem_properties *properties,
6544                                               MemFlags flagsPacked,
6545                                               size_t size,
6546                                               void *host_ptr,
6547                                               cl_int *errcode_ret,
6548                                               cl_mem returnValue)
6549 {
6550     ParamBuffer paramBuffer;
6551 
6552     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
6553 
6554     if (isCallValid)
6555     {
6556         ParamCapture propertiesParam("properties", ParamType::Tcl_mem_propertiesConstPointer);
6557         InitParamValue(ParamType::Tcl_mem_propertiesConstPointer, properties,
6558                        &propertiesParam.value);
6559         CaptureCreateBufferWithProperties_properties(isCallValid, context, properties, flagsPacked,
6560                                                      size, host_ptr, errcode_ret, &propertiesParam);
6561         paramBuffer.addParam(std::move(propertiesParam));
6562     }
6563     else
6564     {
6565         ParamCapture propertiesParam("properties", ParamType::Tcl_mem_propertiesConstPointer);
6566         InitParamValue(ParamType::Tcl_mem_propertiesConstPointer,
6567                        static_cast<const cl_mem_properties *>(nullptr), &propertiesParam.value);
6568         paramBuffer.addParam(std::move(propertiesParam));
6569     }
6570 
6571     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
6572     paramBuffer.addValueParam("size", ParamType::Tsize_t, size);
6573 
6574     if (isCallValid)
6575     {
6576         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
6577         InitParamValue(ParamType::TvoidPointer, host_ptr, &host_ptrParam.value);
6578         CaptureCreateBufferWithProperties_host_ptr(isCallValid, context, properties, flagsPacked,
6579                                                    size, host_ptr, errcode_ret, &host_ptrParam);
6580         paramBuffer.addParam(std::move(host_ptrParam));
6581     }
6582     else
6583     {
6584         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
6585         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &host_ptrParam.value);
6586         paramBuffer.addParam(std::move(host_ptrParam));
6587     }
6588 
6589     if (isCallValid)
6590     {
6591         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6592         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
6593         CaptureCreateBufferWithProperties_errcode_ret(isCallValid, context, properties, flagsPacked,
6594                                                       size, host_ptr, errcode_ret,
6595                                                       &errcode_retParam);
6596         paramBuffer.addParam(std::move(errcode_retParam));
6597     }
6598     else
6599     {
6600         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6601         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
6602                        &errcode_retParam.value);
6603         paramBuffer.addParam(std::move(errcode_retParam));
6604     }
6605 
6606     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
6607     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
6608     paramBuffer.addReturnValue(std::move(returnValueCapture));
6609 
6610     return CallCapture(angle::EntryPoint::CLCreateBufferWithProperties, std::move(paramBuffer));
6611 }
6612 
CaptureCreateImageWithProperties(bool isCallValid,cl_context context,const cl_mem_properties * properties,MemFlags flagsPacked,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret,cl_mem returnValue)6613 CallCapture CaptureCreateImageWithProperties(bool isCallValid,
6614                                              cl_context context,
6615                                              const cl_mem_properties *properties,
6616                                              MemFlags flagsPacked,
6617                                              const cl_image_format *image_format,
6618                                              const cl_image_desc *image_desc,
6619                                              void *host_ptr,
6620                                              cl_int *errcode_ret,
6621                                              cl_mem returnValue)
6622 {
6623     ParamBuffer paramBuffer;
6624 
6625     paramBuffer.addValueParam("context", ParamType::Tcl_context, context);
6626 
6627     if (isCallValid)
6628     {
6629         ParamCapture propertiesParam("properties", ParamType::Tcl_mem_propertiesConstPointer);
6630         InitParamValue(ParamType::Tcl_mem_propertiesConstPointer, properties,
6631                        &propertiesParam.value);
6632         CaptureCreateImageWithProperties_properties(isCallValid, context, properties, flagsPacked,
6633                                                     image_format, image_desc, host_ptr, errcode_ret,
6634                                                     &propertiesParam);
6635         paramBuffer.addParam(std::move(propertiesParam));
6636     }
6637     else
6638     {
6639         ParamCapture propertiesParam("properties", ParamType::Tcl_mem_propertiesConstPointer);
6640         InitParamValue(ParamType::Tcl_mem_propertiesConstPointer,
6641                        static_cast<const cl_mem_properties *>(nullptr), &propertiesParam.value);
6642         paramBuffer.addParam(std::move(propertiesParam));
6643     }
6644 
6645     paramBuffer.addValueParam("flagsPacked", ParamType::TMemFlags, flagsPacked);
6646 
6647     if (isCallValid)
6648     {
6649         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
6650         InitParamValue(ParamType::Tcl_image_formatConstPointer, image_format,
6651                        &image_formatParam.value);
6652         CaptureCreateImageWithProperties_image_format(isCallValid, context, properties, flagsPacked,
6653                                                       image_format, image_desc, host_ptr,
6654                                                       errcode_ret, &image_formatParam);
6655         paramBuffer.addParam(std::move(image_formatParam));
6656     }
6657     else
6658     {
6659         ParamCapture image_formatParam("image_format", ParamType::Tcl_image_formatConstPointer);
6660         InitParamValue(ParamType::Tcl_image_formatConstPointer,
6661                        static_cast<const cl_image_format *>(nullptr), &image_formatParam.value);
6662         paramBuffer.addParam(std::move(image_formatParam));
6663     }
6664 
6665     if (isCallValid)
6666     {
6667         ParamCapture image_descParam("image_desc", ParamType::Tcl_image_descConstPointer);
6668         InitParamValue(ParamType::Tcl_image_descConstPointer, image_desc, &image_descParam.value);
6669         CaptureCreateImageWithProperties_image_desc(isCallValid, context, properties, flagsPacked,
6670                                                     image_format, image_desc, host_ptr, errcode_ret,
6671                                                     &image_descParam);
6672         paramBuffer.addParam(std::move(image_descParam));
6673     }
6674     else
6675     {
6676         ParamCapture image_descParam("image_desc", ParamType::Tcl_image_descConstPointer);
6677         InitParamValue(ParamType::Tcl_image_descConstPointer,
6678                        static_cast<const cl_image_desc *>(nullptr), &image_descParam.value);
6679         paramBuffer.addParam(std::move(image_descParam));
6680     }
6681 
6682     if (isCallValid)
6683     {
6684         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
6685         InitParamValue(ParamType::TvoidPointer, host_ptr, &host_ptrParam.value);
6686         CaptureCreateImageWithProperties_host_ptr(isCallValid, context, properties, flagsPacked,
6687                                                   image_format, image_desc, host_ptr, errcode_ret,
6688                                                   &host_ptrParam);
6689         paramBuffer.addParam(std::move(host_ptrParam));
6690     }
6691     else
6692     {
6693         ParamCapture host_ptrParam("host_ptr", ParamType::TvoidPointer);
6694         InitParamValue(ParamType::TvoidPointer, static_cast<void *>(nullptr), &host_ptrParam.value);
6695         paramBuffer.addParam(std::move(host_ptrParam));
6696     }
6697 
6698     if (isCallValid)
6699     {
6700         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6701         InitParamValue(ParamType::Tcl_intPointer, errcode_ret, &errcode_retParam.value);
6702         CaptureCreateImageWithProperties_errcode_ret(isCallValid, context, properties, flagsPacked,
6703                                                      image_format, image_desc, host_ptr,
6704                                                      errcode_ret, &errcode_retParam);
6705         paramBuffer.addParam(std::move(errcode_retParam));
6706     }
6707     else
6708     {
6709         ParamCapture errcode_retParam("errcode_ret", ParamType::Tcl_intPointer);
6710         InitParamValue(ParamType::Tcl_intPointer, static_cast<cl_int *>(nullptr),
6711                        &errcode_retParam.value);
6712         paramBuffer.addParam(std::move(errcode_retParam));
6713     }
6714 
6715     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_mem);
6716     InitParamValue(ParamType::Tcl_mem, returnValue, &returnValueCapture.value);
6717     paramBuffer.addReturnValue(std::move(returnValueCapture));
6718 
6719     return CallCapture(angle::EntryPoint::CLCreateImageWithProperties, std::move(paramBuffer));
6720 }
6721 
6722 // cl_khr_icd
CaptureIcdGetPlatformIDsKHR(bool isCallValid,cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms,cl_int returnValue)6723 CallCapture CaptureIcdGetPlatformIDsKHR(bool isCallValid,
6724                                         cl_uint num_entries,
6725                                         cl_platform_id *platforms,
6726                                         cl_uint *num_platforms,
6727                                         cl_int returnValue)
6728 {
6729     ParamBuffer paramBuffer;
6730 
6731     paramBuffer.addValueParam("num_entries", ParamType::Tcl_uint, num_entries);
6732 
6733     if (isCallValid)
6734     {
6735         ParamCapture platformsParam("platforms", ParamType::Tcl_platform_idPointer);
6736         InitParamValue(ParamType::Tcl_platform_idPointer, platforms, &platformsParam.value);
6737         CaptureIcdGetPlatformIDsKHR_platforms(isCallValid, num_entries, platforms, num_platforms,
6738                                               &platformsParam);
6739         paramBuffer.addParam(std::move(platformsParam));
6740     }
6741     else
6742     {
6743         ParamCapture platformsParam("platforms", ParamType::Tcl_platform_idPointer);
6744         InitParamValue(ParamType::Tcl_platform_idPointer, static_cast<cl_platform_id *>(nullptr),
6745                        &platformsParam.value);
6746         paramBuffer.addParam(std::move(platformsParam));
6747     }
6748 
6749     if (isCallValid)
6750     {
6751         ParamCapture num_platformsParam("num_platforms", ParamType::Tcl_uintPointer);
6752         InitParamValue(ParamType::Tcl_uintPointer, num_platforms, &num_platformsParam.value);
6753         CaptureIcdGetPlatformIDsKHR_num_platforms(isCallValid, num_entries, platforms,
6754                                                   num_platforms, &num_platformsParam);
6755         paramBuffer.addParam(std::move(num_platformsParam));
6756     }
6757     else
6758     {
6759         ParamCapture num_platformsParam("num_platforms", ParamType::Tcl_uintPointer);
6760         InitParamValue(ParamType::Tcl_uintPointer, static_cast<cl_uint *>(nullptr),
6761                        &num_platformsParam.value);
6762         paramBuffer.addParam(std::move(num_platformsParam));
6763     }
6764 
6765     ParamCapture returnValueCapture("returnValue", ParamType::Tcl_int);
6766     InitParamValue(ParamType::Tcl_int, returnValue, &returnValueCapture.value);
6767     paramBuffer.addReturnValue(std::move(returnValueCapture));
6768 
6769     return CallCapture(angle::EntryPoint::CLIcdGetPlatformIDsKHR, std::move(paramBuffer));
6770 }
6771 
6772 }  // namespace cl
6773