bgfx.idl 114 KB

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