bgfx.idl 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045
  1. -- vim: syntax=lua
  2. -- bgfx interface
  3. version(105)
  4. typedef "bool"
  5. typedef "char"
  6. typedef "float"
  7. typedef "int8_t"
  8. typedef "int32_t"
  9. typedef "int64_t"
  10. typedef "uint8_t"
  11. typedef "uint16_t"
  12. typedef "uint32_t"
  13. typedef "uint64_t"
  14. typedef "uintptr_t"
  15. typedef "va_list"
  16. typedef "void"
  17. typedef "ViewId"
  18. typedef "CallbackI" { cname = "callback_interface" }
  19. typedef "bx::AllocatorI" { cname = "allocator_interface" }
  20. --- Memory release callback.
  21. funcptr.ReleaseFn
  22. "void"
  23. .ptr "void*" --- Pointer to allocated data.
  24. .userData "void*" --- User defined data if needed.
  25. --- Color RGB/alpha/depth write. When it's not specified write will be disabled.
  26. flag.StateWrite { bits = 64 , base = 1 }
  27. .R --- Enable R write.
  28. .G --- Enable G write.
  29. .B --- Enable B write.
  30. .A --- Enable alpha write.
  31. .Z ( 39 ) --- Enable depth write.
  32. .Rgb { "R", "G", "B" } --- Enable RGB write.
  33. .Mask { "Rgb", "A", "Z" } --- Write all channels mask.
  34. --- Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled.
  35. flag.StateDepthTest { bits = 64, shift = 4, range = 4, base = 1 , desc = "Depth test state" }
  36. .Less --- Enable depth test, less.
  37. .Lequal --- Enable depth test, less or equal.
  38. .Equal --- Enable depth test, equal.
  39. .Gequal --- Enable depth test, greater or equal.
  40. .Greater --- Enable depth test, greater.
  41. .Notequal --- Enable depth test, not equal.
  42. .Never --- Enable depth test, never.
  43. .Always --- Enable depth test, always.
  44. ()
  45. --- Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
  46. --- helper macros.
  47. flag.StateBlend { bits = 64, shift = 12, range = 16, base = 1, desc = "Blend state" }
  48. .Zero --- 0, 0, 0, 0
  49. .One --- 1, 1, 1, 1
  50. .SrcColor --- Rs, Gs, Bs, As
  51. .InvSrcColor --- 1-Rs, 1-Gs, 1-Bs, 1-As
  52. .SrcAlpha --- As, As, As, As
  53. .InvSrcAlpha --- 1-As, 1-As, 1-As, 1-As
  54. .DstAlpha --- Ad, Ad, Ad, Ad
  55. .InvDstAlpha --- 1-Ad, 1-Ad, 1-Ad ,1-Ad
  56. .DstColor --- Rd, Gd, Bd, Ad
  57. .InvDstColor --- 1-Rd, 1-Gd, 1-Bd, 1-Ad
  58. .SrcAlphaSat --- f, f, f, 1; f = min(As, 1-Ad)
  59. .Factor --- Blend factor
  60. .InvFactor --- 1-Blend factor
  61. ()
  62. --- Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
  63. --- helper macros.
  64. flag.StateBlendEquation { bits = 64, shift = 28, range = 6, base = 0, desc = "Blend equation" }
  65. .Add --- Blend add: src + dst.
  66. .Sub --- Blend subtract: src - dst.
  67. .Revsub --- Blend reverse subtract: dst - src.
  68. .Min --- Blend min: min(src, dst).
  69. .Max --- Blend max: max(src, dst).
  70. ()
  71. --- Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled.
  72. flag.StateCull { bits = 64, shift = 36, range = 2, base = 1, desc = "Culling mode" }
  73. .Cw --- Cull clockwise triangles.
  74. .Ccw --- Cull counter-clockwise triangles.
  75. ()
  76. --- Alpha reference value.
  77. flag.StateAlphaRef { bits = 64, shift = 40, range = 8, desc = "Alpha reference", "helper" }
  78. flag.StatePt { bits = 64, shift = 48, range = 3, base = 1, desc = "Primitive type" }
  79. .Tristrip --- Tristrip.
  80. .Lines --- Lines.
  81. .Linestrip --- Line strip.
  82. .Points --- Points.
  83. ()
  84. --- Point size value.
  85. flag.StatePointSize { bits = 64, shift = 52, range = 4, desc = "Point size", "helper" }
  86. --- Enable MSAA write when writing into MSAA frame buffer.
  87. --- This flag is ignored when not writing into MSAA frame buffer.
  88. flag.State { bits = 64 , range = 64 , desc = "State" }
  89. .Msaa (57) --- Enable MSAA rasterization.
  90. .Lineaa (58) --- Enable line AA rasterization.
  91. .ConservativeRaster (59) --- Enable conservative rasterization.
  92. .None (0) --- No state.
  93. .FrontCcw(40) --- Front counter-clockwise (default is clockwise).
  94. .BlendIndependent(35) --- Enable blend independent.
  95. .BlendAlphaToCoverage (36) --- Enable alpha to coverage.
  96. .Default { "WriteRgb", "WriteA", "WriteZ", "DepthTestLess", "CullCw", "Msaa" }
  97. --- Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
  98. --- culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored).
  99. --- Do not use!
  100. flag.StateReserved { bits = 64, shift = 61, range = 3 }
  101. --- Set stencil ref value.
  102. flag.StencilFuncRef { bits = 32, shift = 0, range = 8, "helper" }
  103. --- Set stencil rmask value.
  104. flag.StencilFuncRmask { bits = 32, shift = 8, range = 8, "helper" }
  105. flag.Stencil { bits = 32, const }
  106. .None (0x00000000)
  107. .Mask (0xffffffff)
  108. .Default (0x00000000)
  109. flag.StencilTest { bits = 32, shift = 16, range = 4 , base = 1, desc = "Stencil test" }
  110. .Less --- Enable stencil test, less.
  111. .Lequal --- Enable stencil test, less or equal.
  112. .Equal --- Enable stencil test, equal.
  113. .Gequal --- Enable stencil test, greater or equal.
  114. .Greater --- Enable stencil test, greater.
  115. .Notequal --- Enable stencil test, not equal.
  116. .Never --- Enable stencil test, never.
  117. .Always --- Enable stencil test, always.
  118. ()
  119. flag.StencilOpFailS { bits = 32, shift = 20, range = 4, base = 0, desc = "Stencil operation fail" }
  120. .Zero --- Zero.
  121. .Keep --- Keep.
  122. .Replace --- Replace.
  123. .Incr --- Increment and wrap.
  124. .Incrsat --- Increment and clamp.
  125. .Decr --- Decrement and wrap.
  126. .Decrsat --- Decrement and clamp.
  127. .Invert --- Invert.
  128. ()
  129. flag.StencilOpFailZ { bits = 32, shift = 24, range = 4, base = 0, desc = "Stencil operation depth fail" }
  130. .Zero --- Zero.
  131. .Keep --- Keep.
  132. .Replace --- Replace.
  133. .Incr --- Increment and wrap.
  134. .Incrsat --- Increment and clamp.
  135. .Decr --- Decrement and wrap.
  136. .Decrsat --- Decrement and clamp.
  137. .Invert --- Invert.
  138. ()
  139. flag.StencilOpPassZ { bits = 32, shift = 28, range = 4 , base = 0, desc = "Stencil operation depth pass" }
  140. .Zero --- Zero.
  141. .Keep --- Keep.
  142. .Replace --- Replace.
  143. .Incr --- Increment and wrap.
  144. .Incrsat --- Increment and clamp.
  145. .Decr --- Decrement and wrap.
  146. .Decrsat --- Decrement and clamp.
  147. .Invert --- Invert.
  148. ()
  149. flag.Clear { bits = 16 }
  150. .None --- No clear flags.
  151. .Color --- Clear color.
  152. .Depth --- Clear depth.
  153. .Stencil --- Clear stencil.
  154. .DiscardColor_0 --- Discard frame buffer attachment 0.
  155. .DiscardColor_1 --- Discard frame buffer attachment 1.
  156. .DiscardColor_2 --- Discard frame buffer attachment 2.
  157. .DiscardColor_3 --- Discard frame buffer attachment 3.
  158. .DiscardColor_4 --- Discard frame buffer attachment 4.
  159. .DiscardColor_5 --- Discard frame buffer attachment 5.
  160. .DiscardColor_6 --- Discard frame buffer attachment 6.
  161. .DiscardColor_7 --- Discard frame buffer attachment 7.
  162. .DiscardDepth --- Discard frame buffer depth attachment.
  163. .DiscardStencil --- Discard frame buffer stencil attachment.
  164. .DiscardColorMask {
  165. "DiscardColor_0",
  166. "DiscardColor_1",
  167. "DiscardColor_2",
  168. "DiscardColor_3",
  169. "DiscardColor_4",
  170. "DiscardColor_5",
  171. "DiscardColor_6",
  172. "DiscardColor_7"
  173. }
  174. .DiscardMask {
  175. "DiscardColorMask",
  176. "DiscardDepth",
  177. "DiscardStencil"
  178. }
  179. --- Rendering state discard. When state is preserved in submit, rendering states can be discarded
  180. --- on a finer grain.
  181. flag.Discard { bits = 8, const, desc = "Discard flags" }
  182. .None (0x00) --- Preserve everything.
  183. .Bindings (0x01) --- Discard texture sampler and buffer bindings.
  184. .IndexBuffer (0x02) --- Discard index buffer.
  185. .InstanceData (0x04) --- Discard instance data.
  186. .State (0x08) --- Discard state.
  187. .Transform (0x10) --- Discard transform.
  188. .VertexStreams (0x20) --- Discard vertex streams.
  189. .All (0xff) --- Discard all states.
  190. ()
  191. flag.Debug { bits = 32 }
  192. .None --- No debug.
  193. .Wireframe --- Enable wireframe for all primitives.
  194. .Ifh --- Enable infinitely fast hardware test. No draw calls will be submitted to driver.
  195. --- It's useful when profiling to quickly assess bottleneck between CPU and GPU.
  196. .Stats --- Enable statistics display.
  197. .Text --- Enable debug text display.
  198. .Profiler --- Enable profiler.
  199. ()
  200. flag.BufferComputeFormat { bits = 16, shift = 0, range = 4, base = 1 }
  201. ._8x1 --- 1 8-bit value
  202. ._8x2 --- 2 8-bit values
  203. ._8x4 --- 4 8-bit values
  204. ._16x1 --- 1 16-bit value
  205. ._16x2 --- 2 16-bit values
  206. ._16x4 --- 4 16-bit values
  207. ._32x1 --- 1 32-bit value
  208. ._32x2 --- 2 32-bit values
  209. ._32x4 --- 4 32-bit values
  210. ()
  211. flag.BufferComputeType { bits = 16, shift = 4, range = 2, base = 1 }
  212. .Int --- Type `int`.
  213. .Uint --- Type `uint`.
  214. .Float --- Type `float`.
  215. ()
  216. flag.Buffer { bits = 16, base = 8 }
  217. .None(0)
  218. .ComputeRead --- Buffer will be read by shader.
  219. .ComputeWrite --- Buffer will be used for writing.
  220. .DrawIndirect --- Buffer will be used for storing draw indirect commands.
  221. .AllowResize --- Allow dynamic index/vertex buffer resize during update.
  222. .Index32 --- Index buffer contains 32-bit indices.
  223. .ComputeReadWrite { "ComputeRead" , "ComputeWrite" }
  224. ()
  225. flag.Texture { bits = 64 }
  226. .None (0)
  227. .MsaaSample (36) --- Texture will be used for MSAA sampling.
  228. .Rt (37) --- Render target no MSAA.
  229. .ComputeWrite (45) --- Texture will be used for compute write.
  230. .Srgb (46) --- Sample texture as sRGB.
  231. .BlitDst (47) --- Texture will be used as blit destination.
  232. .ReadBack (48) --- Texture will be used for read back from GPU.
  233. ()
  234. flag.TextureRtMsaa { bits = 64, shift = 36, range = 3 , base = 2 }
  235. .X2 --- Render target MSAAx2 mode.
  236. .X4 --- Render target MSAAx4 mode.
  237. .X8 --- Render target MSAAx8 mode.
  238. .X16 --- Render target MSAAx16 mode.
  239. ()
  240. flag.TextureRt { bits = 64, shift = 36, range = 4 }
  241. .WriteOnly (9) --- Render target will be used for writing
  242. --- Sampler flags.
  243. flag.SamplerU { bits = 32, shift = 0, range = 2, base = 1 }
  244. .Mirror --- Wrap U mode: Mirror
  245. .Clamp --- Wrap U mode: Clamp
  246. .Border --- Wrap U mode: Border
  247. ()
  248. flag.SamplerV { bits = 32, shift = 2, range = 2, base = 1 }
  249. .Mirror --- Wrap V mode: Mirror
  250. .Clamp --- Wrap V mode: Clamp
  251. .Border --- Wrap V mode: Border
  252. ()
  253. flag.SamplerW { bits = 32, shift = 4, range = 2, base = 1 }
  254. .Mirror --- Wrap W mode: Mirror
  255. .Clamp --- Wrap W mode: Clamp
  256. .Border --- Wrap W mode: Border
  257. ()
  258. flag.SamplerMin { bits = 32, shift = 6, range = 2, base = 1 }
  259. .Point --- Min sampling mode: Point
  260. .Anisotropic --- Min sampling mode: Anisotropic
  261. ()
  262. flag.SamplerMag { bits = 32, shift = 8, range = 2, base = 1 }
  263. .Point --- Mag sampling mode: Point
  264. .Anisotropic --- Mag sampling mode: Anisotropic
  265. ()
  266. flag.SamplerMip { bits = 32, shift = 10, range = 1, base = 1 }
  267. .Point --- Mip sampling mode: Point
  268. ()
  269. flag.SamplerCompare { bits = 32 , shift = 16, range = 4, base = 1 }
  270. .Less --- Compare when sampling depth texture: less.
  271. .Lequal --- Compare when sampling depth texture: less or equal.
  272. .Equal --- Compare when sampling depth texture: equal.
  273. .Gequal --- Compare when sampling depth texture: greater or equal.
  274. .Greater --- Compare when sampling depth texture: greater.
  275. .Notequal --- Compare when sampling depth texture: not equal.
  276. .Never --- Compare when sampling depth texture: never.
  277. .Always --- Compare when sampling depth texture: always.
  278. ()
  279. flag.SamplerBorderColor { bits = 32, shift = 24, range = 4, "helper" }
  280. flag.SamplerReserved { bits = 32, shift = 28, range = 4 }
  281. flag.Sampler { bits = 32 }
  282. .None
  283. .SampleStencil (21) --- Sample stencil instead of depth.
  284. .Point { "MinPoint", "MagPoint", "MipPoint" }
  285. .UvwMirror { "UMirror", "VMirror", "WMirror" }
  286. .UvwClamp { "UClamp", "VClamp", "WClamp" }
  287. .UvwBorder { "UBorder", "VBorder", "WBorder" }
  288. .BitsMask {
  289. "UMask",
  290. "VMask",
  291. "WMask",
  292. "MinMask",
  293. "MagMask",
  294. "MipMask",
  295. "CompareMask"
  296. }
  297. ()
  298. flag.ResetMsaa { bits = 32, shift = 4, range = 3, base = 1 }
  299. .X2 --- Enable 2x MSAA.
  300. .X4 --- Enable 4x MSAA.
  301. .X8 --- Enable 8x MSAA.
  302. .X16 --- Enable 16x MSAA.
  303. ()
  304. flag.Reset { bits = 32 }
  305. .None ( 0) --- No reset flags.
  306. .Fullscreen ( 1) --- Not supported yet.
  307. .Vsync ( 8) --- Enable V-Sync.
  308. .Maxanisotropy ( 9) --- Turn on/off max anisotropy.
  309. .Capture (10) --- Begin screen capture.
  310. .FlushAfterRender (14) --- Flush rendering after submitting to GPU.
  311. .FlipAfterRender (15) --- This flag specifies where flip occurs. Default behavior is that flip occurs
  312. --- before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  313. .SrgbBackbuffer (16) --- Enable sRGB backbuffer.
  314. .Hdr10 (17) --- Enable HDR10 rendering.
  315. .Hidpi (18) --- Enable HiDPI rendering.
  316. .DepthClamp (19) --- Enable depth clamp.
  317. .Suspend (20) --- Suspend rendering.
  318. ()
  319. flag.ResetFullscreen { bits = 32, shift = 0, range = 1, base = 1 }
  320. ()
  321. flag.ResetReserved { bits = 32, shift = 31, range = 1 , desc = "Internal" }
  322. flag.Caps { bits = 64, base = 1, name = "Caps" }
  323. .AlphaToCoverage --- Alpha to coverage is supported.
  324. .BlendIndependent --- Blend independent is supported.
  325. .Compute --- Compute shaders are supported.
  326. .ConservativeRaster --- Conservative rasterization is supported.
  327. .DrawIndirect --- Draw indirect is supported.
  328. .FragmentDepth --- Fragment depth is accessible in fragment shader.
  329. .FragmentOrdering --- Fragment ordering is available in fragment shader.
  330. .FramebufferRw --- Read/Write frame buffer attachments are supported.
  331. .GraphicsDebugger --- Graphics debugger is present.
  332. .Reserved
  333. .Hdr10 --- HDR10 rendering is supported.
  334. .Hidpi --- HiDPI rendering is supported.
  335. .Index32 --- 32-bit indices are supported.
  336. .Instancing --- Instancing is supported.
  337. .OcclusionQuery --- Occlusion query is supported.
  338. .RendererMultithreaded --- Renderer is on separate thread.
  339. .SwapChain --- Multiple windows are supported.
  340. .Texture_2dArray --- 2D texture array is supported.
  341. .Texture_3d --- 3D textures are supported.
  342. .TextureBlit --- Texture blit is supported.
  343. .TextureCompareReserved --- All texture compare modes are supported.
  344. .TextureCompareLequal --- Texture compare less equal mode is supported.
  345. .TextureCubeArray --- Cubemap texture array is supported.
  346. .TextureDirectAccess --- CPU direct access to GPU texture memory.
  347. .TextureReadBack --- Read-back texture is supported.
  348. .VertexAttribHalf --- Vertex attribute half-float is supported.
  349. .VertexAttribUint10 --- Vertex attribute 10_10_10_2 is supported.
  350. .VertexId --- Rendering with VertexID only is supported.
  351. .TextureCompareAll { "TextureCompareReserved", "TextureCompareLequal" } --- All texture compare modes are supported.
  352. ()
  353. flag.CapsFormat { bits = 16 }
  354. .TextureNone --- Texture format is not supported.
  355. .Texture_2d --- Texture format is supported.
  356. .Texture_2dSrgb --- Texture as sRGB format is supported.
  357. .Texture_2dEmulated --- Texture format is emulated.
  358. .Texture_3d --- Texture format is supported.
  359. .Texture_3dSrgb --- Texture as sRGB format is supported.
  360. .Texture_3dEmulated --- Texture format is emulated.
  361. .TextureCube --- Texture format is supported.
  362. .TextureCubeSrgb --- Texture as sRGB format is supported.
  363. .TextureCubeEmulated --- Texture format is emulated.
  364. .TextureVertex --- Texture format can be used from vertex shader.
  365. .TextureImage --- Texture format can be used as image from compute shader.
  366. .TextureFramebuffer --- Texture format can be used as frame buffer.
  367. .TextureFramebufferMsaa --- Texture format can be used as MSAA frame buffer.
  368. .TextureMsaa --- Texture can be sampled as MSAA.
  369. .TextureMipAutogen --- Texture format supports auto-generated mips.
  370. ()
  371. flag.Resolve { bits = 8 }
  372. .None --- No resolve flags.
  373. .AutoGenMips --- Auto-generate mip maps on resolve.
  374. ()
  375. flag.PciId { bits = 16 , const }
  376. .None (0x0000) --- Autoselect adapter.
  377. .SoftwareRasterizer (0x0001) --- Software rasterizer.
  378. .Amd (0x1002) --- AMD adapter.
  379. .Intel (0x8086) --- Intel adapter.
  380. .Nvidia (0x10de) --- nVidia adapter.
  381. ()
  382. flag.CubeMap { bits = 8, const }
  383. .PositiveX (0x00) --- Cubemap +x.
  384. .NegativeX (0x01) --- Cubemap -x.
  385. .PositiveY (0x02) --- Cubemap +y.
  386. .NegativeY (0x03) --- Cubemap -y.
  387. .PositiveZ (0x04) --- Cubemap +z.
  388. .NegativeZ (0x05) --- Cubemap -z.
  389. ()
  390. --- Fatal error enum.
  391. enum.Fatal { underscore, comment = "" }
  392. .DebugCheck
  393. .InvalidShader
  394. .UnableToInitialize
  395. .UnableToCreateTexture
  396. .DeviceLost
  397. () -- end of enum
  398. --- Renderer backend type enum.
  399. enum.RendererType { comment = "Renderer types:" }
  400. .Noop --- No rendering.
  401. .Direct3D9 --- Direct3D 9.0
  402. .Direct3D11 --- Direct3D 11.0
  403. .Direct3D12 --- Direct3D 12.0
  404. .Gnm --- GNM
  405. .Metal --- Metal
  406. .Nvn --- NVN
  407. .OpenGLES --- OpenGL ES 2.0+
  408. .OpenGL --- OpenGL 2.1+
  409. .Vulkan --- Vulkan
  410. ()
  411. --- Access mode enum.
  412. enum.Access { comment = "Access:" }
  413. .Read --- Read.
  414. .Write --- Write.
  415. .ReadWrite --- Read and write.
  416. ()
  417. --- Vertex attribute enum.
  418. enum.Attrib { comment = "Corresponds to vertex shader attribute." }
  419. .Position --- a_position
  420. .Normal --- a_normal
  421. .Tangent --- a_tangent
  422. .Bitangent --- a_bitangent
  423. .Color0 --- a_color0
  424. .Color1 --- a_color1
  425. .Color2 --- a_color2
  426. .Color3 --- a_color3
  427. .Indices --- a_indices
  428. .Weight --- a_weight
  429. .TexCoord0 --- a_texcoord0
  430. .TexCoord1 --- a_texcoord1
  431. .TexCoord2 --- a_texcoord2
  432. .TexCoord3 --- a_texcoord3
  433. .TexCoord4 --- a_texcoord4
  434. .TexCoord5 --- a_texcoord5
  435. .TexCoord6 --- a_texcoord6
  436. .TexCoord7 --- a_texcoord7
  437. ()
  438. --- Vertex attribute type enum.
  439. enum.AttribType { comment = "Attribute types:" }
  440. .Uint8 --- Uint8
  441. .Uint10 --- Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`.
  442. .Int16 --- Int16
  443. .Half --- Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`.
  444. .Float --- Float
  445. ()
  446. --- Texture format enum.
  447. ---
  448. --- Notation:
  449. ---
  450. --- RGBA16S
  451. --- ^ ^ ^
  452. --- | | +-- [ ]Unorm
  453. --- | | [F]loat
  454. --- | | [S]norm
  455. --- | | [I]nt
  456. --- | | [U]int
  457. --- | +---- Number of bits per component
  458. --- +-------- Components
  459. ---
  460. --- @attention Availability depends on Caps (see: formats).
  461. enum.TextureFormat { comment = "Texture formats:" }
  462. .BC1 --- DXT1 R5G6B5A1
  463. .BC2 --- DXT3 R5G6B5A4
  464. .BC3 --- DXT5 R5G6B5A8
  465. .BC4 --- LATC1/ATI1 R8
  466. .BC5 --- LATC2/ATI2 RG8
  467. .BC6H --- BC6H RGB16F
  468. .BC7 --- BC7 RGB 4-7 bits per color channel, 0-8 bits alpha
  469. .ETC1 --- ETC1 RGB8
  470. .ETC2 --- ETC2 RGB8
  471. .ETC2A --- ETC2 RGBA8
  472. .ETC2A1 --- ETC2 RGB8A1
  473. .PTC12 --- PVRTC1 RGB 2BPP
  474. .PTC14 --- PVRTC1 RGB 4BPP
  475. .PTC12A --- PVRTC1 RGBA 2BPP
  476. .PTC14A --- PVRTC1 RGBA 4BPP
  477. .PTC22 --- PVRTC2 RGBA 2BPP
  478. .PTC24 --- PVRTC2 RGBA 4BPP
  479. .ATC --- ATC RGB 4BPP
  480. .ATCE --- ATCE RGBA 8 BPP explicit alpha
  481. .ATCI --- ATCI RGBA 8 BPP interpolated alpha
  482. .ASTC4x4 --- ASTC 4x4 8.0 BPP
  483. .ASTC5x5 --- ASTC 5x5 5.12 BPP
  484. .ASTC6x6 --- ASTC 6x6 3.56 BPP
  485. .ASTC8x5 --- ASTC 8x5 3.20 BPP
  486. .ASTC8x6 --- ASTC 8x6 2.67 BPP
  487. .ASTC10x5 --- ASTC 10x5 2.56 BPP
  488. .Unknown --- Compressed formats above.
  489. .R1
  490. .A8
  491. .R8
  492. .R8I
  493. .R8U
  494. .R8S
  495. .R16
  496. .R16I
  497. .R16U
  498. .R16F
  499. .R16S
  500. .R32I
  501. .R32U
  502. .R32F
  503. .RG8
  504. .RG8I
  505. .RG8U
  506. .RG8S
  507. .RG16
  508. .RG16I
  509. .RG16U
  510. .RG16F
  511. .RG16S
  512. .RG32I
  513. .RG32U
  514. .RG32F
  515. .RGB8
  516. .RGB8I
  517. .RGB8U
  518. .RGB8S
  519. .RGB9E5F
  520. .BGRA8
  521. .RGBA8
  522. .RGBA8I
  523. .RGBA8U
  524. .RGBA8S
  525. .RGBA16
  526. .RGBA16I
  527. .RGBA16U
  528. .RGBA16F
  529. .RGBA16S
  530. .RGBA32I
  531. .RGBA32U
  532. .RGBA32F
  533. .R5G6B5
  534. .RGBA4
  535. .RGB5A1
  536. .RGB10A2
  537. .RG11B10F
  538. .UnknownDepth --- Depth formats below.
  539. .D16
  540. .D24
  541. .D24S8
  542. .D32
  543. .D16F
  544. .D24F
  545. .D32F
  546. .D0S8
  547. ()
  548. --- Uniform type enum.
  549. enum.UniformType { comment = "Uniform types:" }
  550. .Sampler [[Sampler.]]
  551. .End [[Reserved, do not use.]]
  552. .Vec4 [[4 floats vector.]]
  553. .Mat3 [[3x3 matrix.]]
  554. .Mat4 [[4x4 matrix.]]
  555. --- Backbuffer ratio enum.
  556. enum.BackbufferRatio { comment = "Backbuffer ratios:" }
  557. .Equal [[Equal to backbuffer.]]
  558. .Half [[One half size of backbuffer.]]
  559. .Quarter [[One quarter size of backbuffer.]]
  560. .Eighth [[One eighth size of backbuffer.]]
  561. .Sixteenth [[One sixteenth size of backbuffer.]]
  562. .Double [[Double size of backbuffer.]]
  563. --- Occlusion query result.
  564. enum.OcclusionQueryResult { comment = "Occlusion query results:" }
  565. .Invisible [[Query failed test.]]
  566. .Visible [[Query passed test.]]
  567. .NoResult [[Query result is not available yet.]]
  568. --- Primitive topology.
  569. enum.Topology { underscore, comment = "Primitive topology:" }
  570. .TriList [[Triangle list.]]
  571. .TriStrip [[Triangle strip.]]
  572. .LineList [[Line list.]]
  573. .LineStrip [[Line strip.]]
  574. .PointList [[Point list.]]
  575. --- Topology conversion function.
  576. enum.TopologyConvert { underscore , comment = "Topology conversion functions:" }
  577. .TriListFlipWinding [[Flip winding order of triangle list.]]
  578. .TriStripFlipWinding [[Flip winding order of trinagle strip.]]
  579. .TriListToLineList [[Convert triangle list to line list.]]
  580. .TriStripToTriList [[Convert triangle strip to triangle list.]]
  581. .LineStripToLineList [[Convert line strip to line list.]]
  582. --- Topology sort order.
  583. enum.TopologySort { underscore, comment = "Topology sort order:" , }
  584. .DirectionFrontToBackMin
  585. .DirectionFrontToBackAvg
  586. .DirectionFrontToBackMax
  587. .DirectionBackToFrontMin
  588. .DirectionBackToFrontAvg
  589. .DirectionBackToFrontMax
  590. .DistanceFrontToBackMin
  591. .DistanceFrontToBackAvg
  592. .DistanceFrontToBackMax
  593. .DistanceBackToFrontMin
  594. .DistanceBackToFrontAvg
  595. .DistanceBackToFrontMax
  596. ()
  597. --- View mode sets draw call sort order.
  598. enum.ViewMode { underscore, comment = "View modes:" }
  599. .Default [[Default sort order.]]
  600. .Sequential [[Sort in the same order in which submit calls were called.]]
  601. .DepthAscending [[Sort draw call depth in ascending order.]]
  602. .DepthDescending [[Sort draw call depth in descending order.]]
  603. --- Render frame enum.
  604. enum.RenderFrame { underscore, comment = "" }
  605. .NoContext --- Renderer context is not created yet.
  606. .Render --- Renderer context is created and rendering.
  607. .Timeout --- Renderer context wait for main thread signal timed out without rendering.
  608. .Exiting --- Renderer context is getting destroyed.
  609. ()
  610. --- GPU info.
  611. struct.GPU { namespace = "Caps" }
  612. .vendorId "uint16_t" --- Vendor PCI id. See `BGFX_PCI_ID_*`.
  613. .deviceId "uint16_t" --- Device id.
  614. --- Renderer runtime limits.
  615. struct.Limits { namespace = "Caps" }
  616. .maxDrawCalls "uint32_t" --- Maximum number of draw calls.
  617. .maxBlits "uint32_t" --- Maximum number of blit calls.
  618. .maxTextureSize "uint32_t" --- Maximum texture size.
  619. .maxTextureLayers "uint32_t" --- Maximum texture layers.
  620. .maxViews "uint32_t" --- Maximum number of views.
  621. .maxFrameBuffers "uint32_t" --- Maximum number of frame buffer handles.
  622. .maxFBAttachments "uint32_t" --- Maximum number of frame buffer attachments.
  623. .maxPrograms "uint32_t" --- Maximum number of program handles.
  624. .maxShaders "uint32_t" --- Maximum number of shader handles.
  625. .maxTextures "uint32_t" --- Maximum number of texture handles.
  626. .maxTextureSamplers "uint32_t" --- Maximum number of texture samplers.
  627. .maxComputeBindings "uint32_t" --- Maximum number of compute bindings.
  628. .maxVertexLayouts "uint32_t" --- Maximum number of vertex format layouts.
  629. .maxVertexStreams "uint32_t" --- Maximum number of vertex streams.
  630. .maxIndexBuffers "uint32_t" --- Maximum number of index buffer handles.
  631. .maxVertexBuffers "uint32_t" --- Maximum number of vertex buffer handles.
  632. .maxDynamicIndexBuffers "uint32_t" --- Maximum number of dynamic index buffer handles.
  633. .maxDynamicVertexBuffers "uint32_t" --- Maximum number of dynamic vertex buffer handles.
  634. .maxUniforms "uint32_t" --- Maximum number of uniform handles.
  635. .maxOcclusionQueries "uint32_t" --- Maximum number of occlusion query handles.
  636. .maxEncoders "uint32_t" --- Maximum number of encoder threads.
  637. .transientVbSize "uint32_t" --- Maximum transient vertex buffer size.
  638. .transientIbSize "uint32_t" --- Maximum transient index buffer size.
  639. --- Renderer capabilities.
  640. struct.Caps
  641. .rendererType "RendererType::Enum" --- Renderer backend type. See: `bgfx::RendererType`
  642. .supported "uint64_t" --- Supported functionality.
  643. --- @attention See BGFX_CAPS_* flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps
  644. .vendorId "uint16_t" --- Selected GPU vendor PCI id.
  645. .deviceId "uint16_t" --- Selected GPU device id.
  646. .homogeneousDepth "bool" --- True when NDC depth is in [-1, 1] range, otherwise its [0, 1].
  647. .originBottomLeft "bool" --- True when NDC origin is at bottom left.
  648. .numGPUs "uint8_t" --- Number of enumerated GPUs.
  649. .gpu "GPU[4]" --- Enumerated GPUs.
  650. .limits "Limits" --- Renderer runtime limits.
  651. .formats "uint16_t[TextureFormat::Count]"
  652. --- Supported texture format capabilities flags:
  653. --- - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported.
  654. --- - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported.
  655. --- - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported.
  656. --- - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated.
  657. --- - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported.
  658. --- - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported.
  659. --- - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated.
  660. --- - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported.
  661. --- - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported.
  662. --- - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated.
  663. --- - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader.
  664. --- - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE` - Texture format can be used as image from compute
  665. --- shader.
  666. --- - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame
  667. --- buffer.
  668. --- - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA
  669. --- frame buffer.
  670. --- - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA.
  671. --- - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated
  672. --- mips.
  673. --- Internal data.
  674. struct.InternalData
  675. .caps "const Caps*" --- Renderer capabilities.
  676. .context "void*" --- GL context, or D3D device.
  677. --- Platform data.
  678. struct.PlatformData { ctor }
  679. .ndt "void*" --- Native display type (*nix specific).
  680. .nwh "void*" --- Native window handle. If `NULL` bgfx will create headless
  681. --- context/device if renderer API supports it.
  682. .context "void*" --- GL context, or D3D device. If `NULL`, bgfx will create context/device.
  683. .backBuffer "void*" --- GL back-buffer, or D3D render target view. If `NULL` bgfx will
  684. --- create back-buffer color surface.
  685. .backBufferDS "void*" --- Backbuffer depth/stencil. If `NULL` bgfx will create back-buffer
  686. --- depth/stencil surface.
  687. --- Backbuffer resolution and reset parameters.
  688. struct.Resolution { ctor }
  689. .format "TextureFormat::Enum" --- Backbuffer format.
  690. .width "uint32_t" --- Backbuffer width.
  691. .height "uint32_t" --- Backbuffer height.
  692. .reset "uint32_t" --- Reset parameters.
  693. .numBackBuffers "uint8_t" --- Number of back buffers.
  694. .maxFrameLatency "uint8_t" --- Maximum frame latency.
  695. --- Configurable runtime limits parameters.
  696. struct.Limits { namespace = "Init" }
  697. .maxEncoders "uint16_t" --- Maximum number of encoder threads.
  698. .transientVbSize "uint32_t" --- Maximum transient vertex buffer size.
  699. .transientIbSize "uint32_t" --- Maximum transient index buffer size.
  700. --- Initialization parameters used by `bgfx::init`.
  701. struct.Init { ctor }
  702. .type "RendererType::Enum" --- Select rendering backend. When set to RendererType::Count
  703. --- a default rendering backend will be selected appropriate to the platform.
  704. --- See: `bgfx::RendererType`
  705. .vendorId "uint16_t" --- Vendor PCI id. If set to `BGFX_PCI_ID_NONE` it will select the first
  706. --- device.
  707. --- - `BGFX_PCI_ID_NONE` - Autoselect adapter.
  708. --- - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer.
  709. --- - `BGFX_PCI_ID_AMD` - AMD adapter.
  710. --- - `BGFX_PCI_ID_INTEL` - Intel adapter.
  711. --- - `BGFX_PCI_ID_NVIDIA` - nVidia adapter.
  712. .deviceId "uint16_t" --- Device id. If set to 0 it will select first device, or device with
  713. --- matching id.
  714. .debug "bool" --- Enable device for debuging.
  715. .profile "bool" --- Enable device for profiling.
  716. .platformData "PlatformData" --- Platform data.
  717. .resolution "Resolution" --- Backbuffer resolution and reset parameters. See: `bgfx::Resolution`.
  718. .limits "Limits" --- Configurable runtime limits parameters.
  719. .callback "CallbackI*" --- Provide application specific callback interface.
  720. --- See: `bgfx::CallbackI`
  721. .allocator "bx::AllocatorI*" --- Custom allocator. When a custom allocator is not
  722. --- specified, bgfx uses the CRT allocator. Bgfx assumes
  723. --- custom allocator is thread safe.
  724. --- Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`.
  725. ---
  726. --- @attention It is illegal to create this structure on stack and pass it to any bgfx API.
  727. struct.Memory
  728. .data "uint8_t*" [[Pointer to data.]]
  729. .size "uint32_t" [[Data size.]]
  730. --- Transient index buffer.
  731. struct.TransientIndexBuffer
  732. .data "uint8_t*" --- Pointer to data.
  733. .size "uint32_t" --- Data size.
  734. .startIndex "uint32_t" --- First index.
  735. .handle "IndexBufferHandle" --- Index buffer handle.
  736. --- Transient vertex buffer.
  737. struct.TransientVertexBuffer
  738. .data "uint8_t*" --- Pointer to data.
  739. .size "uint32_t" --- Data size.
  740. .startVertex "uint32_t" --- First vertex.
  741. .stride "uint16_t" --- Vertex stride.
  742. .handle "VertexBufferHandle" --- Vertex buffer handle.
  743. .layoutHandle "VertexLayoutHandle" --- Vertex layout handle.
  744. --- Instance data buffer info.
  745. struct.InstanceDataBuffer
  746. .data "uint8_t*" --- Pointer to data.
  747. .size "uint32_t" --- Data size.
  748. .offset "uint32_t" --- Offset in vertex buffer.
  749. .num "uint32_t" --- Number of instances.
  750. .stride "uint16_t" --- Vertex buffer stride.
  751. .handle "VertexBufferHandle" --- Vertex buffer object handle.
  752. --- Texture info.
  753. struct.TextureInfo
  754. .format "TextureFormat::Enum" --- Texture format.
  755. .storageSize "uint32_t" --- Total amount of bytes required to store texture.
  756. .width "uint16_t" --- Texture width.
  757. .height "uint16_t" --- Texture height.
  758. .depth "uint16_t" --- Texture depth.
  759. .numLayers "uint16_t" --- Number of layers in texture array.
  760. .numMips "uint8_t" --- Number of MIP maps.
  761. .bitsPerPixel "uint8_t" --- Format bits per pixel.
  762. .cubeMap "bool" --- Texture is cubemap.
  763. --- Uniform info.
  764. struct.UniformInfo
  765. .name "char[256]" --- Uniform name.
  766. .type "UniformType::Enum" --- Uniform type.
  767. .num "uint16_t" --- Number of elements in array.
  768. --- Frame buffer texture attachment info.
  769. struct.Attachment { shortname }
  770. .access "Access::Enum" --- Attachement access. See `Access::Enum`.
  771. .handle "TextureHandle" --- Render target texture handle.
  772. .mip "uint16_t" --- Mip level.
  773. .layer "uint16_t" --- Cubemap side or depth layer/slice.
  774. .resolve "uint8_t" --- Resolve flags. See: `BGFX_RESOLVE_*`
  775. --- Init attachment.
  776. func.Attachment.init
  777. "void"
  778. .handle "TextureHandle" --- Render target texture handle.
  779. .access "Access::Enum" --- Access. See `Access::Enum`.
  780. { default = "Access::Write" }
  781. .layer "uint16_t" --- Cubemap side or depth layer/slice.
  782. { default = 0 }
  783. .mip "uint16_t" --- Mip level.
  784. { default = 0 }
  785. .resolve "uint8_t" --- Resolve flags. See: `BGFX_RESOLVE_*`
  786. { default = "BGFX_RESOLVE_AUTO_GEN_MIPS" }
  787. --- Transform data.
  788. struct.Transform
  789. .data "float*" --- Pointer to first 4x4 matrix.
  790. .num "uint16_t" --- Number of matrices.
  791. --- View stats.
  792. struct.ViewStats
  793. .name "char[256]" --- View name.
  794. .view "ViewId" --- View id.
  795. .cpuTimeBegin "int64_t" --- CPU (submit) begin time.
  796. .cpuTimeEnd "int64_t" --- CPU (submit) end time.
  797. .gpuTimeBegin "int64_t" --- GPU begin time.
  798. .gpuTimeEnd "int64_t" --- GPU end time.
  799. --- Encoder stats.
  800. struct.EncoderStats
  801. .cpuTimeBegin "int64_t" --- Encoder thread CPU submit begin time.
  802. .cpuTimeEnd "int64_t" --- Encoder thread CPU submit end time.
  803. --- Renderer statistics data.
  804. ---
  805. --- @remarks All time values are high-resolution timestamps, while
  806. --- time frequencies define timestamps-per-second for that hardware.
  807. struct.Stats
  808. .cpuTimeFrame "int64_t" --- CPU time between two `bgfx::frame` calls.
  809. .cpuTimeBegin "int64_t" --- Render thread CPU submit begin time.
  810. .cpuTimeEnd "int64_t" --- Render thread CPU submit end time.
  811. .cpuTimerFreq "int64_t" --- CPU timer frequency. Timestamps-per-second
  812. .gpuTimeBegin "int64_t" --- GPU frame begin time.
  813. .gpuTimeEnd "int64_t" --- GPU frame end time.
  814. .gpuTimerFreq "int64_t" --- GPU timer frequency.
  815. .waitRender "int64_t" --- Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API.
  816. .waitSubmit "int64_t" --- Time spent waiting for submit thread to advance to next frame.
  817. .numDraw "uint32_t" --- Number of draw calls submitted.
  818. .numCompute "uint32_t" --- Number of compute calls submitted.
  819. .numBlit "uint32_t" --- Number of blit calls submitted.
  820. .maxGpuLatency "uint32_t" --- GPU driver latency.
  821. .numDynamicIndexBuffers "uint16_t" --- Number of used dynamic index buffers.
  822. .numDynamicVertexBuffers "uint16_t" --- Number of used dynamic vertex buffers.
  823. .numFrameBuffers "uint16_t" --- Number of used frame buffers.
  824. .numIndexBuffers "uint16_t" --- Number of used index buffers.
  825. .numOcclusionQueries "uint16_t" --- Number of used occlusion queries.
  826. .numPrograms "uint16_t" --- Number of used programs.
  827. .numShaders "uint16_t" --- Number of used shaders.
  828. .numTextures "uint16_t" --- Number of used textures.
  829. .numUniforms "uint16_t" --- Number of used uniforms.
  830. .numVertexBuffers "uint16_t" --- Number of used vertex buffers.
  831. .numVertexLayouts "uint16_t" --- Number of used vertex layouts.
  832. .textureMemoryUsed "int64_t" --- Estimate of texture memory used.
  833. .rtMemoryUsed "int64_t" --- Estimate of render target memory used.
  834. .transientVbUsed "int32_t" --- Amount of transient vertex buffer used.
  835. .transientIbUsed "int32_t" --- Amount of transient index buffer used.
  836. .numPrims "uint32_t[Topology::Count]" --- Number of primitives rendered.
  837. .gpuMemoryMax "int64_t" --- Maximum available GPU memory for application.
  838. .gpuMemoryUsed "int64_t" --- Amount of GPU memory used by the application.
  839. .width "uint16_t" --- Backbuffer width in pixels.
  840. .height "uint16_t" --- Backbuffer height in pixels.
  841. .textWidth "uint16_t" --- Debug text width in characters.
  842. .textHeight "uint16_t" --- Debug text height in characters.
  843. .numViews "uint16_t" --- Number of view stats.
  844. .viewStats "ViewStats*" --- Array of View stats.
  845. .numEncoders "uint8_t" --- Number of encoders used during frame.
  846. .encoderStats "EncoderStats*" --- Array of encoder stats.
  847. --- Vertex layout.
  848. struct.VertexLayout { ctor }
  849. .hash "uint32_t" --- Hash.
  850. .stride "uint16_t" --- Stride.
  851. .offset "uint16_t[Attrib::Count]" --- Attribute offsets.
  852. .attributes "uint16_t[Attrib::Count]" --- Used attributes.
  853. --- Encoders are used for submitting draw calls from multiple threads. Only one encoder
  854. --- per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread.
  855. struct.Encoder {}
  856. handle "DynamicIndexBufferHandle"
  857. handle "DynamicVertexBufferHandle"
  858. handle "FrameBufferHandle"
  859. handle "IndexBufferHandle"
  860. handle "IndirectBufferHandle"
  861. handle "OcclusionQueryHandle"
  862. handle "ProgramHandle"
  863. handle "ShaderHandle"
  864. handle "TextureHandle"
  865. handle "UniformHandle"
  866. handle "VertexBufferHandle"
  867. handle "VertexLayoutHandle"
  868. --- Start VertexLayout.
  869. func.VertexLayout.begin
  870. "VertexLayout&"
  871. .rendererType "RendererType::Enum"
  872. { default = "RendererType::Noop" }
  873. --- Add attribute to VertexLayout.
  874. ---
  875. --- @remarks Must be called between begin/end.
  876. ---
  877. func.VertexLayout.add
  878. "VertexLayout&"
  879. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  880. .num "uint8_t" --- Number of elements 1, 2, 3 or 4.
  881. .type "AttribType::Enum" --- Element type.
  882. .normalized "bool" --- When using fixed point AttribType (f.e. Uint8)
  883. { default = false } --- value will be normalized for vertex shader usage. When normalized
  884. --- is set to true, AttribType::Uint8 value in range 0-255 will be
  885. --- in range 0.0-1.0 in vertex shader.
  886. .asInt "bool" --- Packaging rule for vertexPack, vertexUnpack, and
  887. { default = false } --- vertexConvert for AttribType::Uint8 and AttribType::Int16.
  888. --- Unpacking code must be implemented inside vertex shader.
  889. --- Decode attribute.
  890. func.VertexLayout.decode { const }
  891. "void"
  892. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  893. .num "uint8_t &" { out } --- Number of elements.
  894. .type "AttribType::Enum &" { out } --- Element type.
  895. .normalized "bool &" { out } --- Attribute is normalized.
  896. .asInt "bool &" { out } --- Attribute is packed as int.
  897. --- Returns true if VertexLayout contains attribute.
  898. func.VertexLayout.has { const }
  899. "bool"
  900. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  901. --- Skip `_num` bytes in vertex stream.
  902. func.VertexLayout.skip
  903. "VertexLayout&"
  904. .num "uint8_t"
  905. -- Notice: `end` is a keyword in lua.
  906. --- End VertexLayout.
  907. func.VertexLayout["end"]
  908. "void"
  909. --- Returns relative attribute offset from the vertex.
  910. func.VertexLayout.getOffset { const , cpponly }
  911. "uint16_t"
  912. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  913. --- Returns vertex stride.
  914. func.VertexLayout.getStride { const , cpponly }
  915. "uint16_t"
  916. --- Returns size of vertex buffer for number of vertices.
  917. func.VertexLayout.getSize { const, cpponly }
  918. "uint32_t"
  919. .num "uint32_t"
  920. --- Pack vertex attribute into vertex stream format.
  921. func.vertexPack
  922. "void"
  923. .input "const float[4]" --- Value to be packed into vertex stream.
  924. .inputNormalized "bool" --- `true` if input value is already normalized.
  925. .attr "Attrib::Enum" --- Attribute to pack.
  926. .layout "const VertexLayout &" --- Vertex stream layout.
  927. .data "void*" --- Destination vertex stream where data will be packed.
  928. .index "uint32_t" --- Vertex index that will be modified.
  929. { default = 0 }
  930. --- Unpack vertex attribute from vertex stream format.
  931. func.vertexUnpack
  932. "void"
  933. .output "float[4]" { out } --- Result of unpacking.
  934. .attr "Attrib::Enum" --- Attribute to unpack.
  935. .layout "const VertexLayout &" --- Vertex stream layout.
  936. .data "const void*" --- Source vertex stream from where data will be unpacked.
  937. .index "uint32_t" --- Vertex index that will be unpacked.
  938. { default = 0 }
  939. --- Converts vertex stream data from one vertex stream format to another.
  940. func.vertexConvert
  941. "void"
  942. .dstLayout "const VertexLayout &" --- Destination vertex stream layout.
  943. .dstData "void*" --- Destination vertex stream.
  944. .srcLayout "const VertexLayout &" --- Source vertex stream layout.
  945. .srcData "const void*" --- Source vertex stream data.
  946. .num "uint32_t" --- Number of vertices to convert from source to destination.
  947. { default = 1 }
  948. --- Weld vertices.
  949. func.weldVertices
  950. "uint16_t" --- Number of unique vertices after vertex welding.
  951. .output "uint16_t*" --- Welded vertices remapping table. The size of buffer
  952. --- must be the same as number of vertices.
  953. .layout "const VertexLayout &" --- Vertex stream layout.
  954. .data "const void*" --- Vertex stream.
  955. .num "uint16_t" --- Number of vertices in vertex stream.
  956. .epsilon "float" --- Error tolerance for vertex position comparison.
  957. { default = "0.001f" }
  958. --- Convert index buffer for use with different primitive topologies.
  959. func.topologyConvert
  960. "uint32_t" --- Number of output indices after conversion.
  961. .conversion "TopologyConvert::Enum" --- Conversion type, see `TopologyConvert::Enum`.
  962. .dst "void*" { out } --- Destination index buffer. If this argument is NULL
  963. --- function will return number of indices after conversion.
  964. .dstSize "uint32_t" --- Destination index buffer in bytes. It must be
  965. --- large enough to contain output indices. If destination size is
  966. --- insufficient index buffer will be truncated.
  967. .indices "const void*" --- Source indices.
  968. .numIndices "uint32_t" --- Number of input indices.
  969. .index32 "bool" --- Set to `true` if input indices are 32-bit.
  970. --- Sort indices.
  971. func.topologySortTriList
  972. "void"
  973. .sort "TopologySort::Enum" --- Sort order, see `TopologySort::Enum`.
  974. .dst "void*" { out } --- Destination index buffer.
  975. .dstSize "uint32_t" --- Destination index buffer in bytes. It must be
  976. --- large enough to contain output indices. If destination size is
  977. --- insufficient index buffer will be truncated.
  978. .dir "const float[3]" --- Direction (vector must be normalized).
  979. .pos "const float[3]" --- Position.
  980. .vertices "const void*" --- Pointer to first vertex represented as
  981. --- float x, y, z. Must contain at least number of vertices
  982. --- referencende by index buffer.
  983. .stride "uint32_t" --- Vertex stride.
  984. .indices "const void*" --- Source indices.
  985. .numIndices "uint32_t" --- Number of input indices.
  986. .index32 "bool" --- Set to `true` if input indices are 32-bit.
  987. --- Returns supported backend API renderers.
  988. func.getSupportedRenderers
  989. "uint8_t" --- Number of supported renderers.
  990. .max "uint8_t" --- Maximum number of elements in _enum array.
  991. { default = 0 }
  992. .enum "RendererType::Enum*" { inout } --- Array where supported renderers will be written.
  993. { default = NULL }
  994. --- Returns name of renderer.
  995. func.getRendererName
  996. "const char*" --- Name of renderer.
  997. .type "RendererType::Enum" --- Renderer backend type. See: `bgfx::RendererType`
  998. func.initCtor { cfunc }
  999. "void"
  1000. .init "Init*"
  1001. --- Initialize bgfx library.
  1002. func.init { cfunc }
  1003. "bool" --- `true` if initialization was successful.
  1004. .init "const Init &" --- Initialization parameters. See: `bgfx::Init` for more info.
  1005. --- Shutdown bgfx library.
  1006. func.shutdown
  1007. "void"
  1008. --- Reset graphic settings and back-buffer size.
  1009. ---
  1010. --- @attention This call doesn't actually change window size, it just
  1011. --- resizes back-buffer. Windowing code has to change window size.
  1012. ---
  1013. func.reset
  1014. "void"
  1015. .width "uint32_t" --- Back-buffer width.
  1016. .height "uint32_t" --- Back-buffer height.
  1017. .flags "uint32_t" --- See: `BGFX_RESET_*` for more info.
  1018. { default = "BGFX_RESET_NONE" } --- - `BGFX_RESET_NONE` - No reset flags.
  1019. --- - `BGFX_RESET_FULLSCREEN` - Not supported yet.
  1020. --- - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
  1021. --- - `BGFX_RESET_VSYNC` - Enable V-Sync.
  1022. --- - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
  1023. --- - `BGFX_RESET_CAPTURE` - Begin screen capture.
  1024. --- - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
  1025. --- - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
  1026. --- occurs. Default behavior is that flip occurs before rendering new
  1027. --- frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  1028. --- - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer.
  1029. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1030. { default = "TextureFormat::Count" }
  1031. --- Advance to next frame. When using multithreaded renderer, this call
  1032. --- just swaps internal buffers, kicks render thread, and returns. In
  1033. --- singlethreaded renderer this call does frame rendering.
  1034. func.frame
  1035. "uint32_t" --- Current frame number. This might be used in conjunction with
  1036. --- double/multi buffering data outside the library and passing it to
  1037. --- library via `bgfx::makeRef` calls.
  1038. .capture "bool" --- Capture frame with graphics debugger.
  1039. { default = false }
  1040. --- Returns current renderer backend API type.
  1041. ---
  1042. --- @remarks
  1043. --- Library must be initialized.
  1044. ---
  1045. func.getRendererType
  1046. "RendererType::Enum" --- Renderer backend type. See: `bgfx::RendererType`
  1047. --- Returns renderer capabilities.
  1048. ---
  1049. --- @remarks
  1050. --- Library must be initialized.
  1051. ---
  1052. func.getCaps
  1053. "const Caps*" --- Pointer to static `bgfx::Caps` structure.
  1054. --- Returns performance counters.
  1055. ---
  1056. --- @attention Pointer returned is valid until `bgfx::frame` is called.
  1057. ---
  1058. func.getStats
  1059. "const Stats*" -- Performance counters.
  1060. --- Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
  1061. func.alloc
  1062. "const Memory*" --- Allocated memory.
  1063. .size "uint32_t" --- Size to allocate.
  1064. --- Allocate buffer and copy data into it. Data will be freed inside bgfx.
  1065. func.copy
  1066. "const Memory*" --- Allocated memory.
  1067. .data "const void*" --- Pointer to data to be copied.
  1068. .size "uint32_t" --- Size of data to be copied.
  1069. --- Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  1070. --- doesn't allocate memory for data. It just copies the _data pointer. You
  1071. --- can pass `ReleaseFn` function pointer to release this memory after it's
  1072. --- consumed, otherwise you must make sure _data is available for at least 2
  1073. --- `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  1074. --- from any thread.
  1075. ---
  1076. --- @attention Data passed must be available for at least 2 `bgfx::frame` calls.
  1077. ---
  1078. func.makeRef { conly }
  1079. "const Memory*" --- Referenced memory.
  1080. .data "const void*" --- Pointer to data.
  1081. .size "uint32_t" --- Size of data.
  1082. --- Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  1083. --- doesn't allocate memory for data. It just copies the _data pointer. You
  1084. --- can pass `ReleaseFn` function pointer to release this memory after it's
  1085. --- consumed, otherwise you must make sure _data is available for at least 2
  1086. --- `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  1087. --- from any thread.
  1088. ---
  1089. --- @attention Data passed must be available for at least 2 `bgfx::frame` calls.
  1090. ---
  1091. func.makeRef { cname = "make_ref_release" }
  1092. "const Memory*" --- Referenced memory.
  1093. .data "const void*" --- Pointer to data.
  1094. .size "uint32_t" --- Size of data.
  1095. .releaseFn "ReleaseFn" --- Callback function to release memory after use.
  1096. { default = NULL }
  1097. .userData "void*" --- User data to be passed to callback function.
  1098. { default = NULL }
  1099. --- Set debug flags.
  1100. func.setDebug
  1101. "void"
  1102. .debug "uint32_t" --- Available flags:
  1103. --- - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
  1104. --- all rendering calls will be skipped. This is useful when profiling
  1105. --- to quickly assess potential bottlenecks between CPU and GPU.
  1106. --- - `BGFX_DEBUG_PROFILER` - Enable profiler.
  1107. --- - `BGFX_DEBUG_STATS` - Display internal statistics.
  1108. --- - `BGFX_DEBUG_TEXT` - Display debug text.
  1109. --- - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
  1110. --- primitives will be rendered as lines.
  1111. --- Clear internal debug text buffer.
  1112. func.dbgTextClear
  1113. "void"
  1114. .attr "uint8_t" --- Background color.
  1115. { default = 0 }
  1116. .small "bool" --- Default 8x16 or 8x8 font.
  1117. { default = false }
  1118. --- Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
  1119. func.dbgTextPrintf { vararg = "dbgTextPrintfVargs" }
  1120. "void"
  1121. .x "uint16_t" --- Position x from the left corner of the window.
  1122. .y "uint16_t" --- Position y from the top corner of the window.
  1123. .attr "uint8_t" --- Color palette. Where top 4-bits represent index of background, and bottom
  1124. --- 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  1125. .format "const char*" --- `printf` style format.
  1126. --- Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
  1127. func.dbgTextPrintfVargs { cname = "dbg_text_vprintf" }
  1128. "void"
  1129. .x "uint16_t" --- Position x from the left corner of the window.
  1130. .y "uint16_t" --- Position y from the top corner of the window.
  1131. .attr "uint8_t" --- Color palette. Where top 4-bits represent index of background, and bottom
  1132. --- 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  1133. .format "const char*" --- `printf` style format.
  1134. .argList "va_list" --- Variable arguments list for format string.
  1135. --- Draw image into internal debug text buffer.
  1136. func.dbgTextImage
  1137. "void"
  1138. .x "uint16_t" --- Position x from the left corner of the window.
  1139. .y "uint16_t" --- Position y from the top corner of the window.
  1140. .width "uint16_t" --- Image width.
  1141. .height "uint16_t" --- Image height.
  1142. .data "const void*" --- Raw image data (character/attribute raw encoding).
  1143. .pitch "uint16_t" --- Image pitch in bytes.
  1144. --- Create static index buffer.
  1145. func.createIndexBuffer
  1146. "IndexBufferHandle"
  1147. .mem "const Memory*" --- Index buffer data.
  1148. .flags "uint16_t" --- Buffer creation flags.
  1149. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1150. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1151. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1152. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1153. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1154. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1155. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1156. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1157. --- buffers.
  1158. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1159. --- index buffers.
  1160. --- Set static index buffer debug name.
  1161. func.setName { cname = "set_index_buffer_name" }
  1162. "void"
  1163. .handle "IndexBufferHandle" --- Static index buffer handle.
  1164. .name "const char*" --- Static index buffer name.
  1165. .len "int32_t" --- Static index buffer name length (if length is INT32_MAX, it's expected
  1166. { default = INT32_MAX } --- that _name is zero terminated string.
  1167. --- Destroy static index buffer.
  1168. func.destroy { cname = "destroy_index_buffer" }
  1169. "void"
  1170. .handle "IndexBufferHandle" --- Static index buffer handle.
  1171. --- Create vertex layout.
  1172. func.createVertexLayout
  1173. "VertexLayoutHandle"
  1174. .layout "const VertexLayout &" --- Vertex layout.
  1175. --- Destroy vertex layout.
  1176. func.destroy { cname = "destroy_vertex_layout" }
  1177. "void"
  1178. .layoutHandle "VertexLayoutHandle" --- Vertex layout handle.
  1179. --- Create static vertex buffer.
  1180. func.createVertexBuffer
  1181. "VertexBufferHandle" --- Static vertex buffer handle.
  1182. .mem "const Memory*" --- Vertex buffer data.
  1183. .layout "const VertexLayout &" --- Vertex layout.
  1184. .flags "uint16_t" --- Buffer creation flags.
  1185. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1186. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1187. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1188. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1189. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1190. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1191. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1192. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
  1193. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
  1194. --- Set static vertex buffer debug name.
  1195. func.setName { cname = "set_vertex_buffer_name" }
  1196. "void"
  1197. .handle "VertexBufferHandle" --- Static vertex buffer handle.
  1198. .name "const char*" --- Static vertex buffer name.
  1199. .len "int32_t" --- Static vertex buffer name length (if length is INT32_MAX, it's expected
  1200. { default = INT32_MAX } --- that _name is zero terminated string.
  1201. --- Destroy static vertex buffer.
  1202. func.destroy { cname = "destroy_vertex_buffer" }
  1203. "void"
  1204. .handle "VertexBufferHandle" --- Static vertex buffer handle.
  1205. --- Create empty dynamic index buffer.
  1206. func.createDynamicIndexBuffer
  1207. "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1208. .num "uint32_t" --- Number of indices.
  1209. .flags "uint16_t" --- Buffer creation flags.
  1210. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1211. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1212. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1213. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1214. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1215. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1216. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1217. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1218. --- buffers.
  1219. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1220. --- index buffers.
  1221. --- Create dynamic index buffer and initialized it.
  1222. func.createDynamicIndexBuffer { cname = "create_dynamic_index_buffer_mem" }
  1223. "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1224. .mem "const Memory*" --- Index buffer data.
  1225. .flags "uint16_t" --- Buffer creation flags.
  1226. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1227. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1228. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1229. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1230. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1231. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1232. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1233. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1234. --- buffers.
  1235. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1236. --- index buffers.
  1237. --- Update dynamic index buffer.
  1238. func.update { cname = "update_dynamic_index_buffer" }
  1239. "void"
  1240. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1241. .startIndex "uint32_t" --- Start index.
  1242. .mem "const Memory*" --- Index buffer data.
  1243. --- Destroy dynamic index buffer.
  1244. func.destroy { cname = "destroy_dynamic_index_buffer" }
  1245. "void"
  1246. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1247. --- Create empty dynamic vertex buffer.
  1248. func.createDynamicVertexBuffer
  1249. "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1250. .num "uint32_t" --- Number of vertices.
  1251. .layout "const VertexLayout&" --- Vertex layout.
  1252. .flags "uint16_t" --- Buffer creation flags.
  1253. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1254. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1255. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1256. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1257. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1258. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1259. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1260. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1261. --- buffers.
  1262. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1263. --- index buffers.
  1264. --- Create dynamic vertex buffer and initialize it.
  1265. func.createDynamicVertexBuffer { cname = "create_dynamic_vertex_buffer_mem" }
  1266. "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1267. .mem "const Memory*" --- Vertex buffer data.
  1268. .layout "const VertexLayout&" --- Vertex layout.
  1269. .flags "uint16_t" --- Buffer creation flags.
  1270. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1271. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1272. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1273. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1274. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1275. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1276. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1277. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1278. --- buffers.
  1279. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1280. --- index buffers.
  1281. --- Update dynamic vertex buffer.
  1282. func.update { cname = "update_dynamic_vertex_buffer" }
  1283. "void"
  1284. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1285. .startVertex "uint32_t" --- Start vertex.
  1286. .mem "const Memory*" --- Vertex buffer data.
  1287. --- Destroy dynamic vertex buffer.
  1288. func.destroy { cname = "destroy_dynamic_vertex_buffer" }
  1289. "void"
  1290. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1291. --- Returns number of requested or maximum available indices.
  1292. func.getAvailTransientIndexBuffer
  1293. "uint32_t" --- Number of requested or maximum available indices.
  1294. .num "uint32_t" --- Number of required indices.
  1295. --- Returns number of requested or maximum available vertices.
  1296. func.getAvailTransientVertexBuffer
  1297. "uint32_t" --- Number of requested or maximum available vertices.
  1298. .num "uint32_t" --- Number of required vertices.
  1299. .layout "const VertexLayout &" --- Vertex layout.
  1300. --- Returns number of requested or maximum available instance buffer slots.
  1301. func.getAvailInstanceDataBuffer
  1302. "uint32_t" --- Number of requested or maximum available instance buffer slots.
  1303. .num "uint32_t" --- Number of required instances.
  1304. .stride "uint16_t" --- Stride per instance.
  1305. --- Allocate transient index buffer.
  1306. ---
  1307. --- @remarks
  1308. --- Only 16-bit index buffer is supported.
  1309. ---
  1310. func.allocTransientIndexBuffer
  1311. "void"
  1312. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid
  1313. --- for the duration of frame, and it can be reused for multiple draw
  1314. --- calls.
  1315. .num "uint32_t" --- Number of indices to allocate.
  1316. --- Allocate transient vertex buffer.
  1317. func.allocTransientVertexBuffer
  1318. "void"
  1319. .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid
  1320. --- for the duration of frame, and it can be reused for multiple draw
  1321. --- calls.
  1322. .num "uint32_t" --- Number of vertices to allocate.
  1323. .layout "const VertexLayout &" --- Vertex layout.
  1324. --- Check for required space and allocate transient vertex and index
  1325. --- buffers. If both space requirements are satisfied function returns
  1326. --- true.
  1327. ---
  1328. --- @remarks
  1329. --- Only 16-bit index buffer is supported.
  1330. ---
  1331. func.allocTransientBuffers
  1332. "bool"
  1333. .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid
  1334. --- for the duration of frame, and it can be reused for multiple draw
  1335. --- calls.
  1336. .layout "const VertexLayout &" --- Vertex layout.
  1337. .numVertices "uint32_t" --- Number of vertices to allocate.
  1338. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid
  1339. --- for the duration of frame, and it can be reused for multiple draw
  1340. --- calls.
  1341. .numIndices "uint32_t" --- Number of indices to allocate.
  1342. --- Allocate instance data buffer.
  1343. func.allocInstanceDataBuffer
  1344. "void"
  1345. .idb "InstanceDataBuffer*" { out } --- InstanceDataBuffer structure is filled and is valid
  1346. --- for duration of frame, and it can be reused for multiple draw
  1347. --- calls.
  1348. .num "uint32_t" --- Number of instances.
  1349. .stride "uint16_t" --- Instance stride. Must be multiple of 16.
  1350. --- Create draw indirect buffer.
  1351. func.createIndirectBuffer
  1352. "IndirectBufferHandle" --- Indirect buffer handle.
  1353. .num "uint32_t" --- Number of indirect calls.
  1354. --- Destroy draw indirect buffer.
  1355. func.destroy { cname = "destroy_indirect_buffer" }
  1356. "void"
  1357. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  1358. --- Create shader from memory buffer.
  1359. func.createShader
  1360. "ShaderHandle" --- Shader handle.
  1361. .mem "const Memory*" --- Shader binary.
  1362. --- Returns the number of uniforms and uniform handles used inside a shader.
  1363. ---
  1364. --- @remarks
  1365. --- Only non-predefined uniforms are returned.
  1366. ---
  1367. func.getShaderUniforms
  1368. "uint16_t" --- Number of uniforms used by shader.
  1369. .handle "ShaderHandle" --- Shader handle.
  1370. .uniforms "UniformHandle*" { out } --- UniformHandle array where data will be stored.
  1371. { default = NULL }
  1372. .max "uint16_t" --- Maximum capacity of array.
  1373. { default = 0 }
  1374. --- Set shader debug name.
  1375. func.setName { cname = "set_shader_name" }
  1376. "void"
  1377. .handle "ShaderHandle" --- Shader handle.
  1378. .name "const char*" --- Shader name.
  1379. .len "int32_t" --- Shader name length (if length is INT32_MAX, it's expected
  1380. { default = INT32_MAX } --- that _name is zero terminated string).
  1381. --- Destroy shader.
  1382. ---
  1383. --- @remark Once a shader program is created with _handle,
  1384. --- it is safe to destroy that shader.
  1385. ---
  1386. func.destroy { cname = "destroy_shader" }
  1387. "void"
  1388. .handle "ShaderHandle" --- Shader handle.
  1389. --- Create program with vertex and fragment shaders.
  1390. func.createProgram
  1391. "ProgramHandle" --- Program handle if vertex shader output and fragment shader
  1392. --- input are matching, otherwise returns invalid program handle.
  1393. .vsh "ShaderHandle" --- Vertex shader.
  1394. .fsh "ShaderHandle" --- Fragment shader.
  1395. .destroyShaders "bool" --- If true, shaders will be destroyed when program is destroyed.
  1396. { default = false }
  1397. --- Create program with compute shader.
  1398. func.createProgram { cname = "create_compute_program" }
  1399. "ProgramHandle" --- Program handle.
  1400. .csh "ShaderHandle" --- Compute shader.
  1401. .destroyShaders "bool" --- If true, shaders will be destroyed when program is destroyed.
  1402. { default = false }
  1403. --- Destroy program.
  1404. func.destroy { cname = "destroy_program" }
  1405. "void"
  1406. .handle "ProgramHandle" --- Program handle.
  1407. --- Validate texture parameters.
  1408. func.isTextureValid
  1409. "bool" --- True if texture can be successfully created.
  1410. .depth "uint16_t" --- Depth dimension of volume texture.
  1411. .cubeMap "bool" --- Indicates that texture contains cubemap.
  1412. .numLayers "uint16_t" --- Number of layers in texture array.
  1413. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1414. .flags "uint64_t" --- Texture flags. See `BGFX_TEXTURE_*`.
  1415. --- Calculate amount of memory required for texture.
  1416. func.calcTextureSize
  1417. "void"
  1418. .info "TextureInfo &" { out } --- Resulting texture info structure. See: `TextureInfo`.
  1419. .width "uint16_t" --- Width.
  1420. .height "uint16_t" --- Height.
  1421. .depth "uint16_t" --- Depth dimension of volume texture.
  1422. .cubeMap "bool" --- Indicates that texture contains cubemap.
  1423. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1424. .numLayers "uint16_t" --- Number of layers in texture array.
  1425. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1426. --- Create texture from memory buffer.
  1427. func.createTexture
  1428. "TextureHandle" --- Texture handle.
  1429. .mem "const Memory*" --- DDS, KTX or PVR texture binary data.
  1430. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1431. { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1432. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1433. --- mode.
  1434. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1435. --- sampling.
  1436. .skip "uint8_t" --- Skip top level mips when parsing texture.
  1437. { default = 0 }
  1438. .info "TextureInfo*" { out } --- When non-`NULL` is specified it returns parsed texture information.
  1439. { default = NULL }
  1440. --- Create 2D texture.
  1441. func.createTexture2D
  1442. "TextureHandle" --- Texture handle.
  1443. .width "uint16_t" --- Width.
  1444. .height "uint16_t" --- Height.
  1445. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1446. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1447. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1448. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1449. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1450. { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1451. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1452. --- mode.
  1453. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1454. --- sampling.
  1455. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1456. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1457. --- 1, expected memory layout is texture and all mips together for each array element.
  1458. --- Create texture with size based on backbuffer ratio. Texture will maintain ratio
  1459. --- if back buffer resolution changes.
  1460. func.createTexture2D { cname = "create_texture_2d_scaled" }
  1461. "TextureHandle" --- Texture handle.
  1462. .ratio "BackbufferRatio::Enum" --- Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
  1463. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1464. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1465. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1466. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1467. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1468. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1469. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1470. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1471. --- mode.
  1472. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1473. --- sampling.
  1474. --- Create 3D texture.
  1475. func.createTexture3D
  1476. "TextureHandle" --- Texture handle.
  1477. .width "uint16_t" --- Width.
  1478. .height "uint16_t" --- Height.
  1479. .depth "uint16_t" --- Depth.
  1480. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1481. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1482. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1483. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1484. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1485. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1486. --- mode.
  1487. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1488. --- sampling.
  1489. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1490. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1491. --- 1, expected memory layout is texture and all mips together for each array element.
  1492. --- Create Cube texture.
  1493. func.createTextureCube
  1494. "TextureHandle" --- Texture handle.
  1495. .size "uint16_t" --- Cube side size.
  1496. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1497. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1498. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1499. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1500. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1501. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1502. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1503. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1504. --- mode.
  1505. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1506. --- sampling.
  1507. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1508. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1509. --- 1, expected memory layout is texture and all mips together for each array element.
  1510. --- Update 2D texture.
  1511. ---
  1512. --- @attention It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
  1513. ---
  1514. func.updateTexture2D
  1515. "void"
  1516. .handle "TextureHandle" --- Texture handle.
  1517. .layer "uint16_t" --- Layer in texture array.
  1518. .mip "uint8_t" --- Mip level.
  1519. .x "uint16_t" --- X offset in texture.
  1520. .y "uint16_t" --- Y offset in texture.
  1521. .width "uint16_t" --- Width of texture block.
  1522. .height "uint16_t" --- Height of texture block.
  1523. .mem "const Memory*" --- Texture update data.
  1524. .pitch "uint16_t" --- Pitch of input image (bytes). When _pitch is set to
  1525. --- UINT16_MAX, it will be calculated internally based on _width.
  1526. { default = UINT16_MAX }
  1527. --- Update 3D texture.
  1528. ---
  1529. --- @attention It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
  1530. ---
  1531. func.updateTexture3D
  1532. "void"
  1533. .handle "TextureHandle" --- Texture handle.
  1534. .mip "uint8_t" --- Mip level.
  1535. .x "uint16_t" --- X offset in texture.
  1536. .y "uint16_t" --- Y offset in texture.
  1537. .z "uint16_t" --- Z offset in texture.
  1538. .width "uint16_t" --- Width of texture block.
  1539. .height "uint16_t" --- Height of texture block.
  1540. .depth "uint16_t" --- Depth of texture block.
  1541. .mem "const Memory*" --- Texture update data.
  1542. --- Update Cube texture.
  1543. ---
  1544. --- @attention It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
  1545. ---
  1546. func.updateTextureCube
  1547. "void"
  1548. .handle "TextureHandle" --- Texture handle.
  1549. .layer "uint16_t" --- Layer in texture array.
  1550. .side "uint8_t" --- Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
  1551. --- where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
  1552. ---
  1553. --- +----------+
  1554. --- |-z 2|
  1555. --- | ^ +y |
  1556. --- | | | Unfolded cube:
  1557. --- | +---->+x |
  1558. --- +----------+----------+----------+----------+
  1559. --- |+y 1|+y 4|+y 0|+y 5|
  1560. --- | ^ -x | ^ +z | ^ +x | ^ -z |
  1561. --- | | | | | | | | |
  1562. --- | +---->+z | +---->+x | +---->-z | +---->-x |
  1563. --- +----------+----------+----------+----------+
  1564. --- |+z 3|
  1565. --- | ^ -y |
  1566. --- | | |
  1567. --- | +---->+x |
  1568. --- +----------+
  1569. .mip "uint8_t" --- Mip level.
  1570. .x "uint16_t" --- X offset in texture.
  1571. .y "uint16_t" --- Y offset in texture.
  1572. .width "uint16_t" --- Width of texture block.
  1573. .height "uint16_t" --- Height of texture block.
  1574. .mem "const Memory*" --- Texture update data.
  1575. .pitch "uint16_t" --- Pitch of input image (bytes). When _pitch is set to
  1576. --- UINT16_MAX, it will be calculated internally based on _width.
  1577. { default = UINT16_MAX }
  1578. --- Read back texture content.
  1579. ---
  1580. --- @attention Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
  1581. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
  1582. ---
  1583. func.readTexture
  1584. "uint32_t" --- Frame number when the result will be available. See: `bgfx::frame`.
  1585. .handle "TextureHandle" --- Texture handle.
  1586. .data "void*" --- Destination buffer.
  1587. .mip "uint8_t" --- Mip level.
  1588. { default = 0 }
  1589. --- Set texture debug name.
  1590. func.setName { cname = "set_texture_name" }
  1591. "void"
  1592. .handle "TextureHandle" --- Texture handle.
  1593. .name "const char*" --- Texture name.
  1594. .len "int32_t" --- Texture name length (if length is INT32_MAX, it's expected
  1595. { default = INT32_MAX } --- that _name is zero terminated string.
  1596. --- Returns texture direct access pointer.
  1597. ---
  1598. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
  1599. --- is available on GPUs that have unified memory architecture (UMA) support.
  1600. ---
  1601. func.getDirectAccessPtr
  1602. "void*" --- Pointer to texture memory. If returned pointer is `NULL` direct access
  1603. --- is not available for this texture. If pointer is `UINTPTR_MAX` sentinel value
  1604. --- it means texture is pending creation. Pointer returned can be cached and it
  1605. --- will be valid until texture is destroyed.
  1606. .handle "TextureHandle" --- Texture handle.
  1607. --- Destroy texture.
  1608. func.destroy { cname = "destroy_texture" }
  1609. "void"
  1610. .handle "TextureHandle" --- Texture handle.
  1611. --- Create frame buffer (simple).
  1612. func.createFrameBuffer
  1613. "FrameBufferHandle" --- Frame buffer handle.
  1614. .width "uint16_t" --- Texture width.
  1615. .height "uint16_t" --- Texture height.
  1616. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1617. .textureFlags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1618. { default = "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" }
  1619. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1620. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1621. --- mode.
  1622. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1623. --- sampling.
  1624. --- Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio
  1625. --- if back buffer resolution changes.
  1626. func.createFrameBuffer { cname = "create_frame_buffer_scaled" }
  1627. "FrameBufferHandle" --- Frame buffer handle.
  1628. .ratio "BackbufferRatio::Enum" --- Frame buffer size in respect to back-buffer size. See:
  1629. --- `BackbufferRatio::Enum`.
  1630. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1631. .textureFlags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1632. { default = "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" }
  1633. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1634. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1635. --- mode.
  1636. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1637. --- sampling.
  1638. --- Create MRT frame buffer from texture handles (simple).
  1639. func.createFrameBuffer { cname = "create_frame_buffer_from_handles" }
  1640. "FrameBufferHandle" --- Frame buffer handle.
  1641. .num "uint8_t" --- Number of texture handles.
  1642. .handles "const TextureHandle*" --- Texture attachments.
  1643. .destroyTexture "bool" --- If true, textures will be destroyed when
  1644. { default = false } --- frame buffer is destroyed.
  1645. --- Create MRT frame buffer from texture handles with specific layer and
  1646. --- mip level.
  1647. func.createFrameBuffer { cname = "create_frame_buffer_from_attachment" }
  1648. "FrameBufferHandle" --- Frame buffer handle.
  1649. .num "uint8_t" --- Number of attachements.
  1650. .attachment "const Attachment*" --- Attachment texture info. See: `bgfx::Attachment`.
  1651. .destroyTexture "bool" --- If true, textures will be destroyed when
  1652. { default = false } --- frame buffer is destroyed.
  1653. --- Create frame buffer for multiple window rendering.
  1654. ---
  1655. --- @remarks
  1656. --- Frame buffer cannot be used for sampling.
  1657. ---
  1658. --- @attention Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
  1659. ---
  1660. func.createFrameBuffer { cname = "create_frame_buffer_from_nwh" }
  1661. "FrameBufferHandle" --- Frame buffer handle.
  1662. .nwh "void*" --- OS' target native window handle.
  1663. .width "uint16_t" --- Window back buffer width.
  1664. .height "uint16_t" --- Window back buffer height.
  1665. .format "TextureFormat::Enum" --- Window back buffer color format.
  1666. { default = "TextureFormat::Count" }
  1667. .depthFormat "TextureFormat::Enum" --- Window back buffer depth format.
  1668. { default = "TextureFormat::Count" }
  1669. --- Set frame buffer debug name.
  1670. func.setName { cname = "set_frame_buffer_name" }
  1671. "void"
  1672. .handle "FrameBufferHandle" --- Frame buffer handle.
  1673. .name "const char*" --- Frame buffer name.
  1674. .len "int32_t" --- Frame buffer name length (if length is INT32_MAX, it's expected
  1675. { default = INT32_MAX } --- that _name is zero terminated string.
  1676. --- Obtain texture handle of frame buffer attachment.
  1677. func.getTexture
  1678. "TextureHandle"
  1679. .handle "FrameBufferHandle" --- Frame buffer handle.
  1680. .attachment "uint8_t"
  1681. { default = 0 }
  1682. --- Destroy frame buffer.
  1683. func.destroy { cname = "destroy_frame_buffer" }
  1684. "void"
  1685. .handle "FrameBufferHandle" --- Frame buffer handle.
  1686. --- Create shader uniform parameter.
  1687. ---
  1688. --- @remarks
  1689. --- 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
  1690. --- multiple times with the same uniform name. The library will always
  1691. --- return the same handle, but the handle reference count will be
  1692. --- incremented. This means that the same number of `bgfx::destroyUniform`
  1693. --- must be called to properly destroy the uniform.
  1694. ---
  1695. --- 2. Predefined uniforms (declared in `bgfx_shader.sh`):
  1696. --- - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
  1697. --- view, in pixels.
  1698. --- - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
  1699. --- width and height
  1700. --- - `u_view mat4` - view matrix
  1701. --- - `u_invView mat4` - inverted view matrix
  1702. --- - `u_proj mat4` - projection matrix
  1703. --- - `u_invProj mat4` - inverted projection matrix
  1704. --- - `u_viewProj mat4` - concatenated view projection matrix
  1705. --- - `u_invViewProj mat4` - concatenated inverted view projection matrix
  1706. --- - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
  1707. --- - `u_modelView mat4` - concatenated model view matrix, only first
  1708. --- model matrix from array is used.
  1709. --- - `u_modelViewProj mat4` - concatenated model view projection matrix.
  1710. --- - `u_alphaRef float` - alpha reference value for alpha test.
  1711. ---
  1712. func.createUniform
  1713. "UniformHandle" --- Handle to uniform object.
  1714. .name "const char*" --- Uniform name in shader.
  1715. .type "UniformType::Enum" --- Type of uniform (See: `bgfx::UniformType`).
  1716. .num "uint16_t" --- Number of elements in array.
  1717. { default = 1 }
  1718. --- Retrieve uniform info.
  1719. func.getUniformInfo
  1720. "void"
  1721. .handle "UniformHandle" --- Handle to uniform object.
  1722. .info "UniformInfo &" { out } --- Uniform info.
  1723. --- Destroy shader uniform parameter.
  1724. func.destroy { cname = "destroy_uniform" }
  1725. "void"
  1726. .handle "UniformHandle" --- Handle to uniform object.
  1727. --- Create occlusion query.
  1728. func.createOcclusionQuery
  1729. "OcclusionQueryHandle" --- Handle to occlusion query object.
  1730. --- Retrieve occlusion query result from previous frame.
  1731. func.getResult
  1732. "OcclusionQueryResult::Enum" --- Occlusion query result.
  1733. .handle "OcclusionQueryHandle" --- Handle to occlusion query object.
  1734. .result "int32_t*" { out } --- Number of pixels that passed test. This argument
  1735. --- can be `NULL` if result of occlusion query is not needed.
  1736. { default = NULL }
  1737. --- Destroy occlusion query.
  1738. func.destroy { cname = "destroy_occlusion_query" }
  1739. "void"
  1740. .handle "OcclusionQueryHandle" --- Handle to occlusion query object.
  1741. --- Set palette color value.
  1742. func.setPaletteColor
  1743. "void"
  1744. .index "uint8_t" --- Index into palette.
  1745. .rgba "const float[4]" --- RGBA floating point values.
  1746. --- Set palette color value.
  1747. func.setPaletteColor { cname = "set_palette_color_rgba8" }
  1748. "void"
  1749. .index "uint8_t" --- Index into palette.
  1750. .rgba "uint32_t" --- Packed 32-bit RGBA value.
  1751. --- Set view name.
  1752. ---
  1753. --- @remarks
  1754. --- This is debug only feature.
  1755. ---
  1756. --- In graphics debugger view name will appear as:
  1757. ---
  1758. --- "nnnc <view name>"
  1759. --- ^ ^ ^
  1760. --- | +--- compute (C)
  1761. --- +------ view id
  1762. ---
  1763. func.setViewName
  1764. "void"
  1765. .id "ViewId" --- View id.
  1766. .name "const char*" --- View name.
  1767. --- Set view rectangle. Draw primitive outside view will be clipped.
  1768. func.setViewRect
  1769. "void"
  1770. .id "ViewId" --- View id.
  1771. .x "uint16_t" --- Position x from the left corner of the window.
  1772. .y "uint16_t" --- Position y from the top corner of the window.
  1773. .width "uint16_t" --- Width of view port region.
  1774. .height "uint16_t" --- Height of view port region.
  1775. --- Set view rectangle. Draw primitive outside view will be clipped.
  1776. func.setViewRect { cname = "set_view_rect_ratio" }
  1777. "void"
  1778. .id "ViewId" --- View id.
  1779. .x "uint16_t" --- Position x from the left corner of the window.
  1780. .y "uint16_t" --- Position y from the top corner of the window.
  1781. .ratio "BackbufferRatio::Enum" --- Width and height will be set in respect to back-buffer size.
  1782. --- See: `BackbufferRatio::Enum`.
  1783. --- Set view scissor. Draw primitive outside view will be clipped. When
  1784. --- _x, _y, _width and _height are set to 0, scissor will be disabled.
  1785. func.setViewScissor
  1786. "void"
  1787. .id "ViewId" --- View id.
  1788. .x "uint16_t" --- Position x from the left corner of the window.
  1789. { default = 0 }
  1790. .y "uint16_t" --- Position y from the top corner of the window.
  1791. { default = 0 }
  1792. .width "uint16_t" --- Width of view scissor region.
  1793. { default = 0 }
  1794. .height "uint16_t" --- Height of view scissor region.
  1795. { default = 0 }
  1796. --- Set view clear flags.
  1797. func.setViewClear
  1798. "void"
  1799. .id "ViewId" --- View id.
  1800. .flags "uint16_t" --- Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1801. --- operation. See: `BGFX_CLEAR_*`.
  1802. .rgba "uint32_t" --- Color clear value.
  1803. { default = "0x000000ff" }
  1804. .depth "float" --- Depth clear value.
  1805. { default = "1.0f" }
  1806. .stencil "uint8_t" --- Stencil clear value.
  1807. { default = 0 }
  1808. --- Set view clear flags with different clear color for each
  1809. --- frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color
  1810. --- palette.
  1811. func.setViewClear { cname = "set_view_clear_mrt" }
  1812. "void"
  1813. .id "ViewId" --- View id.
  1814. .flags "uint16_t" --- Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1815. --- operation. See: `BGFX_CLEAR_*`.
  1816. .depth "float" --- Depth clear value.
  1817. .stencil "uint8_t" --- Stencil clear value.
  1818. .c0 "uint8_t" --- Palette index for frame buffer attachment 0.
  1819. { default = UINT8_MAX }
  1820. .c1 "uint8_t" --- Palette index for frame buffer attachment 1.
  1821. { default = UINT8_MAX }
  1822. .c2 "uint8_t" --- Palette index for frame buffer attachment 2.
  1823. { default = UINT8_MAX }
  1824. .c3 "uint8_t" --- Palette index for frame buffer attachment 3.
  1825. { default = UINT8_MAX }
  1826. .c4 "uint8_t" --- Palette index for frame buffer attachment 4.
  1827. { default = UINT8_MAX }
  1828. .c5 "uint8_t" --- Palette index for frame buffer attachment 5.
  1829. { default = UINT8_MAX }
  1830. .c6 "uint8_t" --- Palette index for frame buffer attachment 6.
  1831. { default = UINT8_MAX }
  1832. .c7 "uint8_t" --- Palette index for frame buffer attachment 7.
  1833. { default = UINT8_MAX }
  1834. --- Set view sorting mode.
  1835. ---
  1836. --- @remarks
  1837. --- View mode must be set prior calling `bgfx::submit` for the view.
  1838. ---
  1839. func.setViewMode
  1840. "void"
  1841. .id "ViewId" --- View id.
  1842. .mode "ViewMode::Enum" --- View sort mode. See `ViewMode::Enum`.
  1843. { default = "ViewMode::Default" }
  1844. --- Set view frame buffer.
  1845. ---
  1846. --- @remarks
  1847. --- Not persistent after `bgfx::reset` call.
  1848. ---
  1849. func.setViewFrameBuffer
  1850. "void"
  1851. .id "ViewId" --- View id.
  1852. .handle "FrameBufferHandle" --- Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
  1853. --- frame buffer handle will draw primitives from this view into
  1854. --- default back buffer.
  1855. --- Set view view and projection matrices, all draw primitives in this
  1856. --- view will use these matrices.
  1857. func.setViewTransform
  1858. "void"
  1859. .id "ViewId" --- View id.
  1860. .view "const void*" --- View matrix.
  1861. .proj "const void*" --- Projection matrix.
  1862. --- Post submit view reordering.
  1863. func.setViewOrder
  1864. "void"
  1865. .id "ViewId" --- First view id.
  1866. { default = 0 }
  1867. .num "uint16_t" --- Number of views to remap.
  1868. { default = UINT16_MAX }
  1869. .order "const ViewId*" --- View remap id table. Passing `NULL` will reset view ids
  1870. --- to default state.
  1871. { default = NULL }
  1872. --- Begin submitting draw calls from thread.
  1873. func.begin { cname = "encoder_begin" }
  1874. "Encoder*" --- Encoder.
  1875. .forThread "bool" --- Explicitly request an encoder for a worker thread.
  1876. --- End submitting draw calls from thread.
  1877. func["end"] { cname = "encoder_end" }
  1878. "void"
  1879. .encoder "Encoder*" --- Encoder.
  1880. --- Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1881. --- graphics debugging tools.
  1882. func.Encoder.setMarker
  1883. "void"
  1884. .marker "const char*" --- Marker string.
  1885. --- Set render states for draw primitive.
  1886. ---
  1887. --- @remarks
  1888. --- 1. To setup more complex states use:
  1889. --- `BGFX_STATE_ALPHA_REF(_ref)`,
  1890. --- `BGFX_STATE_POINT_SIZE(_size)`,
  1891. --- `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1892. --- `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1893. --- `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1894. --- `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1895. --- 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1896. --- equation is specified.
  1897. ---
  1898. func.Encoder.setState
  1899. "void"
  1900. .state "uint64_t" --- State flags. Default state for primitive type is
  1901. --- triangles. See: `BGFX_STATE_DEFAULT`.
  1902. --- - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  1903. --- - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  1904. --- - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  1905. --- - `BGFX_STATE_CULL_*` - Backface culling mode.
  1906. --- - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  1907. --- - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  1908. --- - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  1909. .rgba "uint32_t" --- Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  1910. --- `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  1911. { default = 0 }
  1912. --- Set condition for rendering.
  1913. func.Encoder.setCondition
  1914. "void"
  1915. .handle "OcclusionQueryHandle" --- Occlusion query handle.
  1916. .visible "bool" --- Render if occlusion query is visible.
  1917. --- Set stencil test state.
  1918. func.Encoder.setStencil
  1919. "void"
  1920. .fstencil "uint32_t" --- Front stencil state.
  1921. .bstencil "uint32_t" --- Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  1922. --- _fstencil is applied to both front and back facing primitives.
  1923. { default = "BGFX_STENCIL_NONE" }
  1924. --- Set scissor for draw primitive.
  1925. ---
  1926. --- @remark
  1927. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  1928. ---
  1929. func.Encoder.setScissor
  1930. "uint16_t" --- Scissor cache index.
  1931. .x "uint16_t" --- Position x from the left corner of the window.
  1932. .y "uint16_t" --- Position y from the top corner of the window.
  1933. .width "uint16_t" --- Width of view scissor region.
  1934. .height "uint16_t" --- Height of view scissor region.
  1935. --- Set scissor from cache for draw primitive.
  1936. ---
  1937. --- @remark
  1938. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  1939. ---
  1940. func.Encoder.setScissor { cname = "set_scissor_cached" }
  1941. "void"
  1942. .cache "uint16_t" --- Index in scissor cache.
  1943. { default = UINT16_MAX }
  1944. --- Set model matrix for draw primitive. If it is not called,
  1945. --- the model will be rendered with an identity model matrix.
  1946. func.Encoder.setTransform
  1947. "uint32_t" --- Index into matrix cache in case the same model matrix has
  1948. --- to be used for other draw primitive call.
  1949. .mtx "const void*" --- Pointer to first matrix in array.
  1950. .num "uint16_t" --- Number of matrices in array.
  1951. --- Set model matrix from matrix cache for draw primitive.
  1952. func.Encoder.setTransform { cname = "set_transform_cached" }
  1953. "void"
  1954. .cache "uint32_t" --- Index in matrix cache.
  1955. .num "uint16_t" --- Number of matrices from cache.
  1956. { default = 1 }
  1957. --- Reserve matrices in internal matrix cache.
  1958. ---
  1959. --- @attention Pointer returned can be modifed until `bgfx::frame` is called.
  1960. ---
  1961. func.Encoder.allocTransform
  1962. "uint32_t" --- Index in matrix cache.
  1963. .transform "Transform*" { out } --- Pointer to `Transform` structure.
  1964. .num "uint16_t" --- Number of matrices.
  1965. --- Set shader uniform parameter for draw primitive.
  1966. func.Encoder.setUniform
  1967. "void"
  1968. .handle "UniformHandle" --- Uniform.
  1969. .value "const void*" --- Pointer to uniform data.
  1970. .num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
  1971. --- use the _num passed on uniform creation.
  1972. { default = 1 }
  1973. --- Set index buffer for draw primitive.
  1974. func.Encoder.setIndexBuffer { cpponly }
  1975. "void"
  1976. .handle "IndexBufferHandle" --- Index buffer.
  1977. --- Set index buffer for draw primitive.
  1978. func.Encoder.setIndexBuffer
  1979. "void"
  1980. .handle "IndexBufferHandle" --- Index buffer.
  1981. .firstIndex "uint32_t" --- First index to render.
  1982. .numIndices "uint32_t" --- Number of indices to render.
  1983. --- Set index buffer for draw primitive.
  1984. func.Encoder.setIndexBuffer { cpponly }
  1985. "void"
  1986. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  1987. --- Set index buffer for draw primitive.
  1988. func.Encoder.setIndexBuffer { cname = "set_dynamic_index_buffer" }
  1989. "void"
  1990. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  1991. .firstIndex "uint32_t" --- First index to render.
  1992. .numIndices "uint32_t" --- Number of indices to render.
  1993. --- Set index buffer for draw primitive.
  1994. func.Encoder.setIndexBuffer { cpponly }
  1995. "void"
  1996. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  1997. --- Set index buffer for draw primitive.
  1998. func.Encoder.setIndexBuffer { cname = "set_transient_index_buffer" }
  1999. "void"
  2000. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2001. .firstIndex "uint32_t" --- First index to render.
  2002. .numIndices "uint32_t" --- Number of indices to render.
  2003. --- Set vertex buffer for draw primitive.
  2004. func.Encoder.setVertexBuffer { cpponly }
  2005. "void"
  2006. .stream "uint8_t" --- Vertex stream.
  2007. .handle "VertexBufferHandle" --- Vertex buffer.
  2008. --- Set vertex buffer for draw primitive.
  2009. func.Encoder.setVertexBuffer
  2010. "void"
  2011. .stream "uint8_t" --- Vertex stream.
  2012. .handle "VertexBufferHandle" --- Vertex buffer.
  2013. .startVertex "uint32_t" --- First vertex to render.
  2014. .numVertices "uint32_t" --- Number of vertices to render.
  2015. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2016. --- handle is used, vertex layout used for creation
  2017. --- of vertex buffer will be used.
  2018. { default = "BGFX_INVALID_HANDLE" }
  2019. --- Set vertex buffer for draw primitive.
  2020. func.Encoder.setVertexBuffer { cpponly }
  2021. "void"
  2022. .stream "uint8_t" --- Vertex stream.
  2023. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2024. --- Set vertex buffer for draw primitive.
  2025. func.Encoder.setVertexBuffer { cname = "set_dynamic_vertex_buffer" }
  2026. "void"
  2027. .stream "uint8_t" --- Vertex stream.
  2028. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2029. .startVertex "uint32_t" --- First vertex to render.
  2030. .numVertices "uint32_t" --- Number of vertices to render.
  2031. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2032. --- handle is used, vertex layout used for creation
  2033. --- of vertex buffer will be used.
  2034. { default = "BGFX_INVALID_HANDLE" }
  2035. --- Set vertex buffer for draw primitive.
  2036. func.Encoder.setVertexBuffer { cpponly }
  2037. "void"
  2038. .stream "uint8_t" --- Vertex stream.
  2039. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2040. --- Set vertex buffer for draw primitive.
  2041. func.Encoder.setVertexBuffer { cname = "set_transient_vertex_buffer" }
  2042. "void"
  2043. .stream "uint8_t" --- Vertex stream.
  2044. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2045. .startVertex "uint32_t" --- First vertex to render.
  2046. .numVertices "uint32_t" --- Number of vertices to render.
  2047. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2048. --- handle is used, vertex layout used for creation
  2049. --- of vertex buffer will be used.
  2050. { default = "BGFX_INVALID_HANDLE" }
  2051. --- Set number of vertices for auto generated vertices use in conjuction
  2052. --- with gl_VertexID.
  2053. ---
  2054. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2055. ---
  2056. func.Encoder.setVertexCount
  2057. "void"
  2058. .numVertices "uint32_t" --- Number of vertices.
  2059. --- Set instance data buffer for draw primitive.
  2060. func.Encoder.setInstanceDataBuffer { cpponly }
  2061. "void"
  2062. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2063. --- Set instance data buffer for draw primitive.
  2064. func.Encoder.setInstanceDataBuffer
  2065. "void"
  2066. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2067. .start "uint32_t" --- First instance data.
  2068. .num "uint32_t" --- Number of data instances.
  2069. --- Set instance data buffer for draw primitive.
  2070. func.Encoder.setInstanceDataBuffer { cpponly }
  2071. "void"
  2072. .handle "VertexBufferHandle" --- Vertex buffer.
  2073. --- Set instance data buffer for draw primitive.
  2074. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" }
  2075. "void"
  2076. .handle "VertexBufferHandle" --- Vertex buffer.
  2077. .startVertex "uint32_t" --- First instance data.
  2078. .num "uint32_t" --- Number of data instances.
  2079. --- Set instance data buffer for draw primitive.
  2080. func.Encoder.setInstanceDataBuffer { cpponly }
  2081. "void"
  2082. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2083. --- Set instance data buffer for draw primitive.
  2084. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" }
  2085. "void"
  2086. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2087. .startVertex "uint32_t" --- First instance data.
  2088. .num "uint32_t" --- Number of data instances.
  2089. --- Set number of instances for auto generated instances use in conjuction
  2090. --- with gl_InstanceID.
  2091. ---
  2092. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2093. ---
  2094. func.Encoder.setInstanceCount
  2095. "void"
  2096. .numInstances "uint32_t" -- Number of instances.
  2097. --- Set texture stage for draw primitive.
  2098. func.Encoder.setTexture
  2099. "void"
  2100. .stage "uint8_t" --- Texture unit.
  2101. .sampler "UniformHandle" --- Program sampler.
  2102. .handle "TextureHandle" --- Texture handle.
  2103. .flags "uint32_t" --- Texture sampling mode. Default value UINT32_MAX uses
  2104. { default = UINT32_MAX } --- texture sampling settings from the texture.
  2105. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2106. --- mode.
  2107. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2108. --- sampling.
  2109. --- Submit an empty primitive for rendering. Uniforms and draw state
  2110. --- will be applied but no geometry will be submitted. Useful in cases
  2111. --- when no other draw/compute primitive is submitted to view, but it's
  2112. --- desired to execute clear view.
  2113. ---
  2114. --- @remark
  2115. --- These empty draw calls will sort before ordinary draw calls.
  2116. ---
  2117. func.Encoder.touch
  2118. "void"
  2119. .id "ViewId" --- View id.
  2120. --- Submit primitive for rendering.
  2121. func.Encoder.submit
  2122. "void"
  2123. .id "ViewId" --- View id.
  2124. .program "ProgramHandle" --- Program.
  2125. .depth "uint32_t" --- Depth for sorting.
  2126. { default = 0 }
  2127. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2128. { default = "BGFX_DISCARD_ALL" }
  2129. --- Submit primitive with occlusion query for rendering.
  2130. func.Encoder.submit { cname = "submit_occlusion_query" }
  2131. "void"
  2132. .id "ViewId" --- View id.
  2133. .program "ProgramHandle" --- Program.
  2134. .occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
  2135. .depth "uint32_t" --- Depth for sorting.
  2136. { default = 0 }
  2137. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2138. { default = "BGFX_DISCARD_ALL" }
  2139. --- Submit primitive for rendering with index and instance data info from
  2140. --- indirect buffer.
  2141. func.Encoder.submit { cname = "submit_indirect" }
  2142. "void"
  2143. .id "ViewId" --- View id.
  2144. .program "ProgramHandle" --- Program.
  2145. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2146. .start "uint16_t" --- First element in indirect buffer.
  2147. { default = 0 }
  2148. .num "uint16_t" --- Number of dispatches.
  2149. { default = 1 }
  2150. .depth "uint32_t" --- Depth for sorting.
  2151. { default = 0 }
  2152. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2153. { default = "BGFX_DISCARD_ALL" }
  2154. --- Set compute index buffer.
  2155. func.Encoder.setBuffer { cname = "set_compute_index_buffer" }
  2156. "void"
  2157. .stage "uint8_t" --- Compute stage.
  2158. .handle "IndexBufferHandle" --- Index buffer handle.
  2159. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2160. --- Set compute vertex buffer.
  2161. func.Encoder.setBuffer { cname = "set_compute_vertex_buffer" }
  2162. "void"
  2163. .stage "uint8_t" --- Compute stage.
  2164. .handle "VertexBufferHandle" --- Vertex buffer handle.
  2165. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2166. --- Set compute dynamic index buffer.
  2167. func.Encoder.setBuffer { cname = "set_compute_dynamic_index_buffer" }
  2168. "void"
  2169. .stage "uint8_t" --- Compute stage.
  2170. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  2171. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2172. --- Set compute dynamic vertex buffer.
  2173. func.Encoder.setBuffer { cname = "set_compute_dynamic_vertex_buffer" }
  2174. "void"
  2175. .stage "uint8_t" --- Compute stage.
  2176. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  2177. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2178. --- Set compute indirect buffer.
  2179. func.Encoder.setBuffer { cname = "set_compute_indirect_buffer" }
  2180. "void"
  2181. .stage "uint8_t" --- Compute stage.
  2182. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  2183. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2184. --- Set compute image from texture.
  2185. func.Encoder.setImage
  2186. "void"
  2187. .stage "uint8_t" --- Compute stage.
  2188. .handle "TextureHandle" --- Texture handle.
  2189. .mip "uint8_t" --- Mip level.
  2190. .access "Access::Enum" --- Image access. See `Access::Enum`.
  2191. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2192. { default = "TextureFormat::Count" }
  2193. --- Dispatch compute.
  2194. func.Encoder.dispatch
  2195. "void"
  2196. .id "ViewId" --- View id.
  2197. .program "ProgramHandle" --- Compute program.
  2198. .numX "uint32_t" --- Number of groups X.
  2199. { default = 1 }
  2200. .numY "uint32_t" --- Number of groups Y.
  2201. { default = 1 }
  2202. .numZ "uint32_t" --- Number of groups Z.
  2203. { default = 1 }
  2204. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2205. { default = "BGFX_DISCARD_ALL" }
  2206. --- Dispatch compute indirect.
  2207. func.Encoder.dispatch { cname = "dispatch_indirect" }
  2208. "void"
  2209. .id "ViewId" --- View id.
  2210. .program "ProgramHandle" --- Compute program.
  2211. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2212. .start "uint16_t" --- First element in indirect buffer.
  2213. { default = 0 }
  2214. .num "uint16_t" --- Number of dispatches.
  2215. { default = 1 }
  2216. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2217. { default = "BGFX_DISCARD_ALL" }
  2218. --- Discard previously set state for draw or compute call.
  2219. func.Encoder.discard
  2220. "void"
  2221. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2222. { default = "BGFX_DISCARD_ALL" }
  2223. --- Blit 2D texture region between two 2D textures.
  2224. ---
  2225. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2226. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2227. ---
  2228. func.Encoder.blit { cpponly }
  2229. "void"
  2230. .id "ViewId" --- View id.
  2231. .dst "TextureHandle" --- Destination texture handle.
  2232. .dstX "uint16_t" --- Destination texture X position.
  2233. .dstY "uint16_t" --- Destination texture Y position.
  2234. .src "TextureHandle" --- Source texture handle.
  2235. .srcX "uint16_t" --- Source texture X position.
  2236. { default = 0 }
  2237. .srcY "uint16_t" --- Source texture Y position.
  2238. { default = 0 }
  2239. .width "uint16_t" --- Width of region.
  2240. { default = UINT16_MAX }
  2241. .height "uint16_t" --- Height of region.
  2242. { default = UINT16_MAX }
  2243. --- Blit 2D texture region between two 2D textures.
  2244. ---
  2245. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2246. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2247. ---
  2248. func.Encoder.blit
  2249. "void"
  2250. .id "ViewId" --- View id.
  2251. .dst "TextureHandle" --- Destination texture handle.
  2252. .dstMip "uint8_t" --- Destination texture mip level.
  2253. .dstX "uint16_t" --- Destination texture X position.
  2254. .dstY "uint16_t" --- Destination texture Y position.
  2255. .dstZ "uint16_t" --- If texture is 2D this argument should be 0. If destination texture is cube
  2256. --- this argument represents destination texture cube face. For 3D texture this argument
  2257. --- represents destination texture Z position.
  2258. .src "TextureHandle" --- Source texture handle.
  2259. .srcMip "uint8_t" --- Source texture mip level.
  2260. { default = 0 }
  2261. .srcX "uint16_t" --- Source texture X position.
  2262. { default = 0 }
  2263. .srcY "uint16_t" --- Source texture Y position.
  2264. { default = 0 }
  2265. .srcZ "uint16_t" --- If texture is 2D this argument should be 0. If source texture is cube
  2266. --- this argument represents source texture cube face. For 3D texture this argument
  2267. --- represents source texture Z position.
  2268. { default = 0 }
  2269. .width "uint16_t" --- Width of region.
  2270. { default = UINT16_MAX }
  2271. .height "uint16_t" --- Height of region.
  2272. { default = UINT16_MAX }
  2273. .depth "uint16_t" --- If texture is 3D this argument represents depth of region, otherwise it's
  2274. --- unused.
  2275. { default = UINT16_MAX }
  2276. --- Request screen shot of window back buffer.
  2277. ---
  2278. --- @remarks
  2279. --- `bgfx::CallbackI::screenShot` must be implemented.
  2280. --- @attention Frame buffer handle must be created with OS' target native window handle.
  2281. ---
  2282. func.requestScreenShot
  2283. "void"
  2284. .handle "FrameBufferHandle" --- Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  2285. --- made for main window back buffer.
  2286. .filePath "const char*" --- Will be passed to `bgfx::CallbackI::screenShot` callback.
  2287. --- Render frame.
  2288. ---
  2289. --- @attention `bgfx::renderFrame` is blocking call. It waits for
  2290. --- `bgfx::frame` to be called from API thread to process frame.
  2291. --- If timeout value is passed call will timeout and return even
  2292. --- if `bgfx::frame` is not called.
  2293. ---
  2294. --- @warning This call should be only used on platforms that don't
  2295. --- allow creating separate rendering thread. If it is called before
  2296. --- to bgfx::init, render thread won't be created by bgfx::init call.
  2297. ---
  2298. func.renderFrame
  2299. "RenderFrame::Enum" --- Current renderer context state. See: `bgfx::RenderFrame`.
  2300. .msecs "int32_t" --- Timeout in milliseconds.
  2301. { default = -1 }
  2302. --- Set platform data.
  2303. ---
  2304. --- @warning Must be called before `bgfx::init`.
  2305. ---
  2306. func.setPlatformData
  2307. "void"
  2308. .data "const PlatformData &" --- Platform data.
  2309. --- Get internal data for interop.
  2310. ---
  2311. --- @attention It's expected you understand some bgfx internals before you
  2312. --- use this call.
  2313. ---
  2314. --- @warning Must be called only on render thread.
  2315. ---
  2316. func.getInternalData
  2317. "const InternalData*" --- Internal data.
  2318. --- Override internal texture with externally created texture. Previously
  2319. --- created internal texture will released.
  2320. ---
  2321. --- @attention It's expected you understand some bgfx internals before you
  2322. --- use this call.
  2323. ---
  2324. --- @warning Must be called only on render thread.
  2325. ---
  2326. func.overrideInternal { cname = "override_internal_texture_ptr" }
  2327. "uintptr_t" --- Native API pointer to texture. If result is 0, texture is not created
  2328. --- yet from the main thread.
  2329. .handle "TextureHandle" --- Texture handle.
  2330. .ptr "uintptr_t" --- Native API pointer to texture.
  2331. --- Override internal texture by creating new texture. Previously created
  2332. --- internal texture will released.
  2333. ---
  2334. --- @attention It's expected you understand some bgfx internals before you
  2335. --- use this call.
  2336. ---
  2337. --- @returns Native API pointer to texture. If result is 0, texture is not created yet from the
  2338. --- main thread.
  2339. ---
  2340. --- @warning Must be called only on render thread.
  2341. ---
  2342. func.overrideInternal { cname = "override_internal_texture" }
  2343. "uintptr_t" --- Native API pointer to texture. If result is 0, texture is not created
  2344. --- yet from the main thread.
  2345. .handle "TextureHandle" --- Texture handle.
  2346. .width "uint16_t" --- Width.
  2347. .height "uint16_t" --- Height.
  2348. .numMips "uint8_t" --- Number of mip-maps.
  2349. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2350. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2351. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2352. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2353. --- mode.
  2354. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2355. --- sampling.
  2356. -- Legacy API:
  2357. --- Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  2358. --- graphics debugging tools.
  2359. func.setMarker
  2360. "void"
  2361. .marker "const char*" --- Marker string.
  2362. --- Set render states for draw primitive.
  2363. ---
  2364. --- @remarks
  2365. --- 1. To setup more complex states use:
  2366. --- `BGFX_STATE_ALPHA_REF(_ref)`,
  2367. --- `BGFX_STATE_POINT_SIZE(_size)`,
  2368. --- `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  2369. --- `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  2370. --- `BGFX_STATE_BLEND_EQUATION(_equation)`,
  2371. --- `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  2372. --- 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  2373. --- equation is specified.
  2374. ---
  2375. func.setState
  2376. "void"
  2377. .state "uint64_t" --- State flags. Default state for primitive type is
  2378. --- triangles. See: `BGFX_STATE_DEFAULT`.
  2379. --- - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  2380. --- - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  2381. --- - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  2382. --- - `BGFX_STATE_CULL_*` - Backface culling mode.
  2383. --- - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  2384. --- - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  2385. --- - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  2386. .rgba "uint32_t" --- Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  2387. --- `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  2388. { default = 0 }
  2389. --- Set condition for rendering.
  2390. func.setCondition
  2391. "void"
  2392. .handle "OcclusionQueryHandle" --- Occlusion query handle.
  2393. .visible "bool" --- Render if occlusion query is visible.
  2394. --- Set stencil test state.
  2395. func.setStencil
  2396. "void"
  2397. .fstencil "uint32_t" --- Front stencil state.
  2398. .bstencil "uint32_t" --- Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  2399. --- _fstencil is applied to both front and back facing primitives.
  2400. { default = "BGFX_STENCIL_NONE" }
  2401. --- Set scissor for draw primitive.
  2402. ---
  2403. --- @remark
  2404. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  2405. ---
  2406. func.setScissor
  2407. "uint16_t" --- Scissor cache index.
  2408. .x "uint16_t" --- Position x from the left corner of the window.
  2409. .y "uint16_t" --- Position y from the top corner of the window.
  2410. .width "uint16_t" --- Width of view scissor region.
  2411. .height "uint16_t" --- Height of view scissor region.
  2412. --- Set scissor from cache for draw primitive.
  2413. ---
  2414. --- @remark
  2415. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  2416. ---
  2417. func.setScissor { cname = "set_scissor_cached" }
  2418. "void"
  2419. .cache "uint16_t" --- Index in scissor cache.
  2420. { default = UINT16_MAX }
  2421. --- Set model matrix for draw primitive. If it is not called,
  2422. --- the model will be rendered with an identity model matrix.
  2423. func.setTransform
  2424. "uint32_t" --- Index into matrix cache in case the same model matrix has
  2425. --- to be used for other draw primitive call.
  2426. .mtx "const void*" --- Pointer to first matrix in array.
  2427. .num "uint16_t" --- Number of matrices in array.
  2428. --- Set model matrix from matrix cache for draw primitive.
  2429. func.setTransform { cname = "set_transform_cached" }
  2430. "void"
  2431. .cache "uint32_t" --- Index in matrix cache.
  2432. .num "uint16_t" --- Number of matrices from cache.
  2433. { default = 1 }
  2434. --- Reserve matrices in internal matrix cache.
  2435. ---
  2436. --- @attention Pointer returned can be modifed until `bgfx::frame` is called.
  2437. ---
  2438. func.allocTransform
  2439. "uint32_t" --- Index in matrix cache.
  2440. .transform "Transform*" { out } --- Pointer to `Transform` structure.
  2441. .num "uint16_t" --- Number of matrices.
  2442. --- Set shader uniform parameter for draw primitive.
  2443. func.setUniform
  2444. "void"
  2445. .handle "UniformHandle" --- Uniform.
  2446. .value "const void*" --- Pointer to uniform data.
  2447. .num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
  2448. --- use the _num passed on uniform creation.
  2449. { default = 1 }
  2450. --- Set index buffer for draw primitive.
  2451. func.setIndexBuffer { cpponly }
  2452. "void"
  2453. .handle "IndexBufferHandle" --- Index buffer.
  2454. --- Set index buffer for draw primitive.
  2455. func.setIndexBuffer
  2456. "void"
  2457. .handle "IndexBufferHandle" --- Index buffer.
  2458. .firstIndex "uint32_t" --- First index to render.
  2459. .numIndices "uint32_t" --- Number of indices to render.
  2460. --- Set index buffer for draw primitive.
  2461. func.setIndexBuffer { cpponly }
  2462. "void"
  2463. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2464. --- Set index buffer for draw primitive.
  2465. func.setIndexBuffer { cname = "set_dynamic_index_buffer" }
  2466. "void"
  2467. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2468. .firstIndex "uint32_t" --- First index to render.
  2469. .numIndices "uint32_t" --- Number of indices to render.
  2470. --- Set index buffer for draw primitive.
  2471. func.setIndexBuffer { cpponly }
  2472. "void"
  2473. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2474. --- Set index buffer for draw primitive.
  2475. func.setIndexBuffer { cname = "set_transient_index_buffer" }
  2476. "void"
  2477. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2478. .firstIndex "uint32_t" --- First index to render.
  2479. .numIndices "uint32_t" --- Number of indices to render.
  2480. --- Set vertex buffer for draw primitive.
  2481. func.setVertexBuffer { cpponly }
  2482. "void"
  2483. .stream "uint8_t" --- Vertex stream.
  2484. .handle "VertexBufferHandle" --- Vertex buffer.
  2485. --- Set vertex buffer for draw primitive.
  2486. func.setVertexBuffer
  2487. "void"
  2488. .stream "uint8_t" --- Vertex stream.
  2489. .handle "VertexBufferHandle" --- Vertex buffer.
  2490. .startVertex "uint32_t" --- First vertex to render.
  2491. .numVertices "uint32_t" --- Number of vertices to render.
  2492. --- Set vertex buffer for draw primitive.
  2493. func.setVertexBuffer { cpponly }
  2494. "void"
  2495. .stream "uint8_t" --- Vertex stream.
  2496. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2497. --- Set vertex buffer for draw primitive.
  2498. func.setVertexBuffer { cname = "set_dynamic_vertex_buffer" }
  2499. "void"
  2500. .stream "uint8_t" --- Vertex stream.
  2501. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2502. .startVertex "uint32_t" --- First vertex to render.
  2503. .numVertices "uint32_t" --- Number of vertices to render.
  2504. --- Set vertex buffer for draw primitive.
  2505. func.setVertexBuffer { cpponly }
  2506. "void"
  2507. .stream "uint8_t" --- Vertex stream.
  2508. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2509. --- Set vertex buffer for draw primitive.
  2510. func.setVertexBuffer { cname = "set_transient_vertex_buffer" }
  2511. "void"
  2512. .stream "uint8_t" --- Vertex stream.
  2513. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2514. .startVertex "uint32_t" --- First vertex to render.
  2515. .numVertices "uint32_t" --- Number of vertices to render.
  2516. --- Set number of vertices for auto generated vertices use in conjuction
  2517. --- with gl_VertexID.
  2518. ---
  2519. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2520. ---
  2521. func.setVertexCount
  2522. "void"
  2523. .numVertices "uint32_t" --- Number of vertices.
  2524. --- Set instance data buffer for draw primitive.
  2525. func.setInstanceDataBuffer { cpponly }
  2526. "void"
  2527. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2528. --- Set instance data buffer for draw primitive.
  2529. func.setInstanceDataBuffer
  2530. "void"
  2531. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2532. .start "uint32_t" --- First instance data.
  2533. .num "uint32_t" --- Number of data instances.
  2534. --- Set instance data buffer for draw primitive.
  2535. func.setInstanceDataBuffer { cpponly }
  2536. "void"
  2537. .handle "VertexBufferHandle" --- Vertex buffer.
  2538. --- Set instance data buffer for draw primitive.
  2539. func.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" }
  2540. "void"
  2541. .handle "VertexBufferHandle" --- Vertex buffer.
  2542. .startVertex "uint32_t" --- First instance data.
  2543. .num "uint32_t" --- Number of data instances.
  2544. --- Set instance data buffer for draw primitive.
  2545. func.setInstanceDataBuffer { cpponly }
  2546. "void"
  2547. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2548. --- Set instance data buffer for draw primitive.
  2549. func.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" }
  2550. "void"
  2551. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2552. .startVertex "uint32_t" --- First instance data.
  2553. .num "uint32_t" --- Number of data instances.
  2554. --- Set number of instances for auto generated instances use in conjuction
  2555. --- with gl_InstanceID.
  2556. ---
  2557. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2558. ---
  2559. func.setInstanceCount
  2560. "void"
  2561. .numInstances "uint32_t" -- Number of instances.
  2562. --- Set texture stage for draw primitive.
  2563. func.setTexture
  2564. "void"
  2565. .stage "uint8_t" --- Texture unit.
  2566. .sampler "UniformHandle" --- Program sampler.
  2567. .handle "TextureHandle" --- Texture handle.
  2568. .flags "uint32_t" --- Texture sampling mode. Default value UINT32_MAX uses
  2569. { default = UINT32_MAX } --- texture sampling settings from the texture.
  2570. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2571. --- mode.
  2572. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2573. --- sampling.
  2574. --- Submit an empty primitive for rendering. Uniforms and draw state
  2575. --- will be applied but no geometry will be submitted.
  2576. ---
  2577. --- @remark
  2578. --- These empty draw calls will sort before ordinary draw calls.
  2579. ---
  2580. func.touch
  2581. "void"
  2582. .id "ViewId" --- View id.
  2583. --- Submit primitive for rendering.
  2584. func.submit
  2585. "void"
  2586. .id "ViewId" --- View id.
  2587. .program "ProgramHandle" --- Program.
  2588. .depth "uint32_t" --- Depth for sorting.
  2589. { default = 0 }
  2590. .flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
  2591. { default = "BGFX_DISCARD_ALL" }
  2592. --- Submit primitive with occlusion query for rendering.
  2593. func.submit { cname = "submit_occlusion_query" }
  2594. "void"
  2595. .id "ViewId" --- View id.
  2596. .program "ProgramHandle" --- Program.
  2597. .occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
  2598. .depth "uint32_t" --- Depth for sorting.
  2599. { default = 0 }
  2600. .flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
  2601. { default = "BGFX_DISCARD_ALL" }
  2602. --- Submit primitive for rendering with index and instance data info from
  2603. --- indirect buffer.
  2604. func.submit { cname = "submit_indirect" }
  2605. "void"
  2606. .id "ViewId" --- View id.
  2607. .program "ProgramHandle" --- Program.
  2608. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2609. .start "uint16_t" --- First element in indirect buffer.
  2610. { default = 0 }
  2611. .num "uint16_t" --- Number of dispatches.
  2612. { default = 1 }
  2613. .depth "uint32_t" --- Depth for sorting.
  2614. { default = 0 }
  2615. .flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
  2616. { default = "BGFX_DISCARD_ALL" }
  2617. --- Set compute index buffer.
  2618. func.setBuffer { cname = "set_compute_index_buffer" }
  2619. "void"
  2620. .stage "uint8_t" --- Compute stage.
  2621. .handle "IndexBufferHandle" --- Index buffer handle.
  2622. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2623. --- Set compute vertex buffer.
  2624. func.setBuffer { cname = "set_compute_vertex_buffer" }
  2625. "void"
  2626. .stage "uint8_t" --- Compute stage.
  2627. .handle "VertexBufferHandle" --- Vertex buffer handle.
  2628. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2629. --- Set compute dynamic index buffer.
  2630. func.setBuffer { cname = "set_compute_dynamic_index_buffer" }
  2631. "void"
  2632. .stage "uint8_t" --- Compute stage.
  2633. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  2634. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2635. --- Set compute dynamic vertex buffer.
  2636. func.setBuffer { cname = "set_compute_dynamic_vertex_buffer" }
  2637. "void"
  2638. .stage "uint8_t" --- Compute stage.
  2639. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  2640. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2641. --- Set compute indirect buffer.
  2642. func.setBuffer { cname = "set_compute_indirect_buffer" }
  2643. "void"
  2644. .stage "uint8_t" --- Compute stage.
  2645. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  2646. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2647. --- Set compute image from texture.
  2648. func.setImage
  2649. "void"
  2650. .stage "uint8_t" --- Compute stage.
  2651. .handle "TextureHandle" --- Texture handle.
  2652. .mip "uint8_t" --- Mip level.
  2653. .access "Access::Enum" --- Image access. See `Access::Enum`.
  2654. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2655. { default = "TextureFormat::Count" }
  2656. --- Dispatch compute.
  2657. func.dispatch
  2658. "void"
  2659. .id "ViewId" --- View id.
  2660. .program "ProgramHandle" --- Compute program.
  2661. .numX "uint32_t" --- Number of groups X.
  2662. { default = 1 }
  2663. .numY "uint32_t" --- Number of groups Y.
  2664. { default = 1 }
  2665. .numZ "uint32_t" --- Number of groups Z.
  2666. { default = 1 }
  2667. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2668. { default = "BGFX_DISCARD_ALL" }
  2669. --- Dispatch compute indirect.
  2670. func.dispatch { cname = "dispatch_indirect" }
  2671. "void"
  2672. .id "ViewId" --- View id.
  2673. .program "ProgramHandle" --- Compute program.
  2674. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2675. .start "uint16_t" --- First element in indirect buffer.
  2676. { default = 0 }
  2677. .num "uint16_t" --- Number of dispatches.
  2678. { default = 1 }
  2679. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2680. { default = "BGFX_DISCARD_ALL" }
  2681. --- Discard previously set state for draw or compute call.
  2682. func.discard
  2683. "void"
  2684. .flags "uint8_t" --- Draw/compute states to discard.
  2685. { default = "BGFX_DISCARD_ALL" }
  2686. --- Blit 2D texture region between two 2D textures.
  2687. ---
  2688. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2689. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2690. ---
  2691. func.blit { cpponly }
  2692. "void"
  2693. .id "ViewId" --- View id.
  2694. .dst "TextureHandle" --- Destination texture handle.
  2695. .dstX "uint16_t" --- Destination texture X position.
  2696. .dstY "uint16_t" --- Destination texture Y position.
  2697. .src "TextureHandle" --- Source texture handle.
  2698. .srcX "uint16_t" --- Source texture X position.
  2699. { default = 0 }
  2700. .srcY "uint16_t" --- Source texture Y position.
  2701. { default = 0 }
  2702. .width "uint16_t" --- Width of region.
  2703. { default = UINT16_MAX }
  2704. .height "uint16_t" --- Height of region.
  2705. { default = UINT16_MAX }
  2706. --- Blit 2D texture region between two 2D textures.
  2707. ---
  2708. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2709. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2710. ---
  2711. func.blit
  2712. "void"
  2713. .id "ViewId" --- View id.
  2714. .dst "TextureHandle" --- Destination texture handle.
  2715. .dstMip "uint8_t" --- Destination texture mip level.
  2716. .dstX "uint16_t" --- Destination texture X position.
  2717. .dstY "uint16_t" --- Destination texture Y position.
  2718. .dstZ "uint16_t" --- If texture is 2D this argument should be 0. If destination texture is cube
  2719. --- this argument represents destination texture cube face. For 3D texture this argument
  2720. --- represents destination texture Z position.
  2721. .src "TextureHandle" --- Source texture handle.
  2722. .srcMip "uint8_t" --- Source texture mip level.
  2723. { default = 0 }
  2724. .srcX "uint16_t" --- Source texture X position.
  2725. { default = 0 }
  2726. .srcY "uint16_t" --- Source texture Y position.
  2727. { default = 0 }
  2728. .srcZ "uint16_t" --- If texture is 2D this argument should be 0. If source texture is cube
  2729. --- this argument represents source texture cube face. For 3D texture this argument
  2730. --- represents source texture Z position.
  2731. { default = 0 }
  2732. .width "uint16_t" --- Width of region.
  2733. { default = UINT16_MAX }
  2734. .height "uint16_t" --- Height of region.
  2735. { default = UINT16_MAX }
  2736. .depth "uint16_t" --- If texture is 3D this argument represents depth of region, otherwise it's
  2737. --- unused.
  2738. { default = UINT16_MAX }