bgfx.idl 136 KB

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