bgfx.idl 136 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129
  1. -- vim: syntax=lua
  2. -- bgfx interface
  3. version(114)
  4. typedef "bool"
  5. typedef "char"
  6. typedef "float"
  7. typedef "int8_t"
  8. typedef "int32_t"
  9. typedef "int64_t"
  10. typedef "uint8_t"
  11. typedef "uint16_t"
  12. typedef "uint32_t"
  13. typedef "uint64_t"
  14. typedef "uintptr_t"
  15. typedef "va_list"
  16. typedef "void"
  17. typedef "ViewId"
  18. typedef "CallbackI" { cname = "callback_interface" }
  19. typedef "bx::AllocatorI" { cname = "allocator_interface" }
  20. --- Memory release callback.
  21. funcptr.ReleaseFn
  22. "void"
  23. .ptr "void*" --- Pointer to allocated data.
  24. .userData "void*" --- User defined data if needed.
  25. --- Color RGB/alpha/depth write. When it's not specified write will be disabled.
  26. flag.StateWrite { bits = 64 , base = 1 }
  27. .R --- Enable R write.
  28. .G --- Enable G write.
  29. .B --- Enable B write.
  30. .A --- Enable alpha write.
  31. .Z (39) --- Enable depth write.
  32. .Rgb { "R", "G", "B" } --- Enable RGB write.
  33. .Mask { "Rgb", "A", "Z" } --- Write all channels mask.
  34. --- Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled.
  35. flag.StateDepthTest { bits = 64, shift = 4, range = 4, base = 1 , desc = "Depth test state" }
  36. .Less --- Enable depth test, less.
  37. .Lequal --- Enable depth test, less or equal.
  38. .Equal --- Enable depth test, equal.
  39. .Gequal --- Enable depth test, greater or equal.
  40. .Greater --- Enable depth test, greater.
  41. .Notequal --- Enable depth test, not equal.
  42. .Never --- Enable depth test, never.
  43. .Always --- Enable depth test, always.
  44. ()
  45. --- Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
  46. --- helper macros.
  47. flag.StateBlend { bits = 64, shift = 12, range = 16, base = 1, desc = "Blend state" }
  48. .Zero --- 0, 0, 0, 0
  49. .One --- 1, 1, 1, 1
  50. .SrcColor --- Rs, Gs, Bs, As
  51. .InvSrcColor --- 1-Rs, 1-Gs, 1-Bs, 1-As
  52. .SrcAlpha --- As, As, As, As
  53. .InvSrcAlpha --- 1-As, 1-As, 1-As, 1-As
  54. .DstAlpha --- Ad, Ad, Ad, Ad
  55. .InvDstAlpha --- 1-Ad, 1-Ad, 1-Ad ,1-Ad
  56. .DstColor --- Rd, Gd, Bd, Ad
  57. .InvDstColor --- 1-Rd, 1-Gd, 1-Bd, 1-Ad
  58. .SrcAlphaSat --- f, f, f, 1; f = min(As, 1-Ad)
  59. .Factor --- Blend factor
  60. .InvFactor --- 1-Blend factor
  61. ()
  62. --- Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
  63. --- helper macros.
  64. flag.StateBlendEquation { bits = 64, shift = 28, range = 6, base = 0, desc = "Blend equation" }
  65. .Add --- Blend add: src + dst.
  66. .Sub --- Blend subtract: src - dst.
  67. .Revsub --- Blend reverse subtract: dst - src.
  68. .Min --- Blend min: min(src, dst).
  69. .Max --- Blend max: max(src, dst).
  70. ()
  71. --- Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled.
  72. flag.StateCull { bits = 64, shift = 36, range = 2, base = 1, desc = "Culling mode" }
  73. .Cw --- Cull clockwise triangles.
  74. .Ccw --- Cull counter-clockwise triangles.
  75. ()
  76. --- Alpha reference value.
  77. flag.StateAlphaRef { bits = 64, shift = 40, range = 8, desc = "Alpha reference", "helper" }
  78. flag.StatePt { bits = 64, shift = 48, range = 3, base = 1, desc = "Primitive type" }
  79. .Tristrip --- Tristrip.
  80. .Lines --- Lines.
  81. .Linestrip --- Line strip.
  82. .Points --- Points.
  83. ()
  84. --- Point size value.
  85. flag.StatePointSize { bits = 64, shift = 52, range = 4, desc = "Point size", "helper" }
  86. --- Enable MSAA write when writing into MSAA frame buffer.
  87. --- This flag is ignored when not writing into MSAA frame buffer.
  88. flag.State { bits = 64 , range = 64 , desc = "State" }
  89. .Msaa (57) --- Enable MSAA rasterization.
  90. .Lineaa (58) --- Enable line AA rasterization.
  91. .ConservativeRaster (59) --- Enable conservative rasterization.
  92. .None (0) --- No state.
  93. .FrontCcw(40) --- Front counter-clockwise (default is clockwise).
  94. .BlendIndependent(35) --- Enable blend independent.
  95. .BlendAlphaToCoverage (36) --- Enable alpha to coverage.
  96. .Default { "WriteRgb", "WriteA", "WriteZ", "DepthTestLess", "CullCw", "Msaa" }
  97. --- Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
  98. --- culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored).
  99. --- Do not use!
  100. flag.StateReserved { bits = 64, shift = 61, range = 3 }
  101. --- Set stencil ref value.
  102. flag.StencilFuncRef { bits = 32, shift = 0, range = 8, "helper" }
  103. --- Set stencil rmask value.
  104. flag.StencilFuncRmask { bits = 32, shift = 8, range = 8, "helper" }
  105. flag.Stencil { bits = 32, const }
  106. .None (0x00000000)
  107. .Mask (0xffffffff)
  108. .Default (0x00000000)
  109. flag.StencilTest { bits = 32, shift = 16, range = 4 , base = 1, desc = "Stencil test" }
  110. .Less --- Enable stencil test, less.
  111. .Lequal --- Enable stencil test, less or equal.
  112. .Equal --- Enable stencil test, equal.
  113. .Gequal --- Enable stencil test, greater or equal.
  114. .Greater --- Enable stencil test, greater.
  115. .Notequal --- Enable stencil test, not equal.
  116. .Never --- Enable stencil test, never.
  117. .Always --- Enable stencil test, always.
  118. ()
  119. flag.StencilOpFailS { bits = 32, shift = 20, range = 4, base = 0, desc = "Stencil operation fail" }
  120. .Zero --- Zero.
  121. .Keep --- Keep.
  122. .Replace --- Replace.
  123. .Incr --- Increment and wrap.
  124. .Incrsat --- Increment and clamp.
  125. .Decr --- Decrement and wrap.
  126. .Decrsat --- Decrement and clamp.
  127. .Invert --- Invert.
  128. ()
  129. flag.StencilOpFailZ { bits = 32, shift = 24, range = 4, base = 0, desc = "Stencil operation depth fail" }
  130. .Zero --- Zero.
  131. .Keep --- Keep.
  132. .Replace --- Replace.
  133. .Incr --- Increment and wrap.
  134. .Incrsat --- Increment and clamp.
  135. .Decr --- Decrement and wrap.
  136. .Decrsat --- Decrement and clamp.
  137. .Invert --- Invert.
  138. ()
  139. flag.StencilOpPassZ { bits = 32, shift = 28, range = 4 , base = 0, desc = "Stencil operation depth pass" }
  140. .Zero --- Zero.
  141. .Keep --- Keep.
  142. .Replace --- Replace.
  143. .Incr --- Increment and wrap.
  144. .Incrsat --- Increment and clamp.
  145. .Decr --- Decrement and wrap.
  146. .Decrsat --- Decrement and clamp.
  147. .Invert --- Invert.
  148. ()
  149. flag.Clear { bits = 16 }
  150. .None --- No clear flags.
  151. .Color --- Clear color.
  152. .Depth --- Clear depth.
  153. .Stencil --- Clear stencil.
  154. .DiscardColor_0 --- Discard frame buffer attachment 0.
  155. .DiscardColor_1 --- Discard frame buffer attachment 1.
  156. .DiscardColor_2 --- Discard frame buffer attachment 2.
  157. .DiscardColor_3 --- Discard frame buffer attachment 3.
  158. .DiscardColor_4 --- Discard frame buffer attachment 4.
  159. .DiscardColor_5 --- Discard frame buffer attachment 5.
  160. .DiscardColor_6 --- Discard frame buffer attachment 6.
  161. .DiscardColor_7 --- Discard frame buffer attachment 7.
  162. .DiscardDepth --- Discard frame buffer depth attachment.
  163. .DiscardStencil --- Discard frame buffer stencil attachment.
  164. .DiscardColorMask {
  165. "DiscardColor_0",
  166. "DiscardColor_1",
  167. "DiscardColor_2",
  168. "DiscardColor_3",
  169. "DiscardColor_4",
  170. "DiscardColor_5",
  171. "DiscardColor_6",
  172. "DiscardColor_7"
  173. }
  174. .DiscardMask {
  175. "DiscardColorMask",
  176. "DiscardDepth",
  177. "DiscardStencil"
  178. }
  179. --- Rendering state discard. When state is preserved in submit, rendering states can be discarded
  180. --- on a finer grain.
  181. flag.Discard { bits = 8, const, desc = "Discard flags" }
  182. .None (0x00) --- Preserve everything.
  183. .Bindings (0x01) --- Discard texture sampler and buffer bindings.
  184. .IndexBuffer (0x02) --- Discard index buffer.
  185. .InstanceData (0x04) --- Discard instance data.
  186. .State (0x08) --- Discard state and uniform bindings.
  187. .Transform (0x10) --- Discard transform.
  188. .VertexStreams (0x20) --- Discard vertex streams.
  189. .All (0xff) --- Discard all states.
  190. ()
  191. flag.Debug { bits = 32 }
  192. .None --- No debug.
  193. .Wireframe --- Enable wireframe for all primitives.
  194. .Ifh --- Enable infinitely fast hardware test. No draw calls will be submitted to driver.
  195. --- It's useful when profiling to quickly assess bottleneck between CPU and GPU.
  196. .Stats --- Enable statistics display.
  197. .Text --- Enable debug text display.
  198. .Profiler --- Enable profiler.
  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. .capabilities "uint64_t" --- Capabilities initialization mask (default: UINT64_MAX).
  722. .debug "bool" --- Enable device for debuging.
  723. .profile "bool" --- Enable device for profiling.
  724. .platformData "PlatformData" --- Platform data.
  725. .resolution "Resolution" --- Backbuffer resolution and reset parameters. See: `bgfx::Resolution`.
  726. .limits "Limits" --- Configurable runtime limits parameters.
  727. .callback "CallbackI*" --- Provide application specific callback interface.
  728. --- See: `bgfx::CallbackI`
  729. .allocator "bx::AllocatorI*" --- Custom allocator. When a custom allocator is not
  730. --- specified, bgfx uses the CRT allocator. Bgfx assumes
  731. --- custom allocator is thread safe.
  732. --- Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`.
  733. ---
  734. --- @attention It is illegal to create this structure on stack and pass it to any bgfx API.
  735. struct.Memory
  736. .data "uint8_t*" --- Pointer to data.
  737. .size "uint32_t" --- Data size.
  738. --- Transient index buffer.
  739. struct.TransientIndexBuffer
  740. .data "uint8_t*" --- Pointer to data.
  741. .size "uint32_t" --- Data size.
  742. .startIndex "uint32_t" --- First index.
  743. .handle "IndexBufferHandle" --- Index buffer handle.
  744. .isIndex16 "bool" --- Index buffer format is 16-bits if true, otherwise it is 32-bit.
  745. --- Transient vertex buffer.
  746. struct.TransientVertexBuffer
  747. .data "uint8_t*" --- Pointer to data.
  748. .size "uint32_t" --- Data size.
  749. .startVertex "uint32_t" --- First vertex.
  750. .stride "uint16_t" --- Vertex stride.
  751. .handle "VertexBufferHandle" --- Vertex buffer handle.
  752. .layoutHandle "VertexLayoutHandle" --- Vertex layout handle.
  753. --- Instance data buffer info.
  754. struct.InstanceDataBuffer
  755. .data "uint8_t*" --- Pointer to data.
  756. .size "uint32_t" --- Data size.
  757. .offset "uint32_t" --- Offset in vertex buffer.
  758. .num "uint32_t" --- Number of instances.
  759. .stride "uint16_t" --- Vertex buffer stride.
  760. .handle "VertexBufferHandle" --- Vertex buffer object handle.
  761. --- Texture info.
  762. struct.TextureInfo
  763. .format "TextureFormat::Enum" --- Texture format.
  764. .storageSize "uint32_t" --- Total amount of bytes required to store texture.
  765. .width "uint16_t" --- Texture width.
  766. .height "uint16_t" --- Texture height.
  767. .depth "uint16_t" --- Texture depth.
  768. .numLayers "uint16_t" --- Number of layers in texture array.
  769. .numMips "uint8_t" --- Number of MIP maps.
  770. .bitsPerPixel "uint8_t" --- Format bits per pixel.
  771. .cubeMap "bool" --- Texture is cubemap.
  772. --- Uniform info.
  773. struct.UniformInfo
  774. .name "char[256]" --- Uniform name.
  775. .type "UniformType::Enum" --- Uniform type.
  776. .num "uint16_t" --- Number of elements in array.
  777. --- Frame buffer texture attachment info.
  778. struct.Attachment { shortname }
  779. .access "Access::Enum" --- Attachment access. See `Access::Enum`.
  780. .handle "TextureHandle" --- Render target texture handle.
  781. .mip "uint16_t" --- Mip level.
  782. .layer "uint16_t" --- Cubemap side or depth layer/slice to use.
  783. .numLayers "uint16_t" --- Number of texture layer/slice(s) in array to use.
  784. .resolve "uint8_t" --- Resolve flags. See: `BGFX_RESOLVE_*`
  785. --- Init attachment.
  786. func.Attachment.init
  787. "void"
  788. .handle "TextureHandle" --- Render target texture handle.
  789. .access "Access::Enum" --- Access. See `Access::Enum`.
  790. { default = "Access::Write" }
  791. .layer "uint16_t" --- Cubemap side or depth layer/slice to use.
  792. { default = 0 }
  793. .numLayers "uint16_t" --- Number of texture layer/slice(s) in array to use.
  794. { default = 1 }
  795. .mip "uint16_t" --- Mip level.
  796. { default = 0 }
  797. .resolve "uint8_t" --- Resolve flags. See: `BGFX_RESOLVE_*`
  798. { default = "BGFX_RESOLVE_AUTO_GEN_MIPS" }
  799. --- Transform data.
  800. struct.Transform
  801. .data "float*" --- Pointer to first 4x4 matrix.
  802. .num "uint16_t" --- Number of matrices.
  803. --- View stats.
  804. struct.ViewStats
  805. .name "char[256]" --- View name.
  806. .view "ViewId" --- View id.
  807. .cpuTimeBegin "int64_t" --- CPU (submit) begin time.
  808. .cpuTimeEnd "int64_t" --- CPU (submit) end time.
  809. .gpuTimeBegin "int64_t" --- GPU begin time.
  810. .gpuTimeEnd "int64_t" --- GPU end time.
  811. --- Encoder stats.
  812. struct.EncoderStats
  813. .cpuTimeBegin "int64_t" --- Encoder thread CPU submit begin time.
  814. .cpuTimeEnd "int64_t" --- Encoder thread CPU submit end time.
  815. --- Renderer statistics data.
  816. ---
  817. --- @remarks All time values are high-resolution timestamps, while
  818. --- time frequencies define timestamps-per-second for that hardware.
  819. struct.Stats
  820. .cpuTimeFrame "int64_t" --- CPU time between two `bgfx::frame` calls.
  821. .cpuTimeBegin "int64_t" --- Render thread CPU submit begin time.
  822. .cpuTimeEnd "int64_t" --- Render thread CPU submit end time.
  823. .cpuTimerFreq "int64_t" --- CPU timer frequency. Timestamps-per-second
  824. .gpuTimeBegin "int64_t" --- GPU frame begin time.
  825. .gpuTimeEnd "int64_t" --- GPU frame end time.
  826. .gpuTimerFreq "int64_t" --- GPU timer frequency.
  827. .waitRender "int64_t" --- Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API.
  828. .waitSubmit "int64_t" --- Time spent waiting for submit thread to advance to next frame.
  829. .numDraw "uint32_t" --- Number of draw calls submitted.
  830. .numCompute "uint32_t" --- Number of compute calls submitted.
  831. .numBlit "uint32_t" --- Number of blit calls submitted.
  832. .maxGpuLatency "uint32_t" --- GPU driver latency.
  833. .numDynamicIndexBuffers "uint16_t" --- Number of used dynamic index buffers.
  834. .numDynamicVertexBuffers "uint16_t" --- Number of used dynamic vertex buffers.
  835. .numFrameBuffers "uint16_t" --- Number of used frame buffers.
  836. .numIndexBuffers "uint16_t" --- Number of used index buffers.
  837. .numOcclusionQueries "uint16_t" --- Number of used occlusion queries.
  838. .numPrograms "uint16_t" --- Number of used programs.
  839. .numShaders "uint16_t" --- Number of used shaders.
  840. .numTextures "uint16_t" --- Number of used textures.
  841. .numUniforms "uint16_t" --- Number of used uniforms.
  842. .numVertexBuffers "uint16_t" --- Number of used vertex buffers.
  843. .numVertexLayouts "uint16_t" --- Number of used vertex layouts.
  844. .textureMemoryUsed "int64_t" --- Estimate of texture memory used.
  845. .rtMemoryUsed "int64_t" --- Estimate of render target memory used.
  846. .transientVbUsed "int32_t" --- Amount of transient vertex buffer used.
  847. .transientIbUsed "int32_t" --- Amount of transient index buffer used.
  848. .numPrims "uint32_t[Topology::Count]" --- Number of primitives rendered.
  849. .gpuMemoryMax "int64_t" --- Maximum available GPU memory for application.
  850. .gpuMemoryUsed "int64_t" --- Amount of GPU memory used by the application.
  851. .width "uint16_t" --- Backbuffer width in pixels.
  852. .height "uint16_t" --- Backbuffer height in pixels.
  853. .textWidth "uint16_t" --- Debug text width in characters.
  854. .textHeight "uint16_t" --- Debug text height in characters.
  855. .numViews "uint16_t" --- Number of view stats.
  856. .viewStats "ViewStats*" --- Array of View stats.
  857. .numEncoders "uint8_t" --- Number of encoders used during frame.
  858. .encoderStats "EncoderStats*" --- Array of encoder stats.
  859. --- Vertex layout.
  860. struct.VertexLayout { ctor }
  861. .hash "uint32_t" --- Hash.
  862. .stride "uint16_t" --- Stride.
  863. .offset "uint16_t[Attrib::Count]" --- Attribute offsets.
  864. .attributes "uint16_t[Attrib::Count]" --- Used attributes.
  865. --- Encoders are used for submitting draw calls from multiple threads. Only one encoder
  866. --- per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread.
  867. struct.Encoder {}
  868. handle "DynamicIndexBufferHandle"
  869. handle "DynamicVertexBufferHandle"
  870. handle "FrameBufferHandle"
  871. handle "IndexBufferHandle"
  872. handle "IndirectBufferHandle"
  873. handle "OcclusionQueryHandle"
  874. handle "ProgramHandle"
  875. handle "ShaderHandle"
  876. handle "TextureHandle"
  877. handle "UniformHandle"
  878. handle "VertexBufferHandle"
  879. handle "VertexLayoutHandle"
  880. --- Start VertexLayout.
  881. func.VertexLayout.begin
  882. "VertexLayout&"
  883. .rendererType "RendererType::Enum"
  884. { default = "RendererType::Noop" }
  885. --- Add attribute to VertexLayout.
  886. ---
  887. --- @remarks Must be called between begin/end.
  888. ---
  889. func.VertexLayout.add
  890. "VertexLayout&"
  891. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  892. .num "uint8_t" --- Number of elements 1, 2, 3 or 4.
  893. .type "AttribType::Enum" --- Element type.
  894. .normalized "bool" --- When using fixed point AttribType (f.e. Uint8)
  895. { default = false } --- value will be normalized for vertex shader usage. When normalized
  896. --- is set to true, AttribType::Uint8 value in range 0-255 will be
  897. --- in range 0.0-1.0 in vertex shader.
  898. .asInt "bool" --- Packaging rule for vertexPack, vertexUnpack, and
  899. { default = false } --- vertexConvert for AttribType::Uint8 and AttribType::Int16.
  900. --- Unpacking code must be implemented inside vertex shader.
  901. --- Decode attribute.
  902. func.VertexLayout.decode { const }
  903. "void"
  904. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  905. .num "uint8_t &" { out } --- Number of elements.
  906. .type "AttribType::Enum &" { out } --- Element type.
  907. .normalized "bool &" { out } --- Attribute is normalized.
  908. .asInt "bool &" { out } --- Attribute is packed as int.
  909. --- Returns true if VertexLayout contains attribute.
  910. func.VertexLayout.has { const }
  911. "bool"
  912. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  913. --- Skip `_num` bytes in vertex stream.
  914. func.VertexLayout.skip
  915. "VertexLayout&"
  916. .num "uint8_t"
  917. -- Notice: `end` is a keyword in lua.
  918. --- End VertexLayout.
  919. func.VertexLayout["end"]
  920. "void"
  921. --- Returns relative attribute offset from the vertex.
  922. func.VertexLayout.getOffset { const , cpponly }
  923. "uint16_t"
  924. .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
  925. --- Returns vertex stride.
  926. func.VertexLayout.getStride { const , cpponly }
  927. "uint16_t"
  928. --- Returns size of vertex buffer for number of vertices.
  929. func.VertexLayout.getSize { const, cpponly }
  930. "uint32_t"
  931. .num "uint32_t"
  932. --- Pack vertex attribute into vertex stream format.
  933. func.vertexPack
  934. "void"
  935. .input "const float[4]" --- Value to be packed into vertex stream.
  936. .inputNormalized "bool" --- `true` if input value is already normalized.
  937. .attr "Attrib::Enum" --- Attribute to pack.
  938. .layout "const VertexLayout &" --- Vertex stream layout.
  939. .data "void*" --- Destination vertex stream where data will be packed.
  940. .index "uint32_t" --- Vertex index that will be modified.
  941. { default = 0 }
  942. --- Unpack vertex attribute from vertex stream format.
  943. func.vertexUnpack
  944. "void"
  945. .output "float[4]" { out } --- Result of unpacking.
  946. .attr "Attrib::Enum" --- Attribute to unpack.
  947. .layout "const VertexLayout &" --- Vertex stream layout.
  948. .data "const void*" --- Source vertex stream from where data will be unpacked.
  949. .index "uint32_t" --- Vertex index that will be unpacked.
  950. { default = 0 }
  951. --- Converts vertex stream data from one vertex stream format to another.
  952. func.vertexConvert
  953. "void"
  954. .dstLayout "const VertexLayout &" --- Destination vertex stream layout.
  955. .dstData "void*" --- Destination vertex stream.
  956. .srcLayout "const VertexLayout &" --- Source vertex stream layout.
  957. .srcData "const void*" --- Source vertex stream data.
  958. .num "uint32_t" --- Number of vertices to convert from source to destination.
  959. { default = 1 }
  960. --- Weld vertices.
  961. func.weldVertices
  962. "uint32_t" --- Number of unique vertices after vertex welding.
  963. .output "void*" --- Welded vertices remapping table. The size of buffer
  964. --- must be the same as number of vertices.
  965. .layout "const VertexLayout &" --- Vertex stream layout.
  966. .data "const void*" --- Vertex stream.
  967. .num "uint32_t" --- Number of vertices in vertex stream.
  968. .index32 "bool" --- Set to `true` if input indices are 32-bit.
  969. .epsilon "float" --- Error tolerance for vertex position comparison.
  970. { default = "0.001f" }
  971. --- Convert index buffer for use with different primitive topologies.
  972. func.topologyConvert
  973. "uint32_t" --- Number of output indices after conversion.
  974. .conversion "TopologyConvert::Enum" --- Conversion type, see `TopologyConvert::Enum`.
  975. .dst "void*" { out } --- Destination index buffer. If this argument is NULL
  976. --- function will return number of indices after conversion.
  977. .dstSize "uint32_t" --- Destination index buffer in bytes. It must be
  978. --- large enough to contain output indices. If destination size is
  979. --- insufficient index buffer will be truncated.
  980. .indices "const void*" --- Source indices.
  981. .numIndices "uint32_t" --- Number of input indices.
  982. .index32 "bool" --- Set to `true` if input indices are 32-bit.
  983. --- Sort indices.
  984. func.topologySortTriList
  985. "void"
  986. .sort "TopologySort::Enum" --- Sort order, see `TopologySort::Enum`.
  987. .dst "void*" { out } --- Destination index buffer.
  988. .dstSize "uint32_t" --- Destination index buffer in bytes. It must be
  989. --- large enough to contain output indices. If destination size is
  990. --- insufficient index buffer will be truncated.
  991. .dir "const float[3]" --- Direction (vector must be normalized).
  992. .pos "const float[3]" --- Position.
  993. .vertices "const void*" --- Pointer to first vertex represented as
  994. --- float x, y, z. Must contain at least number of vertices
  995. --- referencende by index buffer.
  996. .stride "uint32_t" --- Vertex stride.
  997. .indices "const void*" --- Source indices.
  998. .numIndices "uint32_t" --- Number of input indices.
  999. .index32 "bool" --- Set to `true` if input indices are 32-bit.
  1000. --- Returns supported backend API renderers.
  1001. func.getSupportedRenderers
  1002. "uint8_t" --- Number of supported renderers.
  1003. .max "uint8_t" --- Maximum number of elements in _enum array.
  1004. { default = 0 }
  1005. .enum "RendererType::Enum*" { inout } --- Array where supported renderers will be written.
  1006. { default = NULL }
  1007. --- Returns name of renderer.
  1008. func.getRendererName
  1009. "const char*" --- Name of renderer.
  1010. .type "RendererType::Enum" --- Renderer backend type. See: `bgfx::RendererType`
  1011. func.initCtor { cfunc }
  1012. "void"
  1013. .init "Init*"
  1014. --- Initialize bgfx library.
  1015. func.init { cfunc }
  1016. "bool" --- `true` if initialization was successful.
  1017. .init "const Init &" --- Initialization parameters. See: `bgfx::Init` for more info.
  1018. --- Shutdown bgfx library.
  1019. func.shutdown
  1020. "void"
  1021. --- Reset graphic settings and back-buffer size.
  1022. ---
  1023. --- @attention This call doesn't actually change window size, it just
  1024. --- resizes back-buffer. Windowing code has to change window size.
  1025. ---
  1026. func.reset
  1027. "void"
  1028. .width "uint32_t" --- Back-buffer width.
  1029. .height "uint32_t" --- Back-buffer height.
  1030. .flags "uint32_t" --- See: `BGFX_RESET_*` for more info.
  1031. { default = "BGFX_RESET_NONE" } --- - `BGFX_RESET_NONE` - No reset flags.
  1032. --- - `BGFX_RESET_FULLSCREEN` - Not supported yet.
  1033. --- - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
  1034. --- - `BGFX_RESET_VSYNC` - Enable V-Sync.
  1035. --- - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
  1036. --- - `BGFX_RESET_CAPTURE` - Begin screen capture.
  1037. --- - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
  1038. --- - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
  1039. --- occurs. Default behaviour is that flip occurs before rendering new
  1040. --- frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  1041. --- - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer.
  1042. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1043. { default = "TextureFormat::Count" }
  1044. --- Advance to next frame. When using multithreaded renderer, this call
  1045. --- just swaps internal buffers, kicks render thread, and returns. In
  1046. --- singlethreaded renderer this call does frame rendering.
  1047. func.frame
  1048. "uint32_t" --- Current frame number. This might be used in conjunction with
  1049. --- double/multi buffering data outside the library and passing it to
  1050. --- library via `bgfx::makeRef` calls.
  1051. .capture "bool" --- Capture frame with graphics debugger.
  1052. { default = false }
  1053. --- Returns current renderer backend API type.
  1054. ---
  1055. --- @remarks
  1056. --- Library must be initialized.
  1057. ---
  1058. func.getRendererType
  1059. "RendererType::Enum" --- Renderer backend type. See: `bgfx::RendererType`
  1060. --- Returns renderer capabilities.
  1061. ---
  1062. --- @remarks
  1063. --- Library must be initialized.
  1064. ---
  1065. func.getCaps
  1066. "const Caps*" --- Pointer to static `bgfx::Caps` structure.
  1067. --- Returns performance counters.
  1068. ---
  1069. --- @attention Pointer returned is valid until `bgfx::frame` is called.
  1070. ---
  1071. func.getStats
  1072. "const Stats*" -- Performance counters.
  1073. --- Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
  1074. func.alloc
  1075. "const Memory*" --- Allocated memory.
  1076. .size "uint32_t" --- Size to allocate.
  1077. --- Allocate buffer and copy data into it. Data will be freed inside bgfx.
  1078. func.copy
  1079. "const Memory*" --- Allocated memory.
  1080. .data "const void*" --- Pointer to data to be copied.
  1081. .size "uint32_t" --- Size of data to be copied.
  1082. --- Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  1083. --- doesn't allocate memory for data. It just copies the _data pointer. You
  1084. --- can pass `ReleaseFn` function pointer to release this memory after it's
  1085. --- consumed, otherwise you must make sure _data is available for at least 2
  1086. --- `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  1087. --- from any thread.
  1088. ---
  1089. --- @attention Data passed must be available for at least 2 `bgfx::frame` calls.
  1090. ---
  1091. func.makeRef { conly }
  1092. "const Memory*" --- Referenced memory.
  1093. .data "const void*" --- Pointer to data.
  1094. .size "uint32_t" --- Size of data.
  1095. --- Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  1096. --- doesn't allocate memory for data. It just copies the _data pointer. You
  1097. --- can pass `ReleaseFn` function pointer to release this memory after it's
  1098. --- consumed, otherwise you must make sure _data is available for at least 2
  1099. --- `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  1100. --- from any thread.
  1101. ---
  1102. --- @attention Data passed must be available for at least 2 `bgfx::frame` calls.
  1103. ---
  1104. func.makeRef { cname = "make_ref_release" }
  1105. "const Memory*" --- Referenced memory.
  1106. .data "const void*" --- Pointer to data.
  1107. .size "uint32_t" --- Size of data.
  1108. .releaseFn "ReleaseFn" --- Callback function to release memory after use.
  1109. { default = NULL }
  1110. .userData "void*" --- User data to be passed to callback function.
  1111. { default = NULL }
  1112. --- Set debug flags.
  1113. func.setDebug
  1114. "void"
  1115. .debug "uint32_t" --- Available flags:
  1116. --- - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
  1117. --- all rendering calls will be skipped. This is useful when profiling
  1118. --- to quickly assess potential bottlenecks between CPU and GPU.
  1119. --- - `BGFX_DEBUG_PROFILER` - Enable profiler.
  1120. --- - `BGFX_DEBUG_STATS` - Display internal statistics.
  1121. --- - `BGFX_DEBUG_TEXT` - Display debug text.
  1122. --- - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
  1123. --- primitives will be rendered as lines.
  1124. --- Clear internal debug text buffer.
  1125. func.dbgTextClear
  1126. "void"
  1127. .attr "uint8_t" --- Background color.
  1128. { default = 0 }
  1129. .small "bool" --- Default 8x16 or 8x8 font.
  1130. { default = false }
  1131. --- Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
  1132. func.dbgTextPrintf { vararg = "dbgTextPrintfVargs" }
  1133. "void"
  1134. .x "uint16_t" --- Position x from the left corner of the window.
  1135. .y "uint16_t" --- Position y from the top corner of the window.
  1136. .attr "uint8_t" --- Color palette. Where top 4-bits represent index of background, and bottom
  1137. --- 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  1138. .format "const char*" --- `printf` style format.
  1139. --- Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
  1140. func.dbgTextPrintfVargs { cname = "dbg_text_vprintf" }
  1141. "void"
  1142. .x "uint16_t" --- Position x from the left corner of the window.
  1143. .y "uint16_t" --- Position y from the top corner of the window.
  1144. .attr "uint8_t" --- Color palette. Where top 4-bits represent index of background, and bottom
  1145. --- 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  1146. .format "const char*" --- `printf` style format.
  1147. .argList "va_list" --- Variable arguments list for format string.
  1148. --- Draw image into internal debug text buffer.
  1149. func.dbgTextImage
  1150. "void"
  1151. .x "uint16_t" --- Position x from the left corner of the window.
  1152. .y "uint16_t" --- Position y from the top corner of the window.
  1153. .width "uint16_t" --- Image width.
  1154. .height "uint16_t" --- Image height.
  1155. .data "const void*" --- Raw image data (character/attribute raw encoding).
  1156. .pitch "uint16_t" --- Image pitch in bytes.
  1157. --- Create static index buffer.
  1158. func.createIndexBuffer
  1159. "IndexBufferHandle"
  1160. .mem "const Memory*" --- Index buffer data.
  1161. .flags "uint16_t" --- Buffer creation flags.
  1162. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1163. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1164. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1165. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1166. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1167. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1168. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1169. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1170. --- buffers.
  1171. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1172. --- index buffers.
  1173. --- Set static index buffer debug name.
  1174. func.setName { cname = "set_index_buffer_name" }
  1175. "void"
  1176. .handle "IndexBufferHandle" --- Static index buffer handle.
  1177. .name "const char*" --- Static index buffer name.
  1178. .len "int32_t" --- Static index buffer name length (if length is INT32_MAX, it's expected
  1179. { default = INT32_MAX } --- that _name is zero terminated string.
  1180. --- Destroy static index buffer.
  1181. func.destroy { cname = "destroy_index_buffer" }
  1182. "void"
  1183. .handle "IndexBufferHandle" --- Static index buffer handle.
  1184. --- Create vertex layout.
  1185. func.createVertexLayout
  1186. "VertexLayoutHandle"
  1187. .layout "const VertexLayout &" --- Vertex layout.
  1188. --- Destroy vertex layout.
  1189. func.destroy { cname = "destroy_vertex_layout" }
  1190. "void"
  1191. .layoutHandle "VertexLayoutHandle" --- Vertex layout handle.
  1192. --- Create static vertex buffer.
  1193. func.createVertexBuffer
  1194. "VertexBufferHandle" --- Static vertex buffer handle.
  1195. .mem "const Memory*" --- Vertex buffer data.
  1196. .layout "const VertexLayout &" --- Vertex layout.
  1197. .flags "uint16_t" --- Buffer creation flags.
  1198. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1199. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1200. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1201. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1202. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1203. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1204. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1205. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
  1206. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
  1207. --- Set static vertex buffer debug name.
  1208. func.setName { cname = "set_vertex_buffer_name" }
  1209. "void"
  1210. .handle "VertexBufferHandle" --- Static vertex buffer handle.
  1211. .name "const char*" --- Static vertex buffer name.
  1212. .len "int32_t" --- Static vertex buffer name length (if length is INT32_MAX, it's expected
  1213. { default = INT32_MAX } --- that _name is zero terminated string.
  1214. --- Destroy static vertex buffer.
  1215. func.destroy { cname = "destroy_vertex_buffer" }
  1216. "void"
  1217. .handle "VertexBufferHandle" --- Static vertex buffer handle.
  1218. --- Create empty dynamic index buffer.
  1219. func.createDynamicIndexBuffer
  1220. "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1221. .num "uint32_t" --- Number of indices.
  1222. .flags "uint16_t" --- Buffer creation flags.
  1223. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1224. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1225. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1226. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1227. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1228. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1229. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1230. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1231. --- buffers.
  1232. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1233. --- index buffers.
  1234. --- Create dynamic index buffer and initialized it.
  1235. func.createDynamicIndexBuffer { cname = "create_dynamic_index_buffer_mem" }
  1236. "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1237. .mem "const Memory*" --- Index buffer data.
  1238. .flags "uint16_t" --- Buffer creation flags.
  1239. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1240. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1241. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1242. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1243. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1244. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1245. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1246. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1247. --- buffers.
  1248. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1249. --- index buffers.
  1250. --- Update dynamic index buffer.
  1251. func.update { cname = "update_dynamic_index_buffer" }
  1252. "void"
  1253. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1254. .startIndex "uint32_t" --- Start index.
  1255. .mem "const Memory*" --- Index buffer data.
  1256. --- Destroy dynamic index buffer.
  1257. func.destroy { cname = "destroy_dynamic_index_buffer" }
  1258. "void"
  1259. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1260. --- Create empty dynamic vertex buffer.
  1261. func.createDynamicVertexBuffer
  1262. "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1263. .num "uint32_t" --- Number of vertices.
  1264. .layout "const VertexLayout&" --- Vertex layout.
  1265. .flags "uint16_t" --- Buffer creation flags.
  1266. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1267. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1268. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1269. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1270. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1271. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1272. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1273. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1274. --- buffers.
  1275. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1276. --- index buffers.
  1277. --- Create dynamic vertex buffer and initialize it.
  1278. func.createDynamicVertexBuffer { cname = "create_dynamic_vertex_buffer_mem" }
  1279. "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1280. .mem "const Memory*" --- Vertex buffer data.
  1281. .layout "const VertexLayout&" --- Vertex layout.
  1282. .flags "uint16_t" --- Buffer creation flags.
  1283. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  1284. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  1285. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  1286. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  1287. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  1288. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  1289. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  1290. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  1291. --- buffers.
  1292. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  1293. --- index buffers.
  1294. --- Update dynamic vertex buffer.
  1295. func.update { cname = "update_dynamic_vertex_buffer" }
  1296. "void"
  1297. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1298. .startVertex "uint32_t" --- Start vertex.
  1299. .mem "const Memory*" --- Vertex buffer data.
  1300. --- Destroy dynamic vertex buffer.
  1301. func.destroy { cname = "destroy_dynamic_vertex_buffer" }
  1302. "void"
  1303. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1304. --- Returns number of requested or maximum available indices.
  1305. func.getAvailTransientIndexBuffer
  1306. "uint32_t" --- Number of requested or maximum available indices.
  1307. .num "uint32_t" --- Number of required indices.
  1308. --- Returns number of requested or maximum available vertices.
  1309. func.getAvailTransientVertexBuffer
  1310. "uint32_t" --- Number of requested or maximum available vertices.
  1311. .num "uint32_t" --- Number of required vertices.
  1312. .layout "const VertexLayout &" --- Vertex layout.
  1313. --- Returns number of requested or maximum available instance buffer slots.
  1314. func.getAvailInstanceDataBuffer
  1315. "uint32_t" --- Number of requested or maximum available instance buffer slots.
  1316. .num "uint32_t" --- Number of required instances.
  1317. .stride "uint16_t" --- Stride per instance.
  1318. --- Allocate transient index buffer.
  1319. ---
  1320. --- @remarks
  1321. --- Only 16-bit index buffer is supported.
  1322. ---
  1323. func.allocTransientIndexBuffer
  1324. "void"
  1325. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid
  1326. --- for the duration of frame, and it can be reused for multiple draw
  1327. --- calls.
  1328. .num "uint32_t" --- Number of indices to allocate.
  1329. .index32 "bool" --- Set to `true` if input indices will be 32-bit.
  1330. { default = false }
  1331. --- Allocate transient vertex buffer.
  1332. func.allocTransientVertexBuffer
  1333. "void"
  1334. .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid
  1335. --- for the duration of frame, and it can be reused for multiple draw
  1336. --- calls.
  1337. .num "uint32_t" --- Number of vertices to allocate.
  1338. .layout "const VertexLayout &" --- Vertex layout.
  1339. --- Check for required space and allocate transient vertex and index
  1340. --- buffers. If both space requirements are satisfied function returns
  1341. --- true.
  1342. ---
  1343. --- @remarks
  1344. --- Only 16-bit index buffer is supported.
  1345. ---
  1346. func.allocTransientBuffers
  1347. "bool"
  1348. .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid
  1349. --- for the duration of frame, and it can be reused for multiple draw
  1350. --- calls.
  1351. .layout "const VertexLayout &" --- Vertex layout.
  1352. .numVertices "uint32_t" --- Number of vertices to allocate.
  1353. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid
  1354. --- for the duration of frame, and it can be reused for multiple draw
  1355. --- calls.
  1356. .numIndices "uint32_t" --- Number of indices to allocate.
  1357. --- Allocate instance data buffer.
  1358. func.allocInstanceDataBuffer
  1359. "void"
  1360. .idb "InstanceDataBuffer*" { out } --- InstanceDataBuffer structure is filled and is valid
  1361. --- for duration of frame, and it can be reused for multiple draw
  1362. --- calls.
  1363. .num "uint32_t" --- Number of instances.
  1364. .stride "uint16_t" --- Instance stride. Must be multiple of 16.
  1365. --- Create draw indirect buffer.
  1366. func.createIndirectBuffer
  1367. "IndirectBufferHandle" --- Indirect buffer handle.
  1368. .num "uint32_t" --- Number of indirect calls.
  1369. --- Destroy draw indirect buffer.
  1370. func.destroy { cname = "destroy_indirect_buffer" }
  1371. "void"
  1372. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  1373. --- Create shader from memory buffer.
  1374. func.createShader
  1375. "ShaderHandle" --- Shader handle.
  1376. .mem "const Memory*" --- Shader binary.
  1377. --- Returns the number of uniforms and uniform handles used inside a shader.
  1378. ---
  1379. --- @remarks
  1380. --- Only non-predefined uniforms are returned.
  1381. ---
  1382. func.getShaderUniforms
  1383. "uint16_t" --- Number of uniforms used by shader.
  1384. .handle "ShaderHandle" --- Shader handle.
  1385. .uniforms "UniformHandle*" { out } --- UniformHandle array where data will be stored.
  1386. { default = NULL }
  1387. .max "uint16_t" --- Maximum capacity of array.
  1388. { default = 0 }
  1389. --- Set shader debug name.
  1390. func.setName { cname = "set_shader_name" }
  1391. "void"
  1392. .handle "ShaderHandle" --- Shader handle.
  1393. .name "const char*" --- Shader name.
  1394. .len "int32_t" --- Shader name length (if length is INT32_MAX, it's expected
  1395. { default = INT32_MAX } --- that _name is zero terminated string).
  1396. --- Destroy shader.
  1397. ---
  1398. --- @remark Once a shader program is created with _handle,
  1399. --- it is safe to destroy that shader.
  1400. ---
  1401. func.destroy { cname = "destroy_shader" }
  1402. "void"
  1403. .handle "ShaderHandle" --- Shader handle.
  1404. --- Create program with vertex and fragment shaders.
  1405. func.createProgram
  1406. "ProgramHandle" --- Program handle if vertex shader output and fragment shader
  1407. --- input are matching, otherwise returns invalid program handle.
  1408. .vsh "ShaderHandle" --- Vertex shader.
  1409. .fsh "ShaderHandle" --- Fragment shader.
  1410. .destroyShaders "bool" --- If true, shaders will be destroyed when program is destroyed.
  1411. { default = false }
  1412. --- Create program with compute shader.
  1413. func.createProgram { cname = "create_compute_program" }
  1414. "ProgramHandle" --- Program handle.
  1415. .csh "ShaderHandle" --- Compute shader.
  1416. .destroyShaders "bool" --- If true, shaders will be destroyed when program is destroyed.
  1417. { default = false }
  1418. --- Destroy program.
  1419. func.destroy { cname = "destroy_program" }
  1420. "void"
  1421. .handle "ProgramHandle" --- Program handle.
  1422. --- Validate texture parameters.
  1423. func.isTextureValid
  1424. "bool" --- True if texture can be successfully created.
  1425. .depth "uint16_t" --- Depth dimension of volume texture.
  1426. .cubeMap "bool" --- Indicates that texture contains cubemap.
  1427. .numLayers "uint16_t" --- Number of layers in texture array.
  1428. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1429. .flags "uint64_t" --- Texture flags. See `BGFX_TEXTURE_*`.
  1430. --- Validate frame buffer parameters.
  1431. func.isFrameBufferValid
  1432. "bool" --- True if frame buffer can be successfully created.
  1433. .num "uint8_t" --- Number of attachments.
  1434. .attachment "const Attachment*" --- Attachment texture info. See: `bgfx::Attachment`.
  1435. --- Calculate amount of memory required for texture.
  1436. func.calcTextureSize
  1437. "void"
  1438. .info "TextureInfo &" { out } --- Resulting texture info structure. See: `TextureInfo`.
  1439. .width "uint16_t" --- Width.
  1440. .height "uint16_t" --- Height.
  1441. .depth "uint16_t" --- Depth dimension of volume texture.
  1442. .cubeMap "bool" --- Indicates that texture contains cubemap.
  1443. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1444. .numLayers "uint16_t" --- Number of layers in texture array.
  1445. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1446. --- Create texture from memory buffer.
  1447. func.createTexture
  1448. "TextureHandle" --- Texture handle.
  1449. .mem "const Memory*" --- DDS, KTX or PVR texture binary data.
  1450. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1451. { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1452. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1453. --- mode.
  1454. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1455. --- sampling.
  1456. .skip "uint8_t" --- Skip top level mips when parsing texture.
  1457. { default = 0 }
  1458. .info "TextureInfo*" { out } --- When non-`NULL` is specified it returns parsed texture information.
  1459. { default = NULL }
  1460. --- Create 2D texture.
  1461. func.createTexture2D
  1462. "TextureHandle" --- Texture handle.
  1463. .width "uint16_t" --- Width.
  1464. .height "uint16_t" --- Height.
  1465. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1466. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1467. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1468. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1469. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1470. { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1471. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1472. --- mode.
  1473. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1474. --- sampling.
  1475. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1476. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1477. --- 1, expected memory layout is texture and all mips together for each array element.
  1478. --- Create texture with size based on backbuffer ratio. Texture will maintain ratio
  1479. --- if back buffer resolution changes.
  1480. func.createTexture2D { cname = "create_texture_2d_scaled" }
  1481. "TextureHandle" --- Texture handle.
  1482. .ratio "BackbufferRatio::Enum" --- Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
  1483. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1484. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1485. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1486. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1487. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1488. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1489. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1490. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1491. --- mode.
  1492. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1493. --- sampling.
  1494. --- Create 3D texture.
  1495. func.createTexture3D
  1496. "TextureHandle" --- Texture handle.
  1497. .width "uint16_t" --- Width.
  1498. .height "uint16_t" --- Height.
  1499. .depth "uint16_t" --- Depth.
  1500. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1501. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1502. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1503. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1504. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1505. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1506. --- mode.
  1507. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1508. --- sampling.
  1509. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1510. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1511. --- 1, expected memory layout is texture and all mips together for each array element.
  1512. --- Create Cube texture.
  1513. func.createTextureCube
  1514. "TextureHandle" --- Texture handle.
  1515. .size "uint16_t" --- Cube side size.
  1516. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1517. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1518. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1519. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1520. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1521. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1522. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1523. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1524. --- mode.
  1525. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1526. --- sampling.
  1527. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1528. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1529. --- 1, expected memory layout is texture and all mips together for each array element.
  1530. --- Update 2D texture.
  1531. ---
  1532. --- @attention It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
  1533. ---
  1534. func.updateTexture2D
  1535. "void"
  1536. .handle "TextureHandle" --- Texture handle.
  1537. .layer "uint16_t" --- Layer in texture array.
  1538. .mip "uint8_t" --- Mip level.
  1539. .x "uint16_t" --- X offset in texture.
  1540. .y "uint16_t" --- Y offset in texture.
  1541. .width "uint16_t" --- Width of texture block.
  1542. .height "uint16_t" --- Height of texture block.
  1543. .mem "const Memory*" --- Texture update data.
  1544. .pitch "uint16_t" --- Pitch of input image (bytes). When _pitch is set to
  1545. --- UINT16_MAX, it will be calculated internally based on _width.
  1546. { default = UINT16_MAX }
  1547. --- Update 3D texture.
  1548. ---
  1549. --- @attention It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
  1550. ---
  1551. func.updateTexture3D
  1552. "void"
  1553. .handle "TextureHandle" --- Texture handle.
  1554. .mip "uint8_t" --- Mip level.
  1555. .x "uint16_t" --- X offset in texture.
  1556. .y "uint16_t" --- Y offset in texture.
  1557. .z "uint16_t" --- Z offset in texture.
  1558. .width "uint16_t" --- Width of texture block.
  1559. .height "uint16_t" --- Height of texture block.
  1560. .depth "uint16_t" --- Depth of texture block.
  1561. .mem "const Memory*" --- Texture update data.
  1562. --- Update Cube texture.
  1563. ---
  1564. --- @attention It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
  1565. ---
  1566. func.updateTextureCube
  1567. "void"
  1568. .handle "TextureHandle" --- Texture handle.
  1569. .layer "uint16_t" --- Layer in texture array.
  1570. .side "uint8_t" --- Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
  1571. --- where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
  1572. ---
  1573. --- +----------+
  1574. --- |-z 2|
  1575. --- | ^ +y |
  1576. --- | | | Unfolded cube:
  1577. --- | +---->+x |
  1578. --- +----------+----------+----------+----------+
  1579. --- |+y 1|+y 4|+y 0|+y 5|
  1580. --- | ^ -x | ^ +z | ^ +x | ^ -z |
  1581. --- | | | | | | | | |
  1582. --- | +---->+z | +---->+x | +---->-z | +---->-x |
  1583. --- +----------+----------+----------+----------+
  1584. --- |+z 3|
  1585. --- | ^ -y |
  1586. --- | | |
  1587. --- | +---->+x |
  1588. --- +----------+
  1589. .mip "uint8_t" --- Mip level.
  1590. .x "uint16_t" --- X offset in texture.
  1591. .y "uint16_t" --- Y offset in texture.
  1592. .width "uint16_t" --- Width of texture block.
  1593. .height "uint16_t" --- Height of texture block.
  1594. .mem "const Memory*" --- Texture update data.
  1595. .pitch "uint16_t" --- Pitch of input image (bytes). When _pitch is set to
  1596. --- UINT16_MAX, it will be calculated internally based on _width.
  1597. { default = UINT16_MAX }
  1598. --- Read back texture content.
  1599. ---
  1600. --- @attention Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
  1601. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
  1602. ---
  1603. func.readTexture
  1604. "uint32_t" --- Frame number when the result will be available. See: `bgfx::frame`.
  1605. .handle "TextureHandle" --- Texture handle.
  1606. .data "void*" --- Destination buffer.
  1607. .mip "uint8_t" --- Mip level.
  1608. { default = 0 }
  1609. --- Set texture debug name.
  1610. func.setName { cname = "set_texture_name" }
  1611. "void"
  1612. .handle "TextureHandle" --- Texture handle.
  1613. .name "const char*" --- Texture name.
  1614. .len "int32_t" --- Texture name length (if length is INT32_MAX, it's expected
  1615. { default = INT32_MAX } --- that _name is zero terminated string.
  1616. --- Returns texture direct access pointer.
  1617. ---
  1618. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
  1619. --- is available on GPUs that have unified memory architecture (UMA) support.
  1620. ---
  1621. func.getDirectAccessPtr
  1622. "void*" --- Pointer to texture memory. If returned pointer is `NULL` direct access
  1623. --- is not available for this texture. If pointer is `UINTPTR_MAX` sentinel value
  1624. --- it means texture is pending creation. Pointer returned can be cached and it
  1625. --- will be valid until texture is destroyed.
  1626. .handle "TextureHandle" --- Texture handle.
  1627. --- Destroy texture.
  1628. func.destroy { cname = "destroy_texture" }
  1629. "void"
  1630. .handle "TextureHandle" --- Texture handle.
  1631. --- Create frame buffer (simple).
  1632. func.createFrameBuffer
  1633. "FrameBufferHandle" --- Frame buffer handle.
  1634. .width "uint16_t" --- Texture width.
  1635. .height "uint16_t" --- Texture height.
  1636. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1637. .textureFlags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1638. { default = "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" }
  1639. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1640. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1641. --- mode.
  1642. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1643. --- sampling.
  1644. --- Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio
  1645. --- if back buffer resolution changes.
  1646. func.createFrameBuffer { cname = "create_frame_buffer_scaled" }
  1647. "FrameBufferHandle" --- Frame buffer handle.
  1648. .ratio "BackbufferRatio::Enum" --- Frame buffer size in respect to back-buffer size. See:
  1649. --- `BackbufferRatio::Enum`.
  1650. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1651. .textureFlags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1652. { default = "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" }
  1653. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1654. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1655. --- mode.
  1656. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1657. --- sampling.
  1658. --- Create MRT frame buffer from texture handles (simple).
  1659. func.createFrameBuffer { cname = "create_frame_buffer_from_handles" }
  1660. "FrameBufferHandle" --- Frame buffer handle.
  1661. .num "uint8_t" --- Number of texture handles.
  1662. .handles "const TextureHandle*" --- Texture attachments.
  1663. .destroyTexture "bool" --- If true, textures will be destroyed when
  1664. { default = false } --- frame buffer is destroyed.
  1665. --- Create MRT frame buffer from texture handles with specific layer and
  1666. --- mip level.
  1667. func.createFrameBuffer { cname = "create_frame_buffer_from_attachment" }
  1668. "FrameBufferHandle" --- Frame buffer handle.
  1669. .num "uint8_t" --- Number of attachments.
  1670. .attachment "const Attachment*" --- Attachment texture info. See: `bgfx::Attachment`.
  1671. .destroyTexture "bool" --- If true, textures will be destroyed when
  1672. { default = false } --- frame buffer is destroyed.
  1673. --- Create frame buffer for multiple window rendering.
  1674. ---
  1675. --- @remarks
  1676. --- Frame buffer cannot be used for sampling.
  1677. ---
  1678. --- @attention Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
  1679. ---
  1680. func.createFrameBuffer { cname = "create_frame_buffer_from_nwh" }
  1681. "FrameBufferHandle" --- Frame buffer handle.
  1682. .nwh "void*" --- OS' target native window handle.
  1683. .width "uint16_t" --- Window back buffer width.
  1684. .height "uint16_t" --- Window back buffer height.
  1685. .format "TextureFormat::Enum" --- Window back buffer color format.
  1686. { default = "TextureFormat::Count" }
  1687. .depthFormat "TextureFormat::Enum" --- Window back buffer depth format.
  1688. { default = "TextureFormat::Count" }
  1689. --- Set frame buffer debug name.
  1690. func.setName { cname = "set_frame_buffer_name" }
  1691. "void"
  1692. .handle "FrameBufferHandle" --- Frame buffer handle.
  1693. .name "const char*" --- Frame buffer name.
  1694. .len "int32_t" --- Frame buffer name length (if length is INT32_MAX, it's expected
  1695. { default = INT32_MAX } --- that _name is zero terminated string.
  1696. --- Obtain texture handle of frame buffer attachment.
  1697. func.getTexture
  1698. "TextureHandle"
  1699. .handle "FrameBufferHandle" --- Frame buffer handle.
  1700. .attachment "uint8_t"
  1701. { default = 0 }
  1702. --- Destroy frame buffer.
  1703. func.destroy { cname = "destroy_frame_buffer" }
  1704. "void"
  1705. .handle "FrameBufferHandle" --- Frame buffer handle.
  1706. --- Create shader uniform parameter.
  1707. ---
  1708. --- @remarks
  1709. --- 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
  1710. --- multiple times with the same uniform name. The library will always
  1711. --- return the same handle, but the handle reference count will be
  1712. --- incremented. This means that the same number of `bgfx::destroyUniform`
  1713. --- must be called to properly destroy the uniform.
  1714. ---
  1715. --- 2. Predefined uniforms (declared in `bgfx_shader.sh`):
  1716. --- - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
  1717. --- view, in pixels.
  1718. --- - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
  1719. --- width and height
  1720. --- - `u_view mat4` - view matrix
  1721. --- - `u_invView mat4` - inverted view matrix
  1722. --- - `u_proj mat4` - projection matrix
  1723. --- - `u_invProj mat4` - inverted projection matrix
  1724. --- - `u_viewProj mat4` - concatenated view projection matrix
  1725. --- - `u_invViewProj mat4` - concatenated inverted view projection matrix
  1726. --- - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
  1727. --- - `u_modelView mat4` - concatenated model view matrix, only first
  1728. --- model matrix from array is used.
  1729. --- - `u_modelViewProj mat4` - concatenated model view projection matrix.
  1730. --- - `u_alphaRef float` - alpha reference value for alpha test.
  1731. ---
  1732. func.createUniform
  1733. "UniformHandle" --- Handle to uniform object.
  1734. .name "const char*" --- Uniform name in shader.
  1735. .type "UniformType::Enum" --- Type of uniform (See: `bgfx::UniformType`).
  1736. .num "uint16_t" --- Number of elements in array.
  1737. { default = 1 }
  1738. --- Retrieve uniform info.
  1739. func.getUniformInfo
  1740. "void"
  1741. .handle "UniformHandle" --- Handle to uniform object.
  1742. .info "UniformInfo &" { out } --- Uniform info.
  1743. --- Destroy shader uniform parameter.
  1744. func.destroy { cname = "destroy_uniform" }
  1745. "void"
  1746. .handle "UniformHandle" --- Handle to uniform object.
  1747. --- Create occlusion query.
  1748. func.createOcclusionQuery
  1749. "OcclusionQueryHandle" --- Handle to occlusion query object.
  1750. --- Retrieve occlusion query result from previous frame.
  1751. func.getResult
  1752. "OcclusionQueryResult::Enum" --- Occlusion query result.
  1753. .handle "OcclusionQueryHandle" --- Handle to occlusion query object.
  1754. .result "int32_t*" { out } --- Number of pixels that passed test. This argument
  1755. --- can be `NULL` if result of occlusion query is not needed.
  1756. { default = NULL }
  1757. --- Destroy occlusion query.
  1758. func.destroy { cname = "destroy_occlusion_query" }
  1759. "void"
  1760. .handle "OcclusionQueryHandle" --- Handle to occlusion query object.
  1761. --- Set palette color value.
  1762. func.setPaletteColor
  1763. "void"
  1764. .index "uint8_t" --- Index into palette.
  1765. .rgba "const float[4]" --- RGBA floating point values.
  1766. --- Set palette color value.
  1767. func.setPaletteColor { cname = "set_palette_color_rgba8" }
  1768. "void"
  1769. .index "uint8_t" --- Index into palette.
  1770. .rgba "uint32_t" --- Packed 32-bit RGBA value.
  1771. --- Set view name.
  1772. ---
  1773. --- @remarks
  1774. --- This is debug only feature.
  1775. ---
  1776. --- In graphics debugger view name will appear as:
  1777. ---
  1778. --- "nnnc <view name>"
  1779. --- ^ ^ ^
  1780. --- | +--- compute (C)
  1781. --- +------ view id
  1782. ---
  1783. func.setViewName
  1784. "void"
  1785. .id "ViewId" --- View id.
  1786. .name "const char*" --- View name.
  1787. --- Set view rectangle. Draw primitive outside view will be clipped.
  1788. func.setViewRect
  1789. "void"
  1790. .id "ViewId" --- View id.
  1791. .x "uint16_t" --- Position x from the left corner of the window.
  1792. .y "uint16_t" --- Position y from the top corner of the window.
  1793. .width "uint16_t" --- Width of view port region.
  1794. .height "uint16_t" --- Height of view port region.
  1795. --- Set view rectangle. Draw primitive outside view will be clipped.
  1796. func.setViewRect { cname = "set_view_rect_ratio" }
  1797. "void"
  1798. .id "ViewId" --- View id.
  1799. .x "uint16_t" --- Position x from the left corner of the window.
  1800. .y "uint16_t" --- Position y from the top corner of the window.
  1801. .ratio "BackbufferRatio::Enum" --- Width and height will be set in respect to back-buffer size.
  1802. --- See: `BackbufferRatio::Enum`.
  1803. --- Set view scissor. Draw primitive outside view will be clipped. When
  1804. --- _x, _y, _width and _height are set to 0, scissor will be disabled.
  1805. func.setViewScissor
  1806. "void"
  1807. .id "ViewId" --- View id.
  1808. .x "uint16_t" --- Position x from the left corner of the window.
  1809. { default = 0 }
  1810. .y "uint16_t" --- Position y from the top corner of the window.
  1811. { default = 0 }
  1812. .width "uint16_t" --- Width of view scissor region.
  1813. { default = 0 }
  1814. .height "uint16_t" --- Height of view scissor region.
  1815. { default = 0 }
  1816. --- Set view clear flags.
  1817. func.setViewClear
  1818. "void"
  1819. .id "ViewId" --- View id.
  1820. .flags "uint16_t" --- Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1821. --- operation. See: `BGFX_CLEAR_*`.
  1822. .rgba "uint32_t" --- Color clear value.
  1823. { default = "0x000000ff" }
  1824. .depth "float" --- Depth clear value.
  1825. { default = "1.0f" }
  1826. .stencil "uint8_t" --- Stencil clear value.
  1827. { default = 0 }
  1828. --- Set view clear flags with different clear color for each
  1829. --- frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color
  1830. --- palette.
  1831. func.setViewClear { cname = "set_view_clear_mrt" }
  1832. "void"
  1833. .id "ViewId" --- View id.
  1834. .flags "uint16_t" --- Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1835. --- operation. See: `BGFX_CLEAR_*`.
  1836. .depth "float" --- Depth clear value.
  1837. .stencil "uint8_t" --- Stencil clear value.
  1838. .c0 "uint8_t" --- Palette index for frame buffer attachment 0.
  1839. { default = UINT8_MAX }
  1840. .c1 "uint8_t" --- Palette index for frame buffer attachment 1.
  1841. { default = UINT8_MAX }
  1842. .c2 "uint8_t" --- Palette index for frame buffer attachment 2.
  1843. { default = UINT8_MAX }
  1844. .c3 "uint8_t" --- Palette index for frame buffer attachment 3.
  1845. { default = UINT8_MAX }
  1846. .c4 "uint8_t" --- Palette index for frame buffer attachment 4.
  1847. { default = UINT8_MAX }
  1848. .c5 "uint8_t" --- Palette index for frame buffer attachment 5.
  1849. { default = UINT8_MAX }
  1850. .c6 "uint8_t" --- Palette index for frame buffer attachment 6.
  1851. { default = UINT8_MAX }
  1852. .c7 "uint8_t" --- Palette index for frame buffer attachment 7.
  1853. { default = UINT8_MAX }
  1854. --- Set view sorting mode.
  1855. ---
  1856. --- @remarks
  1857. --- View mode must be set prior calling `bgfx::submit` for the view.
  1858. ---
  1859. func.setViewMode
  1860. "void"
  1861. .id "ViewId" --- View id.
  1862. .mode "ViewMode::Enum" --- View sort mode. See `ViewMode::Enum`.
  1863. { default = "ViewMode::Default" }
  1864. --- Set view frame buffer.
  1865. ---
  1866. --- @remarks
  1867. --- Not persistent after `bgfx::reset` call.
  1868. ---
  1869. func.setViewFrameBuffer
  1870. "void"
  1871. .id "ViewId" --- View id.
  1872. .handle "FrameBufferHandle" --- Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
  1873. --- frame buffer handle will draw primitives from this view into
  1874. --- default back buffer.
  1875. --- Set view view and projection matrices, all draw primitives in this
  1876. --- view will use these matrices.
  1877. func.setViewTransform
  1878. "void"
  1879. .id "ViewId" --- View id.
  1880. .view "const void*" --- View matrix.
  1881. .proj "const void*" --- Projection matrix.
  1882. --- Post submit view reordering.
  1883. func.setViewOrder
  1884. "void"
  1885. .id "ViewId" --- First view id.
  1886. { default = 0 }
  1887. .num "uint16_t" --- Number of views to remap.
  1888. { default = UINT16_MAX }
  1889. .order "const ViewId*" --- View remap id table. Passing `NULL` will reset view ids
  1890. --- to default state.
  1891. { default = NULL }
  1892. --- Reset all view settings to default.
  1893. func.resetView
  1894. "void"
  1895. .id "ViewId" -- _id View id.
  1896. --- Begin submitting draw calls from thread.
  1897. func.begin { cname = "encoder_begin" }
  1898. "Encoder*" --- Encoder.
  1899. .forThread "bool" --- Explicitly request an encoder for a worker thread.
  1900. --- End submitting draw calls from thread.
  1901. func["end"] { cname = "encoder_end" }
  1902. "void"
  1903. .encoder "Encoder*" --- Encoder.
  1904. --- Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1905. --- graphics debugging tools.
  1906. func.Encoder.setMarker
  1907. "void"
  1908. .marker "const char*" --- Marker string.
  1909. --- Set render states for draw primitive.
  1910. ---
  1911. --- @remarks
  1912. --- 1. To setup more complex states use:
  1913. --- `BGFX_STATE_ALPHA_REF(_ref)`,
  1914. --- `BGFX_STATE_POINT_SIZE(_size)`,
  1915. --- `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1916. --- `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1917. --- `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1918. --- `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1919. --- 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1920. --- equation is specified.
  1921. ---
  1922. func.Encoder.setState
  1923. "void"
  1924. .state "uint64_t" --- State flags. Default state for primitive type is
  1925. --- triangles. See: `BGFX_STATE_DEFAULT`.
  1926. --- - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  1927. --- - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  1928. --- - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  1929. --- - `BGFX_STATE_CULL_*` - Backface culling mode.
  1930. --- - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  1931. --- - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  1932. --- - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  1933. .rgba "uint32_t" --- Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  1934. --- `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  1935. { default = 0 }
  1936. --- Set condition for rendering.
  1937. func.Encoder.setCondition
  1938. "void"
  1939. .handle "OcclusionQueryHandle" --- Occlusion query handle.
  1940. .visible "bool" --- Render if occlusion query is visible.
  1941. --- Set stencil test state.
  1942. func.Encoder.setStencil
  1943. "void"
  1944. .fstencil "uint32_t" --- Front stencil state.
  1945. .bstencil "uint32_t" --- Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  1946. --- _fstencil is applied to both front and back facing primitives.
  1947. { default = "BGFX_STENCIL_NONE" }
  1948. --- Set scissor for draw primitive.
  1949. ---
  1950. --- @remark
  1951. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  1952. ---
  1953. func.Encoder.setScissor
  1954. "uint16_t" --- Scissor cache index.
  1955. .x "uint16_t" --- Position x from the left corner of the window.
  1956. .y "uint16_t" --- Position y from the top corner of the window.
  1957. .width "uint16_t" --- Width of view scissor region.
  1958. .height "uint16_t" --- Height of view scissor region.
  1959. --- Set scissor from cache for draw primitive.
  1960. ---
  1961. --- @remark
  1962. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  1963. ---
  1964. func.Encoder.setScissor { cname = "set_scissor_cached" }
  1965. "void"
  1966. .cache "uint16_t" --- Index in scissor cache.
  1967. { default = UINT16_MAX }
  1968. --- Set model matrix for draw primitive. If it is not called,
  1969. --- the model will be rendered with an identity model matrix.
  1970. func.Encoder.setTransform
  1971. "uint32_t" --- Index into matrix cache in case the same model matrix has
  1972. --- to be used for other draw primitive call.
  1973. .mtx "const void*" --- Pointer to first matrix in array.
  1974. .num "uint16_t" --- Number of matrices in array.
  1975. --- Set model matrix from matrix cache for draw primitive.
  1976. func.Encoder.setTransform { cname = "set_transform_cached" }
  1977. "void"
  1978. .cache "uint32_t" --- Index in matrix cache.
  1979. .num "uint16_t" --- Number of matrices from cache.
  1980. { default = 1 }
  1981. --- Reserve matrices in internal matrix cache.
  1982. ---
  1983. --- @attention Pointer returned can be modifed until `bgfx::frame` is called.
  1984. ---
  1985. func.Encoder.allocTransform
  1986. "uint32_t" --- Index in matrix cache.
  1987. .transform "Transform*" { out } --- Pointer to `Transform` structure.
  1988. .num "uint16_t" --- Number of matrices.
  1989. --- Set shader uniform parameter for draw primitive.
  1990. func.Encoder.setUniform
  1991. "void"
  1992. .handle "UniformHandle" --- Uniform.
  1993. .value "const void*" --- Pointer to uniform data.
  1994. .num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
  1995. --- use the _num passed on uniform creation.
  1996. { default = 1 }
  1997. --- Set index buffer for draw primitive.
  1998. func.Encoder.setIndexBuffer { cpponly }
  1999. "void"
  2000. .handle "IndexBufferHandle" --- Index buffer.
  2001. --- Set index buffer for draw primitive.
  2002. func.Encoder.setIndexBuffer
  2003. "void"
  2004. .handle "IndexBufferHandle" --- Index buffer.
  2005. .firstIndex "uint32_t" --- First index to render.
  2006. .numIndices "uint32_t" --- Number of indices to render.
  2007. --- Set index buffer for draw primitive.
  2008. func.Encoder.setIndexBuffer { cpponly }
  2009. "void"
  2010. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2011. --- Set index buffer for draw primitive.
  2012. func.Encoder.setIndexBuffer { cname = "set_dynamic_index_buffer" }
  2013. "void"
  2014. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2015. .firstIndex "uint32_t" --- First index to render.
  2016. .numIndices "uint32_t" --- Number of indices to render.
  2017. --- Set index buffer for draw primitive.
  2018. func.Encoder.setIndexBuffer { cpponly }
  2019. "void"
  2020. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2021. --- Set index buffer for draw primitive.
  2022. func.Encoder.setIndexBuffer { cname = "set_transient_index_buffer" }
  2023. "void"
  2024. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2025. .firstIndex "uint32_t" --- First index to render.
  2026. .numIndices "uint32_t" --- Number of indices to render.
  2027. --- Set vertex buffer for draw primitive.
  2028. func.Encoder.setVertexBuffer { cpponly }
  2029. "void"
  2030. .stream "uint8_t" --- Vertex stream.
  2031. .handle "VertexBufferHandle" --- Vertex buffer.
  2032. --- Set vertex buffer for draw primitive.
  2033. func.Encoder.setVertexBuffer { conly }
  2034. "void"
  2035. .stream "uint8_t" --- Vertex stream.
  2036. .handle "VertexBufferHandle" --- Vertex buffer.
  2037. .startVertex "uint32_t" --- First vertex to render.
  2038. .numVertices "uint32_t" --- Number of vertices to render.
  2039. --- Set vertex buffer for draw primitive.
  2040. func.Encoder.setVertexBuffer { cname = "set_vertex_buffer_with_layout" }
  2041. "void"
  2042. .stream "uint8_t" --- Vertex stream.
  2043. .handle "VertexBufferHandle" --- Vertex buffer.
  2044. .startVertex "uint32_t" --- First vertex to render.
  2045. .numVertices "uint32_t" --- Number of vertices to render.
  2046. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2047. --- handle is used, vertex layout used for creation
  2048. --- of vertex buffer will be used.
  2049. { default = "BGFX_INVALID_HANDLE" }
  2050. --- Set vertex buffer for draw primitive.
  2051. func.Encoder.setVertexBuffer { cpponly }
  2052. "void"
  2053. .stream "uint8_t" --- Vertex stream.
  2054. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2055. --- Set vertex buffer for draw primitive.
  2056. func.Encoder.setVertexBuffer { conly, cname = "set_dynamic_vertex_buffer" }
  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. func.Encoder.setVertexBuffer { cname = "set_dynamic_vertex_buffer_with_layout" }
  2063. "void"
  2064. .stream "uint8_t" --- Vertex stream.
  2065. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2066. .startVertex "uint32_t" --- First vertex to render.
  2067. .numVertices "uint32_t" --- Number of vertices to render.
  2068. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2069. --- handle is used, vertex layout used for creation
  2070. --- of vertex buffer will be used.
  2071. { default = "BGFX_INVALID_HANDLE" }
  2072. --- Set vertex buffer for draw primitive.
  2073. func.Encoder.setVertexBuffer { cpponly }
  2074. "void"
  2075. .stream "uint8_t" --- Vertex stream.
  2076. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2077. --- Set vertex buffer for draw primitive.
  2078. func.Encoder.setVertexBuffer { conly, cname = "set_transient_vertex_buffer" }
  2079. "void"
  2080. .stream "uint8_t" --- Vertex stream.
  2081. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2082. .startVertex "uint32_t" --- First vertex to render.
  2083. .numVertices "uint32_t" --- Number of vertices to render.
  2084. --- Set vertex buffer for draw primitive.
  2085. func.Encoder.setVertexBuffer { cname = "set_transient_vertex_buffer_with_layout" }
  2086. "void"
  2087. .stream "uint8_t" --- Vertex stream.
  2088. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2089. .startVertex "uint32_t" --- First vertex to render.
  2090. .numVertices "uint32_t" --- Number of vertices to render.
  2091. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2092. --- handle is used, vertex layout used for creation
  2093. --- of vertex buffer will be used.
  2094. { default = "BGFX_INVALID_HANDLE" }
  2095. --- Set number of vertices for auto generated vertices use in conjuction
  2096. --- with gl_VertexID.
  2097. ---
  2098. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2099. ---
  2100. func.Encoder.setVertexCount
  2101. "void"
  2102. .numVertices "uint32_t" --- Number of vertices.
  2103. --- Set instance data buffer for draw primitive.
  2104. func.Encoder.setInstanceDataBuffer { cpponly }
  2105. "void"
  2106. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2107. --- Set instance data buffer for draw primitive.
  2108. func.Encoder.setInstanceDataBuffer
  2109. "void"
  2110. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2111. .start "uint32_t" --- First instance data.
  2112. .num "uint32_t" --- Number of data instances.
  2113. --- Set instance data buffer for draw primitive.
  2114. func.Encoder.setInstanceDataBuffer { cpponly }
  2115. "void"
  2116. .handle "VertexBufferHandle" --- Vertex buffer.
  2117. --- Set instance data buffer for draw primitive.
  2118. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" }
  2119. "void"
  2120. .handle "VertexBufferHandle" --- Vertex buffer.
  2121. .startVertex "uint32_t" --- First instance data.
  2122. .num "uint32_t" --- Number of data instances.
  2123. --- Set instance data buffer for draw primitive.
  2124. func.Encoder.setInstanceDataBuffer { cpponly }
  2125. "void"
  2126. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2127. --- Set instance data buffer for draw primitive.
  2128. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" }
  2129. "void"
  2130. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2131. .startVertex "uint32_t" --- First instance data.
  2132. .num "uint32_t" --- Number of data instances.
  2133. --- Set number of instances for auto generated instances use in conjuction
  2134. --- with gl_InstanceID.
  2135. ---
  2136. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2137. ---
  2138. func.Encoder.setInstanceCount
  2139. "void"
  2140. .numInstances "uint32_t" -- Number of instances.
  2141. --- Set texture stage for draw primitive.
  2142. func.Encoder.setTexture
  2143. "void"
  2144. .stage "uint8_t" --- Texture unit.
  2145. .sampler "UniformHandle" --- Program sampler.
  2146. .handle "TextureHandle" --- Texture handle.
  2147. .flags "uint32_t" --- Texture sampling mode. Default value UINT32_MAX uses
  2148. { default = UINT32_MAX } --- texture sampling settings from the texture.
  2149. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2150. --- mode.
  2151. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2152. --- sampling.
  2153. --- Submit an empty primitive for rendering. Uniforms and draw state
  2154. --- will be applied but no geometry will be submitted. Useful in cases
  2155. --- when no other draw/compute primitive is submitted to view, but it's
  2156. --- desired to execute clear view.
  2157. ---
  2158. --- @remark
  2159. --- These empty draw calls will sort before ordinary draw calls.
  2160. ---
  2161. func.Encoder.touch
  2162. "void"
  2163. .id "ViewId" --- View id.
  2164. --- Submit primitive for rendering.
  2165. func.Encoder.submit
  2166. "void"
  2167. .id "ViewId" --- View id.
  2168. .program "ProgramHandle" --- Program.
  2169. .depth "uint32_t" --- Depth for sorting.
  2170. { default = 0 }
  2171. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2172. { default = "BGFX_DISCARD_ALL" }
  2173. --- Submit primitive with occlusion query for rendering.
  2174. func.Encoder.submit { cname = "submit_occlusion_query" }
  2175. "void"
  2176. .id "ViewId" --- View id.
  2177. .program "ProgramHandle" --- Program.
  2178. .occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
  2179. .depth "uint32_t" --- Depth for sorting.
  2180. { default = 0 }
  2181. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2182. { default = "BGFX_DISCARD_ALL" }
  2183. --- Submit primitive for rendering with index and instance data info from
  2184. --- indirect buffer.
  2185. func.Encoder.submit { cname = "submit_indirect" }
  2186. "void"
  2187. .id "ViewId" --- View id.
  2188. .program "ProgramHandle" --- Program.
  2189. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2190. .start "uint16_t" --- First element in indirect buffer.
  2191. { default = 0 }
  2192. .num "uint16_t" --- Number of dispatches.
  2193. { default = 1 }
  2194. .depth "uint32_t" --- Depth for sorting.
  2195. { default = 0 }
  2196. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2197. { default = "BGFX_DISCARD_ALL" }
  2198. --- Set compute index buffer.
  2199. func.Encoder.setBuffer { cname = "set_compute_index_buffer" }
  2200. "void"
  2201. .stage "uint8_t" --- Compute stage.
  2202. .handle "IndexBufferHandle" --- Index buffer handle.
  2203. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2204. --- Set compute vertex buffer.
  2205. func.Encoder.setBuffer { cname = "set_compute_vertex_buffer" }
  2206. "void"
  2207. .stage "uint8_t" --- Compute stage.
  2208. .handle "VertexBufferHandle" --- Vertex buffer handle.
  2209. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2210. --- Set compute dynamic index buffer.
  2211. func.Encoder.setBuffer { cname = "set_compute_dynamic_index_buffer" }
  2212. "void"
  2213. .stage "uint8_t" --- Compute stage.
  2214. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  2215. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2216. --- Set compute dynamic vertex buffer.
  2217. func.Encoder.setBuffer { cname = "set_compute_dynamic_vertex_buffer" }
  2218. "void"
  2219. .stage "uint8_t" --- Compute stage.
  2220. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  2221. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2222. --- Set compute indirect buffer.
  2223. func.Encoder.setBuffer { cname = "set_compute_indirect_buffer" }
  2224. "void"
  2225. .stage "uint8_t" --- Compute stage.
  2226. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  2227. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2228. --- Set compute image from texture.
  2229. func.Encoder.setImage
  2230. "void"
  2231. .stage "uint8_t" --- Compute stage.
  2232. .handle "TextureHandle" --- Texture handle.
  2233. .mip "uint8_t" --- Mip level.
  2234. .access "Access::Enum" --- Image access. See `Access::Enum`.
  2235. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2236. { default = "TextureFormat::Count" }
  2237. --- Dispatch compute.
  2238. func.Encoder.dispatch
  2239. "void"
  2240. .id "ViewId" --- View id.
  2241. .program "ProgramHandle" --- Compute program.
  2242. .numX "uint32_t" --- Number of groups X.
  2243. { default = 1 }
  2244. .numY "uint32_t" --- Number of groups Y.
  2245. { default = 1 }
  2246. .numZ "uint32_t" --- Number of groups Z.
  2247. { default = 1 }
  2248. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2249. { default = "BGFX_DISCARD_ALL" }
  2250. --- Dispatch compute indirect.
  2251. func.Encoder.dispatch { cname = "dispatch_indirect" }
  2252. "void"
  2253. .id "ViewId" --- View id.
  2254. .program "ProgramHandle" --- Compute program.
  2255. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2256. .start "uint16_t" --- First element in indirect buffer.
  2257. { default = 0 }
  2258. .num "uint16_t" --- Number of dispatches.
  2259. { default = 1 }
  2260. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2261. { default = "BGFX_DISCARD_ALL" }
  2262. --- Discard previously set state for draw or compute call.
  2263. func.Encoder.discard
  2264. "void"
  2265. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2266. { default = "BGFX_DISCARD_ALL" }
  2267. --- Blit 2D texture region between two 2D textures.
  2268. ---
  2269. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2270. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2271. ---
  2272. func.Encoder.blit { cpponly }
  2273. "void"
  2274. .id "ViewId" --- View id.
  2275. .dst "TextureHandle" --- Destination texture handle.
  2276. .dstX "uint16_t" --- Destination texture X position.
  2277. .dstY "uint16_t" --- Destination texture Y position.
  2278. .src "TextureHandle" --- Source texture handle.
  2279. .srcX "uint16_t" --- Source texture X position.
  2280. { default = 0 }
  2281. .srcY "uint16_t" --- Source texture Y position.
  2282. { default = 0 }
  2283. .width "uint16_t" --- Width of region.
  2284. { default = UINT16_MAX }
  2285. .height "uint16_t" --- Height of region.
  2286. { default = UINT16_MAX }
  2287. --- Blit 2D texture region between two 2D textures.
  2288. ---
  2289. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2290. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2291. ---
  2292. func.Encoder.blit
  2293. "void"
  2294. .id "ViewId" --- View id.
  2295. .dst "TextureHandle" --- Destination texture handle.
  2296. .dstMip "uint8_t" --- Destination texture mip level.
  2297. .dstX "uint16_t" --- Destination texture X position.
  2298. .dstY "uint16_t" --- Destination texture Y position.
  2299. .dstZ "uint16_t" --- If texture is 2D this argument should be 0. If destination texture is cube
  2300. --- this argument represents destination texture cube face. For 3D texture this argument
  2301. --- represents destination texture Z position.
  2302. .src "TextureHandle" --- Source texture handle.
  2303. .srcMip "uint8_t" --- Source texture mip level.
  2304. { default = 0 }
  2305. .srcX "uint16_t" --- Source texture X position.
  2306. { default = 0 }
  2307. .srcY "uint16_t" --- Source texture Y position.
  2308. { default = 0 }
  2309. .srcZ "uint16_t" --- If texture is 2D this argument should be 0. If source texture is cube
  2310. --- this argument represents source texture cube face. For 3D texture this argument
  2311. --- represents source texture Z position.
  2312. { default = 0 }
  2313. .width "uint16_t" --- Width of region.
  2314. { default = UINT16_MAX }
  2315. .height "uint16_t" --- Height of region.
  2316. { default = UINT16_MAX }
  2317. .depth "uint16_t" --- If texture is 3D this argument represents depth of region, otherwise it's
  2318. --- unused.
  2319. { default = UINT16_MAX }
  2320. --- Request screen shot of window back buffer.
  2321. ---
  2322. --- @remarks
  2323. --- `bgfx::CallbackI::screenShot` must be implemented.
  2324. --- @attention Frame buffer handle must be created with OS' target native window handle.
  2325. ---
  2326. func.requestScreenShot
  2327. "void"
  2328. .handle "FrameBufferHandle" --- Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  2329. --- made for main window back buffer.
  2330. .filePath "const char*" --- Will be passed to `bgfx::CallbackI::screenShot` callback.
  2331. --- Render frame.
  2332. ---
  2333. --- @attention `bgfx::renderFrame` is blocking call. It waits for
  2334. --- `bgfx::frame` to be called from API thread to process frame.
  2335. --- If timeout value is passed call will timeout and return even
  2336. --- if `bgfx::frame` is not called.
  2337. ---
  2338. --- @warning This call should be only used on platforms that don't
  2339. --- allow creating separate rendering thread. If it is called before
  2340. --- to bgfx::init, render thread won't be created by bgfx::init call.
  2341. ---
  2342. func.renderFrame
  2343. "RenderFrame::Enum" --- Current renderer context state. See: `bgfx::RenderFrame`.
  2344. .msecs "int32_t" --- Timeout in milliseconds.
  2345. { default = -1 }
  2346. --- Set platform data.
  2347. ---
  2348. --- @warning Must be called before `bgfx::init`.
  2349. ---
  2350. func.setPlatformData
  2351. "void"
  2352. .data "const PlatformData &" --- Platform data.
  2353. --- Get internal data for interop.
  2354. ---
  2355. --- @attention It's expected you understand some bgfx internals before you
  2356. --- use this call.
  2357. ---
  2358. --- @warning Must be called only on render thread.
  2359. ---
  2360. func.getInternalData
  2361. "const InternalData*" --- Internal data.
  2362. --- Override internal texture with externally created texture. Previously
  2363. --- created internal texture will released.
  2364. ---
  2365. --- @attention It's expected you understand some bgfx internals before you
  2366. --- use this call.
  2367. ---
  2368. --- @warning Must be called only on render thread.
  2369. ---
  2370. func.overrideInternal { cname = "override_internal_texture_ptr" }
  2371. "uintptr_t" --- Native API pointer to texture. If result is 0, texture is not created
  2372. --- yet from the main thread.
  2373. .handle "TextureHandle" --- Texture handle.
  2374. .ptr "uintptr_t" --- Native API pointer to texture.
  2375. --- Override internal texture by creating new texture. Previously created
  2376. --- internal texture will released.
  2377. ---
  2378. --- @attention It's expected you understand some bgfx internals before you
  2379. --- use this call.
  2380. ---
  2381. --- @returns Native API pointer to texture. If result is 0, texture is not created yet from the
  2382. --- main thread.
  2383. ---
  2384. --- @warning Must be called only on render thread.
  2385. ---
  2386. func.overrideInternal { cname = "override_internal_texture" }
  2387. "uintptr_t" --- Native API pointer to texture. If result is 0, texture is not created
  2388. --- yet from the main thread.
  2389. .handle "TextureHandle" --- Texture handle.
  2390. .width "uint16_t" --- Width.
  2391. .height "uint16_t" --- Height.
  2392. .numMips "uint8_t" --- Number of mip-maps.
  2393. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2394. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2395. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2396. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2397. --- mode.
  2398. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2399. --- sampling.
  2400. -- Legacy API:
  2401. --- Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  2402. --- graphics debugging tools.
  2403. func.setMarker
  2404. "void"
  2405. .marker "const char*" --- Marker string.
  2406. --- Set render states for draw primitive.
  2407. ---
  2408. --- @remarks
  2409. --- 1. To setup more complex states use:
  2410. --- `BGFX_STATE_ALPHA_REF(_ref)`,
  2411. --- `BGFX_STATE_POINT_SIZE(_size)`,
  2412. --- `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  2413. --- `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  2414. --- `BGFX_STATE_BLEND_EQUATION(_equation)`,
  2415. --- `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  2416. --- 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  2417. --- equation is specified.
  2418. ---
  2419. func.setState
  2420. "void"
  2421. .state "uint64_t" --- State flags. Default state for primitive type is
  2422. --- triangles. See: `BGFX_STATE_DEFAULT`.
  2423. --- - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  2424. --- - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  2425. --- - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  2426. --- - `BGFX_STATE_CULL_*` - Backface culling mode.
  2427. --- - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  2428. --- - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  2429. --- - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  2430. .rgba "uint32_t" --- Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  2431. --- `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  2432. { default = 0 }
  2433. --- Set condition for rendering.
  2434. func.setCondition
  2435. "void"
  2436. .handle "OcclusionQueryHandle" --- Occlusion query handle.
  2437. .visible "bool" --- Render if occlusion query is visible.
  2438. --- Set stencil test state.
  2439. func.setStencil
  2440. "void"
  2441. .fstencil "uint32_t" --- Front stencil state.
  2442. .bstencil "uint32_t" --- Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  2443. --- _fstencil is applied to both front and back facing primitives.
  2444. { default = "BGFX_STENCIL_NONE" }
  2445. --- Set scissor for draw primitive.
  2446. ---
  2447. --- @remark
  2448. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  2449. ---
  2450. func.setScissor
  2451. "uint16_t" --- Scissor cache index.
  2452. .x "uint16_t" --- Position x from the left corner of the window.
  2453. .y "uint16_t" --- Position y from the top corner of the window.
  2454. .width "uint16_t" --- Width of view scissor region.
  2455. .height "uint16_t" --- Height of view scissor region.
  2456. --- Set scissor from cache for draw primitive.
  2457. ---
  2458. --- @remark
  2459. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  2460. ---
  2461. func.setScissor { cname = "set_scissor_cached" }
  2462. "void"
  2463. .cache "uint16_t" --- Index in scissor cache.
  2464. { default = UINT16_MAX }
  2465. --- Set model matrix for draw primitive. If it is not called,
  2466. --- the model will be rendered with an identity model matrix.
  2467. func.setTransform
  2468. "uint32_t" --- Index into matrix cache in case the same model matrix has
  2469. --- to be used for other draw primitive call.
  2470. .mtx "const void*" --- Pointer to first matrix in array.
  2471. .num "uint16_t" --- Number of matrices in array.
  2472. --- Set model matrix from matrix cache for draw primitive.
  2473. func.setTransform { cname = "set_transform_cached" }
  2474. "void"
  2475. .cache "uint32_t" --- Index in matrix cache.
  2476. .num "uint16_t" --- Number of matrices from cache.
  2477. { default = 1 }
  2478. --- Reserve matrices in internal matrix cache.
  2479. ---
  2480. --- @attention Pointer returned can be modifed until `bgfx::frame` is called.
  2481. ---
  2482. func.allocTransform
  2483. "uint32_t" --- Index in matrix cache.
  2484. .transform "Transform*" { out } --- Pointer to `Transform` structure.
  2485. .num "uint16_t" --- Number of matrices.
  2486. --- Set shader uniform parameter for draw primitive.
  2487. func.setUniform
  2488. "void"
  2489. .handle "UniformHandle" --- Uniform.
  2490. .value "const void*" --- Pointer to uniform data.
  2491. .num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
  2492. --- use the _num passed on uniform creation.
  2493. { default = 1 }
  2494. --- Set index buffer for draw primitive.
  2495. func.setIndexBuffer { cpponly }
  2496. "void"
  2497. .handle "IndexBufferHandle" --- Index buffer.
  2498. --- Set index buffer for draw primitive.
  2499. func.setIndexBuffer
  2500. "void"
  2501. .handle "IndexBufferHandle" --- Index buffer.
  2502. .firstIndex "uint32_t" --- First index to render.
  2503. .numIndices "uint32_t" --- Number of indices to render.
  2504. --- Set index buffer for draw primitive.
  2505. func.setIndexBuffer { cpponly }
  2506. "void"
  2507. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2508. --- Set index buffer for draw primitive.
  2509. func.setIndexBuffer { cname = "set_dynamic_index_buffer" }
  2510. "void"
  2511. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2512. .firstIndex "uint32_t" --- First index to render.
  2513. .numIndices "uint32_t" --- Number of indices to render.
  2514. --- Set index buffer for draw primitive.
  2515. func.setIndexBuffer { cpponly }
  2516. "void"
  2517. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2518. --- Set index buffer for draw primitive.
  2519. func.setIndexBuffer { cname = "set_transient_index_buffer" }
  2520. "void"
  2521. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2522. .firstIndex "uint32_t" --- First index to render.
  2523. .numIndices "uint32_t" --- Number of indices to render.
  2524. --- Set vertex buffer for draw primitive.
  2525. func.setVertexBuffer { cpponly }
  2526. "void"
  2527. .stream "uint8_t" --- Vertex stream.
  2528. .handle "VertexBufferHandle" --- Vertex buffer.
  2529. --- Set vertex buffer for draw primitive.
  2530. func.setVertexBuffer { conly }
  2531. "void"
  2532. .stream "uint8_t" --- Vertex stream.
  2533. .handle "VertexBufferHandle" --- Vertex buffer.
  2534. .startVertex "uint32_t" --- First vertex to render.
  2535. .numVertices "uint32_t" --- Number of vertices to render.
  2536. --- Set vertex buffer for draw primitive.
  2537. func.setVertexBuffer { cname = "set_vertex_buffer_with_layout" }
  2538. "void"
  2539. .stream "uint8_t" --- Vertex stream.
  2540. .handle "VertexBufferHandle" --- Vertex buffer.
  2541. .startVertex "uint32_t" --- First vertex to render.
  2542. .numVertices "uint32_t" --- Number of vertices to render.
  2543. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2544. --- handle is used, vertex layout used for creation
  2545. --- of vertex buffer will be used.
  2546. { default = "BGFX_INVALID_HANDLE" }
  2547. --- Set vertex buffer for draw primitive.
  2548. func.setVertexBuffer { cpponly }
  2549. "void"
  2550. .stream "uint8_t" --- Vertex stream.
  2551. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2552. --- Set vertex buffer for draw primitive.
  2553. func.setVertexBuffer { conly, cname = "set_dynamic_vertex_buffer" }
  2554. "void"
  2555. .stream "uint8_t" --- Vertex stream.
  2556. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2557. .startVertex "uint32_t" --- First vertex to render.
  2558. .numVertices "uint32_t" --- Number of vertices to render.
  2559. --- Set vertex buffer for draw primitive.
  2560. func.setVertexBuffer { cname = "set_dynamic_vertex_buffer_with_layout" }
  2561. "void"
  2562. .stream "uint8_t" --- Vertex stream.
  2563. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2564. .startVertex "uint32_t" --- First vertex to render.
  2565. .numVertices "uint32_t" --- Number of vertices to render.
  2566. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2567. --- handle is used, vertex layout used for creation
  2568. --- of vertex buffer will be used.
  2569. { default = "BGFX_INVALID_HANDLE" }
  2570. --- Set vertex buffer for draw primitive.
  2571. func.setVertexBuffer { cpponly }
  2572. "void"
  2573. .stream "uint8_t" --- Vertex stream.
  2574. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2575. --- Set vertex buffer for draw primitive.
  2576. func.setVertexBuffer { conly, cname = "set_transient_vertex_buffer" }
  2577. "void"
  2578. .stream "uint8_t" --- Vertex stream.
  2579. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2580. .startVertex "uint32_t" --- First vertex to render.
  2581. .numVertices "uint32_t" --- Number of vertices to render.
  2582. --- Set vertex buffer for draw primitive.
  2583. func.setVertexBuffer { cname = "set_transient_vertex_buffer_with_layout" }
  2584. "void"
  2585. .stream "uint8_t" --- Vertex stream.
  2586. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2587. .startVertex "uint32_t" --- First vertex to render.
  2588. .numVertices "uint32_t" --- Number of vertices to render.
  2589. .layoutHandle "VertexLayoutHandle" --- Vertex layout for aliasing vertex buffer. If invalid
  2590. --- handle is used, vertex layout used for creation
  2591. --- of vertex buffer will be used.
  2592. { default = "BGFX_INVALID_HANDLE" }
  2593. --- Set number of vertices for auto generated vertices use in conjuction
  2594. --- with gl_VertexID.
  2595. ---
  2596. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2597. ---
  2598. func.setVertexCount
  2599. "void"
  2600. .numVertices "uint32_t" --- Number of vertices.
  2601. --- Set instance data buffer for draw primitive.
  2602. func.setInstanceDataBuffer { cpponly }
  2603. "void"
  2604. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2605. --- Set instance data buffer for draw primitive.
  2606. func.setInstanceDataBuffer
  2607. "void"
  2608. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2609. .start "uint32_t" --- First instance data.
  2610. .num "uint32_t" --- Number of data instances.
  2611. --- Set instance data buffer for draw primitive.
  2612. func.setInstanceDataBuffer { cpponly }
  2613. "void"
  2614. .handle "VertexBufferHandle" --- Vertex buffer.
  2615. --- Set instance data buffer for draw primitive.
  2616. func.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" }
  2617. "void"
  2618. .handle "VertexBufferHandle" --- Vertex buffer.
  2619. .startVertex "uint32_t" --- First instance data.
  2620. .num "uint32_t" --- Number of data instances.
  2621. --- Set instance data buffer for draw primitive.
  2622. func.setInstanceDataBuffer { cpponly }
  2623. "void"
  2624. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2625. --- Set instance data buffer for draw primitive.
  2626. func.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" }
  2627. "void"
  2628. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2629. .startVertex "uint32_t" --- First instance data.
  2630. .num "uint32_t" --- Number of data instances.
  2631. --- Set number of instances for auto generated instances use in conjuction
  2632. --- with gl_InstanceID.
  2633. ---
  2634. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2635. ---
  2636. func.setInstanceCount
  2637. "void"
  2638. .numInstances "uint32_t" -- Number of instances.
  2639. --- Set texture stage for draw primitive.
  2640. func.setTexture
  2641. "void"
  2642. .stage "uint8_t" --- Texture unit.
  2643. .sampler "UniformHandle" --- Program sampler.
  2644. .handle "TextureHandle" --- Texture handle.
  2645. .flags "uint32_t" --- Texture sampling mode. Default value UINT32_MAX uses
  2646. { default = UINT32_MAX } --- texture sampling settings from the texture.
  2647. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2648. --- mode.
  2649. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2650. --- sampling.
  2651. --- Submit an empty primitive for rendering. Uniforms and draw state
  2652. --- will be applied but no geometry will be submitted.
  2653. ---
  2654. --- @remark
  2655. --- These empty draw calls will sort before ordinary draw calls.
  2656. ---
  2657. func.touch
  2658. "void"
  2659. .id "ViewId" --- View id.
  2660. --- Submit primitive for rendering.
  2661. func.submit
  2662. "void"
  2663. .id "ViewId" --- View id.
  2664. .program "ProgramHandle" --- Program.
  2665. .depth "uint32_t" --- Depth for sorting.
  2666. { default = 0 }
  2667. .flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
  2668. { default = "BGFX_DISCARD_ALL" }
  2669. --- Submit primitive with occlusion query for rendering.
  2670. func.submit { cname = "submit_occlusion_query" }
  2671. "void"
  2672. .id "ViewId" --- View id.
  2673. .program "ProgramHandle" --- Program.
  2674. .occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
  2675. .depth "uint32_t" --- Depth for sorting.
  2676. { default = 0 }
  2677. .flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
  2678. { default = "BGFX_DISCARD_ALL" }
  2679. --- Submit primitive for rendering with index and instance data info from
  2680. --- indirect buffer.
  2681. func.submit { cname = "submit_indirect" }
  2682. "void"
  2683. .id "ViewId" --- View id.
  2684. .program "ProgramHandle" --- Program.
  2685. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2686. .start "uint16_t" --- First element in indirect buffer.
  2687. { default = 0 }
  2688. .num "uint16_t" --- Number of dispatches.
  2689. { default = 1 }
  2690. .depth "uint32_t" --- Depth for sorting.
  2691. { default = 0 }
  2692. .flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
  2693. { default = "BGFX_DISCARD_ALL" }
  2694. --- Set compute index buffer.
  2695. func.setBuffer { cname = "set_compute_index_buffer" }
  2696. "void"
  2697. .stage "uint8_t" --- Compute stage.
  2698. .handle "IndexBufferHandle" --- Index buffer handle.
  2699. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2700. --- Set compute vertex buffer.
  2701. func.setBuffer { cname = "set_compute_vertex_buffer" }
  2702. "void"
  2703. .stage "uint8_t" --- Compute stage.
  2704. .handle "VertexBufferHandle" --- Vertex buffer handle.
  2705. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2706. --- Set compute dynamic index buffer.
  2707. func.setBuffer { cname = "set_compute_dynamic_index_buffer" }
  2708. "void"
  2709. .stage "uint8_t" --- Compute stage.
  2710. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  2711. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2712. --- Set compute dynamic vertex buffer.
  2713. func.setBuffer { cname = "set_compute_dynamic_vertex_buffer" }
  2714. "void"
  2715. .stage "uint8_t" --- Compute stage.
  2716. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  2717. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2718. --- Set compute indirect buffer.
  2719. func.setBuffer { cname = "set_compute_indirect_buffer" }
  2720. "void"
  2721. .stage "uint8_t" --- Compute stage.
  2722. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  2723. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2724. --- Set compute image from texture.
  2725. func.setImage
  2726. "void"
  2727. .stage "uint8_t" --- Compute stage.
  2728. .handle "TextureHandle" --- Texture handle.
  2729. .mip "uint8_t" --- Mip level.
  2730. .access "Access::Enum" --- Image access. See `Access::Enum`.
  2731. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2732. { default = "TextureFormat::Count" }
  2733. --- Dispatch compute.
  2734. func.dispatch
  2735. "void"
  2736. .id "ViewId" --- View id.
  2737. .program "ProgramHandle" --- Compute program.
  2738. .numX "uint32_t" --- Number of groups X.
  2739. { default = 1 }
  2740. .numY "uint32_t" --- Number of groups Y.
  2741. { default = 1 }
  2742. .numZ "uint32_t" --- Number of groups Z.
  2743. { default = 1 }
  2744. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2745. { default = "BGFX_DISCARD_ALL" }
  2746. --- Dispatch compute indirect.
  2747. func.dispatch { cname = "dispatch_indirect" }
  2748. "void"
  2749. .id "ViewId" --- View id.
  2750. .program "ProgramHandle" --- Compute program.
  2751. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2752. .start "uint16_t" --- First element in indirect buffer.
  2753. { default = 0 }
  2754. .num "uint16_t" --- Number of dispatches.
  2755. { default = 1 }
  2756. .flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
  2757. { default = "BGFX_DISCARD_ALL" }
  2758. --- Discard previously set state for draw or compute call.
  2759. func.discard
  2760. "void"
  2761. .flags "uint8_t" --- Draw/compute states to discard.
  2762. { default = "BGFX_DISCARD_ALL" }
  2763. --- Blit 2D texture region between two 2D textures.
  2764. ---
  2765. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2766. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2767. ---
  2768. func.blit { cpponly }
  2769. "void"
  2770. .id "ViewId" --- View id.
  2771. .dst "TextureHandle" --- Destination texture handle.
  2772. .dstX "uint16_t" --- Destination texture X position.
  2773. .dstY "uint16_t" --- Destination texture Y position.
  2774. .src "TextureHandle" --- Source texture handle.
  2775. .srcX "uint16_t" --- Source texture X position.
  2776. { default = 0 }
  2777. .srcY "uint16_t" --- Source texture Y position.
  2778. { default = 0 }
  2779. .width "uint16_t" --- Width of region.
  2780. { default = UINT16_MAX }
  2781. .height "uint16_t" --- Height of region.
  2782. { default = UINT16_MAX }
  2783. --- Blit 2D texture region between two 2D textures.
  2784. ---
  2785. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2786. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2787. ---
  2788. func.blit
  2789. "void"
  2790. .id "ViewId" --- View id.
  2791. .dst "TextureHandle" --- Destination texture handle.
  2792. .dstMip "uint8_t" --- Destination texture mip level.
  2793. .dstX "uint16_t" --- Destination texture X position.
  2794. .dstY "uint16_t" --- Destination texture Y position.
  2795. .dstZ "uint16_t" --- If texture is 2D this argument should be 0. If destination texture is cube
  2796. --- this argument represents destination texture cube face. For 3D texture this argument
  2797. --- represents destination texture Z position.
  2798. .src "TextureHandle" --- Source texture handle.
  2799. .srcMip "uint8_t" --- Source texture mip level.
  2800. { default = 0 }
  2801. .srcX "uint16_t" --- Source texture X position.
  2802. { default = 0 }
  2803. .srcY "uint16_t" --- Source texture Y position.
  2804. { default = 0 }
  2805. .srcZ "uint16_t" --- If texture is 2D this argument should be 0. If source texture is cube
  2806. --- this argument represents source texture cube face. For 3D texture this argument
  2807. --- represents source texture Z position.
  2808. { default = 0 }
  2809. .width "uint16_t" --- Width of region.
  2810. { default = UINT16_MAX }
  2811. .height "uint16_t" --- Height of region.
  2812. { default = UINT16_MAX }
  2813. .depth "uint16_t" --- If texture is 3D this argument represents depth of region, otherwise it's
  2814. --- unused.
  2815. { default = UINT16_MAX }