bgfx.idl 137 KB

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