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