bgfx.idl 131 KB

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