bump product version to 5.0.4.1
[LibreOffice.git] / clew / source / clew.c
blobc7f4a9b4a626adaf7cc95b812a9a276ab2c820cc
1 //////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2009-2011 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 //////////////////////////////////////////////////////////////////////////
9 #include "clew/clew.h"
11 //! \file clew.c
12 //! \brief OpenCL run-time loader source
14 #ifndef CLCC_GENERATE_DOCUMENTATION
15 #ifdef _WIN32
16 #define WIN32_LEAN_AND_MEAN
17 #define VC_EXTRALEAN
18 #include <windows.h>
20 typedef HMODULE CLCC_DYNLIB_HANDLE;
22 #define CLCC_DYNLIB_OPEN LoadLibrary
23 #define CLCC_DYNLIB_CLOSE FreeLibrary
24 #define CLCC_DYNLIB_IMPORT GetProcAddress
25 #else
26 #include <dlfcn.h>
28 typedef void* CLCC_DYNLIB_HANDLE;
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
41 #include <stdlib.h>
43 //! \brief module handle
44 static CLCC_DYNLIB_HANDLE module = NULL;
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
117 //! \brief Unloads OpenCL dynamic library, should not be called directly
118 static void clewExit(void)
120 if (module != NULL)
122 // Ignore errors
123 CLCC_DYNLIB_CLOSE(module);
124 module = NULL;
128 #define CLEW_CHECK_FUNCTION(f) \
129 if ((f) == NULL) \
131 CLCC_DYNLIB_CLOSE(module); \
132 module = NULL; \
133 return CLEW_ERROR_IMPORT_FAILED; \
136 //! \param path path to dynamic library to load
137 //! \return CLEW_ERROR_OPEN_FAILED if the library could not be opened
138 //! CLEW_ERROR_ATEXIT_FAILED if atexit(clewExit) failed
139 //! CLEW_SUCCESS when the library was succesfully loaded
140 int clewInit(const char* path)
142 int error = 0;
144 // Check if already initialized
145 if (module != NULL)
147 return CLEW_SUCCESS;
150 // Load library
151 module = CLCC_DYNLIB_OPEN(path);
153 // Check for errors
154 if (module == NULL)
156 return CLEW_ERROR_OPEN_FAILED;
159 // Set unloading
160 error = atexit(clewExit);
162 if (error)
164 // Failure queing atexit, shutdown with error
165 CLCC_DYNLIB_CLOSE(module);
166 module = NULL;
168 return CLEW_ERROR_ATEXIT_FAILED;
171 // Determine function entry-points
172 CLEW_CHECK_FUNCTION(__clewGetPlatformIDs = (PFNCLGETPLATFORMIDS )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs"));
173 CLEW_CHECK_FUNCTION(__clewGetPlatformInfo = (PFNCLGETPLATFORMINFO )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo"));
174 CLEW_CHECK_FUNCTION(__clewGetDeviceIDs = (PFNCLGETDEVICEIDS )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs"));
175 CLEW_CHECK_FUNCTION(__clewGetDeviceInfo = (PFNCLGETDEVICEINFO )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo"));
176 CLEW_CHECK_FUNCTION(__clewCreateContext = (PFNCLCREATECONTEXT )CLCC_DYNLIB_IMPORT(module, "clCreateContext"));
177 CLEW_CHECK_FUNCTION(__clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType"));
178 CLEW_CHECK_FUNCTION(__clewRetainContext = (PFNCLRETAINCONTEXT )CLCC_DYNLIB_IMPORT(module, "clRetainContext"));
179 CLEW_CHECK_FUNCTION(__clewReleaseContext = (PFNCLRELEASECONTEXT )CLCC_DYNLIB_IMPORT(module, "clReleaseContext"));
180 CLEW_CHECK_FUNCTION(__clewGetContextInfo = (PFNCLGETCONTEXTINFO )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo"));
181 CLEW_CHECK_FUNCTION(__clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue"));
182 CLEW_CHECK_FUNCTION(__clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue"));
183 CLEW_CHECK_FUNCTION(__clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue"));
184 CLEW_CHECK_FUNCTION(__clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo"));
185 CLEW_CHECK_FUNCTION(__clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty"));
186 CLEW_CHECK_FUNCTION(__clewCreateBuffer = (PFNCLCREATEBUFFER )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer"));
187 CLEW_CHECK_FUNCTION(__clewCreateImage2D = (PFNCLCREATEIMAGE2D )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D"));
188 CLEW_CHECK_FUNCTION(__clewCreateImage3D = (PFNCLCREATEIMAGE3D )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D"));
189 CLEW_CHECK_FUNCTION(__clewRetainMemObject = (PFNCLRETAINMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject"));
190 CLEW_CHECK_FUNCTION(__clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject"));
191 CLEW_CHECK_FUNCTION(__clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats"));
192 CLEW_CHECK_FUNCTION(__clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo"));
193 CLEW_CHECK_FUNCTION(__clewGetImageInfo = (PFNCLGETIMAGEINFO )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo"));
194 CLEW_CHECK_FUNCTION(__clewCreateSampler = (PFNCLCREATESAMPLER )CLCC_DYNLIB_IMPORT(module, "clCreateSampler"));
195 CLEW_CHECK_FUNCTION(__clewRetainSampler = (PFNCLRETAINSAMPLER )CLCC_DYNLIB_IMPORT(module, "clRetainSampler"));
196 CLEW_CHECK_FUNCTION(__clewReleaseSampler = (PFNCLRELEASESAMPLER )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler"));
197 CLEW_CHECK_FUNCTION(__clewGetSamplerInfo = (PFNCLGETSAMPLERINFO )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo"));
198 CLEW_CHECK_FUNCTION(__clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource"));
199 CLEW_CHECK_FUNCTION(__clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary"));
200 CLEW_CHECK_FUNCTION(__clewRetainProgram = (PFNCLRETAINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clRetainProgram"));
201 CLEW_CHECK_FUNCTION(__clewReleaseProgram = (PFNCLRELEASEPROGRAM )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram"));
202 CLEW_CHECK_FUNCTION(__clewBuildProgram = (PFNCLBUILDPROGRAM )CLCC_DYNLIB_IMPORT(module, "clBuildProgram"));
203 CLEW_CHECK_FUNCTION(__clewUnloadCompiler = (PFNCLUNLOADCOMPILER )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler"));
204 CLEW_CHECK_FUNCTION(__clewGetProgramInfo = (PFNCLGETPROGRAMINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo"));
205 CLEW_CHECK_FUNCTION(__clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo"));
206 CLEW_CHECK_FUNCTION(__clewCreateKernel = (PFNCLCREATEKERNEL )CLCC_DYNLIB_IMPORT(module, "clCreateKernel"));
207 CLEW_CHECK_FUNCTION(__clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram"));
208 CLEW_CHECK_FUNCTION(__clewRetainKernel = (PFNCLRETAINKERNEL )CLCC_DYNLIB_IMPORT(module, "clRetainKernel"));
209 CLEW_CHECK_FUNCTION(__clewReleaseKernel = (PFNCLRELEASEKERNEL )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel"));
210 CLEW_CHECK_FUNCTION(__clewSetKernelArg = (PFNCLSETKERNELARG )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg"));
211 CLEW_CHECK_FUNCTION(__clewGetKernelInfo = (PFNCLGETKERNELINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo"));
212 CLEW_CHECK_FUNCTION(__clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo"));
213 CLEW_CHECK_FUNCTION(__clewWaitForEvents = (PFNCLWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents"));
214 CLEW_CHECK_FUNCTION(__clewGetEventInfo = (PFNCLGETEVENTINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo"));
215 CLEW_CHECK_FUNCTION(__clewRetainEvent = (PFNCLRETAINEVENT )CLCC_DYNLIB_IMPORT(module, "clRetainEvent"));
216 CLEW_CHECK_FUNCTION(__clewReleaseEvent = (PFNCLRELEASEEVENT )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent"));
217 CLEW_CHECK_FUNCTION(__clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo"));
218 CLEW_CHECK_FUNCTION(__clewFlush = (PFNCLFLUSH )CLCC_DYNLIB_IMPORT(module, "clFlush"));
219 CLEW_CHECK_FUNCTION(__clewFinish = (PFNCLFINISH )CLCC_DYNLIB_IMPORT(module, "clFinish"));
220 CLEW_CHECK_FUNCTION(__clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer"));
221 CLEW_CHECK_FUNCTION(__clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer"));
222 CLEW_CHECK_FUNCTION(__clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer"));
223 CLEW_CHECK_FUNCTION(__clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage"));
224 CLEW_CHECK_FUNCTION(__clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage"));
225 CLEW_CHECK_FUNCTION(__clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage"));
226 CLEW_CHECK_FUNCTION(__clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer"));
227 CLEW_CHECK_FUNCTION(__clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage"));
228 CLEW_CHECK_FUNCTION(__clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer"));
229 CLEW_CHECK_FUNCTION(__clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage"));
230 CLEW_CHECK_FUNCTION(__clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject"));
231 CLEW_CHECK_FUNCTION(__clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel"));
232 CLEW_CHECK_FUNCTION(__clewEnqueueTask = (PFNCLENQUEUETASK )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask"));
233 CLEW_CHECK_FUNCTION(__clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel"));
234 CLEW_CHECK_FUNCTION(__clewEnqueueMarker = (PFNCLENQUEUEMARKER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker"));
235 CLEW_CHECK_FUNCTION(__clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"));
236 CLEW_CHECK_FUNCTION(__clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"));
237 CLEW_CHECK_FUNCTION(__clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"));
239 return CLEW_SUCCESS;
242 //! \param error CL error code
243 //! \return a string representation of the error code
244 const char* clewErrorString(cl_int error)
246 static const char* strings[] =
248 // Error Codes
249 "CL_SUCCESS" // 0
250 , "CL_DEVICE_NOT_FOUND" // -1
251 , "CL_DEVICE_NOT_AVAILABLE" // -2
252 , "CL_COMPILER_NOT_AVAILABLE" // -3
253 , "CL_MEM_OBJECT_ALLOCATION_FAILURE" // -4
254 , "CL_OUT_OF_RESOURCES" // -5
255 , "CL_OUT_OF_HOST_MEMORY" // -6
256 , "CL_PROFILING_INFO_NOT_AVAILABLE" // -7
257 , "CL_MEM_COPY_OVERLAP" // -8
258 , "CL_IMAGE_FORMAT_MISMATCH" // -9
259 , "CL_IMAGE_FORMAT_NOT_SUPPORTED" // -10
260 , "CL_BUILD_PROGRAM_FAILURE" // -11
261 , "CL_MAP_FAILURE" // -12
263 , "" // -13
264 , "" // -14
265 , "" // -15
266 , "" // -16
267 , "" // -17
268 , "" // -18
269 , "" // -19
271 , "" // -20
272 , "" // -21
273 , "" // -22
274 , "" // -23
275 , "" // -24
276 , "" // -25
277 , "" // -26
278 , "" // -27
279 , "" // -28
280 , "" // -29
282 , "CL_INVALID_VALUE" // -30
283 , "CL_INVALID_DEVICE_TYPE" // -31
284 , "CL_INVALID_PLATFORM" // -32
285 , "CL_INVALID_DEVICE" // -33
286 , "CL_INVALID_CONTEXT" // -34
287 , "CL_INVALID_QUEUE_PROPERTIES" // -35
288 , "CL_INVALID_COMMAND_QUEUE" // -36
289 , "CL_INVALID_HOST_PTR" // -37
290 , "CL_INVALID_MEM_OBJECT" // -38
291 , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR" // -39
292 , "CL_INVALID_IMAGE_SIZE" // -40
293 , "CL_INVALID_SAMPLER" // -41
294 , "CL_INVALID_BINARY" // -42
295 , "CL_INVALID_BUILD_OPTIONS" // -43
296 , "CL_INVALID_PROGRAM" // -44
297 , "CL_INVALID_PROGRAM_EXECUTABLE" // -45
298 , "CL_INVALID_KERNEL_NAME" // -46
299 , "CL_INVALID_KERNEL_DEFINITION" // -47
300 , "CL_INVALID_KERNEL" // -48
301 , "CL_INVALID_ARG_INDEX" // -49
302 , "CL_INVALID_ARG_VALUE" // -50
303 , "CL_INVALID_ARG_SIZE" // -51
304 , "CL_INVALID_KERNEL_ARGS" // -52
305 , "CL_INVALID_WORK_DIMENSION" // -53
306 , "CL_INVALID_WORK_GROUP_SIZE" // -54
307 , "CL_INVALID_WORK_ITEM_SIZE" // -55
308 , "CL_INVALID_GLOBAL_OFFSET" // -56
309 , "CL_INVALID_EVENT_WAIT_LIST" // -57
310 , "CL_INVALID_EVENT" // -58
311 , "CL_INVALID_OPERATION" // -59
312 , "CL_INVALID_GL_OBJECT" // -60
313 , "CL_INVALID_BUFFER_SIZE" // -61
314 , "CL_INVALID_MIP_LEVEL" // -62
315 , "CL_INVALID_GLOBAL_WORK_SIZE" // -63
318 if ( (error > 0)
319 || (error < -63)
322 return "unknown error code (no OpenCL driver?)";
325 return strings[-error];