types.d 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  1. /*
  2. *
  3. * AUTO GENERATED! DO NOT EDIT!
  4. *
  5. */
  6. module bindbc.bgfx.types;
  7. public import core.stdc.stdarg : va_list;
  8. enum expandEnum(EnumType, string fqnEnumType = EnumType.stringof) = (){
  9. string expandEnum;
  10. foreach(m; __traits(allMembers, EnumType)){
  11. expandEnum ~= "alias " ~ m ~ " = " ~ fqnEnumType ~ "." ~ m ~ ";";
  12. }
  13. return expandEnum;
  14. }();
  15. extern(C) @nogc nothrow:
  16. enum uint BGFX_API_VERSION = 118;
  17. alias bgfx_view_id_t = ushort;
  18. //NOTE: TEMPORARY fix to some missing preprocessor function-macros...
  19. static BGFX_STATE_BLEND_FUNC_SEPARATE(ulong _srcRGB, ulong _dstRGB, ulong _srcA, ulong _dstA){
  20. return (0UL
  21. | ( ( cast(ulong)_srcRGB | ( cast(ulong)_dstRGB<<4) ) )
  22. | ( ( cast(ulong)_srcA | ( cast(ulong)_dstA <<4) )<<8)
  23. );
  24. }
  25. /// Blend equation separate.
  26. static BGFX_STATE_BLEND_EQUATION_SEPARATE(ulong _equationRGB, ulong _equationA){ return ( cast(ulong)_equationRGB | (cast(ulong)_equationA<<3) ); }
  27. /// Blend function.
  28. static BGFX_STATE_BLEND_FUNC(ulong _src, ulong _dst){ return BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst); }
  29. /// Blend equation.
  30. static BGFX_STATE_BLEND_EQUATION(ulong _equation){ return BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation); }
  31. /// Utility predefined blend modes.
  32. /// Additive blending.
  33. static BGFX_STATE_BLEND_ADD(){ return (0 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE)); }
  34. /// Alpha blend.
  35. static BGFX_STATE_BLEND_ALPHA(){ return (0 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)); }
  36. /// Memory release callback.
  37. /// Color RGB/alpha/depth write. When it's not specified write will be disabled.
  38. enum ulong BGFX_STATE_WRITE_R = 0x0000000000000001; /// Enable R write.
  39. enum ulong BGFX_STATE_WRITE_G = 0x0000000000000002; /// Enable G write.
  40. enum ulong BGFX_STATE_WRITE_B = 0x0000000000000004; /// Enable B write.
  41. enum ulong BGFX_STATE_WRITE_A = 0x0000000000000008; /// Enable alpha write.
  42. enum ulong BGFX_STATE_WRITE_Z = 0x0000004000000000; /// Enable depth write.
  43. enum ulong BGFX_STATE_WRITE_RGB = 0x0000000000000007; /// Enable RGB write.
  44. enum ulong BGFX_STATE_WRITE_MASK = 0x000000400000000f; /// Write all channels mask.
  45. /// Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled.
  46. enum ulong BGFX_STATE_DEPTH_TEST_LESS = 0x0000000000000010; /// Enable depth test, less.
  47. enum ulong BGFX_STATE_DEPTH_TEST_LEQUAL = 0x0000000000000020; /// Enable depth test, less or equal.
  48. enum ulong BGFX_STATE_DEPTH_TEST_EQUAL = 0x0000000000000030; /// Enable depth test, equal.
  49. enum ulong BGFX_STATE_DEPTH_TEST_GEQUAL = 0x0000000000000040; /// Enable depth test, greater or equal.
  50. enum ulong BGFX_STATE_DEPTH_TEST_GREATER = 0x0000000000000050; /// Enable depth test, greater.
  51. enum ulong BGFX_STATE_DEPTH_TEST_NOTEQUAL = 0x0000000000000060; /// Enable depth test, not equal.
  52. enum ulong BGFX_STATE_DEPTH_TEST_NEVER = 0x0000000000000070; /// Enable depth test, never.
  53. enum ulong BGFX_STATE_DEPTH_TEST_ALWAYS = 0x0000000000000080; /// Enable depth test, always.
  54. enum ulong BGFX_STATE_DEPTH_TEST_SHIFT = 4; /// Depth test state bit shift
  55. enum ulong BGFX_STATE_DEPTH_TEST_MASK = 0x00000000000000f0; /// Depth test state bit mask
  56. /**
  57. * Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
  58. * helper macros.
  59. */
  60. enum ulong BGFX_STATE_BLEND_ZERO = 0x0000000000001000; /// 0, 0, 0, 0
  61. enum ulong BGFX_STATE_BLEND_ONE = 0x0000000000002000; /// 1, 1, 1, 1
  62. enum ulong BGFX_STATE_BLEND_SRC_COLOR = 0x0000000000003000; /// Rs, Gs, Bs, As
  63. enum ulong BGFX_STATE_BLEND_INV_SRC_COLOR = 0x0000000000004000; /// 1-Rs, 1-Gs, 1-Bs, 1-As
  64. enum ulong BGFX_STATE_BLEND_SRC_ALPHA = 0x0000000000005000; /// As, As, As, As
  65. enum ulong BGFX_STATE_BLEND_INV_SRC_ALPHA = 0x0000000000006000; /// 1-As, 1-As, 1-As, 1-As
  66. enum ulong BGFX_STATE_BLEND_DST_ALPHA = 0x0000000000007000; /// Ad, Ad, Ad, Ad
  67. enum ulong BGFX_STATE_BLEND_INV_DST_ALPHA = 0x0000000000008000; /// 1-Ad, 1-Ad, 1-Ad ,1-Ad
  68. enum ulong BGFX_STATE_BLEND_DST_COLOR = 0x0000000000009000; /// Rd, Gd, Bd, Ad
  69. enum ulong BGFX_STATE_BLEND_INV_DST_COLOR = 0x000000000000a000; /// 1-Rd, 1-Gd, 1-Bd, 1-Ad
  70. enum ulong BGFX_STATE_BLEND_SRC_ALPHA_SAT = 0x000000000000b000; /// f, f, f, 1; f = min(As, 1-Ad)
  71. enum ulong BGFX_STATE_BLEND_FACTOR = 0x000000000000c000; /// Blend factor
  72. enum ulong BGFX_STATE_BLEND_INV_FACTOR = 0x000000000000d000; /// 1-Blend factor
  73. enum ulong BGFX_STATE_BLEND_SHIFT = 12; /// Blend state bit shift
  74. enum ulong BGFX_STATE_BLEND_MASK = 0x000000000ffff000; /// Blend state bit mask
  75. /**
  76. * Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
  77. * helper macros.
  78. */
  79. enum ulong BGFX_STATE_BLEND_EQUATION_ADD = 0x0000000000000000; /// Blend add: src + dst.
  80. enum ulong BGFX_STATE_BLEND_EQUATION_SUB = 0x0000000010000000; /// Blend subtract: src - dst.
  81. enum ulong BGFX_STATE_BLEND_EQUATION_REVSUB = 0x0000000020000000; /// Blend reverse subtract: dst - src.
  82. enum ulong BGFX_STATE_BLEND_EQUATION_MIN = 0x0000000030000000; /// Blend min: min(src, dst).
  83. enum ulong BGFX_STATE_BLEND_EQUATION_MAX = 0x0000000040000000; /// Blend max: max(src, dst).
  84. enum ulong BGFX_STATE_BLEND_EQUATION_SHIFT = 28; /// Blend equation bit shift
  85. enum ulong BGFX_STATE_BLEND_EQUATION_MASK = 0x00000003f0000000; /// Blend equation bit mask
  86. /// Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled.
  87. enum ulong BGFX_STATE_CULL_CW = 0x0000001000000000; /// Cull clockwise triangles.
  88. enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; /// Cull counter-clockwise triangles.
  89. enum ulong BGFX_STATE_CULL_SHIFT = 36; /// Culling mode bit shift
  90. enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; /// Culling mode bit mask
  91. /// Alpha reference value.
  92. enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift
  93. enum ulong BGFX_STATE_ALPHA_REF_MASK = 0x0000ff0000000000; /// Alpha reference bit mask
  94. ulong BGFX_STATE_ALPHA_REF (ulong v) { return (v << BGFX_STATE_ALPHA_REF_SHIFT) & BGFX_STATE_ALPHA_REF_MASK; }
  95. enum ulong BGFX_STATE_PT_TRISTRIP = 0x0001000000000000; /// Tristrip.
  96. enum ulong BGFX_STATE_PT_LINES = 0x0002000000000000; /// Lines.
  97. enum ulong BGFX_STATE_PT_LINESTRIP = 0x0003000000000000; /// Line strip.
  98. enum ulong BGFX_STATE_PT_POINTS = 0x0004000000000000; /// Points.
  99. enum ulong BGFX_STATE_PT_SHIFT = 48; /// Primitive type bit shift
  100. enum ulong BGFX_STATE_PT_MASK = 0x0007000000000000; /// Primitive type bit mask
  101. /// Point size value.
  102. enum ulong BGFX_STATE_POINT_SIZE_SHIFT = 52; /// Point size bit shift
  103. enum ulong BGFX_STATE_POINT_SIZE_MASK = 0x00f0000000000000; /// Point size bit mask
  104. ulong BGFX_STATE_POINT_SIZE (ulong v) { return (v << BGFX_STATE_POINT_SIZE_SHIFT) & BGFX_STATE_POINT_SIZE_MASK; }
  105. /**
  106. * Enable MSAA write when writing into MSAA frame buffer.
  107. * This flag is ignored when not writing into MSAA frame buffer.
  108. */
  109. enum ulong BGFX_STATE_MSAA = 0x0100000000000000; /// Enable MSAA rasterization.
  110. enum ulong BGFX_STATE_LINEAA = 0x0200000000000000; /// Enable line AA rasterization.
  111. enum ulong BGFX_STATE_CONSERVATIVE_RASTER = 0x0400000000000000; /// Enable conservative rasterization.
  112. enum ulong BGFX_STATE_NONE = 0x0000000000000000; /// No state.
  113. enum ulong BGFX_STATE_FRONT_CCW = 0x0000008000000000; /// Front counter-clockwise (default is clockwise).
  114. enum ulong BGFX_STATE_BLEND_INDEPENDENT = 0x0000000400000000; /// Enable blend independent.
  115. enum ulong BGFX_STATE_BLEND_ALPHA_TO_COVERAGE = 0x0000000800000000; /// Enable alpha to coverage.
  116. /**
  117. * Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
  118. * culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored).
  119. */
  120. enum ulong BGFX_STATE_DEFAULT = BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CW | BGFX_STATE_MSAA;
  121. enum ulong BGFX_STATE_MASK = 0xffffffffffffffff; /// State bit mask
  122. /// Do not use!
  123. enum ulong BGFX_STATE_RESERVED_SHIFT = 61;
  124. enum ulong BGFX_STATE_RESERVED_MASK = 0xe000000000000000;
  125. /// Set stencil ref value.
  126. enum uint BGFX_STENCIL_FUNC_REF_SHIFT = 0;
  127. enum uint BGFX_STENCIL_FUNC_REF_MASK = 0x000000ff;
  128. uint BGFX_STENCIL_FUNC_REF (uint v) { return (v << BGFX_STENCIL_FUNC_REF_SHIFT) & BGFX_STENCIL_FUNC_REF_MASK; }
  129. /// Set stencil rmask value.
  130. enum uint BGFX_STENCIL_FUNC_RMASK_SHIFT = 8;
  131. enum uint BGFX_STENCIL_FUNC_RMASK_MASK = 0x0000ff00;
  132. uint BGFX_STENCIL_FUNC_RMASK (uint v) { return (v << BGFX_STENCIL_FUNC_RMASK_SHIFT) & BGFX_STENCIL_FUNC_RMASK_MASK; }
  133. enum uint BGFX_STENCIL_NONE = 0x00000000;
  134. enum uint BGFX_STENCIL_MASK = 0xffffffff;
  135. enum uint BGFX_STENCIL_DEFAULT = 0x00000000;
  136. enum uint BGFX_STENCIL_TEST_LESS = 0x00010000; /// Enable stencil test, less.
  137. enum uint BGFX_STENCIL_TEST_LEQUAL = 0x00020000; /// Enable stencil test, less or equal.
  138. enum uint BGFX_STENCIL_TEST_EQUAL = 0x00030000; /// Enable stencil test, equal.
  139. enum uint BGFX_STENCIL_TEST_GEQUAL = 0x00040000; /// Enable stencil test, greater or equal.
  140. enum uint BGFX_STENCIL_TEST_GREATER = 0x00050000; /// Enable stencil test, greater.
  141. enum uint BGFX_STENCIL_TEST_NOTEQUAL = 0x00060000; /// Enable stencil test, not equal.
  142. enum uint BGFX_STENCIL_TEST_NEVER = 0x00070000; /// Enable stencil test, never.
  143. enum uint BGFX_STENCIL_TEST_ALWAYS = 0x00080000; /// Enable stencil test, always.
  144. enum uint BGFX_STENCIL_TEST_SHIFT = 16; /// Stencil test bit shift
  145. enum uint BGFX_STENCIL_TEST_MASK = 0x000f0000; /// Stencil test bit mask
  146. enum uint BGFX_STENCIL_OP_FAIL_S_ZERO = 0x00000000; /// Zero.
  147. enum uint BGFX_STENCIL_OP_FAIL_S_KEEP = 0x00100000; /// Keep.
  148. enum uint BGFX_STENCIL_OP_FAIL_S_REPLACE = 0x00200000; /// Replace.
  149. enum uint BGFX_STENCIL_OP_FAIL_S_INCR = 0x00300000; /// Increment and wrap.
  150. enum uint BGFX_STENCIL_OP_FAIL_S_INCRSAT = 0x00400000; /// Increment and clamp.
  151. enum uint BGFX_STENCIL_OP_FAIL_S_DECR = 0x00500000; /// Decrement and wrap.
  152. enum uint BGFX_STENCIL_OP_FAIL_S_DECRSAT = 0x00600000; /// Decrement and clamp.
  153. enum uint BGFX_STENCIL_OP_FAIL_S_INVERT = 0x00700000; /// Invert.
  154. enum uint BGFX_STENCIL_OP_FAIL_S_SHIFT = 20; /// Stencil operation fail bit shift
  155. enum uint BGFX_STENCIL_OP_FAIL_S_MASK = 0x00f00000; /// Stencil operation fail bit mask
  156. enum uint BGFX_STENCIL_OP_FAIL_Z_ZERO = 0x00000000; /// Zero.
  157. enum uint BGFX_STENCIL_OP_FAIL_Z_KEEP = 0x01000000; /// Keep.
  158. enum uint BGFX_STENCIL_OP_FAIL_Z_REPLACE = 0x02000000; /// Replace.
  159. enum uint BGFX_STENCIL_OP_FAIL_Z_INCR = 0x03000000; /// Increment and wrap.
  160. enum uint BGFX_STENCIL_OP_FAIL_Z_INCRSAT = 0x04000000; /// Increment and clamp.
  161. enum uint BGFX_STENCIL_OP_FAIL_Z_DECR = 0x05000000; /// Decrement and wrap.
  162. enum uint BGFX_STENCIL_OP_FAIL_Z_DECRSAT = 0x06000000; /// Decrement and clamp.
  163. enum uint BGFX_STENCIL_OP_FAIL_Z_INVERT = 0x07000000; /// Invert.
  164. enum uint BGFX_STENCIL_OP_FAIL_Z_SHIFT = 24; /// Stencil operation depth fail bit shift
  165. enum uint BGFX_STENCIL_OP_FAIL_Z_MASK = 0x0f000000; /// Stencil operation depth fail bit mask
  166. enum uint BGFX_STENCIL_OP_PASS_Z_ZERO = 0x00000000; /// Zero.
  167. enum uint BGFX_STENCIL_OP_PASS_Z_KEEP = 0x10000000; /// Keep.
  168. enum uint BGFX_STENCIL_OP_PASS_Z_REPLACE = 0x20000000; /// Replace.
  169. enum uint BGFX_STENCIL_OP_PASS_Z_INCR = 0x30000000; /// Increment and wrap.
  170. enum uint BGFX_STENCIL_OP_PASS_Z_INCRSAT = 0x40000000; /// Increment and clamp.
  171. enum uint BGFX_STENCIL_OP_PASS_Z_DECR = 0x50000000; /// Decrement and wrap.
  172. enum uint BGFX_STENCIL_OP_PASS_Z_DECRSAT = 0x60000000; /// Decrement and clamp.
  173. enum uint BGFX_STENCIL_OP_PASS_Z_INVERT = 0x70000000; /// Invert.
  174. enum uint BGFX_STENCIL_OP_PASS_Z_SHIFT = 28; /// Stencil operation depth pass bit shift
  175. enum uint BGFX_STENCIL_OP_PASS_Z_MASK = 0xf0000000; /// Stencil operation depth pass bit mask
  176. enum ushort BGFX_CLEAR_NONE = 0x0000; /// No clear flags.
  177. enum ushort BGFX_CLEAR_COLOR = 0x0001; /// Clear color.
  178. enum ushort BGFX_CLEAR_DEPTH = 0x0002; /// Clear depth.
  179. enum ushort BGFX_CLEAR_STENCIL = 0x0004; /// Clear stencil.
  180. enum ushort BGFX_CLEAR_DISCARD_COLOR_0 = 0x0008; /// Discard frame buffer attachment 0.
  181. enum ushort BGFX_CLEAR_DISCARD_COLOR_1 = 0x0010; /// Discard frame buffer attachment 1.
  182. enum ushort BGFX_CLEAR_DISCARD_COLOR_2 = 0x0020; /// Discard frame buffer attachment 2.
  183. enum ushort BGFX_CLEAR_DISCARD_COLOR_3 = 0x0040; /// Discard frame buffer attachment 3.
  184. enum ushort BGFX_CLEAR_DISCARD_COLOR_4 = 0x0080; /// Discard frame buffer attachment 4.
  185. enum ushort BGFX_CLEAR_DISCARD_COLOR_5 = 0x0100; /// Discard frame buffer attachment 5.
  186. enum ushort BGFX_CLEAR_DISCARD_COLOR_6 = 0x0200; /// Discard frame buffer attachment 6.
  187. enum ushort BGFX_CLEAR_DISCARD_COLOR_7 = 0x0400; /// Discard frame buffer attachment 7.
  188. enum ushort BGFX_CLEAR_DISCARD_DEPTH = 0x0800; /// Discard frame buffer depth attachment.
  189. enum ushort BGFX_CLEAR_DISCARD_STENCIL = 0x1000; /// Discard frame buffer stencil attachment.
  190. enum ushort BGFX_CLEAR_DISCARD_COLOR_MASK = 0x07f8;
  191. enum ushort BGFX_CLEAR_DISCARD_MASK = 0x1ff8;
  192. /**
  193. * Rendering state discard. When state is preserved in submit, rendering states can be discarded
  194. * on a finer grain.
  195. */
  196. enum ubyte BGFX_DISCARD_NONE = 0x00; /// Preserve everything.
  197. enum ubyte BGFX_DISCARD_BINDINGS = 0x01; /// Discard texture sampler and buffer bindings.
  198. enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x02; /// Discard index buffer.
  199. enum ubyte BGFX_DISCARD_INSTANCE_DATA = 0x04; /// Discard instance data.
  200. enum ubyte BGFX_DISCARD_STATE = 0x08; /// Discard state and uniform bindings.
  201. enum ubyte BGFX_DISCARD_TRANSFORM = 0x10; /// Discard transform.
  202. enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x20; /// Discard vertex streams.
  203. enum ubyte BGFX_DISCARD_ALL = 0xff; /// Discard all states.
  204. enum uint BGFX_DEBUG_NONE = 0x00000000; /// No debug.
  205. enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; /// Enable wireframe for all primitives.
  206. /**
  207. * Enable infinitely fast hardware test. No draw calls will be submitted to driver.
  208. * It's useful when profiling to quickly assess bottleneck between CPU and GPU.
  209. */
  210. enum uint BGFX_DEBUG_IFH = 0x00000002;
  211. enum uint BGFX_DEBUG_STATS = 0x00000004; /// Enable statistics display.
  212. enum uint BGFX_DEBUG_TEXT = 0x00000008; /// Enable debug text display.
  213. enum uint BGFX_DEBUG_PROFILER = 0x00000010; /// Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`.
  214. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X1 = 0x0001; /// 1 8-bit value
  215. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X2 = 0x0002; /// 2 8-bit values
  216. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X4 = 0x0003; /// 4 8-bit values
  217. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X1 = 0x0004; /// 1 16-bit value
  218. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X2 = 0x0005; /// 2 16-bit values
  219. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X4 = 0x0006; /// 4 16-bit values
  220. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X1 = 0x0007; /// 1 32-bit value
  221. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X2 = 0x0008; /// 2 32-bit values
  222. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X4 = 0x0009; /// 4 32-bit values
  223. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_SHIFT = 0;
  224. enum ushort BGFX_BUFFER_COMPUTE_FORMAT_MASK = 0x000f;
  225. enum ushort BGFX_BUFFER_COMPUTE_TYPE_INT = 0x0010; /// Type `int`.
  226. enum ushort BGFX_BUFFER_COMPUTE_TYPE_UINT = 0x0020; /// Type `uint`.
  227. enum ushort BGFX_BUFFER_COMPUTE_TYPE_FLOAT = 0x0030; /// Type `float`.
  228. enum ushort BGFX_BUFFER_COMPUTE_TYPE_SHIFT = 4;
  229. enum ushort BGFX_BUFFER_COMPUTE_TYPE_MASK = 0x0030;
  230. enum ushort BGFX_BUFFER_NONE = 0x0000;
  231. enum ushort BGFX_BUFFER_COMPUTE_READ = 0x0100; /// Buffer will be read by shader.
  232. enum ushort BGFX_BUFFER_COMPUTE_WRITE = 0x0200; /// Buffer will be used for writing.
  233. enum ushort BGFX_BUFFER_DRAW_INDIRECT = 0x0400; /// Buffer will be used for storing draw indirect commands.
  234. enum ushort BGFX_BUFFER_ALLOW_RESIZE = 0x0800; /// Allow dynamic index/vertex buffer resize during update.
  235. enum ushort BGFX_BUFFER_INDEX32 = 0x1000; /// Index buffer contains 32-bit indices.
  236. enum ushort BGFX_BUFFER_COMPUTE_READ_WRITE = 0x0300;
  237. enum ulong BGFX_TEXTURE_NONE = 0x0000000000000000;
  238. enum ulong BGFX_TEXTURE_MSAA_SAMPLE = 0x0000000800000000; /// Texture will be used for MSAA sampling.
  239. enum ulong BGFX_TEXTURE_RT = 0x0000001000000000; /// Render target no MSAA.
  240. enum ulong BGFX_TEXTURE_COMPUTE_WRITE = 0x0000100000000000; /// Texture will be used for compute write.
  241. enum ulong BGFX_TEXTURE_SRGB = 0x0000200000000000; /// Sample texture as sRGB.
  242. enum ulong BGFX_TEXTURE_BLIT_DST = 0x0000400000000000; /// Texture will be used as blit destination.
  243. enum ulong BGFX_TEXTURE_READ_BACK = 0x0000800000000000; /// Texture will be used for read back from GPU.
  244. enum ulong BGFX_TEXTURE_RT_MSAA_X2 = 0x0000002000000000; /// Render target MSAAx2 mode.
  245. enum ulong BGFX_TEXTURE_RT_MSAA_X4 = 0x0000003000000000; /// Render target MSAAx4 mode.
  246. enum ulong BGFX_TEXTURE_RT_MSAA_X8 = 0x0000004000000000; /// Render target MSAAx8 mode.
  247. enum ulong BGFX_TEXTURE_RT_MSAA_X16 = 0x0000005000000000; /// Render target MSAAx16 mode.
  248. enum ulong BGFX_TEXTURE_RT_MSAA_SHIFT = 36;
  249. enum ulong BGFX_TEXTURE_RT_MSAA_MASK = 0x0000007000000000;
  250. enum ulong BGFX_TEXTURE_RT_WRITE_ONLY = 0x0000008000000000; /// Render target will be used for writing
  251. enum ulong BGFX_TEXTURE_RT_SHIFT = 36;
  252. enum ulong BGFX_TEXTURE_RT_MASK = 0x000000f000000000;
  253. /// Sampler flags.
  254. enum uint BGFX_SAMPLER_U_MIRROR = 0x00000001; /// Wrap U mode: Mirror
  255. enum uint BGFX_SAMPLER_U_CLAMP = 0x00000002; /// Wrap U mode: Clamp
  256. enum uint BGFX_SAMPLER_U_BORDER = 0x00000003; /// Wrap U mode: Border
  257. enum uint BGFX_SAMPLER_U_SHIFT = 0;
  258. enum uint BGFX_SAMPLER_U_MASK = 0x00000003;
  259. enum uint BGFX_SAMPLER_V_MIRROR = 0x00000004; /// Wrap V mode: Mirror
  260. enum uint BGFX_SAMPLER_V_CLAMP = 0x00000008; /// Wrap V mode: Clamp
  261. enum uint BGFX_SAMPLER_V_BORDER = 0x0000000c; /// Wrap V mode: Border
  262. enum uint BGFX_SAMPLER_V_SHIFT = 2;
  263. enum uint BGFX_SAMPLER_V_MASK = 0x0000000c;
  264. enum uint BGFX_SAMPLER_W_MIRROR = 0x00000010; /// Wrap W mode: Mirror
  265. enum uint BGFX_SAMPLER_W_CLAMP = 0x00000020; /// Wrap W mode: Clamp
  266. enum uint BGFX_SAMPLER_W_BORDER = 0x00000030; /// Wrap W mode: Border
  267. enum uint BGFX_SAMPLER_W_SHIFT = 4;
  268. enum uint BGFX_SAMPLER_W_MASK = 0x00000030;
  269. enum uint BGFX_SAMPLER_MIN_POINT = 0x00000040; /// Min sampling mode: Point
  270. enum uint BGFX_SAMPLER_MIN_ANISOTROPIC = 0x00000080; /// Min sampling mode: Anisotropic
  271. enum uint BGFX_SAMPLER_MIN_SHIFT = 6;
  272. enum uint BGFX_SAMPLER_MIN_MASK = 0x000000c0;
  273. enum uint BGFX_SAMPLER_MAG_POINT = 0x00000100; /// Mag sampling mode: Point
  274. enum uint BGFX_SAMPLER_MAG_ANISOTROPIC = 0x00000200; /// Mag sampling mode: Anisotropic
  275. enum uint BGFX_SAMPLER_MAG_SHIFT = 8;
  276. enum uint BGFX_SAMPLER_MAG_MASK = 0x00000300;
  277. enum uint BGFX_SAMPLER_MIP_POINT = 0x00000400; /// Mip sampling mode: Point
  278. enum uint BGFX_SAMPLER_MIP_SHIFT = 10;
  279. enum uint BGFX_SAMPLER_MIP_MASK = 0x00000400;
  280. enum uint BGFX_SAMPLER_COMPARE_LESS = 0x00010000; /// Compare when sampling depth texture: less.
  281. enum uint BGFX_SAMPLER_COMPARE_LEQUAL = 0x00020000; /// Compare when sampling depth texture: less or equal.
  282. enum uint BGFX_SAMPLER_COMPARE_EQUAL = 0x00030000; /// Compare when sampling depth texture: equal.
  283. enum uint BGFX_SAMPLER_COMPARE_GEQUAL = 0x00040000; /// Compare when sampling depth texture: greater or equal.
  284. enum uint BGFX_SAMPLER_COMPARE_GREATER = 0x00050000; /// Compare when sampling depth texture: greater.
  285. enum uint BGFX_SAMPLER_COMPARE_NOTEQUAL = 0x00060000; /// Compare when sampling depth texture: not equal.
  286. enum uint BGFX_SAMPLER_COMPARE_NEVER = 0x00070000; /// Compare when sampling depth texture: never.
  287. enum uint BGFX_SAMPLER_COMPARE_ALWAYS = 0x00080000; /// Compare when sampling depth texture: always.
  288. enum uint BGFX_SAMPLER_COMPARE_SHIFT = 16;
  289. enum uint BGFX_SAMPLER_COMPARE_MASK = 0x000f0000;
  290. enum uint BGFX_SAMPLER_BORDER_COLOR_SHIFT = 24;
  291. enum uint BGFX_SAMPLER_BORDER_COLOR_MASK = 0x0f000000;
  292. uint BGFX_SAMPLER_BORDER_COLOR (uint v) { return (v << BGFX_SAMPLER_BORDER_COLOR_SHIFT) & BGFX_SAMPLER_BORDER_COLOR_MASK; }
  293. enum uint BGFX_SAMPLER_RESERVED_SHIFT = 28;
  294. enum uint BGFX_SAMPLER_RESERVED_MASK = 0xf0000000;
  295. enum uint BGFX_SAMPLER_NONE = 0x00000000;
  296. enum uint BGFX_SAMPLER_SAMPLE_STENCIL = 0x00100000; /// Sample stencil instead of depth.
  297. enum uint BGFX_SAMPLER_POINT = BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT;
  298. enum uint BGFX_SAMPLER_UVW_MIRROR = BGFX_SAMPLER_U_MIRROR | BGFX_SAMPLER_V_MIRROR | BGFX_SAMPLER_W_MIRROR;
  299. enum uint BGFX_SAMPLER_UVW_CLAMP = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP;
  300. enum uint BGFX_SAMPLER_UVW_BORDER = BGFX_SAMPLER_U_BORDER | BGFX_SAMPLER_V_BORDER | BGFX_SAMPLER_W_BORDER;
  301. enum uint BGFX_SAMPLER_BITS_MASK = BGFX_SAMPLER_U_MASK | BGFX_SAMPLER_V_MASK | BGFX_SAMPLER_W_MASK | BGFX_SAMPLER_MIN_MASK | BGFX_SAMPLER_MAG_MASK | BGFX_SAMPLER_MIP_MASK | BGFX_SAMPLER_COMPARE_MASK;
  302. enum uint BGFX_RESET_MSAA_X2 = 0x00000010; /// Enable 2x MSAA.
  303. enum uint BGFX_RESET_MSAA_X4 = 0x00000020; /// Enable 4x MSAA.
  304. enum uint BGFX_RESET_MSAA_X8 = 0x00000030; /// Enable 8x MSAA.
  305. enum uint BGFX_RESET_MSAA_X16 = 0x00000040; /// Enable 16x MSAA.
  306. enum uint BGFX_RESET_MSAA_SHIFT = 4;
  307. enum uint BGFX_RESET_MSAA_MASK = 0x00000070;
  308. enum uint BGFX_RESET_NONE = 0x00000000; /// No reset flags.
  309. enum uint BGFX_RESET_FULLSCREEN = 0x00000001; /// Not supported yet.
  310. enum uint BGFX_RESET_VSYNC = 0x00000080; /// Enable V-Sync.
  311. enum uint BGFX_RESET_MAXANISOTROPY = 0x00000100; /// Turn on/off max anisotropy.
  312. enum uint BGFX_RESET_CAPTURE = 0x00000200; /// Begin screen capture.
  313. enum uint BGFX_RESET_FLUSH_AFTER_RENDER = 0x00002000; /// Flush rendering after submitting to GPU.
  314. /**
  315. * This flag specifies where flip occurs. Default behaviour is that flip occurs
  316. * before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  317. */
  318. enum uint BGFX_RESET_FLIP_AFTER_RENDER = 0x00004000;
  319. enum uint BGFX_RESET_SRGB_BACKBUFFER = 0x00008000; /// Enable sRGB backbuffer.
  320. enum uint BGFX_RESET_HDR10 = 0x00010000; /// Enable HDR10 rendering.
  321. enum uint BGFX_RESET_HIDPI = 0x00020000; /// Enable HiDPI rendering.
  322. enum uint BGFX_RESET_DEPTH_CLAMP = 0x00040000; /// Enable depth clamp.
  323. enum uint BGFX_RESET_SUSPEND = 0x00080000; /// Suspend rendering.
  324. enum uint BGFX_RESET_TRANSPARENT_BACKBUFFER = 0x00100000; /// Transparent backbuffer. Availability depends on: `BGFX_CAPS_TRANSPARENT_BACKBUFFER`.
  325. enum uint BGFX_RESET_FULLSCREEN_SHIFT = 0;
  326. enum uint BGFX_RESET_FULLSCREEN_MASK = 0x00000001;
  327. enum uint BGFX_RESET_RESERVED_SHIFT = 31; /// Internal bit shift
  328. enum uint BGFX_RESET_RESERVED_MASK = 0x80000000; /// Internal bit mask
  329. enum ulong BGFX_CAPS_ALPHA_TO_COVERAGE = 0x0000000000000001; /// Alpha to coverage is supported.
  330. enum ulong BGFX_CAPS_BLEND_INDEPENDENT = 0x0000000000000002; /// Blend independent is supported.
  331. enum ulong BGFX_CAPS_COMPUTE = 0x0000000000000004; /// Compute shaders are supported.
  332. enum ulong BGFX_CAPS_CONSERVATIVE_RASTER = 0x0000000000000008; /// Conservative rasterization is supported.
  333. enum ulong BGFX_CAPS_DRAW_INDIRECT = 0x0000000000000010; /// Draw indirect is supported.
  334. enum ulong BGFX_CAPS_FRAGMENT_DEPTH = 0x0000000000000020; /// Fragment depth is available in fragment shader.
  335. enum ulong BGFX_CAPS_FRAGMENT_ORDERING = 0x0000000000000040; /// Fragment ordering is available in fragment shader.
  336. enum ulong BGFX_CAPS_GRAPHICS_DEBUGGER = 0x0000000000000080; /// Graphics debugger is present.
  337. enum ulong BGFX_CAPS_HDR10 = 0x0000000000000100; /// HDR10 rendering is supported.
  338. enum ulong BGFX_CAPS_HIDPI = 0x0000000000000200; /// HiDPI rendering is supported.
  339. enum ulong BGFX_CAPS_IMAGE_RW = 0x0000000000000400; /// Image Read/Write is supported.
  340. enum ulong BGFX_CAPS_INDEX32 = 0x0000000000000800; /// 32-bit indices are supported.
  341. enum ulong BGFX_CAPS_INSTANCING = 0x0000000000001000; /// Instancing is supported.
  342. enum ulong BGFX_CAPS_OCCLUSION_QUERY = 0x0000000000002000; /// Occlusion query is supported.
  343. enum ulong BGFX_CAPS_RENDERER_MULTITHREADED = 0x0000000000004000; /// Renderer is on separate thread.
  344. enum ulong BGFX_CAPS_SWAP_CHAIN = 0x0000000000008000; /// Multiple windows are supported.
  345. enum ulong BGFX_CAPS_TEXTURE_2D_ARRAY = 0x0000000000010000; /// 2D texture array is supported.
  346. enum ulong BGFX_CAPS_TEXTURE_3D = 0x0000000000020000; /// 3D textures are supported.
  347. enum ulong BGFX_CAPS_TEXTURE_BLIT = 0x0000000000040000; /// Texture blit is supported.
  348. enum ulong BGFX_CAPS_TRANSPARENT_BACKBUFFER = 0x0000000000080000; /// Transparent back buffer supported.
  349. enum ulong BGFX_CAPS_TEXTURE_COMPARE_RESERVED = 0x0000000000100000;
  350. enum ulong BGFX_CAPS_TEXTURE_COMPARE_LEQUAL = 0x0000000000200000; /// Texture compare less equal mode is supported.
  351. enum ulong BGFX_CAPS_TEXTURE_CUBE_ARRAY = 0x0000000000400000; /// Cubemap texture array is supported.
  352. enum ulong BGFX_CAPS_TEXTURE_DIRECT_ACCESS = 0x0000000000800000; /// CPU direct access to GPU texture memory.
  353. enum ulong BGFX_CAPS_TEXTURE_READ_BACK = 0x0000000001000000; /// Read-back texture is supported.
  354. enum ulong BGFX_CAPS_VERTEX_ATTRIB_HALF = 0x0000000002000000; /// Vertex attribute half-float is supported.
  355. enum ulong BGFX_CAPS_VERTEX_ATTRIB_UINT10 = 0x0000000004000000; /// Vertex attribute 10_10_10_2 is supported.
  356. enum ulong BGFX_CAPS_VERTEX_ID = 0x0000000008000000; /// Rendering with VertexID only is supported.
  357. enum ulong BGFX_CAPS_VIEWPORT_LAYER_ARRAY = 0x0000000010000000; /// Viewport layer is available in vertex shader.
  358. enum ulong BGFX_CAPS_DRAW_INDIRECT_COUNT = 0x0000000020000000; /// Draw indirect with indirect count is supported.
  359. enum ulong BGFX_CAPS_TEXTURE_COMPARE_ALL = 0x0000000000300000; /// All texture compare modes are supported.
  360. enum uint BGFX_CAPS_FORMAT_TEXTURE_NONE = 0x00000000; /// Texture format is not supported.
  361. enum uint BGFX_CAPS_FORMAT_TEXTURE_2D = 0x00000001; /// Texture format is supported.
  362. enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB = 0x00000002; /// Texture as sRGB format is supported.
  363. enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED = 0x00000004; /// Texture format is emulated.
  364. enum uint BGFX_CAPS_FORMAT_TEXTURE_3D = 0x00000008; /// Texture format is supported.
  365. enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB = 0x00000010; /// Texture as sRGB format is supported.
  366. enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED = 0x00000020; /// Texture format is emulated.
  367. enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE = 0x00000040; /// Texture format is supported.
  368. enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB = 0x00000080; /// Texture as sRGB format is supported.
  369. enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED = 0x00000100; /// Texture format is emulated.
  370. enum uint BGFX_CAPS_FORMAT_TEXTURE_VERTEX = 0x00000200; /// Texture format can be used from vertex shader.
  371. enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ = 0x00000400; /// Texture format can be used as image and read from.
  372. enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE = 0x00000800; /// Texture format can be used as image and written to.
  373. enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER = 0x00001000; /// Texture format can be used as frame buffer.
  374. enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA = 0x00002000; /// Texture format can be used as MSAA frame buffer.
  375. enum uint BGFX_CAPS_FORMAT_TEXTURE_MSAA = 0x00004000; /// Texture can be sampled as MSAA.
  376. enum uint BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN = 0x00008000; /// Texture format supports auto-generated mips.
  377. enum ubyte BGFX_RESOLVE_NONE = 0x00; /// No resolve flags.
  378. enum ubyte BGFX_RESOLVE_AUTO_GEN_MIPS = 0x01; /// Auto-generate mip maps on resolve.
  379. enum ushort BGFX_PCI_ID_NONE = 0x0000; /// Autoselect adapter.
  380. enum ushort BGFX_PCI_ID_SOFTWARE_RASTERIZER = 0x0001; /// Software rasterizer.
  381. enum ushort BGFX_PCI_ID_AMD = 0x1002; /// AMD adapter.
  382. enum ushort BGFX_PCI_ID_APPLE = 0x106b; /// Apple adapter.
  383. enum ushort BGFX_PCI_ID_INTEL = 0x8086; /// Intel adapter.
  384. enum ushort BGFX_PCI_ID_NVIDIA = 0x10de; /// nVidia adapter.
  385. enum ushort BGFX_PCI_ID_MICROSOFT = 0x1414; /// Microsoft adapter.
  386. enum ushort BGFX_PCI_ID_ARM = 0x13b5; /// ARM adapter.
  387. enum ubyte BGFX_CUBE_MAP_POSITIVE_X = 0x00; /// Cubemap +x.
  388. enum ubyte BGFX_CUBE_MAP_NEGATIVE_X = 0x01; /// Cubemap -x.
  389. enum ubyte BGFX_CUBE_MAP_POSITIVE_Y = 0x02; /// Cubemap +y.
  390. enum ubyte BGFX_CUBE_MAP_NEGATIVE_Y = 0x03; /// Cubemap -y.
  391. enum ubyte BGFX_CUBE_MAP_POSITIVE_Z = 0x04; /// Cubemap +z.
  392. enum ubyte BGFX_CUBE_MAP_NEGATIVE_Z = 0x05; /// Cubemap -z.
  393. /// Fatal error enum.
  394. enum bgfx_fatal_t
  395. {
  396. BGFX_FATAL_DEBUGCHECK,
  397. BGFX_FATAL_INVALIDSHADER,
  398. BGFX_FATAL_UNABLETOINITIALIZE,
  399. BGFX_FATAL_UNABLETOCREATETEXTURE,
  400. BGFX_FATAL_DEVICELOST,
  401. BGFX_FATAL_COUNT
  402. }
  403. mixin(expandEnum!bgfx_fatal_t);
  404. /// Renderer backend type enum.
  405. enum bgfx_renderer_type_t
  406. {
  407. BGFX_RENDERER_TYPE_NOOP, /// No rendering.
  408. BGFX_RENDERER_TYPE_AGC, /// AGC
  409. BGFX_RENDERER_TYPE_DIRECT3D9, /// Direct3D 9.0
  410. BGFX_RENDERER_TYPE_DIRECT3D11, /// Direct3D 11.0
  411. BGFX_RENDERER_TYPE_DIRECT3D12, /// Direct3D 12.0
  412. BGFX_RENDERER_TYPE_GNM, /// GNM
  413. BGFX_RENDERER_TYPE_METAL, /// Metal
  414. BGFX_RENDERER_TYPE_NVN, /// NVN
  415. BGFX_RENDERER_TYPE_OPENGLES, /// OpenGL ES 2.0+
  416. BGFX_RENDERER_TYPE_OPENGL, /// OpenGL 2.1+
  417. BGFX_RENDERER_TYPE_VULKAN, /// Vulkan
  418. BGFX_RENDERER_TYPE_WEBGPU, /// WebGPU
  419. BGFX_RENDERER_TYPE_COUNT
  420. }
  421. mixin(expandEnum!bgfx_renderer_type_t);
  422. /// Access mode enum.
  423. enum bgfx_access_t
  424. {
  425. BGFX_ACCESS_READ, /// Read.
  426. BGFX_ACCESS_WRITE, /// Write.
  427. BGFX_ACCESS_READWRITE, /// Read and write.
  428. BGFX_ACCESS_COUNT
  429. }
  430. mixin(expandEnum!bgfx_access_t);
  431. /// Vertex attribute enum.
  432. enum bgfx_attrib_t
  433. {
  434. BGFX_ATTRIB_POSITION, /// a_position
  435. BGFX_ATTRIB_NORMAL, /// a_normal
  436. BGFX_ATTRIB_TANGENT, /// a_tangent
  437. BGFX_ATTRIB_BITANGENT, /// a_bitangent
  438. BGFX_ATTRIB_COLOR0, /// a_color0
  439. BGFX_ATTRIB_COLOR1, /// a_color1
  440. BGFX_ATTRIB_COLOR2, /// a_color2
  441. BGFX_ATTRIB_COLOR3, /// a_color3
  442. BGFX_ATTRIB_INDICES, /// a_indices
  443. BGFX_ATTRIB_WEIGHT, /// a_weight
  444. BGFX_ATTRIB_TEXCOORD0, /// a_texcoord0
  445. BGFX_ATTRIB_TEXCOORD1, /// a_texcoord1
  446. BGFX_ATTRIB_TEXCOORD2, /// a_texcoord2
  447. BGFX_ATTRIB_TEXCOORD3, /// a_texcoord3
  448. BGFX_ATTRIB_TEXCOORD4, /// a_texcoord4
  449. BGFX_ATTRIB_TEXCOORD5, /// a_texcoord5
  450. BGFX_ATTRIB_TEXCOORD6, /// a_texcoord6
  451. BGFX_ATTRIB_TEXCOORD7, /// a_texcoord7
  452. BGFX_ATTRIB_COUNT
  453. }
  454. mixin(expandEnum!bgfx_attrib_t);
  455. /// Vertex attribute type enum.
  456. enum bgfx_attrib_type_t
  457. {
  458. BGFX_ATTRIB_TYPE_UINT8, /// Uint8
  459. BGFX_ATTRIB_TYPE_UINT10, /// Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`.
  460. BGFX_ATTRIB_TYPE_INT16, /// Int16
  461. BGFX_ATTRIB_TYPE_HALF, /// Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`.
  462. BGFX_ATTRIB_TYPE_FLOAT, /// Float
  463. BGFX_ATTRIB_TYPE_COUNT
  464. }
  465. mixin(expandEnum!bgfx_attrib_type_t);
  466. /**
  467. * Texture format enum.
  468. * Notation:
  469. * RGBA16S
  470. * ^ ^ ^
  471. * | | +-- [ ]Unorm
  472. * | | [F]loat
  473. * | | [S]norm
  474. * | | [I]nt
  475. * | | [U]int
  476. * | +---- Number of bits per component
  477. * +-------- Components
  478. * @attention Availability depends on Caps (see: formats).
  479. */
  480. enum bgfx_texture_format_t
  481. {
  482. BGFX_TEXTURE_FORMAT_BC1, /// DXT1 R5G6B5A1
  483. BGFX_TEXTURE_FORMAT_BC2, /// DXT3 R5G6B5A4
  484. BGFX_TEXTURE_FORMAT_BC3, /// DXT5 R5G6B5A8
  485. BGFX_TEXTURE_FORMAT_BC4, /// LATC1/ATI1 R8
  486. BGFX_TEXTURE_FORMAT_BC5, /// LATC2/ATI2 RG8
  487. BGFX_TEXTURE_FORMAT_BC6H, /// BC6H RGB16F
  488. BGFX_TEXTURE_FORMAT_BC7, /// BC7 RGB 4-7 bits per color channel, 0-8 bits alpha
  489. BGFX_TEXTURE_FORMAT_ETC1, /// ETC1 RGB8
  490. BGFX_TEXTURE_FORMAT_ETC2, /// ETC2 RGB8
  491. BGFX_TEXTURE_FORMAT_ETC2A, /// ETC2 RGBA8
  492. BGFX_TEXTURE_FORMAT_ETC2A1, /// ETC2 RGB8A1
  493. BGFX_TEXTURE_FORMAT_PTC12, /// PVRTC1 RGB 2BPP
  494. BGFX_TEXTURE_FORMAT_PTC14, /// PVRTC1 RGB 4BPP
  495. BGFX_TEXTURE_FORMAT_PTC12A, /// PVRTC1 RGBA 2BPP
  496. BGFX_TEXTURE_FORMAT_PTC14A, /// PVRTC1 RGBA 4BPP
  497. BGFX_TEXTURE_FORMAT_PTC22, /// PVRTC2 RGBA 2BPP
  498. BGFX_TEXTURE_FORMAT_PTC24, /// PVRTC2 RGBA 4BPP
  499. BGFX_TEXTURE_FORMAT_ATC, /// ATC RGB 4BPP
  500. BGFX_TEXTURE_FORMAT_ATCE, /// ATCE RGBA 8 BPP explicit alpha
  501. BGFX_TEXTURE_FORMAT_ATCI, /// ATCI RGBA 8 BPP interpolated alpha
  502. BGFX_TEXTURE_FORMAT_ASTC4X4, /// ASTC 4x4 8.0 BPP
  503. BGFX_TEXTURE_FORMAT_ASTC5X4, /// ASTC 5x4 6.40 BPP
  504. BGFX_TEXTURE_FORMAT_ASTC5X5, /// ASTC 5x5 5.12 BPP
  505. BGFX_TEXTURE_FORMAT_ASTC6X5, /// ASTC 6x5 4.27 BPP
  506. BGFX_TEXTURE_FORMAT_ASTC6X6, /// ASTC 6x6 3.56 BPP
  507. BGFX_TEXTURE_FORMAT_ASTC8X5, /// ASTC 8x5 3.20 BPP
  508. BGFX_TEXTURE_FORMAT_ASTC8X6, /// ASTC 8x6 2.67 BPP
  509. BGFX_TEXTURE_FORMAT_ASTC8X8, /// ASTC 8x8 2.00 BPP
  510. BGFX_TEXTURE_FORMAT_ASTC10X5, /// ASTC 10x5 2.56 BPP
  511. BGFX_TEXTURE_FORMAT_ASTC10X6, /// ASTC 10x6 2.13 BPP
  512. BGFX_TEXTURE_FORMAT_ASTC10X8, /// ASTC 10x8 1.60 BPP
  513. BGFX_TEXTURE_FORMAT_ASTC10X10, /// ASTC 10x10 1.28 BPP
  514. BGFX_TEXTURE_FORMAT_ASTC12X10, /// ASTC 12x10 1.07 BPP
  515. BGFX_TEXTURE_FORMAT_ASTC12X12, /// ASTC 12x12 0.89 BPP
  516. BGFX_TEXTURE_FORMAT_UNKNOWN, /// Compressed formats above.
  517. BGFX_TEXTURE_FORMAT_R1,
  518. BGFX_TEXTURE_FORMAT_A8,
  519. BGFX_TEXTURE_FORMAT_R8,
  520. BGFX_TEXTURE_FORMAT_R8I,
  521. BGFX_TEXTURE_FORMAT_R8U,
  522. BGFX_TEXTURE_FORMAT_R8S,
  523. BGFX_TEXTURE_FORMAT_R16,
  524. BGFX_TEXTURE_FORMAT_R16I,
  525. BGFX_TEXTURE_FORMAT_R16U,
  526. BGFX_TEXTURE_FORMAT_R16F,
  527. BGFX_TEXTURE_FORMAT_R16S,
  528. BGFX_TEXTURE_FORMAT_R32I,
  529. BGFX_TEXTURE_FORMAT_R32U,
  530. BGFX_TEXTURE_FORMAT_R32F,
  531. BGFX_TEXTURE_FORMAT_RG8,
  532. BGFX_TEXTURE_FORMAT_RG8I,
  533. BGFX_TEXTURE_FORMAT_RG8U,
  534. BGFX_TEXTURE_FORMAT_RG8S,
  535. BGFX_TEXTURE_FORMAT_RG16,
  536. BGFX_TEXTURE_FORMAT_RG16I,
  537. BGFX_TEXTURE_FORMAT_RG16U,
  538. BGFX_TEXTURE_FORMAT_RG16F,
  539. BGFX_TEXTURE_FORMAT_RG16S,
  540. BGFX_TEXTURE_FORMAT_RG32I,
  541. BGFX_TEXTURE_FORMAT_RG32U,
  542. BGFX_TEXTURE_FORMAT_RG32F,
  543. BGFX_TEXTURE_FORMAT_RGB8,
  544. BGFX_TEXTURE_FORMAT_RGB8I,
  545. BGFX_TEXTURE_FORMAT_RGB8U,
  546. BGFX_TEXTURE_FORMAT_RGB8S,
  547. BGFX_TEXTURE_FORMAT_RGB9E5F,
  548. BGFX_TEXTURE_FORMAT_BGRA8,
  549. BGFX_TEXTURE_FORMAT_RGBA8,
  550. BGFX_TEXTURE_FORMAT_RGBA8I,
  551. BGFX_TEXTURE_FORMAT_RGBA8U,
  552. BGFX_TEXTURE_FORMAT_RGBA8S,
  553. BGFX_TEXTURE_FORMAT_RGBA16,
  554. BGFX_TEXTURE_FORMAT_RGBA16I,
  555. BGFX_TEXTURE_FORMAT_RGBA16U,
  556. BGFX_TEXTURE_FORMAT_RGBA16F,
  557. BGFX_TEXTURE_FORMAT_RGBA16S,
  558. BGFX_TEXTURE_FORMAT_RGBA32I,
  559. BGFX_TEXTURE_FORMAT_RGBA32U,
  560. BGFX_TEXTURE_FORMAT_RGBA32F,
  561. BGFX_TEXTURE_FORMAT_B5G6R5,
  562. BGFX_TEXTURE_FORMAT_R5G6B5,
  563. BGFX_TEXTURE_FORMAT_BGRA4,
  564. BGFX_TEXTURE_FORMAT_RGBA4,
  565. BGFX_TEXTURE_FORMAT_BGR5A1,
  566. BGFX_TEXTURE_FORMAT_RGB5A1,
  567. BGFX_TEXTURE_FORMAT_RGB10A2,
  568. BGFX_TEXTURE_FORMAT_RG11B10F,
  569. BGFX_TEXTURE_FORMAT_UNKNOWNDEPTH, /// Depth formats below.
  570. BGFX_TEXTURE_FORMAT_D16,
  571. BGFX_TEXTURE_FORMAT_D24,
  572. BGFX_TEXTURE_FORMAT_D24S8,
  573. BGFX_TEXTURE_FORMAT_D32,
  574. BGFX_TEXTURE_FORMAT_D16F,
  575. BGFX_TEXTURE_FORMAT_D24F,
  576. BGFX_TEXTURE_FORMAT_D32F,
  577. BGFX_TEXTURE_FORMAT_D0S8,
  578. BGFX_TEXTURE_FORMAT_COUNT
  579. }
  580. mixin(expandEnum!bgfx_texture_format_t);
  581. /// Uniform type enum.
  582. enum bgfx_uniform_type_t
  583. {
  584. BGFX_UNIFORM_TYPE_SAMPLER, /// Sampler.
  585. BGFX_UNIFORM_TYPE_END, /// Reserved, do not use.
  586. BGFX_UNIFORM_TYPE_VEC4, /// 4 floats vector.
  587. BGFX_UNIFORM_TYPE_MAT3, /// 3x3 matrix.
  588. BGFX_UNIFORM_TYPE_MAT4, /// 4x4 matrix.
  589. BGFX_UNIFORM_TYPE_COUNT
  590. }
  591. mixin(expandEnum!bgfx_uniform_type_t);
  592. /// Backbuffer ratio enum.
  593. enum bgfx_backbuffer_ratio_t
  594. {
  595. BGFX_BACKBUFFER_RATIO_EQUAL, /// Equal to backbuffer.
  596. BGFX_BACKBUFFER_RATIO_HALF, /// One half size of backbuffer.
  597. BGFX_BACKBUFFER_RATIO_QUARTER, /// One quarter size of backbuffer.
  598. BGFX_BACKBUFFER_RATIO_EIGHTH, /// One eighth size of backbuffer.
  599. BGFX_BACKBUFFER_RATIO_SIXTEENTH, /// One sixteenth size of backbuffer.
  600. BGFX_BACKBUFFER_RATIO_DOUBLE, /// Double size of backbuffer.
  601. BGFX_BACKBUFFER_RATIO_COUNT
  602. }
  603. mixin(expandEnum!bgfx_backbuffer_ratio_t);
  604. /// Occlusion query result.
  605. enum bgfx_occlusion_query_result_t
  606. {
  607. BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE, /// Query failed test.
  608. BGFX_OCCLUSION_QUERY_RESULT_VISIBLE, /// Query passed test.
  609. BGFX_OCCLUSION_QUERY_RESULT_NORESULT, /// Query result is not available yet.
  610. BGFX_OCCLUSION_QUERY_RESULT_COUNT
  611. }
  612. mixin(expandEnum!bgfx_occlusion_query_result_t);
  613. /// Primitive topology.
  614. enum bgfx_topology_t
  615. {
  616. BGFX_TOPOLOGY_TRILIST, /// Triangle list.
  617. BGFX_TOPOLOGY_TRISTRIP, /// Triangle strip.
  618. BGFX_TOPOLOGY_LINELIST, /// Line list.
  619. BGFX_TOPOLOGY_LINESTRIP, /// Line strip.
  620. BGFX_TOPOLOGY_POINTLIST, /// Point list.
  621. BGFX_TOPOLOGY_COUNT
  622. }
  623. mixin(expandEnum!bgfx_topology_t);
  624. /// Topology conversion function.
  625. enum bgfx_topology_convert_t
  626. {
  627. BGFX_TOPOLOGY_CONVERT_TRILISTFLIPWINDING, /// Flip winding order of triangle list.
  628. BGFX_TOPOLOGY_CONVERT_TRISTRIPFLIPWINDING, /// Flip winding order of triangle strip.
  629. BGFX_TOPOLOGY_CONVERT_TRILISTTOLINELIST, /// Convert triangle list to line list.
  630. BGFX_TOPOLOGY_CONVERT_TRISTRIPTOTRILIST, /// Convert triangle strip to triangle list.
  631. BGFX_TOPOLOGY_CONVERT_LINESTRIPTOLINELIST, /// Convert line strip to line list.
  632. BGFX_TOPOLOGY_CONVERT_COUNT
  633. }
  634. mixin(expandEnum!bgfx_topology_convert_t);
  635. /// Topology sort order.
  636. enum bgfx_topology_sort_t
  637. {
  638. BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMIN,
  639. BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKAVG,
  640. BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMAX,
  641. BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMIN,
  642. BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTAVG,
  643. BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMAX,
  644. BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMIN,
  645. BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKAVG,
  646. BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMAX,
  647. BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMIN,
  648. BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTAVG,
  649. BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMAX,
  650. BGFX_TOPOLOGY_SORT_COUNT
  651. }
  652. mixin(expandEnum!bgfx_topology_sort_t);
  653. /// View mode sets draw call sort order.
  654. enum bgfx_view_mode_t
  655. {
  656. BGFX_VIEW_MODE_DEFAULT, /// Default sort order.
  657. BGFX_VIEW_MODE_SEQUENTIAL, /// Sort in the same order in which submit calls were called.
  658. BGFX_VIEW_MODE_DEPTHASCENDING, /// Sort draw call depth in ascending order.
  659. BGFX_VIEW_MODE_DEPTHDESCENDING, /// Sort draw call depth in descending order.
  660. BGFX_VIEW_MODE_COUNT
  661. }
  662. mixin(expandEnum!bgfx_view_mode_t);
  663. /// Render frame enum.
  664. enum bgfx_render_frame_t
  665. {
  666. BGFX_RENDER_FRAME_NOCONTEXT, /// Renderer context is not created yet.
  667. BGFX_RENDER_FRAME_RENDER, /// Renderer context is created and rendering.
  668. BGFX_RENDER_FRAME_TIMEOUT, /// Renderer context wait for main thread signal timed out without rendering.
  669. BGFX_RENDER_FRAME_EXITING, /// Renderer context is getting destroyed.
  670. BGFX_RENDER_FRAME_COUNT
  671. }
  672. mixin(expandEnum!bgfx_render_frame_t);
  673. /// GPU info.
  674. struct bgfx_caps_gpu_t
  675. {
  676. ushort vendorId; /// Vendor PCI id. See `BGFX_PCI_ID_*`.
  677. ushort deviceId; /// Device id.
  678. }
  679. /// Renderer runtime limits.
  680. struct bgfx_caps_limits_t
  681. {
  682. uint maxDrawCalls; /// Maximum number of draw calls.
  683. uint maxBlits; /// Maximum number of blit calls.
  684. uint maxTextureSize; /// Maximum texture size.
  685. uint maxTextureLayers; /// Maximum texture layers.
  686. uint maxViews; /// Maximum number of views.
  687. uint maxFrameBuffers; /// Maximum number of frame buffer handles.
  688. uint maxFBAttachments; /// Maximum number of frame buffer attachments.
  689. uint maxPrograms; /// Maximum number of program handles.
  690. uint maxShaders; /// Maximum number of shader handles.
  691. uint maxTextures; /// Maximum number of texture handles.
  692. uint maxTextureSamplers; /// Maximum number of texture samplers.
  693. uint maxComputeBindings; /// Maximum number of compute bindings.
  694. uint maxVertexLayouts; /// Maximum number of vertex format layouts.
  695. uint maxVertexStreams; /// Maximum number of vertex streams.
  696. uint maxIndexBuffers; /// Maximum number of index buffer handles.
  697. uint maxVertexBuffers; /// Maximum number of vertex buffer handles.
  698. uint maxDynamicIndexBuffers; /// Maximum number of dynamic index buffer handles.
  699. uint maxDynamicVertexBuffers; /// Maximum number of dynamic vertex buffer handles.
  700. uint maxUniforms; /// Maximum number of uniform handles.
  701. uint maxOcclusionQueries; /// Maximum number of occlusion query handles.
  702. uint maxEncoders; /// Maximum number of encoder threads.
  703. uint minResourceCbSize; /// Minimum resource command buffer size.
  704. uint transientVbSize; /// Maximum transient vertex buffer size.
  705. uint transientIbSize; /// Maximum transient index buffer size.
  706. }
  707. /// Renderer capabilities.
  708. struct bgfx_caps_t
  709. {
  710. bgfx_renderer_type_t rendererType; /// Renderer backend type. See: `bgfx::RendererType`
  711. /**
  712. * Supported functionality.
  713. * @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps
  714. */
  715. ulong supported;
  716. ushort vendorId; /// Selected GPU vendor PCI id.
  717. ushort deviceId; /// Selected GPU device id.
  718. bool homogeneousDepth; /// True when NDC depth is in [-1, 1] range, otherwise its [0, 1].
  719. bool originBottomLeft; /// True when NDC origin is at bottom left.
  720. ubyte numGPUs; /// Number of enumerated GPUs.
  721. bgfx_caps_gpu_t[4] gpu; /// Enumerated GPUs.
  722. bgfx_caps_limits_t limits; /// Renderer runtime limits.
  723. /**
  724. * Supported texture format capabilities flags:
  725. * - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported.
  726. * - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported.
  727. * - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported.
  728. * - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated.
  729. * - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported.
  730. * - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported.
  731. * - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated.
  732. * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported.
  733. * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported.
  734. * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated.
  735. * - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader.
  736. * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image
  737. * and read from.
  738. * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image
  739. * and written to.
  740. * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame
  741. * buffer.
  742. * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA
  743. * frame buffer.
  744. * - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA.
  745. * - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated
  746. * mips.
  747. */
  748. ushort[bgfx_texture_format_t.BGFX_TEXTURE_FORMAT_COUNT] formats;
  749. }
  750. /// Internal data.
  751. struct bgfx_internal_data_t
  752. {
  753. const(bgfx_caps_t)* caps; /// Renderer capabilities.
  754. void* context; /// GL context, or D3D device.
  755. }
  756. /// Platform data.
  757. struct bgfx_platform_data_t
  758. {
  759. void* ndt; /// Native display type (*nix specific).
  760. /**
  761. * Native window handle. If `NULL`, bgfx will create a headless
  762. * context/device, provided the rendering API supports it.
  763. */
  764. void* nwh;
  765. /**
  766. * GL context, D3D device, or Vulkan device. If `NULL`, bgfx
  767. * will create context/device.
  768. */
  769. void* context;
  770. /**
  771. * GL back-buffer, or D3D render target view. If `NULL` bgfx will
  772. * create back-buffer color surface.
  773. */
  774. void* backBuffer;
  775. /**
  776. * Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer
  777. * depth/stencil surface.
  778. */
  779. void* backBufferDS;
  780. }
  781. /// Backbuffer resolution and reset parameters.
  782. struct bgfx_resolution_t
  783. {
  784. bgfx_texture_format_t format; /// Backbuffer format.
  785. uint width; /// Backbuffer width.
  786. uint height; /// Backbuffer height.
  787. uint reset; /// Reset parameters.
  788. ubyte numBackBuffers; /// Number of back buffers.
  789. ubyte maxFrameLatency; /// Maximum frame latency.
  790. }
  791. /// Configurable runtime limits parameters.
  792. struct bgfx_init_limits_t
  793. {
  794. ushort maxEncoders; /// Maximum number of encoder threads.
  795. uint minResourceCbSize; /// Minimum resource command buffer size.
  796. uint transientVbSize; /// Maximum transient vertex buffer size.
  797. uint transientIbSize; /// Maximum transient index buffer size.
  798. }
  799. /// Initialization parameters used by `bgfx::init`.
  800. struct bgfx_init_t
  801. {
  802. /**
  803. * Select rendering backend. When set to RendererType::Count
  804. * a default rendering backend will be selected appropriate to the platform.
  805. * See: `bgfx::RendererType`
  806. */
  807. bgfx_renderer_type_t type;
  808. /**
  809. * Vendor PCI ID. If set to `BGFX_PCI_ID_NONE`, discrete and integrated
  810. * GPUs will be prioritised.
  811. * - `BGFX_PCI_ID_NONE` - Autoselect adapter.
  812. * - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer.
  813. * - `BGFX_PCI_ID_AMD` - AMD adapter.
  814. * - `BGFX_PCI_ID_APPLE` - Apple adapter.
  815. * - `BGFX_PCI_ID_INTEL` - Intel adapter.
  816. * - `BGFX_PCI_ID_NVIDIA` - NVIDIA adapter.
  817. * - `BGFX_PCI_ID_MICROSOFT` - Microsoft adapter.
  818. */
  819. ushort vendorId;
  820. /**
  821. * Device ID. If set to 0 it will select first device, or device with
  822. * matching ID.
  823. */
  824. ushort deviceId;
  825. ulong capabilities; /// Capabilities initialization mask (default: UINT64_MAX).
  826. bool debug_; /// Enable device for debugging.
  827. bool profile; /// Enable device for profiling.
  828. bgfx_platform_data_t platformData; /// Platform data.
  829. bgfx_resolution_t resolution; /// Backbuffer resolution and reset parameters. See: `bgfx::Resolution`.
  830. bgfx_init_limits_t limits; /// Configurable runtime limits parameters.
  831. /**
  832. * Provide application specific callback interface.
  833. * See: `bgfx::CallbackI`
  834. */
  835. void* callback;
  836. /**
  837. * Custom allocator. When a custom allocator is not
  838. * specified, bgfx uses the CRT allocator. Bgfx assumes
  839. * custom allocator is thread safe.
  840. */
  841. void* allocator;
  842. }
  843. /**
  844. * Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`.
  845. * @attention It is illegal to create this structure on stack and pass it to any bgfx API.
  846. */
  847. struct bgfx_memory_t
  848. {
  849. ubyte* data; /// Pointer to data.
  850. uint size; /// Data size.
  851. }
  852. /// Transient index buffer.
  853. struct bgfx_transient_index_buffer_t
  854. {
  855. ubyte* data; /// Pointer to data.
  856. uint size; /// Data size.
  857. uint startIndex; /// First index.
  858. bgfx_index_buffer_handle_t handle; /// Index buffer handle.
  859. bool isIndex16; /// Index buffer format is 16-bits if true, otherwise it is 32-bit.
  860. }
  861. /// Transient vertex buffer.
  862. struct bgfx_transient_vertex_buffer_t
  863. {
  864. ubyte* data; /// Pointer to data.
  865. uint size; /// Data size.
  866. uint startVertex; /// First vertex.
  867. ushort stride; /// Vertex stride.
  868. bgfx_vertex_buffer_handle_t handle; /// Vertex buffer handle.
  869. bgfx_vertex_layout_handle_t layoutHandle; /// Vertex layout handle.
  870. }
  871. /// Instance data buffer info.
  872. struct bgfx_instance_data_buffer_t
  873. {
  874. ubyte* data; /// Pointer to data.
  875. uint size; /// Data size.
  876. uint offset; /// Offset in vertex buffer.
  877. uint num; /// Number of instances.
  878. ushort stride; /// Vertex buffer stride.
  879. bgfx_vertex_buffer_handle_t handle; /// Vertex buffer object handle.
  880. }
  881. /// Texture info.
  882. struct bgfx_texture_info_t
  883. {
  884. bgfx_texture_format_t format; /// Texture format.
  885. uint storageSize; /// Total amount of bytes required to store texture.
  886. ushort width; /// Texture width.
  887. ushort height; /// Texture height.
  888. ushort depth; /// Texture depth.
  889. ushort numLayers; /// Number of layers in texture array.
  890. ubyte numMips; /// Number of MIP maps.
  891. ubyte bitsPerPixel; /// Format bits per pixel.
  892. bool cubeMap; /// Texture is cubemap.
  893. }
  894. /// Uniform info.
  895. struct bgfx_uniform_info_t
  896. {
  897. char[256] name; /// Uniform name.
  898. bgfx_uniform_type_t type; /// Uniform type.
  899. ushort num; /// Number of elements in array.
  900. }
  901. /// Frame buffer texture attachment info.
  902. struct bgfx_attachment_t
  903. {
  904. bgfx_access_t access; /// Attachment access. See `Access::Enum`.
  905. bgfx_texture_handle_t handle; /// Render target texture handle.
  906. ushort mip; /// Mip level.
  907. ushort layer; /// Cubemap side or depth layer/slice to use.
  908. ushort numLayers; /// Number of texture layer/slice(s) in array to use.
  909. ubyte resolve; /// Resolve flags. See: `BGFX_RESOLVE_*`
  910. }
  911. /// Transform data.
  912. struct bgfx_transform_t
  913. {
  914. float* data; /// Pointer to first 4x4 matrix.
  915. ushort num; /// Number of matrices.
  916. }
  917. /// View stats.
  918. struct bgfx_view_stats_t
  919. {
  920. char[256] name; /// View name.
  921. bgfx_view_id_t view; /// View id.
  922. long cpuTimeBegin; /// CPU (submit) begin time.
  923. long cpuTimeEnd; /// CPU (submit) end time.
  924. long gpuTimeBegin; /// GPU begin time.
  925. long gpuTimeEnd; /// GPU end time.
  926. uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd.
  927. }
  928. /// Encoder stats.
  929. struct bgfx_encoder_stats_t
  930. {
  931. long cpuTimeBegin; /// Encoder thread CPU submit begin time.
  932. long cpuTimeEnd; /// Encoder thread CPU submit end time.
  933. }
  934. /**
  935. * Renderer statistics data.
  936. * @remarks All time values are high-resolution timestamps, while
  937. * time frequencies define timestamps-per-second for that hardware.
  938. */
  939. struct bgfx_stats_t
  940. {
  941. long cpuTimeFrame; /// CPU time between two `bgfx::frame` calls.
  942. long cpuTimeBegin; /// Render thread CPU submit begin time.
  943. long cpuTimeEnd; /// Render thread CPU submit end time.
  944. long cpuTimerFreq; /// CPU timer frequency. Timestamps-per-second
  945. long gpuTimeBegin; /// GPU frame begin time.
  946. long gpuTimeEnd; /// GPU frame end time.
  947. long gpuTimerFreq; /// GPU timer frequency.
  948. long waitRender; /// Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API.
  949. long waitSubmit; /// Time spent waiting for submit thread to advance to next frame.
  950. uint numDraw; /// Number of draw calls submitted.
  951. uint numCompute; /// Number of compute calls submitted.
  952. uint numBlit; /// Number of blit calls submitted.
  953. uint maxGpuLatency; /// GPU driver latency.
  954. uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd.
  955. ushort numDynamicIndexBuffers; /// Number of used dynamic index buffers.
  956. ushort numDynamicVertexBuffers; /// Number of used dynamic vertex buffers.
  957. ushort numFrameBuffers; /// Number of used frame buffers.
  958. ushort numIndexBuffers; /// Number of used index buffers.
  959. ushort numOcclusionQueries; /// Number of used occlusion queries.
  960. ushort numPrograms; /// Number of used programs.
  961. ushort numShaders; /// Number of used shaders.
  962. ushort numTextures; /// Number of used textures.
  963. ushort numUniforms; /// Number of used uniforms.
  964. ushort numVertexBuffers; /// Number of used vertex buffers.
  965. ushort numVertexLayouts; /// Number of used vertex layouts.
  966. long textureMemoryUsed; /// Estimate of texture memory used.
  967. long rtMemoryUsed; /// Estimate of render target memory used.
  968. int transientVbUsed; /// Amount of transient vertex buffer used.
  969. int transientIbUsed; /// Amount of transient index buffer used.
  970. uint[bgfx_topology_t.BGFX_TOPOLOGY_COUNT] numPrims; /// Number of primitives rendered.
  971. long gpuMemoryMax; /// Maximum available GPU memory for application.
  972. long gpuMemoryUsed; /// Amount of GPU memory used by the application.
  973. ushort width; /// Backbuffer width in pixels.
  974. ushort height; /// Backbuffer height in pixels.
  975. ushort textWidth; /// Debug text width in characters.
  976. ushort textHeight; /// Debug text height in characters.
  977. ushort numViews; /// Number of view stats.
  978. bgfx_view_stats_t* viewStats; /// Array of View stats.
  979. ubyte numEncoders; /// Number of encoders used during frame.
  980. bgfx_encoder_stats_t* encoderStats; /// Array of encoder stats.
  981. }
  982. /// Vertex layout.
  983. struct bgfx_vertex_layout_t
  984. {
  985. uint hash; /// Hash.
  986. ushort stride; /// Stride.
  987. ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] offset; /// Attribute offsets.
  988. ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] attributes; /// Used attributes.
  989. }
  990. /**
  991. * Encoders are used for submitting draw calls from multiple threads. Only one encoder
  992. * per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread.
  993. */
  994. struct bgfx_encoder_t
  995. {
  996. }
  997. struct bgfx_dynamic_index_buffer_handle_t { ushort idx; }
  998. struct bgfx_dynamic_vertex_buffer_handle_t { ushort idx; }
  999. struct bgfx_frame_buffer_handle_t { ushort idx; }
  1000. struct bgfx_index_buffer_handle_t { ushort idx; }
  1001. struct bgfx_indirect_buffer_handle_t { ushort idx; }
  1002. struct bgfx_occlusion_query_handle_t { ushort idx; }
  1003. struct bgfx_program_handle_t { ushort idx; }
  1004. struct bgfx_shader_handle_t { ushort idx; }
  1005. struct bgfx_texture_handle_t { ushort idx; }
  1006. struct bgfx_uniform_handle_t { ushort idx; }
  1007. struct bgfx_vertex_buffer_handle_t { ushort idx; }
  1008. struct bgfx_vertex_layout_handle_t { ushort idx; }