Clone of mesa.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

cl_platform.h 43KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429
  1. /**********************************************************************************
  2. * Copyright (c) 2008-2018 The Khronos Group Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and/or associated documentation files (the
  6. * "Materials"), to deal in the Materials without restriction, including
  7. * without limitation the rights to use, copy, modify, merge, publish,
  8. * distribute, sublicense, and/or sell copies of the Materials, and to
  9. * permit persons to whom the Materials are furnished to do so, subject to
  10. * the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included
  13. * in all copies or substantial portions of the Materials.
  14. *
  15. * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
  16. * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
  17. * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
  18. * https://www.khronos.org/registry/
  19. *
  20. * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26. * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  27. **********************************************************************************/
  28. #ifndef __CL_PLATFORM_H
  29. #define __CL_PLATFORM_H
  30. #include <CL/cl_version.h>
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if defined(_WIN32)
  35. #define CL_API_ENTRY
  36. #define CL_API_CALL __stdcall
  37. #define CL_CALLBACK __stdcall
  38. #else
  39. #define CL_API_ENTRY
  40. #define CL_API_CALL
  41. #define CL_CALLBACK
  42. #endif
  43. /*
  44. * Deprecation flags refer to the last version of the header in which the
  45. * feature was not deprecated.
  46. *
  47. * E.g. VERSION_1_1_DEPRECATED means the feature is present in 1.1 without
  48. * deprecation but is deprecated in versions later than 1.1.
  49. */
  50. #define CL_EXTENSION_WEAK_LINK
  51. #define CL_API_SUFFIX__VERSION_1_0
  52. #define CL_EXT_SUFFIX__VERSION_1_0
  53. #define CL_API_SUFFIX__VERSION_1_1
  54. #define CL_EXT_SUFFIX__VERSION_1_1
  55. #define CL_API_SUFFIX__VERSION_1_2
  56. #define CL_EXT_SUFFIX__VERSION_1_2
  57. #define CL_API_SUFFIX__VERSION_2_0
  58. #define CL_EXT_SUFFIX__VERSION_2_0
  59. #define CL_API_SUFFIX__VERSION_2_1
  60. #define CL_EXT_SUFFIX__VERSION_2_1
  61. #define CL_API_SUFFIX__VERSION_2_2
  62. #define CL_EXT_SUFFIX__VERSION_2_2
  63. #ifdef __GNUC__
  64. #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
  65. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  66. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  67. #else
  68. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
  69. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  70. #endif
  71. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  72. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  73. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  74. #else
  75. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
  76. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  77. #endif
  78. #ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
  79. #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
  80. #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
  81. #else
  82. #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED __attribute__((deprecated))
  83. #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
  84. #endif
  85. #ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
  86. #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED
  87. #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED
  88. #else
  89. #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED __attribute__((deprecated))
  90. #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED
  91. #endif
  92. #ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
  93. #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED
  94. #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED
  95. #else
  96. #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED __attribute__((deprecated))
  97. #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED
  98. #endif
  99. #elif defined(_WIN32)
  100. #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
  101. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  102. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  103. #else
  104. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  105. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
  106. #endif
  107. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  108. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  109. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  110. #else
  111. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  112. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
  113. #endif
  114. #ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
  115. #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
  116. #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
  117. #else
  118. #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
  119. #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED __declspec(deprecated)
  120. #endif
  121. #ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
  122. #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED
  123. #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED
  124. #else
  125. #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED
  126. #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED __declspec(deprecated)
  127. #endif
  128. #ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
  129. #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED
  130. #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED
  131. #else
  132. #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED
  133. #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED __declspec(deprecated)
  134. #endif
  135. #else
  136. #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
  137. #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
  138. #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
  139. #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
  140. #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
  141. #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
  142. #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED
  143. #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED
  144. #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED
  145. #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED
  146. #endif
  147. #if (defined (_WIN32) && defined(_MSC_VER))
  148. /* scalar types */
  149. typedef signed __int8 cl_char;
  150. typedef unsigned __int8 cl_uchar;
  151. typedef signed __int16 cl_short;
  152. typedef unsigned __int16 cl_ushort;
  153. typedef signed __int32 cl_int;
  154. typedef unsigned __int32 cl_uint;
  155. typedef signed __int64 cl_long;
  156. typedef unsigned __int64 cl_ulong;
  157. typedef unsigned __int16 cl_half;
  158. typedef float cl_float;
  159. typedef double cl_double;
  160. /* Macro names and corresponding values defined by OpenCL */
  161. #define CL_CHAR_BIT 8
  162. #define CL_SCHAR_MAX 127
  163. #define CL_SCHAR_MIN (-127-1)
  164. #define CL_CHAR_MAX CL_SCHAR_MAX
  165. #define CL_CHAR_MIN CL_SCHAR_MIN
  166. #define CL_UCHAR_MAX 255
  167. #define CL_SHRT_MAX 32767
  168. #define CL_SHRT_MIN (-32767-1)
  169. #define CL_USHRT_MAX 65535
  170. #define CL_INT_MAX 2147483647
  171. #define CL_INT_MIN (-2147483647-1)
  172. #define CL_UINT_MAX 0xffffffffU
  173. #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
  174. #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
  175. #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
  176. #define CL_FLT_DIG 6
  177. #define CL_FLT_MANT_DIG 24
  178. #define CL_FLT_MAX_10_EXP +38
  179. #define CL_FLT_MAX_EXP +128
  180. #define CL_FLT_MIN_10_EXP -37
  181. #define CL_FLT_MIN_EXP -125
  182. #define CL_FLT_RADIX 2
  183. #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
  184. #define CL_FLT_MIN 1.175494350822287507969e-38f
  185. #define CL_FLT_EPSILON 1.1920928955078125e-7f
  186. #define CL_HALF_DIG 3
  187. #define CL_HALF_MANT_DIG 11
  188. #define CL_HALF_MAX_10_EXP +4
  189. #define CL_HALF_MAX_EXP +16
  190. #define CL_HALF_MIN_10_EXP -4
  191. #define CL_HALF_MIN_EXP -13
  192. #define CL_HALF_RADIX 2
  193. #define CL_HALF_MAX 65504.0f
  194. #define CL_HALF_MIN 6.103515625e-05f
  195. #define CL_HALF_EPSILON 9.765625e-04f
  196. #define CL_DBL_DIG 15
  197. #define CL_DBL_MANT_DIG 53
  198. #define CL_DBL_MAX_10_EXP +308
  199. #define CL_DBL_MAX_EXP +1024
  200. #define CL_DBL_MIN_10_EXP -307
  201. #define CL_DBL_MIN_EXP -1021
  202. #define CL_DBL_RADIX 2
  203. #define CL_DBL_MAX 1.7976931348623158e+308
  204. #define CL_DBL_MIN 2.225073858507201383090e-308
  205. #define CL_DBL_EPSILON 2.220446049250313080847e-16
  206. #define CL_M_E 2.7182818284590452354
  207. #define CL_M_LOG2E 1.4426950408889634074
  208. #define CL_M_LOG10E 0.43429448190325182765
  209. #define CL_M_LN2 0.69314718055994530942
  210. #define CL_M_LN10 2.30258509299404568402
  211. #define CL_M_PI 3.14159265358979323846
  212. #define CL_M_PI_2 1.57079632679489661923
  213. #define CL_M_PI_4 0.78539816339744830962
  214. #define CL_M_1_PI 0.31830988618379067154
  215. #define CL_M_2_PI 0.63661977236758134308
  216. #define CL_M_2_SQRTPI 1.12837916709551257390
  217. #define CL_M_SQRT2 1.41421356237309504880
  218. #define CL_M_SQRT1_2 0.70710678118654752440
  219. #define CL_M_E_F 2.718281828f
  220. #define CL_M_LOG2E_F 1.442695041f
  221. #define CL_M_LOG10E_F 0.434294482f
  222. #define CL_M_LN2_F 0.693147181f
  223. #define CL_M_LN10_F 2.302585093f
  224. #define CL_M_PI_F 3.141592654f
  225. #define CL_M_PI_2_F 1.570796327f
  226. #define CL_M_PI_4_F 0.785398163f
  227. #define CL_M_1_PI_F 0.318309886f
  228. #define CL_M_2_PI_F 0.636619772f
  229. #define CL_M_2_SQRTPI_F 1.128379167f
  230. #define CL_M_SQRT2_F 1.414213562f
  231. #define CL_M_SQRT1_2_F 0.707106781f
  232. #define CL_NAN (CL_INFINITY - CL_INFINITY)
  233. #define CL_HUGE_VALF ((cl_float) 1e50)
  234. #define CL_HUGE_VAL ((cl_double) 1e500)
  235. #define CL_MAXFLOAT CL_FLT_MAX
  236. #define CL_INFINITY CL_HUGE_VALF
  237. #else
  238. #include <stdint.h>
  239. /* scalar types */
  240. typedef int8_t cl_char;
  241. typedef uint8_t cl_uchar;
  242. typedef int16_t cl_short __attribute__((aligned(2)));
  243. typedef uint16_t cl_ushort __attribute__((aligned(2)));
  244. typedef int32_t cl_int __attribute__((aligned(4)));
  245. typedef uint32_t cl_uint __attribute__((aligned(4)));
  246. typedef int64_t cl_long __attribute__((aligned(8)));
  247. typedef uint64_t cl_ulong __attribute__((aligned(8)));
  248. typedef uint16_t cl_half __attribute__((aligned(2)));
  249. typedef float cl_float __attribute__((aligned(4)));
  250. typedef double cl_double __attribute__((aligned(8)));
  251. /* Macro names and corresponding values defined by OpenCL */
  252. #define CL_CHAR_BIT 8
  253. #define CL_SCHAR_MAX 127
  254. #define CL_SCHAR_MIN (-127-1)
  255. #define CL_CHAR_MAX CL_SCHAR_MAX
  256. #define CL_CHAR_MIN CL_SCHAR_MIN
  257. #define CL_UCHAR_MAX 255
  258. #define CL_SHRT_MAX 32767
  259. #define CL_SHRT_MIN (-32767-1)
  260. #define CL_USHRT_MAX 65535
  261. #define CL_INT_MAX 2147483647
  262. #define CL_INT_MIN (-2147483647-1)
  263. #define CL_UINT_MAX 0xffffffffU
  264. #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
  265. #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
  266. #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
  267. #define CL_FLT_DIG 6
  268. #define CL_FLT_MANT_DIG 24
  269. #define CL_FLT_MAX_10_EXP +38
  270. #define CL_FLT_MAX_EXP +128
  271. #define CL_FLT_MIN_10_EXP -37
  272. #define CL_FLT_MIN_EXP -125
  273. #define CL_FLT_RADIX 2
  274. #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
  275. #define CL_FLT_MIN 1.175494350822287507969e-38f
  276. #define CL_FLT_EPSILON 1.1920928955078125e-7f
  277. #define CL_HALF_DIG 3
  278. #define CL_HALF_MANT_DIG 11
  279. #define CL_HALF_MAX_10_EXP +4
  280. #define CL_HALF_MAX_EXP +16
  281. #define CL_HALF_MIN_10_EXP -4
  282. #define CL_HALF_MIN_EXP -13
  283. #define CL_HALF_RADIX 2
  284. #define CL_HALF_MAX 65504.0f
  285. #define CL_HALF_MIN 6.103515625e-05f
  286. #define CL_HALF_EPSILON 9.765625e-04f
  287. #define CL_DBL_DIG 15
  288. #define CL_DBL_MANT_DIG 53
  289. #define CL_DBL_MAX_10_EXP +308
  290. #define CL_DBL_MAX_EXP +1024
  291. #define CL_DBL_MIN_10_EXP -307
  292. #define CL_DBL_MIN_EXP -1021
  293. #define CL_DBL_RADIX 2
  294. #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
  295. #define CL_DBL_MIN 2.225073858507201383090e-308
  296. #define CL_DBL_EPSILON 2.220446049250313080847e-16
  297. #define CL_M_E 2.7182818284590452354
  298. #define CL_M_LOG2E 1.4426950408889634074
  299. #define CL_M_LOG10E 0.43429448190325182765
  300. #define CL_M_LN2 0.69314718055994530942
  301. #define CL_M_LN10 2.30258509299404568402
  302. #define CL_M_PI 3.14159265358979323846
  303. #define CL_M_PI_2 1.57079632679489661923
  304. #define CL_M_PI_4 0.78539816339744830962
  305. #define CL_M_1_PI 0.31830988618379067154
  306. #define CL_M_2_PI 0.63661977236758134308
  307. #define CL_M_2_SQRTPI 1.12837916709551257390
  308. #define CL_M_SQRT2 1.41421356237309504880
  309. #define CL_M_SQRT1_2 0.70710678118654752440
  310. #define CL_M_E_F 2.718281828f
  311. #define CL_M_LOG2E_F 1.442695041f
  312. #define CL_M_LOG10E_F 0.434294482f
  313. #define CL_M_LN2_F 0.693147181f
  314. #define CL_M_LN10_F 2.302585093f
  315. #define CL_M_PI_F 3.141592654f
  316. #define CL_M_PI_2_F 1.570796327f
  317. #define CL_M_PI_4_F 0.785398163f
  318. #define CL_M_1_PI_F 0.318309886f
  319. #define CL_M_2_PI_F 0.636619772f
  320. #define CL_M_2_SQRTPI_F 1.128379167f
  321. #define CL_M_SQRT2_F 1.414213562f
  322. #define CL_M_SQRT1_2_F 0.707106781f
  323. #if defined( __GNUC__ )
  324. #define CL_HUGE_VALF __builtin_huge_valf()
  325. #define CL_HUGE_VAL __builtin_huge_val()
  326. #define CL_NAN __builtin_nanf( "" )
  327. #else
  328. #define CL_HUGE_VALF ((cl_float) 1e50)
  329. #define CL_HUGE_VAL ((cl_double) 1e500)
  330. float nanf( const char * );
  331. #define CL_NAN nanf( "" )
  332. #endif
  333. #define CL_MAXFLOAT CL_FLT_MAX
  334. #define CL_INFINITY CL_HUGE_VALF
  335. #endif
  336. #include <stddef.h>
  337. /* Mirror types to GL types. Mirror types allow us to avoid deciding which 87s to load based on whether we are using GL or GLES here. */
  338. typedef unsigned int cl_GLuint;
  339. typedef int cl_GLint;
  340. typedef unsigned int cl_GLenum;
  341. /*
  342. * Vector types
  343. *
  344. * Note: OpenCL requires that all types be naturally aligned.
  345. * This means that vector types must be naturally aligned.
  346. * For example, a vector of four floats must be aligned to
  347. * a 16 byte boundary (calculated as 4 * the natural 4-byte
  348. * alignment of the float). The alignment qualifiers here
  349. * will only function properly if your compiler supports them
  350. * and if you don't actively work to defeat them. For example,
  351. * in order for a cl_float4 to be 16 byte aligned in a struct,
  352. * the start of the struct must itself be 16-byte aligned.
  353. *
  354. * Maintaining proper alignment is the user's responsibility.
  355. */
  356. /* Define basic vector types */
  357. #if defined( __VEC__ )
  358. #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
  359. typedef __vector unsigned char __cl_uchar16;
  360. typedef __vector signed char __cl_char16;
  361. typedef __vector unsigned short __cl_ushort8;
  362. typedef __vector signed short __cl_short8;
  363. typedef __vector unsigned int __cl_uint4;
  364. typedef __vector signed int __cl_int4;
  365. typedef __vector float __cl_float4;
  366. #define __CL_UCHAR16__ 1
  367. #define __CL_CHAR16__ 1
  368. #define __CL_USHORT8__ 1
  369. #define __CL_SHORT8__ 1
  370. #define __CL_UINT4__ 1
  371. #define __CL_INT4__ 1
  372. #define __CL_FLOAT4__ 1
  373. #endif
  374. #if defined( __SSE__ )
  375. #if defined( __MINGW64__ )
  376. #include <intrin.h>
  377. #else
  378. #include <xmmintrin.h>
  379. #endif
  380. #if defined( __GNUC__ )
  381. typedef float __cl_float4 __attribute__((vector_size(16)));
  382. #else
  383. typedef __m128 __cl_float4;
  384. #endif
  385. #define __CL_FLOAT4__ 1
  386. #endif
  387. #if defined( __SSE2__ )
  388. #if defined( __MINGW64__ )
  389. #include <intrin.h>
  390. #else
  391. #include <emmintrin.h>
  392. #endif
  393. #if defined( __GNUC__ )
  394. typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
  395. typedef cl_char __cl_char16 __attribute__((vector_size(16)));
  396. typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
  397. typedef cl_short __cl_short8 __attribute__((vector_size(16)));
  398. typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
  399. typedef cl_int __cl_int4 __attribute__((vector_size(16)));
  400. typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
  401. typedef cl_long __cl_long2 __attribute__((vector_size(16)));
  402. typedef cl_double __cl_double2 __attribute__((vector_size(16)));
  403. #else
  404. typedef __m128i __cl_uchar16;
  405. typedef __m128i __cl_char16;
  406. typedef __m128i __cl_ushort8;
  407. typedef __m128i __cl_short8;
  408. typedef __m128i __cl_uint4;
  409. typedef __m128i __cl_int4;
  410. typedef __m128i __cl_ulong2;
  411. typedef __m128i __cl_long2;
  412. typedef __m128d __cl_double2;
  413. #endif
  414. #define __CL_UCHAR16__ 1
  415. #define __CL_CHAR16__ 1
  416. #define __CL_USHORT8__ 1
  417. #define __CL_SHORT8__ 1
  418. #define __CL_INT4__ 1
  419. #define __CL_UINT4__ 1
  420. #define __CL_ULONG2__ 1
  421. #define __CL_LONG2__ 1
  422. #define __CL_DOUBLE2__ 1
  423. #endif
  424. #if defined( __MMX__ )
  425. #include <mmintrin.h>
  426. #if defined( __GNUC__ )
  427. typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
  428. typedef cl_char __cl_char8 __attribute__((vector_size(8)));
  429. typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
  430. typedef cl_short __cl_short4 __attribute__((vector_size(8)));
  431. typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
  432. typedef cl_int __cl_int2 __attribute__((vector_size(8)));
  433. typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
  434. typedef cl_long __cl_long1 __attribute__((vector_size(8)));
  435. typedef cl_float __cl_float2 __attribute__((vector_size(8)));
  436. #else
  437. typedef __m64 __cl_uchar8;
  438. typedef __m64 __cl_char8;
  439. typedef __m64 __cl_ushort4;
  440. typedef __m64 __cl_short4;
  441. typedef __m64 __cl_uint2;
  442. typedef __m64 __cl_int2;
  443. typedef __m64 __cl_ulong1;
  444. typedef __m64 __cl_long1;
  445. typedef __m64 __cl_float2;
  446. #endif
  447. #define __CL_UCHAR8__ 1
  448. #define __CL_CHAR8__ 1
  449. #define __CL_USHORT4__ 1
  450. #define __CL_SHORT4__ 1
  451. #define __CL_INT2__ 1
  452. #define __CL_UINT2__ 1
  453. #define __CL_ULONG1__ 1
  454. #define __CL_LONG1__ 1
  455. #define __CL_FLOAT2__ 1
  456. #endif
  457. #if defined( __AVX__ )
  458. #if defined( __MINGW64__ )
  459. #include <intrin.h>
  460. #else
  461. #include <immintrin.h>
  462. #endif
  463. #if defined( __GNUC__ )
  464. typedef cl_float __cl_float8 __attribute__((vector_size(32)));
  465. typedef cl_double __cl_double4 __attribute__((vector_size(32)));
  466. #else
  467. typedef __m256 __cl_float8;
  468. typedef __m256d __cl_double4;
  469. #endif
  470. #define __CL_FLOAT8__ 1
  471. #define __CL_DOUBLE4__ 1
  472. #endif
  473. /* Define capabilities for anonymous struct members. */
  474. #if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
  475. #define __CL_HAS_ANON_STRUCT__ 1
  476. #define __CL_ANON_STRUCT__
  477. #elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
  478. #define __CL_HAS_ANON_STRUCT__ 1
  479. #define __CL_ANON_STRUCT__ __extension__
  480. #elif defined( _WIN32) && defined(_MSC_VER)
  481. #if _MSC_VER >= 1500
  482. /* Microsoft Developer Studio 2008 supports anonymous structs, but
  483. * complains by default. */
  484. #define __CL_HAS_ANON_STRUCT__ 1
  485. #define __CL_ANON_STRUCT__
  486. /* Disable warning C4201: nonstandard extension used : nameless
  487. * struct/union */
  488. #pragma warning( push )
  489. #pragma warning( disable : 4201 )
  490. #endif
  491. #else
  492. #define __CL_HAS_ANON_STRUCT__ 0
  493. #define __CL_ANON_STRUCT__
  494. #endif
  495. /* Define alignment keys */
  496. #if defined( __GNUC__ )
  497. #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
  498. #elif defined( _WIN32) && (_MSC_VER)
  499. /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
  500. /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
  501. /* #include <crtdefs.h> */
  502. /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
  503. #define CL_ALIGNED(_x)
  504. #else
  505. #warning Need to implement some method to align data here
  506. #define CL_ALIGNED(_x)
  507. #endif
  508. /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
  509. #if __CL_HAS_ANON_STRUCT__
  510. /* .xyzw and .s0123...{f|F} are supported */
  511. #define CL_HAS_NAMED_VECTOR_FIELDS 1
  512. /* .hi and .lo are supported */
  513. #define CL_HAS_HI_LO_VECTOR_FIELDS 1
  514. #endif
  515. /* Define cl_vector types */
  516. /* ---- cl_charn ---- */
  517. typedef union
  518. {
  519. cl_char CL_ALIGNED(2) s[2];
  520. #if __CL_HAS_ANON_STRUCT__
  521. __CL_ANON_STRUCT__ struct{ cl_char x, y; };
  522. __CL_ANON_STRUCT__ struct{ cl_char s0, s1; };
  523. __CL_ANON_STRUCT__ struct{ cl_char lo, hi; };
  524. #endif
  525. #if defined( __CL_CHAR2__)
  526. __cl_char2 v2;
  527. #endif
  528. }cl_char2;
  529. typedef union
  530. {
  531. cl_char CL_ALIGNED(4) s[4];
  532. #if __CL_HAS_ANON_STRUCT__
  533. __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
  534. __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3; };
  535. __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; };
  536. #endif
  537. #if defined( __CL_CHAR2__)
  538. __cl_char2 v2[2];
  539. #endif
  540. #if defined( __CL_CHAR4__)
  541. __cl_char4 v4;
  542. #endif
  543. }cl_char4;
  544. /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
  545. typedef cl_char4 cl_char3;
  546. typedef union
  547. {
  548. cl_char CL_ALIGNED(8) s[8];
  549. #if __CL_HAS_ANON_STRUCT__
  550. __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
  551. __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
  552. __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; };
  553. #endif
  554. #if defined( __CL_CHAR2__)
  555. __cl_char2 v2[4];
  556. #endif
  557. #if defined( __CL_CHAR4__)
  558. __cl_char4 v4[2];
  559. #endif
  560. #if defined( __CL_CHAR8__ )
  561. __cl_char8 v8;
  562. #endif
  563. }cl_char8;
  564. typedef union
  565. {
  566. cl_char CL_ALIGNED(16) s[16];
  567. #if __CL_HAS_ANON_STRUCT__
  568. __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  569. __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  570. __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; };
  571. #endif
  572. #if defined( __CL_CHAR2__)
  573. __cl_char2 v2[8];
  574. #endif
  575. #if defined( __CL_CHAR4__)
  576. __cl_char4 v4[4];
  577. #endif
  578. #if defined( __CL_CHAR8__ )
  579. __cl_char8 v8[2];
  580. #endif
  581. #if defined( __CL_CHAR16__ )
  582. __cl_char16 v16;
  583. #endif
  584. }cl_char16;
  585. /* ---- cl_ucharn ---- */
  586. typedef union
  587. {
  588. cl_uchar CL_ALIGNED(2) s[2];
  589. #if __CL_HAS_ANON_STRUCT__
  590. __CL_ANON_STRUCT__ struct{ cl_uchar x, y; };
  591. __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1; };
  592. __CL_ANON_STRUCT__ struct{ cl_uchar lo, hi; };
  593. #endif
  594. #if defined( __cl_uchar2__)
  595. __cl_uchar2 v2;
  596. #endif
  597. }cl_uchar2;
  598. typedef union
  599. {
  600. cl_uchar CL_ALIGNED(4) s[4];
  601. #if __CL_HAS_ANON_STRUCT__
  602. __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
  603. __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3; };
  604. __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; };
  605. #endif
  606. #if defined( __CL_UCHAR2__)
  607. __cl_uchar2 v2[2];
  608. #endif
  609. #if defined( __CL_UCHAR4__)
  610. __cl_uchar4 v4;
  611. #endif
  612. }cl_uchar4;
  613. /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
  614. typedef cl_uchar4 cl_uchar3;
  615. typedef union
  616. {
  617. cl_uchar CL_ALIGNED(8) s[8];
  618. #if __CL_HAS_ANON_STRUCT__
  619. __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
  620. __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
  621. __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; };
  622. #endif
  623. #if defined( __CL_UCHAR2__)
  624. __cl_uchar2 v2[4];
  625. #endif
  626. #if defined( __CL_UCHAR4__)
  627. __cl_uchar4 v4[2];
  628. #endif
  629. #if defined( __CL_UCHAR8__ )
  630. __cl_uchar8 v8;
  631. #endif
  632. }cl_uchar8;
  633. typedef union
  634. {
  635. cl_uchar CL_ALIGNED(16) s[16];
  636. #if __CL_HAS_ANON_STRUCT__
  637. __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  638. __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  639. __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; };
  640. #endif
  641. #if defined( __CL_UCHAR2__)
  642. __cl_uchar2 v2[8];
  643. #endif
  644. #if defined( __CL_UCHAR4__)
  645. __cl_uchar4 v4[4];
  646. #endif
  647. #if defined( __CL_UCHAR8__ )
  648. __cl_uchar8 v8[2];
  649. #endif
  650. #if defined( __CL_UCHAR16__ )
  651. __cl_uchar16 v16;
  652. #endif
  653. }cl_uchar16;
  654. /* ---- cl_shortn ---- */
  655. typedef union
  656. {
  657. cl_short CL_ALIGNED(4) s[2];
  658. #if __CL_HAS_ANON_STRUCT__
  659. __CL_ANON_STRUCT__ struct{ cl_short x, y; };
  660. __CL_ANON_STRUCT__ struct{ cl_short s0, s1; };
  661. __CL_ANON_STRUCT__ struct{ cl_short lo, hi; };
  662. #endif
  663. #if defined( __CL_SHORT2__)
  664. __cl_short2 v2;
  665. #endif
  666. }cl_short2;
  667. typedef union
  668. {
  669. cl_short CL_ALIGNED(8) s[4];
  670. #if __CL_HAS_ANON_STRUCT__
  671. __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
  672. __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3; };
  673. __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; };
  674. #endif
  675. #if defined( __CL_SHORT2__)
  676. __cl_short2 v2[2];
  677. #endif
  678. #if defined( __CL_SHORT4__)
  679. __cl_short4 v4;
  680. #endif
  681. }cl_short4;
  682. /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
  683. typedef cl_short4 cl_short3;
  684. typedef union
  685. {
  686. cl_short CL_ALIGNED(16) s[8];
  687. #if __CL_HAS_ANON_STRUCT__
  688. __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
  689. __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
  690. __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; };
  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. {
  704. cl_short CL_ALIGNED(32) s[16];
  705. #if __CL_HAS_ANON_STRUCT__
  706. __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  707. __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  708. __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; };
  709. #endif
  710. #if defined( __CL_SHORT2__)
  711. __cl_short2 v2[8];
  712. #endif
  713. #if defined( __CL_SHORT4__)
  714. __cl_short4 v4[4];
  715. #endif
  716. #if defined( __CL_SHORT8__ )
  717. __cl_short8 v8[2];
  718. #endif
  719. #if defined( __CL_SHORT16__ )
  720. __cl_short16 v16;
  721. #endif
  722. }cl_short16;
  723. /* ---- cl_ushortn ---- */
  724. typedef union
  725. {
  726. cl_ushort CL_ALIGNED(4) s[2];
  727. #if __CL_HAS_ANON_STRUCT__
  728. __CL_ANON_STRUCT__ struct{ cl_ushort x, y; };
  729. __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1; };
  730. __CL_ANON_STRUCT__ struct{ cl_ushort lo, hi; };
  731. #endif
  732. #if defined( __CL_USHORT2__)
  733. __cl_ushort2 v2;
  734. #endif
  735. }cl_ushort2;
  736. typedef union
  737. {
  738. cl_ushort CL_ALIGNED(8) s[4];
  739. #if __CL_HAS_ANON_STRUCT__
  740. __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
  741. __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3; };
  742. __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; };
  743. #endif
  744. #if defined( __CL_USHORT2__)
  745. __cl_ushort2 v2[2];
  746. #endif
  747. #if defined( __CL_USHORT4__)
  748. __cl_ushort4 v4;
  749. #endif
  750. }cl_ushort4;
  751. /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
  752. typedef cl_ushort4 cl_ushort3;
  753. typedef union
  754. {
  755. cl_ushort CL_ALIGNED(16) s[8];
  756. #if __CL_HAS_ANON_STRUCT__
  757. __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
  758. __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
  759. __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; };
  760. #endif
  761. #if defined( __CL_USHORT2__)
  762. __cl_ushort2 v2[4];
  763. #endif
  764. #if defined( __CL_USHORT4__)
  765. __cl_ushort4 v4[2];
  766. #endif
  767. #if defined( __CL_USHORT8__ )
  768. __cl_ushort8 v8;
  769. #endif
  770. }cl_ushort8;
  771. typedef union
  772. {
  773. cl_ushort CL_ALIGNED(32) s[16];
  774. #if __CL_HAS_ANON_STRUCT__
  775. __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  776. __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  777. __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; };
  778. #endif
  779. #if defined( __CL_USHORT2__)
  780. __cl_ushort2 v2[8];
  781. #endif
  782. #if defined( __CL_USHORT4__)
  783. __cl_ushort4 v4[4];
  784. #endif
  785. #if defined( __CL_USHORT8__ )
  786. __cl_ushort8 v8[2];
  787. #endif
  788. #if defined( __CL_USHORT16__ )
  789. __cl_ushort16 v16;
  790. #endif
  791. }cl_ushort16;
  792. /* ---- cl_halfn ---- */
  793. typedef union
  794. {
  795. cl_half CL_ALIGNED(4) s[2];
  796. #if __CL_HAS_ANON_STRUCT__
  797. __CL_ANON_STRUCT__ struct{ cl_half x, y; };
  798. __CL_ANON_STRUCT__ struct{ cl_half s0, s1; };
  799. __CL_ANON_STRUCT__ struct{ cl_half lo, hi; };
  800. #endif
  801. #if defined( __CL_HALF2__)
  802. __cl_half2 v2;
  803. #endif
  804. }cl_half2;
  805. typedef union
  806. {
  807. cl_half CL_ALIGNED(8) s[4];
  808. #if __CL_HAS_ANON_STRUCT__
  809. __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
  810. __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3; };
  811. __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; };
  812. #endif
  813. #if defined( __CL_HALF2__)
  814. __cl_half2 v2[2];
  815. #endif
  816. #if defined( __CL_HALF4__)
  817. __cl_half4 v4;
  818. #endif
  819. }cl_half4;
  820. /* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */
  821. typedef cl_half4 cl_half3;
  822. typedef union
  823. {
  824. cl_half CL_ALIGNED(16) s[8];
  825. #if __CL_HAS_ANON_STRUCT__
  826. __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
  827. __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7; };
  828. __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; };
  829. #endif
  830. #if defined( __CL_HALF2__)
  831. __cl_half2 v2[4];
  832. #endif
  833. #if defined( __CL_HALF4__)
  834. __cl_half4 v4[2];
  835. #endif
  836. #if defined( __CL_HALF8__ )
  837. __cl_half8 v8;
  838. #endif
  839. }cl_half8;
  840. typedef union
  841. {
  842. cl_half CL_ALIGNED(32) s[16];
  843. #if __CL_HAS_ANON_STRUCT__
  844. __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  845. __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  846. __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; };
  847. #endif
  848. #if defined( __CL_HALF2__)
  849. __cl_half2 v2[8];
  850. #endif
  851. #if defined( __CL_HALF4__)
  852. __cl_half4 v4[4];
  853. #endif
  854. #if defined( __CL_HALF8__ )
  855. __cl_half8 v8[2];
  856. #endif
  857. #if defined( __CL_HALF16__ )
  858. __cl_half16 v16;
  859. #endif
  860. }cl_half16;
  861. /* ---- cl_intn ---- */
  862. typedef union
  863. {
  864. cl_int CL_ALIGNED(8) s[2];
  865. #if __CL_HAS_ANON_STRUCT__
  866. __CL_ANON_STRUCT__ struct{ cl_int x, y; };
  867. __CL_ANON_STRUCT__ struct{ cl_int s0, s1; };
  868. __CL_ANON_STRUCT__ struct{ cl_int lo, hi; };
  869. #endif
  870. #if defined( __CL_INT2__)
  871. __cl_int2 v2;
  872. #endif
  873. }cl_int2;
  874. typedef union
  875. {
  876. cl_int CL_ALIGNED(16) s[4];
  877. #if __CL_HAS_ANON_STRUCT__
  878. __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
  879. __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3; };
  880. __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; };
  881. #endif
  882. #if defined( __CL_INT2__)
  883. __cl_int2 v2[2];
  884. #endif
  885. #if defined( __CL_INT4__)
  886. __cl_int4 v4;
  887. #endif
  888. }cl_int4;
  889. /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
  890. typedef cl_int4 cl_int3;
  891. typedef union
  892. {
  893. cl_int CL_ALIGNED(32) s[8];
  894. #if __CL_HAS_ANON_STRUCT__
  895. __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
  896. __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
  897. __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; };
  898. #endif
  899. #if defined( __CL_INT2__)
  900. __cl_int2 v2[4];
  901. #endif
  902. #if defined( __CL_INT4__)
  903. __cl_int4 v4[2];
  904. #endif
  905. #if defined( __CL_INT8__ )
  906. __cl_int8 v8;
  907. #endif
  908. }cl_int8;
  909. typedef union
  910. {
  911. cl_int CL_ALIGNED(64) s[16];
  912. #if __CL_HAS_ANON_STRUCT__
  913. __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  914. __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  915. __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; };
  916. #endif
  917. #if defined( __CL_INT2__)
  918. __cl_int2 v2[8];
  919. #endif
  920. #if defined( __CL_INT4__)
  921. __cl_int4 v4[4];
  922. #endif
  923. #if defined( __CL_INT8__ )
  924. __cl_int8 v8[2];
  925. #endif
  926. #if defined( __CL_INT16__ )
  927. __cl_int16 v16;
  928. #endif
  929. }cl_int16;
  930. /* ---- cl_uintn ---- */
  931. typedef union
  932. {
  933. cl_uint CL_ALIGNED(8) s[2];
  934. #if __CL_HAS_ANON_STRUCT__
  935. __CL_ANON_STRUCT__ struct{ cl_uint x, y; };
  936. __CL_ANON_STRUCT__ struct{ cl_uint s0, s1; };
  937. __CL_ANON_STRUCT__ struct{ cl_uint lo, hi; };
  938. #endif
  939. #if defined( __CL_UINT2__)
  940. __cl_uint2 v2;
  941. #endif
  942. }cl_uint2;
  943. typedef union
  944. {
  945. cl_uint CL_ALIGNED(16) s[4];
  946. #if __CL_HAS_ANON_STRUCT__
  947. __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
  948. __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3; };
  949. __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; };
  950. #endif
  951. #if defined( __CL_UINT2__)
  952. __cl_uint2 v2[2];
  953. #endif
  954. #if defined( __CL_UINT4__)
  955. __cl_uint4 v4;
  956. #endif
  957. }cl_uint4;
  958. /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
  959. typedef cl_uint4 cl_uint3;
  960. typedef union
  961. {
  962. cl_uint CL_ALIGNED(32) s[8];
  963. #if __CL_HAS_ANON_STRUCT__
  964. __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
  965. __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
  966. __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; };
  967. #endif
  968. #if defined( __CL_UINT2__)
  969. __cl_uint2 v2[4];
  970. #endif
  971. #if defined( __CL_UINT4__)
  972. __cl_uint4 v4[2];
  973. #endif
  974. #if defined( __CL_UINT8__ )
  975. __cl_uint8 v8;
  976. #endif
  977. }cl_uint8;
  978. typedef union
  979. {
  980. cl_uint CL_ALIGNED(64) s[16];
  981. #if __CL_HAS_ANON_STRUCT__
  982. __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  983. __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  984. __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; };
  985. #endif
  986. #if defined( __CL_UINT2__)
  987. __cl_uint2 v2[8];
  988. #endif
  989. #if defined( __CL_UINT4__)
  990. __cl_uint4 v4[4];
  991. #endif
  992. #if defined( __CL_UINT8__ )
  993. __cl_uint8 v8[2];
  994. #endif
  995. #if defined( __CL_UINT16__ )
  996. __cl_uint16 v16;
  997. #endif
  998. }cl_uint16;
  999. /* ---- cl_longn ---- */
  1000. typedef union
  1001. {
  1002. cl_long CL_ALIGNED(16) s[2];
  1003. #if __CL_HAS_ANON_STRUCT__
  1004. __CL_ANON_STRUCT__ struct{ cl_long x, y; };
  1005. __CL_ANON_STRUCT__ struct{ cl_long s0, s1; };
  1006. __CL_ANON_STRUCT__ struct{ cl_long lo, hi; };
  1007. #endif
  1008. #if defined( __CL_LONG2__)
  1009. __cl_long2 v2;
  1010. #endif
  1011. }cl_long2;
  1012. typedef union
  1013. {
  1014. cl_long CL_ALIGNED(32) s[4];
  1015. #if __CL_HAS_ANON_STRUCT__
  1016. __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
  1017. __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3; };
  1018. __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; };
  1019. #endif
  1020. #if defined( __CL_LONG2__)
  1021. __cl_long2 v2[2];
  1022. #endif
  1023. #if defined( __CL_LONG4__)
  1024. __cl_long4 v4;
  1025. #endif
  1026. }cl_long4;
  1027. /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
  1028. typedef cl_long4 cl_long3;
  1029. typedef union
  1030. {
  1031. cl_long CL_ALIGNED(64) s[8];
  1032. #if __CL_HAS_ANON_STRUCT__
  1033. __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
  1034. __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
  1035. __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; };
  1036. #endif
  1037. #if defined( __CL_LONG2__)
  1038. __cl_long2 v2[4];
  1039. #endif
  1040. #if defined( __CL_LONG4__)
  1041. __cl_long4 v4[2];
  1042. #endif
  1043. #if defined( __CL_LONG8__ )
  1044. __cl_long8 v8;
  1045. #endif
  1046. }cl_long8;
  1047. typedef union
  1048. {
  1049. cl_long CL_ALIGNED(128) s[16];
  1050. #if __CL_HAS_ANON_STRUCT__
  1051. __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1052. __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1053. __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; };
  1054. #endif
  1055. #if defined( __CL_LONG2__)
  1056. __cl_long2 v2[8];
  1057. #endif
  1058. #if defined( __CL_LONG4__)
  1059. __cl_long4 v4[4];
  1060. #endif
  1061. #if defined( __CL_LONG8__ )
  1062. __cl_long8 v8[2];
  1063. #endif
  1064. #if defined( __CL_LONG16__ )
  1065. __cl_long16 v16;
  1066. #endif
  1067. }cl_long16;
  1068. /* ---- cl_ulongn ---- */
  1069. typedef union
  1070. {
  1071. cl_ulong CL_ALIGNED(16) s[2];
  1072. #if __CL_HAS_ANON_STRUCT__
  1073. __CL_ANON_STRUCT__ struct{ cl_ulong x, y; };
  1074. __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1; };
  1075. __CL_ANON_STRUCT__ struct{ cl_ulong lo, hi; };
  1076. #endif
  1077. #if defined( __CL_ULONG2__)
  1078. __cl_ulong2 v2;
  1079. #endif
  1080. }cl_ulong2;
  1081. typedef union
  1082. {
  1083. cl_ulong CL_ALIGNED(32) s[4];
  1084. #if __CL_HAS_ANON_STRUCT__
  1085. __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
  1086. __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3; };
  1087. __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; };
  1088. #endif
  1089. #if defined( __CL_ULONG2__)
  1090. __cl_ulong2 v2[2];
  1091. #endif
  1092. #if defined( __CL_ULONG4__)
  1093. __cl_ulong4 v4;
  1094. #endif
  1095. }cl_ulong4;
  1096. /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
  1097. typedef cl_ulong4 cl_ulong3;
  1098. typedef union
  1099. {
  1100. cl_ulong CL_ALIGNED(64) s[8];
  1101. #if __CL_HAS_ANON_STRUCT__
  1102. __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
  1103. __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
  1104. __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; };
  1105. #endif
  1106. #if defined( __CL_ULONG2__)
  1107. __cl_ulong2 v2[4];
  1108. #endif
  1109. #if defined( __CL_ULONG4__)
  1110. __cl_ulong4 v4[2];
  1111. #endif
  1112. #if defined( __CL_ULONG8__ )
  1113. __cl_ulong8 v8;
  1114. #endif
  1115. }cl_ulong8;
  1116. typedef union
  1117. {
  1118. cl_ulong CL_ALIGNED(128) s[16];
  1119. #if __CL_HAS_ANON_STRUCT__
  1120. __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1121. __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1122. __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; };
  1123. #endif
  1124. #if defined( __CL_ULONG2__)
  1125. __cl_ulong2 v2[8];
  1126. #endif
  1127. #if defined( __CL_ULONG4__)
  1128. __cl_ulong4 v4[4];
  1129. #endif
  1130. #if defined( __CL_ULONG8__ )
  1131. __cl_ulong8 v8[2];
  1132. #endif
  1133. #if defined( __CL_ULONG16__ )
  1134. __cl_ulong16 v16;
  1135. #endif
  1136. }cl_ulong16;
  1137. /* --- cl_floatn ---- */
  1138. typedef union
  1139. {
  1140. cl_float CL_ALIGNED(8) s[2];
  1141. #if __CL_HAS_ANON_STRUCT__
  1142. __CL_ANON_STRUCT__ struct{ cl_float x, y; };
  1143. __CL_ANON_STRUCT__ struct{ cl_float s0, s1; };
  1144. __CL_ANON_STRUCT__ struct{ cl_float lo, hi; };
  1145. #endif
  1146. #if defined( __CL_FLOAT2__)
  1147. __cl_float2 v2;
  1148. #endif
  1149. }cl_float2;
  1150. typedef union
  1151. {
  1152. cl_float CL_ALIGNED(16) s[4];
  1153. #if __CL_HAS_ANON_STRUCT__
  1154. __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
  1155. __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3; };
  1156. __CL_ANON_STRUCT__ struct{ cl_float2 lo, hi; };
  1157. #endif
  1158. #if defined( __CL_FLOAT2__)
  1159. __cl_float2 v2[2];
  1160. #endif
  1161. #if defined( __CL_FLOAT4__)
  1162. __cl_float4 v4;
  1163. #endif
  1164. }cl_float4;
  1165. /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
  1166. typedef cl_float4 cl_float3;
  1167. typedef union
  1168. {
  1169. cl_float CL_ALIGNED(32) s[8];
  1170. #if __CL_HAS_ANON_STRUCT__
  1171. __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
  1172. __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
  1173. __CL_ANON_STRUCT__ struct{ cl_float4 lo, hi; };
  1174. #endif
  1175. #if defined( __CL_FLOAT2__)
  1176. __cl_float2 v2[4];
  1177. #endif
  1178. #if defined( __CL_FLOAT4__)
  1179. __cl_float4 v4[2];
  1180. #endif
  1181. #if defined( __CL_FLOAT8__ )
  1182. __cl_float8 v8;
  1183. #endif
  1184. }cl_float8;
  1185. typedef union
  1186. {
  1187. cl_float CL_ALIGNED(64) s[16];
  1188. #if __CL_HAS_ANON_STRUCT__
  1189. __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1190. __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1191. __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; };
  1192. #endif
  1193. #if defined( __CL_FLOAT2__)
  1194. __cl_float2 v2[8];
  1195. #endif
  1196. #if defined( __CL_FLOAT4__)
  1197. __cl_float4 v4[4];
  1198. #endif
  1199. #if defined( __CL_FLOAT8__ )
  1200. __cl_float8 v8[2];
  1201. #endif
  1202. #if defined( __CL_FLOAT16__ )
  1203. __cl_float16 v16;
  1204. #endif
  1205. }cl_float16;
  1206. /* --- cl_doublen ---- */
  1207. typedef union
  1208. {
  1209. cl_double CL_ALIGNED(16) s[2];
  1210. #if __CL_HAS_ANON_STRUCT__
  1211. __CL_ANON_STRUCT__ struct{ cl_double x, y; };
  1212. __CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
  1213. __CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
  1214. #endif
  1215. #if defined( __CL_DOUBLE2__)
  1216. __cl_double2 v2;
  1217. #endif
  1218. }cl_double2;
  1219. typedef union
  1220. {
  1221. cl_double CL_ALIGNED(32) s[4];
  1222. #if __CL_HAS_ANON_STRUCT__
  1223. __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
  1224. __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3; };
  1225. __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; };
  1226. #endif
  1227. #if defined( __CL_DOUBLE2__)
  1228. __cl_double2 v2[2];
  1229. #endif
  1230. #if defined( __CL_DOUBLE4__)
  1231. __cl_double4 v4;
  1232. #endif
  1233. }cl_double4;
  1234. /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
  1235. typedef cl_double4 cl_double3;
  1236. typedef union
  1237. {
  1238. cl_double CL_ALIGNED(64) s[8];
  1239. #if __CL_HAS_ANON_STRUCT__
  1240. __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
  1241. __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
  1242. __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; };
  1243. #endif
  1244. #if defined( __CL_DOUBLE2__)
  1245. __cl_double2 v2[4];
  1246. #endif
  1247. #if defined( __CL_DOUBLE4__)
  1248. __cl_double4 v4[2];
  1249. #endif
  1250. #if defined( __CL_DOUBLE8__ )
  1251. __cl_double8 v8;
  1252. #endif
  1253. }cl_double8;
  1254. typedef union
  1255. {
  1256. cl_double CL_ALIGNED(128) s[16];
  1257. #if __CL_HAS_ANON_STRUCT__
  1258. __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
  1259. __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
  1260. __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; };
  1261. #endif
  1262. #if defined( __CL_DOUBLE2__)
  1263. __cl_double2 v2[8];
  1264. #endif
  1265. #if defined( __CL_DOUBLE4__)
  1266. __cl_double4 v4[4];
  1267. #endif
  1268. #if defined( __CL_DOUBLE8__ )
  1269. __cl_double8 v8[2];
  1270. #endif
  1271. #if defined( __CL_DOUBLE16__ )
  1272. __cl_double16 v16;
  1273. #endif
  1274. }cl_double16;
  1275. /* Macro to facilitate debugging
  1276. * Usage:
  1277. * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
  1278. * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \"
  1279. * Each line thereafter of OpenCL C source must end with: \n\
  1280. * The last line ends in ";
  1281. *
  1282. * Example:
  1283. *
  1284. * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
  1285. * kernel void foo( int a, float * b ) \n\
  1286. * { \n\
  1287. * // my comment \n\
  1288. * *b[ get_global_id(0)] = a; \n\
  1289. * } \n\
  1290. * ";
  1291. *
  1292. * This should correctly set up the line, (column) and file information for your source
  1293. * string so you can do source level debugging.
  1294. */
  1295. #define __CL_STRINGIFY( _x ) # _x
  1296. #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
  1297. #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
  1298. #ifdef __cplusplus
  1299. }
  1300. #endif
  1301. #undef __CL_HAS_ANON_STRUCT__
  1302. #undef __CL_ANON_STRUCT__
  1303. #if defined( _WIN32) && defined(_MSC_VER)
  1304. #if _MSC_VER >=1500
  1305. #pragma warning( pop )
  1306. #endif
  1307. #endif
  1308. #endif /* __CL_PLATFORM_H */