HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cl_version.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2018-2020 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #ifndef __CL_VERSION_H
18 #define __CL_VERSION_H
19 
20 /* Detect which version to target */
21 #if !defined(CL_TARGET_OPENCL_VERSION)
22 #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
23 #define CL_TARGET_OPENCL_VERSION 300
24 #endif
25 #if CL_TARGET_OPENCL_VERSION != 100 && \
26  CL_TARGET_OPENCL_VERSION != 110 && \
27  CL_TARGET_OPENCL_VERSION != 120 && \
28  CL_TARGET_OPENCL_VERSION != 200 && \
29  CL_TARGET_OPENCL_VERSION != 210 && \
30  CL_TARGET_OPENCL_VERSION != 220 && \
31  CL_TARGET_OPENCL_VERSION != 300
32 #pragma message("cl_version: CL_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220, 300). Defaulting to 300 (OpenCL 3.0)")
33 #undef CL_TARGET_OPENCL_VERSION
34 #define CL_TARGET_OPENCL_VERSION 300
35 #endif
36 
37 
38 /* OpenCL Version */
39 #if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
40 #define CL_VERSION_3_0 1
41 #endif
42 #if CL_TARGET_OPENCL_VERSION >= 220 && !defined(CL_VERSION_2_2)
43 #define CL_VERSION_2_2 1
44 #endif
45 #if CL_TARGET_OPENCL_VERSION >= 210 && !defined(CL_VERSION_2_1)
46 #define CL_VERSION_2_1 1
47 #endif
48 #if CL_TARGET_OPENCL_VERSION >= 200 && !defined(CL_VERSION_2_0)
49 #define CL_VERSION_2_0 1
50 #endif
51 #if CL_TARGET_OPENCL_VERSION >= 120 && !defined(CL_VERSION_1_2)
52 #define CL_VERSION_1_2 1
53 #endif
54 #if CL_TARGET_OPENCL_VERSION >= 110 && !defined(CL_VERSION_1_1)
55 #define CL_VERSION_1_1 1
56 #endif
57 #if CL_TARGET_OPENCL_VERSION >= 100 && !defined(CL_VERSION_1_0)
58 #define CL_VERSION_1_0 1
59 #endif
60 
61 /* Allow deprecated APIs for older OpenCL versions. */
62 #if CL_TARGET_OPENCL_VERSION <= 220 && !defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
63 #define CL_USE_DEPRECATED_OPENCL_2_2_APIS
64 #endif
65 #if CL_TARGET_OPENCL_VERSION <= 210 && !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS)
66 #define CL_USE_DEPRECATED_OPENCL_2_1_APIS
67 #endif
68 #if CL_TARGET_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
69 #define CL_USE_DEPRECATED_OPENCL_2_0_APIS
70 #endif
71 #if CL_TARGET_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
72 #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
73 #endif
74 #if CL_TARGET_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
75 #define CL_USE_DEPRECATED_OPENCL_1_1_APIS
76 #endif
77 #if CL_TARGET_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
78 #define CL_USE_DEPRECATED_OPENCL_1_0_APIS
79 #endif
80 
81 #endif /* __CL_VERSION_H */