bgfx.idl 138 KB

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