blob: f38280a8a0b4c44b243d9769d04543a55cbd9dc8 [file] [log] [blame]
Pierre Moreaudddc5642018-01-28 11:38:46 +01001/*******************************************************************************
Dave Airlie725df7c2020-10-07 10:19:09 +10002 * Copyright (c) 2018-2020 The Khronos Group Inc.
Pierre Moreaudddc5642018-01-28 11:38:46 +01003 *
Dave Airlie725df7c2020-10-07 10:19:09 +10004 * 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
Pierre Moreaudddc5642018-01-28 11:38:46 +01007 *
Dave Airlie725df7c2020-10-07 10:19:09 +10008 * http://www.apache.org/licenses/LICENSE-2.0
Pierre Moreaudddc5642018-01-28 11:38:46 +01009 *
Dave Airlie725df7c2020-10-07 10:19:09 +100010 * 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.
Pierre Moreaudddc5642018-01-28 11:38:46 +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)
22#pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
23#define CL_TARGET_OPENCL_VERSION 220
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 && \
Dave Airlie725df7c2020-10-07 10:19:09 +100030 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 220 (OpenCL 2.2)")
Pierre Moreaudddc5642018-01-28 11:38:46 +010033#undef CL_TARGET_OPENCL_VERSION
34#define CL_TARGET_OPENCL_VERSION 220
35#endif
36
37
38/* OpenCL Version */
Dave Airlie725df7c2020-10-07 10:19:09 +100039#if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
40#define CL_VERSION_3_0 1
41#endif
Pierre Moreaudddc5642018-01-28 11:38:46 +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. */
Dave Airlie725df7c2020-10-07 10:19:09 +100062#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
Pierre Moreaudddc5642018-01-28 11:38:46 +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 */