cl_common_defines.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef CL_COMMON_DEFINES_H
  2. #define CL_COMMON_DEFINES_H
  3. // This file includes defines that are common to both kernel code and
  4. // the NVPTX back-end.
  5. //
  6. // Common defines for Image intrinsics
  7. // Channel order
  8. enum {
  9. CLK_R = 0x10B0,
  10. CLK_A = 0x10B1,
  11. CLK_RG = 0x10B2,
  12. CLK_RA = 0x10B3,
  13. CLK_RGB = 0x10B4,
  14. CLK_RGBA = 0x10B5,
  15. CLK_BGRA = 0x10B6,
  16. CLK_ARGB = 0x10B7,
  17. #if (__NV_CL_C_VERSION == __NV_CL_C_VERSION_1_0)
  18. CLK_xRGB = 0x10B7,
  19. #endif
  20. CLK_INTENSITY = 0x10B8,
  21. CLK_LUMINANCE = 0x10B9
  22. #if (__NV_CL_C_VERSION >= __NV_CL_C_VERSION_1_1)
  23. ,
  24. CLK_Rx = 0x10BA,
  25. CLK_RGx = 0x10BB,
  26. CLK_RGBx = 0x10BC
  27. #endif
  28. };
  29. typedef enum clk_channel_type {
  30. // valid formats for float return types
  31. CLK_SNORM_INT8 = 0x10D0, // four channel RGBA unorm8
  32. CLK_SNORM_INT16 = 0x10D1, // four channel RGBA unorm16
  33. CLK_UNORM_INT8 = 0x10D2, // four channel RGBA unorm8
  34. CLK_UNORM_INT16 = 0x10D3, // four channel RGBA unorm16
  35. CLK_HALF_FLOAT = 0x10DD, // four channel RGBA half
  36. CLK_FLOAT = 0x10DE, // four channel RGBA float
  37. #if (__NV_CL_C_VERSION >= __NV_CL_C_VERSION_1_1)
  38. CLK_UNORM_SHORT_565 = 0x10D4,
  39. CLK_UNORM_SHORT_555 = 0x10D5,
  40. CLK_UNORM_INT_101010 = 0x10D6,
  41. #endif
  42. // valid only for integer return types
  43. CLK_SIGNED_INT8 = 0x10D7,
  44. CLK_SIGNED_INT16 = 0x10D8,
  45. CLK_SIGNED_INT32 = 0x10D9,
  46. CLK_UNSIGNED_INT8 = 0x10DA,
  47. CLK_UNSIGNED_INT16 = 0x10DB,
  48. CLK_UNSIGNED_INT32 = 0x10DC,
  49. // CI SPI for CPU
  50. __CLK_UNORM_INT8888, // four channel ARGB unorm8
  51. __CLK_UNORM_INT8888R, // four channel BGRA unorm8
  52. __CLK_VALID_IMAGE_TYPE_COUNT,
  53. __CLK_INVALID_IMAGE_TYPE = __CLK_VALID_IMAGE_TYPE_COUNT,
  54. __CLK_VALID_IMAGE_TYPE_MASK_BITS = 4, // number of bits required to
  55. // represent any image type
  56. __CLK_VALID_IMAGE_TYPE_MASK = (1 << __CLK_VALID_IMAGE_TYPE_MASK_BITS) - 1
  57. } clk_channel_type;
  58. typedef enum clk_sampler_type {
  59. __CLK_ADDRESS_BASE = 0,
  60. CLK_ADDRESS_NONE = 0 << __CLK_ADDRESS_BASE,
  61. CLK_ADDRESS_CLAMP = 1 << __CLK_ADDRESS_BASE,
  62. CLK_ADDRESS_CLAMP_TO_EDGE = 2 << __CLK_ADDRESS_BASE,
  63. CLK_ADDRESS_REPEAT = 3 << __CLK_ADDRESS_BASE,
  64. CLK_ADDRESS_MIRROR = 4 << __CLK_ADDRESS_BASE,
  65. #if (__NV_CL_C_VERSION >= __NV_CL_C_VERSION_1_1)
  66. CLK_ADDRESS_MIRRORED_REPEAT = CLK_ADDRESS_MIRROR,
  67. #endif
  68. __CLK_ADDRESS_MASK =
  69. CLK_ADDRESS_NONE | CLK_ADDRESS_CLAMP | CLK_ADDRESS_CLAMP_TO_EDGE |
  70. CLK_ADDRESS_REPEAT | CLK_ADDRESS_MIRROR,
  71. __CLK_ADDRESS_BITS = 3, // number of bits required to
  72. // represent address info
  73. __CLK_NORMALIZED_BASE = __CLK_ADDRESS_BITS,
  74. CLK_NORMALIZED_COORDS_FALSE = 0,
  75. CLK_NORMALIZED_COORDS_TRUE = 1 << __CLK_NORMALIZED_BASE,
  76. __CLK_NORMALIZED_MASK =
  77. CLK_NORMALIZED_COORDS_FALSE | CLK_NORMALIZED_COORDS_TRUE,
  78. __CLK_NORMALIZED_BITS = 1, // number of bits required to
  79. // represent normalization
  80. __CLK_FILTER_BASE = __CLK_NORMALIZED_BASE + __CLK_NORMALIZED_BITS,
  81. CLK_FILTER_NEAREST = 0 << __CLK_FILTER_BASE,
  82. CLK_FILTER_LINEAR = 1 << __CLK_FILTER_BASE,
  83. CLK_FILTER_ANISOTROPIC = 2 << __CLK_FILTER_BASE,
  84. __CLK_FILTER_MASK =
  85. CLK_FILTER_NEAREST | CLK_FILTER_LINEAR | CLK_FILTER_ANISOTROPIC,
  86. __CLK_FILTER_BITS = 2, // number of bits required to
  87. // represent address info
  88. __CLK_MIP_BASE = __CLK_FILTER_BASE + __CLK_FILTER_BITS,
  89. CLK_MIP_NEAREST = 0 << __CLK_MIP_BASE,
  90. CLK_MIP_LINEAR = 1 << __CLK_MIP_BASE,
  91. CLK_MIP_ANISOTROPIC = 2 << __CLK_MIP_BASE,
  92. __CLK_MIP_MASK = CLK_MIP_NEAREST | CLK_MIP_LINEAR | CLK_MIP_ANISOTROPIC,
  93. __CLK_MIP_BITS = 2,
  94. __CLK_SAMPLER_BITS = __CLK_MIP_BASE + __CLK_MIP_BITS,
  95. __CLK_SAMPLER_MASK = __CLK_MIP_MASK | __CLK_FILTER_MASK |
  96. __CLK_NORMALIZED_MASK | __CLK_ADDRESS_MASK,
  97. __CLK_ANISOTROPIC_RATIO_BITS = 5,
  98. __CLK_ANISOTROPIC_RATIO_MASK =
  99. (int) 0x80000000 >> (__CLK_ANISOTROPIC_RATIO_BITS - 1)
  100. } clk_sampler_type;
  101. // Memory synchronization
  102. #define CLK_LOCAL_MEM_FENCE (1 << 0)
  103. #define CLK_GLOBAL_MEM_FENCE (1 << 1)
  104. #endif // CL_COMMON_DEFINES_H