1//===-- OpenCLImageTypes.def - Metadata about BuiltinTypes ------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8// This file extends builtin types database with OpenCL image singleton types.
9// Custom code should define one of those three macros:
10// GENERIC_IMAGE_TYPE(Type, Id) - a generic image with its Id without an
11// access type
12// IMAGE_TYPE(Type, Id, SingletonId, AccessType, CGSuffix) - an image type
13// with given ID, singleton ID access type and a codegen suffix
14// GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) - a generic image with its Id and
15// required extension without an access type
16
17#ifdef GENERIC_IMAGE_TYPE
18
19#define IMAGE_READ_TYPE(Type, Id, Ext) GENERIC_IMAGE_TYPE(Type, Id)
20#define IMAGE_WRITE_TYPE(Type, Id, Ext)
21#define IMAGE_READ_WRITE_TYPE(Type, Id, Ext)
22
23#elif defined(GENERIC_IMAGE_TYPE_EXT)
24#define IMAGE_READ_TYPE(Type, Id, Ext) GENERIC_IMAGE_TYPE_EXT(Type, Id##ROTy, Ext)
25#define IMAGE_WRITE_TYPE(Type, Id, Ext) GENERIC_IMAGE_TYPE_EXT(Type, Id##WOTy, Ext)
26#define IMAGE_READ_WRITE_TYPE(Type, Id, Ext) GENERIC_IMAGE_TYPE_EXT(Type, Id##RWTy, Ext)
27
28#else
29#ifndef IMAGE_READ_TYPE
30#define IMAGE_READ_TYPE(Type, Id, Ext) \
31 IMAGE_TYPE(Type, Id##RO, Id##ROTy, read_only, ro)
32#endif
33#ifndef IMAGE_WRITE_TYPE
34#define IMAGE_WRITE_TYPE(Type, Id, Ext) \
35 IMAGE_TYPE(Type, Id##WO, Id##WOTy, write_only, wo)
36#endif
37#ifndef IMAGE_READ_WRITE_TYPE
38#define IMAGE_READ_WRITE_TYPE(Type, Id, Ext) \
39 IMAGE_TYPE(Type, Id##RW, Id##RWTy, read_write, rw)
40#endif
41
42#endif
43
44IMAGE_READ_TYPE(image1d, OCLImage1d, "")
45IMAGE_READ_TYPE(image1d_array, OCLImage1dArray, "")
46IMAGE_READ_TYPE(image1d_buffer, OCLImage1dBuffer, "")
47IMAGE_READ_TYPE(image2d, OCLImage2d, "")
48IMAGE_READ_TYPE(image2d_array, OCLImage2dArray, "")
49IMAGE_READ_TYPE(image2d_depth, OCLImage2dDepth, "")
50IMAGE_READ_TYPE(image2d_array_depth, OCLImage2dArrayDepth, "")
51IMAGE_READ_TYPE(image2d_msaa, OCLImage2dMSAA, "cl_khr_gl_msaa_sharing")
52IMAGE_READ_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA, "cl_khr_gl_msaa_sharing")
53IMAGE_READ_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth, "cl_khr_gl_msaa_sharing")
54IMAGE_READ_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth, "cl_khr_gl_msaa_sharing")
55IMAGE_READ_TYPE(image3d, OCLImage3d, "")
56
57IMAGE_WRITE_TYPE(image1d, OCLImage1d, "")
58IMAGE_WRITE_TYPE(image1d_array, OCLImage1dArray, "")
59IMAGE_WRITE_TYPE(image1d_buffer, OCLImage1dBuffer, "")
60IMAGE_WRITE_TYPE(image2d, OCLImage2d, "")
61IMAGE_WRITE_TYPE(image2d_array, OCLImage2dArray, "")
62IMAGE_WRITE_TYPE(image2d_depth, OCLImage2dDepth, "")
63IMAGE_WRITE_TYPE(image2d_array_depth, OCLImage2dArrayDepth, "")
64IMAGE_WRITE_TYPE(image2d_msaa, OCLImage2dMSAA, "cl_khr_gl_msaa_sharing")
65IMAGE_WRITE_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA, "cl_khr_gl_msaa_sharing")
66IMAGE_WRITE_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth, "cl_khr_gl_msaa_sharing")
67IMAGE_WRITE_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth, "cl_khr_gl_msaa_sharing")
68IMAGE_WRITE_TYPE(image3d, OCLImage3d, "")
69
70IMAGE_READ_WRITE_TYPE(image1d, OCLImage1d, "")
71IMAGE_READ_WRITE_TYPE(image1d_array, OCLImage1dArray, "")
72IMAGE_READ_WRITE_TYPE(image1d_buffer, OCLImage1dBuffer, "")
73IMAGE_READ_WRITE_TYPE(image2d, OCLImage2d, "")
74IMAGE_READ_WRITE_TYPE(image2d_array, OCLImage2dArray, "")
75IMAGE_READ_WRITE_TYPE(image2d_depth, OCLImage2dDepth, "")
76IMAGE_READ_WRITE_TYPE(image2d_array_depth, OCLImage2dArrayDepth, "")
77IMAGE_READ_WRITE_TYPE(image2d_msaa, OCLImage2dMSAA, "cl_khr_gl_msaa_sharing")
78IMAGE_READ_WRITE_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA, "cl_khr_gl_msaa_sharing")
79IMAGE_READ_WRITE_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth, "cl_khr_gl_msaa_sharing")
80IMAGE_READ_WRITE_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth, "cl_khr_gl_msaa_sharing")
81IMAGE_READ_WRITE_TYPE(image3d, OCLImage3d, "")
82
83#undef IMAGE_TYPE
84#undef GENERIC_IMAGE_TYPE
85#undef IMAGE_READ_TYPE
86#undef IMAGE_WRITE_TYPE
87#undef IMAGE_READ_WRITE_TYPE
88

source code of clang/include/clang/Basic/OpenCLImageTypes.def