1 | /******************************************************************************* |
2 | * Copyright (c) 2018 The Khronos Group Inc. |
3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and/or associated documentation files (the |
6 | * "Materials"), to deal in the Materials without restriction, including |
7 | * without limitation the rights to use, copy, modify, merge, publish, |
8 | * distribute, sublicense, and/or sell copies of the Materials, and to |
9 | * permit persons to whom the Materials are furnished to do so, subject to |
10 | * the following conditions: |
11 | * |
12 | * The above copyright notice and this permission notice shall be included |
13 | * in all copies or substantial portions of the Materials. |
14 | * |
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS |
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS |
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT |
18 | * https://www.khronos.org/registry/ |
19 | * |
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
27 | ******************************************************************************/ |
28 | |
29 | #ifndef __CL_VERSION_H |
30 | #define __CL_VERSION_H |
31 | |
32 | /* Detect which version to target */ |
33 | #if !defined(CL_TARGET_OPENCL_VERSION) |
34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)") |
35 | #define CL_TARGET_OPENCL_VERSION 220 |
36 | #endif |
37 | #if CL_TARGET_OPENCL_VERSION != 100 && \ |
38 | CL_TARGET_OPENCL_VERSION != 110 && \ |
39 | CL_TARGET_OPENCL_VERSION != 120 && \ |
40 | CL_TARGET_OPENCL_VERSION != 200 && \ |
41 | CL_TARGET_OPENCL_VERSION != 210 && \ |
42 | CL_TARGET_OPENCL_VERSION != 220 |
43 | #pragma message("cl_version: CL_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220). Defaulting to 220 (OpenCL 2.2)") |
44 | #undef CL_TARGET_OPENCL_VERSION |
45 | #define CL_TARGET_OPENCL_VERSION 220 |
46 | #endif |
47 | |
48 | |
49 | /* OpenCL Version */ |
50 | #if CL_TARGET_OPENCL_VERSION >= 220 && !defined(CL_VERSION_2_2) |
51 | #define CL_VERSION_2_2 1 |
52 | #endif |
53 | #if CL_TARGET_OPENCL_VERSION >= 210 && !defined(CL_VERSION_2_1) |
54 | #define CL_VERSION_2_1 1 |
55 | #endif |
56 | #if CL_TARGET_OPENCL_VERSION >= 200 && !defined(CL_VERSION_2_0) |
57 | #define CL_VERSION_2_0 1 |
58 | #endif |
59 | #if CL_TARGET_OPENCL_VERSION >= 120 && !defined(CL_VERSION_1_2) |
60 | #define CL_VERSION_1_2 1 |
61 | #endif |
62 | #if CL_TARGET_OPENCL_VERSION >= 110 && !defined(CL_VERSION_1_1) |
63 | #define CL_VERSION_1_1 1 |
64 | #endif |
65 | #if CL_TARGET_OPENCL_VERSION >= 100 && !defined(CL_VERSION_1_0) |
66 | #define CL_VERSION_1_0 1 |
67 | #endif |
68 | |
69 | /* Allow deprecated APIs for older OpenCL versions. */ |
70 | #if CL_TARGET_OPENCL_VERSION <= 210 && !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) |
71 | #define CL_USE_DEPRECATED_OPENCL_2_1_APIS |
72 | #endif |
73 | #if CL_TARGET_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) |
74 | #define CL_USE_DEPRECATED_OPENCL_2_0_APIS |
75 | #endif |
76 | #if CL_TARGET_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) |
77 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS |
78 | #endif |
79 | #if CL_TARGET_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) |
80 | #define CL_USE_DEPRECATED_OPENCL_1_1_APIS |
81 | #endif |
82 | #if CL_TARGET_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) |
83 | #define CL_USE_DEPRECATED_OPENCL_1_0_APIS |
84 | #endif |
85 | |
86 | #endif /* __CL_VERSION_H */ |
87 | |