bgfx.idl 146 KB

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