bgfx.idl 132 KB

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