Enums.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. // Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <anki/util/StdTypes.h>
  7. #include <anki/util/Enum.h>
  8. namespace anki
  9. {
  10. /// @addtogroup graphics
  11. /// @{
  12. enum ColorBit : U8
  13. {
  14. NONE = 0,
  15. RED = 1 << 0,
  16. GREEN = 1 << 1,
  17. BLUE = 1 << 2,
  18. ALPHA = 1 << 3,
  19. ALL = RED | GREEN | BLUE | ALPHA
  20. };
  21. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(ColorBit, inline)
  22. enum PrimitiveTopology : U8
  23. {
  24. POINTS,
  25. LINES,
  26. LINE_STIP,
  27. TRIANGLES,
  28. TRIANGLE_STRIP,
  29. PATCHES
  30. };
  31. enum class FillMode : U8
  32. {
  33. POINTS,
  34. WIREFRAME,
  35. SOLID
  36. };
  37. enum class CullMode : U8
  38. {
  39. FRONT,
  40. BACK,
  41. FRONT_AND_BACK
  42. };
  43. enum class CompareOperation : U8
  44. {
  45. ALWAYS,
  46. LESS,
  47. EQUAL,
  48. LESS_EQUAL,
  49. GREATER,
  50. GREATER_EQUAL,
  51. NOT_EQUAL,
  52. NEVER
  53. };
  54. enum class BlendMethod : U8
  55. {
  56. ZERO,
  57. ONE,
  58. SRC_COLOR,
  59. ONE_MINUS_SRC_COLOR,
  60. DST_COLOR,
  61. ONE_MINUS_DST_COLOR,
  62. SRC_ALPHA,
  63. ONE_MINUS_SRC_ALPHA,
  64. DST_ALPHA,
  65. ONE_MINUS_DST_ALPHA,
  66. CONSTANT_COLOR,
  67. ONE_MINUS_CONSTANT_COLOR,
  68. CONSTANT_ALPHA,
  69. ONE_MINUS_CONSTANT_ALPHA,
  70. SRC_ALPHA_SATURATE,
  71. SRC1_COLOR,
  72. ONE_MINUS_SRC1_COLOR,
  73. SRC1_ALPHA,
  74. ONE_MINUS_SRC1_ALPHA
  75. };
  76. enum class BlendFunction : U8
  77. {
  78. ADD,
  79. SUBTRACT,
  80. REVERSE_SUBTRACT,
  81. MIN,
  82. MAX
  83. };
  84. enum class VertexStepRate : U8
  85. {
  86. VERTEX,
  87. INSTANCE,
  88. DRAW
  89. };
  90. enum class ComponentFormat : U8
  91. {
  92. NONE,
  93. R8,
  94. R8G8,
  95. R8G8B8,
  96. R8G8B8A8,
  97. R16,
  98. R16G16,
  99. R16G16B16,
  100. R16G16B16A16,
  101. R32,
  102. R32G32,
  103. R32G32B32,
  104. R32G32B32A32,
  105. // Special
  106. R10G10B10A2,
  107. R11G11B10,
  108. // Compressed
  109. R8G8B8_S3TC, ///< DXT1
  110. R8G8B8_ETC2,
  111. R8G8B8A8_S3TC, ///< DXT5
  112. R8G8B8A8_ETC2,
  113. // Depth
  114. D16,
  115. D24,
  116. D32,
  117. // Limits
  118. FIRST_COMPRESSED = R8G8B8_S3TC,
  119. LAST_COMPRESSED = R8G8B8A8_ETC2
  120. };
  121. enum class TransformFormat : U8
  122. {
  123. NONE,
  124. UNORM,
  125. SNORM,
  126. UINT,
  127. SINT,
  128. FLOAT
  129. };
  130. enum class TextureType : U8
  131. {
  132. _1D,
  133. _2D,
  134. _3D,
  135. _2D_ARRAY,
  136. CUBE,
  137. CUBE_ARRAY
  138. };
  139. enum class SamplingFilter : U8
  140. {
  141. NEAREST,
  142. LINEAR,
  143. BASE ///< Only for mipmaps
  144. };
  145. enum class ShaderType : U8
  146. {
  147. VERTEX,
  148. TESSELLATION_CONTROL,
  149. TESSELLATION_EVALUATION,
  150. GEOMETRY,
  151. FRAGMENT,
  152. COMPUTE,
  153. COUNT
  154. };
  155. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(ShaderType, inline)
  156. enum class ShaderTypeBit : U8
  157. {
  158. NONE = 0,
  159. VERTEX = 1 << 0,
  160. TESSELLATION_CONTROL = 1 << 1,
  161. TESSELLATION_EVALUATION = 1 << 2,
  162. GEOMETRY = 1 << 3,
  163. FRAGMENT = 1 << 4,
  164. COMPUTE = 1 << 5
  165. };
  166. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(ShaderTypeBit, inline)
  167. enum class ShaderVariableDataType : U8
  168. {
  169. NONE,
  170. FLOAT,
  171. VEC2,
  172. VEC3,
  173. VEC4,
  174. MAT3,
  175. MAT4,
  176. SAMPLER_2D,
  177. SAMPLER_3D,
  178. SAMPLER_2D_ARRAY,
  179. SAMPLER_CUBE,
  180. NUMERICS_FIRST = FLOAT,
  181. NUMERICS_LAST = MAT4,
  182. SAMPLERS_FIRST = SAMPLER_2D,
  183. SAMPLERS_LAST = SAMPLER_CUBE
  184. };
  185. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(ShaderVariableDataType, inline)
  186. /// Format for images and vertex attributes.
  187. class PixelFormat
  188. {
  189. public:
  190. ComponentFormat m_components = ComponentFormat::NONE;
  191. TransformFormat m_transform = TransformFormat::NONE;
  192. Bool8 m_srgb = false;
  193. PixelFormat() = default;
  194. PixelFormat(const PixelFormat&) = default;
  195. PixelFormat(ComponentFormat cf, TransformFormat tf, Bool srgb = false)
  196. : m_components(cf)
  197. , m_transform(tf)
  198. , m_srgb(srgb)
  199. {
  200. }
  201. PixelFormat& operator=(const PixelFormat&) = default;
  202. Bool operator==(const PixelFormat& b) const
  203. {
  204. return m_components == b.m_components && m_transform == b.m_transform
  205. && m_srgb == b.m_srgb;
  206. }
  207. };
  208. /// Occlusion query result bit.
  209. enum class OcclusionQueryResultBit : U8
  210. {
  211. NOT_AVAILABLE = 1 << 0,
  212. VISIBLE = 1 << 1,
  213. NOT_VISIBLE = 1 << 2
  214. };
  215. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(OcclusionQueryResultBit, inline)
  216. /// Occlusion query result.
  217. enum class OcclusionQueryResult : U8
  218. {
  219. NOT_AVAILABLE,
  220. VISIBLE,
  221. NOT_VISIBLE
  222. };
  223. /// Attachment load operation.
  224. enum class AttachmentLoadOperation : U8
  225. {
  226. LOAD,
  227. CLEAR,
  228. DONT_CARE
  229. };
  230. /// Attachment store operation.
  231. enum class AttachmentStoreOperation : U8
  232. {
  233. STORE,
  234. RESOLVE_MSAA,
  235. DONT_CARE
  236. };
  237. /// Buffer usage modes.
  238. enum class BufferUsageBit : U8
  239. {
  240. NONE = 0,
  241. UNIFORM = 1 << 0,
  242. STORAGE = 1 << 1,
  243. INDEX = 1 << 2,
  244. VERTEX = 1 << 3,
  245. INDIRECT = 1 << 4
  246. };
  247. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(BufferUsageBit, inline)
  248. /// Buffer usage modes.
  249. enum class BufferUsage : U8
  250. {
  251. UNIFORM,
  252. STORAGE,
  253. INDEX,
  254. VERTEX,
  255. INDIRECT,
  256. TRANSFER, ///< For texture upload and buffer write.
  257. COUNT,
  258. FIRST = UNIFORM
  259. };
  260. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(BufferUsage, inline)
  261. /// Buffer access from client modes.
  262. enum class BufferAccessBit : U8
  263. {
  264. NONE = 0,
  265. CLIENT_MAP_READ = 1 << 0,
  266. CLIENT_MAP_WRITE = 1 << 1,
  267. CLIENT_WRITE = 1 << 2,
  268. };
  269. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(BufferAccessBit, inline)
  270. /// @}
  271. } // end namespace anki