bgfxdefines.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. /*
  2. * Copyright 2011-2015 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #ifndef BGFX_DEFINES_H_HEADER_GUARD
  6. #define BGFX_DEFINES_H_HEADER_GUARD
  7. ///
  8. #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
  9. #define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000002) //!< Enable alpha write.
  10. #define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000004) //!< Enable depth write.
  11. #define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) //!< Enable depth test, less.
  12. #define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) //!< Enable depth test, less equal.
  13. #define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) //!<
  14. #define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) //!<
  15. #define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) //!<
  16. #define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) //!<
  17. #define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) //!<
  18. #define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) //!<
  19. #define BGFX_STATE_DEPTH_TEST_SHIFT 4
  20. #define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) //!< Depth test state bit mask.
  21. #define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) //!<
  22. #define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) //!<
  23. #define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) //!<
  24. #define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) //!<
  25. #define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) //!<
  26. #define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) //!<
  27. #define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) //!<
  28. #define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) //!<
  29. #define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) //!<
  30. #define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) //!<
  31. #define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) //!<
  32. #define BGFX_STATE_BLEND_FACTOR UINT64_C(0x000000000000c000) //!<
  33. #define BGFX_STATE_BLEND_INV_FACTOR UINT64_C(0x000000000000d000) //!<
  34. #define BGFX_STATE_BLEND_SHIFT 12 //!< Blend state bit shift.
  35. #define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) //!< Blend state bit mask.
  36. #define BGFX_STATE_BLEND_EQUATION_ADD UINT64_C(0x0000000000000000) //!<
  37. #define BGFX_STATE_BLEND_EQUATION_SUB UINT64_C(0x0000000010000000) //!<
  38. #define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000) //!<
  39. #define BGFX_STATE_BLEND_EQUATION_MIN UINT64_C(0x0000000030000000) //!<
  40. #define BGFX_STATE_BLEND_EQUATION_MAX UINT64_C(0x0000000040000000) //!<
  41. #define BGFX_STATE_BLEND_EQUATION_SHIFT 28 //!< Blend equation bit shift.
  42. #define BGFX_STATE_BLEND_EQUATION_MASK UINT64_C(0x00000003f0000000) //!< Blend equation bit mask.
  43. #define BGFX_STATE_BLEND_INDEPENDENT UINT64_C(0x0000000400000000) //!< Enable blend independent.
  44. #define BGFX_STATE_CULL_CW UINT64_C(0x0000001000000000) //!< Cull clockwise triangles.
  45. #define BGFX_STATE_CULL_CCW UINT64_C(0x0000002000000000) //!< Cull counter-clockwise triangles.
  46. #define BGFX_STATE_CULL_SHIFT 36 //!< Culling mode bit shift.
  47. #define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) //!< Culling mode bit mask.
  48. #define BGFX_STATE_ALPHA_REF_SHIFT 40 //!<
  49. #define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x0000ff0000000000) //!<
  50. #define BGFX_STATE_PT_TRISTRIP UINT64_C(0x0001000000000000) //!< Tristrip.
  51. #define BGFX_STATE_PT_LINES UINT64_C(0x0002000000000000) //!< Lines.
  52. #define BGFX_STATE_PT_LINESTRIP UINT64_C(0x0003000000000000) //!< Line strip.
  53. #define BGFX_STATE_PT_POINTS UINT64_C(0x0004000000000000) //!< Points.
  54. #define BGFX_STATE_PT_SHIFT 48 //!< Primitive type bit shift.
  55. #define BGFX_STATE_PT_MASK UINT64_C(0x0007000000000000) //!< Primitive type bit mask.
  56. #define BGFX_STATE_POINT_SIZE_SHIFT 52 //!<
  57. #define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x0ff0000000000000) //!<
  58. /// Enable MSAA write when writing into MSAA frame buffer. This flag is ignored when not writing into
  59. /// MSAA frame buffer.
  60. #define BGFX_STATE_MSAA UINT64_C(0x1000000000000000) //!<
  61. #define BGFX_STATE_RESERVED_MASK UINT64_C(0xe000000000000000) //!<
  62. #define BGFX_STATE_NONE UINT64_C(0x0000000000000000) //!<
  63. #define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) //!<
  64. /// Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
  65. /// culling and MSAA (when writting into MSAA frame buffer, otherwise this flag is ignored).
  66. #define BGFX_STATE_DEFAULT (0 \
  67. | BGFX_STATE_RGB_WRITE \
  68. | BGFX_STATE_ALPHA_WRITE \
  69. | BGFX_STATE_DEPTH_TEST_LESS \
  70. | BGFX_STATE_DEPTH_WRITE \
  71. | BGFX_STATE_CULL_CW \
  72. | BGFX_STATE_MSAA \
  73. )
  74. #define BGFX_STATE_ALPHA_REF(_ref) ( ( (uint64_t)(_ref )<<BGFX_STATE_ALPHA_REF_SHIFT )&BGFX_STATE_ALPHA_REF_MASK)
  75. #define BGFX_STATE_POINT_SIZE(_size) ( ( (uint64_t)(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
  76. ///
  77. #define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (UINT64_C(0) \
  78. | ( ( (uint64_t)(_srcRGB)|( (uint64_t)(_dstRGB)<<4) ) ) \
  79. | ( ( (uint64_t)(_srcA )|( (uint64_t)(_dstA )<<4) )<<8) \
  80. )
  81. #define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) ( (uint64_t)(_rgb)|( (uint64_t)(_a)<<3) )
  82. ///
  83. #define BGFX_STATE_BLEND_FUNC(_src, _dst) BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst)
  84. #define BGFX_STATE_BLEND_EQUATION(_equation) BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation)
  85. #define BGFX_STATE_BLEND_ADD (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) )
  86. #define BGFX_STATE_BLEND_ALPHA (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) )
  87. #define BGFX_STATE_BLEND_DARKEN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MIN) )
  88. #define BGFX_STATE_BLEND_LIGHTEN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MAX) )
  89. #define BGFX_STATE_BLEND_MULTIPLY (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO ) )
  90. #define BGFX_STATE_BLEND_NORMAL (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) )
  91. #define BGFX_STATE_BLEND_SCREEN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_COLOR) )
  92. #define BGFX_STATE_BLEND_LINEAR_BURN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_SUB) )
  93. ///
  94. #define BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) (0 \
  95. | ( uint32_t( (_src)>>BGFX_STATE_BLEND_SHIFT) \
  96. | ( uint32_t( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \
  97. )
  98. #define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \
  99. | BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \
  100. | ( uint32_t( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \
  101. )
  102. #define BGFX_STATE_BLEND_FUNC_RT_1(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<< 0)
  103. #define BGFX_STATE_BLEND_FUNC_RT_2(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<11)
  104. #define BGFX_STATE_BLEND_FUNC_RT_3(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<22)
  105. #define BGFX_STATE_BLEND_FUNC_RT_1E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<< 0)
  106. #define BGFX_STATE_BLEND_FUNC_RT_2E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<11)
  107. #define BGFX_STATE_BLEND_FUNC_RT_3E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<22)
  108. ///
  109. #define BGFX_STENCIL_FUNC_REF_SHIFT 0 //!<
  110. #define BGFX_STENCIL_FUNC_REF_MASK UINT32_C(0x000000ff) //!<
  111. #define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 //!<
  112. #define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) //!<
  113. #define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) //!< Enable stencil test, less.
  114. #define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) //!<
  115. #define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) //!<
  116. #define BGFX_STENCIL_TEST_GEQUAL UINT32_C(0x00040000) //!<
  117. #define BGFX_STENCIL_TEST_GREATER UINT32_C(0x00050000) //!<
  118. #define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) //!<
  119. #define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) //!<
  120. #define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) //!<
  121. #define BGFX_STENCIL_TEST_SHIFT 16 //!<
  122. #define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) //!<
  123. #define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) //!<
  124. #define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) //!<
  125. #define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) //!<
  126. #define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) //!<
  127. #define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) //!<
  128. #define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) //!<
  129. #define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) //!<
  130. #define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) //!<
  131. #define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 //!<
  132. #define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) //!<
  133. #define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) //!<
  134. #define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) //!<
  135. #define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) //!<
  136. #define BGFX_STENCIL_OP_FAIL_Z_INCR UINT32_C(0x03000000) //!<
  137. #define BGFX_STENCIL_OP_FAIL_Z_INCRSAT UINT32_C(0x04000000) //!<
  138. #define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) //!<
  139. #define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) //!<
  140. #define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) //!<
  141. #define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 //!<
  142. #define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) //!<
  143. #define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) //!<
  144. #define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) //!<
  145. #define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) //!<
  146. #define BGFX_STENCIL_OP_PASS_Z_INCR UINT32_C(0x30000000) //!<
  147. #define BGFX_STENCIL_OP_PASS_Z_INCRSAT UINT32_C(0x40000000) //!<
  148. #define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) //!<
  149. #define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) //!<
  150. #define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) //!<
  151. #define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 //!<
  152. #define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) //!<
  153. #define BGFX_STENCIL_NONE UINT32_C(0x00000000) //!<
  154. #define BGFX_STENCIL_MASK UINT32_C(0xffffffff) //!<
  155. #define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) //!<
  156. /// Set stencil ref value.
  157. #define BGFX_STENCIL_FUNC_REF(_ref) ( (uint32_t(_ref)<<BGFX_STENCIL_FUNC_REF_SHIFT)&BGFX_STENCIL_FUNC_REF_MASK)
  158. /// Set stencil rmask value.
  159. #define BGFX_STENCIL_FUNC_RMASK(_mask) ( (uint32_t(_mask)<<BGFX_STENCIL_FUNC_RMASK_SHIFT)&BGFX_STENCIL_FUNC_RMASK_MASK)
  160. ///
  161. #define BGFX_CLEAR_NONE UINT16_C(0x0000) //!< No clear flags.
  162. #define BGFX_CLEAR_COLOR UINT16_C(0x0001) //!< Clear color.
  163. #define BGFX_CLEAR_DEPTH UINT16_C(0x0002) //!< Clear depth.
  164. #define BGFX_CLEAR_STENCIL UINT16_C(0x0004) //!< Clear stencil.
  165. #define BGFX_CLEAR_DISCARD_COLOR_0 UINT16_C(0x0008) //!< Discard frame buffer attachment 0.
  166. #define BGFX_CLEAR_DISCARD_COLOR_1 UINT16_C(0x0010) //!< Discard frame buffer attachment 1.
  167. #define BGFX_CLEAR_DISCARD_COLOR_2 UINT16_C(0x0020) //!< Discard frame buffer attachment 2.
  168. #define BGFX_CLEAR_DISCARD_COLOR_3 UINT16_C(0x0040) //!< Discard frame buffer attachment 3.
  169. #define BGFX_CLEAR_DISCARD_COLOR_4 UINT16_C(0x0080) //!< Discard frame buffer attachment 4.
  170. #define BGFX_CLEAR_DISCARD_COLOR_5 UINT16_C(0x0100) //!< Discard frame buffer attachment 5.
  171. #define BGFX_CLEAR_DISCARD_COLOR_6 UINT16_C(0x0200) //!< Discard frame buffer attachment 6.
  172. #define BGFX_CLEAR_DISCARD_COLOR_7 UINT16_C(0x0400) //!< Discard frame buffer attachment 7.
  173. #define BGFX_CLEAR_DISCARD_DEPTH UINT16_C(0x0800) //!< Discard frame buffer depth attachment.
  174. #define BGFX_CLEAR_DISCARD_STENCIL UINT16_C(0x1000) //!< Discard frame buffer stencil attachment.
  175. #define BGFX_CLEAR_DISCARD_COLOR_MASK (0 \
  176. | BGFX_CLEAR_DISCARD_COLOR_0 \
  177. | BGFX_CLEAR_DISCARD_COLOR_1 \
  178. | BGFX_CLEAR_DISCARD_COLOR_2 \
  179. | BGFX_CLEAR_DISCARD_COLOR_3 \
  180. | BGFX_CLEAR_DISCARD_COLOR_4 \
  181. | BGFX_CLEAR_DISCARD_COLOR_5 \
  182. | BGFX_CLEAR_DISCARD_COLOR_6 \
  183. | BGFX_CLEAR_DISCARD_COLOR_7 \
  184. )
  185. #define BGFX_CLEAR_DISCARD_MASK (0 \
  186. | BGFX_CLEAR_DISCARD_COLOR_MASK \
  187. | BGFX_CLEAR_DISCARD_DEPTH \
  188. | BGFX_CLEAR_DISCARD_STENCIL \
  189. )
  190. #define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug.
  191. #define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives.
  192. #define BGFX_DEBUG_IFH UINT32_C(0x00000002) //!< Enable infinitely fast hardware test. No draw calls will be submitted to driver. It’s useful when profiling to quickly assess bottleneck between CPU and GPU.
  193. #define BGFX_DEBUG_STATS UINT32_C(0x00000004) //!< Enable statistics display.
  194. #define BGFX_DEBUG_TEXT UINT32_C(0x00000008) //!< Enable debug text display.
  195. ///
  196. #define BGFX_BUFFER_NONE UINT16_C(0x0000) //!<
  197. #define BGFX_BUFFER_COMPUTE_FORMAT_8x1 UINT16_C(0x0001) //!<
  198. #define BGFX_BUFFER_COMPUTE_FORMAT_8x2 UINT16_C(0x0002) //!<
  199. #define BGFX_BUFFER_COMPUTE_FORMAT_8x4 UINT16_C(0x0003) //!<
  200. #define BGFX_BUFFER_COMPUTE_FORMAT_16x1 UINT16_C(0x0004) //!<
  201. #define BGFX_BUFFER_COMPUTE_FORMAT_16x2 UINT16_C(0x0005) //!<
  202. #define BGFX_BUFFER_COMPUTE_FORMAT_16x4 UINT16_C(0x0006) //!<
  203. #define BGFX_BUFFER_COMPUTE_FORMAT_32x1 UINT16_C(0x0007) //!<
  204. #define BGFX_BUFFER_COMPUTE_FORMAT_32x2 UINT16_C(0x0008) //!<
  205. #define BGFX_BUFFER_COMPUTE_FORMAT_32x4 UINT16_C(0x0009) //!<
  206. #define BGFX_BUFFER_COMPUTE_FORMAT_SHIFT 0 //!<
  207. #define BGFX_BUFFER_COMPUTE_FORMAT_MASK UINT16_C(0x000f) //!<
  208. #define BGFX_BUFFER_COMPUTE_TYPE_UINT UINT16_C(0x0010) //!<
  209. #define BGFX_BUFFER_COMPUTE_TYPE_INT UINT16_C(0x0020) //!<
  210. #define BGFX_BUFFER_COMPUTE_TYPE_FLOAT UINT16_C(0x0030) //!<
  211. #define BGFX_BUFFER_COMPUTE_TYPE_SHIFT 4 //!<
  212. #define BGFX_BUFFER_COMPUTE_TYPE_MASK UINT16_C(0x0030) //!<
  213. #define BGFX_BUFFER_COMPUTE_READ UINT16_C(0x0100) //!<
  214. #define BGFX_BUFFER_COMPUTE_WRITE UINT16_C(0x0200) //!<
  215. #define BGFX_BUFFER_DRAW_INDIRECT UINT16_C(0x0400) //!<
  216. #define BGFX_BUFFER_ALLOW_RESIZE UINT16_C(0x0800) //!<
  217. #define BGFX_BUFFER_INDEX32 UINT16_C(0x1000) //!<
  218. #define BGFX_BUFFER_COMPUTE_READ_WRITE (0 \
  219. | BGFX_BUFFER_COMPUTE_READ \
  220. | BGFX_BUFFER_COMPUTE_WRITE \
  221. )
  222. ///
  223. #define BGFX_TEXTURE_NONE UINT32_C(0x00000000) //!<
  224. #define BGFX_TEXTURE_U_MIRROR UINT32_C(0x00000001) //!<
  225. #define BGFX_TEXTURE_U_CLAMP UINT32_C(0x00000002) //!<
  226. #define BGFX_TEXTURE_U_SHIFT 0 //!<
  227. #define BGFX_TEXTURE_U_MASK UINT32_C(0x00000003) //!<
  228. #define BGFX_TEXTURE_V_MIRROR UINT32_C(0x00000004) //!<
  229. #define BGFX_TEXTURE_V_CLAMP UINT32_C(0x00000008) //!<
  230. #define BGFX_TEXTURE_V_SHIFT 2 //!<
  231. #define BGFX_TEXTURE_V_MASK UINT32_C(0x0000000c) //!<
  232. #define BGFX_TEXTURE_W_MIRROR UINT32_C(0x00000010) //!<
  233. #define BGFX_TEXTURE_W_CLAMP UINT32_C(0x00000020) //!<
  234. #define BGFX_TEXTURE_W_SHIFT 4 //!<
  235. #define BGFX_TEXTURE_W_MASK UINT32_C(0x00000030) //!<
  236. #define BGFX_TEXTURE_MIN_POINT UINT32_C(0x00000040) //!<
  237. #define BGFX_TEXTURE_MIN_ANISOTROPIC UINT32_C(0x00000080) //!<
  238. #define BGFX_TEXTURE_MIN_SHIFT 6 //!<
  239. #define BGFX_TEXTURE_MIN_MASK UINT32_C(0x000000c0) //!<
  240. #define BGFX_TEXTURE_MAG_POINT UINT32_C(0x00000100) //!<
  241. #define BGFX_TEXTURE_MAG_ANISOTROPIC UINT32_C(0x00000200) //!<
  242. #define BGFX_TEXTURE_MAG_SHIFT 8 //!<
  243. #define BGFX_TEXTURE_MAG_MASK UINT32_C(0x00000300) //!<
  244. #define BGFX_TEXTURE_MIP_POINT UINT32_C(0x00000400) //!<
  245. #define BGFX_TEXTURE_MIP_SHIFT 10 //!<
  246. #define BGFX_TEXTURE_MIP_MASK UINT32_C(0x00000400) //!<
  247. #define BGFX_TEXTURE_RT UINT32_C(0x00001000) //!<
  248. #define BGFX_TEXTURE_RT_MSAA_X2 UINT32_C(0x00002000) //!<
  249. #define BGFX_TEXTURE_RT_MSAA_X4 UINT32_C(0x00003000) //!<
  250. #define BGFX_TEXTURE_RT_MSAA_X8 UINT32_C(0x00004000) //!<
  251. #define BGFX_TEXTURE_RT_MSAA_X16 UINT32_C(0x00005000) //!<
  252. #define BGFX_TEXTURE_RT_MSAA_SHIFT 12 //!<
  253. #define BGFX_TEXTURE_RT_MSAA_MASK UINT32_C(0x00007000) //!<
  254. #define BGFX_TEXTURE_RT_BUFFER_ONLY UINT32_C(0x00008000) //!<
  255. #define BGFX_TEXTURE_RT_MASK UINT32_C(0x0000f000) //!<
  256. #define BGFX_TEXTURE_COMPARE_LESS UINT32_C(0x00010000) //!<
  257. #define BGFX_TEXTURE_COMPARE_LEQUAL UINT32_C(0x00020000) //!<
  258. #define BGFX_TEXTURE_COMPARE_EQUAL UINT32_C(0x00030000) //!<
  259. #define BGFX_TEXTURE_COMPARE_GEQUAL UINT32_C(0x00040000) //!<
  260. #define BGFX_TEXTURE_COMPARE_GREATER UINT32_C(0x00050000) //!<
  261. #define BGFX_TEXTURE_COMPARE_NOTEQUAL UINT32_C(0x00060000) //!<
  262. #define BGFX_TEXTURE_COMPARE_NEVER UINT32_C(0x00070000) //!<
  263. #define BGFX_TEXTURE_COMPARE_ALWAYS UINT32_C(0x00080000) //!<
  264. #define BGFX_TEXTURE_COMPARE_SHIFT 16 //!<
  265. #define BGFX_TEXTURE_COMPARE_MASK UINT32_C(0x000f0000) //!<
  266. #define BGFX_TEXTURE_COMPUTE_WRITE UINT32_C(0x00100000) //!<
  267. #define BGFX_TEXTURE_SRGB UINT32_C(0x00200000) //!<
  268. #define BGFX_TEXTURE_RESERVED_SHIFT 24 //!<
  269. #define BGFX_TEXTURE_RESERVED_MASK UINT32_C(0xff000000) //!<
  270. #define BGFX_TEXTURE_SAMPLER_BITS_MASK (0 \
  271. | BGFX_TEXTURE_U_MASK \
  272. | BGFX_TEXTURE_V_MASK \
  273. | BGFX_TEXTURE_W_MASK \
  274. | BGFX_TEXTURE_MIN_MASK \
  275. | BGFX_TEXTURE_MAG_MASK \
  276. | BGFX_TEXTURE_MIP_MASK \
  277. | BGFX_TEXTURE_COMPARE_MASK \
  278. )
  279. ///
  280. #define BGFX_RESET_NONE UINT32_C(0x00000000) //!< No reset flags.
  281. #define BGFX_RESET_FULLSCREEN UINT32_C(0x00000001) //!< Not supported yet.
  282. #define BGFX_RESET_FULLSCREEN_SHIFT 0 //!< Fullscreen bit shift.
  283. #define BGFX_RESET_FULLSCREEN_MASK UINT32_C(0x00000001) //!< Fullscreen bit mask.
  284. #define BGFX_RESET_MSAA_X2 UINT32_C(0x00000010) //!< Enable 2x MSAA.
  285. #define BGFX_RESET_MSAA_X4 UINT32_C(0x00000020) //!< Enable 4x MSAA.
  286. #define BGFX_RESET_MSAA_X8 UINT32_C(0x00000030) //!< Enable 8x MSAA.
  287. #define BGFX_RESET_MSAA_X16 UINT32_C(0x00000040) //!< Enable 16x MSAA.
  288. #define BGFX_RESET_MSAA_SHIFT 4 //!< MSAA mode bit shift.
  289. #define BGFX_RESET_MSAA_MASK UINT32_C(0x00000070) //!< MSAA mode bit mask.
  290. #define BGFX_RESET_VSYNC UINT32_C(0x00000080) //!< Enable V-Sync.
  291. #define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy.
  292. #define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture.
  293. #define BGFX_RESET_HMD UINT32_C(0x00000400) //!< HMD stereo rendering.
  294. #define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800) //!< HMD stereo rendering debug mode.
  295. #define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000) //!< HMD calibration.
  296. #define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU.
  297. #define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) //!< This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  298. #define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer.
  299. #define BGFX_RESET_HIDPI UINT32_C(0x00010000) //!< Enable HiDPI rendering.
  300. ///
  301. #define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001) //!< Texture compare less equal mode is supported.
  302. #define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x0000000000000003) //!< All texture compare modes are supported.
  303. #define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000000004) //!< 3D textures are supported.
  304. #define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000000000008) //!< Vertex attribute half-float is supported.
  305. #define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000000000010) //!< Vertex attribute 10_10_10_2 is supported.
  306. #define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000000020) //!< Instancing is supported.
  307. #define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000000040) //!< Renderer is on separate thread.
  308. #define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000000000080) //!< Fragment depth is accessible in fragment shader.
  309. #define BGFX_CAPS_BLEND_INDEPENDENT UINT64_C(0x0000000000000100) //!< Blend independent is supported.
  310. #define BGFX_CAPS_COMPUTE UINT64_C(0x0000000000000200) //!< Compute shaders are supported.
  311. #define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000400) //!< Fragment ordering is available in fragment shader.
  312. #define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000000800) //!< Multiple windows are supported.
  313. #define BGFX_CAPS_HMD UINT64_C(0x0000000000001000) //!< Head Mounted Display is available.
  314. #define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000002000) //!< 32-bit indices are supported.
  315. #define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000004000) //!< Draw indirect is supported.
  316. #define BGFX_CAPS_HIDPI UINT64_C(0x0000000000008000) //!< HiDPI rendering is supported.
  317. ///
  318. #define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT8_C(0x00) //!< Texture format is not supported.
  319. #define BGFX_CAPS_FORMAT_TEXTURE_COLOR UINT8_C(0x01) //!< Texture format is supported.
  320. #define BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB UINT8_C(0x02) //!< Texture as sRGB format is supported.
  321. #define BGFX_CAPS_FORMAT_TEXTURE_EMULATED UINT8_C(0x04) //!< Texture format is emulated.
  322. #define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT8_C(0x08) //!< Texture format can be used from vertex shader.
  323. #define BGFX_CAPS_FORMAT_TEXTURE_IMAGE UINT8_C(0x10) //!< Texture format can be used as image from compute shader.
  324. #define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER UINT8_C(0x20) //!< Texture format can be used as frame buffer.
  325. ///
  326. #define BGFX_VIEW_NONE UINT8_C(0x00) //!<
  327. #define BGFX_VIEW_STEREO UINT8_C(0x01) //!<
  328. ///
  329. #define BGFX_SUBMIT_EYE_LEFT UINT8_C(0x01) //!<
  330. #define BGFX_SUBMIT_EYE_RIGHT UINT8_C(0x02) //!<
  331. #define BGFX_SUBMIT_EYE_MASK UINT8_C(0x03) //!<
  332. #define BGFX_SUBMIT_EYE_FIRST BGFX_SUBMIT_EYE_LEFT
  333. ///
  334. #define BGFX_PCI_ID_NONE UINT16_C(0x0000) //!< Autoselect adapter.
  335. #define BGFX_PCI_ID_SOFTWARE_RASTERIZER UINT16_C(0x0001) //!< Software rasterizer.
  336. #define BGFX_PCI_ID_AMD UINT16_C(0x1002) //!< AMD adapter.
  337. #define BGFX_PCI_ID_INTEL UINT16_C(0x8086) //!< Intel adapter.
  338. #define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de) //!< nVidia adapter.
  339. ///
  340. #define BGFX_HMD_NONE UINT8_C(0x00) //!< None.
  341. #define BGFX_HMD_DEVICE_RESOLUTION UINT8_C(0x01) //!< Has HMD native resolution.
  342. #define BGFX_HMD_RENDERING UINT8_C(0x02) //!< Rendering to HMD.
  343. #endif // BGFX_DEFINES_H_HEADER_GUARD