funcs.d 180 KB

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