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 license.txt)
7 //////////////////////////////////////////////////////////////////////////
8 
9 #include "clew.h"
10 
11 #ifdef _WIN32
12 #define WIN32_LEAN_AND_MEAN
13 #define VC_EXTRALEAN
14 #include <windows.h>
15 
16 typedef HMODULE CLEW_DYNLIB_HANDLE;
17 
18 #define CLEW_DYNLIB_OPEN LoadLibraryA
19 #define CLEW_DYNLIB_CLOSE FreeLibrary
20 #define CLEW_DYNLIB_IMPORT GetProcAddress
21 #else
22 #include <dlfcn.h>
23 
24 typedef void* CLEW_DYNLIB_HANDLE;
25 
26 #define CLEW_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL)
27 #define CLEW_DYNLIB_CLOSE dlclose
28 #define CLEW_DYNLIB_IMPORT dlsym
29 #endif
30 
31 #include <stdlib.h>
32 
33 //! \brief module handle
34 static CLEW_DYNLIB_HANDLE module = NULL;
35 
36 //  Variables holding function entry points
37 PFNCLGETPLATFORMIDS __clewGetPlatformIDs = NULL;
38 PFNCLGETPLATFORMINFO __clewGetPlatformInfo = NULL;
39 PFNCLGETDEVICEIDS __clewGetDeviceIDs = NULL;
40 PFNCLGETDEVICEINFO __clewGetDeviceInfo = NULL;
41 PFNCLCREATECONTEXT __clewCreateContext = NULL;
42 PFNCLCREATECONTEXTFROMTYPE __clewCreateContextFromType = NULL;
43 PFNCLRETAINCONTEXT __clewRetainContext = NULL;
44 PFNCLRELEASECONTEXT __clewReleaseContext = NULL;
45 PFNCLGETCONTEXTINFO __clewGetContextInfo = NULL;
46 PFNCLCREATECOMMANDQUEUE __clewCreateCommandQueue = NULL;
47 PFNCLRETAINCOMMANDQUEUE __clewRetainCommandQueue = NULL;
48 PFNCLRELEASECOMMANDQUEUE __clewReleaseCommandQueue = NULL;
49 PFNCLGETCOMMANDQUEUEINFO __clewGetCommandQueueInfo = NULL;
50 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
51 PFNCLSETCOMMANDQUEUEPROPERTY __clewSetCommandQueueProperty = NULL;
52 #endif
53 PFNCLCREATEBUFFER __clewCreateBuffer = NULL;
54 PFNCLCREATESUBBUFFER __clewCreateSubBuffer = NULL;
55 PFNCLCREATEIMAGE2D __clewCreateImage2D = NULL;
56 PFNCLCREATEIMAGE3D __clewCreateImage3D = NULL;
57 PFNCLRETAINMEMOBJECT __clewRetainMemObject = NULL;
58 PFNCLRELEASEMEMOBJECT __clewReleaseMemObject = NULL;
59 PFNCLGETSUPPORTEDIMAGEFORMATS __clewGetSupportedImageFormats = NULL;
60 PFNCLGETMEMOBJECTINFO __clewGetMemObjectInfo = NULL;
61 PFNCLGETIMAGEINFO __clewGetImageInfo = NULL;
62 PFNCLSETMEMOBJECTDESTRUCTORCALLBACK __clewSetMemObjectDestructorCallback = NULL;
63 PFNCLCREATESAMPLER __clewCreateSampler = NULL;
64 PFNCLRETAINSAMPLER __clewRetainSampler = NULL;
65 PFNCLRELEASESAMPLER __clewReleaseSampler = NULL;
66 PFNCLGETSAMPLERINFO __clewGetSamplerInfo = NULL;
67 PFNCLCREATEPROGRAMWITHSOURCE __clewCreateProgramWithSource = NULL;
68 PFNCLCREATEPROGRAMWITHBINARY __clewCreateProgramWithBinary = NULL;
69 PFNCLRETAINPROGRAM __clewRetainProgram = NULL;
70 PFNCLRELEASEPROGRAM __clewReleaseProgram = NULL;
71 PFNCLBUILDPROGRAM __clewBuildProgram = NULL;
72 PFNCLUNLOADCOMPILER __clewUnloadCompiler = NULL;
73 PFNCLGETPROGRAMINFO __clewGetProgramInfo = NULL;
74 PFNCLGETPROGRAMBUILDINFO __clewGetProgramBuildInfo = NULL;
75 PFNCLCREATEKERNEL __clewCreateKernel = NULL;
76 PFNCLCREATEKERNELSINPROGRAM __clewCreateKernelsInProgram = NULL;
77 PFNCLRETAINKERNEL __clewRetainKernel = NULL;
78 PFNCLRELEASEKERNEL __clewReleaseKernel = NULL;
79 PFNCLSETKERNELARG __clewSetKernelArg = NULL;
80 PFNCLGETKERNELINFO __clewGetKernelInfo = NULL;
81 PFNCLGETKERNELWORKGROUPINFO __clewGetKernelWorkGroupInfo = NULL;
82 PFNCLWAITFOREVENTS __clewWaitForEvents = NULL;
83 PFNCLGETEVENTINFO __clewGetEventInfo = NULL;
84 PFNCLCREATEUSEREVENT __clewCreateUserEvent = NULL;
85 PFNCLRETAINEVENT __clewRetainEvent = NULL;
86 PFNCLRELEASEEVENT __clewReleaseEvent = NULL;
87 PFNCLSETUSEREVENTSTATUS __clewSetUserEventStatus = NULL;
88 PFNCLSETEVENTCALLBACK __clewSetEventCallback = NULL;
89 PFNCLGETEVENTPROFILINGINFO __clewGetEventProfilingInfo = NULL;
90 PFNCLFLUSH __clewFlush = NULL;
91 PFNCLFINISH __clewFinish = NULL;
92 PFNCLENQUEUEREADBUFFER __clewEnqueueReadBuffer = NULL;
93 PFNCLENQUEUEREADBUFFERRECT __clewEnqueueReadBufferRect = NULL;
94 PFNCLENQUEUEWRITEBUFFER __clewEnqueueWriteBuffer = NULL;
95 PFNCLENQUEUEWRITEBUFFERRECT __clewEnqueueWriteBufferRect = NULL;
96 PFNCLENQUEUECOPYBUFFER __clewEnqueueCopyBuffer = NULL;
97 PFNCLENQUEUEREADIMAGE __clewEnqueueReadImage = NULL;
98 PFNCLENQUEUEWRITEIMAGE __clewEnqueueWriteImage = NULL;
99 PFNCLENQUEUECOPYIMAGE __clewEnqueueCopyImage = NULL;
100 PFNCLENQUEUECOPYBUFFERRECT __clewEnqueueCopyBufferRect = NULL;
101 PFNCLENQUEUECOPYIMAGETOBUFFER __clewEnqueueCopyImageToBuffer = NULL;
102 PFNCLENQUEUECOPYBUFFERTOIMAGE __clewEnqueueCopyBufferToImage = NULL;
103 PFNCLENQUEUEMAPBUFFER __clewEnqueueMapBuffer = NULL;
104 PFNCLENQUEUEMAPIMAGE __clewEnqueueMapImage = NULL;
105 PFNCLENQUEUEUNMAPMEMOBJECT __clewEnqueueUnmapMemObject = NULL;
106 PFNCLENQUEUENDRANGEKERNEL __clewEnqueueNDRangeKernel = NULL;
107 PFNCLENQUEUETASK __clewEnqueueTask = NULL;
108 PFNCLENQUEUENATIVEKERNEL __clewEnqueueNativeKernel = NULL;
109 PFNCLENQUEUEMARKER __clewEnqueueMarker = NULL;
110 PFNCLENQUEUEWAITFOREVENTS __clewEnqueueWaitForEvents = NULL;
111 PFNCLENQUEUEBARRIER __clewEnqueueBarrier = NULL;
112 PFNCLGETEXTENSIONFUNCTIONADDRESS __clewGetExtensionFunctionAddress = NULL;
113 
clewExit(void)114 void clewExit(void)
115 {
116 	if (module != NULL)
117 	{
118 		//  Ignore errors
119 		CLEW_DYNLIB_CLOSE(module);
120 		module = NULL;
121 	}
122 }
123 
clewInit(const char * path)124 int clewInit(const char* path)
125 {
126 	int error = 0;
127 
128 	//  Check if already initialized
129 	if (module != NULL)
130 	{
131 		return CLEW_SUCCESS;
132 	}
133 
134 	//  Load library
135 	module = CLEW_DYNLIB_OPEN(path);
136 
137 	//  Check for errors
138 	if (module == NULL)
139 	{
140 		return CLEW_ERROR_OPEN_FAILED;
141 	}
142 
143 	//  Set unloading
144 	error = atexit(clewExit);
145 
146 	if (error)
147 	{
148 		//  Failure queuing atexit, shutdown with error
149 		CLEW_DYNLIB_CLOSE(module);
150 		module = NULL;
151 
152 		return CLEW_ERROR_ATEXIT_FAILED;
153 	}
154 
155 	//  Determine function entry-points
156 	__clewGetPlatformIDs = (PFNCLGETPLATFORMIDS)CLEW_DYNLIB_IMPORT(module, "clGetPlatformIDs");
157 	__clewGetPlatformInfo = (PFNCLGETPLATFORMINFO)CLEW_DYNLIB_IMPORT(module, "clGetPlatformInfo");
158 	__clewGetDeviceIDs = (PFNCLGETDEVICEIDS)CLEW_DYNLIB_IMPORT(module, "clGetDeviceIDs");
159 	__clewGetDeviceInfo = (PFNCLGETDEVICEINFO)CLEW_DYNLIB_IMPORT(module, "clGetDeviceInfo");
160 	__clewCreateContext = (PFNCLCREATECONTEXT)CLEW_DYNLIB_IMPORT(module, "clCreateContext");
161 	__clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE)CLEW_DYNLIB_IMPORT(module, "clCreateContextFromType");
162 	__clewRetainContext = (PFNCLRETAINCONTEXT)CLEW_DYNLIB_IMPORT(module, "clRetainContext");
163 	__clewReleaseContext = (PFNCLRELEASECONTEXT)CLEW_DYNLIB_IMPORT(module, "clReleaseContext");
164 	__clewGetContextInfo = (PFNCLGETCONTEXTINFO)CLEW_DYNLIB_IMPORT(module, "clGetContextInfo");
165 	__clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE)CLEW_DYNLIB_IMPORT(module, "clCreateCommandQueue");
166 	__clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE)CLEW_DYNLIB_IMPORT(module, "clRetainCommandQueue");
167 	__clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE)CLEW_DYNLIB_IMPORT(module, "clReleaseCommandQueue");
168 	__clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO)CLEW_DYNLIB_IMPORT(module, "clGetCommandQueueInfo");
169 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
170 	__clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY)CLEW_DYNLIB_IMPORT(module, "clSetCommandQueueProperty");
171 #endif
172 	__clewCreateBuffer = (PFNCLCREATEBUFFER)CLEW_DYNLIB_IMPORT(module, "clCreateBuffer");
173 	__clewCreateSubBuffer = (PFNCLCREATESUBBUFFER)CLEW_DYNLIB_IMPORT(module, "clCreateBuffer");
174 	__clewCreateImage2D = (PFNCLCREATEIMAGE2D)CLEW_DYNLIB_IMPORT(module, "clCreateImage2D");
175 	__clewCreateImage3D = (PFNCLCREATEIMAGE3D)CLEW_DYNLIB_IMPORT(module, "clCreateImage3D");
176 	__clewRetainMemObject = (PFNCLRETAINMEMOBJECT)CLEW_DYNLIB_IMPORT(module, "clRetainMemObject");
177 	__clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT)CLEW_DYNLIB_IMPORT(module, "clReleaseMemObject");
178 	__clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS)CLEW_DYNLIB_IMPORT(module, "clGetSupportedImageFormats");
179 	__clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO)CLEW_DYNLIB_IMPORT(module, "clGetMemObjectInfo");
180 	__clewGetImageInfo = (PFNCLGETIMAGEINFO)CLEW_DYNLIB_IMPORT(module, "clGetImageInfo");
181 	__clewSetMemObjectDestructorCallback = (PFNCLSETMEMOBJECTDESTRUCTORCALLBACK)CLEW_DYNLIB_IMPORT(module, "clSetMemObjectDestructorCallback");
182 	__clewCreateSampler = (PFNCLCREATESAMPLER)CLEW_DYNLIB_IMPORT(module, "clCreateSampler");
183 	__clewRetainSampler = (PFNCLRETAINSAMPLER)CLEW_DYNLIB_IMPORT(module, "clRetainSampler");
184 	__clewReleaseSampler = (PFNCLRELEASESAMPLER)CLEW_DYNLIB_IMPORT(module, "clReleaseSampler");
185 	__clewGetSamplerInfo = (PFNCLGETSAMPLERINFO)CLEW_DYNLIB_IMPORT(module, "clGetSamplerInfo");
186 	__clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE)CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithSource");
187 	__clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY)CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithBinary");
188 	__clewRetainProgram = (PFNCLRETAINPROGRAM)CLEW_DYNLIB_IMPORT(module, "clRetainProgram");
189 	__clewReleaseProgram = (PFNCLRELEASEPROGRAM)CLEW_DYNLIB_IMPORT(module, "clReleaseProgram");
190 	__clewBuildProgram = (PFNCLBUILDPROGRAM)CLEW_DYNLIB_IMPORT(module, "clBuildProgram");
191 	__clewUnloadCompiler = (PFNCLUNLOADCOMPILER)CLEW_DYNLIB_IMPORT(module, "clUnloadCompiler");
192 	__clewGetProgramInfo = (PFNCLGETPROGRAMINFO)CLEW_DYNLIB_IMPORT(module, "clGetProgramInfo");
193 	__clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO)CLEW_DYNLIB_IMPORT(module, "clGetProgramBuildInfo");
194 	__clewCreateKernel = (PFNCLCREATEKERNEL)CLEW_DYNLIB_IMPORT(module, "clCreateKernel");
195 	__clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM)CLEW_DYNLIB_IMPORT(module, "clCreateKernelsInProgram");
196 	__clewRetainKernel = (PFNCLRETAINKERNEL)CLEW_DYNLIB_IMPORT(module, "clRetainKernel");
197 	__clewReleaseKernel = (PFNCLRELEASEKERNEL)CLEW_DYNLIB_IMPORT(module, "clReleaseKernel");
198 	__clewSetKernelArg = (PFNCLSETKERNELARG)CLEW_DYNLIB_IMPORT(module, "clSetKernelArg");
199 	__clewGetKernelInfo = (PFNCLGETKERNELINFO)CLEW_DYNLIB_IMPORT(module, "clGetKernelInfo");
200 	__clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO)CLEW_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo");
201 	__clewWaitForEvents = (PFNCLWAITFOREVENTS)CLEW_DYNLIB_IMPORT(module, "clWaitForEvents");
202 	__clewGetEventInfo = (PFNCLGETEVENTINFO)CLEW_DYNLIB_IMPORT(module, "clGetEventInfo");
203 	__clewCreateUserEvent = (PFNCLCREATEUSEREVENT)CLEW_DYNLIB_IMPORT(module, "clCreateUserEvent");
204 	__clewRetainEvent = (PFNCLRETAINEVENT)CLEW_DYNLIB_IMPORT(module, "clRetainEvent");
205 	__clewReleaseEvent = (PFNCLRELEASEEVENT)CLEW_DYNLIB_IMPORT(module, "clReleaseEvent");
206 	__clewSetUserEventStatus = (PFNCLSETUSEREVENTSTATUS)CLEW_DYNLIB_IMPORT(module, "clSetUserEventStatus");
207 	__clewSetEventCallback = (PFNCLSETEVENTCALLBACK)CLEW_DYNLIB_IMPORT(module, "clSetEventCallback");
208 	__clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO)CLEW_DYNLIB_IMPORT(module, "clGetEventProfilingInfo");
209 	__clewFlush = (PFNCLFLUSH)CLEW_DYNLIB_IMPORT(module, "clFlush");
210 	__clewFinish = (PFNCLFINISH)CLEW_DYNLIB_IMPORT(module, "clFinish");
211 	__clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER)CLEW_DYNLIB_IMPORT(module, "clEnqueueReadBuffer");
212 	__clewEnqueueReadBufferRect = (PFNCLENQUEUEREADBUFFERRECT)CLEW_DYNLIB_IMPORT(module, "clEnqueueReadBufferRect");
213 	__clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER)CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer");
214 	__clewEnqueueWriteBufferRect = (PFNCLENQUEUEWRITEBUFFERRECT)CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteBufferRect");
215 	__clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER)CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer");
216 	__clewEnqueueCopyBufferRect = (PFNCLENQUEUECOPYBUFFERRECT)CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBufferRect");
217 	__clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE)CLEW_DYNLIB_IMPORT(module, "clEnqueueReadImage");
218 	__clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE)CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteImage");
219 	__clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE)CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyImage");
220 	__clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER)CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer");
221 	__clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE)CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage");
222 	__clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER)CLEW_DYNLIB_IMPORT(module, "clEnqueueMapBuffer");
223 	__clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE)CLEW_DYNLIB_IMPORT(module, "clEnqueueMapImage");
224 	__clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT)CLEW_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject");
225 	__clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL)CLEW_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel");
226 	__clewEnqueueTask = (PFNCLENQUEUETASK)CLEW_DYNLIB_IMPORT(module, "clEnqueueTask");
227 	__clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL)CLEW_DYNLIB_IMPORT(module, "clEnqueueNativeKernel");
228 	__clewEnqueueMarker = (PFNCLENQUEUEMARKER)CLEW_DYNLIB_IMPORT(module, "clEnqueueMarker");
229 	__clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS)CLEW_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
230 	__clewEnqueueBarrier = (PFNCLENQUEUEBARRIER)CLEW_DYNLIB_IMPORT(module, "clEnqueueBarrier");
231 	__clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS)CLEW_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
232 
233 	return CLEW_SUCCESS;
234 }
235 
clewErrorString(cl_int error)236 const char* clewErrorString(cl_int error)
237 {
238 	static const char* strings[] =
239 		{
240 			// Error Codes
241 			"CL_SUCCESS"  //   0
242 			,
243 			"CL_DEVICE_NOT_FOUND"  //  -1
244 			,
245 			"CL_DEVICE_NOT_AVAILABLE"  //  -2
246 			,
247 			"CL_COMPILER_NOT_AVAILABLE"  //  -3
248 			,
249 			"CL_MEM_OBJECT_ALLOCATION_FAILURE"  //  -4
250 			,
251 			"CL_OUT_OF_RESOURCES"  //  -5
252 			,
253 			"CL_OUT_OF_HOST_MEMORY"  //  -6
254 			,
255 			"CL_PROFILING_INFO_NOT_AVAILABLE"  //  -7
256 			,
257 			"CL_MEM_COPY_OVERLAP"  //  -8
258 			,
259 			"CL_IMAGE_FORMAT_MISMATCH"  //  -9
260 			,
261 			"CL_IMAGE_FORMAT_NOT_SUPPORTED"  //  -10
262 			,
263 			"CL_BUILD_PROGRAM_FAILURE"  //  -11
264 			,
265 			"CL_MAP_FAILURE"  //  -12
266 
267 			,
268 			""  //  -13
269 			,
270 			""  //  -14
271 			,
272 			""  //  -15
273 			,
274 			""  //  -16
275 			,
276 			""  //  -17
277 			,
278 			""  //  -18
279 			,
280 			""  //  -19
281 
282 			,
283 			""  //  -20
284 			,
285 			""  //  -21
286 			,
287 			""  //  -22
288 			,
289 			""  //  -23
290 			,
291 			""  //  -24
292 			,
293 			""  //  -25
294 			,
295 			""  //  -26
296 			,
297 			""  //  -27
298 			,
299 			""  //  -28
300 			,
301 			""  //  -29
302 
303 			,
304 			"CL_INVALID_VALUE"  //  -30
305 			,
306 			"CL_INVALID_DEVICE_TYPE"  //  -31
307 			,
308 			"CL_INVALID_PLATFORM"  //  -32
309 			,
310 			"CL_INVALID_DEVICE"  //  -33
311 			,
312 			"CL_INVALID_CONTEXT"  //  -34
313 			,
314 			"CL_INVALID_QUEUE_PROPERTIES"  //  -35
315 			,
316 			"CL_INVALID_COMMAND_QUEUE"  //  -36
317 			,
318 			"CL_INVALID_HOST_PTR"  //  -37
319 			,
320 			"CL_INVALID_MEM_OBJECT"  //  -38
321 			,
322 			"CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"  //  -39
323 			,
324 			"CL_INVALID_IMAGE_SIZE"  //  -40
325 			,
326 			"CL_INVALID_SAMPLER"  //  -41
327 			,
328 			"CL_INVALID_BINARY"  //  -42
329 			,
330 			"CL_INVALID_BUILD_OPTIONS"  //  -43
331 			,
332 			"CL_INVALID_PROGRAM"  //  -44
333 			,
334 			"CL_INVALID_PROGRAM_EXECUTABLE"  //  -45
335 			,
336 			"CL_INVALID_KERNEL_NAME"  //  -46
337 			,
338 			"CL_INVALID_KERNEL_DEFINITION"  //  -47
339 			,
340 			"CL_INVALID_KERNEL"  //  -48
341 			,
342 			"CL_INVALID_ARG_INDEX"  //  -49
343 			,
344 			"CL_INVALID_ARG_VALUE"  //  -50
345 			,
346 			"CL_INVALID_ARG_SIZE"  //  -51
347 			,
348 			"CL_INVALID_KERNEL_ARGS"  //  -52
349 			,
350 			"CL_INVALID_WORK_DIMENSION"  //  -53
351 			,
352 			"CL_INVALID_WORK_GROUP_SIZE"  //  -54
353 			,
354 			"CL_INVALID_WORK_ITEM_SIZE"  //  -55
355 			,
356 			"CL_INVALID_GLOBAL_OFFSET"  //  -56
357 			,
358 			"CL_INVALID_EVENT_WAIT_LIST"  //  -57
359 			,
360 			"CL_INVALID_EVENT"  //  -58
361 			,
362 			"CL_INVALID_OPERATION"  //  -59
363 			,
364 			"CL_INVALID_GL_OBJECT"  //  -60
365 			,
366 			"CL_INVALID_BUFFER_SIZE"  //  -61
367 			,
368 			"CL_INVALID_MIP_LEVEL"  //  -62
369 			,
370 			"CL_INVALID_GLOBAL_WORK_SIZE"  //  -63
371 		};
372 
373 	return strings[-error];
374 }
375