bgfx.idl 130 KB

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