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