• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2025 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // capture_cl_params.cpp:
7 //   Pointer parameter capture functions for the OpenCL entry points.
8 
9 #include "libANGLE/CLImage.h"
10 #include "libANGLE/capture/capture_cl_autogen.h"
11 #include "libANGLE/cl_utils.h"
12 #include "libANGLE/queryutils.h"
13 
14 namespace cl
15 {
CaptureGetPlatformIDs_platforms(bool isCallValid,cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms,angle::ParamCapture * paramCapture)16 void CaptureGetPlatformIDs_platforms(bool isCallValid,
17                                      cl_uint num_entries,
18                                      cl_platform_id *platforms,
19                                      cl_uint *num_platforms,
20                                      angle::ParamCapture *paramCapture)
21 {
22     if (platforms)
23     {
24         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLPlatformIndices(platforms,
25                                                                                   num_entries);
26     }
27 }
CaptureGetPlatformIDs_num_platforms(bool isCallValid,cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms,angle::ParamCapture * paramCapture)28 void CaptureGetPlatformIDs_num_platforms(bool isCallValid,
29                                          cl_uint num_entries,
30                                          cl_platform_id *platforms,
31                                          cl_uint *num_platforms,
32                                          angle::ParamCapture *paramCapture)
33 {
34     if (num_platforms)
35     {
36         paramCapture->readBufferSizeBytes = sizeof(cl_uint);
37     }
38 }
CaptureGetPlatformInfo_param_value(bool isCallValid,cl_platform_id platform,PlatformInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)39 void CaptureGetPlatformInfo_param_value(bool isCallValid,
40                                         cl_platform_id platform,
41                                         PlatformInfo param_namePacked,
42                                         size_t param_value_size,
43                                         void *param_value,
44                                         size_t *param_value_size_ret,
45                                         angle::ParamCapture *paramCapture)
46 {
47     if (param_value)
48     {
49         paramCapture->readBufferSizeBytes = param_value_size;
50     }
51 }
CaptureGetPlatformInfo_param_value_size_ret(bool isCallValid,cl_platform_id platform,PlatformInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)52 void CaptureGetPlatformInfo_param_value_size_ret(bool isCallValid,
53                                                  cl_platform_id platform,
54                                                  PlatformInfo param_namePacked,
55                                                  size_t param_value_size,
56                                                  void *param_value,
57                                                  size_t *param_value_size_ret,
58                                                  angle::ParamCapture *paramCapture)
59 {
60     if (param_value_size_ret)
61     {
62         paramCapture->readBufferSizeBytes = sizeof(size_t);
63     }
64 }
CaptureGetDeviceIDs_devices(bool isCallValid,cl_platform_id platform,DeviceType device_typePacked,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices,angle::ParamCapture * paramCapture)65 void CaptureGetDeviceIDs_devices(bool isCallValid,
66                                  cl_platform_id platform,
67                                  DeviceType device_typePacked,
68                                  cl_uint num_entries,
69                                  cl_device_id *devices,
70                                  cl_uint *num_devices,
71                                  angle::ParamCapture *paramCapture)
72 {
73     if (devices)
74     {
75         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLDeviceIndices(devices,
76                                                                                 num_entries);
77         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
78             devices, num_entries, paramCapture, &angle::FrameCaptureShared::getIndex);
79     }
80 }
CaptureGetDeviceIDs_num_devices(bool isCallValid,cl_platform_id platform,DeviceType device_typePacked,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices,angle::ParamCapture * paramCapture)81 void CaptureGetDeviceIDs_num_devices(bool isCallValid,
82                                      cl_platform_id platform,
83                                      DeviceType device_typePacked,
84                                      cl_uint num_entries,
85                                      cl_device_id *devices,
86                                      cl_uint *num_devices,
87                                      angle::ParamCapture *paramCapture)
88 {
89     if (num_devices)
90     {
91         paramCapture->readBufferSizeBytes = sizeof(cl_uint);
92     }
93 }
CaptureGetDeviceInfo_param_value(bool isCallValid,cl_device_id device,DeviceInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)94 void CaptureGetDeviceInfo_param_value(bool isCallValid,
95                                       cl_device_id device,
96                                       DeviceInfo param_namePacked,
97                                       size_t param_value_size,
98                                       void *param_value,
99                                       size_t *param_value_size_ret,
100                                       angle::ParamCapture *paramCapture)
101 {
102     if (param_value)
103     {
104         paramCapture->readBufferSizeBytes = param_value_size;
105     }
106 }
CaptureGetDeviceInfo_param_value_size_ret(bool isCallValid,cl_device_id device,DeviceInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)107 void CaptureGetDeviceInfo_param_value_size_ret(bool isCallValid,
108                                                cl_device_id device,
109                                                DeviceInfo param_namePacked,
110                                                size_t param_value_size,
111                                                void *param_value,
112                                                size_t *param_value_size_ret,
113                                                angle::ParamCapture *paramCapture)
114 {
115     if (param_value_size_ret)
116     {
117         paramCapture->readBufferSizeBytes = sizeof(size_t);
118     }
119 }
CaptureCreateContext_properties(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,angle::ParamCapture * paramCapture)120 void CaptureCreateContext_properties(bool isCallValid,
121                                      const cl_context_properties *properties,
122                                      cl_uint num_devices,
123                                      const cl_device_id *devices,
124                                      void(CL_CALLBACK *pfn_notify)(const char *errinfo,
125                                                                    const void *private_info,
126                                                                    size_t cb,
127                                                                    void *user_data),
128                                      void *user_data,
129                                      cl_int *errcode_ret,
130                                      angle::ParamCapture *paramCapture)
131 {
132     if (properties)
133     {
134         int propertiesSize = 1;
135         while (properties[propertiesSize - 1] != 0)
136         {
137             ++propertiesSize;
138         }
139         CaptureMemory(properties, propertiesSize * sizeof(cl_context_properties), paramCapture);
140     }
141 }
CaptureCreateContext_devices(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,angle::ParamCapture * paramCapture)142 void CaptureCreateContext_devices(bool isCallValid,
143                                   const cl_context_properties *properties,
144                                   cl_uint num_devices,
145                                   const cl_device_id *devices,
146                                   void(CL_CALLBACK *pfn_notify)(const char *errinfo,
147                                                                 const void *private_info,
148                                                                 size_t cb,
149                                                                 void *user_data),
150                                   void *user_data,
151                                   cl_int *errcode_ret,
152                                   angle::ParamCapture *paramCapture)
153 {
154     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
155         devices, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
156 }
CaptureCreateContext_pfn_notify(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,angle::ParamCapture * paramCapture)157 void CaptureCreateContext_pfn_notify(bool isCallValid,
158                                      const cl_context_properties *properties,
159                                      cl_uint num_devices,
160                                      const cl_device_id *devices,
161                                      void(CL_CALLBACK *pfn_notify)(const char *errinfo,
162                                                                    const void *private_info,
163                                                                    size_t cb,
164                                                                    void *user_data),
165                                      void *user_data,
166                                      cl_int *errcode_ret,
167                                      angle::ParamCapture *paramCapture)
168 {
169     // Nothing to implement
170 }
CaptureCreateContext_user_data(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,angle::ParamCapture * paramCapture)171 void CaptureCreateContext_user_data(bool isCallValid,
172                                     const cl_context_properties *properties,
173                                     cl_uint num_devices,
174                                     const cl_device_id *devices,
175                                     void(CL_CALLBACK *pfn_notify)(const char *errinfo,
176                                                                   const void *private_info,
177                                                                   size_t cb,
178                                                                   void *user_data),
179                                     void *user_data,
180                                     cl_int *errcode_ret,
181                                     angle::ParamCapture *paramCapture)
182 {
183     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
184                    &paramCapture->value);
185 }
CaptureCreateContext_errcode_ret(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,angle::ParamCapture * paramCapture)186 void CaptureCreateContext_errcode_ret(bool isCallValid,
187                                       const cl_context_properties *properties,
188                                       cl_uint num_devices,
189                                       const cl_device_id *devices,
190                                       void(CL_CALLBACK *pfn_notify)(const char *errinfo,
191                                                                     const void *private_info,
192                                                                     size_t cb,
193                                                                     void *user_data),
194                                       void *user_data,
195                                       cl_int *errcode_ret,
196                                       angle::ParamCapture *paramCapture)
197 {
198     if (errcode_ret)
199     {
200         paramCapture->readBufferSizeBytes = sizeof(cl_int);
201     }
202 }
CaptureCreateContextFromType_properties(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,angle::ParamCapture * paramCapture)203 void CaptureCreateContextFromType_properties(bool isCallValid,
204                                              const cl_context_properties *properties,
205                                              DeviceType device_typePacked,
206                                              void(CL_CALLBACK *pfn_notify)(const char *errinfo,
207                                                                            const void *private_info,
208                                                                            size_t cb,
209                                                                            void *user_data),
210                                              void *user_data,
211                                              cl_int *errcode_ret,
212                                              angle::ParamCapture *paramCapture)
213 {
214     if (properties)
215     {
216         int propertiesSize = 0;
217         while (properties[propertiesSize++] != 0)
218         {
219         }
220         CaptureMemory(properties, propertiesSize * sizeof(cl_context_properties), paramCapture);
221     }
222 }
CaptureCreateContextFromType_pfn_notify(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,angle::ParamCapture * paramCapture)223 void CaptureCreateContextFromType_pfn_notify(bool isCallValid,
224                                              const cl_context_properties *properties,
225                                              DeviceType device_typePacked,
226                                              void(CL_CALLBACK *pfn_notify)(const char *errinfo,
227                                                                            const void *private_info,
228                                                                            size_t cb,
229                                                                            void *user_data),
230                                              void *user_data,
231                                              cl_int *errcode_ret,
232                                              angle::ParamCapture *paramCapture)
233 {
234     // Nothing to implement
235 }
CaptureCreateContextFromType_user_data(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,angle::ParamCapture * paramCapture)236 void CaptureCreateContextFromType_user_data(bool isCallValid,
237                                             const cl_context_properties *properties,
238                                             DeviceType device_typePacked,
239                                             void(CL_CALLBACK *pfn_notify)(const char *errinfo,
240                                                                           const void *private_info,
241                                                                           size_t cb,
242                                                                           void *user_data),
243                                             void *user_data,
244                                             cl_int *errcode_ret,
245                                             angle::ParamCapture *paramCapture)
246 {
247     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
248                    &paramCapture->value);
249 }
CaptureCreateContextFromType_errcode_ret(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,angle::ParamCapture * paramCapture)250 void CaptureCreateContextFromType_errcode_ret(
251     bool isCallValid,
252     const cl_context_properties *properties,
253     DeviceType device_typePacked,
254     void(CL_CALLBACK *pfn_notify)(const char *errinfo,
255                                   const void *private_info,
256                                   size_t cb,
257                                   void *user_data),
258     void *user_data,
259     cl_int *errcode_ret,
260     angle::ParamCapture *paramCapture)
261 {
262     if (errcode_ret)
263     {
264         paramCapture->readBufferSizeBytes = sizeof(cl_int);
265     }
266 }
CaptureGetContextInfo_param_value(bool isCallValid,cl_context context,ContextInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)267 void CaptureGetContextInfo_param_value(bool isCallValid,
268                                        cl_context context,
269                                        ContextInfo param_namePacked,
270                                        size_t param_value_size,
271                                        void *param_value,
272                                        size_t *param_value_size_ret,
273                                        angle::ParamCapture *paramCapture)
274 {
275     if (param_value)
276     {
277         paramCapture->readBufferSizeBytes = param_value_size;
278     }
279 }
CaptureGetContextInfo_param_value_size_ret(bool isCallValid,cl_context context,ContextInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)280 void CaptureGetContextInfo_param_value_size_ret(bool isCallValid,
281                                                 cl_context context,
282                                                 ContextInfo param_namePacked,
283                                                 size_t param_value_size,
284                                                 void *param_value,
285                                                 size_t *param_value_size_ret,
286                                                 angle::ParamCapture *paramCapture)
287 {
288     if (param_value_size_ret)
289     {
290         paramCapture->readBufferSizeBytes = sizeof(size_t);
291     }
292 }
CaptureGetCommandQueueInfo_param_value(bool isCallValid,cl_command_queue command_queue,CommandQueueInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)293 void CaptureGetCommandQueueInfo_param_value(bool isCallValid,
294                                             cl_command_queue command_queue,
295                                             CommandQueueInfo param_namePacked,
296                                             size_t param_value_size,
297                                             void *param_value,
298                                             size_t *param_value_size_ret,
299                                             angle::ParamCapture *paramCapture)
300 {
301     if (param_value)
302     {
303         paramCapture->readBufferSizeBytes = param_value_size;
304     }
305 }
CaptureGetCommandQueueInfo_param_value_size_ret(bool isCallValid,cl_command_queue command_queue,CommandQueueInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)306 void CaptureGetCommandQueueInfo_param_value_size_ret(bool isCallValid,
307                                                      cl_command_queue command_queue,
308                                                      CommandQueueInfo param_namePacked,
309                                                      size_t param_value_size,
310                                                      void *param_value,
311                                                      size_t *param_value_size_ret,
312                                                      angle::ParamCapture *paramCapture)
313 {
314     if (param_value_size_ret)
315     {
316         paramCapture->readBufferSizeBytes = sizeof(size_t);
317     }
318 }
CaptureCreateBuffer_host_ptr(bool isCallValid,cl_context context,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,angle::ParamCapture * paramCapture)319 void CaptureCreateBuffer_host_ptr(bool isCallValid,
320                                   cl_context context,
321                                   MemFlags flagsPacked,
322                                   size_t size,
323                                   void *host_ptr,
324                                   cl_int *errcode_ret,
325                                   angle::ParamCapture *paramCapture)
326 {
327     if (host_ptr)
328     {
329         CaptureMemory(host_ptr, size, paramCapture);
330     }
331 }
CaptureCreateBuffer_errcode_ret(bool isCallValid,cl_context context,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,angle::ParamCapture * paramCapture)332 void CaptureCreateBuffer_errcode_ret(bool isCallValid,
333                                      cl_context context,
334                                      MemFlags flagsPacked,
335                                      size_t size,
336                                      void *host_ptr,
337                                      cl_int *errcode_ret,
338                                      angle::ParamCapture *paramCapture)
339 {
340     if (errcode_ret)
341     {
342         paramCapture->readBufferSizeBytes = sizeof(cl_int);
343     }
344 }
CaptureGetSupportedImageFormats_image_formats(bool isCallValid,cl_context context,MemFlags flagsPacked,MemObjectType image_typePacked,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats,angle::ParamCapture * paramCapture)345 void CaptureGetSupportedImageFormats_image_formats(bool isCallValid,
346                                                    cl_context context,
347                                                    MemFlags flagsPacked,
348                                                    MemObjectType image_typePacked,
349                                                    cl_uint num_entries,
350                                                    cl_image_format *image_formats,
351                                                    cl_uint *num_image_formats,
352                                                    angle::ParamCapture *paramCapture)
353 {
354     if (image_formats)
355     {
356         paramCapture->readBufferSizeBytes = num_entries * sizeof(cl_image_format);
357     }
358 }
CaptureGetSupportedImageFormats_num_image_formats(bool isCallValid,cl_context context,MemFlags flagsPacked,MemObjectType image_typePacked,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats,angle::ParamCapture * paramCapture)359 void CaptureGetSupportedImageFormats_num_image_formats(bool isCallValid,
360                                                        cl_context context,
361                                                        MemFlags flagsPacked,
362                                                        MemObjectType image_typePacked,
363                                                        cl_uint num_entries,
364                                                        cl_image_format *image_formats,
365                                                        cl_uint *num_image_formats,
366                                                        angle::ParamCapture *paramCapture)
367 {
368     if (num_image_formats)
369     {
370         paramCapture->readBufferSizeBytes = sizeof(cl_uint);
371     }
372 }
CaptureGetMemObjectInfo_param_value(bool isCallValid,cl_mem memobj,MemInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)373 void CaptureGetMemObjectInfo_param_value(bool isCallValid,
374                                          cl_mem memobj,
375                                          MemInfo param_namePacked,
376                                          size_t param_value_size,
377                                          void *param_value,
378                                          size_t *param_value_size_ret,
379                                          angle::ParamCapture *paramCapture)
380 {
381     if (param_value)
382     {
383         paramCapture->readBufferSizeBytes = param_value_size;
384     }
385 }
CaptureGetMemObjectInfo_param_value_size_ret(bool isCallValid,cl_mem memobj,MemInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)386 void CaptureGetMemObjectInfo_param_value_size_ret(bool isCallValid,
387                                                   cl_mem memobj,
388                                                   MemInfo param_namePacked,
389                                                   size_t param_value_size,
390                                                   void *param_value,
391                                                   size_t *param_value_size_ret,
392                                                   angle::ParamCapture *paramCapture)
393 {
394     if (param_value_size_ret)
395     {
396         paramCapture->readBufferSizeBytes = sizeof(size_t);
397     }
398 }
CaptureGetImageInfo_param_value(bool isCallValid,cl_mem image,ImageInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)399 void CaptureGetImageInfo_param_value(bool isCallValid,
400                                      cl_mem image,
401                                      ImageInfo param_namePacked,
402                                      size_t param_value_size,
403                                      void *param_value,
404                                      size_t *param_value_size_ret,
405                                      angle::ParamCapture *paramCapture)
406 {
407     if (param_value)
408     {
409         paramCapture->readBufferSizeBytes = param_value_size;
410     }
411 }
CaptureGetImageInfo_param_value_size_ret(bool isCallValid,cl_mem image,ImageInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)412 void CaptureGetImageInfo_param_value_size_ret(bool isCallValid,
413                                               cl_mem image,
414                                               ImageInfo param_namePacked,
415                                               size_t param_value_size,
416                                               void *param_value,
417                                               size_t *param_value_size_ret,
418                                               angle::ParamCapture *paramCapture)
419 {
420     if (param_value_size_ret)
421     {
422         paramCapture->readBufferSizeBytes = sizeof(size_t);
423     }
424 }
CaptureGetSamplerInfo_param_value(bool isCallValid,cl_sampler sampler,SamplerInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)425 void CaptureGetSamplerInfo_param_value(bool isCallValid,
426                                        cl_sampler sampler,
427                                        SamplerInfo param_namePacked,
428                                        size_t param_value_size,
429                                        void *param_value,
430                                        size_t *param_value_size_ret,
431                                        angle::ParamCapture *paramCapture)
432 {
433     if (param_value)
434     {
435         paramCapture->readBufferSizeBytes = param_value_size;
436     }
437 }
CaptureGetSamplerInfo_param_value_size_ret(bool isCallValid,cl_sampler sampler,SamplerInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)438 void CaptureGetSamplerInfo_param_value_size_ret(bool isCallValid,
439                                                 cl_sampler sampler,
440                                                 SamplerInfo param_namePacked,
441                                                 size_t param_value_size,
442                                                 void *param_value,
443                                                 size_t *param_value_size_ret,
444                                                 angle::ParamCapture *paramCapture)
445 {
446     if (param_value_size_ret)
447     {
448         paramCapture->readBufferSizeBytes = sizeof(size_t);
449     }
450 }
CaptureCreateProgramWithSource_strings(bool isCallValid,cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret,angle::ParamCapture * paramCapture)451 void CaptureCreateProgramWithSource_strings(bool isCallValid,
452                                             cl_context context,
453                                             cl_uint count,
454                                             const char **strings,
455                                             const size_t *lengths,
456                                             cl_int *errcode_ret,
457                                             angle::ParamCapture *paramCapture)
458 {
459     for (size_t i = 0; i < count; ++i)
460     {
461         if (lengths && lengths[i])
462         {
463             // Add a null terminator so it can be printed in the replay file.
464             // It won't effect the function parameters.
465             char *tempCharList = new char[lengths[i] + 1];
466             std::memcpy(tempCharList, strings[i], lengths[i] * sizeof(char));
467             tempCharList[lengths[i] + 1] = '\0';
468             CaptureMemory(strings[i], (lengths[i] + 1) * sizeof(char), paramCapture);
469             delete[] tempCharList;
470         }
471         else
472         {
473             CaptureMemory(strings[i], (strlen(strings[i]) + 1) * sizeof(char), paramCapture);
474         }
475     }
476 }
CaptureCreateProgramWithSource_lengths(bool isCallValid,cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret,angle::ParamCapture * paramCapture)477 void CaptureCreateProgramWithSource_lengths(bool isCallValid,
478                                             cl_context context,
479                                             cl_uint count,
480                                             const char **strings,
481                                             const size_t *lengths,
482                                             cl_int *errcode_ret,
483                                             angle::ParamCapture *paramCapture)
484 {
485     if (lengths)
486     {
487         CaptureMemory(lengths, count * sizeof(size_t), paramCapture);
488     }
489 }
CaptureCreateProgramWithSource_errcode_ret(bool isCallValid,cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret,angle::ParamCapture * paramCapture)490 void CaptureCreateProgramWithSource_errcode_ret(bool isCallValid,
491                                                 cl_context context,
492                                                 cl_uint count,
493                                                 const char **strings,
494                                                 const size_t *lengths,
495                                                 cl_int *errcode_ret,
496                                                 angle::ParamCapture *paramCapture)
497 {
498     if (errcode_ret)
499     {
500         paramCapture->readBufferSizeBytes = sizeof(cl_int);
501     }
502 }
CaptureCreateProgramWithBinary_device_list(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,angle::ParamCapture * paramCapture)503 void CaptureCreateProgramWithBinary_device_list(bool isCallValid,
504                                                 cl_context context,
505                                                 cl_uint num_devices,
506                                                 const cl_device_id *device_list,
507                                                 const size_t *lengths,
508                                                 const unsigned char **binaries,
509                                                 cl_int *binary_status,
510                                                 cl_int *errcode_ret,
511                                                 angle::ParamCapture *paramCapture)
512 {
513     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
514         device_list, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
515 }
CaptureCreateProgramWithBinary_lengths(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,angle::ParamCapture * paramCapture)516 void CaptureCreateProgramWithBinary_lengths(bool isCallValid,
517                                             cl_context context,
518                                             cl_uint num_devices,
519                                             const cl_device_id *device_list,
520                                             const size_t *lengths,
521                                             const unsigned char **binaries,
522                                             cl_int *binary_status,
523                                             cl_int *errcode_ret,
524                                             angle::ParamCapture *paramCapture)
525 {
526     if (lengths)
527     {
528         CaptureMemory(lengths, num_devices * sizeof(size_t), paramCapture);
529     }
530 }
CaptureCreateProgramWithBinary_binaries(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,angle::ParamCapture * paramCapture)531 void CaptureCreateProgramWithBinary_binaries(bool isCallValid,
532                                              cl_context context,
533                                              cl_uint num_devices,
534                                              const cl_device_id *device_list,
535                                              const size_t *lengths,
536                                              const unsigned char **binaries,
537                                              cl_int *binary_status,
538                                              cl_int *errcode_ret,
539                                              angle::ParamCapture *paramCapture)
540 {
541     for (size_t i = 0; i < num_devices; ++i)
542     {
543         if (lengths && lengths[i])
544         {
545             CaptureMemory(binaries[i], lengths[i] * sizeof(unsigned char), paramCapture);
546         }
547     }
548 }
549 
CaptureCreateProgramWithBinary_binary_status(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,angle::ParamCapture * paramCapture)550 void CaptureCreateProgramWithBinary_binary_status(bool isCallValid,
551                                                   cl_context context,
552                                                   cl_uint num_devices,
553                                                   const cl_device_id *device_list,
554                                                   const size_t *lengths,
555                                                   const unsigned char **binaries,
556                                                   cl_int *binary_status,
557                                                   cl_int *errcode_ret,
558                                                   angle::ParamCapture *paramCapture)
559 {
560     if (binary_status)
561     {
562         paramCapture->readBufferSizeBytes = num_devices * sizeof(cl_int);
563     }
564 }
565 
CaptureCreateProgramWithBinary_errcode_ret(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,angle::ParamCapture * paramCapture)566 void CaptureCreateProgramWithBinary_errcode_ret(bool isCallValid,
567                                                 cl_context context,
568                                                 cl_uint num_devices,
569                                                 const cl_device_id *device_list,
570                                                 const size_t *lengths,
571                                                 const unsigned char **binaries,
572                                                 cl_int *binary_status,
573                                                 cl_int *errcode_ret,
574                                                 angle::ParamCapture *paramCapture)
575 {
576     if (errcode_ret)
577     {
578         paramCapture->readBufferSizeBytes = sizeof(cl_int);
579     }
580 }
581 
CaptureBuildProgram_device_list(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,angle::ParamCapture * paramCapture)582 void CaptureBuildProgram_device_list(bool isCallValid,
583                                      cl_program program,
584                                      cl_uint num_devices,
585                                      const cl_device_id *device_list,
586                                      const char *options,
587                                      void(CL_CALLBACK *pfn_notify)(cl_program program,
588                                                                    void *user_data),
589                                      void *user_data,
590                                      angle::ParamCapture *paramCapture)
591 {
592     if (device_list)
593     {
594 
595         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
596             device_list, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
597     }
598 }
599 
CaptureBuildProgram_options(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,angle::ParamCapture * paramCapture)600 void CaptureBuildProgram_options(bool isCallValid,
601                                  cl_program program,
602                                  cl_uint num_devices,
603                                  const cl_device_id *device_list,
604                                  const char *options,
605                                  void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
606                                  void *user_data,
607                                  angle::ParamCapture *paramCapture)
608 {
609     if (options)
610     {
611         CaptureString(options, paramCapture);
612     }
613 }
CaptureBuildProgram_pfn_notify(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,angle::ParamCapture * paramCapture)614 void CaptureBuildProgram_pfn_notify(bool isCallValid,
615                                     cl_program program,
616                                     cl_uint num_devices,
617                                     const cl_device_id *device_list,
618                                     const char *options,
619                                     void(CL_CALLBACK *pfn_notify)(cl_program program,
620                                                                   void *user_data),
621                                     void *user_data,
622                                     angle::ParamCapture *paramCapture)
623 {
624     // Nothing to implement
625 }
CaptureBuildProgram_user_data(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,angle::ParamCapture * paramCapture)626 void CaptureBuildProgram_user_data(bool isCallValid,
627                                    cl_program program,
628                                    cl_uint num_devices,
629                                    const cl_device_id *device_list,
630                                    const char *options,
631                                    void(CL_CALLBACK *pfn_notify)(cl_program program,
632                                                                  void *user_data),
633                                    void *user_data,
634                                    angle::ParamCapture *paramCapture)
635 {
636     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
637                    &paramCapture->value);
638 }
CaptureGetProgramInfo_param_value(bool isCallValid,cl_program program,ProgramInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)639 void CaptureGetProgramInfo_param_value(bool isCallValid,
640                                        cl_program program,
641                                        ProgramInfo param_namePacked,
642                                        size_t param_value_size,
643                                        void *param_value,
644                                        size_t *param_value_size_ret,
645                                        angle::ParamCapture *paramCapture)
646 {
647     if (param_value)
648     {
649         paramCapture->readBufferSizeBytes = param_value_size;
650     }
651 }
CaptureGetProgramInfo_param_value_size_ret(bool isCallValid,cl_program program,ProgramInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)652 void CaptureGetProgramInfo_param_value_size_ret(bool isCallValid,
653                                                 cl_program program,
654                                                 ProgramInfo param_namePacked,
655                                                 size_t param_value_size,
656                                                 void *param_value,
657                                                 size_t *param_value_size_ret,
658                                                 angle::ParamCapture *paramCapture)
659 {
660     if (param_value_size_ret)
661     {
662         paramCapture->readBufferSizeBytes = sizeof(size_t);
663     }
664 }
CaptureGetProgramBuildInfo_param_value(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,angle::ParamCapture * paramCapture)665 void CaptureGetProgramBuildInfo_param_value(bool isCallValid,
666                                             cl_program program,
667                                             cl_device_id device,
668                                             ProgramBuildInfo param_namePacked,
669                                             size_t param_value_size,
670                                             void *param_value,
671                                             size_t *param_value_size_ret,
672                                             angle::ParamCapture *paramCapture)
673 {
674     if (param_value)
675     {
676         paramCapture->readBufferSizeBytes = param_value_size;
677     }
678 }
CaptureGetProgramBuildInfo_param_value_size_ret(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,angle::ParamCapture * paramCapture)679 void CaptureGetProgramBuildInfo_param_value_size_ret(bool isCallValid,
680                                                      cl_program program,
681                                                      cl_device_id device,
682                                                      ProgramBuildInfo param_namePacked,
683                                                      size_t param_value_size,
684                                                      void *param_value,
685                                                      size_t *param_value_size_ret,
686                                                      angle::ParamCapture *paramCapture)
687 {
688     if (param_value_size_ret)
689     {
690         paramCapture->readBufferSizeBytes = sizeof(size_t);
691     }
692 }
CaptureCreateKernel_kernel_name(bool isCallValid,cl_program program,const char * kernel_name,cl_int * errcode_ret,angle::ParamCapture * paramCapture)693 void CaptureCreateKernel_kernel_name(bool isCallValid,
694                                      cl_program program,
695                                      const char *kernel_name,
696                                      cl_int *errcode_ret,
697                                      angle::ParamCapture *paramCapture)
698 {
699     CaptureString(kernel_name, paramCapture);
700 }
CaptureCreateKernel_errcode_ret(bool isCallValid,cl_program program,const char * kernel_name,cl_int * errcode_ret,angle::ParamCapture * paramCapture)701 void CaptureCreateKernel_errcode_ret(bool isCallValid,
702                                      cl_program program,
703                                      const char *kernel_name,
704                                      cl_int *errcode_ret,
705                                      angle::ParamCapture *paramCapture)
706 {
707     if (errcode_ret)
708     {
709         paramCapture->readBufferSizeBytes = sizeof(cl_int);
710     }
711 }
CaptureCreateKernelsInProgram_kernels(bool isCallValid,cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret,angle::ParamCapture * paramCapture)712 void CaptureCreateKernelsInProgram_kernels(bool isCallValid,
713                                            cl_program program,
714                                            cl_uint num_kernels,
715                                            cl_kernel *kernels,
716                                            cl_uint *num_kernels_ret,
717                                            angle::ParamCapture *paramCapture)
718 {
719     if (kernels)
720     {
721         cl_uint maxKernels =
722             num_kernels_ret && *num_kernels_ret < num_kernels ? *num_kernels_ret : num_kernels;
723         for (cl_uint i = 0; i < maxKernels; ++i)
724         {
725             cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(&kernels[i]);
726         }
727         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
728             kernels, maxKernels, paramCapture, &angle::FrameCaptureShared::getIndex);
729     }
730 }
CaptureCreateKernelsInProgram_num_kernels_ret(bool isCallValid,cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret,angle::ParamCapture * paramCapture)731 void CaptureCreateKernelsInProgram_num_kernels_ret(bool isCallValid,
732                                                    cl_program program,
733                                                    cl_uint num_kernels,
734                                                    cl_kernel *kernels,
735                                                    cl_uint *num_kernels_ret,
736                                                    angle::ParamCapture *paramCapture)
737 {
738     if (num_kernels_ret)
739     {
740         paramCapture->readBufferSizeBytes = sizeof(cl_uint);
741     }
742 }
CaptureSetKernelArg_arg_value(bool isCallValid,cl_kernel kernel,cl_uint arg_index,size_t arg_size,const void * arg_value,angle::ParamCapture * paramCapture)743 void CaptureSetKernelArg_arg_value(bool isCallValid,
744                                    cl_kernel kernel,
745                                    cl_uint arg_index,
746                                    size_t arg_size,
747                                    const void *arg_value,
748                                    angle::ParamCapture *paramCapture)
749 {
750     if (arg_size == sizeof(cl_mem) && cl::Platform::GetDefault()->getFrameCaptureShared()->getIndex(
751                                           static_cast<const cl_mem *>(arg_value)) != SIZE_MAX)
752     {
753         InitParamValue(angle::ParamType::Tcl_mem, *static_cast<const cl_mem *>(arg_value),
754                        &paramCapture->value);
755     }
756     else if (arg_size == sizeof(cl_sampler) &&
757              cl::Platform::GetDefault()->getFrameCaptureShared()->getIndex(
758                  static_cast<const cl_sampler *>(arg_value)) != SIZE_MAX)
759     {
760         InitParamValue(angle::ParamType::Tcl_sampler, *static_cast<const cl_sampler *>(arg_value),
761                        &paramCapture->value);
762     }
763     else if (arg_size == sizeof(cl_command_queue) &&
764              cl::Platform::GetDefault()->getFrameCaptureShared()->getIndex(
765                  static_cast<const cl_command_queue *>(arg_value)) != SIZE_MAX)
766     {
767         InitParamValue(angle::ParamType::Tcl_command_queue,
768                        *static_cast<const cl_command_queue *>(arg_value), &paramCapture->value);
769     }
770     else if (arg_value)
771     {
772         CaptureMemory(arg_value, arg_size, paramCapture);
773     }
774 }
CaptureGetKernelInfo_param_value(bool isCallValid,cl_kernel kernel,KernelInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)775 void CaptureGetKernelInfo_param_value(bool isCallValid,
776                                       cl_kernel kernel,
777                                       KernelInfo param_namePacked,
778                                       size_t param_value_size,
779                                       void *param_value,
780                                       size_t *param_value_size_ret,
781                                       angle::ParamCapture *paramCapture)
782 {
783     if (param_value)
784     {
785         paramCapture->readBufferSizeBytes = param_value_size;
786     }
787 }
CaptureGetKernelInfo_param_value_size_ret(bool isCallValid,cl_kernel kernel,KernelInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)788 void CaptureGetKernelInfo_param_value_size_ret(bool isCallValid,
789                                                cl_kernel kernel,
790                                                KernelInfo param_namePacked,
791                                                size_t param_value_size,
792                                                void *param_value,
793                                                size_t *param_value_size_ret,
794                                                angle::ParamCapture *paramCapture)
795 {
796     if (param_value_size_ret)
797     {
798         paramCapture->readBufferSizeBytes = sizeof(size_t);
799     }
800 }
CaptureGetKernelWorkGroupInfo_param_value(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,angle::ParamCapture * paramCapture)801 void CaptureGetKernelWorkGroupInfo_param_value(bool isCallValid,
802                                                cl_kernel kernel,
803                                                cl_device_id device,
804                                                KernelWorkGroupInfo param_namePacked,
805                                                size_t param_value_size,
806                                                void *param_value,
807                                                size_t *param_value_size_ret,
808                                                angle::ParamCapture *paramCapture)
809 {
810     if (param_value)
811     {
812         paramCapture->readBufferSizeBytes = param_value_size;
813     }
814 }
CaptureGetKernelWorkGroupInfo_param_value_size_ret(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,angle::ParamCapture * paramCapture)815 void CaptureGetKernelWorkGroupInfo_param_value_size_ret(bool isCallValid,
816                                                         cl_kernel kernel,
817                                                         cl_device_id device,
818                                                         KernelWorkGroupInfo param_namePacked,
819                                                         size_t param_value_size,
820                                                         void *param_value,
821                                                         size_t *param_value_size_ret,
822                                                         angle::ParamCapture *paramCapture)
823 {
824     if (param_value_size_ret)
825     {
826         paramCapture->readBufferSizeBytes = sizeof(size_t);
827     }
828 }
CaptureWaitForEvents_event_list(bool isCallValid,cl_uint num_events,const cl_event * event_list,angle::ParamCapture * paramCapture)829 void CaptureWaitForEvents_event_list(bool isCallValid,
830                                      cl_uint num_events,
831                                      const cl_event *event_list,
832                                      angle::ParamCapture *paramCapture)
833 {
834     if (event_list)
835     {
836         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
837             event_list, num_events, paramCapture, &angle::FrameCaptureShared::getIndex);
838     }
839 }
CaptureGetEventInfo_param_value(bool isCallValid,cl_event event,EventInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)840 void CaptureGetEventInfo_param_value(bool isCallValid,
841                                      cl_event event,
842                                      EventInfo param_namePacked,
843                                      size_t param_value_size,
844                                      void *param_value,
845                                      size_t *param_value_size_ret,
846                                      angle::ParamCapture *paramCapture)
847 {
848     if (param_value)
849     {
850         paramCapture->readBufferSizeBytes = param_value_size;
851     }
852 }
CaptureGetEventInfo_param_value_size_ret(bool isCallValid,cl_event event,EventInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)853 void CaptureGetEventInfo_param_value_size_ret(bool isCallValid,
854                                               cl_event event,
855                                               EventInfo param_namePacked,
856                                               size_t param_value_size,
857                                               void *param_value,
858                                               size_t *param_value_size_ret,
859                                               angle::ParamCapture *paramCapture)
860 {
861     if (param_value_size_ret)
862     {
863         paramCapture->readBufferSizeBytes = sizeof(size_t);
864     }
865 }
CaptureGetEventProfilingInfo_param_value(bool isCallValid,cl_event event,ProfilingInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)866 void CaptureGetEventProfilingInfo_param_value(bool isCallValid,
867                                               cl_event event,
868                                               ProfilingInfo param_namePacked,
869                                               size_t param_value_size,
870                                               void *param_value,
871                                               size_t *param_value_size_ret,
872                                               angle::ParamCapture *paramCapture)
873 {
874     if (param_value)
875     {
876         paramCapture->readBufferSizeBytes = param_value_size;
877     }
878 }
CaptureGetEventProfilingInfo_param_value_size_ret(bool isCallValid,cl_event event,ProfilingInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)879 void CaptureGetEventProfilingInfo_param_value_size_ret(bool isCallValid,
880                                                        cl_event event,
881                                                        ProfilingInfo param_namePacked,
882                                                        size_t param_value_size,
883                                                        void *param_value,
884                                                        size_t *param_value_size_ret,
885                                                        angle::ParamCapture *paramCapture)
886 {
887     if (param_value_size_ret)
888     {
889         paramCapture->readBufferSizeBytes = sizeof(size_t);
890     }
891 }
CaptureEnqueueReadBuffer_ptr(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,angle::ParamCapture * paramCapture)892 void CaptureEnqueueReadBuffer_ptr(bool isCallValid,
893                                   cl_command_queue command_queue,
894                                   cl_mem buffer,
895                                   cl_bool blocking_read,
896                                   size_t offset,
897                                   size_t size,
898                                   void *ptr,
899                                   cl_uint num_events_in_wait_list,
900                                   const cl_event *event_wait_list,
901                                   cl_event *event,
902                                   angle::ParamCapture *paramCapture)
903 {
904     paramCapture->readBufferSizeBytes = size;
905 }
CaptureEnqueueReadBuffer_event_wait_list(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,angle::ParamCapture * paramCapture)906 void CaptureEnqueueReadBuffer_event_wait_list(bool isCallValid,
907                                               cl_command_queue command_queue,
908                                               cl_mem buffer,
909                                               cl_bool blocking_read,
910                                               size_t offset,
911                                               size_t size,
912                                               void *ptr,
913                                               cl_uint num_events_in_wait_list,
914                                               const cl_event *event_wait_list,
915                                               cl_event *event,
916                                               angle::ParamCapture *paramCapture)
917 {
918     if (event_wait_list)
919     {
920         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
921             event_wait_list, num_events_in_wait_list, paramCapture,
922             &angle::FrameCaptureShared::getIndex);
923     }
924 }
CaptureEnqueueReadBuffer_event(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,angle::ParamCapture * paramCapture)925 void CaptureEnqueueReadBuffer_event(bool isCallValid,
926                                     cl_command_queue command_queue,
927                                     cl_mem buffer,
928                                     cl_bool blocking_read,
929                                     size_t offset,
930                                     size_t size,
931                                     void *ptr,
932                                     cl_uint num_events_in_wait_list,
933                                     const cl_event *event_wait_list,
934                                     cl_event *event,
935                                     angle::ParamCapture *paramCapture)
936 {
937     if (event)
938     {
939         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
940         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
941     }
942 }
CaptureEnqueueWriteBuffer_ptr(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,angle::ParamCapture * paramCapture)943 void CaptureEnqueueWriteBuffer_ptr(bool isCallValid,
944                                    cl_command_queue command_queue,
945                                    cl_mem buffer,
946                                    cl_bool blocking_write,
947                                    size_t offset,
948                                    size_t size,
949                                    const void *ptr,
950                                    cl_uint num_events_in_wait_list,
951                                    const cl_event *event_wait_list,
952                                    cl_event *event,
953                                    angle::ParamCapture *paramCapture)
954 {
955     if (ptr)
956     {
957         CaptureMemory(ptr, size, paramCapture);
958     }
959 }
CaptureEnqueueWriteBuffer_event_wait_list(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,angle::ParamCapture * paramCapture)960 void CaptureEnqueueWriteBuffer_event_wait_list(bool isCallValid,
961                                                cl_command_queue command_queue,
962                                                cl_mem buffer,
963                                                cl_bool blocking_write,
964                                                size_t offset,
965                                                size_t size,
966                                                const void *ptr,
967                                                cl_uint num_events_in_wait_list,
968                                                const cl_event *event_wait_list,
969                                                cl_event *event,
970                                                angle::ParamCapture *paramCapture)
971 {
972     if (event_wait_list)
973     {
974         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
975             event_wait_list, num_events_in_wait_list, paramCapture,
976             &angle::FrameCaptureShared::getIndex);
977     }
978 }
CaptureEnqueueWriteBuffer_event(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,angle::ParamCapture * paramCapture)979 void CaptureEnqueueWriteBuffer_event(bool isCallValid,
980                                      cl_command_queue command_queue,
981                                      cl_mem buffer,
982                                      cl_bool blocking_write,
983                                      size_t offset,
984                                      size_t size,
985                                      const void *ptr,
986                                      cl_uint num_events_in_wait_list,
987                                      const cl_event *event_wait_list,
988                                      cl_event *event,
989                                      angle::ParamCapture *paramCapture)
990 {
991     if (event)
992     {
993         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
994         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
995     }
996 }
CaptureEnqueueCopyBuffer_event_wait_list(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,angle::ParamCapture * paramCapture)997 void CaptureEnqueueCopyBuffer_event_wait_list(bool isCallValid,
998                                               cl_command_queue command_queue,
999                                               cl_mem src_buffer,
1000                                               cl_mem dst_buffer,
1001                                               size_t src_offset,
1002                                               size_t dst_offset,
1003                                               size_t size,
1004                                               cl_uint num_events_in_wait_list,
1005                                               const cl_event *event_wait_list,
1006                                               cl_event *event,
1007                                               angle::ParamCapture *paramCapture)
1008 {
1009     if (event_wait_list)
1010     {
1011         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1012             event_wait_list, num_events_in_wait_list, paramCapture,
1013             &angle::FrameCaptureShared::getIndex);
1014     }
1015 }
CaptureEnqueueCopyBuffer_event(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,angle::ParamCapture * paramCapture)1016 void CaptureEnqueueCopyBuffer_event(bool isCallValid,
1017                                     cl_command_queue command_queue,
1018                                     cl_mem src_buffer,
1019                                     cl_mem dst_buffer,
1020                                     size_t src_offset,
1021                                     size_t dst_offset,
1022                                     size_t size,
1023                                     cl_uint num_events_in_wait_list,
1024                                     const cl_event *event_wait_list,
1025                                     cl_event *event,
1026                                     angle::ParamCapture *paramCapture)
1027 {
1028     if (event)
1029     {
1030         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1031         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1032     }
1033 }
CaptureEnqueueReadImage_origin(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,angle::ParamCapture * paramCapture)1034 void CaptureEnqueueReadImage_origin(bool isCallValid,
1035                                     cl_command_queue command_queue,
1036                                     cl_mem image,
1037                                     cl_bool blocking_read,
1038                                     const size_t *origin,
1039                                     const size_t *region,
1040                                     size_t row_pitch,
1041                                     size_t slice_pitch,
1042                                     void *ptr,
1043                                     cl_uint num_events_in_wait_list,
1044                                     const cl_event *event_wait_list,
1045                                     cl_event *event,
1046                                     angle::ParamCapture *paramCapture)
1047 {
1048     if (origin)
1049     {
1050         CaptureMemory(origin, 3 * sizeof(size_t), paramCapture);
1051     }
1052 }
CaptureEnqueueReadImage_region(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,angle::ParamCapture * paramCapture)1053 void CaptureEnqueueReadImage_region(bool isCallValid,
1054                                     cl_command_queue command_queue,
1055                                     cl_mem image,
1056                                     cl_bool blocking_read,
1057                                     const size_t *origin,
1058                                     const size_t *region,
1059                                     size_t row_pitch,
1060                                     size_t slice_pitch,
1061                                     void *ptr,
1062                                     cl_uint num_events_in_wait_list,
1063                                     const cl_event *event_wait_list,
1064                                     cl_event *event,
1065                                     angle::ParamCapture *paramCapture)
1066 {
1067     if (region)
1068     {
1069         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
1070     }
1071 }
CaptureEnqueueReadImage_ptr(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,angle::ParamCapture * paramCapture)1072 void CaptureEnqueueReadImage_ptr(bool isCallValid,
1073                                  cl_command_queue command_queue,
1074                                  cl_mem image,
1075                                  cl_bool blocking_read,
1076                                  const size_t *origin,
1077                                  const size_t *region,
1078                                  size_t row_pitch,
1079                                  size_t slice_pitch,
1080                                  void *ptr,
1081                                  cl_uint num_events_in_wait_list,
1082                                  const cl_event *event_wait_list,
1083                                  cl_event *event,
1084                                  angle::ParamCapture *paramCapture)
1085 {
1086     if (ptr)
1087     {
1088         size_t elementSize        = image->cast<Image>().getElementSize();
1089         size_t computedRowPitch   = (row_pitch != 0) ? row_pitch : region[0] * elementSize;
1090         size_t computedSlicePitch = 0;
1091         MemObjectType imageType   = image->cast<Image>().getType();
1092         if (imageType == MemObjectType::Image3D || imageType == MemObjectType::Image2D_Array ||
1093             imageType == MemObjectType::Image1D_Array)
1094         {
1095             computedSlicePitch = (slice_pitch != 0) ? slice_pitch : computedRowPitch * region[1];
1096         }
1097         paramCapture->readBufferSizeBytes = (region[2] - 1) * computedSlicePitch +
1098                                             (region[1] - 1) * computedRowPitch +
1099                                             region[0] * elementSize;
1100     }
1101 }
CaptureEnqueueReadImage_event_wait_list(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,angle::ParamCapture * paramCapture)1102 void CaptureEnqueueReadImage_event_wait_list(bool isCallValid,
1103                                              cl_command_queue command_queue,
1104                                              cl_mem image,
1105                                              cl_bool blocking_read,
1106                                              const size_t *origin,
1107                                              const size_t *region,
1108                                              size_t row_pitch,
1109                                              size_t slice_pitch,
1110                                              void *ptr,
1111                                              cl_uint num_events_in_wait_list,
1112                                              const cl_event *event_wait_list,
1113                                              cl_event *event,
1114                                              angle::ParamCapture *paramCapture)
1115 {
1116     if (event_wait_list)
1117     {
1118         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1119             event_wait_list, num_events_in_wait_list, paramCapture,
1120             &angle::FrameCaptureShared::getIndex);
1121     }
1122 }
CaptureEnqueueReadImage_event(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,angle::ParamCapture * paramCapture)1123 void CaptureEnqueueReadImage_event(bool isCallValid,
1124                                    cl_command_queue command_queue,
1125                                    cl_mem image,
1126                                    cl_bool blocking_read,
1127                                    const size_t *origin,
1128                                    const size_t *region,
1129                                    size_t row_pitch,
1130                                    size_t slice_pitch,
1131                                    void *ptr,
1132                                    cl_uint num_events_in_wait_list,
1133                                    const cl_event *event_wait_list,
1134                                    cl_event *event,
1135                                    angle::ParamCapture *paramCapture)
1136 {
1137     if (event)
1138     {
1139         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1140         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1141     }
1142 }
CaptureEnqueueWriteImage_origin(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,angle::ParamCapture * paramCapture)1143 void CaptureEnqueueWriteImage_origin(bool isCallValid,
1144                                      cl_command_queue command_queue,
1145                                      cl_mem image,
1146                                      cl_bool blocking_write,
1147                                      const size_t *origin,
1148                                      const size_t *region,
1149                                      size_t input_row_pitch,
1150                                      size_t input_slice_pitch,
1151                                      const void *ptr,
1152                                      cl_uint num_events_in_wait_list,
1153                                      const cl_event *event_wait_list,
1154                                      cl_event *event,
1155                                      angle::ParamCapture *paramCapture)
1156 {
1157     if (origin)
1158     {
1159         CaptureMemory(origin, 3 * sizeof(size_t), paramCapture);
1160     }
1161 }
CaptureEnqueueWriteImage_region(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,angle::ParamCapture * paramCapture)1162 void CaptureEnqueueWriteImage_region(bool isCallValid,
1163                                      cl_command_queue command_queue,
1164                                      cl_mem image,
1165                                      cl_bool blocking_write,
1166                                      const size_t *origin,
1167                                      const size_t *region,
1168                                      size_t input_row_pitch,
1169                                      size_t input_slice_pitch,
1170                                      const void *ptr,
1171                                      cl_uint num_events_in_wait_list,
1172                                      const cl_event *event_wait_list,
1173                                      cl_event *event,
1174                                      angle::ParamCapture *paramCapture)
1175 {
1176     if (region)
1177     {
1178         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
1179     }
1180 }
CaptureEnqueueWriteImage_ptr(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,angle::ParamCapture * paramCapture)1181 void CaptureEnqueueWriteImage_ptr(bool isCallValid,
1182                                   cl_command_queue command_queue,
1183                                   cl_mem image,
1184                                   cl_bool blocking_write,
1185                                   const size_t *origin,
1186                                   const size_t *region,
1187                                   size_t input_row_pitch,
1188                                   size_t input_slice_pitch,
1189                                   const void *ptr,
1190                                   cl_uint num_events_in_wait_list,
1191                                   const cl_event *event_wait_list,
1192                                   cl_event *event,
1193                                   angle::ParamCapture *paramCapture)
1194 {
1195     if (ptr)
1196     {
1197         size_t elementSize = image->cast<Image>().getElementSize();
1198         size_t computedRowPitch =
1199             (input_row_pitch != 0) ? input_row_pitch : region[0] * elementSize;
1200         size_t computedSlicePitch = 0;
1201         MemObjectType imageType   = image->cast<Image>().getType();
1202         if (imageType == MemObjectType::Image3D || imageType == MemObjectType::Image2D_Array ||
1203             imageType == MemObjectType::Image1D_Array)
1204         {
1205             computedSlicePitch =
1206                 (input_slice_pitch != 0) ? input_slice_pitch : computedRowPitch * region[1];
1207         }
1208         size_t totalSize = (region[2] - 1) * computedSlicePitch +
1209                            (region[1] - 1) * computedRowPitch + region[0] * elementSize;
1210         CaptureMemory(ptr, totalSize, paramCapture);
1211     }
1212 }
CaptureEnqueueWriteImage_event_wait_list(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,angle::ParamCapture * paramCapture)1213 void CaptureEnqueueWriteImage_event_wait_list(bool isCallValid,
1214                                               cl_command_queue command_queue,
1215                                               cl_mem image,
1216                                               cl_bool blocking_write,
1217                                               const size_t *origin,
1218                                               const size_t *region,
1219                                               size_t input_row_pitch,
1220                                               size_t input_slice_pitch,
1221                                               const void *ptr,
1222                                               cl_uint num_events_in_wait_list,
1223                                               const cl_event *event_wait_list,
1224                                               cl_event *event,
1225                                               angle::ParamCapture *paramCapture)
1226 {
1227     if (event_wait_list)
1228     {
1229         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1230             event_wait_list, num_events_in_wait_list, paramCapture,
1231             &angle::FrameCaptureShared::getIndex);
1232     }
1233 }
CaptureEnqueueWriteImage_event(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,angle::ParamCapture * paramCapture)1234 void CaptureEnqueueWriteImage_event(bool isCallValid,
1235                                     cl_command_queue command_queue,
1236                                     cl_mem image,
1237                                     cl_bool blocking_write,
1238                                     const size_t *origin,
1239                                     const size_t *region,
1240                                     size_t input_row_pitch,
1241                                     size_t input_slice_pitch,
1242                                     const void *ptr,
1243                                     cl_uint num_events_in_wait_list,
1244                                     const cl_event *event_wait_list,
1245                                     cl_event *event,
1246                                     angle::ParamCapture *paramCapture)
1247 {
1248     if (event)
1249     {
1250         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1251         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1252     }
1253 }
CaptureEnqueueCopyImage_src_origin(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,angle::ParamCapture * paramCapture)1254 void CaptureEnqueueCopyImage_src_origin(bool isCallValid,
1255                                         cl_command_queue command_queue,
1256                                         cl_mem src_image,
1257                                         cl_mem dst_image,
1258                                         const size_t *src_origin,
1259                                         const size_t *dst_origin,
1260                                         const size_t *region,
1261                                         cl_uint num_events_in_wait_list,
1262                                         const cl_event *event_wait_list,
1263                                         cl_event *event,
1264                                         angle::ParamCapture *paramCapture)
1265 {
1266     if (src_origin)
1267     {
1268         CaptureMemory(src_origin, 3 * sizeof(size_t), paramCapture);
1269     }
1270 }
CaptureEnqueueCopyImage_dst_origin(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,angle::ParamCapture * paramCapture)1271 void CaptureEnqueueCopyImage_dst_origin(bool isCallValid,
1272                                         cl_command_queue command_queue,
1273                                         cl_mem src_image,
1274                                         cl_mem dst_image,
1275                                         const size_t *src_origin,
1276                                         const size_t *dst_origin,
1277                                         const size_t *region,
1278                                         cl_uint num_events_in_wait_list,
1279                                         const cl_event *event_wait_list,
1280                                         cl_event *event,
1281                                         angle::ParamCapture *paramCapture)
1282 {
1283     if (dst_origin)
1284     {
1285         CaptureMemory(dst_origin, 3 * sizeof(size_t), paramCapture);
1286     }
1287 }
CaptureEnqueueCopyImage_region(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,angle::ParamCapture * paramCapture)1288 void CaptureEnqueueCopyImage_region(bool isCallValid,
1289                                     cl_command_queue command_queue,
1290                                     cl_mem src_image,
1291                                     cl_mem dst_image,
1292                                     const size_t *src_origin,
1293                                     const size_t *dst_origin,
1294                                     const size_t *region,
1295                                     cl_uint num_events_in_wait_list,
1296                                     const cl_event *event_wait_list,
1297                                     cl_event *event,
1298                                     angle::ParamCapture *paramCapture)
1299 {
1300     if (region)
1301     {
1302         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
1303     }
1304 }
CaptureEnqueueCopyImage_event_wait_list(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,angle::ParamCapture * paramCapture)1305 void CaptureEnqueueCopyImage_event_wait_list(bool isCallValid,
1306                                              cl_command_queue command_queue,
1307                                              cl_mem src_image,
1308                                              cl_mem dst_image,
1309                                              const size_t *src_origin,
1310                                              const size_t *dst_origin,
1311                                              const size_t *region,
1312                                              cl_uint num_events_in_wait_list,
1313                                              const cl_event *event_wait_list,
1314                                              cl_event *event,
1315                                              angle::ParamCapture *paramCapture)
1316 {
1317     if (event_wait_list)
1318     {
1319         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1320             event_wait_list, num_events_in_wait_list, paramCapture,
1321             &angle::FrameCaptureShared::getIndex);
1322     }
1323 }
CaptureEnqueueCopyImage_event(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,angle::ParamCapture * paramCapture)1324 void CaptureEnqueueCopyImage_event(bool isCallValid,
1325                                    cl_command_queue command_queue,
1326                                    cl_mem src_image,
1327                                    cl_mem dst_image,
1328                                    const size_t *src_origin,
1329                                    const size_t *dst_origin,
1330                                    const size_t *region,
1331                                    cl_uint num_events_in_wait_list,
1332                                    const cl_event *event_wait_list,
1333                                    cl_event *event,
1334                                    angle::ParamCapture *paramCapture)
1335 {
1336     if (event)
1337     {
1338         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1339         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1340     }
1341 }
CaptureEnqueueCopyImageToBuffer_src_origin(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,angle::ParamCapture * paramCapture)1342 void CaptureEnqueueCopyImageToBuffer_src_origin(bool isCallValid,
1343                                                 cl_command_queue command_queue,
1344                                                 cl_mem src_image,
1345                                                 cl_mem dst_buffer,
1346                                                 const size_t *src_origin,
1347                                                 const size_t *region,
1348                                                 size_t dst_offset,
1349                                                 cl_uint num_events_in_wait_list,
1350                                                 const cl_event *event_wait_list,
1351                                                 cl_event *event,
1352                                                 angle::ParamCapture *paramCapture)
1353 {
1354     if (src_origin)
1355     {
1356         CaptureMemory(src_origin, 3 * sizeof(size_t), paramCapture);
1357     }
1358 }
CaptureEnqueueCopyImageToBuffer_region(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,angle::ParamCapture * paramCapture)1359 void CaptureEnqueueCopyImageToBuffer_region(bool isCallValid,
1360                                             cl_command_queue command_queue,
1361                                             cl_mem src_image,
1362                                             cl_mem dst_buffer,
1363                                             const size_t *src_origin,
1364                                             const size_t *region,
1365                                             size_t dst_offset,
1366                                             cl_uint num_events_in_wait_list,
1367                                             const cl_event *event_wait_list,
1368                                             cl_event *event,
1369                                             angle::ParamCapture *paramCapture)
1370 {
1371     if (region)
1372     {
1373         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
1374     }
1375 }
CaptureEnqueueCopyImageToBuffer_event_wait_list(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,angle::ParamCapture * paramCapture)1376 void CaptureEnqueueCopyImageToBuffer_event_wait_list(bool isCallValid,
1377                                                      cl_command_queue command_queue,
1378                                                      cl_mem src_image,
1379                                                      cl_mem dst_buffer,
1380                                                      const size_t *src_origin,
1381                                                      const size_t *region,
1382                                                      size_t dst_offset,
1383                                                      cl_uint num_events_in_wait_list,
1384                                                      const cl_event *event_wait_list,
1385                                                      cl_event *event,
1386                                                      angle::ParamCapture *paramCapture)
1387 {
1388     if (event_wait_list)
1389     {
1390         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1391             event_wait_list, num_events_in_wait_list, paramCapture,
1392             &angle::FrameCaptureShared::getIndex);
1393     }
1394 }
CaptureEnqueueCopyImageToBuffer_event(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,angle::ParamCapture * paramCapture)1395 void CaptureEnqueueCopyImageToBuffer_event(bool isCallValid,
1396                                            cl_command_queue command_queue,
1397                                            cl_mem src_image,
1398                                            cl_mem dst_buffer,
1399                                            const size_t *src_origin,
1400                                            const size_t *region,
1401                                            size_t dst_offset,
1402                                            cl_uint num_events_in_wait_list,
1403                                            const cl_event *event_wait_list,
1404                                            cl_event *event,
1405                                            angle::ParamCapture *paramCapture)
1406 {
1407     if (event)
1408     {
1409         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1410         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1411     }
1412 }
CaptureEnqueueCopyBufferToImage_dst_origin(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,angle::ParamCapture * paramCapture)1413 void CaptureEnqueueCopyBufferToImage_dst_origin(bool isCallValid,
1414                                                 cl_command_queue command_queue,
1415                                                 cl_mem src_buffer,
1416                                                 cl_mem dst_image,
1417                                                 size_t src_offset,
1418                                                 const size_t *dst_origin,
1419                                                 const size_t *region,
1420                                                 cl_uint num_events_in_wait_list,
1421                                                 const cl_event *event_wait_list,
1422                                                 cl_event *event,
1423                                                 angle::ParamCapture *paramCapture)
1424 {
1425     if (dst_origin)
1426     {
1427         CaptureMemory(dst_origin, 3 * sizeof(size_t), paramCapture);
1428     }
1429 }
CaptureEnqueueCopyBufferToImage_region(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,angle::ParamCapture * paramCapture)1430 void CaptureEnqueueCopyBufferToImage_region(bool isCallValid,
1431                                             cl_command_queue command_queue,
1432                                             cl_mem src_buffer,
1433                                             cl_mem dst_image,
1434                                             size_t src_offset,
1435                                             const size_t *dst_origin,
1436                                             const size_t *region,
1437                                             cl_uint num_events_in_wait_list,
1438                                             const cl_event *event_wait_list,
1439                                             cl_event *event,
1440                                             angle::ParamCapture *paramCapture)
1441 {
1442     if (region)
1443     {
1444         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
1445     }
1446 }
CaptureEnqueueCopyBufferToImage_event_wait_list(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,angle::ParamCapture * paramCapture)1447 void CaptureEnqueueCopyBufferToImage_event_wait_list(bool isCallValid,
1448                                                      cl_command_queue command_queue,
1449                                                      cl_mem src_buffer,
1450                                                      cl_mem dst_image,
1451                                                      size_t src_offset,
1452                                                      const size_t *dst_origin,
1453                                                      const size_t *region,
1454                                                      cl_uint num_events_in_wait_list,
1455                                                      const cl_event *event_wait_list,
1456                                                      cl_event *event,
1457                                                      angle::ParamCapture *paramCapture)
1458 {
1459     if (event_wait_list)
1460     {
1461         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1462             event_wait_list, num_events_in_wait_list, paramCapture,
1463             &angle::FrameCaptureShared::getIndex);
1464     }
1465 }
CaptureEnqueueCopyBufferToImage_event(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,angle::ParamCapture * paramCapture)1466 void CaptureEnqueueCopyBufferToImage_event(bool isCallValid,
1467                                            cl_command_queue command_queue,
1468                                            cl_mem src_buffer,
1469                                            cl_mem dst_image,
1470                                            size_t src_offset,
1471                                            const size_t *dst_origin,
1472                                            const size_t *region,
1473                                            cl_uint num_events_in_wait_list,
1474                                            const cl_event *event_wait_list,
1475                                            cl_event *event,
1476                                            angle::ParamCapture *paramCapture)
1477 {
1478     if (event)
1479     {
1480         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1481         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1482     }
1483 }
CaptureEnqueueMapBuffer_event_wait_list(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,angle::ParamCapture * paramCapture)1484 void CaptureEnqueueMapBuffer_event_wait_list(bool isCallValid,
1485                                              cl_command_queue command_queue,
1486                                              cl_mem buffer,
1487                                              cl_bool blocking_map,
1488                                              MapFlags map_flagsPacked,
1489                                              size_t offset,
1490                                              size_t size,
1491                                              cl_uint num_events_in_wait_list,
1492                                              const cl_event *event_wait_list,
1493                                              cl_event *event,
1494                                              cl_int *errcode_ret,
1495                                              angle::ParamCapture *paramCapture)
1496 {
1497     if (event_wait_list)
1498     {
1499         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1500             event_wait_list, num_events_in_wait_list, paramCapture,
1501             &angle::FrameCaptureShared::getIndex);
1502     }
1503 }
CaptureEnqueueMapBuffer_event(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,angle::ParamCapture * paramCapture)1504 void CaptureEnqueueMapBuffer_event(bool isCallValid,
1505                                    cl_command_queue command_queue,
1506                                    cl_mem buffer,
1507                                    cl_bool blocking_map,
1508                                    MapFlags map_flagsPacked,
1509                                    size_t offset,
1510                                    size_t size,
1511                                    cl_uint num_events_in_wait_list,
1512                                    const cl_event *event_wait_list,
1513                                    cl_event *event,
1514                                    cl_int *errcode_ret,
1515                                    angle::ParamCapture *paramCapture)
1516 {
1517     if (event)
1518     {
1519         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1520         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1521     }
1522 }
CaptureEnqueueMapBuffer_errcode_ret(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,angle::ParamCapture * paramCapture)1523 void CaptureEnqueueMapBuffer_errcode_ret(bool isCallValid,
1524                                          cl_command_queue command_queue,
1525                                          cl_mem buffer,
1526                                          cl_bool blocking_map,
1527                                          MapFlags map_flagsPacked,
1528                                          size_t offset,
1529                                          size_t size,
1530                                          cl_uint num_events_in_wait_list,
1531                                          const cl_event *event_wait_list,
1532                                          cl_event *event,
1533                                          cl_int *errcode_ret,
1534                                          angle::ParamCapture *paramCapture)
1535 {
1536     if (errcode_ret)
1537     {
1538         paramCapture->readBufferSizeBytes = sizeof(cl_int);
1539     }
1540 }
CaptureEnqueueMapImage_origin(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,angle::ParamCapture * paramCapture)1541 void CaptureEnqueueMapImage_origin(bool isCallValid,
1542                                    cl_command_queue command_queue,
1543                                    cl_mem image,
1544                                    cl_bool blocking_map,
1545                                    MapFlags map_flagsPacked,
1546                                    const size_t *origin,
1547                                    const size_t *region,
1548                                    size_t *image_row_pitch,
1549                                    size_t *image_slice_pitch,
1550                                    cl_uint num_events_in_wait_list,
1551                                    const cl_event *event_wait_list,
1552                                    cl_event *event,
1553                                    cl_int *errcode_ret,
1554                                    angle::ParamCapture *paramCapture)
1555 {
1556     if (origin)
1557     {
1558         CaptureMemory(origin, 3 * sizeof(size_t), paramCapture);
1559     }
1560 }
CaptureEnqueueMapImage_region(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,angle::ParamCapture * paramCapture)1561 void CaptureEnqueueMapImage_region(bool isCallValid,
1562                                    cl_command_queue command_queue,
1563                                    cl_mem image,
1564                                    cl_bool blocking_map,
1565                                    MapFlags map_flagsPacked,
1566                                    const size_t *origin,
1567                                    const size_t *region,
1568                                    size_t *image_row_pitch,
1569                                    size_t *image_slice_pitch,
1570                                    cl_uint num_events_in_wait_list,
1571                                    const cl_event *event_wait_list,
1572                                    cl_event *event,
1573                                    cl_int *errcode_ret,
1574                                    angle::ParamCapture *paramCapture)
1575 {
1576     if (region)
1577     {
1578         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
1579     }
1580 }
CaptureEnqueueMapImage_image_row_pitch(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,angle::ParamCapture * paramCapture)1581 void CaptureEnqueueMapImage_image_row_pitch(bool isCallValid,
1582                                             cl_command_queue command_queue,
1583                                             cl_mem image,
1584                                             cl_bool blocking_map,
1585                                             MapFlags map_flagsPacked,
1586                                             const size_t *origin,
1587                                             const size_t *region,
1588                                             size_t *image_row_pitch,
1589                                             size_t *image_slice_pitch,
1590                                             cl_uint num_events_in_wait_list,
1591                                             const cl_event *event_wait_list,
1592                                             cl_event *event,
1593                                             cl_int *errcode_ret,
1594                                             angle::ParamCapture *paramCapture)
1595 {
1596     if (image_row_pitch)
1597     {
1598         paramCapture->readBufferSizeBytes = sizeof(size_t);
1599     }
1600 }
CaptureEnqueueMapImage_image_slice_pitch(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,angle::ParamCapture * paramCapture)1601 void CaptureEnqueueMapImage_image_slice_pitch(bool isCallValid,
1602                                               cl_command_queue command_queue,
1603                                               cl_mem image,
1604                                               cl_bool blocking_map,
1605                                               MapFlags map_flagsPacked,
1606                                               const size_t *origin,
1607                                               const size_t *region,
1608                                               size_t *image_row_pitch,
1609                                               size_t *image_slice_pitch,
1610                                               cl_uint num_events_in_wait_list,
1611                                               const cl_event *event_wait_list,
1612                                               cl_event *event,
1613                                               cl_int *errcode_ret,
1614                                               angle::ParamCapture *paramCapture)
1615 {
1616     if (image_slice_pitch)
1617     {
1618         paramCapture->readBufferSizeBytes = sizeof(size_t);
1619     }
1620 }
CaptureEnqueueMapImage_event_wait_list(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,angle::ParamCapture * paramCapture)1621 void CaptureEnqueueMapImage_event_wait_list(bool isCallValid,
1622                                             cl_command_queue command_queue,
1623                                             cl_mem image,
1624                                             cl_bool blocking_map,
1625                                             MapFlags map_flagsPacked,
1626                                             const size_t *origin,
1627                                             const size_t *region,
1628                                             size_t *image_row_pitch,
1629                                             size_t *image_slice_pitch,
1630                                             cl_uint num_events_in_wait_list,
1631                                             const cl_event *event_wait_list,
1632                                             cl_event *event,
1633                                             cl_int *errcode_ret,
1634                                             angle::ParamCapture *paramCapture)
1635 {
1636     if (event_wait_list)
1637     {
1638         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1639             event_wait_list, num_events_in_wait_list, paramCapture,
1640             &angle::FrameCaptureShared::getIndex);
1641     }
1642 }
CaptureEnqueueMapImage_event(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,angle::ParamCapture * paramCapture)1643 void CaptureEnqueueMapImage_event(bool isCallValid,
1644                                   cl_command_queue command_queue,
1645                                   cl_mem image,
1646                                   cl_bool blocking_map,
1647                                   MapFlags map_flagsPacked,
1648                                   const size_t *origin,
1649                                   const size_t *region,
1650                                   size_t *image_row_pitch,
1651                                   size_t *image_slice_pitch,
1652                                   cl_uint num_events_in_wait_list,
1653                                   const cl_event *event_wait_list,
1654                                   cl_event *event,
1655                                   cl_int *errcode_ret,
1656                                   angle::ParamCapture *paramCapture)
1657 {
1658     if (event)
1659     {
1660         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1661         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1662     }
1663 }
CaptureEnqueueMapImage_errcode_ret(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,angle::ParamCapture * paramCapture)1664 void CaptureEnqueueMapImage_errcode_ret(bool isCallValid,
1665                                         cl_command_queue command_queue,
1666                                         cl_mem image,
1667                                         cl_bool blocking_map,
1668                                         MapFlags map_flagsPacked,
1669                                         const size_t *origin,
1670                                         const size_t *region,
1671                                         size_t *image_row_pitch,
1672                                         size_t *image_slice_pitch,
1673                                         cl_uint num_events_in_wait_list,
1674                                         const cl_event *event_wait_list,
1675                                         cl_event *event,
1676                                         cl_int *errcode_ret,
1677                                         angle::ParamCapture *paramCapture)
1678 {
1679     if (errcode_ret)
1680     {
1681         paramCapture->readBufferSizeBytes = sizeof(cl_int);
1682     }
1683 }
CaptureEnqueueUnmapMemObject_mapped_ptr(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,angle::ParamCapture * paramCapture)1684 void CaptureEnqueueUnmapMemObject_mapped_ptr(bool isCallValid,
1685                                              cl_command_queue command_queue,
1686                                              cl_mem memobj,
1687                                              void *mapped_ptr,
1688                                              cl_uint num_events_in_wait_list,
1689                                              const cl_event *event_wait_list,
1690                                              cl_event *event,
1691                                              angle::ParamCapture *paramCapture)
1692 {
1693     // Nothing to implement
1694 }
CaptureEnqueueUnmapMemObject_event_wait_list(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,angle::ParamCapture * paramCapture)1695 void CaptureEnqueueUnmapMemObject_event_wait_list(bool isCallValid,
1696                                                   cl_command_queue command_queue,
1697                                                   cl_mem memobj,
1698                                                   void *mapped_ptr,
1699                                                   cl_uint num_events_in_wait_list,
1700                                                   const cl_event *event_wait_list,
1701                                                   cl_event *event,
1702                                                   angle::ParamCapture *paramCapture)
1703 {
1704     if (event_wait_list)
1705     {
1706         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1707             event_wait_list, num_events_in_wait_list, paramCapture,
1708             &angle::FrameCaptureShared::getIndex);
1709     }
1710 }
CaptureEnqueueUnmapMemObject_event(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,angle::ParamCapture * paramCapture)1711 void CaptureEnqueueUnmapMemObject_event(bool isCallValid,
1712                                         cl_command_queue command_queue,
1713                                         cl_mem memobj,
1714                                         void *mapped_ptr,
1715                                         cl_uint num_events_in_wait_list,
1716                                         const cl_event *event_wait_list,
1717                                         cl_event *event,
1718                                         angle::ParamCapture *paramCapture)
1719 {
1720     if (event)
1721     {
1722         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1723         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1724     }
1725 }
CaptureEnqueueNDRangeKernel_global_work_offset(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,angle::ParamCapture * paramCapture)1726 void CaptureEnqueueNDRangeKernel_global_work_offset(bool isCallValid,
1727                                                     cl_command_queue command_queue,
1728                                                     cl_kernel kernel,
1729                                                     cl_uint work_dim,
1730                                                     const size_t *global_work_offset,
1731                                                     const size_t *global_work_size,
1732                                                     const size_t *local_work_size,
1733                                                     cl_uint num_events_in_wait_list,
1734                                                     const cl_event *event_wait_list,
1735                                                     cl_event *event,
1736                                                     angle::ParamCapture *paramCapture)
1737 {
1738     if (global_work_offset)
1739     {
1740         CaptureMemory(global_work_offset, work_dim * sizeof(size_t), paramCapture);
1741     }
1742 }
CaptureEnqueueNDRangeKernel_global_work_size(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,angle::ParamCapture * paramCapture)1743 void CaptureEnqueueNDRangeKernel_global_work_size(bool isCallValid,
1744                                                   cl_command_queue command_queue,
1745                                                   cl_kernel kernel,
1746                                                   cl_uint work_dim,
1747                                                   const size_t *global_work_offset,
1748                                                   const size_t *global_work_size,
1749                                                   const size_t *local_work_size,
1750                                                   cl_uint num_events_in_wait_list,
1751                                                   const cl_event *event_wait_list,
1752                                                   cl_event *event,
1753                                                   angle::ParamCapture *paramCapture)
1754 {
1755     if (global_work_size)
1756     {
1757         CaptureMemory(global_work_size, work_dim * sizeof(size_t), paramCapture);
1758     }
1759 }
CaptureEnqueueNDRangeKernel_local_work_size(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,angle::ParamCapture * paramCapture)1760 void CaptureEnqueueNDRangeKernel_local_work_size(bool isCallValid,
1761                                                  cl_command_queue command_queue,
1762                                                  cl_kernel kernel,
1763                                                  cl_uint work_dim,
1764                                                  const size_t *global_work_offset,
1765                                                  const size_t *global_work_size,
1766                                                  const size_t *local_work_size,
1767                                                  cl_uint num_events_in_wait_list,
1768                                                  const cl_event *event_wait_list,
1769                                                  cl_event *event,
1770                                                  angle::ParamCapture *paramCapture)
1771 {
1772     if (local_work_size)
1773     {
1774         CaptureMemory(local_work_size, work_dim * sizeof(size_t), paramCapture);
1775     }
1776 }
CaptureEnqueueNDRangeKernel_event_wait_list(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,angle::ParamCapture * paramCapture)1777 void CaptureEnqueueNDRangeKernel_event_wait_list(bool isCallValid,
1778                                                  cl_command_queue command_queue,
1779                                                  cl_kernel kernel,
1780                                                  cl_uint work_dim,
1781                                                  const size_t *global_work_offset,
1782                                                  const size_t *global_work_size,
1783                                                  const size_t *local_work_size,
1784                                                  cl_uint num_events_in_wait_list,
1785                                                  const cl_event *event_wait_list,
1786                                                  cl_event *event,
1787                                                  angle::ParamCapture *paramCapture)
1788 {
1789     if (event_wait_list)
1790     {
1791         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1792             event_wait_list, num_events_in_wait_list, paramCapture,
1793             &angle::FrameCaptureShared::getIndex);
1794     }
1795 }
CaptureEnqueueNDRangeKernel_event(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,angle::ParamCapture * paramCapture)1796 void CaptureEnqueueNDRangeKernel_event(bool isCallValid,
1797                                        cl_command_queue command_queue,
1798                                        cl_kernel kernel,
1799                                        cl_uint work_dim,
1800                                        const size_t *global_work_offset,
1801                                        const size_t *global_work_size,
1802                                        const size_t *local_work_size,
1803                                        cl_uint num_events_in_wait_list,
1804                                        const cl_event *event_wait_list,
1805                                        cl_event *event,
1806                                        angle::ParamCapture *paramCapture)
1807 {
1808     if (event)
1809     {
1810         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1811         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1812     }
1813 }
CaptureEnqueueNativeKernel_user_func(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,angle::ParamCapture * paramCapture)1814 void CaptureEnqueueNativeKernel_user_func(bool isCallValid,
1815                                           cl_command_queue command_queue,
1816                                           void(CL_CALLBACK *user_func)(void *),
1817                                           void *args,
1818                                           size_t cb_args,
1819                                           cl_uint num_mem_objects,
1820                                           const cl_mem *mem_list,
1821                                           const void **args_mem_loc,
1822                                           cl_uint num_events_in_wait_list,
1823                                           const cl_event *event_wait_list,
1824                                           cl_event *event,
1825                                           angle::ParamCapture *paramCapture)
1826 {
1827     // Nothing to implement
1828 }
CaptureEnqueueNativeKernel_args(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,angle::ParamCapture * paramCapture)1829 void CaptureEnqueueNativeKernel_args(bool isCallValid,
1830                                      cl_command_queue command_queue,
1831                                      void(CL_CALLBACK *user_func)(void *),
1832                                      void *args,
1833                                      size_t cb_args,
1834                                      cl_uint num_mem_objects,
1835                                      const cl_mem *mem_list,
1836                                      const void **args_mem_loc,
1837                                      cl_uint num_events_in_wait_list,
1838                                      const cl_event *event_wait_list,
1839                                      cl_event *event,
1840                                      angle::ParamCapture *paramCapture)
1841 {
1842 
1843     // Store all binary data
1844     // Then do:
1845     // memcpy(args, binary_data[x], size)
1846     // args[x] = clMemMap[y];
1847     // ...
1848     // ...
1849     CaptureMemory(args, cb_args, paramCapture);
1850 }
CaptureEnqueueNativeKernel_mem_list(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,angle::ParamCapture * paramCapture)1851 void CaptureEnqueueNativeKernel_mem_list(bool isCallValid,
1852                                          cl_command_queue command_queue,
1853                                          void(CL_CALLBACK *user_func)(void *),
1854                                          void *args,
1855                                          size_t cb_args,
1856                                          cl_uint num_mem_objects,
1857                                          const cl_mem *mem_list,
1858                                          const void **args_mem_loc,
1859                                          cl_uint num_events_in_wait_list,
1860                                          const cl_event *event_wait_list,
1861                                          cl_event *event,
1862                                          angle::ParamCapture *paramCapture)
1863 {
1864     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1865         mem_list, num_mem_objects, paramCapture, &angle::FrameCaptureShared::getIndex);
1866 }
CaptureEnqueueNativeKernel_args_mem_loc(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,angle::ParamCapture * paramCapture)1867 void CaptureEnqueueNativeKernel_args_mem_loc(bool isCallValid,
1868                                              cl_command_queue command_queue,
1869                                              void(CL_CALLBACK *user_func)(void *),
1870                                              void *args,
1871                                              size_t cb_args,
1872                                              cl_uint num_mem_objects,
1873                                              const cl_mem *mem_list,
1874                                              const void **args_mem_loc,
1875                                              cl_uint num_events_in_wait_list,
1876                                              const cl_event *event_wait_list,
1877                                              cl_event *event,
1878                                              angle::ParamCapture *paramCapture)
1879 {
1880     cl::Platform::GetDefault()->getFrameCaptureShared()->setOffsetsVector(
1881         args, args_mem_loc, num_mem_objects, paramCapture);
1882 }
CaptureEnqueueNativeKernel_event_wait_list(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,angle::ParamCapture * paramCapture)1883 void CaptureEnqueueNativeKernel_event_wait_list(bool isCallValid,
1884                                                 cl_command_queue command_queue,
1885                                                 void(CL_CALLBACK *user_func)(void *),
1886                                                 void *args,
1887                                                 size_t cb_args,
1888                                                 cl_uint num_mem_objects,
1889                                                 const cl_mem *mem_list,
1890                                                 const void **args_mem_loc,
1891                                                 cl_uint num_events_in_wait_list,
1892                                                 const cl_event *event_wait_list,
1893                                                 cl_event *event,
1894                                                 angle::ParamCapture *paramCapture)
1895 {
1896     if (event_wait_list)
1897     {
1898         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
1899             event_wait_list, num_events_in_wait_list, paramCapture,
1900             &angle::FrameCaptureShared::getIndex);
1901     }
1902 }
CaptureEnqueueNativeKernel_event(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,angle::ParamCapture * paramCapture)1903 void CaptureEnqueueNativeKernel_event(bool isCallValid,
1904                                       cl_command_queue command_queue,
1905                                       void(CL_CALLBACK *user_func)(void *),
1906                                       void *args,
1907                                       size_t cb_args,
1908                                       cl_uint num_mem_objects,
1909                                       const cl_mem *mem_list,
1910                                       const void **args_mem_loc,
1911                                       cl_uint num_events_in_wait_list,
1912                                       const cl_event *event_wait_list,
1913                                       cl_event *event,
1914                                       angle::ParamCapture *paramCapture)
1915 {
1916     if (event)
1917     {
1918         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
1919         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
1920     }
1921 }
CaptureSetCommandQueueProperty_old_properties(bool isCallValid,cl_command_queue command_queue,CommandQueueProperties propertiesPacked,cl_bool enable,cl_command_queue_properties * old_properties,angle::ParamCapture * paramCapture)1922 void CaptureSetCommandQueueProperty_old_properties(bool isCallValid,
1923                                                    cl_command_queue command_queue,
1924                                                    CommandQueueProperties propertiesPacked,
1925                                                    cl_bool enable,
1926                                                    cl_command_queue_properties *old_properties,
1927                                                    angle::ParamCapture *paramCapture)
1928 {
1929     if (old_properties)
1930     {
1931         paramCapture->readBufferSizeBytes = sizeof(cl_command_queue_properties);
1932     }
1933 }
1934 
GetCorrectedImageRowPitch(const cl_image_format * image_format,size_t image_row_pitch,size_t image_width)1935 size_t GetCorrectedImageRowPitch(const cl_image_format *image_format,
1936                                  size_t image_row_pitch,
1937                                  size_t image_width)
1938 {
1939     size_t corrected_image_row_pitch = image_row_pitch;
1940     if (corrected_image_row_pitch == 0)
1941     {
1942         switch (image_format->image_channel_order)
1943         {
1944             case CL_R:
1945             case CL_A:
1946             case CL_DEPTH:
1947             case CL_LUMINANCE:
1948             case CL_INTENSITY:
1949                 corrected_image_row_pitch = 1;
1950                 break;
1951             case CL_RG:
1952             case CL_RA:
1953             case CL_Rx:
1954             case CL_DEPTH_STENCIL:
1955                 corrected_image_row_pitch = 2;
1956                 break;
1957             case CL_RGB:
1958             case CL_RGx:
1959             case CL_sRGB:
1960                 corrected_image_row_pitch = 3;
1961                 break;
1962             case CL_RGBA:
1963             case CL_BGRA:
1964             case CL_ARGB:
1965             case CL_ABGR:
1966             case CL_RGBx:
1967             case CL_sRGBA:
1968             case CL_sBGRA:
1969             case CL_sRGBx:
1970                 corrected_image_row_pitch = 4;
1971                 break;
1972             default:
1973                 break;
1974         }
1975 
1976         switch (image_format->image_channel_data_type)
1977         {
1978             case CL_SNORM_INT16:
1979             case CL_UNORM_INT16:
1980             case CL_UNORM_SHORT_565:
1981             case CL_UNORM_SHORT_555:
1982             case CL_SIGNED_INT16:
1983             case CL_UNSIGNED_INT16:
1984             case CL_HALF_FLOAT:
1985                 corrected_image_row_pitch *= 2;
1986                 break;
1987             case CL_UNORM_INT24:
1988                 corrected_image_row_pitch *= 3;
1989                 break;
1990             case CL_UNORM_INT_101010:
1991             case CL_UNORM_INT_101010_2:
1992             case CL_FLOAT:
1993             case CL_SIGNED_INT32:
1994             case CL_UNSIGNED_INT32:
1995                 corrected_image_row_pitch *= 4;
1996                 break;
1997             default:
1998                 break;
1999         }
2000 
2001         corrected_image_row_pitch *= image_width;
2002     }
2003     return corrected_image_row_pitch;
2004 }
2005 
GetCorrectedImageSlicePitch(size_t image_row_pitch,size_t image_slice_pitch,size_t image_height,cl_mem_object_type image_type)2006 size_t GetCorrectedImageSlicePitch(size_t image_row_pitch,
2007                                    size_t image_slice_pitch,
2008                                    size_t image_height,
2009                                    cl_mem_object_type image_type)
2010 {
2011     size_t corrected_image_slice_pitch = image_slice_pitch;
2012     if (corrected_image_slice_pitch == 0)
2013     {
2014         switch (image_type)
2015         {
2016             case CL_MEM_OBJECT_IMAGE3D:
2017             case CL_MEM_OBJECT_IMAGE2D_ARRAY:
2018                 corrected_image_slice_pitch = image_row_pitch * image_height;
2019                 break;
2020             case CL_MEM_OBJECT_IMAGE1D_ARRAY:
2021                 corrected_image_slice_pitch = image_row_pitch;
2022                 break;
2023             default:
2024                 break;
2025         }
2026     }
2027     return corrected_image_slice_pitch;
2028 }
2029 
CaptureCreateImage2D_image_format(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,angle::ParamCapture * paramCapture)2030 void CaptureCreateImage2D_image_format(bool isCallValid,
2031                                        cl_context context,
2032                                        MemFlags flagsPacked,
2033                                        const cl_image_format *image_format,
2034                                        size_t image_width,
2035                                        size_t image_height,
2036                                        size_t image_row_pitch,
2037                                        void *host_ptr,
2038                                        cl_int *errcode_ret,
2039                                        angle::ParamCapture *paramCapture)
2040 {
2041     if (image_format)
2042     {
2043         CaptureMemory(image_format, sizeof(cl_image_format), paramCapture);
2044     }
2045 }
CaptureCreateImage2D_host_ptr(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,angle::ParamCapture * paramCapture)2046 void CaptureCreateImage2D_host_ptr(bool isCallValid,
2047                                    cl_context context,
2048                                    MemFlags flagsPacked,
2049                                    const cl_image_format *image_format,
2050                                    size_t image_width,
2051                                    size_t image_height,
2052                                    size_t image_row_pitch,
2053                                    void *host_ptr,
2054                                    cl_int *errcode_ret,
2055                                    angle::ParamCapture *paramCapture)
2056 {
2057     CaptureMemory(
2058         host_ptr,
2059         GetCorrectedImageRowPitch(image_format, image_row_pitch, image_width) * image_height,
2060         paramCapture);
2061 }
CaptureCreateImage2D_errcode_ret(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,angle::ParamCapture * paramCapture)2062 void CaptureCreateImage2D_errcode_ret(bool isCallValid,
2063                                       cl_context context,
2064                                       MemFlags flagsPacked,
2065                                       const cl_image_format *image_format,
2066                                       size_t image_width,
2067                                       size_t image_height,
2068                                       size_t image_row_pitch,
2069                                       void *host_ptr,
2070                                       cl_int *errcode_ret,
2071                                       angle::ParamCapture *paramCapture)
2072 {
2073     if (errcode_ret)
2074     {
2075         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2076     }
2077 }
CaptureCreateImage3D_image_format(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,angle::ParamCapture * paramCapture)2078 void CaptureCreateImage3D_image_format(bool isCallValid,
2079                                        cl_context context,
2080                                        MemFlags flagsPacked,
2081                                        const cl_image_format *image_format,
2082                                        size_t image_width,
2083                                        size_t image_height,
2084                                        size_t image_depth,
2085                                        size_t image_row_pitch,
2086                                        size_t image_slice_pitch,
2087                                        void *host_ptr,
2088                                        cl_int *errcode_ret,
2089                                        angle::ParamCapture *paramCapture)
2090 {
2091     if (image_format)
2092     {
2093         CaptureMemory(image_format, sizeof(cl_image_format), paramCapture);
2094     }
2095 }
CaptureCreateImage3D_host_ptr(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,angle::ParamCapture * paramCapture)2096 void CaptureCreateImage3D_host_ptr(bool isCallValid,
2097                                    cl_context context,
2098                                    MemFlags flagsPacked,
2099                                    const cl_image_format *image_format,
2100                                    size_t image_width,
2101                                    size_t image_height,
2102                                    size_t image_depth,
2103                                    size_t image_row_pitch,
2104                                    size_t image_slice_pitch,
2105                                    void *host_ptr,
2106                                    cl_int *errcode_ret,
2107                                    angle::ParamCapture *paramCapture)
2108 {
2109     size_t correctedImageRowPitch =
2110         GetCorrectedImageRowPitch(image_format, image_row_pitch, image_width);
2111     CaptureMemory(host_ptr,
2112                   GetCorrectedImageSlicePitch(correctedImageRowPitch, image_slice_pitch,
2113                                               image_height, CL_MEM_OBJECT_IMAGE3D) *
2114                       image_depth,
2115                   paramCapture);
2116 }
CaptureCreateImage3D_errcode_ret(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,angle::ParamCapture * paramCapture)2117 void CaptureCreateImage3D_errcode_ret(bool isCallValid,
2118                                       cl_context context,
2119                                       MemFlags flagsPacked,
2120                                       const cl_image_format *image_format,
2121                                       size_t image_width,
2122                                       size_t image_height,
2123                                       size_t image_depth,
2124                                       size_t image_row_pitch,
2125                                       size_t image_slice_pitch,
2126                                       void *host_ptr,
2127                                       cl_int *errcode_ret,
2128                                       angle::ParamCapture *paramCapture)
2129 {
2130     if (errcode_ret)
2131     {
2132         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2133     }
2134 }
CaptureEnqueueMarker_event(bool isCallValid,cl_command_queue command_queue,cl_event * event,angle::ParamCapture * paramCapture)2135 void CaptureEnqueueMarker_event(bool isCallValid,
2136                                 cl_command_queue command_queue,
2137                                 cl_event *event,
2138                                 angle::ParamCapture *paramCapture)
2139 {
2140     if (event)
2141     {
2142         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
2143         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
2144     }
2145 }
CaptureEnqueueWaitForEvents_event_list(bool isCallValid,cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list,angle::ParamCapture * paramCapture)2146 void CaptureEnqueueWaitForEvents_event_list(bool isCallValid,
2147                                             cl_command_queue command_queue,
2148                                             cl_uint num_events,
2149                                             const cl_event *event_list,
2150                                             angle::ParamCapture *paramCapture)
2151 {
2152     if (event_list)
2153     {
2154         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2155             event_list, num_events, paramCapture, &angle::FrameCaptureShared::getIndex);
2156     }
2157 }
CaptureGetExtensionFunctionAddress_func_name(bool isCallValid,const char * func_name,angle::ParamCapture * paramCapture)2158 void CaptureGetExtensionFunctionAddress_func_name(bool isCallValid,
2159                                                   const char *func_name,
2160                                                   angle::ParamCapture *paramCapture)
2161 {
2162     if (func_name)
2163     {
2164         CaptureString(func_name, paramCapture);
2165     }
2166 }
CaptureCreateCommandQueue_errcode_ret(bool isCallValid,cl_context context,cl_device_id device,CommandQueueProperties propertiesPacked,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2167 void CaptureCreateCommandQueue_errcode_ret(bool isCallValid,
2168                                            cl_context context,
2169                                            cl_device_id device,
2170                                            CommandQueueProperties propertiesPacked,
2171                                            cl_int *errcode_ret,
2172                                            angle::ParamCapture *paramCapture)
2173 {
2174     if (errcode_ret)
2175     {
2176         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2177     }
2178 }
CaptureCreateSampler_errcode_ret(bool isCallValid,cl_context context,cl_bool normalized_coords,AddressingMode addressing_modePacked,FilterMode filter_modePacked,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2179 void CaptureCreateSampler_errcode_ret(bool isCallValid,
2180                                       cl_context context,
2181                                       cl_bool normalized_coords,
2182                                       AddressingMode addressing_modePacked,
2183                                       FilterMode filter_modePacked,
2184                                       cl_int *errcode_ret,
2185                                       angle::ParamCapture *paramCapture)
2186 {
2187     if (errcode_ret)
2188     {
2189         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2190     }
2191 }
CaptureEnqueueTask_event_wait_list(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,angle::ParamCapture * paramCapture)2192 void CaptureEnqueueTask_event_wait_list(bool isCallValid,
2193                                         cl_command_queue command_queue,
2194                                         cl_kernel kernel,
2195                                         cl_uint num_events_in_wait_list,
2196                                         const cl_event *event_wait_list,
2197                                         cl_event *event,
2198                                         angle::ParamCapture *paramCapture)
2199 {
2200     if (event_wait_list)
2201     {
2202         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2203             event_wait_list, num_events_in_wait_list, paramCapture,
2204             &angle::FrameCaptureShared::getIndex);
2205     }
2206 }
CaptureEnqueueTask_event(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,angle::ParamCapture * paramCapture)2207 void CaptureEnqueueTask_event(bool isCallValid,
2208                               cl_command_queue command_queue,
2209                               cl_kernel kernel,
2210                               cl_uint num_events_in_wait_list,
2211                               const cl_event *event_wait_list,
2212                               cl_event *event,
2213                               angle::ParamCapture *paramCapture)
2214 {
2215     if (event)
2216     {
2217         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
2218         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
2219     }
2220 }
CaptureCreateSubBuffer_buffer_create_info(bool isCallValid,cl_mem buffer,MemFlags flagsPacked,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2221 void CaptureCreateSubBuffer_buffer_create_info(bool isCallValid,
2222                                                cl_mem buffer,
2223                                                MemFlags flagsPacked,
2224                                                cl_buffer_create_type buffer_create_type,
2225                                                const void *buffer_create_info,
2226                                                cl_int *errcode_ret,
2227                                                angle::ParamCapture *paramCapture)
2228 {
2229     if (buffer_create_info)
2230     {
2231         CaptureMemory(buffer_create_info, sizeof(cl_buffer_region), paramCapture);
2232     }
2233 }
CaptureCreateSubBuffer_errcode_ret(bool isCallValid,cl_mem buffer,MemFlags flagsPacked,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2234 void CaptureCreateSubBuffer_errcode_ret(bool isCallValid,
2235                                         cl_mem buffer,
2236                                         MemFlags flagsPacked,
2237                                         cl_buffer_create_type buffer_create_type,
2238                                         const void *buffer_create_info,
2239                                         cl_int *errcode_ret,
2240                                         angle::ParamCapture *paramCapture)
2241 {
2242     if (errcode_ret)
2243     {
2244         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2245     }
2246 }
CaptureSetMemObjectDestructorCallback_pfn_notify(bool isCallValid,cl_mem memobj,void (CL_CALLBACK * pfn_notify)(cl_mem memobj,void * user_data),void * user_data,angle::ParamCapture * paramCapture)2247 void CaptureSetMemObjectDestructorCallback_pfn_notify(
2248     bool isCallValid,
2249     cl_mem memobj,
2250     void(CL_CALLBACK *pfn_notify)(cl_mem memobj, void *user_data),
2251     void *user_data,
2252     angle::ParamCapture *paramCapture)
2253 {
2254     // Nothing to implement
2255 }
CaptureSetMemObjectDestructorCallback_user_data(bool isCallValid,cl_mem memobj,void (CL_CALLBACK * pfn_notify)(cl_mem memobj,void * user_data),void * user_data,angle::ParamCapture * paramCapture)2256 void CaptureSetMemObjectDestructorCallback_user_data(bool isCallValid,
2257                                                      cl_mem memobj,
2258                                                      void(CL_CALLBACK *pfn_notify)(cl_mem memobj,
2259                                                                                    void *user_data),
2260                                                      void *user_data,
2261                                                      angle::ParamCapture *paramCapture)
2262 {
2263     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
2264                    &paramCapture->value);
2265 }
CaptureCreateUserEvent_errcode_ret(bool isCallValid,cl_context context,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2266 void CaptureCreateUserEvent_errcode_ret(bool isCallValid,
2267                                         cl_context context,
2268                                         cl_int *errcode_ret,
2269                                         angle::ParamCapture *paramCapture)
2270 {
2271     if (errcode_ret)
2272     {
2273         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2274     }
2275 }
CaptureSetEventCallback_pfn_notify(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,angle::ParamCapture * paramCapture)2276 void CaptureSetEventCallback_pfn_notify(bool isCallValid,
2277                                         cl_event event,
2278                                         cl_int command_exec_callback_type,
2279                                         void(CL_CALLBACK *pfn_notify)(cl_event event,
2280                                                                       cl_int event_command_status,
2281                                                                       void *user_data),
2282                                         void *user_data,
2283                                         angle::ParamCapture *paramCapture)
2284 {
2285     // Nothing to implement
2286 }
CaptureSetEventCallback_user_data(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,angle::ParamCapture * paramCapture)2287 void CaptureSetEventCallback_user_data(bool isCallValid,
2288                                        cl_event event,
2289                                        cl_int command_exec_callback_type,
2290                                        void(CL_CALLBACK *pfn_notify)(cl_event event,
2291                                                                      cl_int event_command_status,
2292                                                                      void *user_data),
2293                                        void *user_data,
2294                                        angle::ParamCapture *paramCapture)
2295 {
2296     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
2297                    &paramCapture->value);
2298 }
CaptureEnqueueReadBufferRect_buffer_origin(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,angle::ParamCapture * paramCapture)2299 void CaptureEnqueueReadBufferRect_buffer_origin(bool isCallValid,
2300                                                 cl_command_queue command_queue,
2301                                                 cl_mem buffer,
2302                                                 cl_bool blocking_read,
2303                                                 const size_t *buffer_origin,
2304                                                 const size_t *host_origin,
2305                                                 const size_t *region,
2306                                                 size_t buffer_row_pitch,
2307                                                 size_t buffer_slice_pitch,
2308                                                 size_t host_row_pitch,
2309                                                 size_t host_slice_pitch,
2310                                                 void *ptr,
2311                                                 cl_uint num_events_in_wait_list,
2312                                                 const cl_event *event_wait_list,
2313                                                 cl_event *event,
2314                                                 angle::ParamCapture *paramCapture)
2315 {
2316     if (buffer_origin)
2317     {
2318         CaptureMemory(buffer_origin, 3 * sizeof(size_t), paramCapture);
2319     }
2320 }
CaptureEnqueueReadBufferRect_host_origin(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,angle::ParamCapture * paramCapture)2321 void CaptureEnqueueReadBufferRect_host_origin(bool isCallValid,
2322                                               cl_command_queue command_queue,
2323                                               cl_mem buffer,
2324                                               cl_bool blocking_read,
2325                                               const size_t *buffer_origin,
2326                                               const size_t *host_origin,
2327                                               const size_t *region,
2328                                               size_t buffer_row_pitch,
2329                                               size_t buffer_slice_pitch,
2330                                               size_t host_row_pitch,
2331                                               size_t host_slice_pitch,
2332                                               void *ptr,
2333                                               cl_uint num_events_in_wait_list,
2334                                               const cl_event *event_wait_list,
2335                                               cl_event *event,
2336                                               angle::ParamCapture *paramCapture)
2337 {
2338     if (host_origin)
2339     {
2340         CaptureMemory(host_origin, 3 * sizeof(size_t), paramCapture);
2341     }
2342 }
CaptureEnqueueReadBufferRect_region(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,angle::ParamCapture * paramCapture)2343 void CaptureEnqueueReadBufferRect_region(bool isCallValid,
2344                                          cl_command_queue command_queue,
2345                                          cl_mem buffer,
2346                                          cl_bool blocking_read,
2347                                          const size_t *buffer_origin,
2348                                          const size_t *host_origin,
2349                                          const size_t *region,
2350                                          size_t buffer_row_pitch,
2351                                          size_t buffer_slice_pitch,
2352                                          size_t host_row_pitch,
2353                                          size_t host_slice_pitch,
2354                                          void *ptr,
2355                                          cl_uint num_events_in_wait_list,
2356                                          const cl_event *event_wait_list,
2357                                          cl_event *event,
2358                                          angle::ParamCapture *paramCapture)
2359 {
2360     if (region)
2361     {
2362         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
2363     }
2364 }
CaptureEnqueueReadBufferRect_ptr(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,angle::ParamCapture * paramCapture)2365 void CaptureEnqueueReadBufferRect_ptr(bool isCallValid,
2366                                       cl_command_queue command_queue,
2367                                       cl_mem buffer,
2368                                       cl_bool blocking_read,
2369                                       const size_t *buffer_origin,
2370                                       const size_t *host_origin,
2371                                       const size_t *region,
2372                                       size_t buffer_row_pitch,
2373                                       size_t buffer_slice_pitch,
2374                                       size_t host_row_pitch,
2375                                       size_t host_slice_pitch,
2376                                       void *ptr,
2377                                       cl_uint num_events_in_wait_list,
2378                                       const cl_event *event_wait_list,
2379                                       cl_event *event,
2380                                       angle::ParamCapture *paramCapture)
2381 {
2382     if (ptr)
2383     {
2384         // According to docs, "If host_row_pitch is 0, host_row_pitch is computed as region[0]" and
2385         // "If host_slice_pitch is 0, host_slice_pitch is computed as region[1] x host_row_pitch"
2386         size_t computed_host_row_pitch = host_row_pitch != 0 ? host_row_pitch : region[0];
2387         size_t computed_host_slice_pitch =
2388             host_slice_pitch != 0 ? host_slice_pitch : computed_host_row_pitch * region[1];
2389 
2390         // According to docs, "The offset in bytes is computed as host_origin[2] x host_slice_pitch
2391         // + host_origin[1] x host_row_pitch + host_origin[0]"
2392         size_t totalOffset = (host_origin[2] * computed_host_slice_pitch +
2393                               host_origin[1] * computed_host_row_pitch + host_origin[0]);
2394 
2395         // Total size = (total offset in bytes) + (total size in bytes of desired memory including
2396         // padding)
2397         paramCapture->readBufferSizeBytes = totalOffset +
2398                                             (region[2] - 1) * computed_host_slice_pitch +
2399                                             (region[1] - 1) * computed_host_row_pitch + region[0];
2400     }
2401 }
CaptureEnqueueReadBufferRect_event_wait_list(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,angle::ParamCapture * paramCapture)2402 void CaptureEnqueueReadBufferRect_event_wait_list(bool isCallValid,
2403                                                   cl_command_queue command_queue,
2404                                                   cl_mem buffer,
2405                                                   cl_bool blocking_read,
2406                                                   const size_t *buffer_origin,
2407                                                   const size_t *host_origin,
2408                                                   const size_t *region,
2409                                                   size_t buffer_row_pitch,
2410                                                   size_t buffer_slice_pitch,
2411                                                   size_t host_row_pitch,
2412                                                   size_t host_slice_pitch,
2413                                                   void *ptr,
2414                                                   cl_uint num_events_in_wait_list,
2415                                                   const cl_event *event_wait_list,
2416                                                   cl_event *event,
2417                                                   angle::ParamCapture *paramCapture)
2418 {
2419     if (event_wait_list)
2420     {
2421         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2422             event_wait_list, num_events_in_wait_list, paramCapture,
2423             &angle::FrameCaptureShared::getIndex);
2424     }
2425 }
CaptureEnqueueReadBufferRect_event(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,angle::ParamCapture * paramCapture)2426 void CaptureEnqueueReadBufferRect_event(bool isCallValid,
2427                                         cl_command_queue command_queue,
2428                                         cl_mem buffer,
2429                                         cl_bool blocking_read,
2430                                         const size_t *buffer_origin,
2431                                         const size_t *host_origin,
2432                                         const size_t *region,
2433                                         size_t buffer_row_pitch,
2434                                         size_t buffer_slice_pitch,
2435                                         size_t host_row_pitch,
2436                                         size_t host_slice_pitch,
2437                                         void *ptr,
2438                                         cl_uint num_events_in_wait_list,
2439                                         const cl_event *event_wait_list,
2440                                         cl_event *event,
2441                                         angle::ParamCapture *paramCapture)
2442 {
2443     if (event)
2444     {
2445         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
2446         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
2447     }
2448 }
CaptureEnqueueWriteBufferRect_buffer_origin(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,angle::ParamCapture * paramCapture)2449 void CaptureEnqueueWriteBufferRect_buffer_origin(bool isCallValid,
2450                                                  cl_command_queue command_queue,
2451                                                  cl_mem buffer,
2452                                                  cl_bool blocking_write,
2453                                                  const size_t *buffer_origin,
2454                                                  const size_t *host_origin,
2455                                                  const size_t *region,
2456                                                  size_t buffer_row_pitch,
2457                                                  size_t buffer_slice_pitch,
2458                                                  size_t host_row_pitch,
2459                                                  size_t host_slice_pitch,
2460                                                  const void *ptr,
2461                                                  cl_uint num_events_in_wait_list,
2462                                                  const cl_event *event_wait_list,
2463                                                  cl_event *event,
2464                                                  angle::ParamCapture *paramCapture)
2465 {
2466     if (buffer_origin)
2467     {
2468         CaptureMemory(buffer_origin, 3 * sizeof(size_t), paramCapture);
2469     }
2470 }
CaptureEnqueueWriteBufferRect_host_origin(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,angle::ParamCapture * paramCapture)2471 void CaptureEnqueueWriteBufferRect_host_origin(bool isCallValid,
2472                                                cl_command_queue command_queue,
2473                                                cl_mem buffer,
2474                                                cl_bool blocking_write,
2475                                                const size_t *buffer_origin,
2476                                                const size_t *host_origin,
2477                                                const size_t *region,
2478                                                size_t buffer_row_pitch,
2479                                                size_t buffer_slice_pitch,
2480                                                size_t host_row_pitch,
2481                                                size_t host_slice_pitch,
2482                                                const void *ptr,
2483                                                cl_uint num_events_in_wait_list,
2484                                                const cl_event *event_wait_list,
2485                                                cl_event *event,
2486                                                angle::ParamCapture *paramCapture)
2487 {
2488     if (host_origin)
2489     {
2490         CaptureMemory(host_origin, 3 * sizeof(size_t), paramCapture);
2491     }
2492 }
CaptureEnqueueWriteBufferRect_region(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,angle::ParamCapture * paramCapture)2493 void CaptureEnqueueWriteBufferRect_region(bool isCallValid,
2494                                           cl_command_queue command_queue,
2495                                           cl_mem buffer,
2496                                           cl_bool blocking_write,
2497                                           const size_t *buffer_origin,
2498                                           const size_t *host_origin,
2499                                           const size_t *region,
2500                                           size_t buffer_row_pitch,
2501                                           size_t buffer_slice_pitch,
2502                                           size_t host_row_pitch,
2503                                           size_t host_slice_pitch,
2504                                           const void *ptr,
2505                                           cl_uint num_events_in_wait_list,
2506                                           const cl_event *event_wait_list,
2507                                           cl_event *event,
2508                                           angle::ParamCapture *paramCapture)
2509 {
2510     if (region)
2511     {
2512         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
2513     }
2514 }
CaptureEnqueueWriteBufferRect_ptr(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,angle::ParamCapture * paramCapture)2515 void CaptureEnqueueWriteBufferRect_ptr(bool isCallValid,
2516                                        cl_command_queue command_queue,
2517                                        cl_mem buffer,
2518                                        cl_bool blocking_write,
2519                                        const size_t *buffer_origin,
2520                                        const size_t *host_origin,
2521                                        const size_t *region,
2522                                        size_t buffer_row_pitch,
2523                                        size_t buffer_slice_pitch,
2524                                        size_t host_row_pitch,
2525                                        size_t host_slice_pitch,
2526                                        const void *ptr,
2527                                        cl_uint num_events_in_wait_list,
2528                                        const cl_event *event_wait_list,
2529                                        cl_event *event,
2530                                        angle::ParamCapture *paramCapture)
2531 {
2532     if (ptr)
2533     {
2534         // According to docs, "If host_row_pitch is 0, host_row_pitch is computed as region[0]" and
2535         // "If host_slice_pitch is 0, host_slice_pitch is computed as region[1] x host_row_pitch"
2536         size_t computed_host_row_pitch = host_row_pitch != 0 ? host_row_pitch : region[0];
2537         size_t computed_host_slice_pitch =
2538             host_slice_pitch != 0 ? host_slice_pitch : computed_host_row_pitch * region[1];
2539 
2540         // According to docs, "The offset in bytes is computed as host_origin[2] x host_slice_pitch
2541         // + host_origin[1] x host_row_pitch + host_origin[0]"
2542         size_t totalOffset = (host_origin[2] * computed_host_slice_pitch +
2543                               host_origin[1] * computed_host_row_pitch + host_origin[0]);
2544 
2545         // total size = (total offset in bytes) + (total size in bytes of desired memory including
2546         // padding)
2547         size_t totalSize = totalOffset + (region[2] - 1) * computed_host_slice_pitch +
2548                            (region[1] - 1) * computed_host_row_pitch + region[0];
2549         CaptureMemory(ptr, totalSize, paramCapture);
2550     }
2551 }
CaptureEnqueueWriteBufferRect_event_wait_list(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,angle::ParamCapture * paramCapture)2552 void CaptureEnqueueWriteBufferRect_event_wait_list(bool isCallValid,
2553                                                    cl_command_queue command_queue,
2554                                                    cl_mem buffer,
2555                                                    cl_bool blocking_write,
2556                                                    const size_t *buffer_origin,
2557                                                    const size_t *host_origin,
2558                                                    const size_t *region,
2559                                                    size_t buffer_row_pitch,
2560                                                    size_t buffer_slice_pitch,
2561                                                    size_t host_row_pitch,
2562                                                    size_t host_slice_pitch,
2563                                                    const void *ptr,
2564                                                    cl_uint num_events_in_wait_list,
2565                                                    const cl_event *event_wait_list,
2566                                                    cl_event *event,
2567                                                    angle::ParamCapture *paramCapture)
2568 {
2569     if (event_wait_list)
2570     {
2571         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2572             event_wait_list, num_events_in_wait_list, paramCapture,
2573             &angle::FrameCaptureShared::getIndex);
2574     }
2575 }
CaptureEnqueueWriteBufferRect_event(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,angle::ParamCapture * paramCapture)2576 void CaptureEnqueueWriteBufferRect_event(bool isCallValid,
2577                                          cl_command_queue command_queue,
2578                                          cl_mem buffer,
2579                                          cl_bool blocking_write,
2580                                          const size_t *buffer_origin,
2581                                          const size_t *host_origin,
2582                                          const size_t *region,
2583                                          size_t buffer_row_pitch,
2584                                          size_t buffer_slice_pitch,
2585                                          size_t host_row_pitch,
2586                                          size_t host_slice_pitch,
2587                                          const void *ptr,
2588                                          cl_uint num_events_in_wait_list,
2589                                          const cl_event *event_wait_list,
2590                                          cl_event *event,
2591                                          angle::ParamCapture *paramCapture)
2592 {
2593     if (event)
2594     {
2595         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
2596         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
2597     }
2598 }
CaptureEnqueueCopyBufferRect_src_origin(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,angle::ParamCapture * paramCapture)2599 void CaptureEnqueueCopyBufferRect_src_origin(bool isCallValid,
2600                                              cl_command_queue command_queue,
2601                                              cl_mem src_buffer,
2602                                              cl_mem dst_buffer,
2603                                              const size_t *src_origin,
2604                                              const size_t *dst_origin,
2605                                              const size_t *region,
2606                                              size_t src_row_pitch,
2607                                              size_t src_slice_pitch,
2608                                              size_t dst_row_pitch,
2609                                              size_t dst_slice_pitch,
2610                                              cl_uint num_events_in_wait_list,
2611                                              const cl_event *event_wait_list,
2612                                              cl_event *event,
2613                                              angle::ParamCapture *paramCapture)
2614 {
2615     if (src_origin)
2616     {
2617         CaptureMemory(src_origin, 3 * sizeof(size_t), paramCapture);
2618     }
2619 }
CaptureEnqueueCopyBufferRect_dst_origin(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,angle::ParamCapture * paramCapture)2620 void CaptureEnqueueCopyBufferRect_dst_origin(bool isCallValid,
2621                                              cl_command_queue command_queue,
2622                                              cl_mem src_buffer,
2623                                              cl_mem dst_buffer,
2624                                              const size_t *src_origin,
2625                                              const size_t *dst_origin,
2626                                              const size_t *region,
2627                                              size_t src_row_pitch,
2628                                              size_t src_slice_pitch,
2629                                              size_t dst_row_pitch,
2630                                              size_t dst_slice_pitch,
2631                                              cl_uint num_events_in_wait_list,
2632                                              const cl_event *event_wait_list,
2633                                              cl_event *event,
2634                                              angle::ParamCapture *paramCapture)
2635 {
2636     if (dst_origin)
2637     {
2638         CaptureMemory(dst_origin, 3 * sizeof(size_t), paramCapture);
2639     }
2640 }
CaptureEnqueueCopyBufferRect_region(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,angle::ParamCapture * paramCapture)2641 void CaptureEnqueueCopyBufferRect_region(bool isCallValid,
2642                                          cl_command_queue command_queue,
2643                                          cl_mem src_buffer,
2644                                          cl_mem dst_buffer,
2645                                          const size_t *src_origin,
2646                                          const size_t *dst_origin,
2647                                          const size_t *region,
2648                                          size_t src_row_pitch,
2649                                          size_t src_slice_pitch,
2650                                          size_t dst_row_pitch,
2651                                          size_t dst_slice_pitch,
2652                                          cl_uint num_events_in_wait_list,
2653                                          const cl_event *event_wait_list,
2654                                          cl_event *event,
2655                                          angle::ParamCapture *paramCapture)
2656 {
2657     if (region)
2658     {
2659         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
2660     }
2661 }
CaptureEnqueueCopyBufferRect_event_wait_list(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,angle::ParamCapture * paramCapture)2662 void CaptureEnqueueCopyBufferRect_event_wait_list(bool isCallValid,
2663                                                   cl_command_queue command_queue,
2664                                                   cl_mem src_buffer,
2665                                                   cl_mem dst_buffer,
2666                                                   const size_t *src_origin,
2667                                                   const size_t *dst_origin,
2668                                                   const size_t *region,
2669                                                   size_t src_row_pitch,
2670                                                   size_t src_slice_pitch,
2671                                                   size_t dst_row_pitch,
2672                                                   size_t dst_slice_pitch,
2673                                                   cl_uint num_events_in_wait_list,
2674                                                   const cl_event *event_wait_list,
2675                                                   cl_event *event,
2676                                                   angle::ParamCapture *paramCapture)
2677 {
2678     if (event_wait_list)
2679     {
2680         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2681             event_wait_list, num_events_in_wait_list, paramCapture,
2682             &angle::FrameCaptureShared::getIndex);
2683     }
2684 }
CaptureEnqueueCopyBufferRect_event(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,angle::ParamCapture * paramCapture)2685 void CaptureEnqueueCopyBufferRect_event(bool isCallValid,
2686                                         cl_command_queue command_queue,
2687                                         cl_mem src_buffer,
2688                                         cl_mem dst_buffer,
2689                                         const size_t *src_origin,
2690                                         const size_t *dst_origin,
2691                                         const size_t *region,
2692                                         size_t src_row_pitch,
2693                                         size_t src_slice_pitch,
2694                                         size_t dst_row_pitch,
2695                                         size_t dst_slice_pitch,
2696                                         cl_uint num_events_in_wait_list,
2697                                         const cl_event *event_wait_list,
2698                                         cl_event *event,
2699                                         angle::ParamCapture *paramCapture)
2700 {
2701     if (event)
2702     {
2703         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
2704         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
2705     }
2706 }
CaptureCreateSubDevices_properties(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,angle::ParamCapture * paramCapture)2707 void CaptureCreateSubDevices_properties(bool isCallValid,
2708                                         cl_device_id in_device,
2709                                         const cl_device_partition_property *properties,
2710                                         cl_uint num_devices,
2711                                         cl_device_id *out_devices,
2712                                         cl_uint *num_devices_ret,
2713                                         angle::ParamCapture *paramCapture)
2714 {
2715     if (properties)
2716     {
2717         size_t propertiesSize = 0;
2718         while (properties[propertiesSize++] != 0)
2719         {
2720         }
2721         CaptureMemory(properties, sizeof(cl_device_partition_property) * propertiesSize,
2722                       paramCapture);
2723     }
2724 }
CaptureCreateSubDevices_out_devices(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,angle::ParamCapture * paramCapture)2725 void CaptureCreateSubDevices_out_devices(bool isCallValid,
2726                                          cl_device_id in_device,
2727                                          const cl_device_partition_property *properties,
2728                                          cl_uint num_devices,
2729                                          cl_device_id *out_devices,
2730                                          cl_uint *num_devices_ret,
2731                                          angle::ParamCapture *paramCapture)
2732 {
2733     if (out_devices)
2734     {
2735         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLDeviceIndices(out_devices,
2736                                                                                 num_devices);
2737         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2738             out_devices, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
2739     }
2740 }
CaptureCreateSubDevices_num_devices_ret(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,angle::ParamCapture * paramCapture)2741 void CaptureCreateSubDevices_num_devices_ret(bool isCallValid,
2742                                              cl_device_id in_device,
2743                                              const cl_device_partition_property *properties,
2744                                              cl_uint num_devices,
2745                                              cl_device_id *out_devices,
2746                                              cl_uint *num_devices_ret,
2747                                              angle::ParamCapture *paramCapture)
2748 {
2749     if (num_devices_ret)
2750     {
2751         paramCapture->readBufferSizeBytes = sizeof(cl_uint);
2752     }
2753 }
CaptureCreateImage_image_format(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,angle::ParamCapture * paramCapture)2754 void CaptureCreateImage_image_format(bool isCallValid,
2755                                      cl_context context,
2756                                      MemFlags flagsPacked,
2757                                      const cl_image_format *image_format,
2758                                      const cl_image_desc *image_desc,
2759                                      void *host_ptr,
2760                                      cl_int *errcode_ret,
2761                                      angle::ParamCapture *paramCapture)
2762 {
2763     if (image_format)
2764     {
2765         CaptureMemory(image_format, sizeof(cl_image_format), paramCapture);
2766     }
2767 }
CaptureCreateImage_image_desc(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,angle::ParamCapture * paramCapture)2768 void CaptureCreateImage_image_desc(bool isCallValid,
2769                                    cl_context context,
2770                                    MemFlags flagsPacked,
2771                                    const cl_image_format *image_format,
2772                                    const cl_image_desc *image_desc,
2773                                    void *host_ptr,
2774                                    cl_int *errcode_ret,
2775                                    angle::ParamCapture *paramCapture)
2776 {
2777     if (image_desc)
2778     {
2779         CaptureMemory(image_desc, sizeof(cl_image_desc), paramCapture);
2780     }
2781 }
CaptureCreateImage_host_ptr(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,angle::ParamCapture * paramCapture)2782 void CaptureCreateImage_host_ptr(bool isCallValid,
2783                                  cl_context context,
2784                                  MemFlags flagsPacked,
2785                                  const cl_image_format *image_format,
2786                                  const cl_image_desc *image_desc,
2787                                  void *host_ptr,
2788                                  cl_int *errcode_ret,
2789                                  angle::ParamCapture *paramCapture)
2790 {
2791     if (host_ptr && image_desc)
2792     {
2793         size_t image_size             = 0;
2794         size_t correctedImageRowPitch = GetCorrectedImageRowPitch(
2795             image_format, image_desc->image_row_pitch, image_desc->image_width);
2796         size_t correctedImageSlicePitch =
2797             GetCorrectedImageSlicePitch(correctedImageRowPitch, image_desc->image_slice_pitch,
2798                                         image_desc->image_height, image_desc->image_type);
2799 
2800         switch (image_desc->image_type)
2801         {
2802             case CL_MEM_OBJECT_IMAGE1D:
2803             case CL_MEM_OBJECT_IMAGE1D_BUFFER:
2804                 image_size = correctedImageRowPitch;
2805                 break;
2806             case CL_MEM_OBJECT_IMAGE2D:
2807                 image_size = correctedImageRowPitch * image_desc->image_height;
2808                 break;
2809             case CL_MEM_OBJECT_IMAGE3D:
2810                 image_size = correctedImageSlicePitch * image_desc->image_depth;
2811                 break;
2812             case CL_MEM_OBJECT_IMAGE1D_ARRAY:
2813             case CL_MEM_OBJECT_IMAGE2D_ARRAY:
2814                 image_size = correctedImageSlicePitch * image_desc->image_array_size;
2815                 break;
2816             default:
2817                 break;
2818         }
2819 
2820         CaptureMemory(host_ptr, image_size, paramCapture);
2821     }
2822 }
CaptureCreateImage_errcode_ret(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,angle::ParamCapture * paramCapture)2823 void CaptureCreateImage_errcode_ret(bool isCallValid,
2824                                     cl_context context,
2825                                     MemFlags flagsPacked,
2826                                     const cl_image_format *image_format,
2827                                     const cl_image_desc *image_desc,
2828                                     void *host_ptr,
2829                                     cl_int *errcode_ret,
2830                                     angle::ParamCapture *paramCapture)
2831 {
2832     if (errcode_ret)
2833     {
2834         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2835     }
2836 }
CaptureCreateProgramWithBuiltInKernels_device_list(bool isCallValid,cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2837 void CaptureCreateProgramWithBuiltInKernels_device_list(bool isCallValid,
2838                                                         cl_context context,
2839                                                         cl_uint num_devices,
2840                                                         const cl_device_id *device_list,
2841                                                         const char *kernel_names,
2842                                                         cl_int *errcode_ret,
2843                                                         angle::ParamCapture *paramCapture)
2844 {
2845     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2846         device_list, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
2847 }
CaptureCreateProgramWithBuiltInKernels_kernel_names(bool isCallValid,cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2848 void CaptureCreateProgramWithBuiltInKernels_kernel_names(bool isCallValid,
2849                                                          cl_context context,
2850                                                          cl_uint num_devices,
2851                                                          const cl_device_id *device_list,
2852                                                          const char *kernel_names,
2853                                                          cl_int *errcode_ret,
2854                                                          angle::ParamCapture *paramCapture)
2855 {
2856     if (kernel_names)
2857     {
2858         CaptureString(kernel_names, paramCapture);
2859     }
2860 }
CaptureCreateProgramWithBuiltInKernels_errcode_ret(bool isCallValid,cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret,angle::ParamCapture * paramCapture)2861 void CaptureCreateProgramWithBuiltInKernels_errcode_ret(bool isCallValid,
2862                                                         cl_context context,
2863                                                         cl_uint num_devices,
2864                                                         const cl_device_id *device_list,
2865                                                         const char *kernel_names,
2866                                                         cl_int *errcode_ret,
2867                                                         angle::ParamCapture *paramCapture)
2868 {
2869     if (errcode_ret)
2870     {
2871         paramCapture->readBufferSizeBytes = sizeof(cl_int);
2872     }
2873 }
CaptureCompileProgram_device_list(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,angle::ParamCapture * paramCapture)2874 void CaptureCompileProgram_device_list(bool isCallValid,
2875                                        cl_program program,
2876                                        cl_uint num_devices,
2877                                        const cl_device_id *device_list,
2878                                        const char *options,
2879                                        cl_uint num_input_headers,
2880                                        const cl_program *input_headers,
2881                                        const char **header_include_names,
2882                                        void(CL_CALLBACK *pfn_notify)(cl_program program,
2883                                                                      void *user_data),
2884                                        void *user_data,
2885                                        angle::ParamCapture *paramCapture)
2886 {
2887     if (device_list)
2888     {
2889         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2890             device_list, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
2891     }
2892 }
CaptureCompileProgram_options(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,angle::ParamCapture * paramCapture)2893 void CaptureCompileProgram_options(bool isCallValid,
2894                                    cl_program program,
2895                                    cl_uint num_devices,
2896                                    const cl_device_id *device_list,
2897                                    const char *options,
2898                                    cl_uint num_input_headers,
2899                                    const cl_program *input_headers,
2900                                    const char **header_include_names,
2901                                    void(CL_CALLBACK *pfn_notify)(cl_program program,
2902                                                                  void *user_data),
2903                                    void *user_data,
2904                                    angle::ParamCapture *paramCapture)
2905 {
2906     if (options)
2907     {
2908         CaptureString(options, paramCapture);
2909     }
2910 }
CaptureCompileProgram_input_headers(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,angle::ParamCapture * paramCapture)2911 void CaptureCompileProgram_input_headers(bool isCallValid,
2912                                          cl_program program,
2913                                          cl_uint num_devices,
2914                                          const cl_device_id *device_list,
2915                                          const char *options,
2916                                          cl_uint num_input_headers,
2917                                          const cl_program *input_headers,
2918                                          const char **header_include_names,
2919                                          void(CL_CALLBACK *pfn_notify)(cl_program program,
2920                                                                        void *user_data),
2921                                          void *user_data,
2922                                          angle::ParamCapture *paramCapture)
2923 {
2924     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2925         input_headers, num_input_headers, paramCapture, &angle::FrameCaptureShared::getIndex);
2926 }
CaptureCompileProgram_header_include_names(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,angle::ParamCapture * paramCapture)2927 void CaptureCompileProgram_header_include_names(bool isCallValid,
2928                                                 cl_program program,
2929                                                 cl_uint num_devices,
2930                                                 const cl_device_id *device_list,
2931                                                 const char *options,
2932                                                 cl_uint num_input_headers,
2933                                                 const cl_program *input_headers,
2934                                                 const char **header_include_names,
2935                                                 void(CL_CALLBACK *pfn_notify)(cl_program program,
2936                                                                               void *user_data),
2937                                                 void *user_data,
2938                                                 angle::ParamCapture *paramCapture)
2939 {
2940     for (size_t i = 0; i < num_input_headers; ++i)
2941     {
2942         CaptureMemory(header_include_names[i], (strlen(header_include_names[i]) + 1) * sizeof(char),
2943                       paramCapture);
2944     }
2945 }
CaptureCompileProgram_pfn_notify(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,angle::ParamCapture * paramCapture)2946 void CaptureCompileProgram_pfn_notify(bool isCallValid,
2947                                       cl_program program,
2948                                       cl_uint num_devices,
2949                                       const cl_device_id *device_list,
2950                                       const char *options,
2951                                       cl_uint num_input_headers,
2952                                       const cl_program *input_headers,
2953                                       const char **header_include_names,
2954                                       void(CL_CALLBACK *pfn_notify)(cl_program program,
2955                                                                     void *user_data),
2956                                       void *user_data,
2957                                       angle::ParamCapture *paramCapture)
2958 {
2959     // Nothing to implement
2960 }
CaptureCompileProgram_user_data(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,angle::ParamCapture * paramCapture)2961 void CaptureCompileProgram_user_data(bool isCallValid,
2962                                      cl_program program,
2963                                      cl_uint num_devices,
2964                                      const cl_device_id *device_list,
2965                                      const char *options,
2966                                      cl_uint num_input_headers,
2967                                      const cl_program *input_headers,
2968                                      const char **header_include_names,
2969                                      void(CL_CALLBACK *pfn_notify)(cl_program program,
2970                                                                    void *user_data),
2971                                      void *user_data,
2972                                      angle::ParamCapture *paramCapture)
2973 {
2974     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
2975                    &paramCapture->value);
2976 }
CaptureLinkProgram_device_list(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,angle::ParamCapture * paramCapture)2977 void CaptureLinkProgram_device_list(bool isCallValid,
2978                                     cl_context context,
2979                                     cl_uint num_devices,
2980                                     const cl_device_id *device_list,
2981                                     const char *options,
2982                                     cl_uint num_input_programs,
2983                                     const cl_program *input_programs,
2984                                     void(CL_CALLBACK *pfn_notify)(cl_program program,
2985                                                                   void *user_data),
2986                                     void *user_data,
2987                                     cl_int *errcode_ret,
2988                                     angle::ParamCapture *paramCapture)
2989 {
2990     if (device_list)
2991     {
2992         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
2993             device_list, num_devices, paramCapture, &angle::FrameCaptureShared::getIndex);
2994     }
2995 }
CaptureLinkProgram_options(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,angle::ParamCapture * paramCapture)2996 void CaptureLinkProgram_options(bool isCallValid,
2997                                 cl_context context,
2998                                 cl_uint num_devices,
2999                                 const cl_device_id *device_list,
3000                                 const char *options,
3001                                 cl_uint num_input_programs,
3002                                 const cl_program *input_programs,
3003                                 void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
3004                                 void *user_data,
3005                                 cl_int *errcode_ret,
3006                                 angle::ParamCapture *paramCapture)
3007 {
3008     if (options)
3009     {
3010         CaptureString(options, paramCapture);
3011     }
3012 }
CaptureLinkProgram_input_programs(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,angle::ParamCapture * paramCapture)3013 void CaptureLinkProgram_input_programs(bool isCallValid,
3014                                        cl_context context,
3015                                        cl_uint num_devices,
3016                                        const cl_device_id *device_list,
3017                                        const char *options,
3018                                        cl_uint num_input_programs,
3019                                        const cl_program *input_programs,
3020                                        void(CL_CALLBACK *pfn_notify)(cl_program program,
3021                                                                      void *user_data),
3022                                        void *user_data,
3023                                        cl_int *errcode_ret,
3024                                        angle::ParamCapture *paramCapture)
3025 {
3026     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3027         input_programs, num_input_programs, paramCapture, &angle::FrameCaptureShared::getIndex);
3028 }
CaptureLinkProgram_pfn_notify(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,angle::ParamCapture * paramCapture)3029 void CaptureLinkProgram_pfn_notify(bool isCallValid,
3030                                    cl_context context,
3031                                    cl_uint num_devices,
3032                                    const cl_device_id *device_list,
3033                                    const char *options,
3034                                    cl_uint num_input_programs,
3035                                    const cl_program *input_programs,
3036                                    void(CL_CALLBACK *pfn_notify)(cl_program program,
3037                                                                  void *user_data),
3038                                    void *user_data,
3039                                    cl_int *errcode_ret,
3040                                    angle::ParamCapture *paramCapture)
3041 {
3042     // Nothing to implement
3043 }
CaptureLinkProgram_user_data(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,angle::ParamCapture * paramCapture)3044 void CaptureLinkProgram_user_data(bool isCallValid,
3045                                   cl_context context,
3046                                   cl_uint num_devices,
3047                                   const cl_device_id *device_list,
3048                                   const char *options,
3049                                   cl_uint num_input_programs,
3050                                   const cl_program *input_programs,
3051                                   void(CL_CALLBACK *pfn_notify)(cl_program program,
3052                                                                 void *user_data),
3053                                   void *user_data,
3054                                   cl_int *errcode_ret,
3055                                   angle::ParamCapture *paramCapture)
3056 {
3057     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
3058                    &paramCapture->value);
3059 }
CaptureLinkProgram_errcode_ret(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,angle::ParamCapture * paramCapture)3060 void CaptureLinkProgram_errcode_ret(bool isCallValid,
3061                                     cl_context context,
3062                                     cl_uint num_devices,
3063                                     const cl_device_id *device_list,
3064                                     const char *options,
3065                                     cl_uint num_input_programs,
3066                                     const cl_program *input_programs,
3067                                     void(CL_CALLBACK *pfn_notify)(cl_program program,
3068                                                                   void *user_data),
3069                                     void *user_data,
3070                                     cl_int *errcode_ret,
3071                                     angle::ParamCapture *paramCapture)
3072 {
3073     if (errcode_ret)
3074     {
3075         paramCapture->readBufferSizeBytes = sizeof(cl_int);
3076     }
3077 }
CaptureGetKernelArgInfo_param_value(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,angle::ParamCapture * paramCapture)3078 void CaptureGetKernelArgInfo_param_value(bool isCallValid,
3079                                          cl_kernel kernel,
3080                                          cl_uint arg_index,
3081                                          KernelArgInfo param_namePacked,
3082                                          size_t param_value_size,
3083                                          void *param_value,
3084                                          size_t *param_value_size_ret,
3085                                          angle::ParamCapture *paramCapture)
3086 {
3087     if (param_value)
3088     {
3089         paramCapture->readBufferSizeBytes = param_value_size;
3090     }
3091 }
CaptureGetKernelArgInfo_param_value_size_ret(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,angle::ParamCapture * paramCapture)3092 void CaptureGetKernelArgInfo_param_value_size_ret(bool isCallValid,
3093                                                   cl_kernel kernel,
3094                                                   cl_uint arg_index,
3095                                                   KernelArgInfo param_namePacked,
3096                                                   size_t param_value_size,
3097                                                   void *param_value,
3098                                                   size_t *param_value_size_ret,
3099                                                   angle::ParamCapture *paramCapture)
3100 {
3101     if (param_value_size_ret)
3102     {
3103         paramCapture->readBufferSizeBytes = sizeof(size_t);
3104     }
3105 }
CaptureEnqueueFillBuffer_pattern(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,angle::ParamCapture * paramCapture)3106 void CaptureEnqueueFillBuffer_pattern(bool isCallValid,
3107                                       cl_command_queue command_queue,
3108                                       cl_mem buffer,
3109                                       const void *pattern,
3110                                       size_t pattern_size,
3111                                       size_t offset,
3112                                       size_t size,
3113                                       cl_uint num_events_in_wait_list,
3114                                       const cl_event *event_wait_list,
3115                                       cl_event *event,
3116                                       angle::ParamCapture *paramCapture)
3117 {
3118     if (pattern)
3119     {
3120         CaptureMemory(pattern, offset + size, paramCapture);
3121     }
3122 }
CaptureEnqueueFillBuffer_event_wait_list(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,angle::ParamCapture * paramCapture)3123 void CaptureEnqueueFillBuffer_event_wait_list(bool isCallValid,
3124                                               cl_command_queue command_queue,
3125                                               cl_mem buffer,
3126                                               const void *pattern,
3127                                               size_t pattern_size,
3128                                               size_t offset,
3129                                               size_t size,
3130                                               cl_uint num_events_in_wait_list,
3131                                               const cl_event *event_wait_list,
3132                                               cl_event *event,
3133                                               angle::ParamCapture *paramCapture)
3134 {
3135     if (event_wait_list)
3136     {
3137         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3138             event_wait_list, num_events_in_wait_list, paramCapture,
3139             &angle::FrameCaptureShared::getIndex);
3140     }
3141 }
CaptureEnqueueFillBuffer_event(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,angle::ParamCapture * paramCapture)3142 void CaptureEnqueueFillBuffer_event(bool isCallValid,
3143                                     cl_command_queue command_queue,
3144                                     cl_mem buffer,
3145                                     const void *pattern,
3146                                     size_t pattern_size,
3147                                     size_t offset,
3148                                     size_t size,
3149                                     cl_uint num_events_in_wait_list,
3150                                     const cl_event *event_wait_list,
3151                                     cl_event *event,
3152                                     angle::ParamCapture *paramCapture)
3153 {
3154     if (event)
3155     {
3156         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3157         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3158     }
3159 }
CaptureEnqueueFillImage_fill_color(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,angle::ParamCapture * paramCapture)3160 void CaptureEnqueueFillImage_fill_color(bool isCallValid,
3161                                         cl_command_queue command_queue,
3162                                         cl_mem image,
3163                                         const void *fill_color,
3164                                         const size_t *origin,
3165                                         const size_t *region,
3166                                         cl_uint num_events_in_wait_list,
3167                                         const cl_event *event_wait_list,
3168                                         cl_event *event,
3169                                         angle::ParamCapture *paramCapture)
3170 {
3171     void *value = (void *)malloc(sizeof(cl_image_format));
3172     if (IsError(
3173             image->cast<Image>().getInfo(ImageInfo::Format, sizeof(cl_image_format), value, NULL)))
3174     {
3175         return;
3176     }
3177     cl_image_format imageFormat = *(cl_image_format *)value;
3178     size_t totalSize;
3179     if (imageFormat.image_channel_order == CL_DEPTH)
3180     {
3181         totalSize = sizeof(cl_float);
3182     }
3183     else
3184     {
3185         switch (imageFormat.image_channel_data_type)
3186         {
3187             case CL_SNORM_INT8:
3188             case CL_UNORM_INT8:
3189             case CL_SIGNED_INT8:
3190             case CL_UNSIGNED_INT8:
3191                 totalSize = 4 * sizeof(cl_uchar);
3192                 break;
3193             case CL_SNORM_INT16:
3194             case CL_UNORM_INT16:
3195             case CL_SIGNED_INT16:
3196             case CL_UNSIGNED_INT16:
3197                 totalSize = 4 * sizeof(cl_ushort);
3198                 break;
3199             case CL_SIGNED_INT32:
3200                 totalSize = 4 * sizeof(cl_int);
3201                 break;
3202             case CL_UNSIGNED_INT32:
3203                 totalSize = 4 * sizeof(cl_uint);
3204                 break;
3205             case CL_HALF_FLOAT:
3206                 totalSize = 4 * sizeof(cl_half);
3207                 break;
3208             case CL_FLOAT:
3209                 totalSize = 4 * sizeof(cl_float);
3210                 break;
3211             case CL_UNORM_SHORT_565:
3212             case CL_UNORM_SHORT_555:
3213             case CL_UNORM_INT_101010:
3214                 totalSize = 4 * sizeof(cl_ushort);
3215                 break;
3216             default:
3217                 totalSize = 0;
3218                 break;
3219         }
3220     }
3221 
3222     CaptureMemory(fill_color, totalSize, paramCapture);
3223 }
CaptureEnqueueFillImage_origin(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,angle::ParamCapture * paramCapture)3224 void CaptureEnqueueFillImage_origin(bool isCallValid,
3225                                     cl_command_queue command_queue,
3226                                     cl_mem image,
3227                                     const void *fill_color,
3228                                     const size_t *origin,
3229                                     const size_t *region,
3230                                     cl_uint num_events_in_wait_list,
3231                                     const cl_event *event_wait_list,
3232                                     cl_event *event,
3233                                     angle::ParamCapture *paramCapture)
3234 {
3235     if (origin)
3236     {
3237         CaptureMemory(origin, 3 * sizeof(size_t), paramCapture);
3238     }
3239 }
CaptureEnqueueFillImage_region(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,angle::ParamCapture * paramCapture)3240 void CaptureEnqueueFillImage_region(bool isCallValid,
3241                                     cl_command_queue command_queue,
3242                                     cl_mem image,
3243                                     const void *fill_color,
3244                                     const size_t *origin,
3245                                     const size_t *region,
3246                                     cl_uint num_events_in_wait_list,
3247                                     const cl_event *event_wait_list,
3248                                     cl_event *event,
3249                                     angle::ParamCapture *paramCapture)
3250 {
3251     if (region)
3252     {
3253         CaptureMemory(region, 3 * sizeof(size_t), paramCapture);
3254     }
3255 }
CaptureEnqueueFillImage_event_wait_list(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,angle::ParamCapture * paramCapture)3256 void CaptureEnqueueFillImage_event_wait_list(bool isCallValid,
3257                                              cl_command_queue command_queue,
3258                                              cl_mem image,
3259                                              const void *fill_color,
3260                                              const size_t *origin,
3261                                              const size_t *region,
3262                                              cl_uint num_events_in_wait_list,
3263                                              const cl_event *event_wait_list,
3264                                              cl_event *event,
3265                                              angle::ParamCapture *paramCapture)
3266 {
3267     if (event_wait_list)
3268     {
3269         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3270             event_wait_list, num_events_in_wait_list, paramCapture,
3271             &angle::FrameCaptureShared::getIndex);
3272     }
3273 }
CaptureEnqueueFillImage_event(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,angle::ParamCapture * paramCapture)3274 void CaptureEnqueueFillImage_event(bool isCallValid,
3275                                    cl_command_queue command_queue,
3276                                    cl_mem image,
3277                                    const void *fill_color,
3278                                    const size_t *origin,
3279                                    const size_t *region,
3280                                    cl_uint num_events_in_wait_list,
3281                                    const cl_event *event_wait_list,
3282                                    cl_event *event,
3283                                    angle::ParamCapture *paramCapture)
3284 {
3285     if (event)
3286     {
3287         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3288         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3289     }
3290 }
CaptureEnqueueMigrateMemObjects_mem_objects(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,angle::ParamCapture * paramCapture)3291 void CaptureEnqueueMigrateMemObjects_mem_objects(bool isCallValid,
3292                                                  cl_command_queue command_queue,
3293                                                  cl_uint num_mem_objects,
3294                                                  const cl_mem *mem_objects,
3295                                                  MemMigrationFlags flagsPacked,
3296                                                  cl_uint num_events_in_wait_list,
3297                                                  const cl_event *event_wait_list,
3298                                                  cl_event *event,
3299                                                  angle::ParamCapture *paramCapture)
3300 {
3301     cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3302         mem_objects, num_mem_objects, paramCapture, &angle::FrameCaptureShared::getIndex);
3303 }
CaptureEnqueueMigrateMemObjects_event_wait_list(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,angle::ParamCapture * paramCapture)3304 void CaptureEnqueueMigrateMemObjects_event_wait_list(bool isCallValid,
3305                                                      cl_command_queue command_queue,
3306                                                      cl_uint num_mem_objects,
3307                                                      const cl_mem *mem_objects,
3308                                                      MemMigrationFlags flagsPacked,
3309                                                      cl_uint num_events_in_wait_list,
3310                                                      const cl_event *event_wait_list,
3311                                                      cl_event *event,
3312                                                      angle::ParamCapture *paramCapture)
3313 {
3314     if (event_wait_list)
3315     {
3316         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3317             event_wait_list, num_events_in_wait_list, paramCapture,
3318             &angle::FrameCaptureShared::getIndex);
3319     }
3320 }
CaptureEnqueueMigrateMemObjects_event(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,angle::ParamCapture * paramCapture)3321 void CaptureEnqueueMigrateMemObjects_event(bool isCallValid,
3322                                            cl_command_queue command_queue,
3323                                            cl_uint num_mem_objects,
3324                                            const cl_mem *mem_objects,
3325                                            MemMigrationFlags flagsPacked,
3326                                            cl_uint num_events_in_wait_list,
3327                                            const cl_event *event_wait_list,
3328                                            cl_event *event,
3329                                            angle::ParamCapture *paramCapture)
3330 {
3331     if (event)
3332     {
3333         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3334         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3335     }
3336 }
CaptureEnqueueMarkerWithWaitList_event_wait_list(bool isCallValid,cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)3337 void CaptureEnqueueMarkerWithWaitList_event_wait_list(bool isCallValid,
3338                                                       cl_command_queue command_queue,
3339                                                       cl_uint num_events_in_wait_list,
3340                                                       const cl_event *event_wait_list,
3341                                                       cl_event *event,
3342                                                       angle::ParamCapture *paramCapture)
3343 {
3344     if (event_wait_list)
3345     {
3346         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3347             event_wait_list, num_events_in_wait_list, paramCapture,
3348             &angle::FrameCaptureShared::getIndex);
3349     }
3350 }
CaptureEnqueueMarkerWithWaitList_event(bool isCallValid,cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)3351 void CaptureEnqueueMarkerWithWaitList_event(bool isCallValid,
3352                                             cl_command_queue command_queue,
3353                                             cl_uint num_events_in_wait_list,
3354                                             const cl_event *event_wait_list,
3355                                             cl_event *event,
3356                                             angle::ParamCapture *paramCapture)
3357 {
3358     if (event)
3359     {
3360         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3361         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3362     }
3363 }
CaptureEnqueueBarrierWithWaitList_event_wait_list(bool isCallValid,cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)3364 void CaptureEnqueueBarrierWithWaitList_event_wait_list(bool isCallValid,
3365                                                        cl_command_queue command_queue,
3366                                                        cl_uint num_events_in_wait_list,
3367                                                        const cl_event *event_wait_list,
3368                                                        cl_event *event,
3369                                                        angle::ParamCapture *paramCapture)
3370 {
3371     if (event_wait_list)
3372     {
3373         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3374             event_wait_list, num_events_in_wait_list, paramCapture,
3375             &angle::FrameCaptureShared::getIndex);
3376     }
3377 }
CaptureEnqueueBarrierWithWaitList_event(bool isCallValid,cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)3378 void CaptureEnqueueBarrierWithWaitList_event(bool isCallValid,
3379                                              cl_command_queue command_queue,
3380                                              cl_uint num_events_in_wait_list,
3381                                              const cl_event *event_wait_list,
3382                                              cl_event *event,
3383                                              angle::ParamCapture *paramCapture)
3384 {
3385     if (event)
3386     {
3387         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3388         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3389     }
3390 }
CaptureGetExtensionFunctionAddressForPlatform_func_name(bool isCallValid,cl_platform_id platform,const char * func_name,angle::ParamCapture * paramCapture)3391 void CaptureGetExtensionFunctionAddressForPlatform_func_name(bool isCallValid,
3392                                                              cl_platform_id platform,
3393                                                              const char *func_name,
3394                                                              angle::ParamCapture *paramCapture)
3395 {
3396     if (func_name)
3397     {
3398         CaptureString(func_name, paramCapture);
3399     }
3400 }
CaptureCreateCommandQueueWithProperties_properties(bool isCallValid,cl_context context,cl_device_id device,const cl_queue_properties * properties,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3401 void CaptureCreateCommandQueueWithProperties_properties(bool isCallValid,
3402                                                         cl_context context,
3403                                                         cl_device_id device,
3404                                                         const cl_queue_properties *properties,
3405                                                         cl_int *errcode_ret,
3406                                                         angle::ParamCapture *paramCapture)
3407 {
3408     if (properties)
3409     {
3410         size_t propertiesSize = 0;
3411         while (properties[propertiesSize++] != 0)
3412         {
3413         }
3414         CaptureMemory((void *)properties, sizeof(cl_queue_properties) * propertiesSize,
3415                       paramCapture);
3416     }
3417 }
CaptureCreateCommandQueueWithProperties_errcode_ret(bool isCallValid,cl_context context,cl_device_id device,const cl_queue_properties * properties,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3418 void CaptureCreateCommandQueueWithProperties_errcode_ret(bool isCallValid,
3419                                                          cl_context context,
3420                                                          cl_device_id device,
3421                                                          const cl_queue_properties *properties,
3422                                                          cl_int *errcode_ret,
3423                                                          angle::ParamCapture *paramCapture)
3424 {
3425     if (errcode_ret)
3426     {
3427         paramCapture->readBufferSizeBytes = sizeof(cl_int);
3428     }
3429 }
CaptureCreatePipe_properties(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,angle::ParamCapture * paramCapture)3430 void CaptureCreatePipe_properties(bool isCallValid,
3431                                   cl_context context,
3432                                   MemFlags flagsPacked,
3433                                   cl_uint pipe_packet_size,
3434                                   cl_uint pipe_max_packets,
3435                                   const cl_pipe_properties *properties,
3436                                   cl_int *errcode_ret,
3437                                   angle::ParamCapture *paramCapture)
3438 {
3439     if (properties)
3440     {
3441         size_t propertiesSize = 0;
3442         while (properties[propertiesSize++] != 0)
3443         {
3444         }
3445         CaptureMemory((void *)properties, sizeof(cl_pipe_properties) * propertiesSize,
3446                       paramCapture);
3447     }
3448 }
CaptureCreatePipe_errcode_ret(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,angle::ParamCapture * paramCapture)3449 void CaptureCreatePipe_errcode_ret(bool isCallValid,
3450                                    cl_context context,
3451                                    MemFlags flagsPacked,
3452                                    cl_uint pipe_packet_size,
3453                                    cl_uint pipe_max_packets,
3454                                    const cl_pipe_properties *properties,
3455                                    cl_int *errcode_ret,
3456                                    angle::ParamCapture *paramCapture)
3457 {
3458     if (errcode_ret)
3459     {
3460         paramCapture->readBufferSizeBytes = sizeof(cl_int);
3461     }
3462 }
CaptureGetPipeInfo_param_value(bool isCallValid,cl_mem pipe,PipeInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)3463 void CaptureGetPipeInfo_param_value(bool isCallValid,
3464                                     cl_mem pipe,
3465                                     PipeInfo param_namePacked,
3466                                     size_t param_value_size,
3467                                     void *param_value,
3468                                     size_t *param_value_size_ret,
3469                                     angle::ParamCapture *paramCapture)
3470 {
3471     if (param_value)
3472     {
3473         paramCapture->readBufferSizeBytes = param_value_size;
3474     }
3475 }
CaptureGetPipeInfo_param_value_size_ret(bool isCallValid,cl_mem pipe,PipeInfo param_namePacked,size_t param_value_size,void * param_value,size_t * param_value_size_ret,angle::ParamCapture * paramCapture)3476 void CaptureGetPipeInfo_param_value_size_ret(bool isCallValid,
3477                                              cl_mem pipe,
3478                                              PipeInfo param_namePacked,
3479                                              size_t param_value_size,
3480                                              void *param_value,
3481                                              size_t *param_value_size_ret,
3482                                              angle::ParamCapture *paramCapture)
3483 {
3484     if (param_value_size_ret)
3485     {
3486         paramCapture->readBufferSizeBytes = sizeof(size_t);
3487     }
3488 }
CaptureSVMFree_svm_pointer(bool isCallValid,cl_context context,void * svm_pointer,angle::ParamCapture * paramCapture)3489 void CaptureSVMFree_svm_pointer(bool isCallValid,
3490                                 cl_context context,
3491                                 void *svm_pointer,
3492                                 angle::ParamCapture *paramCapture)
3493 {
3494     // Nothing to implement. svm_pointer is an SVM pointer
3495 }
CaptureCreateSamplerWithProperties_sampler_properties(bool isCallValid,cl_context context,const cl_sampler_properties * sampler_properties,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3496 void CaptureCreateSamplerWithProperties_sampler_properties(
3497     bool isCallValid,
3498     cl_context context,
3499     const cl_sampler_properties *sampler_properties,
3500     cl_int *errcode_ret,
3501     angle::ParamCapture *paramCapture)
3502 {
3503     if (sampler_properties)
3504     {
3505         size_t propertiesSize = 0;
3506         while (sampler_properties[propertiesSize++] != 0)
3507         {
3508         }
3509         CaptureMemory((void *)sampler_properties, sizeof(cl_sampler_properties) * propertiesSize,
3510                       paramCapture);
3511     }
3512 }
CaptureCreateSamplerWithProperties_errcode_ret(bool isCallValid,cl_context context,const cl_sampler_properties * sampler_properties,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3513 void CaptureCreateSamplerWithProperties_errcode_ret(bool isCallValid,
3514                                                     cl_context context,
3515                                                     const cl_sampler_properties *sampler_properties,
3516                                                     cl_int *errcode_ret,
3517                                                     angle::ParamCapture *paramCapture)
3518 {
3519     if (errcode_ret)
3520     {
3521         paramCapture->readBufferSizeBytes = sizeof(cl_int);
3522     }
3523 }
CaptureSetKernelArgSVMPointer_arg_value(bool isCallValid,cl_kernel kernel,cl_uint arg_index,const void * arg_value,angle::ParamCapture * paramCapture)3524 void CaptureSetKernelArgSVMPointer_arg_value(bool isCallValid,
3525                                              cl_kernel kernel,
3526                                              cl_uint arg_index,
3527                                              const void *arg_value,
3528                                              angle::ParamCapture *paramCapture)
3529 {
3530     // Nothing to implement. arg_value is an SVM pointer
3531 }
CaptureSetKernelExecInfo_param_value(bool isCallValid,cl_kernel kernel,KernelExecInfo param_namePacked,size_t param_value_size,const void * param_value,angle::ParamCapture * paramCapture)3532 void CaptureSetKernelExecInfo_param_value(bool isCallValid,
3533                                           cl_kernel kernel,
3534                                           KernelExecInfo param_namePacked,
3535                                           size_t param_value_size,
3536                                           const void *param_value,
3537                                           angle::ParamCapture *paramCapture)
3538 {
3539     if (param_value)
3540     {
3541         paramCapture->readBufferSizeBytes = param_value_size;
3542     }
3543 }
CaptureEnqueueSVMFree_svm_pointers(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,angle::ParamCapture * paramCapture)3544 void CaptureEnqueueSVMFree_svm_pointers(bool isCallValid,
3545                                         cl_command_queue command_queue,
3546                                         cl_uint num_svm_pointers,
3547                                         void *svm_pointers[],
3548                                         void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
3549                                                                          cl_uint num_svm_pointers,
3550                                                                          void *svm_pointers[],
3551                                                                          void *user_data),
3552                                         void *user_data,
3553                                         cl_uint num_events_in_wait_list,
3554                                         const cl_event *event_wait_list,
3555                                         cl_event *event,
3556                                         angle::ParamCapture *paramCapture)
3557 {
3558     if (svm_pointers)
3559     {
3560         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLVoidVectorIndex(
3561             const_cast<const void **>(svm_pointers), num_svm_pointers, paramCapture);
3562     }
3563 }
CaptureEnqueueSVMFree_pfn_free_func(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,angle::ParamCapture * paramCapture)3564 void CaptureEnqueueSVMFree_pfn_free_func(bool isCallValid,
3565                                          cl_command_queue command_queue,
3566                                          cl_uint num_svm_pointers,
3567                                          void *svm_pointers[],
3568                                          void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
3569                                                                           cl_uint num_svm_pointers,
3570                                                                           void *svm_pointers[],
3571                                                                           void *user_data),
3572                                          void *user_data,
3573                                          cl_uint num_events_in_wait_list,
3574                                          const cl_event *event_wait_list,
3575                                          cl_event *event,
3576                                          angle::ParamCapture *paramCapture)
3577 {
3578     // Nothing to implement
3579 }
CaptureEnqueueSVMFree_user_data(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,angle::ParamCapture * paramCapture)3580 void CaptureEnqueueSVMFree_user_data(bool isCallValid,
3581                                      cl_command_queue command_queue,
3582                                      cl_uint num_svm_pointers,
3583                                      void *svm_pointers[],
3584                                      void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
3585                                                                       cl_uint num_svm_pointers,
3586                                                                       void *svm_pointers[],
3587                                                                       void *user_data),
3588                                      void *user_data,
3589                                      cl_uint num_events_in_wait_list,
3590                                      const cl_event *event_wait_list,
3591                                      cl_event *event,
3592                                      angle::ParamCapture *paramCapture)
3593 {
3594     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
3595                    &paramCapture->value);
3596 }
CaptureEnqueueSVMFree_event_wait_list(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,angle::ParamCapture * paramCapture)3597 void CaptureEnqueueSVMFree_event_wait_list(
3598     bool isCallValid,
3599     cl_command_queue command_queue,
3600     cl_uint num_svm_pointers,
3601     void *svm_pointers[],
3602     void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
3603                                      cl_uint num_svm_pointers,
3604                                      void *svm_pointers[],
3605                                      void *user_data),
3606     void *user_data,
3607     cl_uint num_events_in_wait_list,
3608     const cl_event *event_wait_list,
3609     cl_event *event,
3610     angle::ParamCapture *paramCapture)
3611 {
3612     if (event_wait_list)
3613     {
3614         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3615             event_wait_list, num_events_in_wait_list, paramCapture,
3616             &angle::FrameCaptureShared::getIndex);
3617     }
3618 }
CaptureEnqueueSVMFree_event(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,angle::ParamCapture * paramCapture)3619 void CaptureEnqueueSVMFree_event(bool isCallValid,
3620                                  cl_command_queue command_queue,
3621                                  cl_uint num_svm_pointers,
3622                                  void *svm_pointers[],
3623                                  void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
3624                                                                   cl_uint num_svm_pointers,
3625                                                                   void *svm_pointers[],
3626                                                                   void *user_data),
3627                                  void *user_data,
3628                                  cl_uint num_events_in_wait_list,
3629                                  const cl_event *event_wait_list,
3630                                  cl_event *event,
3631                                  angle::ParamCapture *paramCapture)
3632 {
3633     if (event)
3634     {
3635         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3636         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3637     }
3638 }
CaptureEnqueueSVMMemcpy_dst_ptr(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,angle::ParamCapture * paramCapture)3639 void CaptureEnqueueSVMMemcpy_dst_ptr(bool isCallValid,
3640                                      cl_command_queue command_queue,
3641                                      cl_bool blocking_copy,
3642                                      void *dst_ptr,
3643                                      const void *src_ptr,
3644                                      size_t size,
3645                                      cl_uint num_events_in_wait_list,
3646                                      const cl_event *event_wait_list,
3647                                      cl_event *event,
3648                                      angle::ParamCapture *paramCapture)
3649 {
3650     if (src_ptr &&
3651         cl::Platform::GetDefault()->getFrameCaptureShared()->getCLVoidIndex(src_ptr) == SIZE_MAX)
3652     {
3653         paramCapture->readBufferSizeBytes = size;
3654     }
3655 }
CaptureEnqueueSVMMemcpy_src_ptr(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,angle::ParamCapture * paramCapture)3656 void CaptureEnqueueSVMMemcpy_src_ptr(bool isCallValid,
3657                                      cl_command_queue command_queue,
3658                                      cl_bool blocking_copy,
3659                                      void *dst_ptr,
3660                                      const void *src_ptr,
3661                                      size_t size,
3662                                      cl_uint num_events_in_wait_list,
3663                                      const cl_event *event_wait_list,
3664                                      cl_event *event,
3665                                      angle::ParamCapture *paramCapture)
3666 {
3667     if (src_ptr &&
3668         cl::Platform::GetDefault()->getFrameCaptureShared()->getCLVoidIndex(src_ptr) == SIZE_MAX)
3669     {
3670         CaptureMemory(src_ptr, size, paramCapture);
3671     }
3672 }
CaptureEnqueueSVMMemcpy_event_wait_list(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,angle::ParamCapture * paramCapture)3673 void CaptureEnqueueSVMMemcpy_event_wait_list(bool isCallValid,
3674                                              cl_command_queue command_queue,
3675                                              cl_bool blocking_copy,
3676                                              void *dst_ptr,
3677                                              const void *src_ptr,
3678                                              size_t size,
3679                                              cl_uint num_events_in_wait_list,
3680                                              const cl_event *event_wait_list,
3681                                              cl_event *event,
3682                                              angle::ParamCapture *paramCapture)
3683 {
3684     if (event_wait_list)
3685     {
3686         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3687             event_wait_list, num_events_in_wait_list, paramCapture,
3688             &angle::FrameCaptureShared::getIndex);
3689     }
3690 }
CaptureEnqueueSVMMemcpy_event(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,angle::ParamCapture * paramCapture)3691 void CaptureEnqueueSVMMemcpy_event(bool isCallValid,
3692                                    cl_command_queue command_queue,
3693                                    cl_bool blocking_copy,
3694                                    void *dst_ptr,
3695                                    const void *src_ptr,
3696                                    size_t size,
3697                                    cl_uint num_events_in_wait_list,
3698                                    const cl_event *event_wait_list,
3699                                    cl_event *event,
3700                                    angle::ParamCapture *paramCapture)
3701 {
3702     if (event)
3703     {
3704         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3705         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3706     }
3707 }
CaptureEnqueueSVMMemFill_svm_ptr(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,angle::ParamCapture * paramCapture)3708 void CaptureEnqueueSVMMemFill_svm_ptr(bool isCallValid,
3709                                       cl_command_queue command_queue,
3710                                       void *svm_ptr,
3711                                       const void *pattern,
3712                                       size_t pattern_size,
3713                                       size_t size,
3714                                       cl_uint num_events_in_wait_list,
3715                                       const cl_event *event_wait_list,
3716                                       cl_event *event,
3717                                       angle::ParamCapture *paramCapture)
3718 {
3719     // Nothing to implement. svm_ptr is an SVM pointer
3720 }
CaptureEnqueueSVMMemFill_pattern(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,angle::ParamCapture * paramCapture)3721 void CaptureEnqueueSVMMemFill_pattern(bool isCallValid,
3722                                       cl_command_queue command_queue,
3723                                       void *svm_ptr,
3724                                       const void *pattern,
3725                                       size_t pattern_size,
3726                                       size_t size,
3727                                       cl_uint num_events_in_wait_list,
3728                                       const cl_event *event_wait_list,
3729                                       cl_event *event,
3730                                       angle::ParamCapture *paramCapture)
3731 {
3732     if (pattern)
3733     {
3734         CaptureMemory(pattern, pattern_size, paramCapture);
3735     }
3736 }
CaptureEnqueueSVMMemFill_event_wait_list(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,angle::ParamCapture * paramCapture)3737 void CaptureEnqueueSVMMemFill_event_wait_list(bool isCallValid,
3738                                               cl_command_queue command_queue,
3739                                               void *svm_ptr,
3740                                               const void *pattern,
3741                                               size_t pattern_size,
3742                                               size_t size,
3743                                               cl_uint num_events_in_wait_list,
3744                                               const cl_event *event_wait_list,
3745                                               cl_event *event,
3746                                               angle::ParamCapture *paramCapture)
3747 {
3748     if (event_wait_list)
3749     {
3750         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3751             event_wait_list, num_events_in_wait_list, paramCapture,
3752             &angle::FrameCaptureShared::getIndex);
3753     }
3754 }
CaptureEnqueueSVMMemFill_event(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,angle::ParamCapture * paramCapture)3755 void CaptureEnqueueSVMMemFill_event(bool isCallValid,
3756                                     cl_command_queue command_queue,
3757                                     void *svm_ptr,
3758                                     const void *pattern,
3759                                     size_t pattern_size,
3760                                     size_t size,
3761                                     cl_uint num_events_in_wait_list,
3762                                     const cl_event *event_wait_list,
3763                                     cl_event *event,
3764                                     angle::ParamCapture *paramCapture)
3765 {
3766     if (event)
3767     {
3768         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3769         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3770     }
3771 }
CaptureEnqueueSVMMap_svm_ptr(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,angle::ParamCapture * paramCapture)3772 void CaptureEnqueueSVMMap_svm_ptr(bool isCallValid,
3773                                   cl_command_queue command_queue,
3774                                   cl_bool blocking_map,
3775                                   MapFlags flagsPacked,
3776                                   void *svm_ptr,
3777                                   size_t size,
3778                                   cl_uint num_events_in_wait_list,
3779                                   const cl_event *event_wait_list,
3780                                   cl_event *event,
3781                                   angle::ParamCapture *paramCapture)
3782 {
3783     // Nothing to implement. svm_ptr is an SVM pointer
3784 }
CaptureEnqueueSVMMap_event_wait_list(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,angle::ParamCapture * paramCapture)3785 void CaptureEnqueueSVMMap_event_wait_list(bool isCallValid,
3786                                           cl_command_queue command_queue,
3787                                           cl_bool blocking_map,
3788                                           MapFlags flagsPacked,
3789                                           void *svm_ptr,
3790                                           size_t size,
3791                                           cl_uint num_events_in_wait_list,
3792                                           const cl_event *event_wait_list,
3793                                           cl_event *event,
3794                                           angle::ParamCapture *paramCapture)
3795 {
3796     if (event_wait_list)
3797     {
3798         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3799             event_wait_list, num_events_in_wait_list, paramCapture,
3800             &angle::FrameCaptureShared::getIndex);
3801     }
3802 }
CaptureEnqueueSVMMap_event(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,angle::ParamCapture * paramCapture)3803 void CaptureEnqueueSVMMap_event(bool isCallValid,
3804                                 cl_command_queue command_queue,
3805                                 cl_bool blocking_map,
3806                                 MapFlags flagsPacked,
3807                                 void *svm_ptr,
3808                                 size_t size,
3809                                 cl_uint num_events_in_wait_list,
3810                                 const cl_event *event_wait_list,
3811                                 cl_event *event,
3812                                 angle::ParamCapture *paramCapture)
3813 {
3814     if (event)
3815     {
3816         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3817         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3818     }
3819 }
CaptureEnqueueSVMUnmap_svm_ptr(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,angle::ParamCapture * paramCapture)3820 void CaptureEnqueueSVMUnmap_svm_ptr(bool isCallValid,
3821                                     cl_command_queue command_queue,
3822                                     void *svm_ptr,
3823                                     cl_uint num_events_in_wait_list,
3824                                     const cl_event *event_wait_list,
3825                                     cl_event *event,
3826                                     angle::ParamCapture *paramCapture)
3827 {
3828     // Nothing to implement. svm_ptr is an SVM pointer
3829 }
CaptureEnqueueSVMUnmap_event_wait_list(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,angle::ParamCapture * paramCapture)3830 void CaptureEnqueueSVMUnmap_event_wait_list(bool isCallValid,
3831                                             cl_command_queue command_queue,
3832                                             void *svm_ptr,
3833                                             cl_uint num_events_in_wait_list,
3834                                             const cl_event *event_wait_list,
3835                                             cl_event *event,
3836                                             angle::ParamCapture *paramCapture)
3837 {
3838     if (event_wait_list)
3839     {
3840         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
3841             event_wait_list, num_events_in_wait_list, paramCapture,
3842             &angle::FrameCaptureShared::getIndex);
3843     }
3844 }
CaptureEnqueueSVMUnmap_event(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,angle::ParamCapture * paramCapture)3845 void CaptureEnqueueSVMUnmap_event(bool isCallValid,
3846                                   cl_command_queue command_queue,
3847                                   void *svm_ptr,
3848                                   cl_uint num_events_in_wait_list,
3849                                   const cl_event *event_wait_list,
3850                                   cl_event *event,
3851                                   angle::ParamCapture *paramCapture)
3852 {
3853     if (event)
3854     {
3855         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
3856         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
3857     }
3858 }
CaptureGetDeviceAndHostTimer_device_timestamp(bool isCallValid,cl_device_id device,cl_ulong * device_timestamp,cl_ulong * host_timestamp,angle::ParamCapture * paramCapture)3859 void CaptureGetDeviceAndHostTimer_device_timestamp(bool isCallValid,
3860                                                    cl_device_id device,
3861                                                    cl_ulong *device_timestamp,
3862                                                    cl_ulong *host_timestamp,
3863                                                    angle::ParamCapture *paramCapture)
3864 {
3865     if (device_timestamp)
3866     {
3867         paramCapture->readBufferSizeBytes = sizeof(cl_ulong);
3868     }
3869 }
CaptureGetDeviceAndHostTimer_host_timestamp(bool isCallValid,cl_device_id device,cl_ulong * device_timestamp,cl_ulong * host_timestamp,angle::ParamCapture * paramCapture)3870 void CaptureGetDeviceAndHostTimer_host_timestamp(bool isCallValid,
3871                                                  cl_device_id device,
3872                                                  cl_ulong *device_timestamp,
3873                                                  cl_ulong *host_timestamp,
3874                                                  angle::ParamCapture *paramCapture)
3875 {
3876     if (host_timestamp)
3877     {
3878         paramCapture->readBufferSizeBytes = sizeof(cl_ulong);
3879     }
3880 }
CaptureGetHostTimer_host_timestamp(bool isCallValid,cl_device_id device,cl_ulong * host_timestamp,angle::ParamCapture * paramCapture)3881 void CaptureGetHostTimer_host_timestamp(bool isCallValid,
3882                                         cl_device_id device,
3883                                         cl_ulong *host_timestamp,
3884                                         angle::ParamCapture *paramCapture)
3885 {
3886     if (host_timestamp)
3887     {
3888         paramCapture->readBufferSizeBytes = sizeof(cl_ulong);
3889     }
3890 }
CaptureCreateProgramWithIL_il(bool isCallValid,cl_context context,const void * il,size_t length,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3891 void CaptureCreateProgramWithIL_il(bool isCallValid,
3892                                    cl_context context,
3893                                    const void *il,
3894                                    size_t length,
3895                                    cl_int *errcode_ret,
3896                                    angle::ParamCapture *paramCapture)
3897 {
3898     if (il)
3899     {
3900         CaptureMemory(il, length, paramCapture);
3901     }
3902 }
CaptureCreateProgramWithIL_errcode_ret(bool isCallValid,cl_context context,const void * il,size_t length,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3903 void CaptureCreateProgramWithIL_errcode_ret(bool isCallValid,
3904                                             cl_context context,
3905                                             const void *il,
3906                                             size_t length,
3907                                             cl_int *errcode_ret,
3908                                             angle::ParamCapture *paramCapture)
3909 {
3910     if (errcode_ret)
3911     {
3912         paramCapture->readBufferSizeBytes = sizeof(cl_int);
3913     }
3914 }
CaptureCloneKernel_errcode_ret(bool isCallValid,cl_kernel source_kernel,cl_int * errcode_ret,angle::ParamCapture * paramCapture)3915 void CaptureCloneKernel_errcode_ret(bool isCallValid,
3916                                     cl_kernel source_kernel,
3917                                     cl_int *errcode_ret,
3918                                     angle::ParamCapture *paramCapture)
3919 {
3920     if (errcode_ret)
3921     {
3922         paramCapture->readBufferSizeBytes = sizeof(cl_int);
3923     }
3924 }
CaptureGetKernelSubGroupInfo_input_value(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,angle::ParamCapture * paramCapture)3925 void CaptureGetKernelSubGroupInfo_input_value(bool isCallValid,
3926                                               cl_kernel kernel,
3927                                               cl_device_id device,
3928                                               KernelSubGroupInfo param_namePacked,
3929                                               size_t input_value_size,
3930                                               const void *input_value,
3931                                               size_t param_value_size,
3932                                               void *param_value,
3933                                               size_t *param_value_size_ret,
3934                                               angle::ParamCapture *paramCapture)
3935 {
3936     if (input_value)
3937     {
3938         CaptureMemory(input_value, input_value_size, paramCapture);
3939     }
3940 }
CaptureGetKernelSubGroupInfo_param_value(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,angle::ParamCapture * paramCapture)3941 void CaptureGetKernelSubGroupInfo_param_value(bool isCallValid,
3942                                               cl_kernel kernel,
3943                                               cl_device_id device,
3944                                               KernelSubGroupInfo param_namePacked,
3945                                               size_t input_value_size,
3946                                               const void *input_value,
3947                                               size_t param_value_size,
3948                                               void *param_value,
3949                                               size_t *param_value_size_ret,
3950                                               angle::ParamCapture *paramCapture)
3951 {
3952     if (param_value)
3953     {
3954         paramCapture->readBufferSizeBytes = param_value_size;
3955     }
3956 }
CaptureGetKernelSubGroupInfo_param_value_size_ret(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,angle::ParamCapture * paramCapture)3957 void CaptureGetKernelSubGroupInfo_param_value_size_ret(bool isCallValid,
3958                                                        cl_kernel kernel,
3959                                                        cl_device_id device,
3960                                                        KernelSubGroupInfo param_namePacked,
3961                                                        size_t input_value_size,
3962                                                        const void *input_value,
3963                                                        size_t param_value_size,
3964                                                        void *param_value,
3965                                                        size_t *param_value_size_ret,
3966                                                        angle::ParamCapture *paramCapture)
3967 {
3968     if (param_value_size_ret)
3969     {
3970         paramCapture->readBufferSizeBytes = sizeof(size_t);
3971     }
3972 }
CaptureEnqueueSVMMigrateMem_svm_pointers(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,angle::ParamCapture * paramCapture)3973 void CaptureEnqueueSVMMigrateMem_svm_pointers(bool isCallValid,
3974                                               cl_command_queue command_queue,
3975                                               cl_uint num_svm_pointers,
3976                                               const void **svm_pointers,
3977                                               const size_t *sizes,
3978                                               MemMigrationFlags flagsPacked,
3979                                               cl_uint num_events_in_wait_list,
3980                                               const cl_event *event_wait_list,
3981                                               cl_event *event,
3982                                               angle::ParamCapture *paramCapture)
3983 {
3984     if (svm_pointers)
3985     {
3986         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLVoidVectorIndex(
3987             svm_pointers, num_svm_pointers, paramCapture);
3988     }
3989 }
CaptureEnqueueSVMMigrateMem_sizes(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,angle::ParamCapture * paramCapture)3990 void CaptureEnqueueSVMMigrateMem_sizes(bool isCallValid,
3991                                        cl_command_queue command_queue,
3992                                        cl_uint num_svm_pointers,
3993                                        const void **svm_pointers,
3994                                        const size_t *sizes,
3995                                        MemMigrationFlags flagsPacked,
3996                                        cl_uint num_events_in_wait_list,
3997                                        const cl_event *event_wait_list,
3998                                        cl_event *event,
3999                                        angle::ParamCapture *paramCapture)
4000 {
4001     if (sizes)
4002     {
4003         CaptureMemory(sizes, num_svm_pointers * sizeof(size_t), paramCapture);
4004     }
4005 }
CaptureEnqueueSVMMigrateMem_event_wait_list(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,angle::ParamCapture * paramCapture)4006 void CaptureEnqueueSVMMigrateMem_event_wait_list(bool isCallValid,
4007                                                  cl_command_queue command_queue,
4008                                                  cl_uint num_svm_pointers,
4009                                                  const void **svm_pointers,
4010                                                  const size_t *sizes,
4011                                                  MemMigrationFlags flagsPacked,
4012                                                  cl_uint num_events_in_wait_list,
4013                                                  const cl_event *event_wait_list,
4014                                                  cl_event *event,
4015                                                  angle::ParamCapture *paramCapture)
4016 {
4017     if (event_wait_list)
4018     {
4019         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
4020             event_wait_list, num_events_in_wait_list, paramCapture,
4021             &angle::FrameCaptureShared::getIndex);
4022     }
4023 }
CaptureEnqueueSVMMigrateMem_event(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,angle::ParamCapture * paramCapture)4024 void CaptureEnqueueSVMMigrateMem_event(bool isCallValid,
4025                                        cl_command_queue command_queue,
4026                                        cl_uint num_svm_pointers,
4027                                        const void **svm_pointers,
4028                                        const size_t *sizes,
4029                                        MemMigrationFlags flagsPacked,
4030                                        cl_uint num_events_in_wait_list,
4031                                        const cl_event *event_wait_list,
4032                                        cl_event *event,
4033                                        angle::ParamCapture *paramCapture)
4034 {
4035     if (event)
4036     {
4037         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
4038         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
4039     }
4040 }
CaptureSetProgramReleaseCallback_pfn_notify(bool isCallValid,cl_program program,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,angle::ParamCapture * paramCapture)4041 void CaptureSetProgramReleaseCallback_pfn_notify(bool isCallValid,
4042                                                  cl_program program,
4043                                                  void(CL_CALLBACK *pfn_notify)(cl_program program,
4044                                                                                void *user_data),
4045                                                  void *user_data,
4046                                                  angle::ParamCapture *paramCapture)
4047 {
4048     // Nothing to implement
4049 }
CaptureSetProgramReleaseCallback_user_data(bool isCallValid,cl_program program,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,angle::ParamCapture * paramCapture)4050 void CaptureSetProgramReleaseCallback_user_data(bool isCallValid,
4051                                                 cl_program program,
4052                                                 void(CL_CALLBACK *pfn_notify)(cl_program program,
4053                                                                               void *user_data),
4054                                                 void *user_data,
4055                                                 angle::ParamCapture *paramCapture)
4056 {
4057     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
4058                    &paramCapture->value);
4059 }
CaptureSetProgramSpecializationConstant_spec_value(bool isCallValid,cl_program program,cl_uint spec_id,size_t spec_size,const void * spec_value,angle::ParamCapture * paramCapture)4060 void CaptureSetProgramSpecializationConstant_spec_value(bool isCallValid,
4061                                                         cl_program program,
4062                                                         cl_uint spec_id,
4063                                                         size_t spec_size,
4064                                                         const void *spec_value,
4065                                                         angle::ParamCapture *paramCapture)
4066 {
4067     if (spec_value)
4068     {
4069         CaptureMemory(spec_value, spec_size, paramCapture);
4070     }
4071 }
CaptureSetContextDestructorCallback_pfn_notify(bool isCallValid,cl_context context,void (CL_CALLBACK * pfn_notify)(cl_context context,void * user_data),void * user_data,angle::ParamCapture * paramCapture)4072 void CaptureSetContextDestructorCallback_pfn_notify(
4073     bool isCallValid,
4074     cl_context context,
4075     void(CL_CALLBACK *pfn_notify)(cl_context context, void *user_data),
4076     void *user_data,
4077     angle::ParamCapture *paramCapture)
4078 {
4079     // Nothing to implement
4080 }
CaptureSetContextDestructorCallback_user_data(bool isCallValid,cl_context context,void (CL_CALLBACK * pfn_notify)(cl_context context,void * user_data),void * user_data,angle::ParamCapture * paramCapture)4081 void CaptureSetContextDestructorCallback_user_data(bool isCallValid,
4082                                                    cl_context context,
4083                                                    void(CL_CALLBACK *pfn_notify)(cl_context context,
4084                                                                                  void *user_data),
4085                                                    void *user_data,
4086                                                    angle::ParamCapture *paramCapture)
4087 {
4088     InitParamValue(angle::ParamType::TvoidPointer, static_cast<void *>(nullptr),
4089                    &paramCapture->value);
4090 }
CaptureCreateBufferWithProperties_properties(bool isCallValid,cl_context context,const cl_mem_properties * properties,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,angle::ParamCapture * paramCapture)4091 void CaptureCreateBufferWithProperties_properties(bool isCallValid,
4092                                                   cl_context context,
4093                                                   const cl_mem_properties *properties,
4094                                                   MemFlags flagsPacked,
4095                                                   size_t size,
4096                                                   void *host_ptr,
4097                                                   cl_int *errcode_ret,
4098                                                   angle::ParamCapture *paramCapture)
4099 {
4100     if (properties)
4101     {
4102         size_t propertiesSize = 0;
4103         while (properties[propertiesSize++] != 0)
4104         {
4105         }
4106         CaptureMemory(properties, propertiesSize, paramCapture);
4107     }
4108 }
CaptureCreateBufferWithProperties_host_ptr(bool isCallValid,cl_context context,const cl_mem_properties * properties,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,angle::ParamCapture * paramCapture)4109 void CaptureCreateBufferWithProperties_host_ptr(bool isCallValid,
4110                                                 cl_context context,
4111                                                 const cl_mem_properties *properties,
4112                                                 MemFlags flagsPacked,
4113                                                 size_t size,
4114                                                 void *host_ptr,
4115                                                 cl_int *errcode_ret,
4116                                                 angle::ParamCapture *paramCapture)
4117 {
4118     if (host_ptr)
4119     {
4120         CaptureMemory(host_ptr, size, paramCapture);
4121     }
4122 }
CaptureCreateBufferWithProperties_errcode_ret(bool isCallValid,cl_context context,const cl_mem_properties * properties,MemFlags flagsPacked,size_t size,void * host_ptr,cl_int * errcode_ret,angle::ParamCapture * paramCapture)4123 void CaptureCreateBufferWithProperties_errcode_ret(bool isCallValid,
4124                                                    cl_context context,
4125                                                    const cl_mem_properties *properties,
4126                                                    MemFlags flagsPacked,
4127                                                    size_t size,
4128                                                    void *host_ptr,
4129                                                    cl_int *errcode_ret,
4130                                                    angle::ParamCapture *paramCapture)
4131 {
4132     if (errcode_ret)
4133     {
4134         paramCapture->readBufferSizeBytes = sizeof(cl_int);
4135     }
4136 }
CaptureCreateImageWithProperties_properties(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,angle::ParamCapture * paramCapture)4137 void CaptureCreateImageWithProperties_properties(bool isCallValid,
4138                                                  cl_context context,
4139                                                  const cl_mem_properties *properties,
4140                                                  MemFlags flagsPacked,
4141                                                  const cl_image_format *image_format,
4142                                                  const cl_image_desc *image_desc,
4143                                                  void *host_ptr,
4144                                                  cl_int *errcode_ret,
4145                                                  angle::ParamCapture *paramCapture)
4146 {
4147     if (properties)
4148     {
4149         CaptureMemory(properties, sizeof(cl_mem_properties), paramCapture);
4150     }
4151 }
CaptureCreateImageWithProperties_image_format(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,angle::ParamCapture * paramCapture)4152 void CaptureCreateImageWithProperties_image_format(bool isCallValid,
4153                                                    cl_context context,
4154                                                    const cl_mem_properties *properties,
4155                                                    MemFlags flagsPacked,
4156                                                    const cl_image_format *image_format,
4157                                                    const cl_image_desc *image_desc,
4158                                                    void *host_ptr,
4159                                                    cl_int *errcode_ret,
4160                                                    angle::ParamCapture *paramCapture)
4161 {
4162     if (image_format)
4163     {
4164         CaptureMemory(image_format, sizeof(cl_image_format), paramCapture);
4165     }
4166 }
CaptureCreateImageWithProperties_image_desc(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,angle::ParamCapture * paramCapture)4167 void CaptureCreateImageWithProperties_image_desc(bool isCallValid,
4168                                                  cl_context context,
4169                                                  const cl_mem_properties *properties,
4170                                                  MemFlags flagsPacked,
4171                                                  const cl_image_format *image_format,
4172                                                  const cl_image_desc *image_desc,
4173                                                  void *host_ptr,
4174                                                  cl_int *errcode_ret,
4175                                                  angle::ParamCapture *paramCapture)
4176 {
4177     if (image_desc)
4178     {
4179         CaptureMemory(image_desc, sizeof(cl_image_desc), paramCapture);
4180     }
4181 }
CaptureCreateImageWithProperties_host_ptr(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,angle::ParamCapture * paramCapture)4182 void CaptureCreateImageWithProperties_host_ptr(bool isCallValid,
4183                                                cl_context context,
4184                                                const cl_mem_properties *properties,
4185                                                MemFlags flagsPacked,
4186                                                const cl_image_format *image_format,
4187                                                const cl_image_desc *image_desc,
4188                                                void *host_ptr,
4189                                                cl_int *errcode_ret,
4190                                                angle::ParamCapture *paramCapture)
4191 {
4192     if (host_ptr && image_desc)
4193     {
4194         size_t image_size = 0;
4195         switch (image_desc->image_type)
4196         {
4197             case CL_MEM_OBJECT_IMAGE1D:
4198             case CL_MEM_OBJECT_IMAGE1D_BUFFER:
4199                 image_size = image_desc->image_row_pitch;
4200                 break;
4201             case CL_MEM_OBJECT_IMAGE2D:
4202                 image_size = image_desc->image_row_pitch * image_desc->image_height;
4203                 break;
4204             case CL_MEM_OBJECT_IMAGE3D:
4205                 image_size = image_desc->image_slice_pitch * image_desc->image_depth;
4206                 break;
4207             case CL_MEM_OBJECT_IMAGE1D_ARRAY:
4208             case CL_MEM_OBJECT_IMAGE2D_ARRAY:
4209                 image_size = image_desc->image_slice_pitch * image_desc->image_array_size;
4210                 break;
4211             default:
4212                 break;
4213         }
4214 
4215         // Add a buffer
4216         image_size += 16;
4217 
4218         CaptureMemory(host_ptr, sizeof(image_size), paramCapture);
4219     }
4220 }
CaptureCreateImageWithProperties_errcode_ret(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,angle::ParamCapture * paramCapture)4221 void CaptureCreateImageWithProperties_errcode_ret(bool isCallValid,
4222                                                   cl_context context,
4223                                                   const cl_mem_properties *properties,
4224                                                   MemFlags flagsPacked,
4225                                                   const cl_image_format *image_format,
4226                                                   const cl_image_desc *image_desc,
4227                                                   void *host_ptr,
4228                                                   cl_int *errcode_ret,
4229                                                   angle::ParamCapture *paramCapture)
4230 {
4231     if (errcode_ret)
4232     {
4233         paramCapture->readBufferSizeBytes = sizeof(cl_int);
4234     }
4235 }
4236 
CaptureEnqueueAcquireExternalMemObjectsKHR_mem_objects(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)4237 void CaptureEnqueueAcquireExternalMemObjectsKHR_mem_objects(bool isCallValid,
4238                                                             cl_command_queue command_queue,
4239                                                             cl_uint num_mem_objects,
4240                                                             const cl_mem *mem_objects,
4241                                                             cl_uint num_events_in_wait_list,
4242                                                             const cl_event *event_wait_list,
4243                                                             cl_event *event,
4244                                                             angle::ParamCapture *paramCapture)
4245 {
4246     if (mem_objects)
4247     {
4248         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
4249             mem_objects, num_mem_objects, paramCapture, &angle::FrameCaptureShared::getIndex);
4250     }
4251 }
4252 
CaptureEnqueueAcquireExternalMemObjectsKHR_event_wait_list(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)4253 void CaptureEnqueueAcquireExternalMemObjectsKHR_event_wait_list(bool isCallValid,
4254                                                                 cl_command_queue command_queue,
4255                                                                 cl_uint num_mem_objects,
4256                                                                 const cl_mem *mem_objects,
4257                                                                 cl_uint num_events_in_wait_list,
4258                                                                 const cl_event *event_wait_list,
4259                                                                 cl_event *event,
4260                                                                 angle::ParamCapture *paramCapture)
4261 {
4262     if (event_wait_list)
4263     {
4264         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
4265             event_wait_list, num_events_in_wait_list, paramCapture,
4266             &angle::FrameCaptureShared::getIndex);
4267     }
4268 }
4269 
CaptureEnqueueAcquireExternalMemObjectsKHR_event(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)4270 void CaptureEnqueueAcquireExternalMemObjectsKHR_event(bool isCallValid,
4271                                                       cl_command_queue command_queue,
4272                                                       cl_uint num_mem_objects,
4273                                                       const cl_mem *mem_objects,
4274                                                       cl_uint num_events_in_wait_list,
4275                                                       const cl_event *event_wait_list,
4276                                                       cl_event *event,
4277                                                       angle::ParamCapture *paramCapture)
4278 {
4279     if (event)
4280     {
4281         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
4282         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
4283     }
4284 }
4285 
CaptureEnqueueReleaseExternalMemObjectsKHR_mem_objects(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)4286 void CaptureEnqueueReleaseExternalMemObjectsKHR_mem_objects(bool isCallValid,
4287                                                             cl_command_queue command_queue,
4288                                                             cl_uint num_mem_objects,
4289                                                             const cl_mem *mem_objects,
4290                                                             cl_uint num_events_in_wait_list,
4291                                                             const cl_event *event_wait_list,
4292                                                             cl_event *event,
4293                                                             angle::ParamCapture *paramCapture)
4294 {
4295     if (mem_objects)
4296     {
4297         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
4298             mem_objects, num_mem_objects, paramCapture, &angle::FrameCaptureShared::getIndex);
4299     }
4300 }
4301 
CaptureEnqueueReleaseExternalMemObjectsKHR_event_wait_list(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)4302 void CaptureEnqueueReleaseExternalMemObjectsKHR_event_wait_list(bool isCallValid,
4303                                                                 cl_command_queue command_queue,
4304                                                                 cl_uint num_mem_objects,
4305                                                                 const cl_mem *mem_objects,
4306                                                                 cl_uint num_events_in_wait_list,
4307                                                                 const cl_event *event_wait_list,
4308                                                                 cl_event *event,
4309                                                                 angle::ParamCapture *paramCapture)
4310 {
4311     if (event_wait_list)
4312     {
4313         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLObjVectorMap(
4314             event_wait_list, num_events_in_wait_list, paramCapture,
4315             &angle::FrameCaptureShared::getIndex);
4316     }
4317 }
4318 
CaptureEnqueueReleaseExternalMemObjectsKHR_event(bool isCallValid,cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,angle::ParamCapture * paramCapture)4319 void CaptureEnqueueReleaseExternalMemObjectsKHR_event(bool isCallValid,
4320                                                       cl_command_queue command_queue,
4321                                                       cl_uint num_mem_objects,
4322                                                       const cl_mem *mem_objects,
4323                                                       cl_uint num_events_in_wait_list,
4324                                                       const cl_event *event_wait_list,
4325                                                       cl_event *event,
4326                                                       angle::ParamCapture *paramCapture)
4327 {
4328     if (event)
4329     {
4330         InitParamValue(angle::ParamType::Tcl_event, *event, &paramCapture->value);
4331         cl::Platform::GetDefault()->getFrameCaptureShared()->setIndex(event);
4332     }
4333 }
4334 
CaptureIcdGetPlatformIDsKHR_platforms(bool isCallValid,cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms,angle::ParamCapture * paramCapture)4335 void CaptureIcdGetPlatformIDsKHR_platforms(bool isCallValid,
4336                                            cl_uint num_entries,
4337                                            cl_platform_id *platforms,
4338                                            cl_uint *num_platforms,
4339                                            angle::ParamCapture *paramCapture)
4340 {
4341     if (platforms)
4342     {
4343         cl::Platform::GetDefault()->getFrameCaptureShared()->setCLPlatformIndices(platforms,
4344                                                                                   num_entries);
4345     }
4346 }
CaptureIcdGetPlatformIDsKHR_num_platforms(bool isCallValid,cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms,angle::ParamCapture * paramCapture)4347 void CaptureIcdGetPlatformIDsKHR_num_platforms(bool isCallValid,
4348                                                cl_uint num_entries,
4349                                                cl_platform_id *platforms,
4350                                                cl_uint *num_platforms,
4351                                                angle::ParamCapture *paramCapture)
4352 {
4353     if (num_platforms)
4354     {
4355         paramCapture->readBufferSizeBytes = sizeof(cl_uint);
4356     }
4357 }
4358 }  // namespace cl
4359