clew.h 121 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823
  1. #ifndef CLEW_HPP_INCLUDED
  2. #define CLEW_HPP_INCLUDED
  3. //////////////////////////////////////////////////////////////////////////
  4. // Copyright (c) 2009-2011 Organic Vectory B.V., KindDragon
  5. // Written by George van Venrooij
  6. //
  7. // Distributed under the MIT License.
  8. //////////////////////////////////////////////////////////////////////////
  9. //! \file clew.h
  10. //! \brief OpenCL run-time loader header
  11. //!
  12. //! This file contains a copy of the contents of CL.H and CL_PLATFORM.H from the
  13. //! official OpenCL spec. The purpose of this code is to load the OpenCL dynamic
  14. //! library at run-time and thus allow the executable to function on many
  15. //! platforms regardless of the vendor of the OpenCL driver actually installed.
  16. //! Some of the techniques used here were inspired by work done in the GLEW
  17. //! library (http://glew.sourceforge.net/)
  18. // Run-time dynamic linking functionality based on concepts used in GLEW
  19. #ifdef __OPENCL_CL_H
  20. #error cl.h included before clew.h
  21. #endif
  22. #ifdef __OPENCL_CL_PLATFORM_H
  23. #error cl_platform.h included before clew.h
  24. #endif
  25. // Prevent cl.h inclusion
  26. #define __OPENCL_CL_H
  27. // Prevent cl_platform.h inclusion
  28. #define __CL_PLATFORM_H
  29. /*******************************************************************************
  30. * Copyright (c) 2008-2010 The Khronos Group Inc.
  31. *
  32. * Permission is hereby granted, free of charge, to any person obtaining a
  33. * copy of this software and/or associated documentation files (the
  34. * "Materials"), to deal in the Materials without restriction, including
  35. * without limitation the rights to use, copy, modify, merge, publish,
  36. * distribute, sublicense, and/or sell copies of the Materials, and to
  37. * permit persons to whom the Materials are furnished to do so, subject to
  38. * the following conditions:
  39. *
  40. * The above copyright notice and this permission notice shall be included
  41. * in all copies or substantial portions of the Materials.
  42. *
  43. * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  44. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  45. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  46. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  47. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  48. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  49. * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  50. ******************************************************************************/
  51. #ifdef __APPLE__
  52. /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
  53. #include <AvailabilityMacros.h>
  54. #endif
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. #if defined(_WIN32)
  59. #define CL_API_ENTRY
  60. #define CL_API_CALL __stdcall
  61. #define CL_CALLBACK __stdcall
  62. #else
  63. #define CL_API_ENTRY
  64. #define CL_API_CALL
  65. #define CL_CALLBACK
  66. #endif
  67. #ifdef __APPLE__
  68. #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
  69. #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
  70. #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
  71. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
  72. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
  73. #define CL_API_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
  74. #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
  75. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
  76. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
  77. #define CL_API_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK
  78. #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK
  79. #else
  80. #define CL_EXTENSION_WEAK_LINK
  81. #define CL_API_SUFFIX__VERSION_1_0
  82. #define CL_EXT_SUFFIX__VERSION_1_0
  83. #define CL_API_SUFFIX__VERSION_1_1
  84. #define CL_EXT_SUFFIX__VERSION_1_1
  85. #define CL_API_SUFFIX__VERSION_1_2
  86. #define CL_EXT_SUFFIX__VERSION_1_2
  87. #if defined(__GNUC__)
  88. #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
  89. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  90. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  91. #else
  92. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
  93. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  94. #endif
  95. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  96. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  97. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  98. #else
  99. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
  100. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  101. #endif
  102. #elif defined(_WIN32)
  103. #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
  104. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  105. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  106. #else
  107. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  108. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
  109. #endif
  110. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  111. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  112. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  113. #else
  114. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  115. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
  116. #endif
  117. #else
  118. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  119. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  120. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  121. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  122. #endif
  123. #endif
  124. #if (defined (_WIN32) && defined(_MSC_VER))
  125. /* scalar types */
  126. typedef signed __int8 cl_char;
  127. typedef unsigned __int8 cl_uchar;
  128. typedef signed __int16 cl_short;
  129. typedef unsigned __int16 cl_ushort;
  130. typedef signed __int32 cl_int;
  131. typedef unsigned __int32 cl_uint;
  132. typedef signed __int64 cl_long;
  133. typedef unsigned __int64 cl_ulong;
  134. typedef unsigned __int16 cl_half;
  135. typedef float cl_float;
  136. typedef double cl_double;
  137. /* Macro names and corresponding values defined by OpenCL */
  138. #define CL_CHAR_BIT 8
  139. #define CL_SCHAR_MAX 127
  140. #define CL_SCHAR_MIN (-127-1)
  141. #define CL_CHAR_MAX CL_SCHAR_MAX
  142. #define CL_CHAR_MIN CL_SCHAR_MIN
  143. #define CL_UCHAR_MAX 255
  144. #define CL_SHRT_MAX 32767
  145. #define CL_SHRT_MIN (-32767-1)
  146. #define CL_USHRT_MAX 65535
  147. #define CL_INT_MAX 2147483647
  148. #define CL_INT_MIN (-2147483647-1)
  149. #define CL_UINT_MAX 0xffffffffU
  150. #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
  151. #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
  152. #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
  153. #define CL_FLT_DIG 6
  154. #define CL_FLT_MANT_DIG 24
  155. #define CL_FLT_MAX_10_EXP +38
  156. #define CL_FLT_MAX_EXP +128
  157. #define CL_FLT_MIN_10_EXP -37
  158. #define CL_FLT_MIN_EXP -125
  159. #define CL_FLT_RADIX 2
  160. #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
  161. #define CL_FLT_MIN 1.175494350822287507969e-38f
  162. #define CL_FLT_EPSILON 0x1.0p-23f
  163. #define CL_DBL_DIG 15
  164. #define CL_DBL_MANT_DIG 53
  165. #define CL_DBL_MAX_10_EXP +308
  166. #define CL_DBL_MAX_EXP +1024
  167. #define CL_DBL_MIN_10_EXP -307
  168. #define CL_DBL_MIN_EXP -1021
  169. #define CL_DBL_RADIX 2
  170. #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
  171. #define CL_DBL_MIN 2.225073858507201383090e-308
  172. #define CL_DBL_EPSILON 2.220446049250313080847e-16
  173. #define CL_M_E 2.718281828459045090796
  174. #define CL_M_LOG2E 1.442695040888963387005
  175. #define CL_M_LOG10E 0.434294481903251816668
  176. #define CL_M_LN2 0.693147180559945286227
  177. #define CL_M_LN10 2.302585092994045901094
  178. #define CL_M_PI 3.141592653589793115998
  179. #define CL_M_PI_2 1.570796326794896557999
  180. #define CL_M_PI_4 0.785398163397448278999
  181. #define CL_M_1_PI 0.318309886183790691216
  182. #define CL_M_2_PI 0.636619772367581382433
  183. #define CL_M_2_SQRTPI 1.128379167095512558561
  184. #define CL_M_SQRT2 1.414213562373095145475
  185. #define CL_M_SQRT1_2 0.707106781186547572737
  186. #define CL_M_E_F 2.71828174591064f
  187. #define CL_M_LOG2E_F 1.44269502162933f
  188. #define CL_M_LOG10E_F 0.43429449200630f
  189. #define CL_M_LN2_F 0.69314718246460f
  190. #define CL_M_LN10_F 2.30258512496948f
  191. #define CL_M_PI_F 3.14159274101257f
  192. #define CL_M_PI_2_F 1.57079637050629f
  193. #define CL_M_PI_4_F 0.78539818525314f
  194. #define CL_M_1_PI_F 0.31830987334251f
  195. #define CL_M_2_PI_F 0.63661974668503f
  196. #define CL_M_2_SQRTPI_F 1.12837922573090f
  197. #define CL_M_SQRT2_F 1.41421353816986f
  198. #define CL_M_SQRT1_2_F 0.70710676908493f
  199. #define CL_NAN (CL_INFINITY - CL_INFINITY)
  200. #define CL_HUGE_VALF ((cl_float) 1e50)
  201. #define CL_HUGE_VAL ((cl_double) 1e500)
  202. #define CL_MAXFLOAT CL_FLT_MAX
  203. #define CL_INFINITY CL_HUGE_VALF
  204. #else
  205. #include <stdint.h>
  206. /* scalar types */
  207. typedef int8_t cl_char;
  208. typedef uint8_t cl_uchar;
  209. typedef int16_t cl_short __attribute__((aligned(2)));
  210. typedef uint16_t cl_ushort __attribute__((aligned(2)));
  211. typedef int32_t cl_int __attribute__((aligned(4)));
  212. typedef uint32_t cl_uint __attribute__((aligned(4)));
  213. typedef int64_t cl_long __attribute__((aligned(8)));
  214. typedef uint64_t cl_ulong __attribute__((aligned(8)));
  215. typedef uint16_t cl_half __attribute__((aligned(2)));
  216. typedef float cl_float __attribute__((aligned(4)));
  217. typedef double cl_double __attribute__((aligned(8)));
  218. /* Macro names and corresponding values defined by OpenCL */
  219. #define CL_CHAR_BIT 8
  220. #define CL_SCHAR_MAX 127
  221. #define CL_SCHAR_MIN (-127-1)
  222. #define CL_CHAR_MAX CL_SCHAR_MAX
  223. #define CL_CHAR_MIN CL_SCHAR_MIN
  224. #define CL_UCHAR_MAX 255
  225. #define CL_SHRT_MAX 32767
  226. #define CL_SHRT_MIN (-32767-1)
  227. #define CL_USHRT_MAX 65535
  228. #define CL_INT_MAX 2147483647
  229. #define CL_INT_MIN (-2147483647-1)
  230. #define CL_UINT_MAX 0xffffffffU
  231. #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
  232. #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
  233. #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
  234. #define CL_FLT_DIG 6
  235. #define CL_FLT_MANT_DIG 24
  236. #define CL_FLT_MAX_10_EXP +38
  237. #define CL_FLT_MAX_EXP +128
  238. #define CL_FLT_MIN_10_EXP -37
  239. #define CL_FLT_MIN_EXP -125
  240. #define CL_FLT_RADIX 2
  241. #define CL_FLT_MAX 0x1.fffffep127f
  242. #define CL_FLT_MIN 0x1.0p-126f
  243. #define CL_FLT_EPSILON 0x1.0p-23f
  244. #define CL_DBL_DIG 15
  245. #define CL_DBL_MANT_DIG 53
  246. #define CL_DBL_MAX_10_EXP +308
  247. #define CL_DBL_MAX_EXP +1024
  248. #define CL_DBL_MIN_10_EXP -307
  249. #define CL_DBL_MIN_EXP -1021
  250. #define CL_DBL_RADIX 2
  251. #define CL_DBL_MAX 0x1.fffffffffffffp1023
  252. #define CL_DBL_MIN 0x1.0p-1022
  253. #define CL_DBL_EPSILON 0x1.0p-52
  254. #define CL_M_E 2.718281828459045090796
  255. #define CL_M_LOG2E 1.442695040888963387005
  256. #define CL_M_LOG10E 0.434294481903251816668
  257. #define CL_M_LN2 0.693147180559945286227
  258. #define CL_M_LN10 2.302585092994045901094
  259. #define CL_M_PI 3.141592653589793115998
  260. #define CL_M_PI_2 1.570796326794896557999
  261. #define CL_M_PI_4 0.785398163397448278999
  262. #define CL_M_1_PI 0.318309886183790691216
  263. #define CL_M_2_PI 0.636619772367581382433
  264. #define CL_M_2_SQRTPI 1.128379167095512558561
  265. #define CL_M_SQRT2 1.414213562373095145475
  266. #define CL_M_SQRT1_2 0.707106781186547572737
  267. #define CL_M_E_F 2.71828174591064f
  268. #define CL_M_LOG2E_F 1.44269502162933f
  269. #define CL_M_LOG10E_F 0.43429449200630f
  270. #define CL_M_LN2_F 0.69314718246460f
  271. #define CL_M_LN10_F 2.30258512496948f
  272. #define CL_M_PI_F 3.14159274101257f
  273. #define CL_M_PI_2_F 1.57079637050629f
  274. #define CL_M_PI_4_F 0.78539818525314f
  275. #define CL_M_1_PI_F 0.31830987334251f
  276. #define CL_M_2_PI_F 0.63661974668503f
  277. #define CL_M_2_SQRTPI_F 1.12837922573090f
  278. #define CL_M_SQRT2_F 1.41421353816986f
  279. #define CL_M_SQRT1_2_F 0.70710676908493f
  280. #if defined( __GNUC__ )
  281. #define CL_HUGE_VALF __builtin_huge_valf()
  282. #define CL_HUGE_VAL __builtin_huge_val()
  283. #define CL_NAN __builtin_nanf( "" )
  284. #else
  285. #define CL_HUGE_VALF ((cl_float) 1e50)
  286. #define CL_HUGE_VAL ((cl_double) 1e500)
  287. float nanf( const char * );
  288. #define CL_NAN nanf( "" )
  289. #endif
  290. #define CL_MAXFLOAT CL_FLT_MAX
  291. #define CL_INFINITY CL_HUGE_VALF
  292. #endif
  293. #include <stddef.h>
  294. /* Mirror types to GL types. Mirror types allow us to avoid deciding which headers to load based on whether we are using GL or GLES here. */
  295. typedef unsigned int cl_GLuint;
  296. typedef int cl_GLint;
  297. typedef unsigned int cl_GLenum;
  298. /*
  299. * Vector types
  300. *
  301. * Note: OpenCL requires that all types be naturally aligned.
  302. * This means that vector types must be naturally aligned.
  303. * For example, a vector of four floats must be aligned to
  304. * a 16 byte boundary (calculated as 4 * the natural 4-byte
  305. * alignment of the float). The alignment qualifiers here
  306. * will only function properly if your compiler supports them
  307. * and if you don't actively work to defeat them. For example,
  308. * in order for a cl_float4 to be 16 byte aligned in a struct,
  309. * the start of the struct must itself be 16-byte aligned.
  310. *
  311. * Maintaining proper alignment is the user's responsibility.
  312. */
  313. #ifdef _MSC_VER
  314. #if defined(_M_IX86)
  315. #if _M_IX86_FP >= 0 && !defined(__SSE__)
  316. #define __SSE__
  317. #endif
  318. #if _M_IX86_FP >= 1
  319. # ifndef __SSE2__
  320. # define __SSE2__
  321. # endif
  322. #endif
  323. #elif defined(_M_X64)
  324. # ifndef __SSE__
  325. # define __SSE__
  326. # endif
  327. # ifndef __SSE2__
  328. # define __SSE2__
  329. # endif
  330. #endif
  331. #endif
  332. /* Define basic vector types */
  333. /* Workaround for ppc64el platform: conflicts with bool from C++. */
  334. #if defined( __VEC__ ) && !(defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
  335. #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
  336. typedef vector unsigned char __cl_uchar16;
  337. typedef vector signed char __cl_char16;
  338. typedef vector unsigned short __cl_ushort8;
  339. typedef vector signed short __cl_short8;
  340. typedef vector unsigned int __cl_uint4;
  341. typedef vector signed int __cl_int4;
  342. typedef vector float __cl_float4;
  343. #define __CL_UCHAR16__ 1
  344. #define __CL_CHAR16__ 1
  345. #define __CL_USHORT8__ 1
  346. #define __CL_SHORT8__ 1
  347. #define __CL_UINT4__ 1
  348. #define __CL_INT4__ 1
  349. #define __CL_FLOAT4__ 1
  350. #endif
  351. #if defined( __SSE__ )
  352. #if defined( __MINGW64__ )
  353. #include <intrin.h>
  354. #else
  355. #include <xmmintrin.h>
  356. #endif
  357. #if defined( __GNUC__ ) && !defined( __ICC )
  358. typedef float __cl_float4 __attribute__((vector_size(16)));
  359. #else
  360. typedef __m128 __cl_float4;
  361. #endif
  362. #define __CL_FLOAT4__ 1
  363. #endif
  364. #if defined( __SSE2__ )
  365. #if defined( __MINGW64__ )
  366. #include <intrin.h>
  367. #else
  368. #include <emmintrin.h>
  369. #endif
  370. #if defined( __GNUC__ ) && !defined( __ICC )
  371. typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
  372. typedef cl_char __cl_char16 __attribute__((vector_size(16)));
  373. typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
  374. typedef cl_short __cl_short8 __attribute__((vector_size(16)));
  375. typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
  376. typedef cl_int __cl_int4 __attribute__((vector_size(16)));
  377. typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
  378. typedef cl_long __cl_long2 __attribute__((vector_size(16)));
  379. typedef cl_double __cl_double2 __attribute__((vector_size(16)));
  380. #else
  381. typedef __m128i __cl_uchar16;
  382. typedef __m128i __cl_char16;
  383. typedef __m128i __cl_ushort8;
  384. typedef __m128i __cl_short8;
  385. typedef __m128i __cl_uint4;
  386. typedef __m128i __cl_int4;
  387. typedef __m128i __cl_ulong2;
  388. typedef __m128i __cl_long2;
  389. typedef __m128d __cl_double2;
  390. #endif
  391. #define __CL_UCHAR16__ 1
  392. #define __CL_CHAR16__ 1
  393. #define __CL_USHORT8__ 1
  394. #define __CL_SHORT8__ 1
  395. #define __CL_INT4__ 1
  396. #define __CL_UINT4__ 1
  397. #define __CL_ULONG2__ 1
  398. #define __CL_LONG2__ 1
  399. #define __CL_DOUBLE2__ 1
  400. #endif
  401. #if defined( __MMX__ )
  402. #include <mmintrin.h>
  403. #if defined( __GNUC__ ) && !defined( __ICC )
  404. typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
  405. typedef cl_char __cl_char8 __attribute__((vector_size(8)));
  406. typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
  407. typedef cl_short __cl_short4 __attribute__((vector_size(8)));
  408. typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
  409. typedef cl_int __cl_int2 __attribute__((vector_size(8)));
  410. typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
  411. typedef cl_long __cl_long1 __attribute__((vector_size(8)));
  412. typedef cl_float __cl_float2 __attribute__((vector_size(8)));
  413. #else
  414. typedef __m64 __cl_uchar8;
  415. typedef __m64 __cl_char8;
  416. typedef __m64 __cl_ushort4;
  417. typedef __m64 __cl_short4;
  418. typedef __m64 __cl_uint2;
  419. typedef __m64 __cl_int2;
  420. typedef __m64 __cl_ulong1;
  421. typedef __m64 __cl_long1;
  422. typedef __m64 __cl_float2;
  423. #endif
  424. #define __CL_UCHAR8__ 1
  425. #define __CL_CHAR8__ 1
  426. #define __CL_USHORT4__ 1
  427. #define __CL_SHORT4__ 1
  428. #define __CL_INT2__ 1
  429. #define __CL_UINT2__ 1
  430. #define __CL_ULONG1__ 1
  431. #define __CL_LONG1__ 1
  432. #define __CL_FLOAT2__ 1
  433. #endif
  434. #if defined( __AVX__ )
  435. #if defined( __MINGW64__ )
  436. #include <intrin.h>
  437. #else
  438. #include <immintrin.h>
  439. #endif
  440. #if defined( __GNUC__ ) && !defined( __ICC )
  441. typedef cl_float __cl_float8 __attribute__((vector_size(32)));
  442. typedef cl_double __cl_double4 __attribute__((vector_size(32)));
  443. #else
  444. typedef __m256 __cl_float8;
  445. typedef __m256d __cl_double4;
  446. #endif
  447. #define __CL_FLOAT8__ 1
  448. #define __CL_DOUBLE4__ 1
  449. #endif
  450. /* Define alignment keys */
  451. #if defined( __GNUC__ )
  452. #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
  453. #elif defined( _WIN32) && (_MSC_VER)
  454. /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
  455. /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
  456. /* #include <crtdefs.h> */
  457. /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
  458. #define CL_ALIGNED(_x)
  459. #else
  460. #warning Need to implement some method to align data here
  461. #define CL_ALIGNED(_x)
  462. #endif
  463. /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
  464. #if (defined( __GNUC__) && ! defined( __STRICT_ANSI__ )) || (defined( _MSC_VER ) && ! defined( __STDC__ ))
  465. /* .xyzw and .s0123...{f|F} are supported */
  466. #define CL_HAS_NAMED_VECTOR_FIELDS 1
  467. /* .hi and .lo are supported */
  468. #define CL_HAS_HI_LO_VECTOR_FIELDS 1
  469. #define CL_NAMED_STRUCT_SUPPORTED
  470. #endif
  471. #if defined( CL_NAMED_STRUCT_SUPPORTED) && defined( _MSC_VER )
  472. #define __extension__ __pragma(warning(suppress:4201))
  473. #endif
  474. /* Define cl_vector types */
  475. /* ---- cl_charn ---- */
  476. typedef union
  477. {
  478. cl_char CL_ALIGNED(2) s[2];
  479. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  480. __extension__ struct{ cl_char x, y; };
  481. __extension__ struct{ cl_char s0, s1; };
  482. __extension__ struct{ cl_char lo, hi; };
  483. #endif
  484. #if defined( __CL_CHAR2__)
  485. __cl_char2 v2;
  486. #endif
  487. }cl_char2;
  488. typedef union
  489. {
  490. cl_char CL_ALIGNED(4) s[4];
  491. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  492. __extension__ struct{ cl_char x, y, z, w; };
  493. __extension__ struct{ cl_char s0, s1, s2, s3; };
  494. __extension__ struct{ cl_char2 lo, hi; };
  495. #endif
  496. #if defined( __CL_CHAR2__)
  497. __cl_char2 v2[2];
  498. #endif
  499. #if defined( __CL_CHAR4__)
  500. __cl_char4 v4;
  501. #endif
  502. }cl_char4;
  503. /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
  504. typedef cl_char4 cl_char3;
  505. typedef union
  506. {
  507. cl_char CL_ALIGNED(8) s[8];
  508. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  509. __extension__ struct{ cl_char x, y, z, w; };
  510. __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
  511. __extension__ struct{ cl_char4 lo, hi; };
  512. #endif
  513. #if defined( __CL_CHAR2__)
  514. __cl_char2 v2[4];
  515. #endif
  516. #if defined( __CL_CHAR4__)
  517. __cl_char4 v4[2];
  518. #endif
  519. #if defined( __CL_CHAR8__ )
  520. __cl_char8 v8;
  521. #endif
  522. }cl_char8;
  523. typedef union
  524. {
  525. cl_char CL_ALIGNED(16) s[16];
  526. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  527. __extension__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  528. __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  529. __extension__ struct{ cl_char8 lo, hi; };
  530. #endif
  531. #if defined( __CL_CHAR2__)
  532. __cl_char2 v2[8];
  533. #endif
  534. #if defined( __CL_CHAR4__)
  535. __cl_char4 v4[4];
  536. #endif
  537. #if defined( __CL_CHAR8__ )
  538. __cl_char8 v8[2];
  539. #endif
  540. #if defined( __CL_CHAR16__ )
  541. __cl_char16 v16;
  542. #endif
  543. }cl_char16;
  544. /* ---- cl_ucharn ---- */
  545. typedef union
  546. {
  547. cl_uchar CL_ALIGNED(2) s[2];
  548. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  549. __extension__ struct{ cl_uchar x, y; };
  550. __extension__ struct{ cl_uchar s0, s1; };
  551. __extension__ struct{ cl_uchar lo, hi; };
  552. #endif
  553. #if defined( __cl_uchar2__)
  554. __cl_uchar2 v2;
  555. #endif
  556. }cl_uchar2;
  557. typedef union
  558. {
  559. cl_uchar CL_ALIGNED(4) s[4];
  560. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  561. __extension__ struct{ cl_uchar x, y, z, w; };
  562. __extension__ struct{ cl_uchar s0, s1, s2, s3; };
  563. __extension__ struct{ cl_uchar2 lo, hi; };
  564. #endif
  565. #if defined( __CL_UCHAR2__)
  566. __cl_uchar2 v2[2];
  567. #endif
  568. #if defined( __CL_UCHAR4__)
  569. __cl_uchar4 v4;
  570. #endif
  571. }cl_uchar4;
  572. /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
  573. typedef cl_uchar4 cl_uchar3;
  574. typedef union
  575. {
  576. cl_uchar CL_ALIGNED(8) s[8];
  577. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  578. __extension__ struct{ cl_uchar x, y, z, w; };
  579. __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
  580. __extension__ struct{ cl_uchar4 lo, hi; };
  581. #endif
  582. #if defined( __CL_UCHAR2__)
  583. __cl_uchar2 v2[4];
  584. #endif
  585. #if defined( __CL_UCHAR4__)
  586. __cl_uchar4 v4[2];
  587. #endif
  588. #if defined( __CL_UCHAR8__ )
  589. __cl_uchar8 v8;
  590. #endif
  591. }cl_uchar8;
  592. typedef union
  593. {
  594. cl_uchar CL_ALIGNED(16) s[16];
  595. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  596. __extension__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  597. __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  598. __extension__ struct{ cl_uchar8 lo, hi; };
  599. #endif
  600. #if defined( __CL_UCHAR2__)
  601. __cl_uchar2 v2[8];
  602. #endif
  603. #if defined( __CL_UCHAR4__)
  604. __cl_uchar4 v4[4];
  605. #endif
  606. #if defined( __CL_UCHAR8__ )
  607. __cl_uchar8 v8[2];
  608. #endif
  609. #if defined( __CL_UCHAR16__ )
  610. __cl_uchar16 v16;
  611. #endif
  612. }cl_uchar16;
  613. /* ---- cl_shortn ---- */
  614. typedef union
  615. {
  616. cl_short CL_ALIGNED(4) s[2];
  617. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  618. __extension__ struct{ cl_short x, y; };
  619. __extension__ struct{ cl_short s0, s1; };
  620. __extension__ struct{ cl_short lo, hi; };
  621. #endif
  622. #if defined( __CL_SHORT2__)
  623. __cl_short2 v2;
  624. #endif
  625. }cl_short2;
  626. typedef union
  627. {
  628. cl_short CL_ALIGNED(8) s[4];
  629. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  630. __extension__ struct{ cl_short x, y, z, w; };
  631. __extension__ struct{ cl_short s0, s1, s2, s3; };
  632. __extension__ struct{ cl_short2 lo, hi; };
  633. #endif
  634. #if defined( __CL_SHORT2__)
  635. __cl_short2 v2[2];
  636. #endif
  637. #if defined( __CL_SHORT4__)
  638. __cl_short4 v4;
  639. #endif
  640. }cl_short4;
  641. /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
  642. typedef cl_short4 cl_short3;
  643. typedef union
  644. {
  645. cl_short CL_ALIGNED(16) s[8];
  646. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  647. __extension__ struct{ cl_short x, y, z, w; };
  648. __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
  649. __extension__ struct{ cl_short4 lo, hi; };
  650. #endif
  651. #if defined( __CL_SHORT2__)
  652. __cl_short2 v2[4];
  653. #endif
  654. #if defined( __CL_SHORT4__)
  655. __cl_short4 v4[2];
  656. #endif
  657. #if defined( __CL_SHORT8__ )
  658. __cl_short8 v8;
  659. #endif
  660. }cl_short8;
  661. typedef union
  662. {
  663. cl_short CL_ALIGNED(32) s[16];
  664. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  665. __extension__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  666. __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  667. __extension__ struct{ cl_short8 lo, hi; };
  668. #endif
  669. #if defined( __CL_SHORT2__)
  670. __cl_short2 v2[8];
  671. #endif
  672. #if defined( __CL_SHORT4__)
  673. __cl_short4 v4[4];
  674. #endif
  675. #if defined( __CL_SHORT8__ )
  676. __cl_short8 v8[2];
  677. #endif
  678. #if defined( __CL_SHORT16__ )
  679. __cl_short16 v16;
  680. #endif
  681. }cl_short16;
  682. /* ---- cl_ushortn ---- */
  683. typedef union
  684. {
  685. cl_ushort CL_ALIGNED(4) s[2];
  686. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  687. __extension__ struct{ cl_ushort x, y; };
  688. __extension__ struct{ cl_ushort s0, s1; };
  689. __extension__ struct{ cl_ushort lo, hi; };
  690. #endif
  691. #if defined( __CL_USHORT2__)
  692. __cl_ushort2 v2;
  693. #endif
  694. }cl_ushort2;
  695. typedef union
  696. {
  697. cl_ushort CL_ALIGNED(8) s[4];
  698. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  699. __extension__ struct{ cl_ushort x, y, z, w; };
  700. __extension__ struct{ cl_ushort s0, s1, s2, s3; };
  701. __extension__ struct{ cl_ushort2 lo, hi; };
  702. #endif
  703. #if defined( __CL_USHORT2__)
  704. __cl_ushort2 v2[2];
  705. #endif
  706. #if defined( __CL_USHORT4__)
  707. __cl_ushort4 v4;
  708. #endif
  709. }cl_ushort4;
  710. /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
  711. typedef cl_ushort4 cl_ushort3;
  712. typedef union
  713. {
  714. cl_ushort CL_ALIGNED(16) s[8];
  715. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  716. __extension__ struct{ cl_ushort x, y, z, w; };
  717. __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
  718. __extension__ struct{ cl_ushort4 lo, hi; };
  719. #endif
  720. #if defined( __CL_USHORT2__)
  721. __cl_ushort2 v2[4];
  722. #endif
  723. #if defined( __CL_USHORT4__)
  724. __cl_ushort4 v4[2];
  725. #endif
  726. #if defined( __CL_USHORT8__ )
  727. __cl_ushort8 v8;
  728. #endif
  729. }cl_ushort8;
  730. typedef union
  731. {
  732. cl_ushort CL_ALIGNED(32) s[16];
  733. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  734. __extension__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  735. __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  736. __extension__ struct{ cl_ushort8 lo, hi; };
  737. #endif
  738. #if defined( __CL_USHORT2__)
  739. __cl_ushort2 v2[8];
  740. #endif
  741. #if defined( __CL_USHORT4__)
  742. __cl_ushort4 v4[4];
  743. #endif
  744. #if defined( __CL_USHORT8__ )
  745. __cl_ushort8 v8[2];
  746. #endif
  747. #if defined( __CL_USHORT16__ )
  748. __cl_ushort16 v16;
  749. #endif
  750. }cl_ushort16;
  751. /* ---- cl_intn ---- */
  752. typedef union
  753. {
  754. cl_int CL_ALIGNED(8) s[2];
  755. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  756. __extension__ struct{ cl_int x, y; };
  757. __extension__ struct{ cl_int s0, s1; };
  758. __extension__ struct{ cl_int lo, hi; };
  759. #endif
  760. #if defined( __CL_INT2__)
  761. __cl_int2 v2;
  762. #endif
  763. }cl_int2;
  764. typedef union
  765. {
  766. cl_int CL_ALIGNED(16) s[4];
  767. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  768. __extension__ struct{ cl_int x, y, z, w; };
  769. __extension__ struct{ cl_int s0, s1, s2, s3; };
  770. __extension__ struct{ cl_int2 lo, hi; };
  771. #endif
  772. #if defined( __CL_INT2__)
  773. __cl_int2 v2[2];
  774. #endif
  775. #if defined( __CL_INT4__)
  776. __cl_int4 v4;
  777. #endif
  778. }cl_int4;
  779. /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
  780. typedef cl_int4 cl_int3;
  781. typedef union
  782. {
  783. cl_int CL_ALIGNED(32) s[8];
  784. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  785. __extension__ struct{ cl_int x, y, z, w; };
  786. __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
  787. __extension__ struct{ cl_int4 lo, hi; };
  788. #endif
  789. #if defined( __CL_INT2__)
  790. __cl_int2 v2[4];
  791. #endif
  792. #if defined( __CL_INT4__)
  793. __cl_int4 v4[2];
  794. #endif
  795. #if defined( __CL_INT8__ )
  796. __cl_int8 v8;
  797. #endif
  798. }cl_int8;
  799. typedef union
  800. {
  801. cl_int CL_ALIGNED(64) s[16];
  802. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  803. __extension__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  804. __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  805. __extension__ struct{ cl_int8 lo, hi; };
  806. #endif
  807. #if defined( __CL_INT2__)
  808. __cl_int2 v2[8];
  809. #endif
  810. #if defined( __CL_INT4__)
  811. __cl_int4 v4[4];
  812. #endif
  813. #if defined( __CL_INT8__ )
  814. __cl_int8 v8[2];
  815. #endif
  816. #if defined( __CL_INT16__ )
  817. __cl_int16 v16;
  818. #endif
  819. }cl_int16;
  820. /* ---- cl_uintn ---- */
  821. typedef union
  822. {
  823. cl_uint CL_ALIGNED(8) s[2];
  824. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  825. __extension__ struct{ cl_uint x, y; };
  826. __extension__ struct{ cl_uint s0, s1; };
  827. __extension__ struct{ cl_uint lo, hi; };
  828. #endif
  829. #if defined( __CL_UINT2__)
  830. __cl_uint2 v2;
  831. #endif
  832. }cl_uint2;
  833. typedef union
  834. {
  835. cl_uint CL_ALIGNED(16) s[4];
  836. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  837. __extension__ struct{ cl_uint x, y, z, w; };
  838. __extension__ struct{ cl_uint s0, s1, s2, s3; };
  839. __extension__ struct{ cl_uint2 lo, hi; };
  840. #endif
  841. #if defined( __CL_UINT2__)
  842. __cl_uint2 v2[2];
  843. #endif
  844. #if defined( __CL_UINT4__)
  845. __cl_uint4 v4;
  846. #endif
  847. }cl_uint4;
  848. /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
  849. typedef cl_uint4 cl_uint3;
  850. typedef union
  851. {
  852. cl_uint CL_ALIGNED(32) s[8];
  853. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  854. __extension__ struct{ cl_uint x, y, z, w; };
  855. __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
  856. __extension__ struct{ cl_uint4 lo, hi; };
  857. #endif
  858. #if defined( __CL_UINT2__)
  859. __cl_uint2 v2[4];
  860. #endif
  861. #if defined( __CL_UINT4__)
  862. __cl_uint4 v4[2];
  863. #endif
  864. #if defined( __CL_UINT8__ )
  865. __cl_uint8 v8;
  866. #endif
  867. }cl_uint8;
  868. typedef union
  869. {
  870. cl_uint CL_ALIGNED(64) s[16];
  871. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  872. __extension__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  873. __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  874. __extension__ struct{ cl_uint8 lo, hi; };
  875. #endif
  876. #if defined( __CL_UINT2__)
  877. __cl_uint2 v2[8];
  878. #endif
  879. #if defined( __CL_UINT4__)
  880. __cl_uint4 v4[4];
  881. #endif
  882. #if defined( __CL_UINT8__ )
  883. __cl_uint8 v8[2];
  884. #endif
  885. #if defined( __CL_UINT16__ )
  886. __cl_uint16 v16;
  887. #endif
  888. }cl_uint16;
  889. /* ---- cl_longn ---- */
  890. typedef union
  891. {
  892. cl_long CL_ALIGNED(16) s[2];
  893. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  894. __extension__ struct{ cl_long x, y; };
  895. __extension__ struct{ cl_long s0, s1; };
  896. __extension__ struct{ cl_long lo, hi; };
  897. #endif
  898. #if defined( __CL_LONG2__)
  899. __cl_long2 v2;
  900. #endif
  901. }cl_long2;
  902. typedef union
  903. {
  904. cl_long CL_ALIGNED(32) s[4];
  905. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  906. __extension__ struct{ cl_long x, y, z, w; };
  907. __extension__ struct{ cl_long s0, s1, s2, s3; };
  908. __extension__ struct{ cl_long2 lo, hi; };
  909. #endif
  910. #if defined( __CL_LONG2__)
  911. __cl_long2 v2[2];
  912. #endif
  913. #if defined( __CL_LONG4__)
  914. __cl_long4 v4;
  915. #endif
  916. }cl_long4;
  917. /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
  918. typedef cl_long4 cl_long3;
  919. typedef union
  920. {
  921. cl_long CL_ALIGNED(64) s[8];
  922. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  923. __extension__ struct{ cl_long x, y, z, w; };
  924. __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
  925. __extension__ struct{ cl_long4 lo, hi; };
  926. #endif
  927. #if defined( __CL_LONG2__)
  928. __cl_long2 v2[4];
  929. #endif
  930. #if defined( __CL_LONG4__)
  931. __cl_long4 v4[2];
  932. #endif
  933. #if defined( __CL_LONG8__ )
  934. __cl_long8 v8;
  935. #endif
  936. }cl_long8;
  937. typedef union
  938. {
  939. cl_long CL_ALIGNED(128) s[16];
  940. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  941. __extension__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  942. __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  943. __extension__ struct{ cl_long8 lo, hi; };
  944. #endif
  945. #if defined( __CL_LONG2__)
  946. __cl_long2 v2[8];
  947. #endif
  948. #if defined( __CL_LONG4__)
  949. __cl_long4 v4[4];
  950. #endif
  951. #if defined( __CL_LONG8__ )
  952. __cl_long8 v8[2];
  953. #endif
  954. #if defined( __CL_LONG16__ )
  955. __cl_long16 v16;
  956. #endif
  957. }cl_long16;
  958. /* ---- cl_ulongn ---- */
  959. typedef union
  960. {
  961. cl_ulong CL_ALIGNED(16) s[2];
  962. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  963. __extension__ struct{ cl_ulong x, y; };
  964. __extension__ struct{ cl_ulong s0, s1; };
  965. __extension__ struct{ cl_ulong lo, hi; };
  966. #endif
  967. #if defined( __CL_ULONG2__)
  968. __cl_ulong2 v2;
  969. #endif
  970. }cl_ulong2;
  971. typedef union
  972. {
  973. cl_ulong CL_ALIGNED(32) s[4];
  974. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  975. __extension__ struct{ cl_ulong x, y, z, w; };
  976. __extension__ struct{ cl_ulong s0, s1, s2, s3; };
  977. __extension__ struct{ cl_ulong2 lo, hi; };
  978. #endif
  979. #if defined( __CL_ULONG2__)
  980. __cl_ulong2 v2[2];
  981. #endif
  982. #if defined( __CL_ULONG4__)
  983. __cl_ulong4 v4;
  984. #endif
  985. }cl_ulong4;
  986. /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
  987. typedef cl_ulong4 cl_ulong3;
  988. typedef union
  989. {
  990. cl_ulong CL_ALIGNED(64) s[8];
  991. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  992. __extension__ struct{ cl_ulong x, y, z, w; };
  993. __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
  994. __extension__ struct{ cl_ulong4 lo, hi; };
  995. #endif
  996. #if defined( __CL_ULONG2__)
  997. __cl_ulong2 v2[4];
  998. #endif
  999. #if defined( __CL_ULONG4__)
  1000. __cl_ulong4 v4[2];
  1001. #endif
  1002. #if defined( __CL_ULONG8__ )
  1003. __cl_ulong8 v8;
  1004. #endif
  1005. }cl_ulong8;
  1006. typedef union
  1007. {
  1008. cl_ulong CL_ALIGNED(128) s[16];
  1009. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1010. __extension__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1011. __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1012. __extension__ struct{ cl_ulong8 lo, hi; };
  1013. #endif
  1014. #if defined( __CL_ULONG2__)
  1015. __cl_ulong2 v2[8];
  1016. #endif
  1017. #if defined( __CL_ULONG4__)
  1018. __cl_ulong4 v4[4];
  1019. #endif
  1020. #if defined( __CL_ULONG8__ )
  1021. __cl_ulong8 v8[2];
  1022. #endif
  1023. #if defined( __CL_ULONG16__ )
  1024. __cl_ulong16 v16;
  1025. #endif
  1026. }cl_ulong16;
  1027. /* --- cl_floatn ---- */
  1028. typedef union
  1029. {
  1030. cl_float CL_ALIGNED(8) s[2];
  1031. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1032. __extension__ struct{ cl_float x, y; };
  1033. __extension__ struct{ cl_float s0, s1; };
  1034. __extension__ struct{ cl_float lo, hi; };
  1035. #endif
  1036. #if defined( __CL_FLOAT2__)
  1037. __cl_float2 v2;
  1038. #endif
  1039. }cl_float2;
  1040. typedef union
  1041. {
  1042. cl_float CL_ALIGNED(16) s[4];
  1043. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1044. __extension__ struct{ cl_float x, y, z, w; };
  1045. __extension__ struct{ cl_float s0, s1, s2, s3; };
  1046. __extension__ struct{ cl_float2 lo, hi; };
  1047. #endif
  1048. #if defined( __CL_FLOAT2__)
  1049. __cl_float2 v2[2];
  1050. #endif
  1051. #if defined( __CL_FLOAT4__)
  1052. __cl_float4 v4;
  1053. #endif
  1054. }cl_float4;
  1055. /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
  1056. typedef cl_float4 cl_float3;
  1057. typedef union
  1058. {
  1059. cl_float CL_ALIGNED(32) s[8];
  1060. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1061. __extension__ struct{ cl_float x, y, z, w; };
  1062. __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
  1063. __extension__ struct{ cl_float4 lo, hi; };
  1064. #endif
  1065. #if defined( __CL_FLOAT2__)
  1066. __cl_float2 v2[4];
  1067. #endif
  1068. #if defined( __CL_FLOAT4__)
  1069. __cl_float4 v4[2];
  1070. #endif
  1071. #if defined( __CL_FLOAT8__ )
  1072. __cl_float8 v8;
  1073. #endif
  1074. }cl_float8;
  1075. typedef union
  1076. {
  1077. cl_float CL_ALIGNED(64) s[16];
  1078. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1079. __extension__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1080. __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1081. __extension__ struct{ cl_float8 lo, hi; };
  1082. #endif
  1083. #if defined( __CL_FLOAT2__)
  1084. __cl_float2 v2[8];
  1085. #endif
  1086. #if defined( __CL_FLOAT4__)
  1087. __cl_float4 v4[4];
  1088. #endif
  1089. #if defined( __CL_FLOAT8__ )
  1090. __cl_float8 v8[2];
  1091. #endif
  1092. #if defined( __CL_FLOAT16__ )
  1093. __cl_float16 v16;
  1094. #endif
  1095. }cl_float16;
  1096. /* --- cl_doublen ---- */
  1097. typedef union
  1098. {
  1099. cl_double CL_ALIGNED(16) s[2];
  1100. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1101. __extension__ struct{ cl_double x, y; };
  1102. __extension__ struct{ cl_double s0, s1; };
  1103. __extension__ struct{ cl_double lo, hi; };
  1104. #endif
  1105. #if defined( __CL_DOUBLE2__)
  1106. __cl_double2 v2;
  1107. #endif
  1108. }cl_double2;
  1109. typedef union
  1110. {
  1111. cl_double CL_ALIGNED(32) s[4];
  1112. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1113. __extension__ struct{ cl_double x, y, z, w; };
  1114. __extension__ struct{ cl_double s0, s1, s2, s3; };
  1115. __extension__ struct{ cl_double2 lo, hi; };
  1116. #endif
  1117. #if defined( __CL_DOUBLE2__)
  1118. __cl_double2 v2[2];
  1119. #endif
  1120. #if defined( __CL_DOUBLE4__)
  1121. __cl_double4 v4;
  1122. #endif
  1123. }cl_double4;
  1124. /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
  1125. typedef cl_double4 cl_double3;
  1126. typedef union
  1127. {
  1128. cl_double CL_ALIGNED(64) s[8];
  1129. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1130. __extension__ struct{ cl_double x, y, z, w; };
  1131. __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
  1132. __extension__ struct{ cl_double4 lo, hi; };
  1133. #endif
  1134. #if defined( __CL_DOUBLE2__)
  1135. __cl_double2 v2[4];
  1136. #endif
  1137. #if defined( __CL_DOUBLE4__)
  1138. __cl_double4 v4[2];
  1139. #endif
  1140. #if defined( __CL_DOUBLE8__ )
  1141. __cl_double8 v8;
  1142. #endif
  1143. }cl_double8;
  1144. typedef union
  1145. {
  1146. cl_double CL_ALIGNED(128) s[16];
  1147. #if defined( CL_NAMED_STRUCT_SUPPORTED )
  1148. __extension__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1149. __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1150. __extension__ struct{ cl_double8 lo, hi; };
  1151. #endif
  1152. #if defined( __CL_DOUBLE2__)
  1153. __cl_double2 v2[8];
  1154. #endif
  1155. #if defined( __CL_DOUBLE4__)
  1156. __cl_double4 v4[4];
  1157. #endif
  1158. #if defined( __CL_DOUBLE8__ )
  1159. __cl_double8 v8[2];
  1160. #endif
  1161. #if defined( __CL_DOUBLE16__ )
  1162. __cl_double16 v16;
  1163. #endif
  1164. }cl_double16;
  1165. /* Macro to facilitate debugging
  1166. * Usage:
  1167. * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
  1168. * The first line ends with: CL_PROGRAM_STRING_BEGIN \"
  1169. * Each line thereafter of OpenCL C source must end with: \n\
  1170. * The last line ends in ";
  1171. *
  1172. * Example:
  1173. *
  1174. * const char *my_program = CL_PROGRAM_STRING_BEGIN "\
  1175. * kernel void foo( int a, float * b ) \n\
  1176. * { \n\
  1177. * // my comment \n\
  1178. * *b[ get_global_id(0)] = a; \n\
  1179. * } \n\
  1180. * ";
  1181. *
  1182. * This should correctly set up the line, (column) and file information for your source
  1183. * string so you can do source level debugging.
  1184. */
  1185. #define __CL_STRINGIFY( _x ) # _x
  1186. #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
  1187. #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
  1188. // CL.h contents
  1189. /******************************************************************************/
  1190. typedef struct _cl_platform_id * cl_platform_id;
  1191. typedef struct _cl_device_id * cl_device_id;
  1192. typedef struct _cl_context * cl_context;
  1193. typedef struct _cl_command_queue * cl_command_queue;
  1194. typedef struct _cl_mem * cl_mem;
  1195. typedef struct _cl_program * cl_program;
  1196. typedef struct _cl_kernel * cl_kernel;
  1197. typedef struct _cl_event * cl_event;
  1198. typedef struct _cl_sampler * cl_sampler;
  1199. typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
  1200. typedef cl_ulong cl_bitfield;
  1201. typedef cl_bitfield cl_device_type;
  1202. typedef cl_uint cl_platform_info;
  1203. typedef cl_uint cl_device_info;
  1204. typedef cl_bitfield cl_device_fp_config;
  1205. typedef cl_uint cl_device_mem_cache_type;
  1206. typedef cl_uint cl_device_local_mem_type;
  1207. typedef cl_bitfield cl_device_exec_capabilities;
  1208. typedef cl_bitfield cl_command_queue_properties;
  1209. typedef intptr_t cl_device_partition_property;
  1210. typedef cl_bitfield cl_device_affinity_domain;
  1211. typedef intptr_t cl_context_properties;
  1212. typedef cl_uint cl_context_info;
  1213. typedef cl_uint cl_command_queue_info;
  1214. typedef cl_uint cl_channel_order;
  1215. typedef cl_uint cl_channel_type;
  1216. typedef cl_bitfield cl_mem_flags;
  1217. typedef cl_uint cl_mem_object_type;
  1218. typedef cl_uint cl_mem_info;
  1219. typedef cl_uint cl_image_info;
  1220. typedef cl_uint cl_buffer_create_type;
  1221. typedef cl_uint cl_addressing_mode;
  1222. typedef cl_uint cl_filter_mode;
  1223. typedef cl_uint cl_sampler_info;
  1224. typedef cl_bitfield cl_map_flags;
  1225. typedef cl_uint cl_program_info;
  1226. typedef cl_uint cl_program_build_info;
  1227. typedef cl_int cl_build_status;
  1228. typedef cl_uint cl_kernel_info;
  1229. typedef cl_uint cl_kernel_work_group_info;
  1230. typedef cl_uint cl_event_info;
  1231. typedef cl_uint cl_command_type;
  1232. typedef cl_uint cl_profiling_info;
  1233. typedef struct _cl_image_format {
  1234. cl_channel_order image_channel_order;
  1235. cl_channel_type image_channel_data_type;
  1236. } cl_image_format;
  1237. typedef struct _cl_image_desc {
  1238. cl_mem_object_type image_type;
  1239. size_t image_width;
  1240. size_t image_height;
  1241. size_t image_depth;
  1242. size_t image_array_size;
  1243. size_t image_row_pitch;
  1244. size_t image_slice_pitch;
  1245. cl_uint num_mip_levels;
  1246. cl_uint num_samples;
  1247. cl_mem buffer;
  1248. } cl_image_desc;
  1249. typedef struct _cl_buffer_region {
  1250. size_t origin;
  1251. size_t size;
  1252. } cl_buffer_region;
  1253. /******************************************************************************/
  1254. /* Error Codes */
  1255. #define CL_SUCCESS 0
  1256. #define CL_DEVICE_NOT_FOUND -1
  1257. #define CL_DEVICE_NOT_AVAILABLE -2
  1258. #define CL_COMPILER_NOT_AVAILABLE -3
  1259. #define CL_MEM_OBJECT_ALLOCATION_FAILURE -4
  1260. #define CL_OUT_OF_RESOURCES -5
  1261. #define CL_OUT_OF_HOST_MEMORY -6
  1262. #define CL_PROFILING_INFO_NOT_AVAILABLE -7
  1263. #define CL_MEM_COPY_OVERLAP -8
  1264. #define CL_IMAGE_FORMAT_MISMATCH -9
  1265. #define CL_IMAGE_FORMAT_NOT_SUPPORTED -10
  1266. #define CL_BUILD_PROGRAM_FAILURE -11
  1267. #define CL_MAP_FAILURE -12
  1268. #define CL_MISALIGNED_SUB_BUFFER_OFFSET -13
  1269. #define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
  1270. #define CL_COMPILE_PROGRAM_FAILURE -15
  1271. #define CL_LINKER_NOT_AVAILABLE -16
  1272. #define CL_LINK_PROGRAM_FAILURE -17
  1273. #define CL_DEVICE_PARTITION_FAILED -18
  1274. #define CL_KERNEL_ARG_INFO_NOT_AVAILABLE -19
  1275. #define CL_INVALID_VALUE -30
  1276. #define CL_INVALID_DEVICE_TYPE -31
  1277. #define CL_INVALID_PLATFORM -32
  1278. #define CL_INVALID_DEVICE -33
  1279. #define CL_INVALID_CONTEXT -34
  1280. #define CL_INVALID_QUEUE_PROPERTIES -35
  1281. #define CL_INVALID_COMMAND_QUEUE -36
  1282. #define CL_INVALID_HOST_PTR -37
  1283. #define CL_INVALID_MEM_OBJECT -38
  1284. #define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39
  1285. #define CL_INVALID_IMAGE_SIZE -40
  1286. #define CL_INVALID_SAMPLER -41
  1287. #define CL_INVALID_BINARY -42
  1288. #define CL_INVALID_BUILD_OPTIONS -43
  1289. #define CL_INVALID_PROGRAM -44
  1290. #define CL_INVALID_PROGRAM_EXECUTABLE -45
  1291. #define CL_INVALID_KERNEL_NAME -46
  1292. #define CL_INVALID_KERNEL_DEFINITION -47
  1293. #define CL_INVALID_KERNEL -48
  1294. #define CL_INVALID_ARG_INDEX -49
  1295. #define CL_INVALID_ARG_VALUE -50
  1296. #define CL_INVALID_ARG_SIZE -51
  1297. #define CL_INVALID_KERNEL_ARGS -52
  1298. #define CL_INVALID_WORK_DIMENSION -53
  1299. #define CL_INVALID_WORK_GROUP_SIZE -54
  1300. #define CL_INVALID_WORK_ITEM_SIZE -55
  1301. #define CL_INVALID_GLOBAL_OFFSET -56
  1302. #define CL_INVALID_EVENT_WAIT_LIST -57
  1303. #define CL_INVALID_EVENT -58
  1304. #define CL_INVALID_OPERATION -59
  1305. #define CL_INVALID_GL_OBJECT -60
  1306. #define CL_INVALID_BUFFER_SIZE -61
  1307. #define CL_INVALID_MIP_LEVEL -62
  1308. #define CL_INVALID_GLOBAL_WORK_SIZE -63
  1309. #define CL_INVALID_PROPERTY -64
  1310. #define CL_INVALID_IMAGE_DESCRIPTOR -65
  1311. #define CL_INVALID_COMPILER_OPTIONS -66
  1312. #define CL_INVALID_LINKER_OPTIONS -67
  1313. #define CL_INVALID_DEVICE_PARTITION_COUNT -68
  1314. /* OpenCL Version */
  1315. #define CL_VERSION_1_0 1
  1316. #define CL_VERSION_1_1 1
  1317. #define CL_VERSION_1_2 1
  1318. /* cl_bool */
  1319. #define CL_FALSE 0
  1320. #define CL_TRUE 1
  1321. #define CL_BLOCKING CL_TRUE
  1322. #define CL_NON_BLOCKING CL_FALSE
  1323. /* cl_platform_info */
  1324. #define CL_PLATFORM_PROFILE 0x0900
  1325. #define CL_PLATFORM_VERSION 0x0901
  1326. #define CL_PLATFORM_NAME 0x0902
  1327. #define CL_PLATFORM_VENDOR 0x0903
  1328. #define CL_PLATFORM_EXTENSIONS 0x0904
  1329. /* cl_device_type - bitfield */
  1330. #define CL_DEVICE_TYPE_DEFAULT (1 << 0)
  1331. #define CL_DEVICE_TYPE_CPU (1 << 1)
  1332. #define CL_DEVICE_TYPE_GPU (1 << 2)
  1333. #define CL_DEVICE_TYPE_ACCELERATOR (1 << 3)
  1334. #define CL_DEVICE_TYPE_CUSTOM (1 << 4)
  1335. #define CL_DEVICE_TYPE_ALL 0xFFFFFFFF
  1336. /* cl_device_info */
  1337. #define CL_DEVICE_TYPE 0x1000
  1338. #define CL_DEVICE_VENDOR_ID 0x1001
  1339. #define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002
  1340. #define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003
  1341. #define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004
  1342. #define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005
  1343. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006
  1344. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007
  1345. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008
  1346. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009
  1347. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A
  1348. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B
  1349. #define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C
  1350. #define CL_DEVICE_ADDRESS_BITS 0x100D
  1351. #define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E
  1352. #define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F
  1353. #define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010
  1354. #define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011
  1355. #define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012
  1356. #define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013
  1357. #define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014
  1358. #define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015
  1359. #define CL_DEVICE_IMAGE_SUPPORT 0x1016
  1360. #define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017
  1361. #define CL_DEVICE_MAX_SAMPLERS 0x1018
  1362. #define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019
  1363. #define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A
  1364. #define CL_DEVICE_SINGLE_FP_CONFIG 0x101B
  1365. #define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C
  1366. #define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D
  1367. #define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E
  1368. #define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F
  1369. #define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020
  1370. #define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021
  1371. #define CL_DEVICE_LOCAL_MEM_TYPE 0x1022
  1372. #define CL_DEVICE_LOCAL_MEM_SIZE 0x1023
  1373. #define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024
  1374. #define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025
  1375. #define CL_DEVICE_ENDIAN_LITTLE 0x1026
  1376. #define CL_DEVICE_AVAILABLE 0x1027
  1377. #define CL_DEVICE_COMPILER_AVAILABLE 0x1028
  1378. #define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029
  1379. #define CL_DEVICE_QUEUE_PROPERTIES 0x102A
  1380. #define CL_DEVICE_NAME 0x102B
  1381. #define CL_DEVICE_VENDOR 0x102C
  1382. #define CL_DRIVER_VERSION 0x102D
  1383. #define CL_DEVICE_PROFILE 0x102E
  1384. #define CL_DEVICE_VERSION 0x102F
  1385. #define CL_DEVICE_EXTENSIONS 0x1030
  1386. #define CL_DEVICE_PLATFORM 0x1031
  1387. #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
  1388. /* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */
  1389. #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034
  1390. #define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035
  1391. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036
  1392. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037
  1393. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038
  1394. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039
  1395. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A
  1396. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B
  1397. #define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C
  1398. #define CL_DEVICE_OPENCL_C_VERSION 0x103D
  1399. #define CL_DEVICE_LINKER_AVAILABLE 0x103E
  1400. #define CL_DEVICE_BUILT_IN_KERNELS 0x103F
  1401. #define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE 0x1040
  1402. #define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE 0x1041
  1403. #define CL_DEVICE_PARENT_DEVICE 0x1042
  1404. #define CL_DEVICE_PARTITION_MAX_SUB_DEVICES 0x1043
  1405. #define CL_DEVICE_PARTITION_PROPERTIES 0x1044
  1406. #define CL_DEVICE_PARTITION_AFFINITY_DOMAIN 0x1045
  1407. #define CL_DEVICE_PARTITION_TYPE 0x1046
  1408. #define CL_DEVICE_REFERENCE_COUNT 0x1047
  1409. #define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC 0x1048
  1410. #define CL_DEVICE_PRINTF_BUFFER_SIZE 0x1049
  1411. #define CL_DEVICE_IMAGE_PITCH_ALIGNMENT 0x104A
  1412. #define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT 0x104B
  1413. /* cl_device_fp_config - bitfield */
  1414. #define CL_FP_DENORM (1 << 0)
  1415. #define CL_FP_INF_NAN (1 << 1)
  1416. #define CL_FP_ROUND_TO_NEAREST (1 << 2)
  1417. #define CL_FP_ROUND_TO_ZERO (1 << 3)
  1418. #define CL_FP_ROUND_TO_INF (1 << 4)
  1419. #define CL_FP_FMA (1 << 5)
  1420. #define CL_FP_SOFT_FLOAT (1 << 6)
  1421. #define CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT (1 << 7)
  1422. /* cl_device_mem_cache_type */
  1423. #define CL_NONE 0x0
  1424. #define CL_READ_ONLY_CACHE 0x1
  1425. #define CL_READ_WRITE_CACHE 0x2
  1426. /* cl_device_local_mem_type */
  1427. #define CL_LOCAL 0x1
  1428. #define CL_GLOBAL 0x2
  1429. /* cl_device_exec_capabilities - bitfield */
  1430. #define CL_EXEC_KERNEL (1 << 0)
  1431. #define CL_EXEC_NATIVE_KERNEL (1 << 1)
  1432. /* cl_command_queue_properties - bitfield */
  1433. #define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0)
  1434. #define CL_QUEUE_PROFILING_ENABLE (1 << 1)
  1435. /* cl_context_info */
  1436. #define CL_CONTEXT_REFERENCE_COUNT 0x1080
  1437. #define CL_CONTEXT_DEVICES 0x1081
  1438. #define CL_CONTEXT_PROPERTIES 0x1082
  1439. #define CL_CONTEXT_NUM_DEVICES 0x1083
  1440. /* cl_context_info + cl_context_properties */
  1441. #define CL_CONTEXT_PLATFORM 0x1084
  1442. #define CL_CONTEXT_INTEROP_USER_SYNC 0x1085
  1443. /* cl_device_partition_property */
  1444. #define CL_DEVICE_PARTITION_EQUALLY 0x1086
  1445. #define CL_DEVICE_PARTITION_BY_COUNTS 0x1087
  1446. #define CL_DEVICE_PARTITION_BY_COUNTS_LIST_END 0x0
  1447. #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN 0x1088
  1448. /* cl_device_affinity_domain */
  1449. #define CL_DEVICE_AFFINITY_DOMAIN_NUMA (1 << 0)
  1450. #define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE (1 << 1)
  1451. #define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE (1 << 2)
  1452. #define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE (1 << 3)
  1453. #define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE (1 << 4)
  1454. #define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE (1 << 5)
  1455. /* cl_command_queue_info */
  1456. #define CL_QUEUE_CONTEXT 0x1090
  1457. #define CL_QUEUE_DEVICE 0x1091
  1458. #define CL_QUEUE_REFERENCE_COUNT 0x1092
  1459. #define CL_QUEUE_PROPERTIES 0x1093
  1460. /* cl_mem_flags - bitfield */
  1461. #define CL_MEM_READ_WRITE (1 << 0)
  1462. #define CL_MEM_WRITE_ONLY (1 << 1)
  1463. #define CL_MEM_READ_ONLY (1 << 2)
  1464. #define CL_MEM_USE_HOST_PTR (1 << 3)
  1465. #define CL_MEM_ALLOC_HOST_PTR (1 << 4)
  1466. #define CL_MEM_COPY_HOST_PTR (1 << 5)
  1467. // reserved (1 << 6)
  1468. #define CL_MEM_HOST_WRITE_ONLY (1 << 7)
  1469. #define CL_MEM_HOST_READ_ONLY (1 << 8)
  1470. #define CL_MEM_HOST_NO_ACCESS (1 << 9)
  1471. /* cl_mem_migration_flags - bitfield */
  1472. #define CL_MIGRATE_MEM_OBJECT_HOST (1 << 0)
  1473. #define CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED (1 << 1)
  1474. /* cl_channel_order */
  1475. #define CL_R 0x10B0
  1476. #define CL_A 0x10B1
  1477. #define CL_RG 0x10B2
  1478. #define CL_RA 0x10B3
  1479. #define CL_RGB 0x10B4
  1480. #define CL_RGBA 0x10B5
  1481. #define CL_BGRA 0x10B6
  1482. #define CL_ARGB 0x10B7
  1483. #define CL_INTENSITY 0x10B8
  1484. #define CL_LUMINANCE 0x10B9
  1485. #define CL_Rx 0x10BA
  1486. #define CL_RGx 0x10BB
  1487. #define CL_RGBx 0x10BC
  1488. #define CL_DEPTH 0x10BD
  1489. #define CL_DEPTH_STENCIL 0x10BE
  1490. /* cl_channel_type */
  1491. #define CL_SNORM_INT8 0x10D0
  1492. #define CL_SNORM_INT16 0x10D1
  1493. #define CL_UNORM_INT8 0x10D2
  1494. #define CL_UNORM_INT16 0x10D3
  1495. #define CL_UNORM_SHORT_565 0x10D4
  1496. #define CL_UNORM_SHORT_555 0x10D5
  1497. #define CL_UNORM_INT_101010 0x10D6
  1498. #define CL_SIGNED_INT8 0x10D7
  1499. #define CL_SIGNED_INT16 0x10D8
  1500. #define CL_SIGNED_INT32 0x10D9
  1501. #define CL_UNSIGNED_INT8 0x10DA
  1502. #define CL_UNSIGNED_INT16 0x10DB
  1503. #define CL_UNSIGNED_INT32 0x10DC
  1504. #define CL_HALF_FLOAT 0x10DD
  1505. #define CL_FLOAT 0x10DE
  1506. #define CL_UNORM_INT24 0x10DF
  1507. /* cl_mem_object_type */
  1508. #define CL_MEM_OBJECT_BUFFER 0x10F0
  1509. #define CL_MEM_OBJECT_IMAGE2D 0x10F1
  1510. #define CL_MEM_OBJECT_IMAGE3D 0x10F2
  1511. #define CL_MEM_OBJECT_IMAGE2D_ARRAY 0x10F3
  1512. #define CL_MEM_OBJECT_IMAGE1D 0x10F4
  1513. #define CL_MEM_OBJECT_IMAGE1D_ARRAY 0x10F5
  1514. #define CL_MEM_OBJECT_IMAGE1D_BUFFER 0x10F6
  1515. /* cl_mem_info */
  1516. #define CL_MEM_TYPE 0x1100
  1517. #define CL_MEM_FLAGS 0x1101
  1518. #define CL_MEM_SIZE 0x1102
  1519. #define CL_MEM_HOST_PTR 0x1103
  1520. #define CL_MEM_MAP_COUNT 0x1104
  1521. #define CL_MEM_REFERENCE_COUNT 0x1105
  1522. #define CL_MEM_CONTEXT 0x1106
  1523. #define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107
  1524. #define CL_MEM_OFFSET 0x1108
  1525. /* cl_image_info */
  1526. #define CL_IMAGE_FORMAT 0x1110
  1527. #define CL_IMAGE_ELEMENT_SIZE 0x1111
  1528. #define CL_IMAGE_ROW_PITCH 0x1112
  1529. #define CL_IMAGE_SLICE_PITCH 0x1113
  1530. #define CL_IMAGE_WIDTH 0x1114
  1531. #define CL_IMAGE_HEIGHT 0x1115
  1532. #define CL_IMAGE_DEPTH 0x1116
  1533. #define CL_IMAGE_ARRAY_SIZE 0x1117
  1534. #define CL_IMAGE_BUFFER 0x1118
  1535. #define CL_IMAGE_NUM_MIP_LEVELS 0x1119
  1536. #define CL_IMAGE_NUM_SAMPLES 0x111A
  1537. /* cl_addressing_mode */
  1538. #define CL_ADDRESS_NONE 0x1130
  1539. #define CL_ADDRESS_CLAMP_TO_EDGE 0x1131
  1540. #define CL_ADDRESS_CLAMP 0x1132
  1541. #define CL_ADDRESS_REPEAT 0x1133
  1542. #define CL_ADDRESS_MIRRORED_REPEAT 0x1134
  1543. /* cl_filter_mode */
  1544. #define CL_FILTER_NEAREST 0x1140
  1545. #define CL_FILTER_LINEAR 0x1141
  1546. /* cl_sampler_info */
  1547. #define CL_SAMPLER_REFERENCE_COUNT 0x1150
  1548. #define CL_SAMPLER_CONTEXT 0x1151
  1549. #define CL_SAMPLER_NORMALIZED_COORDS 0x1152
  1550. #define CL_SAMPLER_ADDRESSING_MODE 0x1153
  1551. #define CL_SAMPLER_FILTER_MODE 0x1154
  1552. /* cl_map_flags - bitfield */
  1553. #define CL_MAP_READ (1 << 0)
  1554. #define CL_MAP_WRITE (1 << 1)
  1555. #define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
  1556. /* cl_program_info */
  1557. #define CL_PROGRAM_REFERENCE_COUNT 0x1160
  1558. #define CL_PROGRAM_CONTEXT 0x1161
  1559. #define CL_PROGRAM_NUM_DEVICES 0x1162
  1560. #define CL_PROGRAM_DEVICES 0x1163
  1561. #define CL_PROGRAM_SOURCE 0x1164
  1562. #define CL_PROGRAM_BINARY_SIZES 0x1165
  1563. #define CL_PROGRAM_BINARIES 0x1166
  1564. #define CL_PROGRAM_NUM_KERNELS 0x1167
  1565. #define CL_PROGRAM_KERNEL_NAMES 0x1168
  1566. /* cl_program_build_info */
  1567. #define CL_PROGRAM_BUILD_STATUS 0x1181
  1568. #define CL_PROGRAM_BUILD_OPTIONS 0x1182
  1569. #define CL_PROGRAM_BUILD_LOG 0x1183
  1570. #define CL_PROGRAM_BINARY_TYPE 0x1184
  1571. /* cl_build_status */
  1572. #define CL_BUILD_SUCCESS 0
  1573. #define CL_BUILD_NONE -1
  1574. #define CL_BUILD_ERROR -2
  1575. #define CL_BUILD_IN_PROGRESS -3
  1576. /* cl_kernel_info */
  1577. #define CL_KERNEL_FUNCTION_NAME 0x1190
  1578. #define CL_KERNEL_NUM_ARGS 0x1191
  1579. #define CL_KERNEL_REFERENCE_COUNT 0x1192
  1580. #define CL_KERNEL_CONTEXT 0x1193
  1581. #define CL_KERNEL_PROGRAM 0x1194
  1582. #define CL_KERNEL_ATTRIBUTES 0x1195
  1583. /* cl_kernel_arg_info */
  1584. #define CL_KERNEL_ARG_ADDRESS_QUALIFIER 0x1196
  1585. #define CL_KERNEL_ARG_ACCESS_QUALIFIER 0x1197
  1586. #define CL_KERNEL_ARG_TYPE_NAME 0x1198
  1587. #define CL_KERNEL_ARG_TYPE_QUALIFIER 0x1199
  1588. #define CL_KERNEL_ARG_NAME 0x119A
  1589. /* cl_kernel_arg_address_qualifier */
  1590. #define CL_KERNEL_ARG_ADDRESS_GLOBAL 0x119B
  1591. #define CL_KERNEL_ARG_ADDRESS_LOCAL 0x119C
  1592. #define CL_KERNEL_ARG_ADDRESS_CONSTANT 0x119D
  1593. #define CL_KERNEL_ARG_ADDRESS_PRIVATE 0x119E
  1594. /* cl_kernel_arg_access_qualifier */
  1595. #define CL_KERNEL_ARG_ACCESS_READ_ONLY 0x11A0
  1596. #define CL_KERNEL_ARG_ACCESS_WRITE_ONLY 0x11A1
  1597. #define CL_KERNEL_ARG_ACCESS_READ_WRITE 0x11A2
  1598. #define CL_KERNEL_ARG_ACCESS_NONE 0x11A3
  1599. /* cl_kernel_arg_type_qualifer */
  1600. #define CL_KERNEL_ARG_TYPE_NONE 0
  1601. #define CL_KERNEL_ARG_TYPE_CONST (1 << 0)
  1602. #define CL_KERNEL_ARG_TYPE_RESTRICT (1 << 1)
  1603. #define CL_KERNEL_ARG_TYPE_VOLATILE (1 << 2)
  1604. /* cl_kernel_work_group_info */
  1605. #define CL_KERNEL_WORK_GROUP_SIZE 0x11B0
  1606. #define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1
  1607. #define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2
  1608. #define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3
  1609. #define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4
  1610. #define CL_KERNEL_GLOBAL_WORK_SIZE 0x11B5
  1611. /* cl_event_info */
  1612. #define CL_EVENT_COMMAND_QUEUE 0x11D0
  1613. #define CL_EVENT_COMMAND_TYPE 0x11D1
  1614. #define CL_EVENT_REFERENCE_COUNT 0x11D2
  1615. #define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3
  1616. #define CL_EVENT_CONTEXT 0x11D4
  1617. /* cl_command_type */
  1618. #define CL_COMMAND_NDRANGE_KERNEL 0x11F0
  1619. #define CL_COMMAND_TASK 0x11F1
  1620. #define CL_COMMAND_NATIVE_KERNEL 0x11F2
  1621. #define CL_COMMAND_READ_BUFFER 0x11F3
  1622. #define CL_COMMAND_WRITE_BUFFER 0x11F4
  1623. #define CL_COMMAND_COPY_BUFFER 0x11F5
  1624. #define CL_COMMAND_READ_IMAGE 0x11F6
  1625. #define CL_COMMAND_WRITE_IMAGE 0x11F7
  1626. #define CL_COMMAND_COPY_IMAGE 0x11F8
  1627. #define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9
  1628. #define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA
  1629. #define CL_COMMAND_MAP_BUFFER 0x11FB
  1630. #define CL_COMMAND_MAP_IMAGE 0x11FC
  1631. #define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD
  1632. #define CL_COMMAND_MARKER 0x11FE
  1633. #define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF
  1634. #define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200
  1635. #define CL_COMMAND_READ_BUFFER_RECT 0x1201
  1636. #define CL_COMMAND_WRITE_BUFFER_RECT 0x1202
  1637. #define CL_COMMAND_COPY_BUFFER_RECT 0x1203
  1638. #define CL_COMMAND_USER 0x1204
  1639. #define CL_COMMAND_BARRIER 0x1205
  1640. #define CL_COMMAND_MIGRATE_MEM_OBJECTS 0x1206
  1641. #define CL_COMMAND_FILL_BUFFER 0x1207
  1642. #define CL_COMMAND_FILL_IMAGE 0x1208
  1643. /* command execution status */
  1644. #define CL_COMPLETE 0x0
  1645. #define CL_RUNNING 0x1
  1646. #define CL_SUBMITTED 0x2
  1647. #define CL_QUEUED 0x3
  1648. /* cl_buffer_create_type */
  1649. #define CL_BUFFER_CREATE_TYPE_REGION 0x1220
  1650. /* cl_profiling_info */
  1651. #define CL_PROFILING_COMMAND_QUEUED 0x1280
  1652. #define CL_PROFILING_COMMAND_SUBMIT 0x1281
  1653. #define CL_PROFILING_COMMAND_START 0x1282
  1654. #define CL_PROFILING_COMMAND_END 0x1283
  1655. /********************************************************************************************************/
  1656. /********************************************************************************************************/
  1657. /* Function signature typedef's */
  1658. #ifdef __APPLE__
  1659. # pragma GCC diagnostic push
  1660. # pragma GCC diagnostic ignored "-Wignored-attributes"
  1661. #endif
  1662. /* Platform API */
  1663. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1664. PFNCLGETPLATFORMIDS)(cl_uint /* num_entries */,
  1665. cl_platform_id * /* platforms */,
  1666. cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
  1667. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1668. PFNCLGETPLATFORMINFO)(cl_platform_id /* platform */,
  1669. cl_platform_info /* param_name */,
  1670. size_t /* param_value_size */,
  1671. void * /* param_value */,
  1672. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1673. /* Device APIs */
  1674. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1675. PFNCLGETDEVICEIDS)(cl_platform_id /* platform */,
  1676. cl_device_type /* device_type */,
  1677. cl_uint /* num_entries */,
  1678. cl_device_id * /* devices */,
  1679. cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
  1680. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1681. PFNCLGETDEVICEINFO)(cl_device_id /* device */,
  1682. cl_device_info /* param_name */,
  1683. size_t /* param_value_size */,
  1684. void * /* param_value */,
  1685. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1686. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1687. PFNCLCREATESUBDEVICES)(cl_device_id /* in_device */,
  1688. const cl_device_partition_property * /* properties */,
  1689. cl_uint /* num_devices */,
  1690. cl_device_id * /* out_devices */,
  1691. cl_uint * /* num_devices_ret */) CL_API_SUFFIX__VERSION_1_2;
  1692. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1693. PFNCLRETAINDEVICE)(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
  1694. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1695. PFNCLRELEASEDEVICE)(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
  1696. // Context APIs
  1697. typedef CL_API_ENTRY cl_context (CL_API_CALL *
  1698. PFNCLCREATECONTEXT)(const cl_context_properties * /* properties */,
  1699. cl_uint /* num_devices */,
  1700. const cl_device_id * /* devices */,
  1701. void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *),
  1702. void * /* user_data */,
  1703. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1704. typedef CL_API_ENTRY cl_context (CL_API_CALL *
  1705. PFNCLCREATECONTEXTFROMTYPE)(const cl_context_properties * /* properties */,
  1706. cl_device_type /* device_type */,
  1707. void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *),
  1708. void * /* user_data */,
  1709. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1710. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1711. PFNCLRETAINCONTEXT)(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
  1712. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1713. PFNCLRELEASECONTEXT)(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
  1714. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1715. PFNCLGETCONTEXTINFO)(cl_context /* context */,
  1716. cl_context_info /* param_name */,
  1717. size_t /* param_value_size */,
  1718. void * /* param_value */,
  1719. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1720. /* Command Queue APIs */
  1721. typedef CL_API_ENTRY cl_command_queue (CL_API_CALL *
  1722. PFNCLCREATECOMMANDQUEUE)(cl_context /* context */,
  1723. cl_device_id /* device */,
  1724. cl_command_queue_properties /* properties */,
  1725. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1726. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1727. PFNCLRETAINCOMMANDQUEUE)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  1728. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1729. PFNCLRELEASECOMMANDQUEUE)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  1730. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1731. PFNCLGETCOMMANDQUEUEINFO)(cl_command_queue /* command_queue */,
  1732. cl_command_queue_info /* param_name */,
  1733. size_t /* param_value_size */,
  1734. void * /* param_value */,
  1735. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1736. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1737. PFNCLSETCOMMANDQUEUEPROPERTY)(cl_command_queue /* command_queue */,
  1738. cl_command_queue_properties /* properties */,
  1739. cl_bool /* enable */,
  1740. cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
  1741. /* Memory Object APIs */
  1742. typedef CL_API_ENTRY cl_mem (CL_API_CALL *
  1743. PFNCLCREATEBUFFER)(cl_context /* context */,
  1744. cl_mem_flags /* flags */,
  1745. size_t /* size */,
  1746. void * /* host_ptr */,
  1747. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1748. typedef CL_API_ENTRY cl_mem (CL_API_CALL *
  1749. PFNCLCREATESUBBUFFER)(cl_mem /* buffer */,
  1750. cl_mem_flags /* flags */,
  1751. cl_buffer_create_type /* buffer_create_type */,
  1752. const void * /* buffer_create_info */,
  1753. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
  1754. typedef CL_API_ENTRY cl_mem (CL_API_CALL *
  1755. PFNCLCREATEIMAGE)(cl_context /* context */,
  1756. cl_mem_flags /* flags */,
  1757. const cl_image_format * /* image_format */,
  1758. const cl_image_desc * /* image_desc */,
  1759. void * /* host_ptr */,
  1760. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
  1761. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1762. PFNCLRETAINMEMOBJECT)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
  1763. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1764. PFNCLRELEASEMEMOBJECT)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
  1765. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1766. PFNCLGETSUPPORTEDIMAGEFORMATS)(cl_context /* context */,
  1767. cl_mem_flags /* flags */,
  1768. cl_mem_object_type /* image_type */,
  1769. cl_uint /* num_entries */,
  1770. cl_image_format * /* image_formats */,
  1771. cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
  1772. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1773. PFNCLGETMEMOBJECTINFO)(cl_mem /* memobj */,
  1774. cl_mem_info /* param_name */,
  1775. size_t /* param_value_size */,
  1776. void * /* param_value */,
  1777. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1778. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1779. PFNCLGETIMAGEINFO)(cl_mem /* image */,
  1780. cl_image_info /* param_name */,
  1781. size_t /* param_value_size */,
  1782. void * /* param_value */,
  1783. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1784. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1785. PFNCLSETMEMOBJECTDESTRUCTORCALLBACK)( cl_mem /* memobj */,
  1786. void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
  1787. void * /*user_data */ ) CL_API_SUFFIX__VERSION_1_1;
  1788. /* Sampler APIs */
  1789. typedef CL_API_ENTRY cl_sampler (CL_API_CALL *
  1790. PFNCLCREATESAMPLER)(cl_context /* context */,
  1791. cl_bool /* normalized_coords */,
  1792. cl_addressing_mode /* addressing_mode */,
  1793. cl_filter_mode /* filter_mode */,
  1794. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1795. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1796. PFNCLRETAINSAMPLER)(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
  1797. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1798. PFNCLRELEASESAMPLER)(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
  1799. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1800. PFNCLGETSAMPLERINFO)(cl_sampler /* sampler */,
  1801. cl_sampler_info /* param_name */,
  1802. size_t /* param_value_size */,
  1803. void * /* param_value */,
  1804. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1805. /* Program Object APIs */
  1806. typedef CL_API_ENTRY cl_program (CL_API_CALL *
  1807. PFNCLCREATEPROGRAMWITHSOURCE)(cl_context /* context */,
  1808. cl_uint /* count */,
  1809. const char ** /* strings */,
  1810. const size_t * /* lengths */,
  1811. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1812. typedef CL_API_ENTRY cl_program (CL_API_CALL *
  1813. PFNCLCREATEPROGRAMWITHBINARY)(cl_context /* context */,
  1814. cl_uint /* num_devices */,
  1815. const cl_device_id * /* device_list */,
  1816. const size_t * /* lengths */,
  1817. const unsigned char ** /* binaries */,
  1818. cl_int * /* binary_status */,
  1819. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1820. typedef CL_API_ENTRY cl_program (CL_API_CALL *
  1821. PFNCLCREATEPROGRAMWITHBUILTINKERNELS)(cl_context /* context */,
  1822. cl_uint /* num_devices */,
  1823. const cl_device_id * /* device_list */,
  1824. const char * /* kernel_names */,
  1825. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
  1826. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1827. PFNCLRETAINPROGRAM)(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
  1828. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1829. PFNCLRELEASEPROGRAM)(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
  1830. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1831. PFNCLBUILDPROGRAM)(cl_program /* program */,
  1832. cl_uint /* num_devices */,
  1833. const cl_device_id * /* device_list */,
  1834. const char * /* options */,
  1835. void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
  1836. void * /* user_data */) CL_API_SUFFIX__VERSION_1_0;
  1837. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1838. PFNCLGETPROGRAMINFO)(cl_program /* program */,
  1839. cl_program_info /* param_name */,
  1840. size_t /* param_value_size */,
  1841. void * /* param_value */,
  1842. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1843. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1844. PFNCLGETPROGRAMBUILDINFO)(cl_program /* program */,
  1845. cl_device_id /* device */,
  1846. cl_program_build_info /* param_name */,
  1847. size_t /* param_value_size */,
  1848. void * /* param_value */,
  1849. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1850. /* Kernel Object APIs */
  1851. typedef CL_API_ENTRY cl_kernel (CL_API_CALL *
  1852. PFNCLCREATEKERNEL)(cl_program /* program */,
  1853. const char * /* kernel_name */,
  1854. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  1855. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1856. PFNCLCREATEKERNELSINPROGRAM)(cl_program /* program */,
  1857. cl_uint /* num_kernels */,
  1858. cl_kernel * /* kernels */,
  1859. cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
  1860. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1861. PFNCLRETAINKERNEL)(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
  1862. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1863. PFNCLRELEASEKERNEL)(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
  1864. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1865. PFNCLSETKERNELARG)(cl_kernel /* kernel */,
  1866. cl_uint /* arg_index */,
  1867. size_t /* arg_size */,
  1868. const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
  1869. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1870. PFNCLGETKERNELINFO)(cl_kernel /* kernel */,
  1871. cl_kernel_info /* param_name */,
  1872. size_t /* param_value_size */,
  1873. void * /* param_value */,
  1874. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1875. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1876. PFNCLGETKERNELWORKGROUPINFO)(cl_kernel /* kernel */,
  1877. cl_device_id /* device */,
  1878. cl_kernel_work_group_info /* param_name */,
  1879. size_t /* param_value_size */,
  1880. void * /* param_value */,
  1881. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1882. // Event Object APIs
  1883. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1884. PFNCLWAITFOREVENTS)(cl_uint /* num_events */,
  1885. const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
  1886. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1887. PFNCLGETEVENTINFO)(cl_event /* event */,
  1888. cl_event_info /* param_name */,
  1889. size_t /* param_value_size */,
  1890. void * /* param_value */,
  1891. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1892. typedef CL_API_ENTRY cl_event (CL_API_CALL *
  1893. PFNCLCREATEUSEREVENT)(cl_context /* context */,
  1894. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
  1895. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1896. PFNCLRETAINEVENT)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
  1897. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1898. PFNCLRELEASEEVENT)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
  1899. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1900. PFNCLSETUSEREVENTSTATUS)(cl_event /* event */,
  1901. cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
  1902. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1903. PFNCLSETEVENTCALLBACK)( cl_event /* event */,
  1904. cl_int /* command_exec_callback_type */,
  1905. void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *),
  1906. void * /* user_data */) CL_API_SUFFIX__VERSION_1_1;
  1907. /* Profiling APIs */
  1908. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1909. PFNCLGETEVENTPROFILINGINFO)(cl_event /* event */,
  1910. cl_profiling_info /* param_name */,
  1911. size_t /* param_value_size */,
  1912. void * /* param_value */,
  1913. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  1914. // Flush and Finish APIs
  1915. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1916. PFNCLFLUSH)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  1917. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1918. PFNCLFINISH)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  1919. /* Enqueued Commands APIs */
  1920. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1921. PFNCLENQUEUEREADBUFFER)(cl_command_queue /* command_queue */,
  1922. cl_mem /* buffer */,
  1923. cl_bool /* blocking_read */,
  1924. size_t /* offset */,
  1925. size_t /* cb */,
  1926. void * /* ptr */,
  1927. cl_uint /* num_events_in_wait_list */,
  1928. const cl_event * /* event_wait_list */,
  1929. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  1930. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1931. PFNCLENQUEUEREADBUFFERRECT)(cl_command_queue /* command_queue */,
  1932. cl_mem /* buffer */,
  1933. cl_bool /* blocking_read */,
  1934. const size_t * /* buffer_origin */,
  1935. const size_t * /* host_origin */,
  1936. const size_t * /* region */,
  1937. size_t /* buffer_row_pitch */,
  1938. size_t /* buffer_slice_pitch */,
  1939. size_t /* host_row_pitch */,
  1940. size_t /* host_slice_pitch */,
  1941. void * /* ptr */,
  1942. cl_uint /* num_events_in_wait_list */,
  1943. const cl_event * /* event_wait_list */,
  1944. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
  1945. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1946. PFNCLENQUEUEWRITEBUFFER)(cl_command_queue /* command_queue */,
  1947. cl_mem /* buffer */,
  1948. cl_bool /* blocking_write */,
  1949. size_t /* offset */,
  1950. size_t /* cb */,
  1951. const void * /* ptr */,
  1952. cl_uint /* num_events_in_wait_list */,
  1953. const cl_event * /* event_wait_list */,
  1954. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  1955. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1956. PFNCLENQUEUEWRITEBUFFERRECT)(cl_command_queue /* command_queue */,
  1957. cl_mem /* buffer */,
  1958. cl_bool /* blocking_write */,
  1959. const size_t * /* buffer_origin */,
  1960. const size_t * /* host_origin */,
  1961. const size_t * /* region */,
  1962. size_t /* buffer_row_pitch */,
  1963. size_t /* buffer_slice_pitch */,
  1964. size_t /* host_row_pitch */,
  1965. size_t /* host_slice_pitch */,
  1966. const void * /* ptr */,
  1967. cl_uint /* num_events_in_wait_list */,
  1968. const cl_event * /* event_wait_list */,
  1969. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
  1970. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1971. PFNCLENQUEUECOPYBUFFER)(cl_command_queue /* command_queue */,
  1972. cl_mem /* src_buffer */,
  1973. cl_mem /* dst_buffer */,
  1974. size_t /* src_offset */,
  1975. size_t /* dst_offset */,
  1976. size_t /* cb */,
  1977. cl_uint /* num_events_in_wait_list */,
  1978. const cl_event * /* event_wait_list */,
  1979. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  1980. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1981. PFNCLENQUEUECOPYBUFFERRECT)(cl_command_queue /* command_queue */,
  1982. cl_mem /* src_buffer */,
  1983. cl_mem /* dst_buffer */,
  1984. const size_t * /* src_origin */,
  1985. const size_t * /* dst_origin */,
  1986. const size_t * /* region */,
  1987. size_t /* src_row_pitch */,
  1988. size_t /* src_slice_pitch */,
  1989. size_t /* dst_row_pitch */,
  1990. size_t /* dst_slice_pitch */,
  1991. cl_uint /* num_events_in_wait_list */,
  1992. const cl_event * /* event_wait_list */,
  1993. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
  1994. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  1995. PFNCLENQUEUEREADIMAGE)(cl_command_queue /* command_queue */,
  1996. cl_mem /* image */,
  1997. cl_bool /* blocking_read */,
  1998. const size_t * /* origin[3] */,
  1999. const size_t * /* region[3] */,
  2000. size_t /* row_pitch */,
  2001. size_t /* slice_pitch */,
  2002. void * /* ptr */,
  2003. cl_uint /* num_events_in_wait_list */,
  2004. const cl_event * /* event_wait_list */,
  2005. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2006. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2007. PFNCLENQUEUEWRITEIMAGE)(cl_command_queue /* command_queue */,
  2008. cl_mem /* image */,
  2009. cl_bool /* blocking_write */,
  2010. const size_t * /* origin[3] */,
  2011. const size_t * /* region[3] */,
  2012. size_t /* input_row_pitch */,
  2013. size_t /* input_slice_pitch */,
  2014. const void * /* ptr */,
  2015. cl_uint /* num_events_in_wait_list */,
  2016. const cl_event * /* event_wait_list */,
  2017. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2018. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2019. PFNCLENQUEUECOPYIMAGE)(cl_command_queue /* command_queue */,
  2020. cl_mem /* src_image */,
  2021. cl_mem /* dst_image */,
  2022. const size_t * /* src_origin[3] */,
  2023. const size_t * /* dst_origin[3] */,
  2024. const size_t * /* region[3] */,
  2025. cl_uint /* num_events_in_wait_list */,
  2026. const cl_event * /* event_wait_list */,
  2027. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2028. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2029. PFNCLENQUEUECOPYIMAGETOBUFFER)(cl_command_queue /* command_queue */,
  2030. cl_mem /* src_image */,
  2031. cl_mem /* dst_buffer */,
  2032. const size_t * /* src_origin[3] */,
  2033. const size_t * /* region[3] */,
  2034. size_t /* dst_offset */,
  2035. cl_uint /* num_events_in_wait_list */,
  2036. const cl_event * /* event_wait_list */,
  2037. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2038. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2039. PFNCLENQUEUECOPYBUFFERTOIMAGE)(cl_command_queue /* command_queue */,
  2040. cl_mem /* src_buffer */,
  2041. cl_mem /* dst_image */,
  2042. size_t /* src_offset */,
  2043. const size_t * /* dst_origin[3] */,
  2044. const size_t * /* region[3] */,
  2045. cl_uint /* num_events_in_wait_list */,
  2046. const cl_event * /* event_wait_list */,
  2047. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2048. typedef CL_API_ENTRY void * (CL_API_CALL *
  2049. PFNCLENQUEUEMAPBUFFER)(cl_command_queue /* command_queue */,
  2050. cl_mem /* buffer */,
  2051. cl_bool /* blocking_map */,
  2052. cl_map_flags /* map_flags */,
  2053. size_t /* offset */,
  2054. size_t /* cb */,
  2055. cl_uint /* num_events_in_wait_list */,
  2056. const cl_event * /* event_wait_list */,
  2057. cl_event * /* event */,
  2058. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  2059. typedef CL_API_ENTRY void * (CL_API_CALL *
  2060. PFNCLENQUEUEMAPIMAGE)(cl_command_queue /* command_queue */,
  2061. cl_mem /* image */,
  2062. cl_bool /* blocking_map */,
  2063. cl_map_flags /* map_flags */,
  2064. const size_t * /* origin[3] */,
  2065. const size_t * /* region[3] */,
  2066. size_t * /* image_row_pitch */,
  2067. size_t * /* image_slice_pitch */,
  2068. cl_uint /* num_events_in_wait_list */,
  2069. const cl_event * /* event_wait_list */,
  2070. cl_event * /* event */,
  2071. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  2072. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2073. PFNCLENQUEUEUNMAPMEMOBJECT)(cl_command_queue /* command_queue */,
  2074. cl_mem /* memobj */,
  2075. void * /* mapped_ptr */,
  2076. cl_uint /* num_events_in_wait_list */,
  2077. const cl_event * /* event_wait_list */,
  2078. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2079. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2080. PFNCLENQUEUENDRANGEKERNEL)(cl_command_queue /* command_queue */,
  2081. cl_kernel /* kernel */,
  2082. cl_uint /* work_dim */,
  2083. const size_t * /* global_work_offset */,
  2084. const size_t * /* global_work_size */,
  2085. const size_t * /* local_work_size */,
  2086. cl_uint /* num_events_in_wait_list */,
  2087. const cl_event * /* event_wait_list */,
  2088. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2089. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2090. PFNCLENQUEUETASK)(cl_command_queue /* command_queue */,
  2091. cl_kernel /* kernel */,
  2092. cl_uint /* num_events_in_wait_list */,
  2093. const cl_event * /* event_wait_list */,
  2094. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2095. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2096. PFNCLENQUEUENATIVEKERNEL)(cl_command_queue /* command_queue */,
  2097. void (*user_func)(void *),
  2098. void * /* args */,
  2099. size_t /* cb_args */,
  2100. cl_uint /* num_mem_objects */,
  2101. const cl_mem * /* mem_list */,
  2102. const void ** /* args_mem_loc */,
  2103. cl_uint /* num_events_in_wait_list */,
  2104. const cl_event * /* event_wait_list */,
  2105. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2106. /* Extension function access
  2107. *
  2108. * Returns the extension function address for the given function name,
  2109. * or NULL if a valid function can not be found. The client must
  2110. * check to make sure the address is not NULL, before using or
  2111. * calling the returned function address.
  2112. */
  2113. typedef CL_API_ENTRY void * (CL_API_CALL *
  2114. PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM)(cl_platform_id /* platform */,
  2115. const char * /* func_name */) CL_API_SUFFIX__VERSION_1_2;
  2116. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  2117. // Deprecated OpenCL 1.1 APIs
  2118. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
  2119. PFNCLCREATEIMAGE2D)(cl_context /* context */,
  2120. cl_mem_flags /* flags */,
  2121. const cl_image_format * /* image_format */,
  2122. size_t /* image_width */,
  2123. size_t /* image_height */,
  2124. size_t /* image_row_pitch */,
  2125. void * /* host_ptr */,
  2126. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2127. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
  2128. PFNCLCREATEIMAGE3D)(cl_context /* context */,
  2129. cl_mem_flags /* flags */,
  2130. const cl_image_format * /* image_format */,
  2131. size_t /* image_width */,
  2132. size_t /* image_height */,
  2133. size_t /* image_depth */,
  2134. size_t /* image_row_pitch */,
  2135. size_t /* image_slice_pitch */,
  2136. void * /* host_ptr */,
  2137. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2138. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
  2139. PFNCLENQUEUEMARKER)(cl_command_queue /* command_queue */,
  2140. cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2141. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
  2142. PFNCLENQUEUEWAITFOREVENTS)(cl_command_queue /* command_queue */,
  2143. cl_uint /* num_events */,
  2144. const cl_event * /* event_list */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2145. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
  2146. PFNCLENQUEUEBARRIER)(cl_command_queue /* command_queue */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2147. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (CL_API_CALL *
  2148. PFNCLUNLOADCOMPILER)(void) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2149. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * (CL_API_CALL *
  2150. PFNCLGETEXTENSIONFUNCTIONADDRESS)(const char * /* func_name */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2151. #endif
  2152. /* cl_gl */
  2153. typedef cl_uint cl_gl_object_type;
  2154. typedef cl_uint cl_gl_texture_info;
  2155. typedef cl_uint cl_gl_platform_info;
  2156. typedef struct __GLsync *cl_GLsync;
  2157. /* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
  2158. #define CL_GL_OBJECT_BUFFER 0x2000
  2159. #define CL_GL_OBJECT_TEXTURE2D 0x2001
  2160. #define CL_GL_OBJECT_TEXTURE3D 0x2002
  2161. #define CL_GL_OBJECT_RENDERBUFFER 0x2003
  2162. #define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
  2163. #define CL_GL_OBJECT_TEXTURE1D 0x200F
  2164. #define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
  2165. #define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
  2166. /* cl_gl_texture_info */
  2167. #define CL_GL_TEXTURE_TARGET 0x2004
  2168. #define CL_GL_MIPMAP_LEVEL 0x2005
  2169. #define CL_GL_NUM_SAMPLES 0x2012
  2170. typedef CL_API_ENTRY cl_mem (CL_API_CALL *
  2171. PFNCLCREATEFROMGLBUFFER)(cl_context /* context */,
  2172. cl_mem_flags /* flags */,
  2173. cl_GLuint /* bufobj */,
  2174. int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  2175. typedef CL_API_ENTRY cl_mem (CL_API_CALL *
  2176. PFNCLCREATEFROMGLTEXTURE)(cl_context /* context */,
  2177. cl_mem_flags /* flags */,
  2178. cl_GLenum /* target */,
  2179. cl_GLint /* miplevel */,
  2180. cl_GLuint /* texture */,
  2181. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
  2182. typedef CL_API_ENTRY cl_mem (CL_API_CALL *
  2183. PFNCLCREATEFROMGLRENDERBUFFER)(cl_context /* context */,
  2184. cl_mem_flags /* flags */,
  2185. cl_GLuint /* renderbuffer */,
  2186. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  2187. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2188. PFNCLGETGLOBJECTINFO)(cl_mem /* memobj */,
  2189. cl_gl_object_type * /* gl_object_type */,
  2190. cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
  2191. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2192. PFNCLGETGLTEXTUREINFO)(cl_mem /* memobj */,
  2193. cl_gl_texture_info /* param_name */,
  2194. size_t /* param_value_size */,
  2195. void * /* param_value */,
  2196. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  2197. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2198. PFNCLENQUEUEACQUIREGLOBJECTS)(cl_command_queue /* command_queue */,
  2199. cl_uint /* num_objects */,
  2200. const cl_mem * /* mem_objects */,
  2201. cl_uint /* num_events_in_wait_list */,
  2202. const cl_event * /* event_wait_list */,
  2203. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2204. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2205. PFNCLENQUEUERELEASEGLOBJECTS)(cl_command_queue /* command_queue */,
  2206. cl_uint /* num_objects */,
  2207. const cl_mem * /* mem_objects */,
  2208. cl_uint /* num_events_in_wait_list */,
  2209. const cl_event * /* event_wait_list */,
  2210. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  2211. // Deprecated OpenCL 1.1 APIs
  2212. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  2213. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
  2214. PFNCLCREATEFROMGLTEXTURE2D)(cl_context /* context */,
  2215. cl_mem_flags /* flags */,
  2216. cl_GLenum /* target */,
  2217. cl_GLint /* miplevel */,
  2218. cl_GLuint /* texture */,
  2219. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2220. typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (CL_API_CALL *
  2221. PFNCLCREATEFROMGLTEXTURE3D)(cl_context /* context */,
  2222. cl_mem_flags /* flags */,
  2223. cl_GLenum /* target */,
  2224. cl_GLint /* miplevel */,
  2225. cl_GLuint /* texture */,
  2226. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  2227. #endif
  2228. #ifdef __APPLE__
  2229. # pragma GCC diagnostic pop // ignored "-Wignored-attributes"
  2230. #endif
  2231. /* cl_khr_gl_sharing extension */
  2232. #define cl_khr_gl_sharing 1
  2233. typedef cl_uint cl_gl_context_info;
  2234. /* Additional Error Codes */
  2235. #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
  2236. /* cl_gl_context_info */
  2237. #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
  2238. #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
  2239. /* Additional cl_context_properties */
  2240. #define CL_GL_CONTEXT_KHR 0x2008
  2241. #define CL_EGL_DISPLAY_KHR 0x2009
  2242. #define CL_GLX_DISPLAY_KHR 0x200A
  2243. #define CL_WGL_HDC_KHR 0x200B
  2244. #define CL_CGL_SHAREGROUP_KHR 0x200C
  2245. typedef CL_API_ENTRY cl_int (CL_API_CALL *
  2246. PFNCLGETGLCONTEXTINFOKHR)(const cl_context_properties * /* properties */,
  2247. cl_gl_context_info /* param_name */,
  2248. size_t /* param_value_size */,
  2249. void * /* param_value */,
  2250. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  2251. typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
  2252. const cl_context_properties * properties,
  2253. cl_gl_context_info param_name,
  2254. size_t param_value_size,
  2255. void * param_value,
  2256. size_t * param_value_size_ret);
  2257. #define CLEW_STATIC
  2258. #ifdef CLEW_STATIC
  2259. # define CLEWAPI extern
  2260. #else
  2261. # ifdef CLEW_BUILD
  2262. # define CLEWAPI extern __declspec(dllexport)
  2263. # else
  2264. # define CLEWAPI extern __declspec(dllimport)
  2265. # endif
  2266. #endif
  2267. #if defined(_WIN32)
  2268. #define CLEW_FUN_EXPORT extern
  2269. #else
  2270. #define CLEW_FUN_EXPORT CLEWAPI
  2271. #endif
  2272. #define CLEW_GET_FUN(x) x
  2273. // Variables holding function entry points
  2274. CLEW_FUN_EXPORT PFNCLGETPLATFORMIDS __clewGetPlatformIDs ;
  2275. CLEW_FUN_EXPORT PFNCLGETPLATFORMINFO __clewGetPlatformInfo ;
  2276. CLEW_FUN_EXPORT PFNCLGETDEVICEIDS __clewGetDeviceIDs ;
  2277. CLEW_FUN_EXPORT PFNCLGETDEVICEINFO __clewGetDeviceInfo ;
  2278. CLEW_FUN_EXPORT PFNCLCREATESUBDEVICES __clewCreateSubDevices ;
  2279. CLEW_FUN_EXPORT PFNCLRETAINDEVICE __clewRetainDevice ;
  2280. CLEW_FUN_EXPORT PFNCLRELEASEDEVICE __clewReleaseDevice ;
  2281. CLEW_FUN_EXPORT PFNCLCREATECONTEXT __clewCreateContext ;
  2282. CLEW_FUN_EXPORT PFNCLCREATECONTEXTFROMTYPE __clewCreateContextFromType ;
  2283. CLEW_FUN_EXPORT PFNCLRETAINCONTEXT __clewRetainContext ;
  2284. CLEW_FUN_EXPORT PFNCLRELEASECONTEXT __clewReleaseContext ;
  2285. CLEW_FUN_EXPORT PFNCLGETCONTEXTINFO __clewGetContextInfo ;
  2286. CLEW_FUN_EXPORT PFNCLCREATECOMMANDQUEUE __clewCreateCommandQueue ;
  2287. CLEW_FUN_EXPORT PFNCLRETAINCOMMANDQUEUE __clewRetainCommandQueue ;
  2288. CLEW_FUN_EXPORT PFNCLRELEASECOMMANDQUEUE __clewReleaseCommandQueue ;
  2289. CLEW_FUN_EXPORT PFNCLGETCOMMANDQUEUEINFO __clewGetCommandQueueInfo ;
  2290. CLEW_FUN_EXPORT PFNCLCREATEBUFFER __clewCreateBuffer ;
  2291. CLEW_FUN_EXPORT PFNCLCREATESUBBUFFER __clewCreateSubBuffer ;
  2292. CLEW_FUN_EXPORT PFNCLCREATEIMAGE __clewCreateImage ;
  2293. CLEW_FUN_EXPORT PFNCLRETAINMEMOBJECT __clewRetainMemObject ;
  2294. CLEW_FUN_EXPORT PFNCLRELEASEMEMOBJECT __clewReleaseMemObject ;
  2295. CLEW_FUN_EXPORT PFNCLGETSUPPORTEDIMAGEFORMATS __clewGetSupportedImageFormats ;
  2296. CLEW_FUN_EXPORT PFNCLGETMEMOBJECTINFO __clewGetMemObjectInfo ;
  2297. CLEW_FUN_EXPORT PFNCLGETIMAGEINFO __clewGetImageInfo ;
  2298. CLEW_FUN_EXPORT PFNCLSETMEMOBJECTDESTRUCTORCALLBACK __clewSetMemObjectDestructorCallback;
  2299. CLEW_FUN_EXPORT PFNCLCREATESAMPLER __clewCreateSampler ;
  2300. CLEW_FUN_EXPORT PFNCLRETAINSAMPLER __clewRetainSampler ;
  2301. CLEW_FUN_EXPORT PFNCLRELEASESAMPLER __clewReleaseSampler ;
  2302. CLEW_FUN_EXPORT PFNCLGETSAMPLERINFO __clewGetSamplerInfo ;
  2303. CLEW_FUN_EXPORT PFNCLCREATEPROGRAMWITHSOURCE __clewCreateProgramWithSource ;
  2304. CLEW_FUN_EXPORT PFNCLCREATEPROGRAMWITHBINARY __clewCreateProgramWithBinary ;
  2305. CLEW_FUN_EXPORT PFNCLCREATEPROGRAMWITHBUILTINKERNELS __clewCreateProgramWithBuiltInKernels;
  2306. CLEW_FUN_EXPORT PFNCLRETAINPROGRAM __clewRetainProgram ;
  2307. CLEW_FUN_EXPORT PFNCLRELEASEPROGRAM __clewReleaseProgram ;
  2308. CLEW_FUN_EXPORT PFNCLBUILDPROGRAM __clewBuildProgram ;
  2309. CLEW_FUN_EXPORT PFNCLGETPROGRAMINFO __clewGetProgramInfo ;
  2310. CLEW_FUN_EXPORT PFNCLGETPROGRAMBUILDINFO __clewGetProgramBuildInfo ;
  2311. CLEW_FUN_EXPORT PFNCLCREATEKERNEL __clewCreateKernel ;
  2312. CLEW_FUN_EXPORT PFNCLCREATEKERNELSINPROGRAM __clewCreateKernelsInProgram ;
  2313. CLEW_FUN_EXPORT PFNCLRETAINKERNEL __clewRetainKernel ;
  2314. CLEW_FUN_EXPORT PFNCLRELEASEKERNEL __clewReleaseKernel ;
  2315. CLEW_FUN_EXPORT PFNCLSETKERNELARG __clewSetKernelArg ;
  2316. CLEW_FUN_EXPORT PFNCLGETKERNELINFO __clewGetKernelInfo ;
  2317. CLEW_FUN_EXPORT PFNCLGETKERNELWORKGROUPINFO __clewGetKernelWorkGroupInfo ;
  2318. CLEW_FUN_EXPORT PFNCLWAITFOREVENTS __clewWaitForEvents ;
  2319. CLEW_FUN_EXPORT PFNCLGETEVENTINFO __clewGetEventInfo ;
  2320. CLEW_FUN_EXPORT PFNCLCREATEUSEREVENT __clewCreateUserEvent ;
  2321. CLEW_FUN_EXPORT PFNCLRETAINEVENT __clewRetainEvent ;
  2322. CLEW_FUN_EXPORT PFNCLRELEASEEVENT __clewReleaseEvent ;
  2323. CLEW_FUN_EXPORT PFNCLSETUSEREVENTSTATUS __clewSetUserEventStatus ;
  2324. CLEW_FUN_EXPORT PFNCLSETEVENTCALLBACK __clewSetEventCallback ;
  2325. CLEW_FUN_EXPORT PFNCLGETEVENTPROFILINGINFO __clewGetEventProfilingInfo ;
  2326. CLEW_FUN_EXPORT PFNCLFLUSH __clewFlush ;
  2327. CLEW_FUN_EXPORT PFNCLFINISH __clewFinish ;
  2328. CLEW_FUN_EXPORT PFNCLENQUEUEREADBUFFER __clewEnqueueReadBuffer ;
  2329. CLEW_FUN_EXPORT PFNCLENQUEUEREADBUFFERRECT __clewEnqueueReadBufferRect ;
  2330. CLEW_FUN_EXPORT PFNCLENQUEUEWRITEBUFFER __clewEnqueueWriteBuffer ;
  2331. CLEW_FUN_EXPORT PFNCLENQUEUEWRITEBUFFERRECT __clewEnqueueWriteBufferRect ;
  2332. CLEW_FUN_EXPORT PFNCLENQUEUECOPYBUFFER __clewEnqueueCopyBuffer ;
  2333. CLEW_FUN_EXPORT PFNCLENQUEUECOPYBUFFERRECT __clewEnqueueCopyBufferRect ;
  2334. CLEW_FUN_EXPORT PFNCLENQUEUEREADIMAGE __clewEnqueueReadImage ;
  2335. CLEW_FUN_EXPORT PFNCLENQUEUEWRITEIMAGE __clewEnqueueWriteImage ;
  2336. CLEW_FUN_EXPORT PFNCLENQUEUECOPYIMAGE __clewEnqueueCopyImage ;
  2337. CLEW_FUN_EXPORT PFNCLENQUEUECOPYIMAGETOBUFFER __clewEnqueueCopyImageToBuffer ;
  2338. CLEW_FUN_EXPORT PFNCLENQUEUECOPYBUFFERTOIMAGE __clewEnqueueCopyBufferToImage ;
  2339. CLEW_FUN_EXPORT PFNCLENQUEUEMAPBUFFER __clewEnqueueMapBuffer ;
  2340. CLEW_FUN_EXPORT PFNCLENQUEUEMAPIMAGE __clewEnqueueMapImage ;
  2341. CLEW_FUN_EXPORT PFNCLENQUEUEUNMAPMEMOBJECT __clewEnqueueUnmapMemObject ;
  2342. CLEW_FUN_EXPORT PFNCLENQUEUENDRANGEKERNEL __clewEnqueueNDRangeKernel ;
  2343. CLEW_FUN_EXPORT PFNCLENQUEUETASK __clewEnqueueTask ;
  2344. CLEW_FUN_EXPORT PFNCLENQUEUENATIVEKERNEL __clewEnqueueNativeKernel ;
  2345. CLEW_FUN_EXPORT PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM __clewGetExtensionFunctionAddressForPlatform;
  2346. #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
  2347. CLEW_FUN_EXPORT PFNCLSETCOMMANDQUEUEPROPERTY __clewSetCommandQueueProperty ;
  2348. #endif
  2349. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  2350. CLEW_FUN_EXPORT PFNCLCREATEIMAGE2D __clewCreateImage2D ;
  2351. CLEW_FUN_EXPORT PFNCLCREATEIMAGE3D __clewCreateImage3D ;
  2352. CLEW_FUN_EXPORT PFNCLGETEXTENSIONFUNCTIONADDRESS __clewGetExtensionFunctionAddress ;
  2353. CLEW_FUN_EXPORT PFNCLUNLOADCOMPILER __clewUnloadCompiler ;
  2354. CLEW_FUN_EXPORT PFNCLENQUEUEMARKER __clewEnqueueMarker ;
  2355. CLEW_FUN_EXPORT PFNCLENQUEUEWAITFOREVENTS __clewEnqueueWaitForEvents ;
  2356. CLEW_FUN_EXPORT PFNCLENQUEUEBARRIER __clewEnqueueBarrier ;
  2357. #endif
  2358. /* cl_gl */
  2359. CLEW_FUN_EXPORT PFNCLCREATEFROMGLBUFFER __clewCreateFromGLBuffer ;
  2360. CLEW_FUN_EXPORT PFNCLCREATEFROMGLTEXTURE __clewCreateFromGLTexture ;
  2361. CLEW_FUN_EXPORT PFNCLCREATEFROMGLRENDERBUFFER __clewCreateFromGLRenderbuffer ;
  2362. CLEW_FUN_EXPORT PFNCLGETGLOBJECTINFO __clewGetGLObjectInfo ;
  2363. CLEW_FUN_EXPORT PFNCLGETGLTEXTUREINFO __clewGetGLTextureInfo ;
  2364. CLEW_FUN_EXPORT PFNCLENQUEUEACQUIREGLOBJECTS __clewEnqueueAcquireGLObjects ;
  2365. CLEW_FUN_EXPORT PFNCLENQUEUERELEASEGLOBJECTS __clewEnqueueReleaseGLObjects ;
  2366. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  2367. CLEW_FUN_EXPORT PFNCLCREATEFROMGLTEXTURE2D __clewCreateFromGLTexture2D ;
  2368. CLEW_FUN_EXPORT PFNCLCREATEFROMGLTEXTURE3D __clewCreateFromGLTexture3D ;
  2369. #endif
  2370. CLEW_FUN_EXPORT PFNCLGETGLCONTEXTINFOKHR __clewGetGLContextInfoKHR ;
  2371. #define clGetPlatformIDs CLEW_GET_FUN(__clewGetPlatformIDs )
  2372. #define clGetPlatformInfo CLEW_GET_FUN(__clewGetPlatformInfo )
  2373. #define clGetDeviceIDs CLEW_GET_FUN(__clewGetDeviceIDs )
  2374. #define clGetDeviceInfo CLEW_GET_FUN(__clewGetDeviceInfo )
  2375. #define clCreateContext CLEW_GET_FUN(__clewCreateContext )
  2376. #define clCreateContextFromType CLEW_GET_FUN(__clewCreateContextFromType )
  2377. #define clRetainContext CLEW_GET_FUN(__clewRetainContext )
  2378. #define clReleaseContext CLEW_GET_FUN(__clewReleaseContext )
  2379. #define clGetContextInfo CLEW_GET_FUN(__clewGetContextInfo )
  2380. #define clCreateCommandQueue CLEW_GET_FUN(__clewCreateCommandQueue )
  2381. #define clRetainCommandQueue CLEW_GET_FUN(__clewRetainCommandQueue )
  2382. #define clReleaseCommandQueue CLEW_GET_FUN(__clewReleaseCommandQueue )
  2383. #define clGetCommandQueueInfo CLEW_GET_FUN(__clewGetCommandQueueInfo )
  2384. #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
  2385. #warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1!
  2386. /*
  2387. * WARNING:
  2388. * This API introduces mutable state into the OpenCL implementation. It has been REMOVED
  2389. * to better facilitate thread safety. The 1.0 API is not thread safe. It is not tested by the
  2390. * OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
  2391. * It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
  2392. *
  2393. * Software developers previously relying on this API are instructed to set the command queue
  2394. * properties when creating the queue, instead.
  2395. */
  2396. #define clSetCommandQueueProperty CLEW_GET_FUN(__clewSetCommandQueueProperty )
  2397. #endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */
  2398. #define clCreateBuffer CLEW_GET_FUN(__clewCreateBuffer )
  2399. #define clCreateSubBuffer CLEW_GET_FUN(__clewCreateSubBuffer )
  2400. #define clCreateImage CLEW_GET_FUN(__clewCreateImage )
  2401. #define clRetainMemObject CLEW_GET_FUN(__clewRetainMemObject )
  2402. #define clReleaseMemObject CLEW_GET_FUN(__clewReleaseMemObject )
  2403. #define clGetSupportedImageFormats CLEW_GET_FUN(__clewGetSupportedImageFormats )
  2404. #define clGetMemObjectInfo CLEW_GET_FUN(__clewGetMemObjectInfo )
  2405. #define clGetImageInfo CLEW_GET_FUN(__clewGetImageInfo )
  2406. #define clSetMemObjectDestructorCallback CLEW_GET_FUN(__clewSetMemObjectDestructorCallback)
  2407. #define clCreateSampler CLEW_GET_FUN(__clewCreateSampler )
  2408. #define clRetainSampler CLEW_GET_FUN(__clewRetainSampler )
  2409. #define clReleaseSampler CLEW_GET_FUN(__clewReleaseSampler )
  2410. #define clGetSamplerInfo CLEW_GET_FUN(__clewGetSamplerInfo )
  2411. #define clCreateProgramWithSource CLEW_GET_FUN(__clewCreateProgramWithSource )
  2412. #define clCreateProgramWithBinary CLEW_GET_FUN(__clewCreateProgramWithBinary )
  2413. #define clCreateProgramWithBuiltInKernels CLEW_GET_FUN(__clewCreateProgramWithBuiltInKernels)
  2414. #define clRetainProgram CLEW_GET_FUN(__clewRetainProgram )
  2415. #define clReleaseProgram CLEW_GET_FUN(__clewReleaseProgram )
  2416. #define clBuildProgram CLEW_GET_FUN(__clewBuildProgram )
  2417. #define clGetProgramInfo CLEW_GET_FUN(__clewGetProgramInfo )
  2418. #define clGetProgramBuildInfo CLEW_GET_FUN(__clewGetProgramBuildInfo )
  2419. #define clCreateKernel CLEW_GET_FUN(__clewCreateKernel )
  2420. #define clCreateKernelsInProgram CLEW_GET_FUN(__clewCreateKernelsInProgram )
  2421. #define clRetainKernel CLEW_GET_FUN(__clewRetainKernel )
  2422. #define clReleaseKernel CLEW_GET_FUN(__clewReleaseKernel )
  2423. #define clSetKernelArg CLEW_GET_FUN(__clewSetKernelArg )
  2424. #define clGetKernelInfo CLEW_GET_FUN(__clewGetKernelInfo )
  2425. #define clGetKernelWorkGroupInfo CLEW_GET_FUN(__clewGetKernelWorkGroupInfo )
  2426. #define clWaitForEvents CLEW_GET_FUN(__clewWaitForEvents )
  2427. #define clGetEventInfo CLEW_GET_FUN(__clewGetEventInfo )
  2428. #define clCreateUserEvent CLEW_GET_FUN(__clewCreateUserEvent )
  2429. #define clRetainEvent CLEW_GET_FUN(__clewRetainEvent )
  2430. #define clReleaseEvent CLEW_GET_FUN(__clewReleaseEvent )
  2431. #define clSetUserEventStatus CLEW_GET_FUN(__clewSetUserEventStatus )
  2432. #define clSetEventCallback CLEW_GET_FUN(__clewSetEventCallback )
  2433. #define clGetEventProfilingInfo CLEW_GET_FUN(__clewGetEventProfilingInfo )
  2434. #define clFlush CLEW_GET_FUN(__clewFlush )
  2435. #define clFinish CLEW_GET_FUN(__clewFinish )
  2436. #define clEnqueueReadBuffer CLEW_GET_FUN(__clewEnqueueReadBuffer )
  2437. #define clEnqueueReadBufferRect CLEW_GET_FUN(__clewEnqueueReadBufferRect )
  2438. #define clEnqueueWriteBuffer CLEW_GET_FUN(__clewEnqueueWriteBuffer )
  2439. #define clEnqueueWriteBufferRect CLEW_GET_FUN(__clewEnqueueWriteBufferRect )
  2440. #define clEnqueueCopyBuffer CLEW_GET_FUN(__clewEnqueueCopyBuffer )
  2441. #define clEnqueueCopyBufferRect CLEW_GET_FUN(__clewEnqueueCopyBufferRect )
  2442. #define clEnqueueReadImage CLEW_GET_FUN(__clewEnqueueReadImage )
  2443. #define clEnqueueWriteImage CLEW_GET_FUN(__clewEnqueueWriteImage )
  2444. #define clEnqueueCopyImage CLEW_GET_FUN(__clewEnqueueCopyImage )
  2445. #define clEnqueueCopyImageToBuffer CLEW_GET_FUN(__clewEnqueueCopyImageToBuffer )
  2446. #define clEnqueueCopyBufferToImage CLEW_GET_FUN(__clewEnqueueCopyBufferToImage )
  2447. #define clEnqueueMapBuffer CLEW_GET_FUN(__clewEnqueueMapBuffer )
  2448. #define clEnqueueMapImage CLEW_GET_FUN(__clewEnqueueMapImage )
  2449. #define clEnqueueUnmapMemObject CLEW_GET_FUN(__clewEnqueueUnmapMemObject )
  2450. #define clEnqueueNDRangeKernel CLEW_GET_FUN(__clewEnqueueNDRangeKernel )
  2451. #define clEnqueueTask CLEW_GET_FUN(__clewEnqueueTask )
  2452. #define clEnqueueNativeKernel CLEW_GET_FUN(__clewEnqueueNativeKernel )
  2453. #define clGetExtensionFunctionAddressForPlatform CLEW_GET_FUN(__clewGetExtensionFunctionAddressForPlatform)
  2454. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  2455. #define clCreateImage2D CLEW_GET_FUN(__clewCreateImage2D )
  2456. #define clCreateImage3D CLEW_GET_FUN(__clewCreateImage3D )
  2457. #define clGetExtensionFunctionAddress CLEW_GET_FUN(__clewGetExtensionFunctionAddress )
  2458. #define clEnqueueMarker CLEW_GET_FUN(__clewEnqueueMarker )
  2459. #define clEnqueueWaitForEvents CLEW_GET_FUN(__clewEnqueueWaitForEvents )
  2460. #define clEnqueueBarrier CLEW_GET_FUN(__clewEnqueueBarrier )
  2461. #define clUnloadCompiler CLEW_GET_FUN(__clewUnloadCompiler )
  2462. #endif
  2463. /* cl_gl */
  2464. #define clCreateFromGLBuffer CLEW_GET_FUN(__clewCreateFromGLBuffer )
  2465. #define clCreateFromGLTexture CLEW_GET_FUN(__clewCreateFromGLTexture )
  2466. #define clCreateFromGLRenderbuffer CLEW_GET_FUN(__clewCreateFromGLRenderbuffer )
  2467. #define clGetGLObjectInfo CLEW_GET_FUN(__clewGetGLObjectInfo )
  2468. #define clGetGLTextureInfo CLEW_GET_FUN(__clGetGLTextureInfo )
  2469. #define clEnqueueAcquireGLObjects CLEW_GET_FUN(__clewEnqueueAcquireGLObjects )
  2470. #define clEnqueueReleaseGLObjects CLEW_GET_FUN(__clewEnqueueReleaseGLObjects )
  2471. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  2472. #define clCreateFromGLTexture2D CLEW_GET_FUN(__clewCreateFromGLTexture2D )
  2473. #define clCreateFromGLTexture3D CLEW_GET_FUN(__clewCreateFromGLTexture3D )
  2474. #endif
  2475. #define clGetGLContextInfoKHR CLEW_GET_FUN(__clewGetGLContextInfoKHR )
  2476. /* cl_ext */
  2477. /******************************************
  2478. * cl_nv_device_attribute_query extension *
  2479. ******************************************/
  2480. /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
  2481. #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
  2482. #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
  2483. #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
  2484. #define CL_DEVICE_WARP_SIZE_NV 0x4003
  2485. #define CL_DEVICE_GPU_OVERLAP_NV 0x4004
  2486. #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
  2487. #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
  2488. #define CL_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT_NV 0x4007
  2489. #define CL_DEVICE_PCI_BUS_ID_NV 0x4008
  2490. #define CL_DEVICE_PCI_SLOT_ID_NV 0x4009
  2491. /*********************************
  2492. * cl_amd_device_attribute_query *
  2493. *********************************/
  2494. #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
  2495. #define CL_DEVICE_TOPOLOGY_AMD 0x4037
  2496. #define CL_DEVICE_BOARD_NAME_AMD 0x4038
  2497. #define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039
  2498. #define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
  2499. #define CL_DEVICE_SIMD_WIDTH_AMD 0x4041
  2500. #define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042
  2501. #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
  2502. #define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044
  2503. #define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045
  2504. #define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
  2505. #define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047
  2506. #define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048
  2507. #define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049
  2508. #define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A
  2509. #define CL_DEVICE_GFXIP_MINOR_AMD 0x404B
  2510. #define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C
  2511. #ifndef CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD
  2512. #define CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD 1
  2513. typedef union
  2514. {
  2515. struct { cl_uint type; cl_uint data[5]; } raw;
  2516. struct { cl_uint type; cl_char unused[17]; cl_char bus; cl_char device; cl_char function; } pcie;
  2517. } cl_device_topology_amd;
  2518. #endif
  2519. /*********************************
  2520. * cl_arm_printf extension
  2521. *********************************/
  2522. #define CL_PRINTF_CALLBACK_ARM 0x40B0
  2523. #define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
  2524. #define CLEW_SUCCESS 0 //!< Success error code
  2525. #define CLEW_ERROR_OPEN_FAILED -1 //!< Error code for failing to open the dynamic library
  2526. #define CLEW_ERROR_ATEXIT_FAILED -2 //!< Error code for failing to queue the closing of the dynamic library to atexit()
  2527. //! \brief Load OpenCL dynamic library and set function entry points
  2528. int clewInit (void);
  2529. //! \brief Convert an OpenCL error code to its string equivalent
  2530. const char* clewErrorString (cl_int error);
  2531. #ifdef __cplusplus
  2532. }
  2533. #endif
  2534. #endif // CLEW_HPP_INCLUDED