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