bgfx.idl 115 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620
  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 vertex declaration.
  800. func.createVertexDecl
  801. "VertexDeclHandle"
  802. .decl "const VertexDecl &" --- Vertex declaration.
  803. --- Destroy vertex declaration.
  804. func.destroy { cname = "destroy_vertex_decl" }
  805. "void"
  806. .handle "VertexDeclHandle" --- Vertex declaration handle.
  807. --- Create static vertex buffer.
  808. func.createVertexBuffer
  809. "VertexBufferHandle" --- Static vertex buffer handle.
  810. .mem "const Memory*" --- Vertex buffer data.
  811. .decl "const VertexDecl &" --- Vertex declaration.
  812. .flags "uint16_t" --- Buffer creation flags.
  813. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  814. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  815. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  816. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  817. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  818. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  819. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  820. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
  821. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
  822. --- Set static vertex buffer debug name.
  823. func.setName { cname = "set_vertex_buffer_name" }
  824. "void"
  825. .handle "VertexBufferHandle" --- Static vertex buffer handle.
  826. .name "const char*" --- Static vertex buffer name.
  827. .len "int32_t" --- Static vertex buffer name length (if length is INT32_MAX, it's expected
  828. { default = INT32_MAX } --- that _name is zero terminated string.
  829. --- Destroy static vertex buffer.
  830. func.destroy { cname = "destroy_vertex_buffer" }
  831. "void"
  832. .handle "VertexBufferHandle" --- Static vertex buffer handle.
  833. --- Create empty dynamic index buffer.
  834. func.createDynamicIndexBuffer
  835. "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  836. .num "uint32_t" --- Number of indices.
  837. .flags "uint16_t" --- Buffer creation flags.
  838. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  839. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  840. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  841. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  842. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  843. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  844. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  845. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  846. --- buffers.
  847. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  848. --- index buffers.
  849. --- Create dynamic index buffer and initialized it.
  850. func.createDynamicIndexBuffer { cname = "create_dynamic_index_buffer_mem" }
  851. "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  852. .mem "const Memory*" --- Index buffer data.
  853. .flags "uint16_t" --- Buffer creation flags.
  854. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  855. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  856. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  857. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  858. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  859. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  860. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  861. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  862. --- buffers.
  863. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  864. --- index buffers.
  865. --- Update dynamic index buffer.
  866. func.update { cname = "update_dynamic_index_buffer" }
  867. "void"
  868. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  869. .startIndex "uint32_t" --- Start index.
  870. .mem "const Memory*" --- Index buffer data.
  871. --- Destroy dynamic index buffer.
  872. func.destroy { cname = "destroy_dynamic_index_buffer" }
  873. "void"
  874. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  875. --- Create empty dynamic vertex buffer.
  876. func.createDynamicVertexBuffer
  877. "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  878. .num "uint32_t" --- Number of vertices.
  879. .decl "const VertexDecl&" --- Vertex declaration.
  880. .flags "uint16_t" --- Buffer creation flags.
  881. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  882. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  883. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  884. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  885. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  886. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  887. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  888. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  889. --- buffers.
  890. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  891. --- index buffers.
  892. --- Create dynamic vertex buffer and initialize it.
  893. func.createDynamicVertexBuffer { cname = "create_dynamic_vertex_buffer_mem" }
  894. "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  895. .mem "const Memory*" --- Vertex buffer data.
  896. .decl "const VertexDecl&" --- Vertex declaration.
  897. .flags "uint16_t" --- Buffer creation flags.
  898. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags.
  899. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  900. --- - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  901. --- is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  902. --- - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  903. --- - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  904. --- data is passed. If this flag is not specified, and more data is passed on update, the buffer
  905. --- will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  906. --- buffers.
  907. --- - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  908. --- index buffers.
  909. --- Update dynamic vertex buffer.
  910. func.update { cname = "update_dynamic_vertex_buffer" }
  911. "void"
  912. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  913. .startVertex "uint32_t" --- Start vertex.
  914. .mem "const Memory*" --- Vertex buffer data.
  915. --- Destroy dynamic vertex buffer.
  916. func.destroy { cname = "destroy_dynamic_vertex_buffer" }
  917. "void"
  918. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  919. --- Returns number of requested or maximum available indices.
  920. func.getAvailTransientIndexBuffer
  921. "uint32_t" --- Number of requested or maximum available indices.
  922. .num "uint32_t" --- Number of required indices.
  923. --- Returns number of requested or maximum available vertices.
  924. func.getAvailTransientVertexBuffer
  925. "uint32_t" --- Number of requested or maximum available vertices.
  926. .num "uint32_t" --- Number of required vertices.
  927. .decl "const VertexDecl &" --- Vertex declaration.
  928. --- Returns number of requested or maximum available instance buffer slots.
  929. func.getAvailInstanceDataBuffer
  930. "uint32_t" --- Number of requested or maximum available instance buffer slots.
  931. .num "uint32_t" --- Number of required instances.
  932. .stride "uint16_t" --- Stride per instance.
  933. --- Allocate transient index buffer.
  934. ---
  935. --- @remarks
  936. --- Only 16-bit index buffer is supported.
  937. ---
  938. func.allocTransientIndexBuffer
  939. "void"
  940. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid
  941. --- for the duration of frame, and it can be reused for multiple draw
  942. --- calls.
  943. .num "uint32_t" --- Number of indices to allocate.
  944. --- Allocate transient vertex buffer.
  945. func.allocTransientVertexBuffer
  946. "void"
  947. .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid
  948. --- for the duration of frame, and it can be reused for multiple draw
  949. --- calls.
  950. .num "uint32_t" --- Number of vertices to allocate.
  951. .decl "const VertexDecl &" --- Vertex declaration.
  952. --- Check for required space and allocate transient vertex and index
  953. --- buffers. If both space requirements are satisfied function returns
  954. --- true.
  955. ---
  956. --- @remarks
  957. --- Only 16-bit index buffer is supported.
  958. ---
  959. func.allocTransientBuffers
  960. "bool"
  961. .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid
  962. --- for the duration of frame, and it can be reused for multiple draw
  963. --- calls.
  964. .decl "const VertexDecl &" --- Number of vertices to allocate.
  965. .numVertices "uint32_t" --- Vertex declaration.
  966. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid
  967. --- for the duration of frame, and it can be reused for multiple draw
  968. --- calls.
  969. .numIndices "uint32_t" --- Number of indices to allocate.
  970. --- Allocate instance data buffer.
  971. func.allocInstanceDataBuffer
  972. "void"
  973. .idb "InstanceDataBuffer*" { out } --- InstanceDataBuffer structure is filled and is valid
  974. --- for duration of frame, and it can be reused for multiple draw
  975. --- calls.
  976. .num "uint32_t" --- Number of instances.
  977. .stride "uint16_t" --- Instance stride. Must be multiple of 16.
  978. --- Create draw indirect buffer.
  979. func.createIndirectBuffer
  980. "IndirectBufferHandle" --- Indirect buffer handle.
  981. .num "uint32_t" --- Number of indirect calls.
  982. --- Destroy draw indirect buffer.
  983. func.destroy { cname = "destroy_indirect_buffer" }
  984. "void"
  985. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  986. --- Create shader from memory buffer.
  987. func.createShader
  988. "ShaderHandle" --- Shader handle.
  989. .mem "const Memory*" --- Shader binary.
  990. --- Returns the number of uniforms and uniform handles used inside a shader.
  991. ---
  992. --- @remarks
  993. --- Only non-predefined uniforms are returned.
  994. ---
  995. func.getShaderUniforms
  996. "uint16_t" --- Number of uniforms used by shader.
  997. .handle "ShaderHandle" --- Shader handle.
  998. .uniforms "UniformHandle*" { out } --- UniformHandle array where data will be stored.
  999. { default = NULL }
  1000. .max "uint16_t" --- Maximum capacity of array.
  1001. { default = 0 }
  1002. --- Set shader debug name.
  1003. func.setName { cname = "set_shader_name" }
  1004. "void"
  1005. .handle "ShaderHandle" --- Shader handle.
  1006. .name "const char*" --- Shader name.
  1007. .len "int32_t" --- Shader name length (if length is INT32_MAX, it's expected
  1008. { default = INT32_MAX } --- that _name is zero terminated string).
  1009. --- Destroy shader.
  1010. ---
  1011. --- @remark Once a shader program is created with _handle,
  1012. --- it is safe to destroy that shader.
  1013. ---
  1014. func.destroy { cname = "destroy_shader" }
  1015. "void"
  1016. .handle "ShaderHandle" --- Shader handle.
  1017. --- Create program with vertex and fragment shaders.
  1018. func.createProgram
  1019. "ProgramHandle" --- Program handle if vertex shader output and fragment shader
  1020. --- input are matching, otherwise returns invalid program handle.
  1021. .vsh "ShaderHandle" --- Vertex shader.
  1022. .fsh "ShaderHandle" --- Fragment shader.
  1023. .destroyShaders "bool" --- If true, shaders will be destroyed when program is destroyed.
  1024. { default = false }
  1025. --- Create program with compute shader.
  1026. func.createProgram { cname = "create_compute_program" }
  1027. "ProgramHandle" --- Program handle.
  1028. .csh "ShaderHandle" --- Compute shader.
  1029. .destroyShaders "bool" --- If true, shaders will be destroyed when program is destroyed.
  1030. { default = false }
  1031. --- Destroy program.
  1032. func.destroy { cname = "destroy_program" }
  1033. "void"
  1034. .handle "ProgramHandle" --- Program handle.
  1035. --- Validate texture parameters.
  1036. func.isTextureValid
  1037. "bool" --- True if texture can be successfully created.
  1038. .depth "uint16_t" --- Depth dimension of volume texture.
  1039. .cubeMap "bool" --- Indicates that texture contains cubemap.
  1040. .numLayers "uint16_t" --- Number of layers in texture array.
  1041. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1042. .flags "uint64_t" --- Texture flags. See `BGFX_TEXTURE_*`.
  1043. --- Calculate amount of memory required for texture.
  1044. func.calcTextureSize
  1045. "void"
  1046. .info "TextureInfo &" { out } --- Resulting texture info structure. See: `TextureInfo`.
  1047. .width "uint16_t" --- Width.
  1048. .height "uint16_t" --- Height.
  1049. .depth "uint16_t" --- Depth dimension of volume texture.
  1050. .cubeMap "bool" --- Indicates that texture contains cubemap.
  1051. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1052. .numLayers "uint16_t" --- Number of layers in texture array.
  1053. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1054. --- Create texture from memory buffer.
  1055. func.createTexture
  1056. "TextureHandle" --- Texture handle.
  1057. .mem "const Memory*" --- DDS, KTX or PVR texture binary data.
  1058. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1059. { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1060. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1061. --- mode.
  1062. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1063. --- sampling.
  1064. .skip "uint8_t" --- Skip top level mips when parsing texture.
  1065. { default = 0 }
  1066. .info "TextureInfo*" { out } --- When non-`NULL` is specified it returns parsed texture information.
  1067. { default = NULL }
  1068. --- Create 2D texture.
  1069. func.createTexture2D
  1070. "TextureHandle" --- Texture handle.
  1071. .width "uint16_t" --- Width.
  1072. .height "uint16_t" --- Height.
  1073. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1074. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1075. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1076. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1077. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1078. { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1079. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1080. --- mode.
  1081. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1082. --- sampling.
  1083. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1084. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1085. --- 1, expected memory layout is texture and all mips together for each array element.
  1086. --- Create texture with size based on backbuffer ratio. Texture will maintain ratio
  1087. --- if back buffer resolution changes.
  1088. func.createTexture2D { cname = "create_texture_2d_scaled" }
  1089. "TextureHandle" --- Texture handle.
  1090. .ratio "BackbufferRatio::Enum" --- Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
  1091. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1092. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1093. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1094. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1095. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1096. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1097. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1098. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1099. --- mode.
  1100. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1101. --- sampling.
  1102. --- Create 3D texture.
  1103. func.createTexture3D
  1104. "TextureHandle" --- Texture handle.
  1105. .width "uint16_t" --- Width.
  1106. .height "uint16_t" --- Height.
  1107. .depth "uint16_t" --- Depth.
  1108. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1109. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1110. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1111. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1112. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1113. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1114. --- mode.
  1115. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1116. --- sampling.
  1117. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1118. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1119. --- 1, expected memory layout is texture and all mips together for each array element.
  1120. --- Create Cube texture.
  1121. func.createTextureCube
  1122. "TextureHandle" --- Texture handle.
  1123. .size "uint16_t" --- Cube side size.
  1124. .hasMips "bool" --- Indicates that texture contains full mip-map chain.
  1125. .numLayers "uint16_t" --- Number of layers in texture array. Must be 1 if caps
  1126. --- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  1127. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1128. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1129. { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" }
  1130. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1131. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1132. --- mode.
  1133. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1134. --- sampling.
  1135. .mem "const Memory*" --- Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  1136. { default = NULL } --- `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  1137. --- 1, expected memory layout is texture and all mips together for each array element.
  1138. --- Update 2D texture.
  1139. ---
  1140. --- @attention It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
  1141. ---
  1142. func.updateTexture2D
  1143. "void"
  1144. .handle "TextureHandle" --- Texture handle.
  1145. .layer "uint16_t" --- Layer in texture array.
  1146. .mip "uint8_t" --- Mip level.
  1147. .x "uint16_t" --- X offset in texture.
  1148. .y "uint16_t" --- Y offset in texture.
  1149. .width "uint16_t" --- Width of texture block.
  1150. .height "uint16_t" --- Height of texture block.
  1151. .mem "const Memory*" --- Texture update data.
  1152. .pitch "uint16_t" --- Pitch of input image (bytes). When _pitch is set to
  1153. --- UINT16_MAX, it will be calculated internally based on _width.
  1154. { default = UINT16_MAX }
  1155. --- Update 3D texture.
  1156. ---
  1157. --- @attention It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
  1158. ---
  1159. func.updateTexture3D
  1160. "void"
  1161. .handle "TextureHandle" --- Texture handle.
  1162. .mip "uint8_t" --- Mip level.
  1163. .x "uint16_t" --- X offset in texture.
  1164. .y "uint16_t" --- Y offset in texture.
  1165. .z "uint16_t" --- Z offset in texture.
  1166. .width "uint16_t" --- Width of texture block.
  1167. .height "uint16_t" --- Height of texture block.
  1168. .depth "uint16_t" --- Depth of texture block.
  1169. .mem "const Memory*" --- Texture update data.
  1170. --- Update Cube texture.
  1171. ---
  1172. --- @attention It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
  1173. ---
  1174. func.updateTextureCube
  1175. "void"
  1176. .handle "TextureHandle" --- Texture handle.
  1177. .layer "uint16_t" --- Layer in texture array.
  1178. .side "uint8_t" --- Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
  1179. --- where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
  1180. ---
  1181. --- +----------+
  1182. --- |-z 2|
  1183. --- | ^ +y |
  1184. --- | | | Unfolded cube:
  1185. --- | +---->+x |
  1186. --- +----------+----------+----------+----------+
  1187. --- |+y 1|+y 4|+y 0|+y 5|
  1188. --- | ^ -x | ^ +z | ^ +x | ^ -z |
  1189. --- | | | | | | | | |
  1190. --- | +---->+z | +---->+x | +---->-z | +---->-x |
  1191. --- +----------+----------+----------+----------+
  1192. --- |+z 3|
  1193. --- | ^ -y |
  1194. --- | | |
  1195. --- | +---->+x |
  1196. --- +----------+
  1197. .mip "uint8_t" --- Mip level.
  1198. .x "uint16_t" --- X offset in texture.
  1199. .y "uint16_t" --- Y offset in texture.
  1200. .width "uint16_t" --- Width of texture block.
  1201. .height "uint16_t" --- Height of texture block.
  1202. .mem "const Memory*" --- Texture update data.
  1203. .pitch "uint16_t" --- Pitch of input image (bytes). When _pitch is set to
  1204. --- UINT16_MAX, it will be calculated internally based on _width.
  1205. { default = UINT16_MAX }
  1206. --- Read back texture content.
  1207. ---
  1208. --- @attention Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
  1209. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
  1210. ---
  1211. func.readTexture
  1212. "uint32_t" --- Frame number when the result will be available. See: `bgfx::frame`.
  1213. .handle "TextureHandle" --- Texture handle.
  1214. .data "void*" --- Destination buffer.
  1215. .mip "uint8_t" --- Mip level.
  1216. { default = 0 }
  1217. --- Set texture debug name.
  1218. func.setName { cname = "set_texture_name" }
  1219. "void"
  1220. .handle "TextureHandle" --- Texture handle.
  1221. .name "const char*" --- Texture name.
  1222. .len "int32_t" --- Texture name length (if length is INT32_MAX, it's expected
  1223. { default = INT32_MAX } --- that _name is zero terminated string.
  1224. --- Returns texture direct access pointer.
  1225. ---
  1226. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
  1227. --- is available on GPUs that have unified memory architecture (UMA) support.
  1228. ---
  1229. func.getDirectAccessPtr
  1230. "void*" --- Pointer to texture memory. If returned pointer is `NULL` direct access
  1231. --- is not available for this texture. If pointer is `UINTPTR_MAX` sentinel value
  1232. --- it means texture is pending creation. Pointer returned can be cached and it
  1233. --- will be valid until texture is destroyed.
  1234. .handle "TextureHandle" --- Texture handle.
  1235. --- Destroy texture.
  1236. func.destroy { cname = "destroy_texture" }
  1237. "void"
  1238. .handle "TextureHandle" --- Texture handle.
  1239. --- Create frame buffer (simple).
  1240. func.createFrameBuffer
  1241. "FrameBufferHandle" --- Frame buffer handle.
  1242. .width "uint16_t" --- Texture width.
  1243. .height "uint16_t" --- Texture height.
  1244. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1245. .textureFlags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1246. { default = "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" }
  1247. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1248. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1249. --- mode.
  1250. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1251. --- sampling.
  1252. --- Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio
  1253. --- if back buffer resolution changes.
  1254. func.createFrameBuffer { cname = "create_frame_buffer_scaled" }
  1255. "FrameBufferHandle" --- Frame buffer handle.
  1256. .ratio "BackbufferRatio::Enum" --- Frame buffer size in respect to back-buffer size. See:
  1257. --- `BackbufferRatio::Enum`.
  1258. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1259. .textureFlags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1260. { default = "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" }
  1261. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1262. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1263. --- mode.
  1264. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1265. --- sampling.
  1266. --- Create MRT frame buffer from texture handles (simple).
  1267. func.createFrameBuffer { cname = "create_frame_buffer_from_handles" }
  1268. "FrameBufferHandle" --- Frame buffer handle.
  1269. .num "uint8_t" --- Number of texture handles.
  1270. .handles "const TextureHandle*" --- Texture attachments.
  1271. .destroyTexture "bool" --- If true, textures will be destroyed when
  1272. { default = false } --- frame buffer is destroyed.
  1273. --- Create MRT frame buffer from texture handles with specific layer and
  1274. --- mip level.
  1275. func.createFrameBuffer { cname = "create_frame_buffer_from_attachment" }
  1276. "FrameBufferHandle" --- Frame buffer handle.
  1277. .num "uint8_t" --- Number of attachements.
  1278. .attachment "const Attachment*" --- Attachment texture info. See: `bgfx::Attachment`.
  1279. .destroyTexture "bool" --- If true, textures will be destroyed when
  1280. { default = false } --- frame buffer is destroyed.
  1281. --- Create frame buffer for multiple window rendering.
  1282. ---
  1283. --- @remarks
  1284. --- Frame buffer cannot be used for sampling.
  1285. ---
  1286. --- @attention Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
  1287. ---
  1288. func.createFrameBuffer { cname = "create_frame_buffer_from_nwh" }
  1289. "FrameBufferHandle" --- Frame buffer handle.
  1290. .nwh "void*" --- OS' target native window handle.
  1291. .width "uint16_t" --- Window back buffer width.
  1292. .height "uint16_t" --- Window back buffer height.
  1293. .format "TextureFormat::Enum" --- Window back buffer color format.
  1294. { default = "TextureFormat::Count" }
  1295. .depthFormat "TextureFormat::Enum" --- Window back buffer depth format.
  1296. { default = "TextureFormat::Count" }
  1297. --- Set frame buffer debug name.
  1298. func.setName { cname = "set_frame_buffer_name" }
  1299. "void"
  1300. .handle "FrameBufferHandle" --- Frame buffer handle.
  1301. .name "const char*" --- Frame buffer name.
  1302. .len "int32_t" --- Frame buffer name length (if length is INT32_MAX, it's expected
  1303. { default = INT32_MAX } --- that _name is zero terminated string.
  1304. --- Obtain texture handle of frame buffer attachment.
  1305. func.getTexture
  1306. "TextureHandle"
  1307. .handle "FrameBufferHandle" --- Frame buffer handle.
  1308. .attachment "uint8_t"
  1309. { default = 0 }
  1310. --- Destroy frame buffer.
  1311. func.destroy { cname = "destroy_frame_buffer" }
  1312. "void"
  1313. .handle "FrameBufferHandle" --- Frame buffer handle.
  1314. --- Create shader uniform parameter.
  1315. ---
  1316. --- @remarks
  1317. --- 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
  1318. --- multiple times with the same uniform name. The library will always
  1319. --- return the same handle, but the handle reference count will be
  1320. --- incremented. This means that the same number of `bgfx::destroyUniform`
  1321. --- must be called to properly destroy the uniform.
  1322. ---
  1323. --- 2. Predefined uniforms (declared in `bgfx_shader.sh`):
  1324. --- - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
  1325. --- view, in pixels.
  1326. --- - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
  1327. --- width and height
  1328. --- - `u_view mat4` - view matrix
  1329. --- - `u_invView mat4` - inverted view matrix
  1330. --- - `u_proj mat4` - projection matrix
  1331. --- - `u_invProj mat4` - inverted projection matrix
  1332. --- - `u_viewProj mat4` - concatenated view projection matrix
  1333. --- - `u_invViewProj mat4` - concatenated inverted view projection matrix
  1334. --- - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
  1335. --- - `u_modelView mat4` - concatenated model view matrix, only first
  1336. --- model matrix from array is used.
  1337. --- - `u_modelViewProj mat4` - concatenated model view projection matrix.
  1338. --- - `u_alphaRef float` - alpha reference value for alpha test.
  1339. ---
  1340. func.createUniform
  1341. "UniformHandle" --- Handle to uniform object.
  1342. .name "const char*" --- Uniform name in shader.
  1343. .type "UniformType::Enum" --- Type of uniform (See: `bgfx::UniformType`).
  1344. .num "uint16_t" --- Number of elements in array.
  1345. { default = 1 }
  1346. --- Retrieve uniform info.
  1347. func.getUniformInfo
  1348. "void"
  1349. .handle "UniformHandle" --- Handle to uniform object.
  1350. .info "UniformInfo &" { out } --- Uniform info.
  1351. --- Destroy shader uniform parameter.
  1352. func.destroy { cname = "destroy_uniform" }
  1353. "void"
  1354. .handle "UniformHandle" --- Handle to uniform object.
  1355. --- Create occlusion query.
  1356. func.createOcclusionQuery
  1357. "OcclusionQueryHandle" --- Handle to occlusion query object.
  1358. --- Retrieve occlusion query result from previous frame.
  1359. func.getResult
  1360. "OcclusionQueryResult::Enum" --- Occlusion query result.
  1361. .handle "OcclusionQueryHandle" --- Handle to occlusion query object.
  1362. .result "int32_t*" { out } --- Number of pixels that passed test. This argument
  1363. --- can be `NULL` if result of occlusion query is not needed.
  1364. { default = NULL }
  1365. --- Destroy occlusion query.
  1366. func.destroy { cname = "destroy_occlusion_query" }
  1367. "void"
  1368. .handle "OcclusionQueryHandle" --- Handle to occlusion query object.
  1369. --- Set palette color value.
  1370. func.setPaletteColor
  1371. "void"
  1372. .index "uint8_t" --- Index into palette.
  1373. .rgba "const float[4]" --- RGBA floating point values.
  1374. --- Set palette color value.
  1375. func.setPaletteColor { cname = "set_palette_color_rgba8" }
  1376. "void"
  1377. .index "uint8_t" --- Index into palette.
  1378. .rgba "uint32_t" --- Packed 32-bit RGBA value.
  1379. --- Set view name.
  1380. ---
  1381. --- @remarks
  1382. --- This is debug only feature.
  1383. ---
  1384. --- In graphics debugger view name will appear as:
  1385. ---
  1386. --- "nnnc <view name>"
  1387. --- ^ ^ ^
  1388. --- | +--- compute (C)
  1389. --- +------ view id
  1390. ---
  1391. func.setViewName
  1392. "void"
  1393. .id "ViewId" --- View id.
  1394. .name "const char*" --- View name.
  1395. --- Set view rectangle. Draw primitive outside view will be clipped.
  1396. func.setViewRect
  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. .width "uint16_t" --- Width of view port region.
  1402. .height "uint16_t" --- Height of view port region.
  1403. --- Set view rectangle. Draw primitive outside view will be clipped.
  1404. func.setViewRect { cname = "set_view_rect_ratio" }
  1405. "void"
  1406. .id "ViewId" --- View id.
  1407. .x "uint16_t" --- Position x from the left corner of the window.
  1408. .y "uint16_t" --- Position y from the top corner of the window.
  1409. .ratio "BackbufferRatio::Enum" --- Width and height will be set in respect to back-buffer size.
  1410. --- See: `BackbufferRatio::Enum`.
  1411. --- Set view scissor. Draw primitive outside view will be clipped. When
  1412. --- _x, _y, _width and _height are set to 0, scissor will be disabled.
  1413. func.setViewScissor
  1414. "void"
  1415. .id "ViewId" --- View id.
  1416. .x "uint16_t" --- Position x from the left corner of the window.
  1417. { default = 0 }
  1418. .y "uint16_t" --- Position y from the top corner of the window.
  1419. { default = 0 }
  1420. .width "uint16_t" --- Width of view scissor region.
  1421. { default = 0 }
  1422. .height "uint16_t" --- Height of view scissor region.
  1423. { default = 0 }
  1424. --- Set view clear flags.
  1425. func.setViewClear
  1426. "void"
  1427. .id "ViewId" --- View id.
  1428. .flags "uint16_t" --- Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1429. --- operation. See: `BGFX_CLEAR_*`.
  1430. .rgba "uint32_t" --- Color clear value.
  1431. { default = "0x000000ff" }
  1432. .depth "float" --- Depth clear value.
  1433. { default = "1.0f" }
  1434. .stencil "uint8_t" --- Stencil clear value.
  1435. { default = 0 }
  1436. --- Set view clear flags with different clear color for each
  1437. --- frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color
  1438. --- palette.
  1439. func.setViewClear { cname = "set_view_clear_mrt" }
  1440. "void"
  1441. .id "ViewId" --- View id.
  1442. .flags "uint16_t" --- Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1443. --- operation. See: `BGFX_CLEAR_*`.
  1444. .depth "float" --- Depth clear value.
  1445. .stencil "uint8_t" --- Stencil clear value.
  1446. .c0 "uint8_t" --- Palette index for frame buffer attachment 0.
  1447. { default = UINT8_MAX }
  1448. .c1 "uint8_t" --- Palette index for frame buffer attachment 1.
  1449. { default = UINT8_MAX }
  1450. .c2 "uint8_t" --- Palette index for frame buffer attachment 2.
  1451. { default = UINT8_MAX }
  1452. .c3 "uint8_t" --- Palette index for frame buffer attachment 3.
  1453. { default = UINT8_MAX }
  1454. .c4 "uint8_t" --- Palette index for frame buffer attachment 4.
  1455. { default = UINT8_MAX }
  1456. .c5 "uint8_t" --- Palette index for frame buffer attachment 5.
  1457. { default = UINT8_MAX }
  1458. .c6 "uint8_t" --- Palette index for frame buffer attachment 6.
  1459. { default = UINT8_MAX }
  1460. .c7 "uint8_t" --- Palette index for frame buffer attachment 7.
  1461. { default = UINT8_MAX }
  1462. --- Set view sorting mode.
  1463. ---
  1464. --- @remarks
  1465. --- View mode must be set prior calling `bgfx::submit` for the view.
  1466. ---
  1467. func.setViewMode
  1468. "void"
  1469. .id "ViewId" --- View id.
  1470. .mode "ViewMode::Enum" --- View sort mode. See `ViewMode::Enum`.
  1471. { default = "ViewMode::Default" }
  1472. --- Set view frame buffer.
  1473. ---
  1474. --- @remarks
  1475. --- Not persistent after `bgfx::reset` call.
  1476. ---
  1477. func.setViewFrameBuffer
  1478. "void"
  1479. .id "ViewId" --- View id.
  1480. .handle "FrameBufferHandle" --- Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
  1481. --- frame buffer handle will draw primitives from this view into
  1482. --- default back buffer.
  1483. --- Set view view and projection matrices, all draw primitives in this
  1484. --- view will use these matrices.
  1485. func.setViewTransform
  1486. "void"
  1487. .id "ViewId" --- View id.
  1488. .view "const void*" --- View matrix.
  1489. .proj "const void*" --- Projection matrix.
  1490. --- Post submit view reordering.
  1491. func.setViewOrder
  1492. "void"
  1493. .id "ViewId" --- First view id.
  1494. { default = 0 }
  1495. .num "uint16_t" --- Number of views to remap.
  1496. { default = UINT16_MAX }
  1497. .order "const ViewId*" --- View remap id table. Passing `NULL` will reset view ids
  1498. --- to default state.
  1499. { default = NULL }
  1500. --- Begin submitting draw calls from thread.
  1501. func.begin { cname = "encoder_begin" }
  1502. "Encoder*" --- Encoder.
  1503. .forThread "bool" --- Explicitly request an encoder for a worker thread.
  1504. --- End submitting draw calls from thread.
  1505. func["end"] { cname = "encoder_end" }
  1506. "void"
  1507. .encoder "Encoder*" --- Encoder.
  1508. --- Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1509. --- graphics debugging tools.
  1510. func.Encoder.setMarker
  1511. "void"
  1512. .marker "const char*" --- Marker string.
  1513. --- Set render states for draw primitive.
  1514. ---
  1515. --- @remarks
  1516. --- 1. To setup more complex states use:
  1517. --- `BGFX_STATE_ALPHA_REF(_ref)`,
  1518. --- `BGFX_STATE_POINT_SIZE(_size)`,
  1519. --- `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1520. --- `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1521. --- `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1522. --- `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1523. --- 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1524. --- equation is specified.
  1525. ---
  1526. func.Encoder.setState
  1527. "void"
  1528. .state "uint64_t" --- State flags. Default state for primitive type is
  1529. --- triangles. See: `BGFX_STATE_DEFAULT`.
  1530. --- - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  1531. --- - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  1532. --- - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  1533. --- - `BGFX_STATE_CULL_*` - Backface culling mode.
  1534. --- - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  1535. --- - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  1536. --- - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  1537. .rgba "uint32_t" --- Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  1538. --- `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  1539. { default = 0 }
  1540. --- Set condition for rendering.
  1541. func.Encoder.setCondition
  1542. "void"
  1543. .handle "OcclusionQueryHandle" --- Occlusion query handle.
  1544. .visible "bool" --- Render if occlusion query is visible.
  1545. --- Set stencil test state.
  1546. func.Encoder.setStencil
  1547. "void"
  1548. .fstencil "uint32_t" --- Front stencil state.
  1549. .bstencil "uint32_t" --- Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  1550. --- _fstencil is applied to both front and back facing primitives.
  1551. { default = "BGFX_STENCIL_NONE" }
  1552. --- Set scissor for draw primitive.
  1553. ---
  1554. --- @remark
  1555. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  1556. ---
  1557. func.Encoder.setScissor
  1558. "uint16_t" --- Scissor cache index.
  1559. .x "uint16_t" --- Position x from the left corner of the window.
  1560. .y "uint16_t" --- Position y from the top corner of the window.
  1561. .width "uint16_t" --- Width of view scissor region.
  1562. .height "uint16_t" --- Height of view scissor region.
  1563. --- Set scissor from cache for draw primitive.
  1564. ---
  1565. --- @remark
  1566. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  1567. ---
  1568. func.Encoder.setScissor { cname = "set_scissor_cached" }
  1569. "void"
  1570. .cache "uint16_t" --- Index in scissor cache.
  1571. { default = UINT16_MAX }
  1572. --- Set model matrix for draw primitive. If it is not called,
  1573. --- the model will be rendered with an identity model matrix.
  1574. func.Encoder.setTransform
  1575. "uint32_t" --- Index into matrix cache in case the same model matrix has
  1576. --- to be used for other draw primitive call.
  1577. .mtx "const void*" --- Pointer to first matrix in array.
  1578. .num "uint16_t" --- Number of matrices in array.
  1579. --- Set model matrix from matrix cache for draw primitive.
  1580. func.Encoder.setTransform { cname = "set_transform_cached" }
  1581. "void"
  1582. .cache "uint32_t" --- Index in matrix cache.
  1583. .num "uint16_t" --- Number of matrices from cache.
  1584. { default = 1 }
  1585. --- Reserve matrices in internal matrix cache.
  1586. ---
  1587. --- @attention Pointer returned can be modifed until `bgfx::frame` is called.
  1588. ---
  1589. func.Encoder.allocTransform
  1590. "uint32_t" --- Index in matrix cache.
  1591. .transform "Transform*" { out } --- Pointer to `Transform` structure.
  1592. .num "uint16_t" --- Number of matrices.
  1593. --- Set shader uniform parameter for draw primitive.
  1594. func.Encoder.setUniform
  1595. "void"
  1596. .handle "UniformHandle" --- Uniform.
  1597. .value "const void*" --- Pointer to uniform data.
  1598. .num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
  1599. --- use the _num passed on uniform creation.
  1600. { default = 1 }
  1601. --- Set index buffer for draw primitive.
  1602. func.Encoder.setIndexBuffer { cpponly }
  1603. "void"
  1604. .handle "IndexBufferHandle" --- Index buffer.
  1605. --- Set index buffer for draw primitive.
  1606. func.Encoder.setIndexBuffer
  1607. "void"
  1608. .handle "IndexBufferHandle" --- Index buffer.
  1609. .firstIndex "uint32_t" --- First index to render.
  1610. .numIndices "uint32_t" --- Number of indices to render.
  1611. --- Set index buffer for draw primitive.
  1612. func.Encoder.setIndexBuffer { cpponly }
  1613. "void"
  1614. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  1615. --- Set index buffer for draw primitive.
  1616. func.Encoder.setIndexBuffer { cname = "set_dynamic_index_buffer" }
  1617. "void"
  1618. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  1619. .firstIndex "uint32_t" --- First index to render.
  1620. .numIndices "uint32_t" --- Number of indices to render.
  1621. --- Set index buffer for draw primitive.
  1622. func.Encoder.setIndexBuffer { cpponly }
  1623. "void"
  1624. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  1625. --- Set index buffer for draw primitive.
  1626. func.Encoder.setIndexBuffer { cname = "set_transient_index_buffer" }
  1627. "void"
  1628. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  1629. .firstIndex "uint32_t" --- First index to render.
  1630. .numIndices "uint32_t" --- Number of indices to render.
  1631. --- Set vertex buffer for draw primitive.
  1632. func.Encoder.setVertexBuffer { cpponly }
  1633. "void"
  1634. .stream "uint8_t" --- Vertex stream.
  1635. .handle "VertexBufferHandle" --- Vertex buffer.
  1636. --- Set vertex buffer for draw primitive.
  1637. func.Encoder.setVertexBuffer
  1638. "void"
  1639. .stream "uint8_t" --- Vertex stream.
  1640. .handle "VertexBufferHandle" --- Vertex buffer.
  1641. .startVertex "uint32_t" --- First vertex to render.
  1642. .numVertices "uint32_t" --- Number of vertices to render.
  1643. .declHandle "VertexDeclHandle" --- VertexDecl handle for aliasing vertex buffer.
  1644. { default = "BGFX_INVALID_HANDLE" }
  1645. --- Set vertex buffer for draw primitive.
  1646. func.Encoder.setVertexBuffer { cpponly }
  1647. "void"
  1648. .stream "uint8_t" --- Vertex stream.
  1649. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  1650. --- Set vertex buffer for draw primitive.
  1651. func.Encoder.setVertexBuffer { cname = "set_dynamic_vertex_buffer" }
  1652. "void"
  1653. .stream "uint8_t" --- Vertex stream.
  1654. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  1655. .startVertex "uint32_t" --- First vertex to render.
  1656. .numVertices "uint32_t" --- Number of vertices to render.
  1657. .declHandle "VertexDeclHandle" --- VertexDecl handle for aliasing vertex buffer.
  1658. { default = "BGFX_INVALID_HANDLE" }
  1659. --- Set vertex buffer for draw primitive.
  1660. func.Encoder.setVertexBuffer { cpponly }
  1661. "void"
  1662. .stream "uint8_t" --- Vertex stream.
  1663. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  1664. --- Set vertex buffer for draw primitive.
  1665. func.Encoder.setVertexBuffer { cname = "set_transient_vertex_buffer" }
  1666. "void"
  1667. .stream "uint8_t" --- Vertex stream.
  1668. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  1669. .startVertex "uint32_t" --- First vertex to render.
  1670. .numVertices "uint32_t" --- Number of vertices to render.
  1671. .declHandle "VertexDeclHandle" --- VertexDecl handle for aliasing vertex buffer.
  1672. { default = "BGFX_INVALID_HANDLE" }
  1673. --- Set number of vertices for auto generated vertices use in conjuction
  1674. --- with gl_VertexID.
  1675. ---
  1676. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1677. ---
  1678. func.Encoder.setVertexCount
  1679. "void"
  1680. .numVertices "uint32_t" --- Number of vertices.
  1681. --- Set instance data buffer for draw primitive.
  1682. func.Encoder.setInstanceDataBuffer { cpponly }
  1683. "void"
  1684. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  1685. --- Set instance data buffer for draw primitive.
  1686. func.Encoder.setInstanceDataBuffer
  1687. "void"
  1688. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  1689. .start "uint32_t" --- First instance data.
  1690. .num "uint32_t" --- Number of data instances.
  1691. --- Set instance data buffer for draw primitive.
  1692. func.Encoder.setInstanceDataBuffer { cpponly }
  1693. "void"
  1694. .handle "VertexBufferHandle" --- Vertex buffer.
  1695. --- Set instance data buffer for draw primitive.
  1696. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" }
  1697. "void"
  1698. .handle "VertexBufferHandle" --- Vertex buffer.
  1699. .startVertex "uint32_t" --- First instance data.
  1700. .num "uint32_t" --- Number of data instances.
  1701. --- Set instance data buffer for draw primitive.
  1702. func.Encoder.setInstanceDataBuffer { cpponly }
  1703. "void"
  1704. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  1705. --- Set instance data buffer for draw primitive.
  1706. func.Encoder.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" }
  1707. "void"
  1708. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  1709. .startVertex "uint32_t" --- First instance data.
  1710. .num "uint32_t" --- Number of data instances.
  1711. --- Set number of instances for auto generated instances use in conjuction
  1712. --- with gl_InstanceID.
  1713. ---
  1714. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1715. ---
  1716. func.Encoder.setInstanceCount
  1717. "void"
  1718. .numInstances "uint32_t" -- Number of instances.
  1719. --- Set texture stage for draw primitive.
  1720. func.Encoder.setTexture
  1721. "void"
  1722. .stage "uint8_t" --- Texture unit.
  1723. .sampler "UniformHandle" --- Program sampler.
  1724. .handle "TextureHandle" --- Texture handle.
  1725. .flags "uint32_t" --- Texture sampling mode. Default value UINT32_MAX uses
  1726. { default = UINT32_MAX } --- texture sampling settings from the texture.
  1727. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1728. --- mode.
  1729. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1730. --- sampling.
  1731. --- Submit an empty primitive for rendering. Uniforms and draw state
  1732. --- will be applied but no geometry will be submitted.
  1733. ---
  1734. --- @remark
  1735. --- These empty draw calls will sort before ordinary draw calls.
  1736. ---
  1737. func.Encoder.touch
  1738. "void"
  1739. .id "ViewId" --- View id.
  1740. --- Submit primitive for rendering.
  1741. func.Encoder.submit
  1742. "void"
  1743. .id "ViewId" --- View id.
  1744. .program "ProgramHandle" --- Program.
  1745. .depth "uint32_t" --- Depth for sorting.
  1746. { default = 0 }
  1747. .preserveState "bool" --- Preserve internal draw state for next draw call submit.
  1748. { default = false }
  1749. --- Submit primitive with occlusion query for rendering.
  1750. func.Encoder.submit { cname = "submit_occlusion_query" }
  1751. "void"
  1752. .id "ViewId" --- View id.
  1753. .program "ProgramHandle" --- Program.
  1754. .occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
  1755. .depth "uint32_t" --- Depth for sorting.
  1756. { default = 0 }
  1757. .preserveState "bool" --- Preserve internal draw state for next draw call submit.
  1758. { default = false }
  1759. --- Submit primitive for rendering with index and instance data info from
  1760. --- indirect buffer.
  1761. func.Encoder.submit { cname = "submit_indirect" }
  1762. "void"
  1763. .id "ViewId" --- View id.
  1764. .program "ProgramHandle" --- Program.
  1765. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  1766. .start "uint16_t" --- First element in indirect buffer.
  1767. { default = 0 }
  1768. .num "uint16_t" --- Number of dispatches.
  1769. { default = 1 }
  1770. .depth "uint32_t" --- Depth for sorting.
  1771. { default = 0 }
  1772. .preserveState "bool" --- Preserve internal draw state for next draw call submit.
  1773. { default = false }
  1774. --- Set compute index buffer.
  1775. func.Encoder.setBuffer { cname = "set_compute_index_buffer" }
  1776. "void"
  1777. .stage "uint8_t" --- Compute stage.
  1778. .handle "IndexBufferHandle" --- Index buffer handle.
  1779. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  1780. --- Set compute vertex buffer.
  1781. func.Encoder.setBuffer { cname = "set_compute_vertex_buffer" }
  1782. "void"
  1783. .stage "uint8_t" --- Compute stage.
  1784. .handle "VertexBufferHandle" --- Vertex buffer handle.
  1785. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  1786. --- Set compute dynamic index buffer.
  1787. func.Encoder.setBuffer { cname = "set_compute_dynamic_index_buffer" }
  1788. "void"
  1789. .stage "uint8_t" --- Compute stage.
  1790. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  1791. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  1792. --- Set compute dynamic vertex buffer.
  1793. func.Encoder.setBuffer { cname = "set_compute_dynamic_vertex_buffer" }
  1794. "void"
  1795. .stage "uint8_t" --- Compute stage.
  1796. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  1797. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  1798. --- Set compute indirect buffer.
  1799. func.Encoder.setBuffer { cname = "set_compute_indirect_buffer" }
  1800. "void"
  1801. .stage "uint8_t" --- Compute stage.
  1802. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  1803. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  1804. --- Set compute image from texture.
  1805. func.Encoder.setImage
  1806. "void"
  1807. .stage "uint8_t" --- Compute stage.
  1808. .handle "TextureHandle" --- Texture handle.
  1809. .mip "uint8_t" --- Mip level.
  1810. .access "Access::Enum" --- Image access. See `Access::Enum`.
  1811. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1812. { default = "TextureFormat::Count" }
  1813. --- Dispatch compute.
  1814. func.Encoder.dispatch
  1815. "void"
  1816. .id "ViewId" --- View id.
  1817. .program "ProgramHandle" --- Compute program.
  1818. .numX "uint32_t" --- Number of groups X.
  1819. { deafult = 1 }
  1820. .numY "uint32_t" --- Number of groups Y.
  1821. { deafult = 1 }
  1822. .numZ "uint32_t" --- Number of groups Z.
  1823. { deafult = 1 }
  1824. --- Dispatch compute indirect.
  1825. func.Encoder.dispatch { cname = "dispatch_indirect" }
  1826. "void"
  1827. .id "ViewId" --- View id.
  1828. .program "ProgramHandle" --- Compute program.
  1829. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  1830. .start "uint16_t" --- First element in indirect buffer.
  1831. { deafult = 0 }
  1832. .num "uint16_t" --- Number of dispatches.
  1833. { deafult = 1 }
  1834. --- Discard all previously set state for draw or compute call.
  1835. func.Encoder.discard
  1836. "void"
  1837. --- Blit 2D texture region between two 2D textures.
  1838. ---
  1839. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  1840. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  1841. ---
  1842. func.Encoder.blit { cpponly }
  1843. "void"
  1844. .id "ViewId" --- View id.
  1845. .dst "TextureHandle" --- Destination texture handle.
  1846. .dstX "uint16_t" --- Destination texture X position.
  1847. .dstY "uint16_t" --- Destination texture Y position.
  1848. .src "TextureHandle" --- Source texture handle.
  1849. .srcX "uint16_t" --- Source texture X position.
  1850. { default = 0 }
  1851. .srcY "uint16_t" --- Source texture Y position.
  1852. { default = 0 }
  1853. .width "uint16_t" --- Width of region.
  1854. { default = UINT16_MAX }
  1855. .height "uint16_t" --- Height of region.
  1856. { default = UINT16_MAX }
  1857. --- Blit 2D texture region between two 2D textures.
  1858. ---
  1859. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  1860. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  1861. ---
  1862. func.Encoder.blit
  1863. "void"
  1864. .id "ViewId" --- View id.
  1865. .dst "TextureHandle" --- Destination texture handle.
  1866. .dstMip "uint8_t" --- Destination texture mip level.
  1867. .dstX "uint16_t" --- Destination texture X position.
  1868. .dstY "uint16_t" --- Destination texture Y position.
  1869. .dstZ "uint16_t" --- If texture is 2D this argument should be 0. If destination texture is cube
  1870. --- this argument represents destination texture cube face. For 3D texture this argument
  1871. --- represents destination texture Z position.
  1872. .src "TextureHandle" --- Source texture handle.
  1873. .srcMip "uint8_t" --- Source texture mip level.
  1874. { default = 0 }
  1875. .srcX "uint16_t" --- Source texture X position.
  1876. { default = 0 }
  1877. .srcY "uint16_t" --- Source texture Y position.
  1878. { default = 0 }
  1879. .srcZ "uint16_t" --- If texture is 2D this argument should be 0. If source texture is cube
  1880. --- this argument represents source texture cube face. For 3D texture this argument
  1881. --- represents source texture Z position.
  1882. { default = 0 }
  1883. .width "uint16_t" --- Width of region.
  1884. { default = UINT16_MAX }
  1885. .height "uint16_t" --- Height of region.
  1886. { default = UINT16_MAX }
  1887. .depth "uint16_t" --- If texture is 3D this argument represents depth of region, otherwise it's
  1888. --- unused.
  1889. { default = UINT16_MAX }
  1890. --- Request screen shot of window back buffer.
  1891. ---
  1892. --- @remarks
  1893. --- `bgfx::CallbackI::screenShot` must be implemented.
  1894. --- @attention Frame buffer handle must be created with OS' target native window handle.
  1895. ---
  1896. func.requestScreenShot
  1897. "void"
  1898. .handle "FrameBufferHandle" --- Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  1899. --- made for main window back buffer.
  1900. .filePath "const char*" --- Will be passed to `bgfx::CallbackI::screenShot` callback.
  1901. --- Render frame.
  1902. ---
  1903. --- @attention `bgfx::renderFrame` is blocking call. It waits for
  1904. --- `bgfx::frame` to be called from API thread to process frame.
  1905. --- If timeout value is passed call will timeout and return even
  1906. --- if `bgfx::frame` is not called.
  1907. ---
  1908. --- @warning This call should be only used on platforms that don't
  1909. --- allow creating separate rendering thread. If it is called before
  1910. --- to bgfx::init, render thread won't be created by bgfx::init call.
  1911. ---
  1912. func.renderFrame
  1913. "RenderFrame::Enum" --- Current renderer context state. See: `bgfx::RenderFrame`.
  1914. .msecs "int32_t" --- Timeout in milliseconds.
  1915. { default = -1 }
  1916. --- Set platform data.
  1917. ---
  1918. --- @warning Must be called before `bgfx::init`.
  1919. ---
  1920. func.setPlatformData
  1921. "void"
  1922. .data "const PlatformData &" --- Platform data.
  1923. --- Get internal data for interop.
  1924. ---
  1925. --- @attention It's expected you understand some bgfx internals before you
  1926. --- use this call.
  1927. ---
  1928. --- @warning Must be called only on render thread.
  1929. ---
  1930. func.getInternalData
  1931. "const InternalData*" --- Internal data.
  1932. --- Override internal texture with externally created texture. Previously
  1933. --- created internal texture will released.
  1934. ---
  1935. --- @attention It's expected you understand some bgfx internals before you
  1936. --- use this call.
  1937. ---
  1938. --- @warning Must be called only on render thread.
  1939. ---
  1940. func.overrideInternal { cname = "override_internal_texture_ptr" }
  1941. "uintptr_t" --- Native API pointer to texture. If result is 0, texture is not created
  1942. --- yet from the main thread.
  1943. .handle "TextureHandle" --- Texture handle.
  1944. .ptr "uintptr_t" --- Native API pointer to texture.
  1945. --- Override internal texture by creating new texture. Previously created
  1946. --- internal texture will released.
  1947. ---
  1948. --- @attention It's expected you understand some bgfx internals before you
  1949. --- use this call.
  1950. ---
  1951. --- @param[in] _handle Texture handle.
  1952. --- @param[in] _width Width.
  1953. --- @param[in] _height Height.
  1954. --- @param[in] _numMips Number of mip-maps.
  1955. --- @param[in] _format Texture format. See: `TextureFormat::Enum`.
  1956. --- @param[in] _flags Default texture sampling mode is linear, and wrap mode
  1957. --- is repeat.
  1958. --- - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1959. --- mode.
  1960. --- - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1961. --- sampling.
  1962. ---
  1963. --- @returns Native API pointer to texture. If result is 0, texture is not created yet from the
  1964. --- main thread.
  1965. ---
  1966. --- @warning Must be called only on render thread.
  1967. ---
  1968. func.overrideInternal { cname = "override_internal_texture" }
  1969. "uintptr_t" --- Native API pointer to texture. If result is 0, texture is not created
  1970. --- yet from the main thread.
  1971. .handle "TextureHandle" --- Texture handle.
  1972. .width "uint16_t" --- Width.
  1973. .height "uint16_t" --- Height.
  1974. .numMips "uint8_t" --- Number of mip-maps.
  1975. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  1976. .flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1977. --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1978. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1979. --- mode.
  1980. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1981. --- sampling.
  1982. -- Legacy API:
  1983. --- Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1984. --- graphics debugging tools.
  1985. func.setMarker
  1986. "void"
  1987. .marker "const char*" --- Marker string.
  1988. --- Set render states for draw primitive.
  1989. ---
  1990. --- @remarks
  1991. --- 1. To setup more complex states use:
  1992. --- `BGFX_STATE_ALPHA_REF(_ref)`,
  1993. --- `BGFX_STATE_POINT_SIZE(_size)`,
  1994. --- `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1995. --- `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1996. --- `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1997. --- `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1998. --- 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1999. --- equation is specified.
  2000. ---
  2001. func.setState
  2002. "void"
  2003. .state "uint64_t" --- State flags. Default state for primitive type is
  2004. --- triangles. See: `BGFX_STATE_DEFAULT`.
  2005. --- - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  2006. --- - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  2007. --- - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  2008. --- - `BGFX_STATE_CULL_*` - Backface culling mode.
  2009. --- - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  2010. --- - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  2011. --- - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  2012. .rgba "uint32_t" --- Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  2013. --- `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  2014. { default = 0 }
  2015. --- Set condition for rendering.
  2016. func.setCondition
  2017. "void"
  2018. .handle "OcclusionQueryHandle" --- Occlusion query handle.
  2019. .visible "bool" --- Render if occlusion query is visible.
  2020. --- Set stencil test state.
  2021. func.setStencil
  2022. "void"
  2023. .fstencil "uint32_t" --- Front stencil state.
  2024. .bstencil "uint32_t" --- Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  2025. --- _fstencil is applied to both front and back facing primitives.
  2026. { default = "BGFX_STENCIL_NONE" }
  2027. --- Set scissor for draw primitive.
  2028. ---
  2029. --- @remark
  2030. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  2031. ---
  2032. func.setScissor
  2033. "uint16_t" --- Scissor cache index.
  2034. .x "uint16_t" --- Position x from the left corner of the window.
  2035. .y "uint16_t" --- Position y from the top corner of the window.
  2036. .width "uint16_t" --- Width of view scissor region.
  2037. .height "uint16_t" --- Height of view scissor region.
  2038. --- Set scissor from cache for draw primitive.
  2039. ---
  2040. --- @remark
  2041. --- To scissor for all primitives in view see `bgfx::setViewScissor`.
  2042. ---
  2043. func.setScissor { cname = "set_scissor_cached" }
  2044. "void"
  2045. .cache "uint16_t" --- Index in scissor cache.
  2046. { default = UINT16_MAX }
  2047. --- Set model matrix for draw primitive. If it is not called,
  2048. --- the model will be rendered with an identity model matrix.
  2049. func.setTransform
  2050. "uint32_t" --- Index into matrix cache in case the same model matrix has
  2051. --- to be used for other draw primitive call.
  2052. .mtx "const void*" --- Pointer to first matrix in array.
  2053. .num "uint16_t" --- Number of matrices in array.
  2054. --- Set model matrix from matrix cache for draw primitive.
  2055. func.setTransform { cname = "set_transform_cached" }
  2056. "void"
  2057. .cache "uint32_t" --- Index in matrix cache.
  2058. .num "uint16_t" --- Number of matrices from cache.
  2059. { default = 1 }
  2060. --- Reserve matrices in internal matrix cache.
  2061. ---
  2062. --- @attention Pointer returned can be modifed until `bgfx::frame` is called.
  2063. ---
  2064. func.allocTransform
  2065. "uint32_t" --- Index in matrix cache.
  2066. .transform "Transform*" { out } --- Pointer to `Transform` structure.
  2067. .num "uint16_t" --- Number of matrices.
  2068. --- Set shader uniform parameter for draw primitive.
  2069. func.setUniform
  2070. "void"
  2071. .handle "UniformHandle" --- Uniform.
  2072. .value "const void*" --- Pointer to uniform data.
  2073. .num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
  2074. --- use the _num passed on uniform creation.
  2075. { default = 1 }
  2076. --- Set index buffer for draw primitive.
  2077. func.setIndexBuffer { cpponly }
  2078. "void"
  2079. .handle "IndexBufferHandle" --- Index buffer.
  2080. --- Set index buffer for draw primitive.
  2081. func.setIndexBuffer
  2082. "void"
  2083. .handle "IndexBufferHandle" --- Index buffer.
  2084. .firstIndex "uint32_t" --- First index to render.
  2085. .numIndices "uint32_t" --- Number of indices to render.
  2086. --- Set index buffer for draw primitive.
  2087. func.setIndexBuffer { cpponly }
  2088. "void"
  2089. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2090. --- Set index buffer for draw primitive.
  2091. func.setIndexBuffer { cname = "set_dynamic_index_buffer" }
  2092. "void"
  2093. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer.
  2094. .firstIndex "uint32_t" --- First index to render.
  2095. .numIndices "uint32_t" --- Number of indices to render.
  2096. --- Set index buffer for draw primitive.
  2097. func.setIndexBuffer { cpponly }
  2098. "void"
  2099. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2100. --- Set index buffer for draw primitive.
  2101. func.setIndexBuffer { cname = "set_transient_index_buffer" }
  2102. "void"
  2103. .tib "const TransientIndexBuffer*" --- Transient index buffer.
  2104. .firstIndex "uint32_t" --- First index to render.
  2105. .numIndices "uint32_t" --- Number of indices to render.
  2106. --- Set vertex buffer for draw primitive.
  2107. func.setVertexBuffer { cpponly }
  2108. "void"
  2109. .stream "uint8_t" --- Vertex stream.
  2110. .handle "VertexBufferHandle" --- Vertex buffer.
  2111. --- Set vertex buffer for draw primitive.
  2112. func.setVertexBuffer
  2113. "void"
  2114. .stream "uint8_t" --- Vertex stream.
  2115. .handle "VertexBufferHandle" --- Vertex buffer.
  2116. .startVertex "uint32_t" --- First vertex to render.
  2117. .numVertices "uint32_t" --- Number of vertices to render.
  2118. --- Set vertex buffer for draw primitive.
  2119. func.setVertexBuffer { cpponly }
  2120. "void"
  2121. .stream "uint8_t" --- Vertex stream.
  2122. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2123. --- Set vertex buffer for draw primitive.
  2124. func.setVertexBuffer { cname = "set_dynamic_vertex_buffer" }
  2125. "void"
  2126. .stream "uint8_t" --- Vertex stream.
  2127. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2128. .startVertex "uint32_t" --- First vertex to render.
  2129. .numVertices "uint32_t" --- Number of vertices to render.
  2130. --- Set vertex buffer for draw primitive.
  2131. func.setVertexBuffer { cpponly }
  2132. "void"
  2133. .stream "uint8_t" --- Vertex stream.
  2134. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2135. --- Set vertex buffer for draw primitive.
  2136. func.setVertexBuffer { cname = "set_transient_vertex_buffer" }
  2137. "void"
  2138. .stream "uint8_t" --- Vertex stream.
  2139. .tvb "const TransientVertexBuffer*" --- Transient vertex buffer.
  2140. .startVertex "uint32_t" --- First vertex to render.
  2141. .numVertices "uint32_t" --- Number of vertices to render.
  2142. --- Set number of vertices for auto generated vertices use in conjuction
  2143. --- with gl_VertexID.
  2144. ---
  2145. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2146. ---
  2147. func.setVertexCount
  2148. "void"
  2149. .numVertices "uint32_t" --- Number of vertices.
  2150. --- Set instance data buffer for draw primitive.
  2151. func.setInstanceDataBuffer { cpponly }
  2152. "void"
  2153. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2154. --- Set instance data buffer for draw primitive.
  2155. func.setInstanceDataBuffer
  2156. "void"
  2157. .idb "const InstanceDataBuffer*" --- Transient instance data buffer.
  2158. .start "uint32_t" --- First instance data.
  2159. .num "uint32_t" --- Number of data instances.
  2160. --- Set instance data buffer for draw primitive.
  2161. func.setInstanceDataBuffer { cpponly }
  2162. "void"
  2163. .handle "VertexBufferHandle" --- Vertex buffer.
  2164. --- Set instance data buffer for draw primitive.
  2165. func.setInstanceDataBuffer { cname = "set_instance_data_from_vertex_buffer" }
  2166. "void"
  2167. .handle "VertexBufferHandle" --- Vertex buffer.
  2168. .startVertex "uint32_t" --- First instance data.
  2169. .num "uint32_t" --- Number of data instances.
  2170. --- Set instance data buffer for draw primitive.
  2171. func.setInstanceDataBuffer { cpponly }
  2172. "void"
  2173. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2174. --- Set instance data buffer for draw primitive.
  2175. func.setInstanceDataBuffer { cname = "set_instance_data_from_dynamic_vertex_buffer" }
  2176. "void"
  2177. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer.
  2178. .startVertex "uint32_t" --- First instance data.
  2179. .num "uint32_t" --- Number of data instances.
  2180. --- Set number of instances for auto generated instances use in conjuction
  2181. --- with gl_InstanceID.
  2182. ---
  2183. --- @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  2184. ---
  2185. func.setInstanceCount
  2186. "void"
  2187. .numInstances "uint32_t" -- Number of instances.
  2188. --- Set texture stage for draw primitive.
  2189. func.setTexture
  2190. "void"
  2191. .stage "uint8_t" --- Texture unit.
  2192. .sampler "UniformHandle" --- Program sampler.
  2193. .handle "TextureHandle" --- Texture handle.
  2194. .flags "uint32_t" --- Texture sampling mode. Default value UINT32_MAX uses
  2195. { default = UINT32_MAX } --- texture sampling settings from the texture.
  2196. --- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2197. --- mode.
  2198. --- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2199. --- sampling.
  2200. --- Submit an empty primitive for rendering. Uniforms and draw state
  2201. --- will be applied but no geometry will be submitted.
  2202. ---
  2203. --- @remark
  2204. --- These empty draw calls will sort before ordinary draw calls.
  2205. ---
  2206. func.touch
  2207. "void"
  2208. .id "ViewId" --- View id.
  2209. --- Submit primitive for rendering.
  2210. func.submit
  2211. "void"
  2212. .id "ViewId" --- View id.
  2213. .program "ProgramHandle" --- Program.
  2214. .depth "uint32_t" --- Depth for sorting.
  2215. { default = 0 }
  2216. .preserveState "bool" --- Preserve internal draw state for next draw call submit.
  2217. { default = false }
  2218. --- Submit primitive with occlusion query for rendering.
  2219. func.submit { cname = "submit_occlusion_query" }
  2220. "void"
  2221. .id "ViewId" --- View id.
  2222. .program "ProgramHandle" --- Program.
  2223. .occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
  2224. .depth "uint32_t" --- Depth for sorting.
  2225. { default = 0 }
  2226. .preserveState "bool" --- Preserve internal draw state for next draw call submit.
  2227. { default = false }
  2228. --- Submit primitive for rendering with index and instance data info from
  2229. --- indirect buffer.
  2230. func.submit { cname = "submit_indirect" }
  2231. "void"
  2232. .id "ViewId" --- View id.
  2233. .program "ProgramHandle" --- Program.
  2234. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2235. .start "uint16_t" --- First element in indirect buffer.
  2236. { default = 0 }
  2237. .num "uint16_t" --- Number of dispatches.
  2238. { default = 1 }
  2239. .depth "uint32_t" --- Depth for sorting.
  2240. { default = 0 }
  2241. .preserveState "bool" --- Preserve internal draw state for next draw call submit.
  2242. { default = false }
  2243. --- Set compute index buffer.
  2244. func.setBuffer { cname = "set_compute_index_buffer" }
  2245. "void"
  2246. .stage "uint8_t" --- Compute stage.
  2247. .handle "IndexBufferHandle" --- Index buffer handle.
  2248. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2249. --- Set compute vertex buffer.
  2250. func.setBuffer { cname = "set_compute_vertex_buffer" }
  2251. "void"
  2252. .stage "uint8_t" --- Compute stage.
  2253. .handle "VertexBufferHandle" --- Vertex buffer handle.
  2254. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2255. --- Set compute dynamic index buffer.
  2256. func.setBuffer { cname = "set_compute_dynamic_index_buffer" }
  2257. "void"
  2258. .stage "uint8_t" --- Compute stage.
  2259. .handle "DynamicIndexBufferHandle" --- Dynamic index buffer handle.
  2260. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2261. --- Set compute dynamic vertex buffer.
  2262. func.setBuffer { cname = "set_compute_dynamic_vertex_buffer" }
  2263. "void"
  2264. .stage "uint8_t" --- Compute stage.
  2265. .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle.
  2266. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2267. --- Set compute indirect buffer.
  2268. func.setBuffer { cname = "set_compute_indirect_buffer" }
  2269. "void"
  2270. .stage "uint8_t" --- Compute stage.
  2271. .handle "IndirectBufferHandle" --- Indirect buffer handle.
  2272. .access "Access::Enum" --- Buffer access. See `Access::Enum`.
  2273. --- Set compute image from texture.
  2274. func.setImage
  2275. "void"
  2276. .stage "uint8_t" --- Compute stage.
  2277. .handle "TextureHandle" --- Texture handle.
  2278. .mip "uint8_t" --- Mip level.
  2279. .access "Access::Enum" --- Image access. See `Access::Enum`.
  2280. .format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
  2281. { default = "TextureFormat::Count" }
  2282. --- Dispatch compute.
  2283. func.dispatch
  2284. "void"
  2285. .id "ViewId" --- View id.
  2286. .program "ProgramHandle" --- Compute program.
  2287. .numX "uint32_t" --- Number of groups X.
  2288. { deafult = 1 }
  2289. .numY "uint32_t" --- Number of groups Y.
  2290. { deafult = 1 }
  2291. .numZ "uint32_t" --- Number of groups Z.
  2292. { deafult = 1 }
  2293. --- Dispatch compute indirect.
  2294. func.dispatch { cname = "dispatch_indirect" }
  2295. "void"
  2296. .id "ViewId" --- View id.
  2297. .program "ProgramHandle" --- Compute program.
  2298. .indirectHandle "IndirectBufferHandle" --- Indirect buffer.
  2299. .start "uint16_t" --- First element in indirect buffer.
  2300. { deafult = 0 }
  2301. .num "uint16_t" --- Number of dispatches.
  2302. { deafult = 1 }
  2303. --- Discard all previously set state for draw or compute call.
  2304. func.discard
  2305. "void"
  2306. --- Blit 2D texture region between two 2D textures.
  2307. ---
  2308. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2309. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2310. ---
  2311. func.blit { cpponly }
  2312. "void"
  2313. .id "ViewId" --- View id.
  2314. .dst "TextureHandle" --- Destination texture handle.
  2315. .dstX "uint16_t" --- Destination texture X position.
  2316. .dstY "uint16_t" --- Destination texture Y position.
  2317. .src "TextureHandle" --- Source texture handle.
  2318. .srcX "uint16_t" --- Source texture X position.
  2319. { default = 0 }
  2320. .srcY "uint16_t" --- Source texture Y position.
  2321. { default = 0 }
  2322. .width "uint16_t" --- Width of region.
  2323. { default = UINT16_MAX }
  2324. .height "uint16_t" --- Height of region.
  2325. { default = UINT16_MAX }
  2326. --- Blit 2D texture region between two 2D textures.
  2327. ---
  2328. --- @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  2329. --- @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  2330. ---
  2331. func.blit
  2332. "void"
  2333. .id "ViewId" --- View id.
  2334. .dst "TextureHandle" --- Destination texture handle.
  2335. .dstMip "uint8_t" --- Destination texture mip level.
  2336. .dstX "uint16_t" --- Destination texture X position.
  2337. .dstY "uint16_t" --- Destination texture Y position.
  2338. .dstZ "uint16_t" --- If texture is 2D this argument should be 0. If destination texture is cube
  2339. --- this argument represents destination texture cube face. For 3D texture this argument
  2340. --- represents destination texture Z position.
  2341. .src "TextureHandle" --- Source texture handle.
  2342. .srcMip "uint8_t" --- Source texture mip level.
  2343. { default = 0 }
  2344. .srcX "uint16_t" --- Source texture X position.
  2345. { default = 0 }
  2346. .srcY "uint16_t" --- Source texture Y position.
  2347. { default = 0 }
  2348. .srcZ "uint16_t" --- If texture is 2D this argument should be 0. If source texture is cube
  2349. --- this argument represents source texture cube face. For 3D texture this argument
  2350. --- represents source texture Z position.
  2351. { default = 0 }
  2352. .width "uint16_t" --- Width of region.
  2353. { default = UINT16_MAX }
  2354. .height "uint16_t" --- Height of region.
  2355. { default = UINT16_MAX }
  2356. .depth "uint16_t" --- If texture is 3D this argument represents depth of region, otherwise it's
  2357. --- unused.
  2358. { default = UINT16_MAX }