Merging r50522 through r50572 from trunk into soc-2011-tomato
[blender.git] / intern / cycles / util / util_opencl.cpp
1 //////////////////////////////////////////////////////////////////////////
2 //  Copyright (c) 2009 Organic Vectory B.V.
3 //  Written by George van Venrooij
4 //
5 //  Distributed under the Boost Software License, Version 1.0.
6 //  (See accompanying file doc/license/Boost.txt)
7 //  Extracted from the CLCC project - http://clcc.sourceforge.net/
8 //////////////////////////////////////////////////////////////////////////
9
10 #include <stdlib.h>
11
12 #include "util_opencl.h"
13
14 #ifndef CLCC_GENERATE_DOCUMENTATION
15 #ifdef _WIN32
16 #  define WIN32_LEAN_AND_MEAN
17 #  define VC_EXTRALEAN
18 #  include <windows.h>
19
20    typedef HMODULE             CLCC_DYNLIB_HANDLE;
21
22 #  define CLCC_DYNLIB_OPEN    LoadLibrary
23 #  define CLCC_DYNLIB_CLOSE   FreeLibrary
24 #  define CLCC_DYNLIB_IMPORT  GetProcAddress
25 #else
26 #  include <dlfcn.h>
27
28    typedef void*                   CLCC_DYNLIB_HANDLE;
29
30 #  define CLCC_DYNLIB_OPEN(path)  dlopen(path, RTLD_NOW | RTLD_GLOBAL)
31 #  define CLCC_DYNLIB_CLOSE       dlclose
32 #  define CLCC_DYNLIB_IMPORT      dlsym
33 #endif
34 #else
35 //  typedef implementation_defined  CLCC_DYNLIB_HANDLE;
36 //#  define CLCC_DYNLIB_OPEN(path)  implementation_defined
37 //#  define CLCC_DYNLIB_CLOSE       implementation_defined
38 //#  define CLCC_DYNLIB_IMPORT      implementation_defined
39 #endif
40
41 CCL_NAMESPACE_BEGIN
42
43 //! \brief module handle
44 static CLCC_DYNLIB_HANDLE module = NULL;
45
46 //  Variables holding function entry points
47 #ifndef CLCC_GENERATE_DOCUMENTATION
48 PFNCLGETPLATFORMIDS                 __clewGetPlatformIDs                = NULL;
49 PFNCLGETPLATFORMINFO                __clewGetPlatformInfo               = NULL;
50 PFNCLGETDEVICEIDS                   __clewGetDeviceIDs                  = NULL;
51 PFNCLGETDEVICEINFO                  __clewGetDeviceInfo                 = NULL;
52 PFNCLCREATECONTEXT                  __clewCreateContext                 = NULL;
53 PFNCLCREATECONTEXTFROMTYPE          __clewCreateContextFromType         = NULL;
54 PFNCLRETAINCONTEXT                  __clewRetainContext                 = NULL;
55 PFNCLRELEASECONTEXT                 __clewReleaseContext                = NULL;
56 PFNCLGETCONTEXTINFO                 __clewGetContextInfo                = NULL;
57 PFNCLCREATECOMMANDQUEUE             __clewCreateCommandQueue            = NULL;
58 PFNCLRETAINCOMMANDQUEUE             __clewRetainCommandQueue            = NULL;
59 PFNCLRELEASECOMMANDQUEUE            __clewReleaseCommandQueue           = NULL;
60 PFNCLGETCOMMANDQUEUEINFO            __clewGetCommandQueueInfo           = NULL;
61 PFNCLSETCOMMANDQUEUEPROPERTY        __clewSetCommandQueueProperty       = NULL;
62 PFNCLCREATEBUFFER                   __clewCreateBuffer                  = NULL;
63 PFNCLCREATEIMAGE2D                  __clewCreateImage2D                 = NULL;
64 PFNCLCREATEIMAGE3D                  __clewCreateImage3D                 = NULL;
65 PFNCLRETAINMEMOBJECT                __clewRetainMemObject               = NULL;
66 PFNCLRELEASEMEMOBJECT               __clewReleaseMemObject              = NULL;
67 PFNCLGETSUPPORTEDIMAGEFORMATS       __clewGetSupportedImageFormats      = NULL;
68 PFNCLGETMEMOBJECTINFO               __clewGetMemObjectInfo              = NULL;
69 PFNCLGETIMAGEINFO                   __clewGetImageInfo                  = NULL;
70 PFNCLCREATESAMPLER                  __clewCreateSampler                 = NULL;
71 PFNCLRETAINSAMPLER                  __clewRetainSampler                 = NULL;
72 PFNCLRELEASESAMPLER                 __clewReleaseSampler                = NULL;
73 PFNCLGETSAMPLERINFO                 __clewGetSamplerInfo                = NULL;
74 PFNCLCREATEPROGRAMWITHSOURCE        __clewCreateProgramWithSource       = NULL;
75 PFNCLCREATEPROGRAMWITHBINARY        __clewCreateProgramWithBinary       = NULL;
76 PFNCLRETAINPROGRAM                  __clewRetainProgram                 = NULL;
77 PFNCLRELEASEPROGRAM                 __clewReleaseProgram                = NULL;
78 PFNCLBUILDPROGRAM                   __clewBuildProgram                  = NULL;
79 PFNCLUNLOADCOMPILER                 __clewUnloadCompiler                = NULL;
80 PFNCLGETPROGRAMINFO                 __clewGetProgramInfo                = NULL;
81 PFNCLGETPROGRAMBUILDINFO            __clewGetProgramBuildInfo           = NULL;
82 PFNCLCREATEKERNEL                   __clewCreateKernel                  = NULL;
83 PFNCLCREATEKERNELSINPROGRAM         __clewCreateKernelsInProgram        = NULL;
84 PFNCLRETAINKERNEL                   __clewRetainKernel                  = NULL;
85 PFNCLRELEASEKERNEL                  __clewReleaseKernel                 = NULL;
86 PFNCLSETKERNELARG                   __clewSetKernelArg                  = NULL;
87 PFNCLGETKERNELINFO                  __clewGetKernelInfo                 = NULL;
88 PFNCLGETKERNELWORKGROUPINFO         __clewGetKernelWorkGroupInfo        = NULL;
89 PFNCLWAITFOREVENTS                  __clewWaitForEvents                 = NULL;
90 PFNCLGETEVENTINFO                   __clewGetEventInfo                  = NULL;
91 PFNCLRETAINEVENT                    __clewRetainEvent                   = NULL;
92 PFNCLRELEASEEVENT                   __clewReleaseEvent                  = NULL;
93 PFNCLGETEVENTPROFILINGINFO          __clewGetEventProfilingInfo         = NULL;
94 PFNCLFLUSH                          __clewFlush                         = NULL;
95 PFNCLFINISH                         __clewFinish                        = NULL;
96 PFNCLENQUEUEREADBUFFER              __clewEnqueueReadBuffer             = NULL;
97 PFNCLENQUEUEWRITEBUFFER             __clewEnqueueWriteBuffer            = NULL;
98 PFNCLENQUEUECOPYBUFFER              __clewEnqueueCopyBuffer             = NULL;
99 PFNCLENQUEUEREADIMAGE               __clewEnqueueReadImage              = NULL;
100 PFNCLENQUEUEWRITEIMAGE              __clewEnqueueWriteImage             = NULL;
101 PFNCLENQUEUECOPYIMAGE               __clewEnqueueCopyImage              = NULL;
102 PFNCLENQUEUECOPYIMAGETOBUFFER       __clewEnqueueCopyImageToBuffer      = NULL;
103 PFNCLENQUEUECOPYBUFFERTOIMAGE       __clewEnqueueCopyBufferToImage      = NULL;
104 PFNCLENQUEUEMAPBUFFER               __clewEnqueueMapBuffer              = NULL;
105 PFNCLENQUEUEMAPIMAGE                __clewEnqueueMapImage               = NULL;
106 PFNCLENQUEUEUNMAPMEMOBJECT          __clewEnqueueUnmapMemObject         = NULL;
107 PFNCLENQUEUENDRANGEKERNEL           __clewEnqueueNDRangeKernel          = NULL;
108 PFNCLENQUEUETASK                    __clewEnqueueTask                   = NULL;
109 PFNCLENQUEUENATIVEKERNEL            __clewEnqueueNativeKernel           = NULL;
110 PFNCLENQUEUEMARKER                  __clewEnqueueMarker                 = NULL;
111 PFNCLENQUEUEWAITFOREVENTS           __clewEnqueueWaitForEvents          = NULL;
112 PFNCLENQUEUEBARRIER                 __clewEnqueueBarrier                = NULL;
113 PFNCLGETEXTENSIONFUNCTIONADDRESS    __clewGetExtensionFunctionAddress   = NULL;
114 #endif  //  CLCC_GENERATE_DOCUMENTATION
115
116
117 //! \brief Unloads OpenCL dynamic library, should not be called directly
118 static void clewExit(void)
119 {
120         if (module != NULL)
121         {
122                 //  Ignore errors
123                 CLCC_DYNLIB_CLOSE(module);
124                 module = NULL;
125         }
126 }
127
128 //! \param path path to dynamic library to load
129 //! \return CLEW_ERROR_OPEN_FAILED if the library could not be opened
130 //! CLEW_ERROR_ATEXIT_FAILED if atexit(clewExit) failed
131 //! CLEW_SUCCESS when the library was succesfully loaded
132 int clLibraryInit()
133 {
134 #ifdef _WIN32
135         const char *path = "OpenCL.dll";
136 #elif defined(__APPLE__)
137         const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
138 #else
139         const char *path = "libOpenCL.so";
140 #endif
141         int error = 0;
142
143         //  Check if already initialized
144         if (module != NULL)
145         {
146                 return 1;
147         }
148
149         //  Load library
150         module = CLCC_DYNLIB_OPEN(path);
151
152         //  Check for errors
153         if (module == NULL)
154         {
155                 return 0;
156         }
157
158         //  Set unloading
159         error = atexit(clewExit);
160
161         if (error)
162         {
163                 //  Failure queing atexit, shutdown with error
164                 CLCC_DYNLIB_CLOSE(module);
165                 module = NULL;
166
167                 return 0;
168         }
169
170         //  Determine function entry-points
171         __clewGetPlatformIDs                = (PFNCLGETPLATFORMIDS              )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs");
172         __clewGetPlatformInfo               = (PFNCLGETPLATFORMINFO             )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo");
173         __clewGetDeviceIDs                  = (PFNCLGETDEVICEIDS                )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs");
174         __clewGetDeviceInfo                 = (PFNCLGETDEVICEINFO               )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo");
175         __clewCreateContext                 = (PFNCLCREATECONTEXT               )CLCC_DYNLIB_IMPORT(module, "clCreateContext");
176         __clewCreateContextFromType         = (PFNCLCREATECONTEXTFROMTYPE       )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType");
177         __clewRetainContext                 = (PFNCLRETAINCONTEXT               )CLCC_DYNLIB_IMPORT(module, "clRetainContext");
178         __clewReleaseContext                = (PFNCLRELEASECONTEXT              )CLCC_DYNLIB_IMPORT(module, "clReleaseContext");
179         __clewGetContextInfo                = (PFNCLGETCONTEXTINFO              )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo");
180         __clewCreateCommandQueue            = (PFNCLCREATECOMMANDQUEUE          )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue");
181         __clewRetainCommandQueue            = (PFNCLRETAINCOMMANDQUEUE          )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue");
182         __clewReleaseCommandQueue           = (PFNCLRELEASECOMMANDQUEUE         )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue");
183         __clewGetCommandQueueInfo           = (PFNCLGETCOMMANDQUEUEINFO         )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo");
184         __clewSetCommandQueueProperty       = (PFNCLSETCOMMANDQUEUEPROPERTY     )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty");
185         __clewCreateBuffer                  = (PFNCLCREATEBUFFER                )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer");
186         __clewCreateImage2D                 = (PFNCLCREATEIMAGE2D               )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D");
187         __clewCreateImage3D                 = (PFNCLCREATEIMAGE3D               )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D");
188         __clewRetainMemObject               = (PFNCLRETAINMEMOBJECT             )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject");
189         __clewReleaseMemObject              = (PFNCLRELEASEMEMOBJECT            )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject");
190         __clewGetSupportedImageFormats      = (PFNCLGETSUPPORTEDIMAGEFORMATS    )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats");
191         __clewGetMemObjectInfo              = (PFNCLGETMEMOBJECTINFO            )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo");
192         __clewGetImageInfo                  = (PFNCLGETIMAGEINFO                )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo");
193         __clewCreateSampler                 = (PFNCLCREATESAMPLER               )CLCC_DYNLIB_IMPORT(module, "clCreateSampler");
194         __clewRetainSampler                 = (PFNCLRETAINSAMPLER               )CLCC_DYNLIB_IMPORT(module, "clRetainSampler");
195         __clewReleaseSampler                = (PFNCLRELEASESAMPLER              )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler");
196         __clewGetSamplerInfo                = (PFNCLGETSAMPLERINFO              )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo");
197         __clewCreateProgramWithSource       = (PFNCLCREATEPROGRAMWITHSOURCE     )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource");
198         __clewCreateProgramWithBinary       = (PFNCLCREATEPROGRAMWITHBINARY     )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary");
199         __clewRetainProgram                 = (PFNCLRETAINPROGRAM               )CLCC_DYNLIB_IMPORT(module, "clRetainProgram");
200         __clewReleaseProgram                = (PFNCLRELEASEPROGRAM              )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram");
201         __clewBuildProgram                  = (PFNCLBUILDPROGRAM                )CLCC_DYNLIB_IMPORT(module, "clBuildProgram");
202         __clewUnloadCompiler                = (PFNCLUNLOADCOMPILER              )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler");
203         __clewGetProgramInfo                = (PFNCLGETPROGRAMINFO              )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo");
204         __clewGetProgramBuildInfo           = (PFNCLGETPROGRAMBUILDINFO         )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo");
205         __clewCreateKernel                  = (PFNCLCREATEKERNEL                )CLCC_DYNLIB_IMPORT(module, "clCreateKernel");
206         __clewCreateKernelsInProgram        = (PFNCLCREATEKERNELSINPROGRAM      )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram");
207         __clewRetainKernel                  = (PFNCLRETAINKERNEL                )CLCC_DYNLIB_IMPORT(module, "clRetainKernel");
208         __clewReleaseKernel                 = (PFNCLRELEASEKERNEL               )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel");
209         __clewSetKernelArg                  = (PFNCLSETKERNELARG                )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg");
210         __clewGetKernelInfo                 = (PFNCLGETKERNELINFO               )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo");
211         __clewGetKernelWorkGroupInfo        = (PFNCLGETKERNELWORKGROUPINFO      )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo");
212         __clewWaitForEvents                 = (PFNCLWAITFOREVENTS               )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents");
213         __clewGetEventInfo                  = (PFNCLGETEVENTINFO                )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo");
214         __clewRetainEvent                   = (PFNCLRETAINEVENT                 )CLCC_DYNLIB_IMPORT(module, "clRetainEvent");
215         __clewReleaseEvent                  = (PFNCLRELEASEEVENT                )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent");
216         __clewGetEventProfilingInfo         = (PFNCLGETEVENTPROFILINGINFO       )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo");
217         __clewFlush                         = (PFNCLFLUSH                       )CLCC_DYNLIB_IMPORT(module, "clFlush");
218         __clewFinish                        = (PFNCLFINISH                      )CLCC_DYNLIB_IMPORT(module, "clFinish");
219         __clewEnqueueReadBuffer             = (PFNCLENQUEUEREADBUFFER           )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer");
220         __clewEnqueueWriteBuffer            = (PFNCLENQUEUEWRITEBUFFER          )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer");
221         __clewEnqueueCopyBuffer             = (PFNCLENQUEUECOPYBUFFER           )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer");
222         __clewEnqueueReadImage              = (PFNCLENQUEUEREADIMAGE            )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage");
223         __clewEnqueueWriteImage             = (PFNCLENQUEUEWRITEIMAGE           )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage");
224         __clewEnqueueCopyImage              = (PFNCLENQUEUECOPYIMAGE            )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage");
225         __clewEnqueueCopyImageToBuffer      = (PFNCLENQUEUECOPYIMAGETOBUFFER    )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer");
226         __clewEnqueueCopyBufferToImage      = (PFNCLENQUEUECOPYBUFFERTOIMAGE    )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage");
227         __clewEnqueueMapBuffer              = (PFNCLENQUEUEMAPBUFFER            )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer");
228         __clewEnqueueMapImage               = (PFNCLENQUEUEMAPIMAGE             )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage");
229         __clewEnqueueUnmapMemObject         = (PFNCLENQUEUEUNMAPMEMOBJECT       )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject");
230         __clewEnqueueNDRangeKernel          = (PFNCLENQUEUENDRANGEKERNEL        )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel");
231         __clewEnqueueTask                   = (PFNCLENQUEUETASK                 )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask");
232         __clewEnqueueNativeKernel           = (PFNCLENQUEUENATIVEKERNEL         )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel");
233         __clewEnqueueMarker                 = (PFNCLENQUEUEMARKER               )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker");
234         __clewEnqueueWaitForEvents          = (PFNCLENQUEUEWAITFOREVENTS        )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
235         __clewEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
236         __clewGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
237
238         if(__clewGetPlatformIDs == NULL) return 0;
239         if(__clewGetPlatformInfo == NULL) return 0;
240         if(__clewGetDeviceIDs == NULL) return 0;
241         if(__clewGetDeviceInfo == NULL) return 0;
242
243         return 1;
244 }
245
246 //! \param error CL error code
247 //! \return a string representation of the error code
248 const char *clErrorString(cl_int error)
249 {
250         static const char* strings[] =
251         {
252             // Error Codes
253             "CL_SUCCESS"                                  //   0
254             , "CL_DEVICE_NOT_FOUND"                         //  -1
255             , "CL_DEVICE_NOT_AVAILABLE"                     //  -2
256             , "CL_COMPILER_NOT_AVAILABLE"                   //  -3
257             , "CL_MEM_OBJECT_ALLOCATION_FAILURE"            //  -4
258             , "CL_OUT_OF_RESOURCES"                         //  -5
259             , "CL_OUT_OF_HOST_MEMORY"                       //  -6
260             , "CL_PROFILING_INFO_NOT_AVAILABLE"             //  -7
261             , "CL_MEM_COPY_OVERLAP"                         //  -8
262             , "CL_IMAGE_FORMAT_MISMATCH"                    //  -9
263             , "CL_IMAGE_FORMAT_NOT_SUPPORTED"               //  -10
264             , "CL_BUILD_PROGRAM_FAILURE"                    //  -11
265             , "CL_MAP_FAILURE"                              //  -12
266
267             , ""    //  -13
268             , ""    //  -14
269             , ""    //  -15
270             , ""    //  -16
271             , ""    //  -17
272             , ""    //  -18
273             , ""    //  -19
274
275             , ""    //  -20
276             , ""    //  -21
277             , ""    //  -22
278             , ""    //  -23
279             , ""    //  -24
280             , ""    //  -25
281             , ""    //  -26
282             , ""    //  -27
283             , ""    //  -28
284             , ""    //  -29
285
286             , "CL_INVALID_VALUE"                            //  -30
287             , "CL_INVALID_DEVICE_TYPE"                      //  -31
288             , "CL_INVALID_PLATFORM"                         //  -32
289             , "CL_INVALID_DEVICE"                           //  -33
290             , "CL_INVALID_CONTEXT"                          //  -34
291             , "CL_INVALID_QUEUE_PROPERTIES"                 //  -35
292             , "CL_INVALID_COMMAND_QUEUE"                    //  -36
293             , "CL_INVALID_HOST_PTR"                         //  -37
294             , "CL_INVALID_MEM_OBJECT"                       //  -38
295             , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"          //  -39
296             , "CL_INVALID_IMAGE_SIZE"                       //  -40
297             , "CL_INVALID_SAMPLER"                          //  -41
298             , "CL_INVALID_BINARY"                           //  -42
299             , "CL_INVALID_BUILD_OPTIONS"                    //  -43
300             , "CL_INVALID_PROGRAM"                          //  -44
301             , "CL_INVALID_PROGRAM_EXECUTABLE"               //  -45
302             , "CL_INVALID_KERNEL_NAME"                      //  -46
303             , "CL_INVALID_KERNEL_DEFINITION"                //  -47
304             , "CL_INVALID_KERNEL"                           //  -48
305             , "CL_INVALID_ARG_INDEX"                        //  -49
306             , "CL_INVALID_ARG_VALUE"                        //  -50
307             , "CL_INVALID_ARG_SIZE"                         //  -51
308             , "CL_INVALID_KERNEL_ARGS"                      //  -52
309             , "CL_INVALID_WORK_DIMENSION"                   //  -53
310             , "CL_INVALID_WORK_GROUP_SIZE"                  //  -54
311             , "CL_INVALID_WORK_ITEM_SIZE"                   //  -55
312             , "CL_INVALID_GLOBAL_OFFSET"                    //  -56
313             , "CL_INVALID_EVENT_WAIT_LIST"                  //  -57
314             , "CL_INVALID_EVENT"                            //  -58
315             , "CL_INVALID_OPERATION"                        //  -59
316             , "CL_INVALID_GL_OBJECT"                        //  -60
317             , "CL_INVALID_BUFFER_SIZE"                      //  -61
318             , "CL_INVALID_MIP_LEVEL"                        //  -62
319             , "CL_INVALID_GLOBAL_WORK_SIZE"                 //  -63
320         };
321
322         return strings[-error];
323 }
324
325 CCL_NAMESPACE_END
326