180d59932Sopenharmony_ci/*******************************************************************************
280d59932Sopenharmony_ci * Copyright (c) 2018-2020 The Khronos Group Inc.
380d59932Sopenharmony_ci *
480d59932Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
580d59932Sopenharmony_ci * you may not use this file except in compliance with the License.
680d59932Sopenharmony_ci * You may obtain a copy of the License at
780d59932Sopenharmony_ci *
880d59932Sopenharmony_ci *    http://www.apache.org/licenses/LICENSE-2.0
980d59932Sopenharmony_ci *
1080d59932Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1180d59932Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1280d59932Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1380d59932Sopenharmony_ci * See the License for the specific language governing permissions and
1480d59932Sopenharmony_ci * limitations under the License.
1580d59932Sopenharmony_ci ******************************************************************************/
1680d59932Sopenharmony_ci
1780d59932Sopenharmony_ci#ifndef __CL_VERSION_H
1880d59932Sopenharmony_ci#define __CL_VERSION_H
1980d59932Sopenharmony_ci
2080d59932Sopenharmony_ci/* Detect which version to target */
2180d59932Sopenharmony_ci#if !defined(CL_TARGET_OPENCL_VERSION)
2280d59932Sopenharmony_ci#pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
2380d59932Sopenharmony_ci#define CL_TARGET_OPENCL_VERSION 300
2480d59932Sopenharmony_ci#endif
2580d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION != 100 && \
2680d59932Sopenharmony_ci    CL_TARGET_OPENCL_VERSION != 110 && \
2780d59932Sopenharmony_ci    CL_TARGET_OPENCL_VERSION != 120 && \
2880d59932Sopenharmony_ci    CL_TARGET_OPENCL_VERSION != 200 && \
2980d59932Sopenharmony_ci    CL_TARGET_OPENCL_VERSION != 210 && \
3080d59932Sopenharmony_ci    CL_TARGET_OPENCL_VERSION != 220 && \
3180d59932Sopenharmony_ci    CL_TARGET_OPENCL_VERSION != 300
3280d59932Sopenharmony_ci#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)")
3380d59932Sopenharmony_ci#undef CL_TARGET_OPENCL_VERSION
3480d59932Sopenharmony_ci#define CL_TARGET_OPENCL_VERSION 300
3580d59932Sopenharmony_ci#endif
3680d59932Sopenharmony_ci
3780d59932Sopenharmony_ci
3880d59932Sopenharmony_ci/* OpenCL Version */
3980d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
4080d59932Sopenharmony_ci#define CL_VERSION_3_0  1
4180d59932Sopenharmony_ci#endif
4280d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 220 && !defined(CL_VERSION_2_2)
4380d59932Sopenharmony_ci#define CL_VERSION_2_2  1
4480d59932Sopenharmony_ci#endif
4580d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 210 && !defined(CL_VERSION_2_1)
4680d59932Sopenharmony_ci#define CL_VERSION_2_1  1
4780d59932Sopenharmony_ci#endif
4880d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 200 && !defined(CL_VERSION_2_0)
4980d59932Sopenharmony_ci#define CL_VERSION_2_0  1
5080d59932Sopenharmony_ci#endif
5180d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 120 && !defined(CL_VERSION_1_2)
5280d59932Sopenharmony_ci#define CL_VERSION_1_2  1
5380d59932Sopenharmony_ci#endif
5480d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 110 && !defined(CL_VERSION_1_1)
5580d59932Sopenharmony_ci#define CL_VERSION_1_1  1
5680d59932Sopenharmony_ci#endif
5780d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION >= 100 && !defined(CL_VERSION_1_0)
5880d59932Sopenharmony_ci#define CL_VERSION_1_0  1
5980d59932Sopenharmony_ci#endif
6080d59932Sopenharmony_ci
6180d59932Sopenharmony_ci/* Allow deprecated APIs for older OpenCL versions. */
6280d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION <= 220 && !defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
6380d59932Sopenharmony_ci#define CL_USE_DEPRECATED_OPENCL_2_2_APIS
6480d59932Sopenharmony_ci#endif
6580d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION <= 210 && !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS)
6680d59932Sopenharmony_ci#define CL_USE_DEPRECATED_OPENCL_2_1_APIS
6780d59932Sopenharmony_ci#endif
6880d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
6980d59932Sopenharmony_ci#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
7080d59932Sopenharmony_ci#endif
7180d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
7280d59932Sopenharmony_ci#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
7380d59932Sopenharmony_ci#endif
7480d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
7580d59932Sopenharmony_ci#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
7680d59932Sopenharmony_ci#endif
7780d59932Sopenharmony_ci#if CL_TARGET_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
7880d59932Sopenharmony_ci#define CL_USE_DEPRECATED_OPENCL_1_0_APIS
7980d59932Sopenharmony_ci#endif
8080d59932Sopenharmony_ci
8180d59932Sopenharmony_ci#endif  /* __CL_VERSION_H */
82