bgfx.idl 141 KB

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