clew.c 20 KB

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