bgfx.idl 136 KB

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