bgfx.idl 133 KB

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