blob: 3844938d548b6751a68ec015c08dea6a9935860f [file] [log] [blame]
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001/*******************************************************************************
Sheri Zhang79cb9452021-09-07 14:51:49 +01002 * Copyright (c) 2018-2020 The Khronos Group Inc.
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01003 *
Sheri Zhang79cb9452021-09-07 14:51:49 +01004 * 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
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01007 *
Sheri Zhang79cb9452021-09-07 14:51:49 +01008 * http://www.apache.org/licenses/LICENSE-2.0
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01009 *
Sheri Zhang79cb9452021-09-07 14:51:49 +010010 * 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.
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010015 ******************************************************************************/
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)
Sheri Zhang79cb9452021-09-07 14:51:49 +010022#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
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010024#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 && \
Sheri Zhang79cb9452021-09-07 14:51:49 +010030 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)")
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010033#undef CL_TARGET_OPENCL_VERSION
Sheri Zhang79cb9452021-09-07 14:51:49 +010034#define CL_TARGET_OPENCL_VERSION 300
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010035#endif
36
37
38/* OpenCL Version */
Sheri Zhang79cb9452021-09-07 14:51:49 +010039#if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
40#define CL_VERSION_3_0 1
41#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010042#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. */
Sheri Zhang79cb9452021-09-07 14:51:49 +010062#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
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010065#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 */