bgfx.idl 131 KB

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