bgfx.idl 131 KB

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