clew.h 84 KB

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