bgfx.idl 140 KB

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