config.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. /*
  2. * Copyright 2011-2017 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/config.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_XBOXONE \
  35. ? 1 : 0)
  36. # endif // BGFX_CONFIG_RENDERER_DIRECT3D12
  37. # ifndef BGFX_CONFIG_RENDERER_METAL
  38. # define BGFX_CONFIG_RENDERER_METAL (0 \
  39. || (BX_PLATFORM_IOS && BX_CPU_ARM) \
  40. || (BX_PLATFORM_OSX >= 101100) \
  41. ? 1 : 0)
  42. # endif // BGFX_CONFIG_RENDERER_METAL
  43. # ifndef BGFX_CONFIG_RENDERER_OPENGL
  44. # define BGFX_CONFIG_RENDERER_OPENGL (0 \
  45. || BX_PLATFORM_BSD \
  46. || BX_PLATFORM_LINUX \
  47. || BX_PLATFORM_OSX \
  48. || BX_PLATFORM_WINDOWS \
  49. ? 1 : 0)
  50. # endif // BGFX_CONFIG_RENDERER_OPENGL
  51. # ifndef BGFX_CONFIG_RENDERER_OPENGLES
  52. # define BGFX_CONFIG_RENDERER_OPENGLES (0 \
  53. || BX_PLATFORM_ANDROID \
  54. || BX_PLATFORM_EMSCRIPTEN \
  55. || BX_PLATFORM_IOS \
  56. || BX_PLATFORM_QNX \
  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 directly. Must must be power of 2.
  173. #define BGFX_CONFIG_MAX_PROGRAMS (1<<BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM)
  174. #ifndef BGFX_CONFIG_MAX_VIEWS
  175. // Do not change. Must be power of 2.
  176. # define BGFX_CONFIG_MAX_VIEWS 256
  177. #endif // BGFX_CONFIG_MAX_VIEWS
  178. #define BGFX_CONFIG_MAX_VIEW_NAME_RESERVED 6
  179. #ifndef BGFX_CONFIG_MAX_VIEW_NAME
  180. # define BGFX_CONFIG_MAX_VIEW_NAME 256
  181. #endif // BGFX_CONFIG_MAX_VIEW_NAME
  182. #ifndef BGFX_CONFIG_MAX_VERTEX_DECLS
  183. # define BGFX_CONFIG_MAX_VERTEX_DECLS 64
  184. #endif // BGFX_CONFIG_MAX_VERTEX_DECLS
  185. #ifndef BGFX_CONFIG_MAX_INDEX_BUFFERS
  186. # define BGFX_CONFIG_MAX_INDEX_BUFFERS (4<<10)
  187. #endif // BGFX_CONFIG_MAX_INDEX_BUFFERS
  188. #ifndef BGFX_CONFIG_MAX_VERTEX_BUFFERS
  189. # define BGFX_CONFIG_MAX_VERTEX_BUFFERS (4<<10)
  190. #endif // BGFX_CONFIG_MAX_VERTEX_BUFFERS
  191. #ifndef BGFX_CONFIG_MAX_VERTEX_STREAMS
  192. # define BGFX_CONFIG_MAX_VERTEX_STREAMS 4
  193. #endif // BGFX_CONFIG_MAX_VERTEX_STREAMS
  194. #ifndef BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS
  195. # define BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS (4<<10)
  196. #endif // BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS
  197. #ifndef BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS
  198. # define BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS (4<<10)
  199. #endif // BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS
  200. #ifndef BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE
  201. # define BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE (1<<20)
  202. #endif // BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE
  203. #ifndef BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE
  204. # define BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE (3<<20)
  205. #endif // BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE
  206. #ifndef BGFX_CONFIG_MAX_SHADERS
  207. # define BGFX_CONFIG_MAX_SHADERS 512
  208. #endif // BGFX_CONFIG_MAX_FRAGMENT_SHADERS
  209. #ifndef BGFX_CONFIG_MAX_TEXTURES
  210. # define BGFX_CONFIG_MAX_TEXTURES (4<<10)
  211. #endif // BGFX_CONFIG_MAX_TEXTURES
  212. #ifndef BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
  213. # define BGFX_CONFIG_MAX_TEXTURE_SAMPLERS 16
  214. #endif // BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
  215. #ifndef BGFX_CONFIG_MAX_FRAME_BUFFERS
  216. # define BGFX_CONFIG_MAX_FRAME_BUFFERS 128
  217. #endif // BGFX_CONFIG_MAX_FRAME_BUFFERS
  218. #ifndef BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
  219. # define BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS 8
  220. #endif // BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
  221. #ifndef BGFX_CONFIG_MAX_UNIFORMS
  222. # define BGFX_CONFIG_MAX_UNIFORMS 512
  223. #endif // BGFX_CONFIG_MAX_UNIFORMS
  224. #ifndef BGFX_CONFIG_MAX_OCCLUSION_QUERIES
  225. # define BGFX_CONFIG_MAX_OCCLUSION_QUERIES 256
  226. #endif // BGFX_CONFIG_MAX_OCCLUSION_QUERIES
  227. #ifndef BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE
  228. # define BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE (64<<10)
  229. #endif // BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE
  230. #ifndef BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE
  231. # define BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE (6<<20)
  232. #endif // BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE
  233. #ifndef BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE
  234. # define BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE (2<<20)
  235. #endif // BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE
  236. #ifndef BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT
  237. # define BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT 5
  238. #endif // BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT
  239. #ifndef BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE
  240. # define BGFX_CONFIG_MAX_COLOR_PALETTE 16
  241. #endif // BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE
  242. #define BGFX_CONFIG_DRAW_INDIRECT_STRIDE 32
  243. #ifndef BGFX_CONFIG_PROFILER
  244. # define BGFX_CONFIG_PROFILER 0
  245. #endif // BGFX_CONFIG_PROFILER
  246. #ifndef BGFX_CONFIG_RENDERDOC_LOG_FILEPATH
  247. # define BGFX_CONFIG_RENDERDOC_LOG_FILEPATH "temp/bgfx"
  248. #endif // BGFX_CONFIG_RENDERDOC_LOG_FILEPATH
  249. #ifndef BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS
  250. # define BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS { eRENDERDOC_Key_F11 }
  251. #endif // BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS
  252. #ifndef BGFX_CONFIG_API_SEMAPHORE_TIMEOUT
  253. # define BGFX_CONFIG_API_SEMAPHORE_TIMEOUT (5000)
  254. #endif // BGFX_CONFIG_API_SEMAPHORE_TIMEOUT
  255. #ifndef BGFX_CONFIG_MIP_LOD_BIAS
  256. # define BGFX_CONFIG_MIP_LOD_BIAS 0
  257. #endif // BGFX_CONFIG_MIP_LOD_BIAS
  258. #ifndef BGFX_CONFIG_MAX_ENCODERS
  259. # define BGFX_CONFIG_MAX_ENCODERS ( (0 != BGFX_CONFIG_MULTITHREADED) ? 8 : 1)
  260. #endif // BGFX_CONFIG_MAX_ENCODERS
  261. #endif // BGFX_CONFIG_H_HEADER_GUARD