bgfx.idl 142 KB

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