bgfx.idl 137 KB

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