bgfx.idl 130 KB

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