//===-- OpenCLImageTypes.def - Metadata about BuiltinTypes ------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//  This file extends builtin types database with OpenCL image singleton types.
//  Custom code should define one of those two macros:
//    GENERIC_IMAGE_TYPE(Type, Id) - a generic image with its Id without an 
//      access type
//    IMAGE_TYPE(Type, Id, SingletonId, AccessType, CGSuffix) - an image type
//      with given ID, singleton ID access type and a codegen suffix  

#ifdef GENERIC_IMAGE_TYPE

#define IMAGE_READ_TYPE(Type, Id) GENERIC_IMAGE_TYPE(Type, Id)
#define IMAGE_WRITE_TYPE(Type, Id) 
#define IMAGE_READ_WRITE_TYPE(Type, Id) 

#else

#ifndef IMAGE_READ_TYPE
#define IMAGE_READ_TYPE(Type, Id) \
          IMAGE_TYPE(Type, Id##RO, Id##ROTy,  read_only, ro)
#endif
#ifndef IMAGE_WRITE_TYPE
#define IMAGE_WRITE_TYPE(Type, Id) \
          IMAGE_TYPE(Type, Id##WO, Id##WOTy, write_only, wo)
#endif
#ifndef IMAGE_READ_WRITE_TYPE
#define IMAGE_READ_WRITE_TYPE(Type, Id) \
          IMAGE_TYPE(Type, Id##RW, Id##RWTy, read_write, rw)
#endif

#endif

IMAGE_READ_TYPE(image1d, OCLImage1d)
IMAGE_READ_TYPE(image1d_array, OCLImage1dArray)
IMAGE_READ_TYPE(image1d_buffer, OCLImage1dBuffer)
IMAGE_READ_TYPE(image2d, OCLImage2d)
IMAGE_READ_TYPE(image2d_array, OCLImage2dArray)
IMAGE_READ_TYPE(image2d_depth, OCLImage2dDepth)
IMAGE_READ_TYPE(image2d_array_depth, OCLImage2dArrayDepth)
IMAGE_READ_TYPE(image2d_msaa, OCLImage2dMSAA)
IMAGE_READ_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA)
IMAGE_READ_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth)
IMAGE_READ_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth)
IMAGE_READ_TYPE(image3d, OCLImage3d)

IMAGE_WRITE_TYPE(image1d, OCLImage1d)
IMAGE_WRITE_TYPE(image1d_array, OCLImage1dArray)
IMAGE_WRITE_TYPE(image1d_buffer, OCLImage1dBuffer)
IMAGE_WRITE_TYPE(image2d, OCLImage2d)
IMAGE_WRITE_TYPE(image2d_array, OCLImage2dArray)
IMAGE_WRITE_TYPE(image2d_depth, OCLImage2dDepth)
IMAGE_WRITE_TYPE(image2d_array_depth, OCLImage2dArrayDepth)
IMAGE_WRITE_TYPE(image2d_msaa, OCLImage2dMSAA)
IMAGE_WRITE_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA)
IMAGE_WRITE_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth)
IMAGE_WRITE_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth)
IMAGE_WRITE_TYPE(image3d, OCLImage3d)

IMAGE_READ_WRITE_TYPE(image1d, OCLImage1d)
IMAGE_READ_WRITE_TYPE(image1d_array, OCLImage1dArray)
IMAGE_READ_WRITE_TYPE(image1d_buffer, OCLImage1dBuffer)
IMAGE_READ_WRITE_TYPE(image2d, OCLImage2d)
IMAGE_READ_WRITE_TYPE(image2d_array, OCLImage2dArray)
IMAGE_READ_WRITE_TYPE(image2d_depth, OCLImage2dDepth)
IMAGE_READ_WRITE_TYPE(image2d_array_depth, OCLImage2dArrayDepth)
IMAGE_READ_WRITE_TYPE(image2d_msaa, OCLImage2dMSAA)
IMAGE_READ_WRITE_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA)
IMAGE_READ_WRITE_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth)
IMAGE_READ_WRITE_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth)
IMAGE_READ_WRITE_TYPE(image3d, OCLImage3d)

#undef IMAGE_TYPE
#undef GENERIC_IMAGE_TYPE
#undef IMAGE_READ_TYPE
#undef IMAGE_WRITE_TYPE
#undef IMAGE_READ_WRITE_TYPE