CL_Platform.pas 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. (*******************************************************************************
  2. * Copyright (c) 2008-2010 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. * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  22. ******************************************************************************)
  23. (********************************************)
  24. (* *)
  25. (* OpenCL1.2 and Delphi and Windows *)
  26. (* *)
  27. (* created by : Maksym Tymkovych *)
  28. (* (niello) *)
  29. (* *)
  30. (* headers versions: 0.07 *)
  31. (* file name : CL_Platform.pas *)
  32. (* last modify : 10.12.11 *)
  33. (* license : BSD *)
  34. (* *)
  35. (* Site : www.niello.org.ua *)
  36. (* e-mail : [email protected] *)
  37. (* ICQ : 446-769-253 *)
  38. (* *)
  39. (*********Copyright (c) niello 2008-2011*****)
  40. //Fixed By Dmitry Belkevich
  41. //Site www.makhaon.com
  42. //E-mail [email protected]
  43. //(c) 2009
  44. //Beta release 1.0
  45. unit CL_Platform;
  46. interface
  47. (*
  48. Delphi 6 and down don't support UInt64;
  49. *)
  50. {$INCLUDE 'OpenCL.inc'}
  51. type
  52. PCL_char = ^TCL_char;
  53. TCL_char = Shortint;//-127..+128;
  54. PCL_uchar = ^TCL_uchar;
  55. TCL_uchar = Byte;//0..255;
  56. PCL_short = ^TCL_short;
  57. TCL_short = Smallint;//- 32767..+32768;
  58. PCL_ushort = ^TCL_ushort;
  59. TCL_ushort = Word;//0..+65535;
  60. PCL_int = ^TCL_int;
  61. TCL_int = Longint;//-2147483647..+2147483648;
  62. PCL_uint = ^TCL_uint;
  63. TCL_uint = Longword;//0..4294967295;
  64. PCL_long = ^TCL_long;
  65. TCL_long = Int64;
  66. PCL_ulong = ^TCL_ulong;
  67. //The error is found by Andrew Terekhov
  68. TCL_ulong = {$IFDEF DEFINE_UINT64_EQU_INT64} Int64;{$ELSE} UInt64;{$ENDIF}
  69. PCL_half = ^TCL_half;
  70. TCL_half = TCL_ushort;
  71. PCL_float = ^TCL_float;
  72. TCL_float = Single;
  73. PCL_double = ^TCL_double;
  74. TCL_double = Double;
  75. PCL_half2 = ^TCL_half2;
  76. TCL_half2 = record
  77. i16 : Array [0..1]of TCL_half;
  78. end;
  79. PCL_half4 = ^TCL_half4;
  80. TCL_half4 = record
  81. i16 : Array [0..3]of TCL_half;
  82. end;
  83. PCL_half8 = ^TCL_half8;
  84. TCL_half8 = record
  85. i16 : Array [0..7]of TCL_half;
  86. end;
  87. PCL_half16 = ^TCL_half16;
  88. TCL_half16 = record
  89. i16 : Array [0..15]of TCL_half;
  90. end;
  91. PCL_char2 = ^TCL_char2;
  92. TCL_char2 = record
  93. i8 : Array [0..1]of TCL_char;
  94. end;
  95. PCL_char4 = ^TCL_char4;
  96. TCL_char4 = record
  97. i8 : Array [0..3]of TCL_char;
  98. end;
  99. PCL_char8 = ^TCL_char8;
  100. TCL_char8 = record
  101. i8 : Array [0..7]of TCL_char;
  102. end;
  103. PCL_char16 = ^TCL_char16;
  104. TCL_char16 = record
  105. i8 : Array [0..15]of TCL_char;
  106. end;
  107. PCL_uchar2 = ^TCL_uchar2;
  108. TCL_uchar2 = record
  109. u8 : Array [0..1]of TCL_uchar;
  110. end;
  111. PCL_uchar4 = ^TCL_uchar4;
  112. TCL_uchar4 = record
  113. u8 : Array [0..3]of TCL_uchar;
  114. end;
  115. PCL_uchar8 = ^TCL_uchar8;
  116. TCL_uchar8 = record
  117. u8 : Array [0..7]of TCL_uchar;
  118. end;
  119. PCL_uchar16 = ^TCL_uchar16;
  120. TCL_uchar16 = record
  121. u8 : Array [0..15]of TCL_uchar;
  122. end;
  123. PCL_short2 = ^TCL_short2;
  124. TCL_short2 = record
  125. i16 : Array [0..1]of TCL_short;
  126. end;
  127. PCL_short4 = ^TCL_short4;
  128. TCL_short4 = record
  129. i16 : Array [0..3]of TCL_short;
  130. end;
  131. PCL_short8 = ^TCL_short8;
  132. TCL_short8 = record
  133. i16 : Array [0..7]of TCL_short;
  134. end;
  135. PCL_short16 = ^TCL_short16;
  136. TCL_short16 = record
  137. i16 : Array [0..15]of TCL_short;
  138. end;
  139. PCL_ushort2 = ^TCL_ushort2;
  140. TCL_ushort2 = record
  141. u16 : Array [0..1]of TCL_ushort;
  142. end;
  143. PCL_ushort4 = ^TCL_ushort4;
  144. TCL_ushort4 = record
  145. u16 : Array [0..3]of TCL_ushort;
  146. end;
  147. PCL_ushort8 = ^TCL_ushort8;
  148. TCL_ushort8 = record
  149. u16 : Array [0..7]of TCL_ushort;
  150. end;
  151. PCL_ushort16 = ^TCL_ushort16;
  152. TCL_ushort16 = record
  153. u16 : Array [0..15]of TCL_ushort;
  154. end;
  155. PCL_int2 = ^TCL_int2;
  156. TCL_int2 = record
  157. i32 : Array [0..1]of TCL_int;
  158. end;
  159. PCL_int4 = ^TCL_int4;
  160. TCL_int4 = record
  161. i32 : Array [0..3]of TCL_int;
  162. end;
  163. PCL_int8 = ^TCL_int8;
  164. TCL_int8 = record
  165. i32 : Array [0..7]of TCL_int;
  166. end;
  167. PCL_int16 = ^TCL_int16;
  168. TCL_int16 = record
  169. i32 : Array [0..15]of TCL_int;
  170. end;
  171. PCL_uint2 = ^TCL_uint2;
  172. TCL_uint2 = record
  173. u32 : Array [0..1]of TCL_uint;
  174. end;
  175. PCL_uint4 = ^TCL_uint4;
  176. TCL_uint4 = record
  177. u32 : Array [0..3]of TCL_uint;
  178. end;
  179. PCL_uint8 = ^TCL_uint8;
  180. TCL_uint8 = record
  181. u32 : Array [0..7]of TCL_uint;
  182. end;
  183. PCL_uint16 = ^TCL_uint16;
  184. TCL_uint16 = record
  185. u32 : Array [0..15]of TCL_uint;
  186. end;
  187. PCL_long2 = ^TCL_long2;
  188. TCL_long2 = record
  189. i64 : Array [0..1]of TCL_long;
  190. end;
  191. PCL_long4 = ^TCL_long4;
  192. TCL_long4 = record
  193. i64 : Array [0..3]of TCL_long;
  194. end;
  195. PCL_long8 = ^TCL_long8;
  196. TCL_long8 = record
  197. i64 : Array [0..7]of TCL_long;
  198. end;
  199. PCL_long16 = ^TCL_long16;
  200. TCL_long16 = record
  201. i64 : Array [0..15]of TCL_long;
  202. end;
  203. PCL_ulong2 = ^TCL_ulong2;
  204. TCL_ulong2 = record
  205. u64 : Array [0..1]of TCL_ulong;
  206. end;
  207. PCL_ulong4 = ^TCL_ulong4;
  208. TCL_ulong4 = record
  209. u64 : Array [0..3]of TCL_ulong;
  210. end;
  211. PCL_ulong8 = ^TCL_ulong8;
  212. TCL_ulong8 = record
  213. u64 : Array [0..7]of TCL_ulong;
  214. end;
  215. PCL_ulong16 = ^TCL_ulong16;
  216. TCL_ulong16 = record
  217. u64 : Array [0..15]of TCL_ulong;
  218. end;
  219. PCL_float2 = ^TCL_float2;
  220. TCL_float2 = record
  221. f32 : Array [0..1]of TCL_float;
  222. end;
  223. PCL_float4 = ^TCL_float4;
  224. TCL_float4 = record
  225. f32 : Array [0..3]of TCL_float;
  226. end;
  227. PCL_float8 = ^TCL_float8;
  228. TCL_float8 = record
  229. f32 : Array [0..7]of TCL_float;
  230. end;
  231. PCL_float16 = ^TCL_float16;
  232. TCL_float16 = record
  233. f32 : Array [0..15]of TCL_float;
  234. end;
  235. PCL_double2 = ^TCL_double2;
  236. TCL_double2 = record
  237. f64 : Array [0..1]of TCL_double;
  238. end;
  239. PCL_double4 = ^TCL_double4;
  240. TCL_double4 = record
  241. f64 : Array [0..3]of TCL_double;
  242. end;
  243. PCL_double8 = ^TCL_double8;
  244. TCL_double8 = record
  245. f64 : Array [0..7]of TCL_double;
  246. end;
  247. PCL_double16 = ^TCL_double16;
  248. TCL_double16 = record
  249. f64 : Array [0..15]of TCL_double;
  250. end;
  251. const
  252. CL_CHAR_BIT = 8;
  253. CL_SCHAR_MAX = 127;
  254. CL_SCHAR_MIN = (-127-1);
  255. CL_CHAR_MAX = CL_SCHAR_MAX;
  256. CL_CHAR_MIN = CL_SCHAR_MIN;
  257. CL_UCHAR_MAX = 255;
  258. CL_SHRT_MAX = 32767;
  259. CL_SHRT_MIN = (-32767-1);
  260. CL_USHRT_MAX = 65535;
  261. CL_INT_MAX = 2147483647;
  262. CL_INT_MIN = (-2147483647-1);
  263. CL_UINT_MAX = $ffffffff;
  264. CL_LONG_MAX = TCL_long ($7FFFFFFFFFFFFFFF);
  265. CL_LONG_MIN = TCL_long (-$7FFFFFFFFFFFFFFF) - 1;
  266. CL_ULONG_MAX = TCL_ulong($FFFFFFFFFFFFFFFF);
  267. CL_FLT_DIG = 6;
  268. CL_FLT_MANT_DIG = 24;
  269. CL_FLT_MAX_10_EXP = +38;
  270. CL_FLT_MAX_EXP = +128;
  271. CL_FLT_MIN_10_EXP = -37;
  272. CL_FLT_MIN_EXP = -125;
  273. CL_FLT_RADIX = 2;
  274. CL_FLT_MAX = 340282346638528859811704183484516925440.0;
  275. CL_FLT_MIN = 1.175494350822287507969e-38;
  276. //CL_FLT_EPSILON = 0x1.0p-23f;
  277. CL_DBL_DIG = 15;
  278. CL_DBL_MANT_DIG = 53;
  279. CL_DBL_MAX_10_EXP = +308;
  280. CL_DBL_MAX_EXP = +1024;
  281. CL_DBL_MIN_10_EXP = -307;
  282. CL_DBL_MIN_EXP = -1021;
  283. CL_DBL_RADIX = 2;
  284. CL_DBL_MAX = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0;
  285. CL_DBL_MIN = 2.225073858507201383090e-308;
  286. CL_DBL_EPSILON = 2.220446049250313080847e-16;
  287. CL_M_E = 2.718281828459045090796;
  288. CL_M_LOG2E = 1.442695040888963387005;
  289. CL_M_LOG10E = 0.434294481903251816668;
  290. CL_M_LN2 = 0.693147180559945286227;
  291. CL_M_LN10 = 2.302585092994045901094;
  292. CL_M_PI = 3.141592653589793115998;
  293. CL_M_PI_2 = 1.570796326794896557999;
  294. CL_M_PI_4 = 0.785398163397448278999;
  295. CL_M_1_PI = 0.318309886183790691216;
  296. CL_M_2_PI = 0.636619772367581382433;
  297. CL_M_2_SQRTPI = 1.128379167095512558561;
  298. CL_M_SQRT2 = 1.414213562373095145475;
  299. CL_M_SQRT1_2 = 0.707106781186547572737;
  300. CL_M_E_F = 2.71828174591064;
  301. CL_M_LOG2E_F = 1.44269502162933;
  302. CL_M_LOG10E_F = 0.43429449200630;
  303. CL_M_LN2_F = 0.69314718246460;
  304. CL_M_LN10_F = 2.30258512496948;
  305. CL_M_PI_F = 3.14159274101257;
  306. CL_M_PI_2_F = 1.57079637050629;
  307. CL_M_PI_4_F = 0.78539818525314;
  308. CL_M_1_PI_F = 0.31830987334251;
  309. CL_M_2_PI_F = 0.63661974668503;
  310. CL_M_2_SQRTPI_F = 1.12837922573090;
  311. CL_M_SQRT2_F = 1.41421353816986;
  312. CL_M_SQRT1_2_F = 0.70710676908493;
  313. CL_HUGE_VALF : TCL_float = 1e50;
  314. CL_HUGE_VAL : TCL_double = 1e500;
  315. CL_MAXFLOAT = CL_FLT_MAX;
  316. CL_INFINITY : TCL_float = 1e50; //CL_HUGE_VALF
  317. CL_NAN = 0/0;//(CL_INFINITY - CL_INFINITY);
  318. implementation
  319. end.