LLVM API Documentation

cl_common_defines.h
Go to the documentation of this file.
00001 #ifndef CL_COMMON_DEFINES_H
00002 #define CL_COMMON_DEFINES_H
00003 // This file includes defines that are common to both kernel code and
00004 // the NVPTX back-end.
00005 
00006 //
00007 // Common defines for Image intrinsics
00008 // Channel order
00009 enum {
00010   CLK_R = 0x10B0,
00011   CLK_A = 0x10B1,
00012   CLK_RG = 0x10B2,
00013   CLK_RA = 0x10B3,
00014   CLK_RGB = 0x10B4,
00015   CLK_RGBA = 0x10B5,
00016   CLK_BGRA = 0x10B6,
00017   CLK_ARGB = 0x10B7,
00018 
00019 #if (__NV_CL_C_VERSION == __NV_CL_C_VERSION_1_0)
00020   CLK_xRGB = 0x10B7,
00021 #endif
00022 
00023   CLK_INTENSITY = 0x10B8,
00024   CLK_LUMINANCE = 0x10B9
00025 
00026 #if (__NV_CL_C_VERSION >= __NV_CL_C_VERSION_1_1)
00027       ,
00028   CLK_Rx = 0x10BA,
00029   CLK_RGx = 0x10BB,
00030   CLK_RGBx = 0x10BC
00031 #endif
00032 };
00033 
00034 typedef enum clk_channel_type {
00035   // valid formats for float return types
00036   CLK_SNORM_INT8 = 0x10D0,  // four channel RGBA unorm8
00037   CLK_SNORM_INT16 = 0x10D1, // four channel RGBA unorm16
00038   CLK_UNORM_INT8 = 0x10D2,  // four channel RGBA unorm8
00039   CLK_UNORM_INT16 = 0x10D3, // four channel RGBA unorm16
00040   CLK_HALF_FLOAT = 0x10DD,  // four channel RGBA half
00041   CLK_FLOAT = 0x10DE,       // four channel RGBA float
00042 
00043 #if (__NV_CL_C_VERSION >= __NV_CL_C_VERSION_1_1)
00044   CLK_UNORM_SHORT_565 = 0x10D4,
00045   CLK_UNORM_SHORT_555 = 0x10D5,
00046   CLK_UNORM_INT_101010 = 0x10D6,
00047 #endif
00048 
00049   // valid only for integer return types
00050   CLK_SIGNED_INT8 = 0x10D7,
00051   CLK_SIGNED_INT16 = 0x10D8,
00052   CLK_SIGNED_INT32 = 0x10D9,
00053   CLK_UNSIGNED_INT8 = 0x10DA,
00054   CLK_UNSIGNED_INT16 = 0x10DB,
00055   CLK_UNSIGNED_INT32 = 0x10DC,
00056 
00057   // CI SPI for CPU
00058   __CLK_UNORM_INT8888,  // four channel ARGB unorm8
00059   __CLK_UNORM_INT8888R, // four channel BGRA unorm8
00060 
00061   __CLK_VALID_IMAGE_TYPE_COUNT,
00062   __CLK_INVALID_IMAGE_TYPE = __CLK_VALID_IMAGE_TYPE_COUNT,
00063   __CLK_VALID_IMAGE_TYPE_MASK_BITS = 4, // number of bits required to
00064                                         // represent any image type
00065   __CLK_VALID_IMAGE_TYPE_MASK = (1 << __CLK_VALID_IMAGE_TYPE_MASK_BITS) - 1
00066 } clk_channel_type;
00067 
00068 typedef enum clk_sampler_type {
00069   __CLK_ADDRESS_BASE = 0,
00070   CLK_ADDRESS_NONE = 0 << __CLK_ADDRESS_BASE,
00071   CLK_ADDRESS_CLAMP = 1 << __CLK_ADDRESS_BASE,
00072   CLK_ADDRESS_CLAMP_TO_EDGE = 2 << __CLK_ADDRESS_BASE,
00073   CLK_ADDRESS_REPEAT = 3 << __CLK_ADDRESS_BASE,
00074   CLK_ADDRESS_MIRROR = 4 << __CLK_ADDRESS_BASE,
00075 
00076 #if (__NV_CL_C_VERSION >= __NV_CL_C_VERSION_1_1)
00077   CLK_ADDRESS_MIRRORED_REPEAT = CLK_ADDRESS_MIRROR,
00078 #endif
00079   __CLK_ADDRESS_MASK =
00080       CLK_ADDRESS_NONE | CLK_ADDRESS_CLAMP | CLK_ADDRESS_CLAMP_TO_EDGE |
00081       CLK_ADDRESS_REPEAT | CLK_ADDRESS_MIRROR,
00082   __CLK_ADDRESS_BITS = 3, // number of bits required to
00083                           // represent address info
00084 
00085   __CLK_NORMALIZED_BASE = __CLK_ADDRESS_BITS,
00086   CLK_NORMALIZED_COORDS_FALSE = 0,
00087   CLK_NORMALIZED_COORDS_TRUE = 1 << __CLK_NORMALIZED_BASE,
00088   __CLK_NORMALIZED_MASK =
00089       CLK_NORMALIZED_COORDS_FALSE | CLK_NORMALIZED_COORDS_TRUE,
00090   __CLK_NORMALIZED_BITS = 1, // number of bits required to
00091                              // represent normalization
00092 
00093   __CLK_FILTER_BASE = __CLK_NORMALIZED_BASE + __CLK_NORMALIZED_BITS,
00094   CLK_FILTER_NEAREST = 0 << __CLK_FILTER_BASE,
00095   CLK_FILTER_LINEAR = 1 << __CLK_FILTER_BASE,
00096   CLK_FILTER_ANISOTROPIC = 2 << __CLK_FILTER_BASE,
00097   __CLK_FILTER_MASK =
00098       CLK_FILTER_NEAREST | CLK_FILTER_LINEAR | CLK_FILTER_ANISOTROPIC,
00099   __CLK_FILTER_BITS = 2, // number of bits required to
00100                          // represent address info
00101 
00102   __CLK_MIP_BASE = __CLK_FILTER_BASE + __CLK_FILTER_BITS,
00103   CLK_MIP_NEAREST = 0 << __CLK_MIP_BASE,
00104   CLK_MIP_LINEAR = 1 << __CLK_MIP_BASE,
00105   CLK_MIP_ANISOTROPIC = 2 << __CLK_MIP_BASE,
00106   __CLK_MIP_MASK = CLK_MIP_NEAREST | CLK_MIP_LINEAR | CLK_MIP_ANISOTROPIC,
00107   __CLK_MIP_BITS = 2,
00108 
00109   __CLK_SAMPLER_BITS = __CLK_MIP_BASE + __CLK_MIP_BITS,
00110   __CLK_SAMPLER_MASK = __CLK_MIP_MASK | __CLK_FILTER_MASK |
00111                        __CLK_NORMALIZED_MASK | __CLK_ADDRESS_MASK,
00112 
00113   __CLK_ANISOTROPIC_RATIO_BITS = 5,
00114   __CLK_ANISOTROPIC_RATIO_MASK =
00115       (int) 0x80000000 >> (__CLK_ANISOTROPIC_RATIO_BITS - 1)
00116 } clk_sampler_type;
00117 
00118 // Memory synchronization
00119 #define CLK_LOCAL_MEM_FENCE (1 << 0)
00120 #define CLK_GLOBAL_MEM_FENCE (1 << 1)
00121 
00122 #endif // CL_COMMON_DEFINES_H