cl_version.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #ifndef __CL_VERSION_H
  17. #define __CL_VERSION_H
  18. /* Detect which version to target */
  19. #if !defined(CL_TARGET_OPENCL_VERSION)
  20. #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
  21. #define CL_TARGET_OPENCL_VERSION 300
  22. #endif
  23. #if CL_TARGET_OPENCL_VERSION != 100 && \
  24. CL_TARGET_OPENCL_VERSION != 110 && \
  25. CL_TARGET_OPENCL_VERSION != 120 && \
  26. CL_TARGET_OPENCL_VERSION != 200 && \
  27. CL_TARGET_OPENCL_VERSION != 210 && \
  28. CL_TARGET_OPENCL_VERSION != 220 && \
  29. CL_TARGET_OPENCL_VERSION != 300
  30. #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)")
  31. #undef CL_TARGET_OPENCL_VERSION
  32. #define CL_TARGET_OPENCL_VERSION 300
  33. #endif
  34. /* OpenCL Version */
  35. #if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
  36. #define CL_VERSION_3_0 1
  37. #endif
  38. #if CL_TARGET_OPENCL_VERSION >= 220 && !defined(CL_VERSION_2_2)
  39. #define CL_VERSION_2_2 1
  40. #endif
  41. #if CL_TARGET_OPENCL_VERSION >= 210 && !defined(CL_VERSION_2_1)
  42. #define CL_VERSION_2_1 1
  43. #endif
  44. #if CL_TARGET_OPENCL_VERSION >= 200 && !defined(CL_VERSION_2_0)
  45. #define CL_VERSION_2_0 1
  46. #endif
  47. #if CL_TARGET_OPENCL_VERSION >= 120 && !defined(CL_VERSION_1_2)
  48. #define CL_VERSION_1_2 1
  49. #endif
  50. #if CL_TARGET_OPENCL_VERSION >= 110 && !defined(CL_VERSION_1_1)
  51. #define CL_VERSION_1_1 1
  52. #endif
  53. #if CL_TARGET_OPENCL_VERSION >= 100 && !defined(CL_VERSION_1_0)
  54. #define CL_VERSION_1_0 1
  55. #endif
  56. /* Allow deprecated APIs for older OpenCL versions. */
  57. #if CL_TARGET_OPENCL_VERSION <= 220 && !defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
  58. #define CL_USE_DEPRECATED_OPENCL_2_2_APIS
  59. #endif
  60. #if CL_TARGET_OPENCL_VERSION <= 210 && !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS)
  61. #define CL_USE_DEPRECATED_OPENCL_2_1_APIS
  62. #endif
  63. #if CL_TARGET_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
  64. #define CL_USE_DEPRECATED_OPENCL_2_0_APIS
  65. #endif
  66. #if CL_TARGET_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
  67. #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
  68. #endif
  69. #if CL_TARGET_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
  70. #define CL_USE_DEPRECATED_OPENCL_1_1_APIS
  71. #endif
  72. #if CL_TARGET_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
  73. #define CL_USE_DEPRECATED_OPENCL_1_0_APIS
  74. #endif
  75. #endif /* __CL_VERSION_H */