funcs.d 173 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342
  1. /*
  2. *
  3. * AUTO GENERATED! DO NOT EDIT!
  4. *
  5. */
  6. module bindbc.bgfx.funcs;
  7. private import bindbc.bgfx.types;
  8. extern(C) @nogc nothrow:
  9. version(BindBgfx_Static)
  10. {
  11. /**
  12. * Init attachment.
  13. * Params:
  14. * _handle = Render target texture handle.
  15. * _access = Access. See `Access::Enum`.
  16. * _layer = Cubemap side or depth layer/slice.
  17. * _mip = Mip level.
  18. * _resolve = Resolve flags. See: `BGFX_RESOLVE_*`
  19. */
  20. void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _mip, byte _resolve);
  21. /**
  22. * Start VertexLayout.
  23. */
  24. bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType);
  25. /**
  26. * Add attribute to VertexLayout.
  27. * Remarks: Must be called between begin/end.
  28. * Params:
  29. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  30. * _num = Number of elements 1, 2, 3 or 4.
  31. * _type = Element type.
  32. * _normalized = When using fixed point AttribType (f.e. Uint8)
  33. * value will be normalized for vertex shader usage. When normalized
  34. * is set to true, AttribType::Uint8 value in range 0-255 will be
  35. * in range 0.0-1.0 in vertex shader.
  36. * _asInt = Packaging rule for vertexPack, vertexUnpack, and
  37. * vertexConvert for AttribType::Uint8 and AttribType::Int16.
  38. * Unpacking code must be implemented inside vertex shader.
  39. */
  40. bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, byte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
  41. /**
  42. * Decode attribute.
  43. * Params:
  44. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  45. * _num = Number of elements.
  46. * _type = Element type.
  47. * _normalized = Attribute is normalized.
  48. * _asInt = Attribute is packed as int.
  49. */
  50. void bgfx_vertex_layout_decode(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, byte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt);
  51. /**
  52. * Returns true if VertexLayout contains attribute.
  53. * Params:
  54. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  55. */
  56. bool bgfx_vertex_layout_has(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib);
  57. /**
  58. * Skip `_num` bytes in vertex stream.
  59. */
  60. bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, byte _num);
  61. /**
  62. * End VertexLayout.
  63. */
  64. void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this);
  65. /**
  66. * Pack vertex attribute into vertex stream format.
  67. * Params:
  68. * _input = Value to be packed into vertex stream.
  69. * _inputNormalized = `true` if input value is already normalized.
  70. * _attr = Attribute to pack.
  71. * _layout = Vertex stream layout.
  72. * _data = Destination vertex stream where data will be packed.
  73. * _index = Vertex index that will be modified.
  74. */
  75. void bgfx_vertex_pack(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index);
  76. /**
  77. * Unpack vertex attribute from vertex stream format.
  78. * Params:
  79. * _output = Result of unpacking.
  80. * _attr = Attribute to unpack.
  81. * _layout = Vertex stream layout.
  82. * _data = Source vertex stream from where data will be unpacked.
  83. * _index = Vertex index that will be unpacked.
  84. */
  85. void bgfx_vertex_unpack(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index);
  86. /**
  87. * Converts vertex stream data from one vertex stream format to another.
  88. * Params:
  89. * _dstLayout = Destination vertex stream layout.
  90. * _dstData = Destination vertex stream.
  91. * _srcLayout = Source vertex stream layout.
  92. * _srcData = Source vertex stream data.
  93. * _num = Number of vertices to convert from source to destination.
  94. */
  95. void bgfx_vertex_convert(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num);
  96. /**
  97. * Weld vertices.
  98. * Params:
  99. * _output = Welded vertices remapping table. The size of buffer
  100. * must be the same as number of vertices.
  101. * _layout = Vertex stream layout.
  102. * _data = Vertex stream.
  103. * _num = Number of vertices in vertex stream.
  104. * _epsilon = Error tolerance for vertex position comparison.
  105. */
  106. ushort bgfx_weld_vertices(ushort* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, ushort _num, float _epsilon);
  107. /**
  108. * Convert index buffer for use with different primitive topologies.
  109. * Params:
  110. * _conversion = Conversion type, see `TopologyConvert::Enum`.
  111. * _dst = Destination index buffer. If this argument is NULL
  112. * function will return number of indices after conversion.
  113. * _dstSize = Destination index buffer in bytes. It must be
  114. * large enough to contain output indices. If destination size is
  115. * insufficient index buffer will be truncated.
  116. * _indices = Source indices.
  117. * _numIndices = Number of input indices.
  118. * _index32 = Set to `true` if input indices are 32-bit.
  119. */
  120. uint bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32);
  121. /**
  122. * Sort indices.
  123. * Params:
  124. * _sort = Sort order, see `TopologySort::Enum`.
  125. * _dst = Destination index buffer.
  126. * _dstSize = Destination index buffer in bytes. It must be
  127. * large enough to contain output indices. If destination size is
  128. * insufficient index buffer will be truncated.
  129. * _dir = Direction (vector must be normalized).
  130. * _pos = Position.
  131. * _vertices = Pointer to first vertex represented as
  132. * float x, y, z. Must contain at least number of vertices
  133. * referencende by index buffer.
  134. * _stride = Vertex stride.
  135. * _indices = Source indices.
  136. * _numIndices = Number of input indices.
  137. * _index32 = Set to `true` if input indices are 32-bit.
  138. */
  139. void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32);
  140. /**
  141. * Returns supported backend API renderers.
  142. * Params:
  143. * _max = Maximum number of elements in _enum array.
  144. * _enum = Array where supported renderers will be written.
  145. */
  146. byte bgfx_get_supported_renderers(byte _max, bgfx_renderer_type_t* _enum);
  147. /**
  148. * Returns name of renderer.
  149. * Params:
  150. * _type = Renderer backend type. See: `bgfx::RendererType`
  151. */
  152. const(char)* bgfx_get_renderer_name(bgfx_renderer_type_t _type);
  153. void bgfx_init_ctor(bgfx_init_t* _init);
  154. /**
  155. * Initialize bgfx library.
  156. * Params:
  157. * _init = Initialization parameters. See: `bgfx::Init` for more info.
  158. */
  159. bool bgfx_init(const(bgfx_init_t)* _init);
  160. /**
  161. * Shutdown bgfx library.
  162. */
  163. void bgfx_shutdown();
  164. /**
  165. * Reset graphic settings and back-buffer size.
  166. * Attention: This call doesn't actually change window size, it just
  167. * resizes back-buffer. Windowing code has to change window size.
  168. * Params:
  169. * _width = Back-buffer width.
  170. * _height = Back-buffer height.
  171. * _flags = See: `BGFX_RESET_*` for more info.
  172. * - `BGFX_RESET_NONE` - No reset flags.
  173. * - `BGFX_RESET_FULLSCREEN` - Not supported yet.
  174. * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
  175. * - `BGFX_RESET_VSYNC` - Enable V-Sync.
  176. * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
  177. * - `BGFX_RESET_CAPTURE` - Begin screen capture.
  178. * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
  179. * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
  180. * occurs. Default behavior is that flip occurs before rendering new
  181. * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  182. * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer.
  183. * _format = Texture format. See: `TextureFormat::Enum`.
  184. */
  185. void bgfx_reset(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format);
  186. /**
  187. * Advance to next frame. When using multithreaded renderer, this call
  188. * just swaps internal buffers, kicks render thread, and returns. In
  189. * singlethreaded renderer this call does frame rendering.
  190. * Params:
  191. * _capture = Capture frame with graphics debugger.
  192. */
  193. uint bgfx_frame(bool _capture);
  194. /**
  195. * Returns current renderer backend API type.
  196. * Remarks:
  197. * Library must be initialized.
  198. */
  199. bgfx_renderer_type_t bgfx_get_renderer_type();
  200. /**
  201. * Returns renderer capabilities.
  202. * Remarks:
  203. * Library must be initialized.
  204. */
  205. const(bgfx_caps_t)* bgfx_get_caps();
  206. /**
  207. * Returns performance counters.
  208. * Attention: Pointer returned is valid until `bgfx::frame` is called.
  209. */
  210. const(bgfx_stats_t)* bgfx_get_stats();
  211. /**
  212. * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
  213. * Params:
  214. * _size = Size to allocate.
  215. */
  216. const(bgfx_memory_t)* bgfx_alloc(uint _size);
  217. /**
  218. * Allocate buffer and copy data into it. Data will be freed inside bgfx.
  219. * Params:
  220. * _data = Pointer to data to be copied.
  221. * _size = Size of data to be copied.
  222. */
  223. const(bgfx_memory_t)* bgfx_copy(const(void)* _data, uint _size);
  224. /**
  225. * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  226. * doesn't allocate memory for data. It just copies the _data pointer. You
  227. * can pass `ReleaseFn` function pointer to release this memory after it's
  228. * consumed, otherwise you must make sure _data is available for at least 2
  229. * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  230. * from any thread.
  231. * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
  232. * Params:
  233. * _data = Pointer to data.
  234. * _size = Size of data.
  235. */
  236. const(bgfx_memory_t)* bgfx_make_ref(const(void)* _data, uint _size);
  237. /**
  238. * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  239. * doesn't allocate memory for data. It just copies the _data pointer. You
  240. * can pass `ReleaseFn` function pointer to release this memory after it's
  241. * consumed, otherwise you must make sure _data is available for at least 2
  242. * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  243. * from any thread.
  244. * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
  245. * Params:
  246. * _data = Pointer to data.
  247. * _size = Size of data.
  248. * _releaseFn = Callback function to release memory after use.
  249. * _userData = User data to be passed to callback function.
  250. */
  251. const(bgfx_memory_t)* bgfx_make_ref_release(const(void)* _data, uint _size, void* _releaseFn, void* _userData);
  252. /**
  253. * Set debug flags.
  254. * Params:
  255. * _debug = Available flags:
  256. * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
  257. * all rendering calls will be skipped. This is useful when profiling
  258. * to quickly assess potential bottlenecks between CPU and GPU.
  259. * - `BGFX_DEBUG_PROFILER` - Enable profiler.
  260. * - `BGFX_DEBUG_STATS` - Display internal statistics.
  261. * - `BGFX_DEBUG_TEXT` - Display debug text.
  262. * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
  263. * primitives will be rendered as lines.
  264. */
  265. void bgfx_set_debug(uint _debug);
  266. /**
  267. * Clear internal debug text buffer.
  268. * Params:
  269. * _attr = Background color.
  270. * _small = Default 8x16 or 8x8 font.
  271. */
  272. void bgfx_dbg_text_clear(byte _attr, bool _small);
  273. /**
  274. * Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
  275. * Params:
  276. * _x = Position x from the left corner of the window.
  277. * _y = Position y from the top corner of the window.
  278. * _attr = Color palette. Where top 4-bits represent index of background, and bottom
  279. * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  280. * _format = `printf` style format.
  281. */
  282. void bgfx_dbg_text_printf(ushort _x, ushort _y, byte _attr, const(char)* _format, ... );
  283. /**
  284. * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
  285. * Params:
  286. * _x = Position x from the left corner of the window.
  287. * _y = Position y from the top corner of the window.
  288. * _attr = Color palette. Where top 4-bits represent index of background, and bottom
  289. * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  290. * _format = `printf` style format.
  291. * _argList = Variable arguments list for format string.
  292. */
  293. void bgfx_dbg_text_vprintf(ushort _x, ushort _y, byte _attr, const(char)* _format, va_list _argList);
  294. /**
  295. * Draw image into internal debug text buffer.
  296. * Params:
  297. * _x = Position x from the left corner of the window.
  298. * _y = Position y from the top corner of the window.
  299. * _width = Image width.
  300. * _height = Image height.
  301. * _data = Raw image data (character/attribute raw encoding).
  302. * _pitch = Image pitch in bytes.
  303. */
  304. void bgfx_dbg_text_image(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch);
  305. /**
  306. * Create static index buffer.
  307. * Params:
  308. * _mem = Index buffer data.
  309. * _flags = Buffer creation flags.
  310. * - `BGFX_BUFFER_NONE` - No flags.
  311. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  312. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  313. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  314. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  315. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  316. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  317. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  318. * buffers.
  319. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  320. * index buffers.
  321. */
  322. bgfx_index_buffer_handle_t bgfx_create_index_buffer(const(bgfx_memory_t)* _mem, ushort _flags);
  323. /**
  324. * Set static index buffer debug name.
  325. * Params:
  326. * _handle = Static index buffer handle.
  327. * _name = Static index buffer name.
  328. * _len = Static index buffer name length (if length is INT32_MAX, it's expected
  329. * that _name is zero terminated string.
  330. */
  331. void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len);
  332. /**
  333. * Destroy static index buffer.
  334. * Params:
  335. * _handle = Static index buffer handle.
  336. */
  337. void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle);
  338. /**
  339. * Create vertex layout.
  340. * Params:
  341. * _layout = Vertex layout.
  342. */
  343. bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const(bgfx_vertex_layout_t)* _layout);
  344. /**
  345. * Destroy vertex layout.
  346. * Params:
  347. * _layoutHandle = Vertex layout handle.
  348. */
  349. void bgfx_destroy_vertex_layout(bgfx_vertex_layout_handle_t _layoutHandle);
  350. /**
  351. * Create static vertex buffer.
  352. * Params:
  353. * _mem = Vertex buffer data.
  354. * _layout = Vertex layout.
  355. * _flags = Buffer creation flags.
  356. * - `BGFX_BUFFER_NONE` - No flags.
  357. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  358. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  359. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  360. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  361. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  362. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  363. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
  364. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
  365. */
  366. bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  367. /**
  368. * Set static vertex buffer debug name.
  369. * Params:
  370. * _handle = Static vertex buffer handle.
  371. * _name = Static vertex buffer name.
  372. * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected
  373. * that _name is zero terminated string.
  374. */
  375. void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len);
  376. /**
  377. * Destroy static vertex buffer.
  378. * Params:
  379. * _handle = Static vertex buffer handle.
  380. */
  381. void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle);
  382. /**
  383. * Create empty dynamic index buffer.
  384. * Params:
  385. * _num = Number of indices.
  386. * _flags = Buffer creation flags.
  387. * - `BGFX_BUFFER_NONE` - No flags.
  388. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  389. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  390. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  391. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  392. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  393. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  394. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  395. * buffers.
  396. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  397. * index buffers.
  398. */
  399. bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint _num, ushort _flags);
  400. /**
  401. * Create dynamic index buffer and initialized it.
  402. * Params:
  403. * _mem = Index buffer data.
  404. * _flags = Buffer creation flags.
  405. * - `BGFX_BUFFER_NONE` - No flags.
  406. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  407. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  408. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  409. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  410. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  411. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  412. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  413. * buffers.
  414. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  415. * index buffers.
  416. */
  417. bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const(bgfx_memory_t)* _mem, ushort _flags);
  418. /**
  419. * Update dynamic index buffer.
  420. * Params:
  421. * _handle = Dynamic index buffer handle.
  422. * _startIndex = Start index.
  423. * _mem = Index buffer data.
  424. */
  425. void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem);
  426. /**
  427. * Destroy dynamic index buffer.
  428. * Params:
  429. * _handle = Dynamic index buffer handle.
  430. */
  431. void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle);
  432. /**
  433. * Create empty dynamic vertex buffer.
  434. * Params:
  435. * _num = Number of vertices.
  436. * _layout = Vertex layout.
  437. * _flags = Buffer creation flags.
  438. * - `BGFX_BUFFER_NONE` - No flags.
  439. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  440. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  441. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  442. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  443. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  444. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  445. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  446. * buffers.
  447. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  448. * index buffers.
  449. */
  450. bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  451. /**
  452. * Create dynamic vertex buffer and initialize it.
  453. * Params:
  454. * _mem = Vertex buffer data.
  455. * _layout = Vertex layout.
  456. * _flags = Buffer creation flags.
  457. * - `BGFX_BUFFER_NONE` - No flags.
  458. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  459. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  460. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  461. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  462. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  463. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  464. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  465. * buffers.
  466. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  467. * index buffers.
  468. */
  469. bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  470. /**
  471. * Update dynamic vertex buffer.
  472. * Params:
  473. * _handle = Dynamic vertex buffer handle.
  474. * _startVertex = Start vertex.
  475. * _mem = Vertex buffer data.
  476. */
  477. void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem);
  478. /**
  479. * Destroy dynamic vertex buffer.
  480. * Params:
  481. * _handle = Dynamic vertex buffer handle.
  482. */
  483. void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle);
  484. /**
  485. * Returns number of requested or maximum available indices.
  486. * Params:
  487. * _num = Number of required indices.
  488. */
  489. uint bgfx_get_avail_transient_index_buffer(uint _num);
  490. /**
  491. * Returns number of requested or maximum available vertices.
  492. * Params:
  493. * _num = Number of required vertices.
  494. * _layout = Vertex layout.
  495. */
  496. uint bgfx_get_avail_transient_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout);
  497. /**
  498. * Returns number of requested or maximum available instance buffer slots.
  499. * Params:
  500. * _num = Number of required instances.
  501. * _stride = Stride per instance.
  502. */
  503. uint bgfx_get_avail_instance_data_buffer(uint _num, ushort _stride);
  504. /**
  505. * Allocate transient index buffer.
  506. * Remarks:
  507. * Only 16-bit index buffer is supported.
  508. * Params:
  509. * _tib = TransientIndexBuffer structure is filled and is valid
  510. * for the duration of frame, and it can be reused for multiple draw
  511. * calls.
  512. * _num = Number of indices to allocate.
  513. */
  514. void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint _num);
  515. /**
  516. * Allocate transient vertex buffer.
  517. * Params:
  518. * _tvb = TransientVertexBuffer structure is filled and is valid
  519. * for the duration of frame, and it can be reused for multiple draw
  520. * calls.
  521. * _num = Number of vertices to allocate.
  522. * _layout = Vertex layout.
  523. */
  524. void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout);
  525. /**
  526. * Check for required space and allocate transient vertex and index
  527. * buffers. If both space requirements are satisfied function returns
  528. * true.
  529. * Remarks:
  530. * Only 16-bit index buffer is supported.
  531. * Params:
  532. * _tvb = TransientVertexBuffer structure is filled and is valid
  533. * for the duration of frame, and it can be reused for multiple draw
  534. * calls.
  535. * _layout = Vertex layout.
  536. * _numVertices = Number of vertices to allocate.
  537. * _tib = TransientIndexBuffer structure is filled and is valid
  538. * for the duration of frame, and it can be reused for multiple draw
  539. * calls.
  540. * _numIndices = Number of indices to allocate.
  541. */
  542. bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices);
  543. /**
  544. * Allocate instance data buffer.
  545. * Params:
  546. * _idb = InstanceDataBuffer structure is filled and is valid
  547. * for duration of frame, and it can be reused for multiple draw
  548. * calls.
  549. * _num = Number of instances.
  550. * _stride = Instance stride. Must be multiple of 16.
  551. */
  552. void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride);
  553. /**
  554. * Create draw indirect buffer.
  555. * Params:
  556. * _num = Number of indirect calls.
  557. */
  558. bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint _num);
  559. /**
  560. * Destroy draw indirect buffer.
  561. * Params:
  562. * _handle = Indirect buffer handle.
  563. */
  564. void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle);
  565. /**
  566. * Create shader from memory buffer.
  567. * Params:
  568. * _mem = Shader binary.
  569. */
  570. bgfx_shader_handle_t bgfx_create_shader(const(bgfx_memory_t)* _mem);
  571. /**
  572. * Returns the number of uniforms and uniform handles used inside a shader.
  573. * Remarks:
  574. * Only non-predefined uniforms are returned.
  575. * Params:
  576. * _handle = Shader handle.
  577. * _uniforms = UniformHandle array where data will be stored.
  578. * _max = Maximum capacity of array.
  579. */
  580. ushort bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max);
  581. /**
  582. * Set shader debug name.
  583. * Params:
  584. * _handle = Shader handle.
  585. * _name = Shader name.
  586. * _len = Shader name length (if length is INT32_MAX, it's expected
  587. * that _name is zero terminated string).
  588. */
  589. void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const(char)* _name, int _len);
  590. /**
  591. * Destroy shader.
  592. * Remarks: Once a shader program is created with _handle,
  593. * it is safe to destroy that shader.
  594. * Params:
  595. * _handle = Shader handle.
  596. */
  597. void bgfx_destroy_shader(bgfx_shader_handle_t _handle);
  598. /**
  599. * Create program with vertex and fragment shaders.
  600. * Params:
  601. * _vsh = Vertex shader.
  602. * _fsh = Fragment shader.
  603. * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
  604. */
  605. bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
  606. /**
  607. * Create program with compute shader.
  608. * Params:
  609. * _csh = Compute shader.
  610. * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
  611. */
  612. bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders);
  613. /**
  614. * Destroy program.
  615. * Params:
  616. * _handle = Program handle.
  617. */
  618. void bgfx_destroy_program(bgfx_program_handle_t _handle);
  619. /**
  620. * Validate texture parameters.
  621. * Params:
  622. * _depth = Depth dimension of volume texture.
  623. * _cubeMap = Indicates that texture contains cubemap.
  624. * _numLayers = Number of layers in texture array.
  625. * _format = Texture format. See: `TextureFormat::Enum`.
  626. * _flags = Texture flags. See `BGFX_TEXTURE_*`.
  627. */
  628. bool bgfx_is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
  629. /**
  630. * Calculate amount of memory required for texture.
  631. * Params:
  632. * _info = Resulting texture info structure. See: `TextureInfo`.
  633. * _width = Width.
  634. * _height = Height.
  635. * _depth = Depth dimension of volume texture.
  636. * _cubeMap = Indicates that texture contains cubemap.
  637. * _hasMips = Indicates that texture contains full mip-map chain.
  638. * _numLayers = Number of layers in texture array.
  639. * _format = Texture format. See: `TextureFormat::Enum`.
  640. */
  641. void bgfx_calc_texture_size(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format);
  642. /**
  643. * Create texture from memory buffer.
  644. * Params:
  645. * _mem = DDS, KTX or PVR texture binary data.
  646. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  647. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  648. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  649. * mode.
  650. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  651. * sampling.
  652. * _skip = Skip top level mips when parsing texture.
  653. * _info = When non-`NULL` is specified it returns parsed texture information.
  654. */
  655. bgfx_texture_handle_t bgfx_create_texture(const(bgfx_memory_t)* _mem, ulong _flags, byte _skip, bgfx_texture_info_t* _info);
  656. /**
  657. * Create 2D texture.
  658. * Params:
  659. * _width = Width.
  660. * _height = Height.
  661. * _hasMips = Indicates that texture contains full mip-map chain.
  662. * _numLayers = Number of layers in texture array. Must be 1 if caps
  663. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  664. * _format = Texture format. See: `TextureFormat::Enum`.
  665. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  666. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  667. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  668. * mode.
  669. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  670. * sampling.
  671. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  672. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  673. * 1, expected memory layout is texture and all mips together for each array element.
  674. */
  675. bgfx_texture_handle_t bgfx_create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
  676. /**
  677. * Create texture with size based on backbuffer ratio. Texture will maintain ratio
  678. * if back buffer resolution changes.
  679. * Params:
  680. * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
  681. * _hasMips = Indicates that texture contains full mip-map chain.
  682. * _numLayers = Number of layers in texture array. Must be 1 if caps
  683. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  684. * _format = Texture format. See: `TextureFormat::Enum`.
  685. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  686. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  687. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  688. * mode.
  689. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  690. * sampling.
  691. */
  692. bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
  693. /**
  694. * Create 3D texture.
  695. * Params:
  696. * _width = Width.
  697. * _height = Height.
  698. * _depth = Depth.
  699. * _hasMips = Indicates that texture contains full mip-map chain.
  700. * _format = Texture format. See: `TextureFormat::Enum`.
  701. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  702. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  703. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  704. * mode.
  705. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  706. * sampling.
  707. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  708. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  709. * 1, expected memory layout is texture and all mips together for each array element.
  710. */
  711. bgfx_texture_handle_t bgfx_create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
  712. /**
  713. * Create Cube texture.
  714. * Params:
  715. * _size = Cube side size.
  716. * _hasMips = Indicates that texture contains full mip-map chain.
  717. * _numLayers = Number of layers in texture array. Must be 1 if caps
  718. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  719. * _format = Texture format. See: `TextureFormat::Enum`.
  720. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  721. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  722. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  723. * mode.
  724. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  725. * sampling.
  726. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  727. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  728. * 1, expected memory layout is texture and all mips together for each array element.
  729. */
  730. bgfx_texture_handle_t bgfx_create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
  731. /**
  732. * Update 2D texture.
  733. * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
  734. * Params:
  735. * _handle = Texture handle.
  736. * _layer = Layer in texture array.
  737. * _mip = Mip level.
  738. * _x = X offset in texture.
  739. * _y = Y offset in texture.
  740. * _width = Width of texture block.
  741. * _height = Height of texture block.
  742. * _mem = Texture update data.
  743. * _pitch = Pitch of input image (bytes). When _pitch is set to
  744. * UINT16_MAX, it will be calculated internally based on _width.
  745. */
  746. void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, ushort _layer, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
  747. /**
  748. * Update 3D texture.
  749. * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
  750. * Params:
  751. * _handle = Texture handle.
  752. * _mip = Mip level.
  753. * _x = X offset in texture.
  754. * _y = Y offset in texture.
  755. * _z = Z offset in texture.
  756. * _width = Width of texture block.
  757. * _height = Height of texture block.
  758. * _depth = Depth of texture block.
  759. * _mem = Texture update data.
  760. */
  761. void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, byte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem);
  762. /**
  763. * Update Cube texture.
  764. * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
  765. * Params:
  766. * _handle = Texture handle.
  767. * _layer = Layer in texture array.
  768. * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
  769. * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
  770. * +----------+
  771. * |-z 2|
  772. * | ^ +y |
  773. * | | | Unfolded cube:
  774. * | +---->+x |
  775. * +----------+----------+----------+----------+
  776. * |+y 1|+y 4|+y 0|+y 5|
  777. * | ^ -x | ^ +z | ^ +x | ^ -z |
  778. * | | | | | | | | |
  779. * | +---->+z | +---->+x | +---->-z | +---->-x |
  780. * +----------+----------+----------+----------+
  781. * |+z 3|
  782. * | ^ -y |
  783. * | | |
  784. * | +---->+x |
  785. * +----------+
  786. * _mip = Mip level.
  787. * _x = X offset in texture.
  788. * _y = Y offset in texture.
  789. * _width = Width of texture block.
  790. * _height = Height of texture block.
  791. * _mem = Texture update data.
  792. * _pitch = Pitch of input image (bytes). When _pitch is set to
  793. * UINT16_MAX, it will be calculated internally based on _width.
  794. */
  795. void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, ushort _layer, byte _side, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
  796. /**
  797. * Read back texture content.
  798. * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
  799. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
  800. * Params:
  801. * _handle = Texture handle.
  802. * _data = Destination buffer.
  803. * _mip = Mip level.
  804. */
  805. uint bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, byte _mip);
  806. /**
  807. * Set texture debug name.
  808. * Params:
  809. * _handle = Texture handle.
  810. * _name = Texture name.
  811. * _len = Texture name length (if length is INT32_MAX, it's expected
  812. * that _name is zero terminated string.
  813. */
  814. void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const(char)* _name, int _len);
  815. /**
  816. * Returns texture direct access pointer.
  817. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
  818. * is available on GPUs that have unified memory architecture (UMA) support.
  819. * Params:
  820. * _handle = Texture handle.
  821. */
  822. void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle);
  823. /**
  824. * Destroy texture.
  825. * Params:
  826. * _handle = Texture handle.
  827. */
  828. void bgfx_destroy_texture(bgfx_texture_handle_t _handle);
  829. /**
  830. * Create frame buffer (simple).
  831. * Params:
  832. * _width = Texture width.
  833. * _height = Texture height.
  834. * _format = Texture format. See: `TextureFormat::Enum`.
  835. * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  836. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  837. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  838. * mode.
  839. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  840. * sampling.
  841. */
  842. bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags);
  843. /**
  844. * Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio
  845. * if back buffer resolution changes.
  846. * Params:
  847. * _ratio = Frame buffer size in respect to back-buffer size. See:
  848. * `BackbufferRatio::Enum`.
  849. * _format = Texture format. See: `TextureFormat::Enum`.
  850. * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  851. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  852. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  853. * mode.
  854. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  855. * sampling.
  856. */
  857. bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags);
  858. /**
  859. * Create MRT frame buffer from texture handles (simple).
  860. * Params:
  861. * _num = Number of texture handles.
  862. * _handles = Texture attachments.
  863. * _destroyTexture = If true, textures will be destroyed when
  864. * frame buffer is destroyed.
  865. */
  866. bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(byte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture);
  867. /**
  868. * Create MRT frame buffer from texture handles with specific layer and
  869. * mip level.
  870. * Params:
  871. * _num = Number of attachements.
  872. * _attachment = Attachment texture info. See: `bgfx::Attachment`.
  873. * _destroyTexture = If true, textures will be destroyed when
  874. * frame buffer is destroyed.
  875. */
  876. bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(byte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture);
  877. /**
  878. * Create frame buffer for multiple window rendering.
  879. * Remarks:
  880. * Frame buffer cannot be used for sampling.
  881. * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
  882. * Params:
  883. * _nwh = OS' target native window handle.
  884. * _width = Window back buffer width.
  885. * _height = Window back buffer height.
  886. * _format = Window back buffer color format.
  887. * _depthFormat = Window back buffer depth format.
  888. */
  889. bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat);
  890. /**
  891. * Set frame buffer debug name.
  892. * Params:
  893. * _handle = Frame buffer handle.
  894. * _name = Frame buffer name.
  895. * _len = Frame buffer name length (if length is INT32_MAX, it's expected
  896. * that _name is zero terminated string.
  897. */
  898. void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len);
  899. /**
  900. * Obtain texture handle of frame buffer attachment.
  901. * Params:
  902. * _handle = Frame buffer handle.
  903. */
  904. bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, byte _attachment);
  905. /**
  906. * Destroy frame buffer.
  907. * Params:
  908. * _handle = Frame buffer handle.
  909. */
  910. void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle);
  911. /**
  912. * Create shader uniform parameter.
  913. * Remarks:
  914. * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
  915. * multiple times with the same uniform name. The library will always
  916. * return the same handle, but the handle reference count will be
  917. * incremented. This means that the same number of `bgfx::destroyUniform`
  918. * must be called to properly destroy the uniform.
  919. * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
  920. * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
  921. * view, in pixels.
  922. * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
  923. * width and height
  924. * - `u_view mat4` - view matrix
  925. * - `u_invView mat4` - inverted view matrix
  926. * - `u_proj mat4` - projection matrix
  927. * - `u_invProj mat4` - inverted projection matrix
  928. * - `u_viewProj mat4` - concatenated view projection matrix
  929. * - `u_invViewProj mat4` - concatenated inverted view projection matrix
  930. * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
  931. * - `u_modelView mat4` - concatenated model view matrix, only first
  932. * model matrix from array is used.
  933. * - `u_modelViewProj mat4` - concatenated model view projection matrix.
  934. * - `u_alphaRef float` - alpha reference value for alpha test.
  935. * Params:
  936. * _name = Uniform name in shader.
  937. * _type = Type of uniform (See: `bgfx::UniformType`).
  938. * _num = Number of elements in array.
  939. */
  940. bgfx_uniform_handle_t bgfx_create_uniform(const(char)* _name, bgfx_uniform_type_t _type, ushort _num);
  941. /**
  942. * Retrieve uniform info.
  943. * Params:
  944. * _handle = Handle to uniform object.
  945. * _info = Uniform info.
  946. */
  947. void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info);
  948. /**
  949. * Destroy shader uniform parameter.
  950. * Params:
  951. * _handle = Handle to uniform object.
  952. */
  953. void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle);
  954. /**
  955. * Create occlusion query.
  956. */
  957. bgfx_occlusion_query_handle_t bgfx_create_occlusion_query();
  958. /**
  959. * Retrieve occlusion query result from previous frame.
  960. * Params:
  961. * _handle = Handle to occlusion query object.
  962. * _result = Number of pixels that passed test. This argument
  963. * can be `NULL` if result of occlusion query is not needed.
  964. */
  965. bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int* _result);
  966. /**
  967. * Destroy occlusion query.
  968. * Params:
  969. * _handle = Handle to occlusion query object.
  970. */
  971. void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle);
  972. /**
  973. * Set palette color value.
  974. * Params:
  975. * _index = Index into palette.
  976. * _rgba = RGBA floating point values.
  977. */
  978. void bgfx_set_palette_color(byte _index, const float[4] _rgba);
  979. /**
  980. * Set palette color value.
  981. * Params:
  982. * _index = Index into palette.
  983. * _rgba = Packed 32-bit RGBA value.
  984. */
  985. void bgfx_set_palette_color_rgba8(byte _index, uint _rgba);
  986. /**
  987. * Set view name.
  988. * Remarks:
  989. * This is debug only feature.
  990. * In graphics debugger view name will appear as:
  991. * "nnnc <view name>"
  992. * ^ ^ ^
  993. * | +--- compute (C)
  994. * +------ view id
  995. * Params:
  996. * _id = View id.
  997. * _name = View name.
  998. */
  999. void bgfx_set_view_name(bgfx_view_id_t _id, const(char)* _name);
  1000. /**
  1001. * Set view rectangle. Draw primitive outside view will be clipped.
  1002. * Params:
  1003. * _id = View id.
  1004. * _x = Position x from the left corner of the window.
  1005. * _y = Position y from the top corner of the window.
  1006. * _width = Width of view port region.
  1007. * _height = Height of view port region.
  1008. */
  1009. void bgfx_set_view_rect(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
  1010. /**
  1011. * Set view rectangle. Draw primitive outside view will be clipped.
  1012. * Params:
  1013. * _id = View id.
  1014. * _x = Position x from the left corner of the window.
  1015. * _y = Position y from the top corner of the window.
  1016. * _ratio = Width and height will be set in respect to back-buffer size.
  1017. * See: `BackbufferRatio::Enum`.
  1018. */
  1019. void bgfx_set_view_rect_ratio(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio);
  1020. /**
  1021. * Set view scissor. Draw primitive outside view will be clipped. When
  1022. * _x, _y, _width and _height are set to 0, scissor will be disabled.
  1023. * Params:
  1024. * _id = View id.
  1025. * _x = Position x from the left corner of the window.
  1026. * _y = Position y from the top corner of the window.
  1027. * _width = Width of view scissor region.
  1028. * _height = Height of view scissor region.
  1029. */
  1030. void bgfx_set_view_scissor(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
  1031. /**
  1032. * Set view clear flags.
  1033. * Params:
  1034. * _id = View id.
  1035. * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1036. * operation. See: `BGFX_CLEAR_*`.
  1037. * _rgba = Color clear value.
  1038. * _depth = Depth clear value.
  1039. * _stencil = Stencil clear value.
  1040. */
  1041. void bgfx_set_view_clear(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, byte _stencil);
  1042. /**
  1043. * Set view clear flags with different clear color for each
  1044. * frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color
  1045. * palette.
  1046. * Params:
  1047. * _id = View id.
  1048. * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  1049. * operation. See: `BGFX_CLEAR_*`.
  1050. * _depth = Depth clear value.
  1051. * _stencil = Stencil clear value.
  1052. * _c0 = Palette index for frame buffer attachment 0.
  1053. * _c1 = Palette index for frame buffer attachment 1.
  1054. * _c2 = Palette index for frame buffer attachment 2.
  1055. * _c3 = Palette index for frame buffer attachment 3.
  1056. * _c4 = Palette index for frame buffer attachment 4.
  1057. * _c5 = Palette index for frame buffer attachment 5.
  1058. * _c6 = Palette index for frame buffer attachment 6.
  1059. * _c7 = Palette index for frame buffer attachment 7.
  1060. */
  1061. void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, ushort _flags, float _depth, byte _stencil, byte _c0, byte _c1, byte _c2, byte _c3, byte _c4, byte _c5, byte _c6, byte _c7);
  1062. /**
  1063. * Set view sorting mode.
  1064. * Remarks:
  1065. * View mode must be set prior calling `bgfx::submit` for the view.
  1066. * Params:
  1067. * _id = View id.
  1068. * _mode = View sort mode. See `ViewMode::Enum`.
  1069. */
  1070. void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
  1071. /**
  1072. * Set view frame buffer.
  1073. * Remarks:
  1074. * Not persistent after `bgfx::reset` call.
  1075. * Params:
  1076. * _id = View id.
  1077. * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
  1078. * frame buffer handle will draw primitives from this view into
  1079. * default back buffer.
  1080. */
  1081. void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
  1082. /**
  1083. * Set view view and projection matrices, all draw primitives in this
  1084. * view will use these matrices.
  1085. * Params:
  1086. * _id = View id.
  1087. * _view = View matrix.
  1088. * _proj = Projection matrix.
  1089. */
  1090. void bgfx_set_view_transform(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj);
  1091. /**
  1092. * Post submit view reordering.
  1093. * Params:
  1094. * _id = First view id.
  1095. * _num = Number of views to remap.
  1096. * _order = View remap id table. Passing `NULL` will reset view ids
  1097. * to default state.
  1098. */
  1099. void bgfx_set_view_order(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order);
  1100. /**
  1101. * Reset all view settings to default.
  1102. */
  1103. void bgfx_reset_view(bgfx_view_id_t _id);
  1104. /**
  1105. * Begin submitting draw calls from thread.
  1106. * Params:
  1107. * _forThread = Explicitly request an encoder for a worker thread.
  1108. */
  1109. bgfx_encoder_t* bgfx_encoder_begin(bool _forThread);
  1110. /**
  1111. * End submitting draw calls from thread.
  1112. * Params:
  1113. * _encoder = Encoder.
  1114. */
  1115. void bgfx_encoder_end(bgfx_encoder_t* _encoder);
  1116. /**
  1117. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1118. * graphics debugging tools.
  1119. * Params:
  1120. * _marker = Marker string.
  1121. */
  1122. void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const(char)* _marker);
  1123. /**
  1124. * Set render states for draw primitive.
  1125. * Remarks:
  1126. * 1. To setup more complex states use:
  1127. * `BGFX_STATE_ALPHA_REF(_ref)`,
  1128. * `BGFX_STATE_POINT_SIZE(_size)`,
  1129. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1130. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1131. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1132. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1133. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1134. * equation is specified.
  1135. * Params:
  1136. * _state = State flags. Default state for primitive type is
  1137. * triangles. See: `BGFX_STATE_DEFAULT`.
  1138. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  1139. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  1140. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  1141. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  1142. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  1143. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  1144. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  1145. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  1146. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  1147. */
  1148. void bgfx_encoder_set_state(bgfx_encoder_t* _this, ulong _state, uint _rgba);
  1149. /**
  1150. * Set condition for rendering.
  1151. * Params:
  1152. * _handle = Occlusion query handle.
  1153. * _visible = Render if occlusion query is visible.
  1154. */
  1155. void bgfx_encoder_set_condition(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
  1156. /**
  1157. * Set stencil test state.
  1158. * Params:
  1159. * _fstencil = Front stencil state.
  1160. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  1161. * _fstencil is applied to both front and back facing primitives.
  1162. */
  1163. void bgfx_encoder_set_stencil(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil);
  1164. /**
  1165. * Set scissor for draw primitive.
  1166. * Remarks:
  1167. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  1168. * Params:
  1169. * _x = Position x from the left corner of the window.
  1170. * _y = Position y from the top corner of the window.
  1171. * _width = Width of view scissor region.
  1172. * _height = Height of view scissor region.
  1173. */
  1174. ushort bgfx_encoder_set_scissor(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height);
  1175. /**
  1176. * Set scissor from cache for draw primitive.
  1177. * Remarks:
  1178. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  1179. * Params:
  1180. * _cache = Index in scissor cache.
  1181. */
  1182. void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, ushort _cache);
  1183. /**
  1184. * Set model matrix for draw primitive. If it is not called,
  1185. * the model will be rendered with an identity model matrix.
  1186. * Params:
  1187. * _mtx = Pointer to first matrix in array.
  1188. * _num = Number of matrices in array.
  1189. */
  1190. uint bgfx_encoder_set_transform(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num);
  1191. /**
  1192. * Set model matrix from matrix cache for draw primitive.
  1193. * Params:
  1194. * _cache = Index in matrix cache.
  1195. * _num = Number of matrices from cache.
  1196. */
  1197. void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint _cache, ushort _num);
  1198. /**
  1199. * Reserve matrices in internal matrix cache.
  1200. * Attention: Pointer returned can be modifed until `bgfx::frame` is called.
  1201. * Params:
  1202. * _transform = Pointer to `Transform` structure.
  1203. * _num = Number of matrices.
  1204. */
  1205. uint bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num);
  1206. /**
  1207. * Set shader uniform parameter for draw primitive.
  1208. * Params:
  1209. * _handle = Uniform.
  1210. * _value = Pointer to uniform data.
  1211. * _num = Number of elements. Passing `UINT16_MAX` will
  1212. * use the _num passed on uniform creation.
  1213. */
  1214. void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  1215. /**
  1216. * Set index buffer for draw primitive.
  1217. * Params:
  1218. * _handle = Index buffer.
  1219. * _firstIndex = First index to render.
  1220. * _numIndices = Number of indices to render.
  1221. */
  1222. void bgfx_encoder_set_index_buffer(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  1223. /**
  1224. * Set index buffer for draw primitive.
  1225. * Params:
  1226. * _handle = Dynamic index buffer.
  1227. * _firstIndex = First index to render.
  1228. * _numIndices = Number of indices to render.
  1229. */
  1230. void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  1231. /**
  1232. * Set index buffer for draw primitive.
  1233. * Params:
  1234. * _tib = Transient index buffer.
  1235. * _firstIndex = First index to render.
  1236. * _numIndices = Number of indices to render.
  1237. */
  1238. void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
  1239. /**
  1240. * Set vertex buffer for draw primitive.
  1241. * Params:
  1242. * _stream = Vertex stream.
  1243. * _handle = Vertex buffer.
  1244. * _startVertex = First vertex to render.
  1245. * _numVertices = Number of vertices to render.
  1246. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  1247. * handle is used, vertex layout used for creation
  1248. * of vertex buffer will be used.
  1249. */
  1250. void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
  1251. /**
  1252. * Set vertex buffer for draw primitive.
  1253. * Params:
  1254. * _stream = Vertex stream.
  1255. * _handle = Dynamic vertex buffer.
  1256. * _startVertex = First vertex to render.
  1257. * _numVertices = Number of vertices to render.
  1258. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  1259. * handle is used, vertex layout used for creation
  1260. * of vertex buffer will be used.
  1261. */
  1262. void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
  1263. /**
  1264. * Set vertex buffer for draw primitive.
  1265. * Params:
  1266. * _stream = Vertex stream.
  1267. * _tvb = Transient vertex buffer.
  1268. * _startVertex = First vertex to render.
  1269. * _numVertices = Number of vertices to render.
  1270. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  1271. * handle is used, vertex layout used for creation
  1272. * of vertex buffer will be used.
  1273. */
  1274. void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
  1275. /**
  1276. * Set number of vertices for auto generated vertices use in conjuction
  1277. * with gl_VertexID.
  1278. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1279. * Params:
  1280. * _numVertices = Number of vertices.
  1281. */
  1282. void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint _numVertices);
  1283. /**
  1284. * Set instance data buffer for draw primitive.
  1285. * Params:
  1286. * _idb = Transient instance data buffer.
  1287. * _start = First instance data.
  1288. * _num = Number of data instances.
  1289. */
  1290. void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
  1291. /**
  1292. * Set instance data buffer for draw primitive.
  1293. * Params:
  1294. * _handle = Vertex buffer.
  1295. * _startVertex = First instance data.
  1296. * _num = Number of data instances.
  1297. * Set instance data buffer for draw primitive.
  1298. */
  1299. void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  1300. /**
  1301. * Set instance data buffer for draw primitive.
  1302. * Params:
  1303. * _handle = Dynamic vertex buffer.
  1304. * _startVertex = First instance data.
  1305. * _num = Number of data instances.
  1306. */
  1307. void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  1308. /**
  1309. * Set number of instances for auto generated instances use in conjuction
  1310. * with gl_InstanceID.
  1311. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1312. */
  1313. void bgfx_encoder_set_instance_count(bgfx_encoder_t* _this, uint _numInstances);
  1314. /**
  1315. * Set texture stage for draw primitive.
  1316. * Params:
  1317. * _stage = Texture unit.
  1318. * _sampler = Program sampler.
  1319. * _handle = Texture handle.
  1320. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  1321. * texture sampling settings from the texture.
  1322. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1323. * mode.
  1324. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1325. * sampling.
  1326. */
  1327. void bgfx_encoder_set_texture(bgfx_encoder_t* _this, byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
  1328. /**
  1329. * Submit an empty primitive for rendering. Uniforms and draw state
  1330. * will be applied but no geometry will be submitted. Useful in cases
  1331. * when no other draw/compute primitive is submitted to view, but it's
  1332. * desired to execute clear view.
  1333. * Remarks:
  1334. * These empty draw calls will sort before ordinary draw calls.
  1335. * Params:
  1336. * _id = View id.
  1337. */
  1338. void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id);
  1339. /**
  1340. * Submit primitive for rendering.
  1341. * Params:
  1342. * _id = View id.
  1343. * _program = Program.
  1344. * _depth = Depth for sorting.
  1345. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1346. */
  1347. void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
  1348. /**
  1349. * Submit primitive with occlusion query for rendering.
  1350. * Params:
  1351. * _id = View id.
  1352. * _program = Program.
  1353. * _occlusionQuery = Occlusion query.
  1354. * _depth = Depth for sorting.
  1355. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1356. */
  1357. void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
  1358. /**
  1359. * Submit primitive for rendering with index and instance data info from
  1360. * indirect buffer.
  1361. * Params:
  1362. * _id = View id.
  1363. * _program = Program.
  1364. * _indirectHandle = Indirect buffer.
  1365. * _start = First element in indirect buffer.
  1366. * _num = Number of dispatches.
  1367. * _depth = Depth for sorting.
  1368. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1369. */
  1370. void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
  1371. /**
  1372. * Set compute index buffer.
  1373. * Params:
  1374. * _stage = Compute stage.
  1375. * _handle = Index buffer handle.
  1376. * _access = Buffer access. See `Access::Enum`.
  1377. */
  1378. void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  1379. /**
  1380. * Set compute vertex buffer.
  1381. * Params:
  1382. * _stage = Compute stage.
  1383. * _handle = Vertex buffer handle.
  1384. * _access = Buffer access. See `Access::Enum`.
  1385. */
  1386. void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1387. /**
  1388. * Set compute dynamic index buffer.
  1389. * Params:
  1390. * _stage = Compute stage.
  1391. * _handle = Dynamic index buffer handle.
  1392. * _access = Buffer access. See `Access::Enum`.
  1393. */
  1394. void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
  1395. /**
  1396. * Set compute dynamic vertex buffer.
  1397. * Params:
  1398. * _stage = Compute stage.
  1399. * _handle = Dynamic vertex buffer handle.
  1400. * _access = Buffer access. See `Access::Enum`.
  1401. */
  1402. void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1403. /**
  1404. * Set compute indirect buffer.
  1405. * Params:
  1406. * _stage = Compute stage.
  1407. * _handle = Indirect buffer handle.
  1408. * _access = Buffer access. See `Access::Enum`.
  1409. */
  1410. void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  1411. /**
  1412. * Set compute image from texture.
  1413. * Params:
  1414. * _stage = Compute stage.
  1415. * _handle = Texture handle.
  1416. * _mip = Mip level.
  1417. * _access = Image access. See `Access::Enum`.
  1418. * _format = Texture format. See: `TextureFormat::Enum`.
  1419. */
  1420. void bgfx_encoder_set_image(bgfx_encoder_t* _this, byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
  1421. /**
  1422. * Dispatch compute.
  1423. * Params:
  1424. * _id = View id.
  1425. * _program = Compute program.
  1426. * _numX = Number of groups X.
  1427. * _numY = Number of groups Y.
  1428. * _numZ = Number of groups Z.
  1429. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1430. */
  1431. void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
  1432. /**
  1433. * Dispatch compute indirect.
  1434. * Params:
  1435. * _id = View id.
  1436. * _program = Compute program.
  1437. * _indirectHandle = Indirect buffer.
  1438. * _start = First element in indirect buffer.
  1439. * _num = Number of dispatches.
  1440. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1441. */
  1442. void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
  1443. /**
  1444. * Discard previously set state for draw or compute call.
  1445. * Params:
  1446. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1447. */
  1448. void bgfx_encoder_discard(bgfx_encoder_t* _this, byte _flags);
  1449. /**
  1450. * Blit 2D texture region between two 2D textures.
  1451. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  1452. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  1453. * Params:
  1454. * _id = View id.
  1455. * _dst = Destination texture handle.
  1456. * _dstMip = Destination texture mip level.
  1457. * _dstX = Destination texture X position.
  1458. * _dstY = Destination texture Y position.
  1459. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  1460. * this argument represents destination texture cube face. For 3D texture this argument
  1461. * represents destination texture Z position.
  1462. * _src = Source texture handle.
  1463. * _srcMip = Source texture mip level.
  1464. * _srcX = Source texture X position.
  1465. * _srcY = Source texture Y position.
  1466. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  1467. * this argument represents source texture cube face. For 3D texture this argument
  1468. * represents source texture Z position.
  1469. * _width = Width of region.
  1470. * _height = Height of region.
  1471. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  1472. * unused.
  1473. */
  1474. void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
  1475. /**
  1476. * Request screen shot of window back buffer.
  1477. * Remarks:
  1478. * `bgfx::CallbackI::screenShot` must be implemented.
  1479. * Attention: Frame buffer handle must be created with OS' target native window handle.
  1480. * Params:
  1481. * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  1482. * made for main window back buffer.
  1483. * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
  1484. */
  1485. void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath);
  1486. /**
  1487. * Render frame.
  1488. * Attention: `bgfx::renderFrame` is blocking call. It waits for
  1489. * `bgfx::frame` to be called from API thread to process frame.
  1490. * If timeout value is passed call will timeout and return even
  1491. * if `bgfx::frame` is not called.
  1492. * Warning: This call should be only used on platforms that don't
  1493. * allow creating separate rendering thread. If it is called before
  1494. * to bgfx::init, render thread won't be created by bgfx::init call.
  1495. * Params:
  1496. * _msecs = Timeout in milliseconds.
  1497. */
  1498. bgfx_render_frame_t bgfx_render_frame(int _msecs);
  1499. /**
  1500. * Set platform data.
  1501. * Warning: Must be called before `bgfx::init`.
  1502. * Params:
  1503. * _data = Platform data.
  1504. */
  1505. void bgfx_set_platform_data(const(bgfx_platform_data_t)* _data);
  1506. /**
  1507. * Get internal data for interop.
  1508. * Attention: It's expected you understand some bgfx internals before you
  1509. * use this call.
  1510. * Warning: Must be called only on render thread.
  1511. */
  1512. const(bgfx_internal_data_t)* bgfx_get_internal_data();
  1513. /**
  1514. * Override internal texture with externally created texture. Previously
  1515. * created internal texture will released.
  1516. * Attention: It's expected you understand some bgfx internals before you
  1517. * use this call.
  1518. * Warning: Must be called only on render thread.
  1519. * Params:
  1520. * _handle = Texture handle.
  1521. * _ptr = Native API pointer to texture.
  1522. */
  1523. ulong bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, ulong _ptr);
  1524. /**
  1525. * Override internal texture by creating new texture. Previously created
  1526. * internal texture will released.
  1527. * Attention: It's expected you understand some bgfx internals before you
  1528. * use this call.
  1529. * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
  1530. * main thread.
  1531. * Warning: Must be called only on render thread.
  1532. * Params:
  1533. * _handle = Texture handle.
  1534. * _width = Width.
  1535. * _height = Height.
  1536. * _numMips = Number of mip-maps.
  1537. * _format = Texture format. See: `TextureFormat::Enum`.
  1538. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1539. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1540. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1541. * mode.
  1542. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1543. * sampling.
  1544. */
  1545. ulong bgfx_override_internal_texture(bgfx_texture_handle_t _handle, ushort _width, ushort _height, byte _numMips, bgfx_texture_format_t _format, ulong _flags);
  1546. /**
  1547. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1548. * graphics debugging tools.
  1549. * Params:
  1550. * _marker = Marker string.
  1551. */
  1552. void bgfx_set_marker(const(char)* _marker);
  1553. /**
  1554. * Set render states for draw primitive.
  1555. * Remarks:
  1556. * 1. To setup more complex states use:
  1557. * `BGFX_STATE_ALPHA_REF(_ref)`,
  1558. * `BGFX_STATE_POINT_SIZE(_size)`,
  1559. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1560. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1561. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1562. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1563. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1564. * equation is specified.
  1565. * Params:
  1566. * _state = State flags. Default state for primitive type is
  1567. * triangles. See: `BGFX_STATE_DEFAULT`.
  1568. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  1569. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  1570. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  1571. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  1572. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  1573. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  1574. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  1575. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  1576. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  1577. */
  1578. void bgfx_set_state(ulong _state, uint _rgba);
  1579. /**
  1580. * Set condition for rendering.
  1581. * Params:
  1582. * _handle = Occlusion query handle.
  1583. * _visible = Render if occlusion query is visible.
  1584. */
  1585. void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible);
  1586. /**
  1587. * Set stencil test state.
  1588. * Params:
  1589. * _fstencil = Front stencil state.
  1590. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  1591. * _fstencil is applied to both front and back facing primitives.
  1592. */
  1593. void bgfx_set_stencil(uint _fstencil, uint _bstencil);
  1594. /**
  1595. * Set scissor for draw primitive.
  1596. * Remarks:
  1597. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  1598. * Params:
  1599. * _x = Position x from the left corner of the window.
  1600. * _y = Position y from the top corner of the window.
  1601. * _width = Width of view scissor region.
  1602. * _height = Height of view scissor region.
  1603. */
  1604. ushort bgfx_set_scissor(ushort _x, ushort _y, ushort _width, ushort _height);
  1605. /**
  1606. * Set scissor from cache for draw primitive.
  1607. * Remarks:
  1608. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  1609. * Params:
  1610. * _cache = Index in scissor cache.
  1611. */
  1612. void bgfx_set_scissor_cached(ushort _cache);
  1613. /**
  1614. * Set model matrix for draw primitive. If it is not called,
  1615. * the model will be rendered with an identity model matrix.
  1616. * Params:
  1617. * _mtx = Pointer to first matrix in array.
  1618. * _num = Number of matrices in array.
  1619. */
  1620. uint bgfx_set_transform(const(void)* _mtx, ushort _num);
  1621. /**
  1622. * Set model matrix from matrix cache for draw primitive.
  1623. * Params:
  1624. * _cache = Index in matrix cache.
  1625. * _num = Number of matrices from cache.
  1626. */
  1627. void bgfx_set_transform_cached(uint _cache, ushort _num);
  1628. /**
  1629. * Reserve matrices in internal matrix cache.
  1630. * Attention: Pointer returned can be modifed until `bgfx::frame` is called.
  1631. * Params:
  1632. * _transform = Pointer to `Transform` structure.
  1633. * _num = Number of matrices.
  1634. */
  1635. uint bgfx_alloc_transform(bgfx_transform_t* _transform, ushort _num);
  1636. /**
  1637. * Set shader uniform parameter for draw primitive.
  1638. * Params:
  1639. * _handle = Uniform.
  1640. * _value = Pointer to uniform data.
  1641. * _num = Number of elements. Passing `UINT16_MAX` will
  1642. * use the _num passed on uniform creation.
  1643. */
  1644. void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  1645. /**
  1646. * Set index buffer for draw primitive.
  1647. * Params:
  1648. * _handle = Index buffer.
  1649. * _firstIndex = First index to render.
  1650. * _numIndices = Number of indices to render.
  1651. */
  1652. void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  1653. /**
  1654. * Set index buffer for draw primitive.
  1655. * Params:
  1656. * _handle = Dynamic index buffer.
  1657. * _firstIndex = First index to render.
  1658. * _numIndices = Number of indices to render.
  1659. */
  1660. void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  1661. /**
  1662. * Set index buffer for draw primitive.
  1663. * Params:
  1664. * _tib = Transient index buffer.
  1665. * _firstIndex = First index to render.
  1666. * _numIndices = Number of indices to render.
  1667. */
  1668. void bgfx_set_transient_index_buffer(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
  1669. /**
  1670. * Set vertex buffer for draw primitive.
  1671. * Params:
  1672. * _stream = Vertex stream.
  1673. * _handle = Vertex buffer.
  1674. * _startVertex = First vertex to render.
  1675. * _numVertices = Number of vertices to render.
  1676. */
  1677. void bgfx_set_vertex_buffer(byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  1678. /**
  1679. * Set vertex buffer for draw primitive.
  1680. * Params:
  1681. * _stream = Vertex stream.
  1682. * _handle = Dynamic vertex buffer.
  1683. * _startVertex = First vertex to render.
  1684. * _numVertices = Number of vertices to render.
  1685. */
  1686. void bgfx_set_dynamic_vertex_buffer(byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  1687. /**
  1688. * Set vertex buffer for draw primitive.
  1689. * Params:
  1690. * _stream = Vertex stream.
  1691. * _tvb = Transient vertex buffer.
  1692. * _startVertex = First vertex to render.
  1693. * _numVertices = Number of vertices to render.
  1694. */
  1695. void bgfx_set_transient_vertex_buffer(byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
  1696. /**
  1697. * Set number of vertices for auto generated vertices use in conjuction
  1698. * with gl_VertexID.
  1699. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1700. * Params:
  1701. * _numVertices = Number of vertices.
  1702. */
  1703. void bgfx_set_vertex_count(uint _numVertices);
  1704. /**
  1705. * Set instance data buffer for draw primitive.
  1706. * Params:
  1707. * _idb = Transient instance data buffer.
  1708. * _start = First instance data.
  1709. * _num = Number of data instances.
  1710. */
  1711. void bgfx_set_instance_data_buffer(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
  1712. /**
  1713. * Set instance data buffer for draw primitive.
  1714. * Params:
  1715. * _handle = Vertex buffer.
  1716. * _startVertex = First instance data.
  1717. * _num = Number of data instances.
  1718. * Set instance data buffer for draw primitive.
  1719. */
  1720. void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  1721. /**
  1722. * Set instance data buffer for draw primitive.
  1723. * Params:
  1724. * _handle = Dynamic vertex buffer.
  1725. * _startVertex = First instance data.
  1726. * _num = Number of data instances.
  1727. */
  1728. void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  1729. /**
  1730. * Set number of instances for auto generated instances use in conjuction
  1731. * with gl_InstanceID.
  1732. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1733. */
  1734. void bgfx_set_instance_count(uint _numInstances);
  1735. /**
  1736. * Set texture stage for draw primitive.
  1737. * Params:
  1738. * _stage = Texture unit.
  1739. * _sampler = Program sampler.
  1740. * _handle = Texture handle.
  1741. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  1742. * texture sampling settings from the texture.
  1743. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1744. * mode.
  1745. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1746. * sampling.
  1747. */
  1748. void bgfx_set_texture(byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
  1749. /**
  1750. * Submit an empty primitive for rendering. Uniforms and draw state
  1751. * will be applied but no geometry will be submitted.
  1752. * Remarks:
  1753. * These empty draw calls will sort before ordinary draw calls.
  1754. * Params:
  1755. * _id = View id.
  1756. */
  1757. void bgfx_touch(bgfx_view_id_t _id);
  1758. /**
  1759. * Submit primitive for rendering.
  1760. * Params:
  1761. * _id = View id.
  1762. * _program = Program.
  1763. * _depth = Depth for sorting.
  1764. * _flags = Which states to discard for next draw. See BGFX_DISCARD_
  1765. */
  1766. void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
  1767. /**
  1768. * Submit primitive with occlusion query for rendering.
  1769. * Params:
  1770. * _id = View id.
  1771. * _program = Program.
  1772. * _occlusionQuery = Occlusion query.
  1773. * _depth = Depth for sorting.
  1774. * _flags = Which states to discard for next draw. See BGFX_DISCARD_
  1775. */
  1776. void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
  1777. /**
  1778. * Submit primitive for rendering with index and instance data info from
  1779. * indirect buffer.
  1780. * Params:
  1781. * _id = View id.
  1782. * _program = Program.
  1783. * _indirectHandle = Indirect buffer.
  1784. * _start = First element in indirect buffer.
  1785. * _num = Number of dispatches.
  1786. * _depth = Depth for sorting.
  1787. * _flags = Which states to discard for next draw. See BGFX_DISCARD_
  1788. */
  1789. void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
  1790. /**
  1791. * Set compute index buffer.
  1792. * Params:
  1793. * _stage = Compute stage.
  1794. * _handle = Index buffer handle.
  1795. * _access = Buffer access. See `Access::Enum`.
  1796. */
  1797. void bgfx_set_compute_index_buffer(byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  1798. /**
  1799. * Set compute vertex buffer.
  1800. * Params:
  1801. * _stage = Compute stage.
  1802. * _handle = Vertex buffer handle.
  1803. * _access = Buffer access. See `Access::Enum`.
  1804. */
  1805. void bgfx_set_compute_vertex_buffer(byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1806. /**
  1807. * Set compute dynamic index buffer.
  1808. * Params:
  1809. * _stage = Compute stage.
  1810. * _handle = Dynamic index buffer handle.
  1811. * _access = Buffer access. See `Access::Enum`.
  1812. */
  1813. void bgfx_set_compute_dynamic_index_buffer(byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
  1814. /**
  1815. * Set compute dynamic vertex buffer.
  1816. * Params:
  1817. * _stage = Compute stage.
  1818. * _handle = Dynamic vertex buffer handle.
  1819. * _access = Buffer access. See `Access::Enum`.
  1820. */
  1821. void bgfx_set_compute_dynamic_vertex_buffer(byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1822. /**
  1823. * Set compute indirect buffer.
  1824. * Params:
  1825. * _stage = Compute stage.
  1826. * _handle = Indirect buffer handle.
  1827. * _access = Buffer access. See `Access::Enum`.
  1828. */
  1829. void bgfx_set_compute_indirect_buffer(byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  1830. /**
  1831. * Set compute image from texture.
  1832. * Params:
  1833. * _stage = Compute stage.
  1834. * _handle = Texture handle.
  1835. * _mip = Mip level.
  1836. * _access = Image access. See `Access::Enum`.
  1837. * _format = Texture format. See: `TextureFormat::Enum`.
  1838. */
  1839. void bgfx_set_image(byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
  1840. /**
  1841. * Dispatch compute.
  1842. * Params:
  1843. * _id = View id.
  1844. * _program = Compute program.
  1845. * _numX = Number of groups X.
  1846. * _numY = Number of groups Y.
  1847. * _numZ = Number of groups Z.
  1848. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1849. */
  1850. void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
  1851. /**
  1852. * Dispatch compute indirect.
  1853. * Params:
  1854. * _id = View id.
  1855. * _program = Compute program.
  1856. * _indirectHandle = Indirect buffer.
  1857. * _start = First element in indirect buffer.
  1858. * _num = Number of dispatches.
  1859. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1860. */
  1861. void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
  1862. /**
  1863. * Discard previously set state for draw or compute call.
  1864. * Params:
  1865. * _flags = Draw/compute states to discard.
  1866. */
  1867. void bgfx_discard(byte _flags);
  1868. /**
  1869. * Blit 2D texture region between two 2D textures.
  1870. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  1871. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  1872. * Params:
  1873. * _id = View id.
  1874. * _dst = Destination texture handle.
  1875. * _dstMip = Destination texture mip level.
  1876. * _dstX = Destination texture X position.
  1877. * _dstY = Destination texture Y position.
  1878. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  1879. * this argument represents destination texture cube face. For 3D texture this argument
  1880. * represents destination texture Z position.
  1881. * _src = Source texture handle.
  1882. * _srcMip = Source texture mip level.
  1883. * _srcX = Source texture X position.
  1884. * _srcY = Source texture Y position.
  1885. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  1886. * this argument represents source texture cube face. For 3D texture this argument
  1887. * represents source texture Z position.
  1888. * _width = Width of region.
  1889. * _height = Height of region.
  1890. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  1891. * unused.
  1892. */
  1893. void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
  1894. }
  1895. else
  1896. {
  1897. __gshared
  1898. {
  1899. /**
  1900. * Init attachment.
  1901. * Params:
  1902. * _handle = Render target texture handle.
  1903. * _access = Access. See `Access::Enum`.
  1904. * _layer = Cubemap side or depth layer/slice.
  1905. * _mip = Mip level.
  1906. * _resolve = Resolve flags. See: `BGFX_RESOLVE_*`
  1907. */
  1908. alias da_bgfx_attachment_init = void function(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _mip, byte _resolve);
  1909. da_bgfx_attachment_init bgfx_attachment_init;
  1910. /**
  1911. * Start VertexLayout.
  1912. */
  1913. alias da_bgfx_vertex_layout_begin = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType);
  1914. da_bgfx_vertex_layout_begin bgfx_vertex_layout_begin;
  1915. /**
  1916. * Add attribute to VertexLayout.
  1917. * Remarks: Must be called between begin/end.
  1918. * Params:
  1919. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  1920. * _num = Number of elements 1, 2, 3 or 4.
  1921. * _type = Element type.
  1922. * _normalized = When using fixed point AttribType (f.e. Uint8)
  1923. * value will be normalized for vertex shader usage. When normalized
  1924. * is set to true, AttribType::Uint8 value in range 0-255 will be
  1925. * in range 0.0-1.0 in vertex shader.
  1926. * _asInt = Packaging rule for vertexPack, vertexUnpack, and
  1927. * vertexConvert for AttribType::Uint8 and AttribType::Int16.
  1928. * Unpacking code must be implemented inside vertex shader.
  1929. */
  1930. alias da_bgfx_vertex_layout_add = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, byte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
  1931. da_bgfx_vertex_layout_add bgfx_vertex_layout_add;
  1932. /**
  1933. * Decode attribute.
  1934. * Params:
  1935. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  1936. * _num = Number of elements.
  1937. * _type = Element type.
  1938. * _normalized = Attribute is normalized.
  1939. * _asInt = Attribute is packed as int.
  1940. */
  1941. alias da_bgfx_vertex_layout_decode = void function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, byte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt);
  1942. da_bgfx_vertex_layout_decode bgfx_vertex_layout_decode;
  1943. /**
  1944. * Returns true if VertexLayout contains attribute.
  1945. * Params:
  1946. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  1947. */
  1948. alias da_bgfx_vertex_layout_has = bool function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib);
  1949. da_bgfx_vertex_layout_has bgfx_vertex_layout_has;
  1950. /**
  1951. * Skip `_num` bytes in vertex stream.
  1952. */
  1953. alias da_bgfx_vertex_layout_skip = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, byte _num);
  1954. da_bgfx_vertex_layout_skip bgfx_vertex_layout_skip;
  1955. /**
  1956. * End VertexLayout.
  1957. */
  1958. alias da_bgfx_vertex_layout_end = void function(bgfx_vertex_layout_t* _this);
  1959. da_bgfx_vertex_layout_end bgfx_vertex_layout_end;
  1960. /**
  1961. * Pack vertex attribute into vertex stream format.
  1962. * Params:
  1963. * _input = Value to be packed into vertex stream.
  1964. * _inputNormalized = `true` if input value is already normalized.
  1965. * _attr = Attribute to pack.
  1966. * _layout = Vertex stream layout.
  1967. * _data = Destination vertex stream where data will be packed.
  1968. * _index = Vertex index that will be modified.
  1969. */
  1970. alias da_bgfx_vertex_pack = void function(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index);
  1971. da_bgfx_vertex_pack bgfx_vertex_pack;
  1972. /**
  1973. * Unpack vertex attribute from vertex stream format.
  1974. * Params:
  1975. * _output = Result of unpacking.
  1976. * _attr = Attribute to unpack.
  1977. * _layout = Vertex stream layout.
  1978. * _data = Source vertex stream from where data will be unpacked.
  1979. * _index = Vertex index that will be unpacked.
  1980. */
  1981. alias da_bgfx_vertex_unpack = void function(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index);
  1982. da_bgfx_vertex_unpack bgfx_vertex_unpack;
  1983. /**
  1984. * Converts vertex stream data from one vertex stream format to another.
  1985. * Params:
  1986. * _dstLayout = Destination vertex stream layout.
  1987. * _dstData = Destination vertex stream.
  1988. * _srcLayout = Source vertex stream layout.
  1989. * _srcData = Source vertex stream data.
  1990. * _num = Number of vertices to convert from source to destination.
  1991. */
  1992. alias da_bgfx_vertex_convert = void function(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num);
  1993. da_bgfx_vertex_convert bgfx_vertex_convert;
  1994. /**
  1995. * Weld vertices.
  1996. * Params:
  1997. * _output = Welded vertices remapping table. The size of buffer
  1998. * must be the same as number of vertices.
  1999. * _layout = Vertex stream layout.
  2000. * _data = Vertex stream.
  2001. * _num = Number of vertices in vertex stream.
  2002. * _epsilon = Error tolerance for vertex position comparison.
  2003. */
  2004. alias da_bgfx_weld_vertices = ushort function(ushort* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, ushort _num, float _epsilon);
  2005. da_bgfx_weld_vertices bgfx_weld_vertices;
  2006. /**
  2007. * Convert index buffer for use with different primitive topologies.
  2008. * Params:
  2009. * _conversion = Conversion type, see `TopologyConvert::Enum`.
  2010. * _dst = Destination index buffer. If this argument is NULL
  2011. * function will return number of indices after conversion.
  2012. * _dstSize = Destination index buffer in bytes. It must be
  2013. * large enough to contain output indices. If destination size is
  2014. * insufficient index buffer will be truncated.
  2015. * _indices = Source indices.
  2016. * _numIndices = Number of input indices.
  2017. * _index32 = Set to `true` if input indices are 32-bit.
  2018. */
  2019. alias da_bgfx_topology_convert = uint function(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32);
  2020. da_bgfx_topology_convert bgfx_topology_convert;
  2021. /**
  2022. * Sort indices.
  2023. * Params:
  2024. * _sort = Sort order, see `TopologySort::Enum`.
  2025. * _dst = Destination index buffer.
  2026. * _dstSize = Destination index buffer in bytes. It must be
  2027. * large enough to contain output indices. If destination size is
  2028. * insufficient index buffer will be truncated.
  2029. * _dir = Direction (vector must be normalized).
  2030. * _pos = Position.
  2031. * _vertices = Pointer to first vertex represented as
  2032. * float x, y, z. Must contain at least number of vertices
  2033. * referencende by index buffer.
  2034. * _stride = Vertex stride.
  2035. * _indices = Source indices.
  2036. * _numIndices = Number of input indices.
  2037. * _index32 = Set to `true` if input indices are 32-bit.
  2038. */
  2039. alias da_bgfx_topology_sort_tri_list = void function(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32);
  2040. da_bgfx_topology_sort_tri_list bgfx_topology_sort_tri_list;
  2041. /**
  2042. * Returns supported backend API renderers.
  2043. * Params:
  2044. * _max = Maximum number of elements in _enum array.
  2045. * _enum = Array where supported renderers will be written.
  2046. */
  2047. alias da_bgfx_get_supported_renderers = byte function(byte _max, bgfx_renderer_type_t* _enum);
  2048. da_bgfx_get_supported_renderers bgfx_get_supported_renderers;
  2049. /**
  2050. * Returns name of renderer.
  2051. * Params:
  2052. * _type = Renderer backend type. See: `bgfx::RendererType`
  2053. */
  2054. alias da_bgfx_get_renderer_name = const(char)* function(bgfx_renderer_type_t _type);
  2055. da_bgfx_get_renderer_name bgfx_get_renderer_name;
  2056. alias da_bgfx_init_ctor = void function(bgfx_init_t* _init);
  2057. da_bgfx_init_ctor bgfx_init_ctor;
  2058. /**
  2059. * Initialize bgfx library.
  2060. * Params:
  2061. * _init = Initialization parameters. See: `bgfx::Init` for more info.
  2062. */
  2063. alias da_bgfx_init = bool function(const(bgfx_init_t)* _init);
  2064. da_bgfx_init bgfx_init;
  2065. /**
  2066. * Shutdown bgfx library.
  2067. */
  2068. alias da_bgfx_shutdown = void function();
  2069. da_bgfx_shutdown bgfx_shutdown;
  2070. /**
  2071. * Reset graphic settings and back-buffer size.
  2072. * Attention: This call doesn't actually change window size, it just
  2073. * resizes back-buffer. Windowing code has to change window size.
  2074. * Params:
  2075. * _width = Back-buffer width.
  2076. * _height = Back-buffer height.
  2077. * _flags = See: `BGFX_RESET_*` for more info.
  2078. * - `BGFX_RESET_NONE` - No reset flags.
  2079. * - `BGFX_RESET_FULLSCREEN` - Not supported yet.
  2080. * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
  2081. * - `BGFX_RESET_VSYNC` - Enable V-Sync.
  2082. * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
  2083. * - `BGFX_RESET_CAPTURE` - Begin screen capture.
  2084. * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
  2085. * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
  2086. * occurs. Default behavior is that flip occurs before rendering new
  2087. * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  2088. * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer.
  2089. * _format = Texture format. See: `TextureFormat::Enum`.
  2090. */
  2091. alias da_bgfx_reset = void function(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format);
  2092. da_bgfx_reset bgfx_reset;
  2093. /**
  2094. * Advance to next frame. When using multithreaded renderer, this call
  2095. * just swaps internal buffers, kicks render thread, and returns. In
  2096. * singlethreaded renderer this call does frame rendering.
  2097. * Params:
  2098. * _capture = Capture frame with graphics debugger.
  2099. */
  2100. alias da_bgfx_frame = uint function(bool _capture);
  2101. da_bgfx_frame bgfx_frame;
  2102. /**
  2103. * Returns current renderer backend API type.
  2104. * Remarks:
  2105. * Library must be initialized.
  2106. */
  2107. alias da_bgfx_get_renderer_type = bgfx_renderer_type_t function();
  2108. da_bgfx_get_renderer_type bgfx_get_renderer_type;
  2109. /**
  2110. * Returns renderer capabilities.
  2111. * Remarks:
  2112. * Library must be initialized.
  2113. */
  2114. alias da_bgfx_get_caps = const(bgfx_caps_t)* function();
  2115. da_bgfx_get_caps bgfx_get_caps;
  2116. /**
  2117. * Returns performance counters.
  2118. * Attention: Pointer returned is valid until `bgfx::frame` is called.
  2119. */
  2120. alias da_bgfx_get_stats = const(bgfx_stats_t)* function();
  2121. da_bgfx_get_stats bgfx_get_stats;
  2122. /**
  2123. * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
  2124. * Params:
  2125. * _size = Size to allocate.
  2126. */
  2127. alias da_bgfx_alloc = const(bgfx_memory_t)* function(uint _size);
  2128. da_bgfx_alloc bgfx_alloc;
  2129. /**
  2130. * Allocate buffer and copy data into it. Data will be freed inside bgfx.
  2131. * Params:
  2132. * _data = Pointer to data to be copied.
  2133. * _size = Size of data to be copied.
  2134. */
  2135. alias da_bgfx_copy = const(bgfx_memory_t)* function(const(void)* _data, uint _size);
  2136. da_bgfx_copy bgfx_copy;
  2137. /**
  2138. * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  2139. * doesn't allocate memory for data. It just copies the _data pointer. You
  2140. * can pass `ReleaseFn` function pointer to release this memory after it's
  2141. * consumed, otherwise you must make sure _data is available for at least 2
  2142. * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  2143. * from any thread.
  2144. * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
  2145. * Params:
  2146. * _data = Pointer to data.
  2147. * _size = Size of data.
  2148. */
  2149. alias da_bgfx_make_ref = const(bgfx_memory_t)* function(const(void)* _data, uint _size);
  2150. da_bgfx_make_ref bgfx_make_ref;
  2151. /**
  2152. * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  2153. * doesn't allocate memory for data. It just copies the _data pointer. You
  2154. * can pass `ReleaseFn` function pointer to release this memory after it's
  2155. * consumed, otherwise you must make sure _data is available for at least 2
  2156. * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  2157. * from any thread.
  2158. * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
  2159. * Params:
  2160. * _data = Pointer to data.
  2161. * _size = Size of data.
  2162. * _releaseFn = Callback function to release memory after use.
  2163. * _userData = User data to be passed to callback function.
  2164. */
  2165. alias da_bgfx_make_ref_release = const(bgfx_memory_t)* function(const(void)* _data, uint _size, void* _releaseFn, void* _userData);
  2166. da_bgfx_make_ref_release bgfx_make_ref_release;
  2167. /**
  2168. * Set debug flags.
  2169. * Params:
  2170. * _debug = Available flags:
  2171. * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
  2172. * all rendering calls will be skipped. This is useful when profiling
  2173. * to quickly assess potential bottlenecks between CPU and GPU.
  2174. * - `BGFX_DEBUG_PROFILER` - Enable profiler.
  2175. * - `BGFX_DEBUG_STATS` - Display internal statistics.
  2176. * - `BGFX_DEBUG_TEXT` - Display debug text.
  2177. * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
  2178. * primitives will be rendered as lines.
  2179. */
  2180. alias da_bgfx_set_debug = void function(uint _debug);
  2181. da_bgfx_set_debug bgfx_set_debug;
  2182. /**
  2183. * Clear internal debug text buffer.
  2184. * Params:
  2185. * _attr = Background color.
  2186. * _small = Default 8x16 or 8x8 font.
  2187. */
  2188. alias da_bgfx_dbg_text_clear = void function(byte _attr, bool _small);
  2189. da_bgfx_dbg_text_clear bgfx_dbg_text_clear;
  2190. /**
  2191. * Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
  2192. * Params:
  2193. * _x = Position x from the left corner of the window.
  2194. * _y = Position y from the top corner of the window.
  2195. * _attr = Color palette. Where top 4-bits represent index of background, and bottom
  2196. * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  2197. * _format = `printf` style format.
  2198. */
  2199. alias da_bgfx_dbg_text_printf = void function(ushort _x, ushort _y, byte _attr, const(char)* _format, ... );
  2200. da_bgfx_dbg_text_printf bgfx_dbg_text_printf;
  2201. /**
  2202. * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
  2203. * Params:
  2204. * _x = Position x from the left corner of the window.
  2205. * _y = Position y from the top corner of the window.
  2206. * _attr = Color palette. Where top 4-bits represent index of background, and bottom
  2207. * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  2208. * _format = `printf` style format.
  2209. * _argList = Variable arguments list for format string.
  2210. */
  2211. alias da_bgfx_dbg_text_vprintf = void function(ushort _x, ushort _y, byte _attr, const(char)* _format, va_list _argList);
  2212. da_bgfx_dbg_text_vprintf bgfx_dbg_text_vprintf;
  2213. /**
  2214. * Draw image into internal debug text buffer.
  2215. * Params:
  2216. * _x = Position x from the left corner of the window.
  2217. * _y = Position y from the top corner of the window.
  2218. * _width = Image width.
  2219. * _height = Image height.
  2220. * _data = Raw image data (character/attribute raw encoding).
  2221. * _pitch = Image pitch in bytes.
  2222. */
  2223. alias da_bgfx_dbg_text_image = void function(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch);
  2224. da_bgfx_dbg_text_image bgfx_dbg_text_image;
  2225. /**
  2226. * Create static index buffer.
  2227. * Params:
  2228. * _mem = Index buffer data.
  2229. * _flags = Buffer creation flags.
  2230. * - `BGFX_BUFFER_NONE` - No flags.
  2231. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2232. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2233. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2234. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2235. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2236. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2237. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2238. * buffers.
  2239. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2240. * index buffers.
  2241. */
  2242. alias da_bgfx_create_index_buffer = bgfx_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags);
  2243. da_bgfx_create_index_buffer bgfx_create_index_buffer;
  2244. /**
  2245. * Set static index buffer debug name.
  2246. * Params:
  2247. * _handle = Static index buffer handle.
  2248. * _name = Static index buffer name.
  2249. * _len = Static index buffer name length (if length is INT32_MAX, it's expected
  2250. * that _name is zero terminated string.
  2251. */
  2252. alias da_bgfx_set_index_buffer_name = void function(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len);
  2253. da_bgfx_set_index_buffer_name bgfx_set_index_buffer_name;
  2254. /**
  2255. * Destroy static index buffer.
  2256. * Params:
  2257. * _handle = Static index buffer handle.
  2258. */
  2259. alias da_bgfx_destroy_index_buffer = void function(bgfx_index_buffer_handle_t _handle);
  2260. da_bgfx_destroy_index_buffer bgfx_destroy_index_buffer;
  2261. /**
  2262. * Create vertex layout.
  2263. * Params:
  2264. * _layout = Vertex layout.
  2265. */
  2266. alias da_bgfx_create_vertex_layout = bgfx_vertex_layout_handle_t function(const(bgfx_vertex_layout_t)* _layout);
  2267. da_bgfx_create_vertex_layout bgfx_create_vertex_layout;
  2268. /**
  2269. * Destroy vertex layout.
  2270. * Params:
  2271. * _layoutHandle = Vertex layout handle.
  2272. */
  2273. alias da_bgfx_destroy_vertex_layout = void function(bgfx_vertex_layout_handle_t _layoutHandle);
  2274. da_bgfx_destroy_vertex_layout bgfx_destroy_vertex_layout;
  2275. /**
  2276. * Create static vertex buffer.
  2277. * Params:
  2278. * _mem = Vertex buffer data.
  2279. * _layout = Vertex layout.
  2280. * _flags = Buffer creation flags.
  2281. * - `BGFX_BUFFER_NONE` - No flags.
  2282. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2283. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2284. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2285. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2286. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2287. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2288. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
  2289. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
  2290. */
  2291. alias da_bgfx_create_vertex_buffer = bgfx_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  2292. da_bgfx_create_vertex_buffer bgfx_create_vertex_buffer;
  2293. /**
  2294. * Set static vertex buffer debug name.
  2295. * Params:
  2296. * _handle = Static vertex buffer handle.
  2297. * _name = Static vertex buffer name.
  2298. * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected
  2299. * that _name is zero terminated string.
  2300. */
  2301. alias da_bgfx_set_vertex_buffer_name = void function(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len);
  2302. da_bgfx_set_vertex_buffer_name bgfx_set_vertex_buffer_name;
  2303. /**
  2304. * Destroy static vertex buffer.
  2305. * Params:
  2306. * _handle = Static vertex buffer handle.
  2307. */
  2308. alias da_bgfx_destroy_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle);
  2309. da_bgfx_destroy_vertex_buffer bgfx_destroy_vertex_buffer;
  2310. /**
  2311. * Create empty dynamic index buffer.
  2312. * Params:
  2313. * _num = Number of indices.
  2314. * _flags = Buffer creation flags.
  2315. * - `BGFX_BUFFER_NONE` - No flags.
  2316. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2317. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2318. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2319. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2320. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2321. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2322. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2323. * buffers.
  2324. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2325. * index buffers.
  2326. */
  2327. alias da_bgfx_create_dynamic_index_buffer = bgfx_dynamic_index_buffer_handle_t function(uint _num, ushort _flags);
  2328. da_bgfx_create_dynamic_index_buffer bgfx_create_dynamic_index_buffer;
  2329. /**
  2330. * Create dynamic index buffer and initialized it.
  2331. * Params:
  2332. * _mem = Index buffer data.
  2333. * _flags = Buffer creation flags.
  2334. * - `BGFX_BUFFER_NONE` - No flags.
  2335. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2336. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2337. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2338. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2339. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2340. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2341. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2342. * buffers.
  2343. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2344. * index buffers.
  2345. */
  2346. alias da_bgfx_create_dynamic_index_buffer_mem = bgfx_dynamic_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags);
  2347. da_bgfx_create_dynamic_index_buffer_mem bgfx_create_dynamic_index_buffer_mem;
  2348. /**
  2349. * Update dynamic index buffer.
  2350. * Params:
  2351. * _handle = Dynamic index buffer handle.
  2352. * _startIndex = Start index.
  2353. * _mem = Index buffer data.
  2354. */
  2355. alias da_bgfx_update_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem);
  2356. da_bgfx_update_dynamic_index_buffer bgfx_update_dynamic_index_buffer;
  2357. /**
  2358. * Destroy dynamic index buffer.
  2359. * Params:
  2360. * _handle = Dynamic index buffer handle.
  2361. */
  2362. alias da_bgfx_destroy_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle);
  2363. da_bgfx_destroy_dynamic_index_buffer bgfx_destroy_dynamic_index_buffer;
  2364. /**
  2365. * Create empty dynamic vertex buffer.
  2366. * Params:
  2367. * _num = Number of vertices.
  2368. * _layout = Vertex layout.
  2369. * _flags = Buffer creation flags.
  2370. * - `BGFX_BUFFER_NONE` - No flags.
  2371. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2372. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2373. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2374. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2375. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2376. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2377. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2378. * buffers.
  2379. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2380. * index buffers.
  2381. */
  2382. alias da_bgfx_create_dynamic_vertex_buffer = bgfx_dynamic_vertex_buffer_handle_t function(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  2383. da_bgfx_create_dynamic_vertex_buffer bgfx_create_dynamic_vertex_buffer;
  2384. /**
  2385. * Create dynamic vertex buffer and initialize it.
  2386. * Params:
  2387. * _mem = Vertex buffer data.
  2388. * _layout = Vertex layout.
  2389. * _flags = Buffer creation flags.
  2390. * - `BGFX_BUFFER_NONE` - No flags.
  2391. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2392. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2393. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2394. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2395. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2396. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2397. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2398. * buffers.
  2399. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2400. * index buffers.
  2401. */
  2402. alias da_bgfx_create_dynamic_vertex_buffer_mem = bgfx_dynamic_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  2403. da_bgfx_create_dynamic_vertex_buffer_mem bgfx_create_dynamic_vertex_buffer_mem;
  2404. /**
  2405. * Update dynamic vertex buffer.
  2406. * Params:
  2407. * _handle = Dynamic vertex buffer handle.
  2408. * _startVertex = Start vertex.
  2409. * _mem = Vertex buffer data.
  2410. */
  2411. alias da_bgfx_update_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem);
  2412. da_bgfx_update_dynamic_vertex_buffer bgfx_update_dynamic_vertex_buffer;
  2413. /**
  2414. * Destroy dynamic vertex buffer.
  2415. * Params:
  2416. * _handle = Dynamic vertex buffer handle.
  2417. */
  2418. alias da_bgfx_destroy_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle);
  2419. da_bgfx_destroy_dynamic_vertex_buffer bgfx_destroy_dynamic_vertex_buffer;
  2420. /**
  2421. * Returns number of requested or maximum available indices.
  2422. * Params:
  2423. * _num = Number of required indices.
  2424. */
  2425. alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num);
  2426. da_bgfx_get_avail_transient_index_buffer bgfx_get_avail_transient_index_buffer;
  2427. /**
  2428. * Returns number of requested or maximum available vertices.
  2429. * Params:
  2430. * _num = Number of required vertices.
  2431. * _layout = Vertex layout.
  2432. */
  2433. alias da_bgfx_get_avail_transient_vertex_buffer = uint function(uint _num, const(bgfx_vertex_layout_t)* _layout);
  2434. da_bgfx_get_avail_transient_vertex_buffer bgfx_get_avail_transient_vertex_buffer;
  2435. /**
  2436. * Returns number of requested or maximum available instance buffer slots.
  2437. * Params:
  2438. * _num = Number of required instances.
  2439. * _stride = Stride per instance.
  2440. */
  2441. alias da_bgfx_get_avail_instance_data_buffer = uint function(uint _num, ushort _stride);
  2442. da_bgfx_get_avail_instance_data_buffer bgfx_get_avail_instance_data_buffer;
  2443. /**
  2444. * Allocate transient index buffer.
  2445. * Remarks:
  2446. * Only 16-bit index buffer is supported.
  2447. * Params:
  2448. * _tib = TransientIndexBuffer structure is filled and is valid
  2449. * for the duration of frame, and it can be reused for multiple draw
  2450. * calls.
  2451. * _num = Number of indices to allocate.
  2452. */
  2453. alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num);
  2454. da_bgfx_alloc_transient_index_buffer bgfx_alloc_transient_index_buffer;
  2455. /**
  2456. * Allocate transient vertex buffer.
  2457. * Params:
  2458. * _tvb = TransientVertexBuffer structure is filled and is valid
  2459. * for the duration of frame, and it can be reused for multiple draw
  2460. * calls.
  2461. * _num = Number of vertices to allocate.
  2462. * _layout = Vertex layout.
  2463. */
  2464. alias da_bgfx_alloc_transient_vertex_buffer = void function(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout);
  2465. da_bgfx_alloc_transient_vertex_buffer bgfx_alloc_transient_vertex_buffer;
  2466. /**
  2467. * Check for required space and allocate transient vertex and index
  2468. * buffers. If both space requirements are satisfied function returns
  2469. * true.
  2470. * Remarks:
  2471. * Only 16-bit index buffer is supported.
  2472. * Params:
  2473. * _tvb = TransientVertexBuffer structure is filled and is valid
  2474. * for the duration of frame, and it can be reused for multiple draw
  2475. * calls.
  2476. * _layout = Vertex layout.
  2477. * _numVertices = Number of vertices to allocate.
  2478. * _tib = TransientIndexBuffer structure is filled and is valid
  2479. * for the duration of frame, and it can be reused for multiple draw
  2480. * calls.
  2481. * _numIndices = Number of indices to allocate.
  2482. */
  2483. alias da_bgfx_alloc_transient_buffers = bool function(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices);
  2484. da_bgfx_alloc_transient_buffers bgfx_alloc_transient_buffers;
  2485. /**
  2486. * Allocate instance data buffer.
  2487. * Params:
  2488. * _idb = InstanceDataBuffer structure is filled and is valid
  2489. * for duration of frame, and it can be reused for multiple draw
  2490. * calls.
  2491. * _num = Number of instances.
  2492. * _stride = Instance stride. Must be multiple of 16.
  2493. */
  2494. alias da_bgfx_alloc_instance_data_buffer = void function(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride);
  2495. da_bgfx_alloc_instance_data_buffer bgfx_alloc_instance_data_buffer;
  2496. /**
  2497. * Create draw indirect buffer.
  2498. * Params:
  2499. * _num = Number of indirect calls.
  2500. */
  2501. alias da_bgfx_create_indirect_buffer = bgfx_indirect_buffer_handle_t function(uint _num);
  2502. da_bgfx_create_indirect_buffer bgfx_create_indirect_buffer;
  2503. /**
  2504. * Destroy draw indirect buffer.
  2505. * Params:
  2506. * _handle = Indirect buffer handle.
  2507. */
  2508. alias da_bgfx_destroy_indirect_buffer = void function(bgfx_indirect_buffer_handle_t _handle);
  2509. da_bgfx_destroy_indirect_buffer bgfx_destroy_indirect_buffer;
  2510. /**
  2511. * Create shader from memory buffer.
  2512. * Params:
  2513. * _mem = Shader binary.
  2514. */
  2515. alias da_bgfx_create_shader = bgfx_shader_handle_t function(const(bgfx_memory_t)* _mem);
  2516. da_bgfx_create_shader bgfx_create_shader;
  2517. /**
  2518. * Returns the number of uniforms and uniform handles used inside a shader.
  2519. * Remarks:
  2520. * Only non-predefined uniforms are returned.
  2521. * Params:
  2522. * _handle = Shader handle.
  2523. * _uniforms = UniformHandle array where data will be stored.
  2524. * _max = Maximum capacity of array.
  2525. */
  2526. alias da_bgfx_get_shader_uniforms = ushort function(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max);
  2527. da_bgfx_get_shader_uniforms bgfx_get_shader_uniforms;
  2528. /**
  2529. * Set shader debug name.
  2530. * Params:
  2531. * _handle = Shader handle.
  2532. * _name = Shader name.
  2533. * _len = Shader name length (if length is INT32_MAX, it's expected
  2534. * that _name is zero terminated string).
  2535. */
  2536. alias da_bgfx_set_shader_name = void function(bgfx_shader_handle_t _handle, const(char)* _name, int _len);
  2537. da_bgfx_set_shader_name bgfx_set_shader_name;
  2538. /**
  2539. * Destroy shader.
  2540. * Remarks: Once a shader program is created with _handle,
  2541. * it is safe to destroy that shader.
  2542. * Params:
  2543. * _handle = Shader handle.
  2544. */
  2545. alias da_bgfx_destroy_shader = void function(bgfx_shader_handle_t _handle);
  2546. da_bgfx_destroy_shader bgfx_destroy_shader;
  2547. /**
  2548. * Create program with vertex and fragment shaders.
  2549. * Params:
  2550. * _vsh = Vertex shader.
  2551. * _fsh = Fragment shader.
  2552. * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
  2553. */
  2554. alias da_bgfx_create_program = bgfx_program_handle_t function(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
  2555. da_bgfx_create_program bgfx_create_program;
  2556. /**
  2557. * Create program with compute shader.
  2558. * Params:
  2559. * _csh = Compute shader.
  2560. * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
  2561. */
  2562. alias da_bgfx_create_compute_program = bgfx_program_handle_t function(bgfx_shader_handle_t _csh, bool _destroyShaders);
  2563. da_bgfx_create_compute_program bgfx_create_compute_program;
  2564. /**
  2565. * Destroy program.
  2566. * Params:
  2567. * _handle = Program handle.
  2568. */
  2569. alias da_bgfx_destroy_program = void function(bgfx_program_handle_t _handle);
  2570. da_bgfx_destroy_program bgfx_destroy_program;
  2571. /**
  2572. * Validate texture parameters.
  2573. * Params:
  2574. * _depth = Depth dimension of volume texture.
  2575. * _cubeMap = Indicates that texture contains cubemap.
  2576. * _numLayers = Number of layers in texture array.
  2577. * _format = Texture format. See: `TextureFormat::Enum`.
  2578. * _flags = Texture flags. See `BGFX_TEXTURE_*`.
  2579. */
  2580. alias da_bgfx_is_texture_valid = bool function(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
  2581. da_bgfx_is_texture_valid bgfx_is_texture_valid;
  2582. /**
  2583. * Calculate amount of memory required for texture.
  2584. * Params:
  2585. * _info = Resulting texture info structure. See: `TextureInfo`.
  2586. * _width = Width.
  2587. * _height = Height.
  2588. * _depth = Depth dimension of volume texture.
  2589. * _cubeMap = Indicates that texture contains cubemap.
  2590. * _hasMips = Indicates that texture contains full mip-map chain.
  2591. * _numLayers = Number of layers in texture array.
  2592. * _format = Texture format. See: `TextureFormat::Enum`.
  2593. */
  2594. alias da_bgfx_calc_texture_size = void function(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format);
  2595. da_bgfx_calc_texture_size bgfx_calc_texture_size;
  2596. /**
  2597. * Create texture from memory buffer.
  2598. * Params:
  2599. * _mem = DDS, KTX or PVR texture binary data.
  2600. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2601. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2602. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2603. * mode.
  2604. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2605. * sampling.
  2606. * _skip = Skip top level mips when parsing texture.
  2607. * _info = When non-`NULL` is specified it returns parsed texture information.
  2608. */
  2609. alias da_bgfx_create_texture = bgfx_texture_handle_t function(const(bgfx_memory_t)* _mem, ulong _flags, byte _skip, bgfx_texture_info_t* _info);
  2610. da_bgfx_create_texture bgfx_create_texture;
  2611. /**
  2612. * Create 2D texture.
  2613. * Params:
  2614. * _width = Width.
  2615. * _height = Height.
  2616. * _hasMips = Indicates that texture contains full mip-map chain.
  2617. * _numLayers = Number of layers in texture array. Must be 1 if caps
  2618. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  2619. * _format = Texture format. See: `TextureFormat::Enum`.
  2620. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2621. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2622. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2623. * mode.
  2624. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2625. * sampling.
  2626. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  2627. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  2628. * 1, expected memory layout is texture and all mips together for each array element.
  2629. */
  2630. alias da_bgfx_create_texture_2d = bgfx_texture_handle_t function(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
  2631. da_bgfx_create_texture_2d bgfx_create_texture_2d;
  2632. /**
  2633. * Create texture with size based on backbuffer ratio. Texture will maintain ratio
  2634. * if back buffer resolution changes.
  2635. * Params:
  2636. * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
  2637. * _hasMips = Indicates that texture contains full mip-map chain.
  2638. * _numLayers = Number of layers in texture array. Must be 1 if caps
  2639. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  2640. * _format = Texture format. See: `TextureFormat::Enum`.
  2641. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2642. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2643. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2644. * mode.
  2645. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2646. * sampling.
  2647. */
  2648. alias da_bgfx_create_texture_2d_scaled = bgfx_texture_handle_t function(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
  2649. da_bgfx_create_texture_2d_scaled bgfx_create_texture_2d_scaled;
  2650. /**
  2651. * Create 3D texture.
  2652. * Params:
  2653. * _width = Width.
  2654. * _height = Height.
  2655. * _depth = Depth.
  2656. * _hasMips = Indicates that texture contains full mip-map chain.
  2657. * _format = Texture format. See: `TextureFormat::Enum`.
  2658. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2659. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2660. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2661. * mode.
  2662. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2663. * sampling.
  2664. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  2665. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  2666. * 1, expected memory layout is texture and all mips together for each array element.
  2667. */
  2668. alias da_bgfx_create_texture_3d = bgfx_texture_handle_t function(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
  2669. da_bgfx_create_texture_3d bgfx_create_texture_3d;
  2670. /**
  2671. * Create Cube texture.
  2672. * Params:
  2673. * _size = Cube side size.
  2674. * _hasMips = Indicates that texture contains full mip-map chain.
  2675. * _numLayers = Number of layers in texture array. Must be 1 if caps
  2676. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  2677. * _format = Texture format. See: `TextureFormat::Enum`.
  2678. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2679. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2680. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2681. * mode.
  2682. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2683. * sampling.
  2684. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  2685. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  2686. * 1, expected memory layout is texture and all mips together for each array element.
  2687. */
  2688. alias da_bgfx_create_texture_cube = bgfx_texture_handle_t function(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem);
  2689. da_bgfx_create_texture_cube bgfx_create_texture_cube;
  2690. /**
  2691. * Update 2D texture.
  2692. * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
  2693. * Params:
  2694. * _handle = Texture handle.
  2695. * _layer = Layer in texture array.
  2696. * _mip = Mip level.
  2697. * _x = X offset in texture.
  2698. * _y = Y offset in texture.
  2699. * _width = Width of texture block.
  2700. * _height = Height of texture block.
  2701. * _mem = Texture update data.
  2702. * _pitch = Pitch of input image (bytes). When _pitch is set to
  2703. * UINT16_MAX, it will be calculated internally based on _width.
  2704. */
  2705. alias da_bgfx_update_texture_2d = void function(bgfx_texture_handle_t _handle, ushort _layer, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
  2706. da_bgfx_update_texture_2d bgfx_update_texture_2d;
  2707. /**
  2708. * Update 3D texture.
  2709. * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
  2710. * Params:
  2711. * _handle = Texture handle.
  2712. * _mip = Mip level.
  2713. * _x = X offset in texture.
  2714. * _y = Y offset in texture.
  2715. * _z = Z offset in texture.
  2716. * _width = Width of texture block.
  2717. * _height = Height of texture block.
  2718. * _depth = Depth of texture block.
  2719. * _mem = Texture update data.
  2720. */
  2721. alias da_bgfx_update_texture_3d = void function(bgfx_texture_handle_t _handle, byte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem);
  2722. da_bgfx_update_texture_3d bgfx_update_texture_3d;
  2723. /**
  2724. * Update Cube texture.
  2725. * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
  2726. * Params:
  2727. * _handle = Texture handle.
  2728. * _layer = Layer in texture array.
  2729. * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
  2730. * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
  2731. * +----------+
  2732. * |-z 2|
  2733. * | ^ +y |
  2734. * | | | Unfolded cube:
  2735. * | +---->+x |
  2736. * +----------+----------+----------+----------+
  2737. * |+y 1|+y 4|+y 0|+y 5|
  2738. * | ^ -x | ^ +z | ^ +x | ^ -z |
  2739. * | | | | | | | | |
  2740. * | +---->+z | +---->+x | +---->-z | +---->-x |
  2741. * +----------+----------+----------+----------+
  2742. * |+z 3|
  2743. * | ^ -y |
  2744. * | | |
  2745. * | +---->+x |
  2746. * +----------+
  2747. * _mip = Mip level.
  2748. * _x = X offset in texture.
  2749. * _y = Y offset in texture.
  2750. * _width = Width of texture block.
  2751. * _height = Height of texture block.
  2752. * _mem = Texture update data.
  2753. * _pitch = Pitch of input image (bytes). When _pitch is set to
  2754. * UINT16_MAX, it will be calculated internally based on _width.
  2755. */
  2756. alias da_bgfx_update_texture_cube = void function(bgfx_texture_handle_t _handle, ushort _layer, byte _side, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch);
  2757. da_bgfx_update_texture_cube bgfx_update_texture_cube;
  2758. /**
  2759. * Read back texture content.
  2760. * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
  2761. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
  2762. * Params:
  2763. * _handle = Texture handle.
  2764. * _data = Destination buffer.
  2765. * _mip = Mip level.
  2766. */
  2767. alias da_bgfx_read_texture = uint function(bgfx_texture_handle_t _handle, void* _data, byte _mip);
  2768. da_bgfx_read_texture bgfx_read_texture;
  2769. /**
  2770. * Set texture debug name.
  2771. * Params:
  2772. * _handle = Texture handle.
  2773. * _name = Texture name.
  2774. * _len = Texture name length (if length is INT32_MAX, it's expected
  2775. * that _name is zero terminated string.
  2776. */
  2777. alias da_bgfx_set_texture_name = void function(bgfx_texture_handle_t _handle, const(char)* _name, int _len);
  2778. da_bgfx_set_texture_name bgfx_set_texture_name;
  2779. /**
  2780. * Returns texture direct access pointer.
  2781. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
  2782. * is available on GPUs that have unified memory architecture (UMA) support.
  2783. * Params:
  2784. * _handle = Texture handle.
  2785. */
  2786. alias da_bgfx_get_direct_access_ptr = void* function(bgfx_texture_handle_t _handle);
  2787. da_bgfx_get_direct_access_ptr bgfx_get_direct_access_ptr;
  2788. /**
  2789. * Destroy texture.
  2790. * Params:
  2791. * _handle = Texture handle.
  2792. */
  2793. alias da_bgfx_destroy_texture = void function(bgfx_texture_handle_t _handle);
  2794. da_bgfx_destroy_texture bgfx_destroy_texture;
  2795. /**
  2796. * Create frame buffer (simple).
  2797. * Params:
  2798. * _width = Texture width.
  2799. * _height = Texture height.
  2800. * _format = Texture format. See: `TextureFormat::Enum`.
  2801. * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2802. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2803. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2804. * mode.
  2805. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2806. * sampling.
  2807. */
  2808. alias da_bgfx_create_frame_buffer = bgfx_frame_buffer_handle_t function(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags);
  2809. da_bgfx_create_frame_buffer bgfx_create_frame_buffer;
  2810. /**
  2811. * Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio
  2812. * if back buffer resolution changes.
  2813. * Params:
  2814. * _ratio = Frame buffer size in respect to back-buffer size. See:
  2815. * `BackbufferRatio::Enum`.
  2816. * _format = Texture format. See: `TextureFormat::Enum`.
  2817. * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2818. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2819. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2820. * mode.
  2821. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2822. * sampling.
  2823. */
  2824. alias da_bgfx_create_frame_buffer_scaled = bgfx_frame_buffer_handle_t function(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags);
  2825. da_bgfx_create_frame_buffer_scaled bgfx_create_frame_buffer_scaled;
  2826. /**
  2827. * Create MRT frame buffer from texture handles (simple).
  2828. * Params:
  2829. * _num = Number of texture handles.
  2830. * _handles = Texture attachments.
  2831. * _destroyTexture = If true, textures will be destroyed when
  2832. * frame buffer is destroyed.
  2833. */
  2834. alias da_bgfx_create_frame_buffer_from_handles = bgfx_frame_buffer_handle_t function(byte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture);
  2835. da_bgfx_create_frame_buffer_from_handles bgfx_create_frame_buffer_from_handles;
  2836. /**
  2837. * Create MRT frame buffer from texture handles with specific layer and
  2838. * mip level.
  2839. * Params:
  2840. * _num = Number of attachements.
  2841. * _attachment = Attachment texture info. See: `bgfx::Attachment`.
  2842. * _destroyTexture = If true, textures will be destroyed when
  2843. * frame buffer is destroyed.
  2844. */
  2845. alias da_bgfx_create_frame_buffer_from_attachment = bgfx_frame_buffer_handle_t function(byte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture);
  2846. da_bgfx_create_frame_buffer_from_attachment bgfx_create_frame_buffer_from_attachment;
  2847. /**
  2848. * Create frame buffer for multiple window rendering.
  2849. * Remarks:
  2850. * Frame buffer cannot be used for sampling.
  2851. * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
  2852. * Params:
  2853. * _nwh = OS' target native window handle.
  2854. * _width = Window back buffer width.
  2855. * _height = Window back buffer height.
  2856. * _format = Window back buffer color format.
  2857. * _depthFormat = Window back buffer depth format.
  2858. */
  2859. alias da_bgfx_create_frame_buffer_from_nwh = bgfx_frame_buffer_handle_t function(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat);
  2860. da_bgfx_create_frame_buffer_from_nwh bgfx_create_frame_buffer_from_nwh;
  2861. /**
  2862. * Set frame buffer debug name.
  2863. * Params:
  2864. * _handle = Frame buffer handle.
  2865. * _name = Frame buffer name.
  2866. * _len = Frame buffer name length (if length is INT32_MAX, it's expected
  2867. * that _name is zero terminated string.
  2868. */
  2869. alias da_bgfx_set_frame_buffer_name = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len);
  2870. da_bgfx_set_frame_buffer_name bgfx_set_frame_buffer_name;
  2871. /**
  2872. * Obtain texture handle of frame buffer attachment.
  2873. * Params:
  2874. * _handle = Frame buffer handle.
  2875. */
  2876. alias da_bgfx_get_texture = bgfx_texture_handle_t function(bgfx_frame_buffer_handle_t _handle, byte _attachment);
  2877. da_bgfx_get_texture bgfx_get_texture;
  2878. /**
  2879. * Destroy frame buffer.
  2880. * Params:
  2881. * _handle = Frame buffer handle.
  2882. */
  2883. alias da_bgfx_destroy_frame_buffer = void function(bgfx_frame_buffer_handle_t _handle);
  2884. da_bgfx_destroy_frame_buffer bgfx_destroy_frame_buffer;
  2885. /**
  2886. * Create shader uniform parameter.
  2887. * Remarks:
  2888. * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
  2889. * multiple times with the same uniform name. The library will always
  2890. * return the same handle, but the handle reference count will be
  2891. * incremented. This means that the same number of `bgfx::destroyUniform`
  2892. * must be called to properly destroy the uniform.
  2893. * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
  2894. * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
  2895. * view, in pixels.
  2896. * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
  2897. * width and height
  2898. * - `u_view mat4` - view matrix
  2899. * - `u_invView mat4` - inverted view matrix
  2900. * - `u_proj mat4` - projection matrix
  2901. * - `u_invProj mat4` - inverted projection matrix
  2902. * - `u_viewProj mat4` - concatenated view projection matrix
  2903. * - `u_invViewProj mat4` - concatenated inverted view projection matrix
  2904. * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
  2905. * - `u_modelView mat4` - concatenated model view matrix, only first
  2906. * model matrix from array is used.
  2907. * - `u_modelViewProj mat4` - concatenated model view projection matrix.
  2908. * - `u_alphaRef float` - alpha reference value for alpha test.
  2909. * Params:
  2910. * _name = Uniform name in shader.
  2911. * _type = Type of uniform (See: `bgfx::UniformType`).
  2912. * _num = Number of elements in array.
  2913. */
  2914. alias da_bgfx_create_uniform = bgfx_uniform_handle_t function(const(char)* _name, bgfx_uniform_type_t _type, ushort _num);
  2915. da_bgfx_create_uniform bgfx_create_uniform;
  2916. /**
  2917. * Retrieve uniform info.
  2918. * Params:
  2919. * _handle = Handle to uniform object.
  2920. * _info = Uniform info.
  2921. */
  2922. alias da_bgfx_get_uniform_info = void function(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info);
  2923. da_bgfx_get_uniform_info bgfx_get_uniform_info;
  2924. /**
  2925. * Destroy shader uniform parameter.
  2926. * Params:
  2927. * _handle = Handle to uniform object.
  2928. */
  2929. alias da_bgfx_destroy_uniform = void function(bgfx_uniform_handle_t _handle);
  2930. da_bgfx_destroy_uniform bgfx_destroy_uniform;
  2931. /**
  2932. * Create occlusion query.
  2933. */
  2934. alias da_bgfx_create_occlusion_query = bgfx_occlusion_query_handle_t function();
  2935. da_bgfx_create_occlusion_query bgfx_create_occlusion_query;
  2936. /**
  2937. * Retrieve occlusion query result from previous frame.
  2938. * Params:
  2939. * _handle = Handle to occlusion query object.
  2940. * _result = Number of pixels that passed test. This argument
  2941. * can be `NULL` if result of occlusion query is not needed.
  2942. */
  2943. alias da_bgfx_get_result = bgfx_occlusion_query_result_t function(bgfx_occlusion_query_handle_t _handle, int* _result);
  2944. da_bgfx_get_result bgfx_get_result;
  2945. /**
  2946. * Destroy occlusion query.
  2947. * Params:
  2948. * _handle = Handle to occlusion query object.
  2949. */
  2950. alias da_bgfx_destroy_occlusion_query = void function(bgfx_occlusion_query_handle_t _handle);
  2951. da_bgfx_destroy_occlusion_query bgfx_destroy_occlusion_query;
  2952. /**
  2953. * Set palette color value.
  2954. * Params:
  2955. * _index = Index into palette.
  2956. * _rgba = RGBA floating point values.
  2957. */
  2958. alias da_bgfx_set_palette_color = void function(byte _index, const float[4] _rgba);
  2959. da_bgfx_set_palette_color bgfx_set_palette_color;
  2960. /**
  2961. * Set palette color value.
  2962. * Params:
  2963. * _index = Index into palette.
  2964. * _rgba = Packed 32-bit RGBA value.
  2965. */
  2966. alias da_bgfx_set_palette_color_rgba8 = void function(byte _index, uint _rgba);
  2967. da_bgfx_set_palette_color_rgba8 bgfx_set_palette_color_rgba8;
  2968. /**
  2969. * Set view name.
  2970. * Remarks:
  2971. * This is debug only feature.
  2972. * In graphics debugger view name will appear as:
  2973. * "nnnc <view name>"
  2974. * ^ ^ ^
  2975. * | +--- compute (C)
  2976. * +------ view id
  2977. * Params:
  2978. * _id = View id.
  2979. * _name = View name.
  2980. */
  2981. alias da_bgfx_set_view_name = void function(bgfx_view_id_t _id, const(char)* _name);
  2982. da_bgfx_set_view_name bgfx_set_view_name;
  2983. /**
  2984. * Set view rectangle. Draw primitive outside view will be clipped.
  2985. * Params:
  2986. * _id = View id.
  2987. * _x = Position x from the left corner of the window.
  2988. * _y = Position y from the top corner of the window.
  2989. * _width = Width of view port region.
  2990. * _height = Height of view port region.
  2991. */
  2992. alias da_bgfx_set_view_rect = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
  2993. da_bgfx_set_view_rect bgfx_set_view_rect;
  2994. /**
  2995. * Set view rectangle. Draw primitive outside view will be clipped.
  2996. * Params:
  2997. * _id = View id.
  2998. * _x = Position x from the left corner of the window.
  2999. * _y = Position y from the top corner of the window.
  3000. * _ratio = Width and height will be set in respect to back-buffer size.
  3001. * See: `BackbufferRatio::Enum`.
  3002. */
  3003. alias da_bgfx_set_view_rect_ratio = void function(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio);
  3004. da_bgfx_set_view_rect_ratio bgfx_set_view_rect_ratio;
  3005. /**
  3006. * Set view scissor. Draw primitive outside view will be clipped. When
  3007. * _x, _y, _width and _height are set to 0, scissor will be disabled.
  3008. * Params:
  3009. * _id = View id.
  3010. * _x = Position x from the left corner of the window.
  3011. * _y = Position y from the top corner of the window.
  3012. * _width = Width of view scissor region.
  3013. * _height = Height of view scissor region.
  3014. */
  3015. alias da_bgfx_set_view_scissor = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
  3016. da_bgfx_set_view_scissor bgfx_set_view_scissor;
  3017. /**
  3018. * Set view clear flags.
  3019. * Params:
  3020. * _id = View id.
  3021. * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  3022. * operation. See: `BGFX_CLEAR_*`.
  3023. * _rgba = Color clear value.
  3024. * _depth = Depth clear value.
  3025. * _stencil = Stencil clear value.
  3026. */
  3027. alias da_bgfx_set_view_clear = void function(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, byte _stencil);
  3028. da_bgfx_set_view_clear bgfx_set_view_clear;
  3029. /**
  3030. * Set view clear flags with different clear color for each
  3031. * frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color
  3032. * palette.
  3033. * Params:
  3034. * _id = View id.
  3035. * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  3036. * operation. See: `BGFX_CLEAR_*`.
  3037. * _depth = Depth clear value.
  3038. * _stencil = Stencil clear value.
  3039. * _c0 = Palette index for frame buffer attachment 0.
  3040. * _c1 = Palette index for frame buffer attachment 1.
  3041. * _c2 = Palette index for frame buffer attachment 2.
  3042. * _c3 = Palette index for frame buffer attachment 3.
  3043. * _c4 = Palette index for frame buffer attachment 4.
  3044. * _c5 = Palette index for frame buffer attachment 5.
  3045. * _c6 = Palette index for frame buffer attachment 6.
  3046. * _c7 = Palette index for frame buffer attachment 7.
  3047. */
  3048. alias da_bgfx_set_view_clear_mrt = void function(bgfx_view_id_t _id, ushort _flags, float _depth, byte _stencil, byte _c0, byte _c1, byte _c2, byte _c3, byte _c4, byte _c5, byte _c6, byte _c7);
  3049. da_bgfx_set_view_clear_mrt bgfx_set_view_clear_mrt;
  3050. /**
  3051. * Set view sorting mode.
  3052. * Remarks:
  3053. * View mode must be set prior calling `bgfx::submit` for the view.
  3054. * Params:
  3055. * _id = View id.
  3056. * _mode = View sort mode. See `ViewMode::Enum`.
  3057. */
  3058. alias da_bgfx_set_view_mode = void function(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
  3059. da_bgfx_set_view_mode bgfx_set_view_mode;
  3060. /**
  3061. * Set view frame buffer.
  3062. * Remarks:
  3063. * Not persistent after `bgfx::reset` call.
  3064. * Params:
  3065. * _id = View id.
  3066. * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
  3067. * frame buffer handle will draw primitives from this view into
  3068. * default back buffer.
  3069. */
  3070. alias da_bgfx_set_view_frame_buffer = void function(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
  3071. da_bgfx_set_view_frame_buffer bgfx_set_view_frame_buffer;
  3072. /**
  3073. * Set view view and projection matrices, all draw primitives in this
  3074. * view will use these matrices.
  3075. * Params:
  3076. * _id = View id.
  3077. * _view = View matrix.
  3078. * _proj = Projection matrix.
  3079. */
  3080. alias da_bgfx_set_view_transform = void function(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj);
  3081. da_bgfx_set_view_transform bgfx_set_view_transform;
  3082. /**
  3083. * Post submit view reordering.
  3084. * Params:
  3085. * _id = First view id.
  3086. * _num = Number of views to remap.
  3087. * _order = View remap id table. Passing `NULL` will reset view ids
  3088. * to default state.
  3089. */
  3090. alias da_bgfx_set_view_order = void function(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order);
  3091. da_bgfx_set_view_order bgfx_set_view_order;
  3092. /**
  3093. * Reset all view settings to default.
  3094. */
  3095. alias da_bgfx_reset_view = void function(bgfx_view_id_t _id);
  3096. da_bgfx_reset_view bgfx_reset_view;
  3097. /**
  3098. * Begin submitting draw calls from thread.
  3099. * Params:
  3100. * _forThread = Explicitly request an encoder for a worker thread.
  3101. */
  3102. alias da_bgfx_encoder_begin = bgfx_encoder_t* function(bool _forThread);
  3103. da_bgfx_encoder_begin bgfx_encoder_begin;
  3104. /**
  3105. * End submitting draw calls from thread.
  3106. * Params:
  3107. * _encoder = Encoder.
  3108. */
  3109. alias da_bgfx_encoder_end = void function(bgfx_encoder_t* _encoder);
  3110. da_bgfx_encoder_end bgfx_encoder_end;
  3111. /**
  3112. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  3113. * graphics debugging tools.
  3114. * Params:
  3115. * _marker = Marker string.
  3116. */
  3117. alias da_bgfx_encoder_set_marker = void function(bgfx_encoder_t* _this, const(char)* _marker);
  3118. da_bgfx_encoder_set_marker bgfx_encoder_set_marker;
  3119. /**
  3120. * Set render states for draw primitive.
  3121. * Remarks:
  3122. * 1. To setup more complex states use:
  3123. * `BGFX_STATE_ALPHA_REF(_ref)`,
  3124. * `BGFX_STATE_POINT_SIZE(_size)`,
  3125. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  3126. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  3127. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  3128. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  3129. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  3130. * equation is specified.
  3131. * Params:
  3132. * _state = State flags. Default state for primitive type is
  3133. * triangles. See: `BGFX_STATE_DEFAULT`.
  3134. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  3135. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  3136. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  3137. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  3138. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  3139. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  3140. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  3141. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  3142. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  3143. */
  3144. alias da_bgfx_encoder_set_state = void function(bgfx_encoder_t* _this, ulong _state, uint _rgba);
  3145. da_bgfx_encoder_set_state bgfx_encoder_set_state;
  3146. /**
  3147. * Set condition for rendering.
  3148. * Params:
  3149. * _handle = Occlusion query handle.
  3150. * _visible = Render if occlusion query is visible.
  3151. */
  3152. alias da_bgfx_encoder_set_condition = void function(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
  3153. da_bgfx_encoder_set_condition bgfx_encoder_set_condition;
  3154. /**
  3155. * Set stencil test state.
  3156. * Params:
  3157. * _fstencil = Front stencil state.
  3158. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  3159. * _fstencil is applied to both front and back facing primitives.
  3160. */
  3161. alias da_bgfx_encoder_set_stencil = void function(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil);
  3162. da_bgfx_encoder_set_stencil bgfx_encoder_set_stencil;
  3163. /**
  3164. * Set scissor for draw primitive.
  3165. * Remarks:
  3166. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3167. * Params:
  3168. * _x = Position x from the left corner of the window.
  3169. * _y = Position y from the top corner of the window.
  3170. * _width = Width of view scissor region.
  3171. * _height = Height of view scissor region.
  3172. */
  3173. alias da_bgfx_encoder_set_scissor = ushort function(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height);
  3174. da_bgfx_encoder_set_scissor bgfx_encoder_set_scissor;
  3175. /**
  3176. * Set scissor from cache for draw primitive.
  3177. * Remarks:
  3178. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3179. * Params:
  3180. * _cache = Index in scissor cache.
  3181. */
  3182. alias da_bgfx_encoder_set_scissor_cached = void function(bgfx_encoder_t* _this, ushort _cache);
  3183. da_bgfx_encoder_set_scissor_cached bgfx_encoder_set_scissor_cached;
  3184. /**
  3185. * Set model matrix for draw primitive. If it is not called,
  3186. * the model will be rendered with an identity model matrix.
  3187. * Params:
  3188. * _mtx = Pointer to first matrix in array.
  3189. * _num = Number of matrices in array.
  3190. */
  3191. alias da_bgfx_encoder_set_transform = uint function(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num);
  3192. da_bgfx_encoder_set_transform bgfx_encoder_set_transform;
  3193. /**
  3194. * Set model matrix from matrix cache for draw primitive.
  3195. * Params:
  3196. * _cache = Index in matrix cache.
  3197. * _num = Number of matrices from cache.
  3198. */
  3199. alias da_bgfx_encoder_set_transform_cached = void function(bgfx_encoder_t* _this, uint _cache, ushort _num);
  3200. da_bgfx_encoder_set_transform_cached bgfx_encoder_set_transform_cached;
  3201. /**
  3202. * Reserve matrices in internal matrix cache.
  3203. * Attention: Pointer returned can be modifed until `bgfx::frame` is called.
  3204. * Params:
  3205. * _transform = Pointer to `Transform` structure.
  3206. * _num = Number of matrices.
  3207. */
  3208. alias da_bgfx_encoder_alloc_transform = uint function(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num);
  3209. da_bgfx_encoder_alloc_transform bgfx_encoder_alloc_transform;
  3210. /**
  3211. * Set shader uniform parameter for draw primitive.
  3212. * Params:
  3213. * _handle = Uniform.
  3214. * _value = Pointer to uniform data.
  3215. * _num = Number of elements. Passing `UINT16_MAX` will
  3216. * use the _num passed on uniform creation.
  3217. */
  3218. alias da_bgfx_encoder_set_uniform = void function(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  3219. da_bgfx_encoder_set_uniform bgfx_encoder_set_uniform;
  3220. /**
  3221. * Set index buffer for draw primitive.
  3222. * Params:
  3223. * _handle = Index buffer.
  3224. * _firstIndex = First index to render.
  3225. * _numIndices = Number of indices to render.
  3226. */
  3227. alias da_bgfx_encoder_set_index_buffer = void function(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3228. da_bgfx_encoder_set_index_buffer bgfx_encoder_set_index_buffer;
  3229. /**
  3230. * Set index buffer for draw primitive.
  3231. * Params:
  3232. * _handle = Dynamic index buffer.
  3233. * _firstIndex = First index to render.
  3234. * _numIndices = Number of indices to render.
  3235. */
  3236. alias da_bgfx_encoder_set_dynamic_index_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3237. da_bgfx_encoder_set_dynamic_index_buffer bgfx_encoder_set_dynamic_index_buffer;
  3238. /**
  3239. * Set index buffer for draw primitive.
  3240. * Params:
  3241. * _tib = Transient index buffer.
  3242. * _firstIndex = First index to render.
  3243. * _numIndices = Number of indices to render.
  3244. */
  3245. alias da_bgfx_encoder_set_transient_index_buffer = void function(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
  3246. da_bgfx_encoder_set_transient_index_buffer bgfx_encoder_set_transient_index_buffer;
  3247. /**
  3248. * Set vertex buffer for draw primitive.
  3249. * Params:
  3250. * _stream = Vertex stream.
  3251. * _handle = Vertex buffer.
  3252. * _startVertex = First vertex to render.
  3253. * _numVertices = Number of vertices to render.
  3254. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3255. * handle is used, vertex layout used for creation
  3256. * of vertex buffer will be used.
  3257. */
  3258. alias da_bgfx_encoder_set_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
  3259. da_bgfx_encoder_set_vertex_buffer bgfx_encoder_set_vertex_buffer;
  3260. /**
  3261. * Set vertex buffer for draw primitive.
  3262. * Params:
  3263. * _stream = Vertex stream.
  3264. * _handle = Dynamic vertex buffer.
  3265. * _startVertex = First vertex to render.
  3266. * _numVertices = Number of vertices to render.
  3267. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3268. * handle is used, vertex layout used for creation
  3269. * of vertex buffer will be used.
  3270. */
  3271. alias da_bgfx_encoder_set_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
  3272. da_bgfx_encoder_set_dynamic_vertex_buffer bgfx_encoder_set_dynamic_vertex_buffer;
  3273. /**
  3274. * Set vertex buffer for draw primitive.
  3275. * Params:
  3276. * _stream = Vertex stream.
  3277. * _tvb = Transient vertex buffer.
  3278. * _startVertex = First vertex to render.
  3279. * _numVertices = Number of vertices to render.
  3280. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3281. * handle is used, vertex layout used for creation
  3282. * of vertex buffer will be used.
  3283. */
  3284. alias da_bgfx_encoder_set_transient_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle);
  3285. da_bgfx_encoder_set_transient_vertex_buffer bgfx_encoder_set_transient_vertex_buffer;
  3286. /**
  3287. * Set number of vertices for auto generated vertices use in conjuction
  3288. * with gl_VertexID.
  3289. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3290. * Params:
  3291. * _numVertices = Number of vertices.
  3292. */
  3293. alias da_bgfx_encoder_set_vertex_count = void function(bgfx_encoder_t* _this, uint _numVertices);
  3294. da_bgfx_encoder_set_vertex_count bgfx_encoder_set_vertex_count;
  3295. /**
  3296. * Set instance data buffer for draw primitive.
  3297. * Params:
  3298. * _idb = Transient instance data buffer.
  3299. * _start = First instance data.
  3300. * _num = Number of data instances.
  3301. */
  3302. alias da_bgfx_encoder_set_instance_data_buffer = void function(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
  3303. da_bgfx_encoder_set_instance_data_buffer bgfx_encoder_set_instance_data_buffer;
  3304. /**
  3305. * Set instance data buffer for draw primitive.
  3306. * Params:
  3307. * _handle = Vertex buffer.
  3308. * _startVertex = First instance data.
  3309. * _num = Number of data instances.
  3310. * Set instance data buffer for draw primitive.
  3311. */
  3312. alias da_bgfx_encoder_set_instance_data_from_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  3313. da_bgfx_encoder_set_instance_data_from_vertex_buffer bgfx_encoder_set_instance_data_from_vertex_buffer;
  3314. /**
  3315. * Set instance data buffer for draw primitive.
  3316. * Params:
  3317. * _handle = Dynamic vertex buffer.
  3318. * _startVertex = First instance data.
  3319. * _num = Number of data instances.
  3320. */
  3321. alias da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  3322. da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer;
  3323. /**
  3324. * Set number of instances for auto generated instances use in conjuction
  3325. * with gl_InstanceID.
  3326. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3327. */
  3328. alias da_bgfx_encoder_set_instance_count = void function(bgfx_encoder_t* _this, uint _numInstances);
  3329. da_bgfx_encoder_set_instance_count bgfx_encoder_set_instance_count;
  3330. /**
  3331. * Set texture stage for draw primitive.
  3332. * Params:
  3333. * _stage = Texture unit.
  3334. * _sampler = Program sampler.
  3335. * _handle = Texture handle.
  3336. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  3337. * texture sampling settings from the texture.
  3338. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  3339. * mode.
  3340. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  3341. * sampling.
  3342. */
  3343. alias da_bgfx_encoder_set_texture = void function(bgfx_encoder_t* _this, byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
  3344. da_bgfx_encoder_set_texture bgfx_encoder_set_texture;
  3345. /**
  3346. * Submit an empty primitive for rendering. Uniforms and draw state
  3347. * will be applied but no geometry will be submitted. Useful in cases
  3348. * when no other draw/compute primitive is submitted to view, but it's
  3349. * desired to execute clear view.
  3350. * Remarks:
  3351. * These empty draw calls will sort before ordinary draw calls.
  3352. * Params:
  3353. * _id = View id.
  3354. */
  3355. alias da_bgfx_encoder_touch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id);
  3356. da_bgfx_encoder_touch bgfx_encoder_touch;
  3357. /**
  3358. * Submit primitive for rendering.
  3359. * Params:
  3360. * _id = View id.
  3361. * _program = Program.
  3362. * _depth = Depth for sorting.
  3363. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3364. */
  3365. alias da_bgfx_encoder_submit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
  3366. da_bgfx_encoder_submit bgfx_encoder_submit;
  3367. /**
  3368. * Submit primitive with occlusion query for rendering.
  3369. * Params:
  3370. * _id = View id.
  3371. * _program = Program.
  3372. * _occlusionQuery = Occlusion query.
  3373. * _depth = Depth for sorting.
  3374. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3375. */
  3376. alias da_bgfx_encoder_submit_occlusion_query = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
  3377. da_bgfx_encoder_submit_occlusion_query bgfx_encoder_submit_occlusion_query;
  3378. /**
  3379. * Submit primitive for rendering with index and instance data info from
  3380. * indirect buffer.
  3381. * Params:
  3382. * _id = View id.
  3383. * _program = Program.
  3384. * _indirectHandle = Indirect buffer.
  3385. * _start = First element in indirect buffer.
  3386. * _num = Number of dispatches.
  3387. * _depth = Depth for sorting.
  3388. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3389. */
  3390. alias da_bgfx_encoder_submit_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
  3391. da_bgfx_encoder_submit_indirect bgfx_encoder_submit_indirect;
  3392. /**
  3393. * Set compute index buffer.
  3394. * Params:
  3395. * _stage = Compute stage.
  3396. * _handle = Index buffer handle.
  3397. * _access = Buffer access. See `Access::Enum`.
  3398. */
  3399. alias da_bgfx_encoder_set_compute_index_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  3400. da_bgfx_encoder_set_compute_index_buffer bgfx_encoder_set_compute_index_buffer;
  3401. /**
  3402. * Set compute vertex buffer.
  3403. * Params:
  3404. * _stage = Compute stage.
  3405. * _handle = Vertex buffer handle.
  3406. * _access = Buffer access. See `Access::Enum`.
  3407. */
  3408. alias da_bgfx_encoder_set_compute_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  3409. da_bgfx_encoder_set_compute_vertex_buffer bgfx_encoder_set_compute_vertex_buffer;
  3410. /**
  3411. * Set compute dynamic index buffer.
  3412. * Params:
  3413. * _stage = Compute stage.
  3414. * _handle = Dynamic index buffer handle.
  3415. * _access = Buffer access. See `Access::Enum`.
  3416. */
  3417. alias da_bgfx_encoder_set_compute_dynamic_index_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
  3418. da_bgfx_encoder_set_compute_dynamic_index_buffer bgfx_encoder_set_compute_dynamic_index_buffer;
  3419. /**
  3420. * Set compute dynamic vertex buffer.
  3421. * Params:
  3422. * _stage = Compute stage.
  3423. * _handle = Dynamic vertex buffer handle.
  3424. * _access = Buffer access. See `Access::Enum`.
  3425. */
  3426. alias da_bgfx_encoder_set_compute_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  3427. da_bgfx_encoder_set_compute_dynamic_vertex_buffer bgfx_encoder_set_compute_dynamic_vertex_buffer;
  3428. /**
  3429. * Set compute indirect buffer.
  3430. * Params:
  3431. * _stage = Compute stage.
  3432. * _handle = Indirect buffer handle.
  3433. * _access = Buffer access. See `Access::Enum`.
  3434. */
  3435. alias da_bgfx_encoder_set_compute_indirect_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  3436. da_bgfx_encoder_set_compute_indirect_buffer bgfx_encoder_set_compute_indirect_buffer;
  3437. /**
  3438. * Set compute image from texture.
  3439. * Params:
  3440. * _stage = Compute stage.
  3441. * _handle = Texture handle.
  3442. * _mip = Mip level.
  3443. * _access = Image access. See `Access::Enum`.
  3444. * _format = Texture format. See: `TextureFormat::Enum`.
  3445. */
  3446. alias da_bgfx_encoder_set_image = void function(bgfx_encoder_t* _this, byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
  3447. da_bgfx_encoder_set_image bgfx_encoder_set_image;
  3448. /**
  3449. * Dispatch compute.
  3450. * Params:
  3451. * _id = View id.
  3452. * _program = Compute program.
  3453. * _numX = Number of groups X.
  3454. * _numY = Number of groups Y.
  3455. * _numZ = Number of groups Z.
  3456. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3457. */
  3458. alias da_bgfx_encoder_dispatch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
  3459. da_bgfx_encoder_dispatch bgfx_encoder_dispatch;
  3460. /**
  3461. * Dispatch compute indirect.
  3462. * Params:
  3463. * _id = View id.
  3464. * _program = Compute program.
  3465. * _indirectHandle = Indirect buffer.
  3466. * _start = First element in indirect buffer.
  3467. * _num = Number of dispatches.
  3468. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3469. */
  3470. alias da_bgfx_encoder_dispatch_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
  3471. da_bgfx_encoder_dispatch_indirect bgfx_encoder_dispatch_indirect;
  3472. /**
  3473. * Discard previously set state for draw or compute call.
  3474. * Params:
  3475. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3476. */
  3477. alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, byte _flags);
  3478. da_bgfx_encoder_discard bgfx_encoder_discard;
  3479. /**
  3480. * Blit 2D texture region between two 2D textures.
  3481. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  3482. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  3483. * Params:
  3484. * _id = View id.
  3485. * _dst = Destination texture handle.
  3486. * _dstMip = Destination texture mip level.
  3487. * _dstX = Destination texture X position.
  3488. * _dstY = Destination texture Y position.
  3489. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  3490. * this argument represents destination texture cube face. For 3D texture this argument
  3491. * represents destination texture Z position.
  3492. * _src = Source texture handle.
  3493. * _srcMip = Source texture mip level.
  3494. * _srcX = Source texture X position.
  3495. * _srcY = Source texture Y position.
  3496. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  3497. * this argument represents source texture cube face. For 3D texture this argument
  3498. * represents source texture Z position.
  3499. * _width = Width of region.
  3500. * _height = Height of region.
  3501. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  3502. * unused.
  3503. */
  3504. alias da_bgfx_encoder_blit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
  3505. da_bgfx_encoder_blit bgfx_encoder_blit;
  3506. /**
  3507. * Request screen shot of window back buffer.
  3508. * Remarks:
  3509. * `bgfx::CallbackI::screenShot` must be implemented.
  3510. * Attention: Frame buffer handle must be created with OS' target native window handle.
  3511. * Params:
  3512. * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  3513. * made for main window back buffer.
  3514. * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
  3515. */
  3516. alias da_bgfx_request_screen_shot = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath);
  3517. da_bgfx_request_screen_shot bgfx_request_screen_shot;
  3518. /**
  3519. * Render frame.
  3520. * Attention: `bgfx::renderFrame` is blocking call. It waits for
  3521. * `bgfx::frame` to be called from API thread to process frame.
  3522. * If timeout value is passed call will timeout and return even
  3523. * if `bgfx::frame` is not called.
  3524. * Warning: This call should be only used on platforms that don't
  3525. * allow creating separate rendering thread. If it is called before
  3526. * to bgfx::init, render thread won't be created by bgfx::init call.
  3527. * Params:
  3528. * _msecs = Timeout in milliseconds.
  3529. */
  3530. alias da_bgfx_render_frame = bgfx_render_frame_t function(int _msecs);
  3531. da_bgfx_render_frame bgfx_render_frame;
  3532. /**
  3533. * Set platform data.
  3534. * Warning: Must be called before `bgfx::init`.
  3535. * Params:
  3536. * _data = Platform data.
  3537. */
  3538. alias da_bgfx_set_platform_data = void function(const(bgfx_platform_data_t)* _data);
  3539. da_bgfx_set_platform_data bgfx_set_platform_data;
  3540. /**
  3541. * Get internal data for interop.
  3542. * Attention: It's expected you understand some bgfx internals before you
  3543. * use this call.
  3544. * Warning: Must be called only on render thread.
  3545. */
  3546. alias da_bgfx_get_internal_data = const(bgfx_internal_data_t)* function();
  3547. da_bgfx_get_internal_data bgfx_get_internal_data;
  3548. /**
  3549. * Override internal texture with externally created texture. Previously
  3550. * created internal texture will released.
  3551. * Attention: It's expected you understand some bgfx internals before you
  3552. * use this call.
  3553. * Warning: Must be called only on render thread.
  3554. * Params:
  3555. * _handle = Texture handle.
  3556. * _ptr = Native API pointer to texture.
  3557. */
  3558. alias da_bgfx_override_internal_texture_ptr = ulong function(bgfx_texture_handle_t _handle, ulong _ptr);
  3559. da_bgfx_override_internal_texture_ptr bgfx_override_internal_texture_ptr;
  3560. /**
  3561. * Override internal texture by creating new texture. Previously created
  3562. * internal texture will released.
  3563. * Attention: It's expected you understand some bgfx internals before you
  3564. * use this call.
  3565. * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
  3566. * main thread.
  3567. * Warning: Must be called only on render thread.
  3568. * Params:
  3569. * _handle = Texture handle.
  3570. * _width = Width.
  3571. * _height = Height.
  3572. * _numMips = Number of mip-maps.
  3573. * _format = Texture format. See: `TextureFormat::Enum`.
  3574. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  3575. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  3576. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  3577. * mode.
  3578. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  3579. * sampling.
  3580. */
  3581. alias da_bgfx_override_internal_texture = ulong function(bgfx_texture_handle_t _handle, ushort _width, ushort _height, byte _numMips, bgfx_texture_format_t _format, ulong _flags);
  3582. da_bgfx_override_internal_texture bgfx_override_internal_texture;
  3583. /**
  3584. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  3585. * graphics debugging tools.
  3586. * Params:
  3587. * _marker = Marker string.
  3588. */
  3589. alias da_bgfx_set_marker = void function(const(char)* _marker);
  3590. da_bgfx_set_marker bgfx_set_marker;
  3591. /**
  3592. * Set render states for draw primitive.
  3593. * Remarks:
  3594. * 1. To setup more complex states use:
  3595. * `BGFX_STATE_ALPHA_REF(_ref)`,
  3596. * `BGFX_STATE_POINT_SIZE(_size)`,
  3597. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  3598. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  3599. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  3600. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  3601. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  3602. * equation is specified.
  3603. * Params:
  3604. * _state = State flags. Default state for primitive type is
  3605. * triangles. See: `BGFX_STATE_DEFAULT`.
  3606. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  3607. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  3608. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  3609. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  3610. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  3611. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  3612. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  3613. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  3614. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  3615. */
  3616. alias da_bgfx_set_state = void function(ulong _state, uint _rgba);
  3617. da_bgfx_set_state bgfx_set_state;
  3618. /**
  3619. * Set condition for rendering.
  3620. * Params:
  3621. * _handle = Occlusion query handle.
  3622. * _visible = Render if occlusion query is visible.
  3623. */
  3624. alias da_bgfx_set_condition = void function(bgfx_occlusion_query_handle_t _handle, bool _visible);
  3625. da_bgfx_set_condition bgfx_set_condition;
  3626. /**
  3627. * Set stencil test state.
  3628. * Params:
  3629. * _fstencil = Front stencil state.
  3630. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  3631. * _fstencil is applied to both front and back facing primitives.
  3632. */
  3633. alias da_bgfx_set_stencil = void function(uint _fstencil, uint _bstencil);
  3634. da_bgfx_set_stencil bgfx_set_stencil;
  3635. /**
  3636. * Set scissor for draw primitive.
  3637. * Remarks:
  3638. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3639. * Params:
  3640. * _x = Position x from the left corner of the window.
  3641. * _y = Position y from the top corner of the window.
  3642. * _width = Width of view scissor region.
  3643. * _height = Height of view scissor region.
  3644. */
  3645. alias da_bgfx_set_scissor = ushort function(ushort _x, ushort _y, ushort _width, ushort _height);
  3646. da_bgfx_set_scissor bgfx_set_scissor;
  3647. /**
  3648. * Set scissor from cache for draw primitive.
  3649. * Remarks:
  3650. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3651. * Params:
  3652. * _cache = Index in scissor cache.
  3653. */
  3654. alias da_bgfx_set_scissor_cached = void function(ushort _cache);
  3655. da_bgfx_set_scissor_cached bgfx_set_scissor_cached;
  3656. /**
  3657. * Set model matrix for draw primitive. If it is not called,
  3658. * the model will be rendered with an identity model matrix.
  3659. * Params:
  3660. * _mtx = Pointer to first matrix in array.
  3661. * _num = Number of matrices in array.
  3662. */
  3663. alias da_bgfx_set_transform = uint function(const(void)* _mtx, ushort _num);
  3664. da_bgfx_set_transform bgfx_set_transform;
  3665. /**
  3666. * Set model matrix from matrix cache for draw primitive.
  3667. * Params:
  3668. * _cache = Index in matrix cache.
  3669. * _num = Number of matrices from cache.
  3670. */
  3671. alias da_bgfx_set_transform_cached = void function(uint _cache, ushort _num);
  3672. da_bgfx_set_transform_cached bgfx_set_transform_cached;
  3673. /**
  3674. * Reserve matrices in internal matrix cache.
  3675. * Attention: Pointer returned can be modifed until `bgfx::frame` is called.
  3676. * Params:
  3677. * _transform = Pointer to `Transform` structure.
  3678. * _num = Number of matrices.
  3679. */
  3680. alias da_bgfx_alloc_transform = uint function(bgfx_transform_t* _transform, ushort _num);
  3681. da_bgfx_alloc_transform bgfx_alloc_transform;
  3682. /**
  3683. * Set shader uniform parameter for draw primitive.
  3684. * Params:
  3685. * _handle = Uniform.
  3686. * _value = Pointer to uniform data.
  3687. * _num = Number of elements. Passing `UINT16_MAX` will
  3688. * use the _num passed on uniform creation.
  3689. */
  3690. alias da_bgfx_set_uniform = void function(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  3691. da_bgfx_set_uniform bgfx_set_uniform;
  3692. /**
  3693. * Set index buffer for draw primitive.
  3694. * Params:
  3695. * _handle = Index buffer.
  3696. * _firstIndex = First index to render.
  3697. * _numIndices = Number of indices to render.
  3698. */
  3699. alias da_bgfx_set_index_buffer = void function(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3700. da_bgfx_set_index_buffer bgfx_set_index_buffer;
  3701. /**
  3702. * Set index buffer for draw primitive.
  3703. * Params:
  3704. * _handle = Dynamic index buffer.
  3705. * _firstIndex = First index to render.
  3706. * _numIndices = Number of indices to render.
  3707. */
  3708. alias da_bgfx_set_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3709. da_bgfx_set_dynamic_index_buffer bgfx_set_dynamic_index_buffer;
  3710. /**
  3711. * Set index buffer for draw primitive.
  3712. * Params:
  3713. * _tib = Transient index buffer.
  3714. * _firstIndex = First index to render.
  3715. * _numIndices = Number of indices to render.
  3716. */
  3717. alias da_bgfx_set_transient_index_buffer = void function(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
  3718. da_bgfx_set_transient_index_buffer bgfx_set_transient_index_buffer;
  3719. /**
  3720. * Set vertex buffer for draw primitive.
  3721. * Params:
  3722. * _stream = Vertex stream.
  3723. * _handle = Vertex buffer.
  3724. * _startVertex = First vertex to render.
  3725. * _numVertices = Number of vertices to render.
  3726. */
  3727. alias da_bgfx_set_vertex_buffer = void function(byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  3728. da_bgfx_set_vertex_buffer bgfx_set_vertex_buffer;
  3729. /**
  3730. * Set vertex buffer for draw primitive.
  3731. * Params:
  3732. * _stream = Vertex stream.
  3733. * _handle = Dynamic vertex buffer.
  3734. * _startVertex = First vertex to render.
  3735. * _numVertices = Number of vertices to render.
  3736. */
  3737. alias da_bgfx_set_dynamic_vertex_buffer = void function(byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  3738. da_bgfx_set_dynamic_vertex_buffer bgfx_set_dynamic_vertex_buffer;
  3739. /**
  3740. * Set vertex buffer for draw primitive.
  3741. * Params:
  3742. * _stream = Vertex stream.
  3743. * _tvb = Transient vertex buffer.
  3744. * _startVertex = First vertex to render.
  3745. * _numVertices = Number of vertices to render.
  3746. */
  3747. alias da_bgfx_set_transient_vertex_buffer = void function(byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
  3748. da_bgfx_set_transient_vertex_buffer bgfx_set_transient_vertex_buffer;
  3749. /**
  3750. * Set number of vertices for auto generated vertices use in conjuction
  3751. * with gl_VertexID.
  3752. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3753. * Params:
  3754. * _numVertices = Number of vertices.
  3755. */
  3756. alias da_bgfx_set_vertex_count = void function(uint _numVertices);
  3757. da_bgfx_set_vertex_count bgfx_set_vertex_count;
  3758. /**
  3759. * Set instance data buffer for draw primitive.
  3760. * Params:
  3761. * _idb = Transient instance data buffer.
  3762. * _start = First instance data.
  3763. * _num = Number of data instances.
  3764. */
  3765. alias da_bgfx_set_instance_data_buffer = void function(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
  3766. da_bgfx_set_instance_data_buffer bgfx_set_instance_data_buffer;
  3767. /**
  3768. * Set instance data buffer for draw primitive.
  3769. * Params:
  3770. * _handle = Vertex buffer.
  3771. * _startVertex = First instance data.
  3772. * _num = Number of data instances.
  3773. * Set instance data buffer for draw primitive.
  3774. */
  3775. alias da_bgfx_set_instance_data_from_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  3776. da_bgfx_set_instance_data_from_vertex_buffer bgfx_set_instance_data_from_vertex_buffer;
  3777. /**
  3778. * Set instance data buffer for draw primitive.
  3779. * Params:
  3780. * _handle = Dynamic vertex buffer.
  3781. * _startVertex = First instance data.
  3782. * _num = Number of data instances.
  3783. */
  3784. alias da_bgfx_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  3785. da_bgfx_set_instance_data_from_dynamic_vertex_buffer bgfx_set_instance_data_from_dynamic_vertex_buffer;
  3786. /**
  3787. * Set number of instances for auto generated instances use in conjuction
  3788. * with gl_InstanceID.
  3789. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3790. */
  3791. alias da_bgfx_set_instance_count = void function(uint _numInstances);
  3792. da_bgfx_set_instance_count bgfx_set_instance_count;
  3793. /**
  3794. * Set texture stage for draw primitive.
  3795. * Params:
  3796. * _stage = Texture unit.
  3797. * _sampler = Program sampler.
  3798. * _handle = Texture handle.
  3799. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  3800. * texture sampling settings from the texture.
  3801. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  3802. * mode.
  3803. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  3804. * sampling.
  3805. */
  3806. alias da_bgfx_set_texture = void function(byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
  3807. da_bgfx_set_texture bgfx_set_texture;
  3808. /**
  3809. * Submit an empty primitive for rendering. Uniforms and draw state
  3810. * will be applied but no geometry will be submitted.
  3811. * Remarks:
  3812. * These empty draw calls will sort before ordinary draw calls.
  3813. * Params:
  3814. * _id = View id.
  3815. */
  3816. alias da_bgfx_touch = void function(bgfx_view_id_t _id);
  3817. da_bgfx_touch bgfx_touch;
  3818. /**
  3819. * Submit primitive for rendering.
  3820. * Params:
  3821. * _id = View id.
  3822. * _program = Program.
  3823. * _depth = Depth for sorting.
  3824. * _flags = Which states to discard for next draw. See BGFX_DISCARD_
  3825. */
  3826. alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
  3827. da_bgfx_submit bgfx_submit;
  3828. /**
  3829. * Submit primitive with occlusion query for rendering.
  3830. * Params:
  3831. * _id = View id.
  3832. * _program = Program.
  3833. * _occlusionQuery = Occlusion query.
  3834. * _depth = Depth for sorting.
  3835. * _flags = Which states to discard for next draw. See BGFX_DISCARD_
  3836. */
  3837. alias da_bgfx_submit_occlusion_query = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
  3838. da_bgfx_submit_occlusion_query bgfx_submit_occlusion_query;
  3839. /**
  3840. * Submit primitive for rendering with index and instance data info from
  3841. * indirect buffer.
  3842. * Params:
  3843. * _id = View id.
  3844. * _program = Program.
  3845. * _indirectHandle = Indirect buffer.
  3846. * _start = First element in indirect buffer.
  3847. * _num = Number of dispatches.
  3848. * _depth = Depth for sorting.
  3849. * _flags = Which states to discard for next draw. See BGFX_DISCARD_
  3850. */
  3851. alias da_bgfx_submit_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
  3852. da_bgfx_submit_indirect bgfx_submit_indirect;
  3853. /**
  3854. * Set compute index buffer.
  3855. * Params:
  3856. * _stage = Compute stage.
  3857. * _handle = Index buffer handle.
  3858. * _access = Buffer access. See `Access::Enum`.
  3859. */
  3860. alias da_bgfx_set_compute_index_buffer = void function(byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  3861. da_bgfx_set_compute_index_buffer bgfx_set_compute_index_buffer;
  3862. /**
  3863. * Set compute vertex buffer.
  3864. * Params:
  3865. * _stage = Compute stage.
  3866. * _handle = Vertex buffer handle.
  3867. * _access = Buffer access. See `Access::Enum`.
  3868. */
  3869. alias da_bgfx_set_compute_vertex_buffer = void function(byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  3870. da_bgfx_set_compute_vertex_buffer bgfx_set_compute_vertex_buffer;
  3871. /**
  3872. * Set compute dynamic index buffer.
  3873. * Params:
  3874. * _stage = Compute stage.
  3875. * _handle = Dynamic index buffer handle.
  3876. * _access = Buffer access. See `Access::Enum`.
  3877. */
  3878. alias da_bgfx_set_compute_dynamic_index_buffer = void function(byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
  3879. da_bgfx_set_compute_dynamic_index_buffer bgfx_set_compute_dynamic_index_buffer;
  3880. /**
  3881. * Set compute dynamic vertex buffer.
  3882. * Params:
  3883. * _stage = Compute stage.
  3884. * _handle = Dynamic vertex buffer handle.
  3885. * _access = Buffer access. See `Access::Enum`.
  3886. */
  3887. alias da_bgfx_set_compute_dynamic_vertex_buffer = void function(byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  3888. da_bgfx_set_compute_dynamic_vertex_buffer bgfx_set_compute_dynamic_vertex_buffer;
  3889. /**
  3890. * Set compute indirect buffer.
  3891. * Params:
  3892. * _stage = Compute stage.
  3893. * _handle = Indirect buffer handle.
  3894. * _access = Buffer access. See `Access::Enum`.
  3895. */
  3896. alias da_bgfx_set_compute_indirect_buffer = void function(byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  3897. da_bgfx_set_compute_indirect_buffer bgfx_set_compute_indirect_buffer;
  3898. /**
  3899. * Set compute image from texture.
  3900. * Params:
  3901. * _stage = Compute stage.
  3902. * _handle = Texture handle.
  3903. * _mip = Mip level.
  3904. * _access = Image access. See `Access::Enum`.
  3905. * _format = Texture format. See: `TextureFormat::Enum`.
  3906. */
  3907. alias da_bgfx_set_image = void function(byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
  3908. da_bgfx_set_image bgfx_set_image;
  3909. /**
  3910. * Dispatch compute.
  3911. * Params:
  3912. * _id = View id.
  3913. * _program = Compute program.
  3914. * _numX = Number of groups X.
  3915. * _numY = Number of groups Y.
  3916. * _numZ = Number of groups Z.
  3917. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3918. */
  3919. alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
  3920. da_bgfx_dispatch bgfx_dispatch;
  3921. /**
  3922. * Dispatch compute indirect.
  3923. * Params:
  3924. * _id = View id.
  3925. * _program = Compute program.
  3926. * _indirectHandle = Indirect buffer.
  3927. * _start = First element in indirect buffer.
  3928. * _num = Number of dispatches.
  3929. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3930. */
  3931. alias da_bgfx_dispatch_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
  3932. da_bgfx_dispatch_indirect bgfx_dispatch_indirect;
  3933. /**
  3934. * Discard previously set state for draw or compute call.
  3935. * Params:
  3936. * _flags = Draw/compute states to discard.
  3937. */
  3938. alias da_bgfx_discard = void function(byte _flags);
  3939. da_bgfx_discard bgfx_discard;
  3940. /**
  3941. * Blit 2D texture region between two 2D textures.
  3942. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  3943. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  3944. * Params:
  3945. * _id = View id.
  3946. * _dst = Destination texture handle.
  3947. * _dstMip = Destination texture mip level.
  3948. * _dstX = Destination texture X position.
  3949. * _dstY = Destination texture Y position.
  3950. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  3951. * this argument represents destination texture cube face. For 3D texture this argument
  3952. * represents destination texture Z position.
  3953. * _src = Source texture handle.
  3954. * _srcMip = Source texture mip level.
  3955. * _srcX = Source texture X position.
  3956. * _srcY = Source texture Y position.
  3957. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  3958. * this argument represents source texture cube face. For 3D texture this argument
  3959. * represents source texture Z position.
  3960. * _width = Width of region.
  3961. * _height = Height of region.
  3962. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  3963. * unused.
  3964. */
  3965. alias da_bgfx_blit = void function(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth);
  3966. da_bgfx_blit bgfx_blit;
  3967. }
  3968. }