config.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef BGFX_CONFIG_H_HEADER_GUARD
  6. #define BGFX_CONFIG_H_HEADER_GUARD
  7. #include <bx/bx.h>
  8. #ifndef BGFX_CONFIG_DEBUG
  9. # define BGFX_CONFIG_DEBUG 0
  10. #endif // BGFX_CONFIG_DEBUG
  11. #if !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \
  12. && !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \
  13. && !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \
  14. && !defined(BGFX_CONFIG_RENDERER_METAL) \
  15. && !defined(BGFX_CONFIG_RENDERER_OPENGL) \
  16. && !defined(BGFX_CONFIG_RENDERER_OPENGLES) \
  17. && !defined(BGFX_CONFIG_RENDERER_VULKAN) \
  18. && !defined(BGFX_CONFIG_RENDERER_GNM)
  19. # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9
  20. # define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \
  21. || BX_PLATFORM_WINDOWS \
  22. ? 1 : 0)
  23. # endif // BGFX_CONFIG_RENDERER_DIRECT3D9
  24. # ifndef BGFX_CONFIG_RENDERER_DIRECT3D11
  25. # define BGFX_CONFIG_RENDERER_DIRECT3D11 (0 \
  26. || BX_PLATFORM_WINDOWS \
  27. || BX_PLATFORM_WINRT \
  28. || BX_PLATFORM_XBOXONE \
  29. ? 1 : 0)
  30. # endif // BGFX_CONFIG_RENDERER_DIRECT3D11
  31. # ifndef BGFX_CONFIG_RENDERER_DIRECT3D12
  32. # define BGFX_CONFIG_RENDERER_DIRECT3D12 (0 \
  33. || BX_PLATFORM_WINDOWS \
  34. || BX_PLATFORM_WINRT \
  35. || BX_PLATFORM_XBOXONE \
  36. ? 1 : 0)
  37. # endif // BGFX_CONFIG_RENDERER_DIRECT3D12
  38. # ifndef BGFX_CONFIG_RENDERER_METAL
  39. # define BGFX_CONFIG_RENDERER_METAL (0 \
  40. || (BX_PLATFORM_IOS && BX_CPU_ARM) \
  41. || (BX_PLATFORM_OSX >= 101100) \
  42. ? 1 : 0)
  43. # endif // BGFX_CONFIG_RENDERER_METAL
  44. # ifndef BGFX_CONFIG_RENDERER_OPENGL
  45. # define BGFX_CONFIG_RENDERER_OPENGL (0 \
  46. || BX_PLATFORM_BSD \
  47. || BX_PLATFORM_LINUX \
  48. || BX_PLATFORM_OSX \
  49. || BX_PLATFORM_WINDOWS \
  50. ? 1 : 0)
  51. # endif // BGFX_CONFIG_RENDERER_OPENGL
  52. # ifndef BGFX_CONFIG_RENDERER_OPENGLES
  53. # define BGFX_CONFIG_RENDERER_OPENGLES (0 \
  54. || BX_PLATFORM_ANDROID \
  55. || BX_PLATFORM_EMSCRIPTEN \
  56. || BX_PLATFORM_IOS \
  57. || BX_PLATFORM_RPI \
  58. || BX_PLATFORM_STEAMLINK \
  59. || BX_PLATFORM_NX \
  60. ? 1 : 0)
  61. # endif // BGFX_CONFIG_RENDERER_OPENGLES
  62. # ifndef BGFX_CONFIG_RENDERER_VULKAN
  63. # define BGFX_CONFIG_RENDERER_VULKAN (0 \
  64. || BX_PLATFORM_ANDROID \
  65. || BX_PLATFORM_LINUX \
  66. || BX_PLATFORM_WINDOWS \
  67. || BX_PLATFORM_NX \
  68. ? 1 : 0)
  69. # endif // BGFX_CONFIG_RENDERER_VULKAN
  70. # ifndef BGFX_CONFIG_RENDERER_GNM
  71. # define BGFX_CONFIG_RENDERER_GNM (0 \
  72. || BX_PLATFORM_PS4 \
  73. ? 1 : 0)
  74. # endif // BGFX_CONFIG_RENDERER_GNM
  75. #else
  76. # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9
  77. # define BGFX_CONFIG_RENDERER_DIRECT3D9 0
  78. # endif // BGFX_CONFIG_RENDERER_DIRECT3D9
  79. # ifndef BGFX_CONFIG_RENDERER_DIRECT3D11
  80. # define BGFX_CONFIG_RENDERER_DIRECT3D11 0
  81. # endif // BGFX_CONFIG_RENDERER_DIRECT3D11
  82. # ifndef BGFX_CONFIG_RENDERER_DIRECT3D12
  83. # define BGFX_CONFIG_RENDERER_DIRECT3D12 0
  84. # endif // BGFX_CONFIG_RENDERER_DIRECT3D12
  85. # ifndef BGFX_CONFIG_RENDERER_METAL
  86. # define BGFX_CONFIG_RENDERER_METAL 0
  87. # endif // BGFX_CONFIG_RENDERER_METAL
  88. # ifndef BGFX_CONFIG_RENDERER_OPENGL
  89. # define BGFX_CONFIG_RENDERER_OPENGL 0
  90. # endif // BGFX_CONFIG_RENDERER_OPENGL
  91. # ifndef BGFX_CONFIG_RENDERER_OPENGLES
  92. # define BGFX_CONFIG_RENDERER_OPENGLES 0
  93. # endif // BGFX_CONFIG_RENDERER_OPENGLES
  94. # ifndef BGFX_CONFIG_RENDERER_VULKAN
  95. # define BGFX_CONFIG_RENDERER_VULKAN 0
  96. # endif // BGFX_CONFIG_RENDERER_VULKAN
  97. # ifndef BGFX_CONFIG_RENDERER_GNM
  98. # define BGFX_CONFIG_RENDERER_GNM 0
  99. # endif // BGFX_CONFIG_RENDERER_GNM
  100. #endif // !defined...
  101. #if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 21
  102. # undef BGFX_CONFIG_RENDERER_OPENGL
  103. # define BGFX_CONFIG_RENDERER_OPENGL 21
  104. #endif // BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 21
  105. #if BGFX_CONFIG_RENDERER_OPENGLES && BGFX_CONFIG_RENDERER_OPENGLES < 20
  106. # undef BGFX_CONFIG_RENDERER_OPENGLES
  107. # define BGFX_CONFIG_RENDERER_OPENGLES 20
  108. #endif // BGFX_CONFIG_RENDERER_OPENGLES && BGFX_CONFIG_RENDERER_OPENGLES < 20
  109. #if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGLES
  110. # error "Can't define both BGFX_CONFIG_RENDERER_OPENGL and BGFX_CONFIG_RENDERER_OPENGLES"
  111. #endif // BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGLES
  112. /// Enable use of extensions.
  113. #ifndef BGFX_CONFIG_RENDERER_USE_EXTENSIONS
  114. # define BGFX_CONFIG_RENDERER_USE_EXTENSIONS 1
  115. #endif // BGFX_CONFIG_RENDERER_USE_EXTENSIONS
  116. /// Enable use of tinystl.
  117. #ifndef BGFX_CONFIG_USE_TINYSTL
  118. # define BGFX_CONFIG_USE_TINYSTL 1
  119. #endif // BGFX_CONFIG_USE_TINYSTL
  120. /// Enable OculusVR integration.
  121. #ifndef BGFX_CONFIG_USE_OVR
  122. # define BGFX_CONFIG_USE_OVR 0
  123. #endif // BGFX_CONFIG_USE_OVR
  124. /// Enable nVidia PerfHUD integration.
  125. #ifndef BGFX_CONFIG_DEBUG_PERFHUD
  126. # define BGFX_CONFIG_DEBUG_PERFHUD 0
  127. #endif // BGFX_CONFIG_DEBUG_NVPERFHUD
  128. /// Enable PIX markers.
  129. #ifndef BGFX_CONFIG_DEBUG_PIX
  130. # define BGFX_CONFIG_DEBUG_PIX BGFX_CONFIG_DEBUG
  131. #endif // BGFX_CONFIG_DEBUG_PIX
  132. /// Enable DX11 object names.
  133. #ifndef BGFX_CONFIG_DEBUG_OBJECT_NAME
  134. # define BGFX_CONFIG_DEBUG_OBJECT_NAME BGFX_CONFIG_DEBUG
  135. #endif // BGFX_CONFIG_DEBUG_OBJECT_NAME
  136. /// Enable Metal markers.
  137. #ifndef BGFX_CONFIG_DEBUG_MTL
  138. # define BGFX_CONFIG_DEBUG_MTL BGFX_CONFIG_DEBUG
  139. #endif // BGFX_CONFIG_DEBUG_MTL
  140. /// Enable uniform debug checks.
  141. #ifndef BGFX_CONFIG_DEBUG_UNIFORM
  142. # define BGFX_CONFIG_DEBUG_UNIFORM BGFX_CONFIG_DEBUG
  143. #endif // BGFX_CONFIG_DEBUG_UNIFORM
  144. /// Enable occlusion debug checks.
  145. #ifndef BGFX_CONFIG_DEBUG_OCCLUSION
  146. # define BGFX_CONFIG_DEBUG_OCCLUSION BGFX_CONFIG_DEBUG
  147. #endif // BGFX_CONFIG_DEBUG_OCCLUSION
  148. #ifndef BGFX_CONFIG_MULTITHREADED
  149. # define BGFX_CONFIG_MULTITHREADED ( (0 == BX_PLATFORM_EMSCRIPTEN) ? 1 : 0)
  150. #endif // BGFX_CONFIG_MULTITHREADED
  151. #ifndef BGFX_CONFIG_MAX_DRAW_CALLS
  152. # define BGFX_CONFIG_MAX_DRAW_CALLS ( (64<<10)-1)
  153. #endif // BGFX_CONFIG_MAX_DRAW_CALLS
  154. #ifndef BGFX_CONFIG_MAX_BLIT_ITEMS
  155. # define BGFX_CONFIG_MAX_BLIT_ITEMS (1<<10)
  156. #endif // BGFX_CONFIG_MAX_BLIT_ITEMS
  157. #ifndef BGFX_CONFIG_MAX_MATRIX_CACHE
  158. # define BGFX_CONFIG_MAX_MATRIX_CACHE (BGFX_CONFIG_MAX_DRAW_CALLS+1)
  159. #endif // BGFX_CONFIG_MAX_MATRIX_CACHE
  160. #ifndef BGFX_CONFIG_MAX_RECT_CACHE
  161. # define BGFX_CONFIG_MAX_RECT_CACHE (4<<10)
  162. #endif // BGFX_CONFIG_MAX_RECT_CACHE
  163. #ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH
  164. # define BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH 32
  165. #endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH
  166. #ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ
  167. # define BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ 20
  168. #endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ
  169. #ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM
  170. # define BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM 9
  171. #endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM
  172. // Cannot be configured via compiler options.
  173. #define BGFX_CONFIG_MAX_PROGRAMS (1<<BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM)
  174. BX_STATIC_ASSERT(bx::isPowerOf2(BGFX_CONFIG_MAX_PROGRAMS), "BGFX_CONFIG_MAX_PROGRAMS must be power of 2.");
  175. #ifndef BGFX_CONFIG_MAX_VIEWS
  176. # define BGFX_CONFIG_MAX_VIEWS 256
  177. #endif // BGFX_CONFIG_MAX_VIEWS
  178. BX_STATIC_ASSERT(bx::isPowerOf2(BGFX_CONFIG_MAX_VIEWS), "BGFX_CONFIG_MAX_VIEWS must be power of 2.");
  179. #define BGFX_CONFIG_MAX_VIEW_NAME_RESERVED 6
  180. #ifndef BGFX_CONFIG_MAX_VIEW_NAME
  181. # define BGFX_CONFIG_MAX_VIEW_NAME 256
  182. #endif // BGFX_CONFIG_MAX_VIEW_NAME
  183. #ifndef BGFX_CONFIG_MAX_VERTEX_DECLS
  184. # define BGFX_CONFIG_MAX_VERTEX_DECLS 64
  185. #endif // BGFX_CONFIG_MAX_VERTEX_DECLS
  186. #ifndef BGFX_CONFIG_MAX_INDEX_BUFFERS
  187. # define BGFX_CONFIG_MAX_INDEX_BUFFERS (4<<10)
  188. #endif // BGFX_CONFIG_MAX_INDEX_BUFFERS
  189. #ifndef BGFX_CONFIG_MAX_VERTEX_BUFFERS
  190. # define BGFX_CONFIG_MAX_VERTEX_BUFFERS (4<<10)
  191. #endif // BGFX_CONFIG_MAX_VERTEX_BUFFERS
  192. #ifndef BGFX_CONFIG_MAX_VERTEX_STREAMS
  193. # define BGFX_CONFIG_MAX_VERTEX_STREAMS 4
  194. #endif // BGFX_CONFIG_MAX_VERTEX_STREAMS
  195. #ifndef BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS
  196. # define BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS (4<<10)
  197. #endif // BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS
  198. #ifndef BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS
  199. # define BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS (4<<10)
  200. #endif // BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS
  201. #ifndef BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE
  202. # define BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE (1<<20)
  203. #endif // BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE
  204. #ifndef BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE
  205. # define BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE (3<<20)
  206. #endif // BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE
  207. #ifndef BGFX_CONFIG_MAX_SHADERS
  208. # define BGFX_CONFIG_MAX_SHADERS 512
  209. #endif // BGFX_CONFIG_MAX_FRAGMENT_SHADERS
  210. #ifndef BGFX_CONFIG_MAX_TEXTURES
  211. # define BGFX_CONFIG_MAX_TEXTURES (4<<10)
  212. #endif // BGFX_CONFIG_MAX_TEXTURES
  213. #ifndef BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
  214. # define BGFX_CONFIG_MAX_TEXTURE_SAMPLERS 16
  215. #endif // BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
  216. #ifndef BGFX_CONFIG_MAX_FRAME_BUFFERS
  217. # define BGFX_CONFIG_MAX_FRAME_BUFFERS 128
  218. #endif // BGFX_CONFIG_MAX_FRAME_BUFFERS
  219. #ifndef BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
  220. # define BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS 8
  221. #endif // BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
  222. #ifndef BGFX_CONFIG_MAX_UNIFORMS
  223. # define BGFX_CONFIG_MAX_UNIFORMS 512
  224. #endif // BGFX_CONFIG_MAX_UNIFORMS
  225. #ifndef BGFX_CONFIG_MAX_OCCLUSION_QUERIES
  226. # define BGFX_CONFIG_MAX_OCCLUSION_QUERIES 256
  227. #endif // BGFX_CONFIG_MAX_OCCLUSION_QUERIES
  228. #ifndef BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE
  229. # define BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE (64<<10)
  230. #endif // BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE
  231. #ifndef BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE
  232. # define BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE (6<<20)
  233. #endif // BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE
  234. #ifndef BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE
  235. # define BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE (2<<20)
  236. #endif // BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE
  237. #ifndef BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT
  238. # define BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT 5
  239. #endif // BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT
  240. #ifndef BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE
  241. # define BGFX_CONFIG_MAX_COLOR_PALETTE 16
  242. #endif // BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE
  243. #define BGFX_CONFIG_DRAW_INDIRECT_STRIDE 32
  244. #ifndef BGFX_CONFIG_PROFILER
  245. # define BGFX_CONFIG_PROFILER 0
  246. #endif // BGFX_CONFIG_PROFILER
  247. #ifndef BGFX_CONFIG_RENDERDOC_LOG_FILEPATH
  248. # define BGFX_CONFIG_RENDERDOC_LOG_FILEPATH "temp/bgfx"
  249. #endif // BGFX_CONFIG_RENDERDOC_LOG_FILEPATH
  250. #ifndef BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS
  251. # define BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS { eRENDERDOC_Key_F11 }
  252. #endif // BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS
  253. #ifndef BGFX_CONFIG_API_SEMAPHORE_TIMEOUT
  254. # define BGFX_CONFIG_API_SEMAPHORE_TIMEOUT (5000)
  255. #endif // BGFX_CONFIG_API_SEMAPHORE_TIMEOUT
  256. #ifndef BGFX_CONFIG_MIP_LOD_BIAS
  257. # define BGFX_CONFIG_MIP_LOD_BIAS 0
  258. #endif // BGFX_CONFIG_MIP_LOD_BIAS
  259. #ifndef BGFX_CONFIG_MAX_ENCODERS
  260. # define BGFX_CONFIG_MAX_ENCODERS ( (0 != BGFX_CONFIG_MULTITHREADED) ? 8 : 1)
  261. #endif // BGFX_CONFIG_MAX_ENCODERS
  262. #endif // BGFX_CONFIG_H_HEADER_GUARD