Merged revision(s) 58452-58584 from trunk/blender into soc-2013-dingto.
[blender-staging.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 #if 0
118 //! \brief Unloads OpenCL dynamic library, should not be called directly
119 static void clewExit(void)
120 {
121         if (module != NULL)
122         {
123                 //  Ignore errors
124                 CLCC_DYNLIB_CLOSE(module);
125                 module = NULL;
126         }
127 }
128 #endif
129
130 //! \param path path to dynamic library to load
131 //! \return CLEW_ERROR_OPEN_FAILED if the library could not be opened
132 //! CLEW_ERROR_ATEXIT_FAILED if atexit(clewExit) failed
133 //! CLEW_SUCCESS when the library was succesfully loaded
134 int clLibraryInit()
135 {
136 #ifdef _WIN32
137         const char *path = "OpenCL.dll";
138 #elif defined(__APPLE__)
139         const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
140 #else
141         const char *path = "libOpenCL.so";
142 #endif
143
144         // OpenCL disabled for now, only works with this environment variable set
145         if(!getenv("CYCLES_OPENCL_TEST"))
146                 return 0;
147
148         //  Check if already initialized
149         if (module != NULL)
150         {
151                 return 1;
152         }
153
154         //  Load library
155         module = CLCC_DYNLIB_OPEN(path);
156
157         //  Check for errors
158         if (module == NULL)
159         {
160                 return 0;
161         }
162
163         // Disabled because we retain OpenCL context and it's difficult to ensure
164         // this will exit after releasing the context
165 #if 0
166         //  Set unloading
167         int error = atexit(clewExit);
168
169         if (error)
170         {
171                 //  Failure queing atexit, shutdown with error
172                 CLCC_DYNLIB_CLOSE(module);
173                 module = NULL;
174
175                 return 0;
176         }
177 #endif
178
179         //  Determine function entry-points
180         __clewGetPlatformIDs                = (PFNCLGETPLATFORMIDS              )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs");
181         __clewGetPlatformInfo               = (PFNCLGETPLATFORMINFO             )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo");
182         __clewGetDeviceIDs                  = (PFNCLGETDEVICEIDS                )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs");
183         __clewGetDeviceInfo                 = (PFNCLGETDEVICEINFO               )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo");
184         __clewCreateContext                 = (PFNCLCREATECONTEXT               )CLCC_DYNLIB_IMPORT(module, "clCreateContext");
185         __clewCreateContextFromType         = (PFNCLCREATECONTEXTFROMTYPE       )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType");
186         __clewRetainContext                 = (PFNCLRETAINCONTEXT               )CLCC_DYNLIB_IMPORT(module, "clRetainContext");
187         __clewReleaseContext                = (PFNCLRELEASECONTEXT              )CLCC_DYNLIB_IMPORT(module, "clReleaseContext");
188         __clewGetContextInfo                = (PFNCLGETCONTEXTINFO              )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo");
189         __clewCreateCommandQueue            = (PFNCLCREATECOMMANDQUEUE          )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue");
190         __clewRetainCommandQueue            = (PFNCLRETAINCOMMANDQUEUE          )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue");
191         __clewReleaseCommandQueue           = (PFNCLRELEASECOMMANDQUEUE         )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue");
192         __clewGetCommandQueueInfo           = (PFNCLGETCOMMANDQUEUEINFO         )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo");
193         __clewSetCommandQueueProperty       = (PFNCLSETCOMMANDQUEUEPROPERTY     )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty");
194         __clewCreateBuffer                  = (PFNCLCREATEBUFFER                )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer");
195         __clewCreateImage2D                 = (PFNCLCREATEIMAGE2D               )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D");
196         __clewCreateImage3D                 = (PFNCLCREATEIMAGE3D               )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D");
197         __clewRetainMemObject               = (PFNCLRETAINMEMOBJECT             )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject");
198         __clewReleaseMemObject              = (PFNCLRELEASEMEMOBJECT            )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject");
199         __clewGetSupportedImageFormats      = (PFNCLGETSUPPORTEDIMAGEFORMATS    )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats");
200         __clewGetMemObjectInfo              = (PFNCLGETMEMOBJECTINFO            )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo");
201         __clewGetImageInfo                  = (PFNCLGETIMAGEINFO                )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo");
202         __clewCreateSampler                 = (PFNCLCREATESAMPLER               )CLCC_DYNLIB_IMPORT(module, "clCreateSampler");
203         __clewRetainSampler                 = (PFNCLRETAINSAMPLER               )CLCC_DYNLIB_IMPORT(module, "clRetainSampler");
204         __clewReleaseSampler                = (PFNCLRELEASESAMPLER              )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler");
205         __clewGetSamplerInfo                = (PFNCLGETSAMPLERINFO              )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo");
206         __clewCreateProgramWithSource       = (PFNCLCREATEPROGRAMWITHSOURCE     )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource");
207         __clewCreateProgramWithBinary       = (PFNCLCREATEPROGRAMWITHBINARY     )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary");
208         __clewRetainProgram                 = (PFNCLRETAINPROGRAM               )CLCC_DYNLIB_IMPORT(module, "clRetainProgram");
209         __clewReleaseProgram                = (PFNCLRELEASEPROGRAM              )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram");
210         __clewBuildProgram                  = (PFNCLBUILDPROGRAM                )CLCC_DYNLIB_IMPORT(module, "clBuildProgram");
211         __clewUnloadCompiler                = (PFNCLUNLOADCOMPILER              )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler");
212         __clewGetProgramInfo                = (PFNCLGETPROGRAMINFO              )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo");
213         __clewGetProgramBuildInfo           = (PFNCLGETPROGRAMBUILDINFO         )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo");
214         __clewCreateKernel                  = (PFNCLCREATEKERNEL                )CLCC_DYNLIB_IMPORT(module, "clCreateKernel");
215         __clewCreateKernelsInProgram        = (PFNCLCREATEKERNELSINPROGRAM      )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram");
216         __clewRetainKernel                  = (PFNCLRETAINKERNEL                )CLCC_DYNLIB_IMPORT(module, "clRetainKernel");
217         __clewReleaseKernel                 = (PFNCLRELEASEKERNEL               )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel");
218         __clewSetKernelArg                  = (PFNCLSETKERNELARG                )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg");
219         __clewGetKernelInfo                 = (PFNCLGETKERNELINFO               )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo");
220         __clewGetKernelWorkGroupInfo        = (PFNCLGETKERNELWORKGROUPINFO      )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo");
221         __clewWaitForEvents                 = (PFNCLWAITFOREVENTS               )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents");
222         __clewGetEventInfo                  = (PFNCLGETEVENTINFO                )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo");
223         __clewRetainEvent                   = (PFNCLRETAINEVENT                 )CLCC_DYNLIB_IMPORT(module, "clRetainEvent");
224         __clewReleaseEvent                  = (PFNCLRELEASEEVENT                )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent");
225         __clewGetEventProfilingInfo         = (PFNCLGETEVENTPROFILINGINFO       )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo");
226         __clewFlush                         = (PFNCLFLUSH                       )CLCC_DYNLIB_IMPORT(module, "clFlush");
227         __clewFinish                        = (PFNCLFINISH                      )CLCC_DYNLIB_IMPORT(module, "clFinish");
228         __clewEnqueueReadBuffer             = (PFNCLENQUEUEREADBUFFER           )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer");
229         __clewEnqueueWriteBuffer            = (PFNCLENQUEUEWRITEBUFFER          )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer");
230         __clewEnqueueCopyBuffer             = (PFNCLENQUEUECOPYBUFFER           )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer");
231         __clewEnqueueReadImage              = (PFNCLENQUEUEREADIMAGE            )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage");
232         __clewEnqueueWriteImage             = (PFNCLENQUEUEWRITEIMAGE           )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage");
233         __clewEnqueueCopyImage              = (PFNCLENQUEUECOPYIMAGE            )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage");
234         __clewEnqueueCopyImageToBuffer      = (PFNCLENQUEUECOPYIMAGETOBUFFER    )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer");
235         __clewEnqueueCopyBufferToImage      = (PFNCLENQUEUECOPYBUFFERTOIMAGE    )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage");
236         __clewEnqueueMapBuffer              = (PFNCLENQUEUEMAPBUFFER            )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer");
237         __clewEnqueueMapImage               = (PFNCLENQUEUEMAPIMAGE             )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage");
238         __clewEnqueueUnmapMemObject         = (PFNCLENQUEUEUNMAPMEMOBJECT       )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject");
239         __clewEnqueueNDRangeKernel          = (PFNCLENQUEUENDRANGEKERNEL        )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel");
240         __clewEnqueueTask                   = (PFNCLENQUEUETASK                 )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask");
241         __clewEnqueueNativeKernel           = (PFNCLENQUEUENATIVEKERNEL         )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel");
242         __clewEnqueueMarker                 = (PFNCLENQUEUEMARKER               )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker");
243         __clewEnqueueWaitForEvents          = (PFNCLENQUEUEWAITFOREVENTS        )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
244         __clewEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
245         __clewGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
246
247         if(__clewGetPlatformIDs == NULL) return 0;
248         if(__clewGetPlatformInfo == NULL) return 0;
249         if(__clewGetDeviceIDs == NULL) return 0;
250         if(__clewGetDeviceInfo == NULL) return 0;
251
252         return 1;
253 }
254
255 //! \param error CL error code
256 //! \return a string representation of the error code
257 const char *clErrorString(cl_int error)
258 {
259         static const char* strings[] =
260         {
261             // Error Codes
262             "CL_SUCCESS"                                  //   0
263             , "CL_DEVICE_NOT_FOUND"                         //  -1
264             , "CL_DEVICE_NOT_AVAILABLE"                     //  -2
265             , "CL_COMPILER_NOT_AVAILABLE"                   //  -3
266             , "CL_MEM_OBJECT_ALLOCATION_FAILURE"            //  -4
267             , "CL_OUT_OF_RESOURCES"                         //  -5
268             , "CL_OUT_OF_HOST_MEMORY"                       //  -6
269             , "CL_PROFILING_INFO_NOT_AVAILABLE"             //  -7
270             , "CL_MEM_COPY_OVERLAP"                         //  -8
271             , "CL_IMAGE_FORMAT_MISMATCH"                    //  -9
272             , "CL_IMAGE_FORMAT_NOT_SUPPORTED"               //  -10
273             , "CL_BUILD_PROGRAM_FAILURE"                    //  -11
274             , "CL_MAP_FAILURE"                              //  -12
275
276             , ""    //  -13
277             , ""    //  -14
278             , ""    //  -15
279             , ""    //  -16
280             , ""    //  -17
281             , ""    //  -18
282             , ""    //  -19
283
284             , ""    //  -20
285             , ""    //  -21
286             , ""    //  -22
287             , ""    //  -23
288             , ""    //  -24
289             , ""    //  -25
290             , ""    //  -26
291             , ""    //  -27
292             , ""    //  -28
293             , ""    //  -29
294
295             , "CL_INVALID_VALUE"                            //  -30
296             , "CL_INVALID_DEVICE_TYPE"                      //  -31
297             , "CL_INVALID_PLATFORM"                         //  -32
298             , "CL_INVALID_DEVICE"                           //  -33
299             , "CL_INVALID_CONTEXT"                          //  -34
300             , "CL_INVALID_QUEUE_PROPERTIES"                 //  -35
301             , "CL_INVALID_COMMAND_QUEUE"                    //  -36
302             , "CL_INVALID_HOST_PTR"                         //  -37
303             , "CL_INVALID_MEM_OBJECT"                       //  -38
304             , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"          //  -39
305             , "CL_INVALID_IMAGE_SIZE"                       //  -40
306             , "CL_INVALID_SAMPLER"                          //  -41
307             , "CL_INVALID_BINARY"                           //  -42
308             , "CL_INVALID_BUILD_OPTIONS"                    //  -43
309             , "CL_INVALID_PROGRAM"                          //  -44
310             , "CL_INVALID_PROGRAM_EXECUTABLE"               //  -45
311             , "CL_INVALID_KERNEL_NAME"                      //  -46
312             , "CL_INVALID_KERNEL_DEFINITION"                //  -47
313             , "CL_INVALID_KERNEL"                           //  -48
314             , "CL_INVALID_ARG_INDEX"                        //  -49
315             , "CL_INVALID_ARG_VALUE"                        //  -50
316             , "CL_INVALID_ARG_SIZE"                         //  -51
317             , "CL_INVALID_KERNEL_ARGS"                      //  -52
318             , "CL_INVALID_WORK_DIMENSION"                   //  -53
319             , "CL_INVALID_WORK_GROUP_SIZE"                  //  -54
320             , "CL_INVALID_WORK_ITEM_SIZE"                   //  -55
321             , "CL_INVALID_GLOBAL_OFFSET"                    //  -56
322             , "CL_INVALID_EVENT_WAIT_LIST"                  //  -57
323             , "CL_INVALID_EVENT"                            //  -58
324             , "CL_INVALID_OPERATION"                        //  -59
325             , "CL_INVALID_GL_OBJECT"                        //  -60
326             , "CL_INVALID_BUFFER_SIZE"                      //  -61
327             , "CL_INVALID_MIP_LEVEL"                        //  -62
328             , "CL_INVALID_GLOBAL_WORK_SIZE"                 //  -63
329         };
330
331         return strings[-error];
332 }
333
334 CCL_NAMESPACE_END
335
336 #ifdef CLCC_DYNLIB_CLOSE
337 #endif