funcs.d 184 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569
  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. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
  1390. * Params:
  1391. * _id = View id.
  1392. * _program = Program.
  1393. * _indirectHandle = Indirect buffer.
  1394. * _start = First element in indirect buffer.
  1395. * _num = Number of draws.
  1396. * _depth = Depth for sorting.
  1397. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1398. */
  1399. 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);
  1400. /**
  1401. * Submit primitive for rendering with index and instance data info and
  1402. * draw count from indirect buffers.
  1403. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
  1404. * Params:
  1405. * _id = View id.
  1406. * _program = Program.
  1407. * _indirectHandle = Indirect buffer.
  1408. * _start = First element in indirect buffer.
  1409. * _numHandle = Buffer for number of draws. Must be
  1410. * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
  1411. * _numIndex = Element in number buffer.
  1412. * _numMax = Max number of draws.
  1413. * _depth = Depth for sorting.
  1414. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1415. */
  1416. void bgfx_encoder_submit_indirect_count(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
  1417. /**
  1418. * Set compute index buffer.
  1419. * Params:
  1420. * _stage = Compute stage.
  1421. * _handle = Index buffer handle.
  1422. * _access = Buffer access. See `Access::Enum`.
  1423. */
  1424. void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  1425. /**
  1426. * Set compute vertex buffer.
  1427. * Params:
  1428. * _stage = Compute stage.
  1429. * _handle = Vertex buffer handle.
  1430. * _access = Buffer access. See `Access::Enum`.
  1431. */
  1432. void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1433. /**
  1434. * Set compute dynamic index buffer.
  1435. * Params:
  1436. * _stage = Compute stage.
  1437. * _handle = Dynamic index buffer handle.
  1438. * _access = Buffer access. See `Access::Enum`.
  1439. */
  1440. 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);
  1441. /**
  1442. * Set compute dynamic vertex buffer.
  1443. * Params:
  1444. * _stage = Compute stage.
  1445. * _handle = Dynamic vertex buffer handle.
  1446. * _access = Buffer access. See `Access::Enum`.
  1447. */
  1448. 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);
  1449. /**
  1450. * Set compute indirect buffer.
  1451. * Params:
  1452. * _stage = Compute stage.
  1453. * _handle = Indirect buffer handle.
  1454. * _access = Buffer access. See `Access::Enum`.
  1455. */
  1456. void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  1457. /**
  1458. * Set compute image from texture.
  1459. * Params:
  1460. * _stage = Compute stage.
  1461. * _handle = Texture handle.
  1462. * _mip = Mip level.
  1463. * _access = Image access. See `Access::Enum`.
  1464. * _format = Texture format. See: `TextureFormat::Enum`.
  1465. */
  1466. 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);
  1467. /**
  1468. * Dispatch compute.
  1469. * Params:
  1470. * _id = View id.
  1471. * _program = Compute program.
  1472. * _numX = Number of groups X.
  1473. * _numY = Number of groups Y.
  1474. * _numZ = Number of groups Z.
  1475. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1476. */
  1477. 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);
  1478. /**
  1479. * Dispatch compute indirect.
  1480. * Params:
  1481. * _id = View id.
  1482. * _program = Compute program.
  1483. * _indirectHandle = Indirect buffer.
  1484. * _start = First element in indirect buffer.
  1485. * _num = Number of dispatches.
  1486. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1487. */
  1488. 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);
  1489. /**
  1490. * Discard previously set state for draw or compute call.
  1491. * Params:
  1492. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1493. */
  1494. void bgfx_encoder_discard(bgfx_encoder_t* _this, ubyte _flags);
  1495. /**
  1496. * Blit 2D texture region between two 2D textures.
  1497. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  1498. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  1499. * Params:
  1500. * _id = View id.
  1501. * _dst = Destination texture handle.
  1502. * _dstMip = Destination texture mip level.
  1503. * _dstX = Destination texture X position.
  1504. * _dstY = Destination texture Y position.
  1505. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  1506. * this argument represents destination texture cube face. For 3D texture this argument
  1507. * represents destination texture Z position.
  1508. * _src = Source texture handle.
  1509. * _srcMip = Source texture mip level.
  1510. * _srcX = Source texture X position.
  1511. * _srcY = Source texture Y position.
  1512. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  1513. * this argument represents source texture cube face. For 3D texture this argument
  1514. * represents source texture Z position.
  1515. * _width = Width of region.
  1516. * _height = Height of region.
  1517. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  1518. * unused.
  1519. */
  1520. 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);
  1521. /**
  1522. * Request screen shot of window back buffer.
  1523. * Remarks:
  1524. * `bgfx::CallbackI::screenShot` must be implemented.
  1525. * Attention: Frame buffer handle must be created with OS' target native window handle.
  1526. * Params:
  1527. * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  1528. * made for main window back buffer.
  1529. * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
  1530. */
  1531. void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath);
  1532. /**
  1533. * Render frame.
  1534. * Attention: `bgfx::renderFrame` is blocking call. It waits for
  1535. * `bgfx::frame` to be called from API thread to process frame.
  1536. * If timeout value is passed call will timeout and return even
  1537. * if `bgfx::frame` is not called.
  1538. * Warning: This call should be only used on platforms that don't
  1539. * allow creating separate rendering thread. If it is called before
  1540. * to bgfx::init, render thread won't be created by bgfx::init call.
  1541. * Params:
  1542. * _msecs = Timeout in milliseconds.
  1543. */
  1544. bgfx_render_frame_t bgfx_render_frame(int _msecs);
  1545. /**
  1546. * Set platform data.
  1547. * Warning: Must be called before `bgfx::init`.
  1548. * Params:
  1549. * _data = Platform data.
  1550. */
  1551. void bgfx_set_platform_data(const(bgfx_platform_data_t)* _data);
  1552. /**
  1553. * Get internal data for interop.
  1554. * Attention: It's expected you understand some bgfx internals before you
  1555. * use this call.
  1556. * Warning: Must be called only on render thread.
  1557. */
  1558. const(bgfx_internal_data_t)* bgfx_get_internal_data();
  1559. /**
  1560. * Override internal texture with externally created texture. Previously
  1561. * created internal texture will released.
  1562. * Attention: It's expected you understand some bgfx internals before you
  1563. * use this call.
  1564. * Warning: Must be called only on render thread.
  1565. * Params:
  1566. * _handle = Texture handle.
  1567. * _ptr = Native API pointer to texture.
  1568. */
  1569. ulong bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, ulong _ptr);
  1570. /**
  1571. * Override internal texture by creating new texture. Previously created
  1572. * internal texture will released.
  1573. * Attention: It's expected you understand some bgfx internals before you
  1574. * use this call.
  1575. * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
  1576. * main thread.
  1577. * Warning: Must be called only on render thread.
  1578. * Params:
  1579. * _handle = Texture handle.
  1580. * _width = Width.
  1581. * _height = Height.
  1582. * _numMips = Number of mip-maps.
  1583. * _format = Texture format. See: `TextureFormat::Enum`.
  1584. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  1585. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  1586. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1587. * mode.
  1588. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1589. * sampling.
  1590. */
  1591. ulong bgfx_override_internal_texture(bgfx_texture_handle_t _handle, ushort _width, ushort _height, ubyte _numMips, bgfx_texture_format_t _format, ulong _flags);
  1592. /**
  1593. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  1594. * graphics debugging tools.
  1595. * Params:
  1596. * _marker = Marker string.
  1597. */
  1598. void bgfx_set_marker(const(char)* _marker);
  1599. /**
  1600. * Set render states for draw primitive.
  1601. * Remarks:
  1602. * 1. To set up more complex states use:
  1603. * `BGFX_STATE_ALPHA_REF(_ref)`,
  1604. * `BGFX_STATE_POINT_SIZE(_size)`,
  1605. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  1606. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  1607. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  1608. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  1609. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  1610. * equation is specified.
  1611. * Params:
  1612. * _state = State flags. Default state for primitive type is
  1613. * triangles. See: `BGFX_STATE_DEFAULT`.
  1614. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  1615. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  1616. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  1617. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  1618. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  1619. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  1620. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  1621. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  1622. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  1623. */
  1624. void bgfx_set_state(ulong _state, uint _rgba);
  1625. /**
  1626. * Set condition for rendering.
  1627. * Params:
  1628. * _handle = Occlusion query handle.
  1629. * _visible = Render if occlusion query is visible.
  1630. */
  1631. void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible);
  1632. /**
  1633. * Set stencil test state.
  1634. * Params:
  1635. * _fstencil = Front stencil state.
  1636. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  1637. * _fstencil is applied to both front and back facing primitives.
  1638. */
  1639. void bgfx_set_stencil(uint _fstencil, uint _bstencil);
  1640. /**
  1641. * Set scissor for draw primitive.
  1642. * Remarks:
  1643. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  1644. * Params:
  1645. * _x = Position x from the left corner of the window.
  1646. * _y = Position y from the top corner of the window.
  1647. * _width = Width of view scissor region.
  1648. * _height = Height of view scissor region.
  1649. */
  1650. ushort bgfx_set_scissor(ushort _x, ushort _y, ushort _width, ushort _height);
  1651. /**
  1652. * Set scissor from cache for draw primitive.
  1653. * Remarks:
  1654. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  1655. * Params:
  1656. * _cache = Index in scissor cache.
  1657. */
  1658. void bgfx_set_scissor_cached(ushort _cache);
  1659. /**
  1660. * Set model matrix for draw primitive. If it is not called,
  1661. * the model will be rendered with an identity model matrix.
  1662. * Params:
  1663. * _mtx = Pointer to first matrix in array.
  1664. * _num = Number of matrices in array.
  1665. */
  1666. uint bgfx_set_transform(const(void)* _mtx, ushort _num);
  1667. /**
  1668. * Set model matrix from matrix cache for draw primitive.
  1669. * Params:
  1670. * _cache = Index in matrix cache.
  1671. * _num = Number of matrices from cache.
  1672. */
  1673. void bgfx_set_transform_cached(uint _cache, ushort _num);
  1674. /**
  1675. * Reserve matrices in internal matrix cache.
  1676. * Attention: Pointer returned can be modified until `bgfx::frame` is called.
  1677. * Params:
  1678. * _transform = Pointer to `Transform` structure.
  1679. * _num = Number of matrices.
  1680. */
  1681. uint bgfx_alloc_transform(bgfx_transform_t* _transform, ushort _num);
  1682. /**
  1683. * Set shader uniform parameter for draw primitive.
  1684. * Params:
  1685. * _handle = Uniform.
  1686. * _value = Pointer to uniform data.
  1687. * _num = Number of elements. Passing `UINT16_MAX` will
  1688. * use the _num passed on uniform creation.
  1689. */
  1690. void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  1691. /**
  1692. * Set index buffer for draw primitive.
  1693. * Params:
  1694. * _handle = Index buffer.
  1695. * _firstIndex = First index to render.
  1696. * _numIndices = Number of indices to render.
  1697. */
  1698. void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  1699. /**
  1700. * Set index buffer for draw primitive.
  1701. * Params:
  1702. * _handle = Dynamic index buffer.
  1703. * _firstIndex = First index to render.
  1704. * _numIndices = Number of indices to render.
  1705. */
  1706. void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  1707. /**
  1708. * Set index buffer for draw primitive.
  1709. * Params:
  1710. * _tib = Transient index buffer.
  1711. * _firstIndex = First index to render.
  1712. * _numIndices = Number of indices to render.
  1713. */
  1714. void bgfx_set_transient_index_buffer(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
  1715. /**
  1716. * Set vertex buffer for draw primitive.
  1717. * Params:
  1718. * _stream = Vertex stream.
  1719. * _handle = Vertex buffer.
  1720. * _startVertex = First vertex to render.
  1721. * _numVertices = Number of vertices to render.
  1722. */
  1723. void bgfx_set_vertex_buffer(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  1724. /**
  1725. * Set vertex buffer for draw primitive.
  1726. * Params:
  1727. * _stream = Vertex stream.
  1728. * _handle = Vertex buffer.
  1729. * _startVertex = First vertex to render.
  1730. * _numVertices = Number of vertices to render.
  1731. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  1732. * handle is used, vertex layout used for creation
  1733. * of vertex buffer will be used.
  1734. */
  1735. 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);
  1736. /**
  1737. * Set vertex buffer for draw primitive.
  1738. * Params:
  1739. * _stream = Vertex stream.
  1740. * _handle = Dynamic vertex buffer.
  1741. * _startVertex = First vertex to render.
  1742. * _numVertices = Number of vertices to render.
  1743. */
  1744. void bgfx_set_dynamic_vertex_buffer(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  1745. /**
  1746. * Set vertex buffer for draw primitive.
  1747. * Params:
  1748. * _stream = Vertex stream.
  1749. * _handle = Dynamic vertex buffer.
  1750. * _startVertex = First vertex to render.
  1751. * _numVertices = Number of vertices to render.
  1752. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  1753. * handle is used, vertex layout used for creation
  1754. * of vertex buffer will be used.
  1755. */
  1756. 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);
  1757. /**
  1758. * Set vertex buffer for draw primitive.
  1759. * Params:
  1760. * _stream = Vertex stream.
  1761. * _tvb = Transient vertex buffer.
  1762. * _startVertex = First vertex to render.
  1763. * _numVertices = Number of vertices to render.
  1764. */
  1765. void bgfx_set_transient_vertex_buffer(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
  1766. /**
  1767. * Set vertex buffer for draw primitive.
  1768. * Params:
  1769. * _stream = Vertex stream.
  1770. * _tvb = Transient vertex buffer.
  1771. * _startVertex = First vertex to render.
  1772. * _numVertices = Number of vertices to render.
  1773. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  1774. * handle is used, vertex layout used for creation
  1775. * of vertex buffer will be used.
  1776. */
  1777. 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);
  1778. /**
  1779. * Set number of vertices for auto generated vertices use in conjunction
  1780. * with gl_VertexID.
  1781. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1782. * Params:
  1783. * _numVertices = Number of vertices.
  1784. */
  1785. void bgfx_set_vertex_count(uint _numVertices);
  1786. /**
  1787. * Set instance data buffer for draw primitive.
  1788. * Params:
  1789. * _idb = Transient instance data buffer.
  1790. * _start = First instance data.
  1791. * _num = Number of data instances.
  1792. */
  1793. void bgfx_set_instance_data_buffer(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
  1794. /**
  1795. * Set instance data buffer for draw primitive.
  1796. * Params:
  1797. * _handle = Vertex buffer.
  1798. * _startVertex = First instance data.
  1799. * _num = Number of data instances.
  1800. * Set instance data buffer for draw primitive.
  1801. */
  1802. void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  1803. /**
  1804. * Set instance data buffer for draw primitive.
  1805. * Params:
  1806. * _handle = Dynamic vertex buffer.
  1807. * _startVertex = First instance data.
  1808. * _num = Number of data instances.
  1809. */
  1810. void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  1811. /**
  1812. * Set number of instances for auto generated instances use in conjunction
  1813. * with gl_InstanceID.
  1814. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  1815. */
  1816. void bgfx_set_instance_count(uint _numInstances);
  1817. /**
  1818. * Set texture stage for draw primitive.
  1819. * Params:
  1820. * _stage = Texture unit.
  1821. * _sampler = Program sampler.
  1822. * _handle = Texture handle.
  1823. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  1824. * texture sampling settings from the texture.
  1825. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  1826. * mode.
  1827. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  1828. * sampling.
  1829. */
  1830. void bgfx_set_texture(ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
  1831. /**
  1832. * Submit an empty primitive for rendering. Uniforms and draw state
  1833. * will be applied but no geometry will be submitted.
  1834. * Remarks:
  1835. * These empty draw calls will sort before ordinary draw calls.
  1836. * Params:
  1837. * _id = View id.
  1838. */
  1839. void bgfx_touch(bgfx_view_id_t _id);
  1840. /**
  1841. * Submit primitive for rendering.
  1842. * Params:
  1843. * _id = View id.
  1844. * _program = Program.
  1845. * _depth = Depth for sorting.
  1846. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  1847. */
  1848. void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags);
  1849. /**
  1850. * Submit primitive with occlusion query for rendering.
  1851. * Params:
  1852. * _id = View id.
  1853. * _program = Program.
  1854. * _occlusionQuery = Occlusion query.
  1855. * _depth = Depth for sorting.
  1856. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  1857. */
  1858. 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);
  1859. /**
  1860. * Submit primitive for rendering with index and instance data info from
  1861. * indirect buffer.
  1862. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
  1863. * Params:
  1864. * _id = View id.
  1865. * _program = Program.
  1866. * _indirectHandle = Indirect buffer.
  1867. * _start = First element in indirect buffer.
  1868. * _num = Number of draws.
  1869. * _depth = Depth for sorting.
  1870. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  1871. */
  1872. 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);
  1873. /**
  1874. * Submit primitive for rendering with index and instance data info and
  1875. * draw count from indirect buffers.
  1876. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
  1877. * Params:
  1878. * _id = View id.
  1879. * _program = Program.
  1880. * _indirectHandle = Indirect buffer.
  1881. * _start = First element in indirect buffer.
  1882. * _numHandle = Buffer for number of draws. Must be
  1883. * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
  1884. * _numIndex = Element in number buffer.
  1885. * _numMax = Max number of draws.
  1886. * _depth = Depth for sorting.
  1887. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  1888. */
  1889. void bgfx_submit_indirect_count(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
  1890. /**
  1891. * Set compute index buffer.
  1892. * Params:
  1893. * _stage = Compute stage.
  1894. * _handle = Index buffer handle.
  1895. * _access = Buffer access. See `Access::Enum`.
  1896. */
  1897. void bgfx_set_compute_index_buffer(ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  1898. /**
  1899. * Set compute vertex buffer.
  1900. * Params:
  1901. * _stage = Compute stage.
  1902. * _handle = Vertex buffer handle.
  1903. * _access = Buffer access. See `Access::Enum`.
  1904. */
  1905. void bgfx_set_compute_vertex_buffer(ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1906. /**
  1907. * Set compute dynamic index buffer.
  1908. * Params:
  1909. * _stage = Compute stage.
  1910. * _handle = Dynamic index buffer handle.
  1911. * _access = Buffer access. See `Access::Enum`.
  1912. */
  1913. void bgfx_set_compute_dynamic_index_buffer(ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
  1914. /**
  1915. * Set compute dynamic vertex buffer.
  1916. * Params:
  1917. * _stage = Compute stage.
  1918. * _handle = Dynamic vertex buffer handle.
  1919. * _access = Buffer access. See `Access::Enum`.
  1920. */
  1921. void bgfx_set_compute_dynamic_vertex_buffer(ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  1922. /**
  1923. * Set compute indirect buffer.
  1924. * Params:
  1925. * _stage = Compute stage.
  1926. * _handle = Indirect buffer handle.
  1927. * _access = Buffer access. See `Access::Enum`.
  1928. */
  1929. void bgfx_set_compute_indirect_buffer(ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  1930. /**
  1931. * Set compute image from texture.
  1932. * Params:
  1933. * _stage = Compute stage.
  1934. * _handle = Texture handle.
  1935. * _mip = Mip level.
  1936. * _access = Image access. See `Access::Enum`.
  1937. * _format = Texture format. See: `TextureFormat::Enum`.
  1938. */
  1939. void bgfx_set_image(ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
  1940. /**
  1941. * Dispatch compute.
  1942. * Params:
  1943. * _id = View id.
  1944. * _program = Compute program.
  1945. * _numX = Number of groups X.
  1946. * _numY = Number of groups Y.
  1947. * _numZ = Number of groups Z.
  1948. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1949. */
  1950. void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags);
  1951. /**
  1952. * Dispatch compute indirect.
  1953. * Params:
  1954. * _id = View id.
  1955. * _program = Compute program.
  1956. * _indirectHandle = Indirect buffer.
  1957. * _start = First element in indirect buffer.
  1958. * _num = Number of dispatches.
  1959. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  1960. */
  1961. 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);
  1962. /**
  1963. * Discard previously set state for draw or compute call.
  1964. * Params:
  1965. * _flags = Draw/compute states to discard.
  1966. */
  1967. void bgfx_discard(ubyte _flags);
  1968. /**
  1969. * Blit 2D texture region between two 2D textures.
  1970. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  1971. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  1972. * Params:
  1973. * _id = View id.
  1974. * _dst = Destination texture handle.
  1975. * _dstMip = Destination texture mip level.
  1976. * _dstX = Destination texture X position.
  1977. * _dstY = Destination texture Y position.
  1978. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  1979. * this argument represents destination texture cube face. For 3D texture this argument
  1980. * represents destination texture Z position.
  1981. * _src = Source texture handle.
  1982. * _srcMip = Source texture mip level.
  1983. * _srcX = Source texture X position.
  1984. * _srcY = Source texture Y position.
  1985. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  1986. * this argument represents source texture cube face. For 3D texture this argument
  1987. * represents source texture Z position.
  1988. * _width = Width of region.
  1989. * _height = Height of region.
  1990. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  1991. * unused.
  1992. */
  1993. 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);
  1994. }
  1995. else
  1996. {
  1997. __gshared
  1998. {
  1999. /**
  2000. * Init attachment.
  2001. * Params:
  2002. * _handle = Render target texture handle.
  2003. * _access = Access. See `Access::Enum`.
  2004. * _layer = Cubemap side or depth layer/slice to use.
  2005. * _numLayers = Number of texture layer/slice(s) in array to use.
  2006. * _mip = Mip level.
  2007. * _resolve = Resolve flags. See: `BGFX_RESOLVE_*`
  2008. */
  2009. 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);
  2010. da_bgfx_attachment_init bgfx_attachment_init;
  2011. /**
  2012. * Start VertexLayout.
  2013. * Params:
  2014. * _rendererType = Renderer backend type. See: `bgfx::RendererType`
  2015. */
  2016. alias da_bgfx_vertex_layout_begin = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType);
  2017. da_bgfx_vertex_layout_begin bgfx_vertex_layout_begin;
  2018. /**
  2019. * Add attribute to VertexLayout.
  2020. * Remarks: Must be called between begin/end.
  2021. * Params:
  2022. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  2023. * _num = Number of elements 1, 2, 3 or 4.
  2024. * _type = Element type.
  2025. * _normalized = When using fixed point AttribType (f.e. Uint8)
  2026. * value will be normalized for vertex shader usage. When normalized
  2027. * is set to true, AttribType::Uint8 value in range 0-255 will be
  2028. * in range 0.0-1.0 in vertex shader.
  2029. * _asInt = Packaging rule for vertexPack, vertexUnpack, and
  2030. * vertexConvert for AttribType::Uint8 and AttribType::Int16.
  2031. * Unpacking code must be implemented inside vertex shader.
  2032. */
  2033. 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);
  2034. da_bgfx_vertex_layout_add bgfx_vertex_layout_add;
  2035. /**
  2036. * Decode attribute.
  2037. * Params:
  2038. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  2039. * _num = Number of elements.
  2040. * _type = Element type.
  2041. * _normalized = Attribute is normalized.
  2042. * _asInt = Attribute is packed as int.
  2043. */
  2044. 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);
  2045. da_bgfx_vertex_layout_decode bgfx_vertex_layout_decode;
  2046. /**
  2047. * Returns `true` if VertexLayout contains attribute.
  2048. * Params:
  2049. * _attrib = Attribute semantics. See: `bgfx::Attrib`
  2050. */
  2051. alias da_bgfx_vertex_layout_has = bool function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib);
  2052. da_bgfx_vertex_layout_has bgfx_vertex_layout_has;
  2053. /**
  2054. * Skip `_num` bytes in vertex stream.
  2055. * Params:
  2056. * _num = Number of bytes to skip.
  2057. */
  2058. alias da_bgfx_vertex_layout_skip = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, ubyte _num);
  2059. da_bgfx_vertex_layout_skip bgfx_vertex_layout_skip;
  2060. /**
  2061. * End VertexLayout.
  2062. */
  2063. alias da_bgfx_vertex_layout_end = void function(bgfx_vertex_layout_t* _this);
  2064. da_bgfx_vertex_layout_end bgfx_vertex_layout_end;
  2065. /**
  2066. * Pack vertex attribute into vertex stream format.
  2067. * Params:
  2068. * _input = Value to be packed into vertex stream.
  2069. * _inputNormalized = `true` if input value is already normalized.
  2070. * _attr = Attribute to pack.
  2071. * _layout = Vertex stream layout.
  2072. * _data = Destination vertex stream where data will be packed.
  2073. * _index = Vertex index that will be modified.
  2074. */
  2075. 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);
  2076. da_bgfx_vertex_pack bgfx_vertex_pack;
  2077. /**
  2078. * Unpack vertex attribute from vertex stream format.
  2079. * Params:
  2080. * _output = Result of unpacking.
  2081. * _attr = Attribute to unpack.
  2082. * _layout = Vertex stream layout.
  2083. * _data = Source vertex stream from where data will be unpacked.
  2084. * _index = Vertex index that will be unpacked.
  2085. */
  2086. 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);
  2087. da_bgfx_vertex_unpack bgfx_vertex_unpack;
  2088. /**
  2089. * Converts vertex stream data from one vertex stream format to another.
  2090. * Params:
  2091. * _dstLayout = Destination vertex stream layout.
  2092. * _dstData = Destination vertex stream.
  2093. * _srcLayout = Source vertex stream layout.
  2094. * _srcData = Source vertex stream data.
  2095. * _num = Number of vertices to convert from source to destination.
  2096. */
  2097. 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);
  2098. da_bgfx_vertex_convert bgfx_vertex_convert;
  2099. /**
  2100. * Weld vertices.
  2101. * Params:
  2102. * _output = Welded vertices remapping table. The size of buffer
  2103. * must be the same as number of vertices.
  2104. * _layout = Vertex stream layout.
  2105. * _data = Vertex stream.
  2106. * _num = Number of vertices in vertex stream.
  2107. * _index32 = Set to `true` if input indices are 32-bit.
  2108. * _epsilon = Error tolerance for vertex position comparison.
  2109. */
  2110. alias da_bgfx_weld_vertices = uint function(void* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _num, bool _index32, float _epsilon);
  2111. da_bgfx_weld_vertices bgfx_weld_vertices;
  2112. /**
  2113. * Convert index buffer for use with different primitive topologies.
  2114. * Params:
  2115. * _conversion = Conversion type, see `TopologyConvert::Enum`.
  2116. * _dst = Destination index buffer. If this argument is NULL
  2117. * function will return number of indices after conversion.
  2118. * _dstSize = Destination index buffer in bytes. It must be
  2119. * large enough to contain output indices. If destination size is
  2120. * insufficient index buffer will be truncated.
  2121. * _indices = Source indices.
  2122. * _numIndices = Number of input indices.
  2123. * _index32 = Set to `true` if input indices are 32-bit.
  2124. */
  2125. alias da_bgfx_topology_convert = uint function(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32);
  2126. da_bgfx_topology_convert bgfx_topology_convert;
  2127. /**
  2128. * Sort indices.
  2129. * Params:
  2130. * _sort = Sort order, see `TopologySort::Enum`.
  2131. * _dst = Destination index buffer.
  2132. * _dstSize = Destination index buffer in bytes. It must be
  2133. * large enough to contain output indices. If destination size is
  2134. * insufficient index buffer will be truncated.
  2135. * _dir = Direction (vector must be normalized).
  2136. * _pos = Position.
  2137. * _vertices = Pointer to first vertex represented as
  2138. * float x, y, z. Must contain at least number of vertices
  2139. * referencende by index buffer.
  2140. * _stride = Vertex stride.
  2141. * _indices = Source indices.
  2142. * _numIndices = Number of input indices.
  2143. * _index32 = Set to `true` if input indices are 32-bit.
  2144. */
  2145. 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);
  2146. da_bgfx_topology_sort_tri_list bgfx_topology_sort_tri_list;
  2147. /**
  2148. * Returns supported backend API renderers.
  2149. * Params:
  2150. * _max = Maximum number of elements in _enum array.
  2151. * _enum = Array where supported renderers will be written.
  2152. */
  2153. alias da_bgfx_get_supported_renderers = ubyte function(ubyte _max, bgfx_renderer_type_t* _enum);
  2154. da_bgfx_get_supported_renderers bgfx_get_supported_renderers;
  2155. /**
  2156. * Returns name of renderer.
  2157. * Params:
  2158. * _type = Renderer backend type. See: `bgfx::RendererType`
  2159. */
  2160. alias da_bgfx_get_renderer_name = const(char)* function(bgfx_renderer_type_t _type);
  2161. da_bgfx_get_renderer_name bgfx_get_renderer_name;
  2162. alias da_bgfx_init_ctor = void function(bgfx_init_t* _init);
  2163. da_bgfx_init_ctor bgfx_init_ctor;
  2164. /**
  2165. * Initialize the bgfx library.
  2166. * Params:
  2167. * _init = Initialization parameters. See: `bgfx::Init` for more info.
  2168. */
  2169. alias da_bgfx_init = bool function(const(bgfx_init_t)* _init);
  2170. da_bgfx_init bgfx_init;
  2171. /**
  2172. * Shutdown bgfx library.
  2173. */
  2174. alias da_bgfx_shutdown = void function();
  2175. da_bgfx_shutdown bgfx_shutdown;
  2176. /**
  2177. * Reset graphic settings and back-buffer size.
  2178. * Attention: This call doesn’t change the window size, it just resizes
  2179. * the back-buffer. Your windowing code controls the window size.
  2180. * Params:
  2181. * _width = Back-buffer width.
  2182. * _height = Back-buffer height.
  2183. * _flags = See: `BGFX_RESET_*` for more info.
  2184. * - `BGFX_RESET_NONE` - No reset flags.
  2185. * - `BGFX_RESET_FULLSCREEN` - Not supported yet.
  2186. * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
  2187. * - `BGFX_RESET_VSYNC` - Enable V-Sync.
  2188. * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
  2189. * - `BGFX_RESET_CAPTURE` - Begin screen capture.
  2190. * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
  2191. * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
  2192. * occurs. Default behaviour is that flip occurs before rendering new
  2193. * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
  2194. * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer.
  2195. * _format = Texture format. See: `TextureFormat::Enum`.
  2196. */
  2197. alias da_bgfx_reset = void function(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format);
  2198. da_bgfx_reset bgfx_reset;
  2199. /**
  2200. * Advance to next frame. When using multithreaded renderer, this call
  2201. * just swaps internal buffers, kicks render thread, and returns. In
  2202. * singlethreaded renderer this call does frame rendering.
  2203. * Params:
  2204. * _capture = Capture frame with graphics debugger.
  2205. */
  2206. alias da_bgfx_frame = uint function(bool _capture);
  2207. da_bgfx_frame bgfx_frame;
  2208. /**
  2209. * Returns current renderer backend API type.
  2210. * Remarks:
  2211. * Library must be initialized.
  2212. */
  2213. alias da_bgfx_get_renderer_type = bgfx_renderer_type_t function();
  2214. da_bgfx_get_renderer_type bgfx_get_renderer_type;
  2215. /**
  2216. * Returns renderer capabilities.
  2217. * Remarks:
  2218. * Library must be initialized.
  2219. */
  2220. alias da_bgfx_get_caps = const(bgfx_caps_t)* function();
  2221. da_bgfx_get_caps bgfx_get_caps;
  2222. /**
  2223. * Returns performance counters.
  2224. * Attention: Pointer returned is valid until `bgfx::frame` is called.
  2225. */
  2226. alias da_bgfx_get_stats = const(bgfx_stats_t)* function();
  2227. da_bgfx_get_stats bgfx_get_stats;
  2228. /**
  2229. * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
  2230. * Params:
  2231. * _size = Size to allocate.
  2232. */
  2233. alias da_bgfx_alloc = const(bgfx_memory_t)* function(uint _size);
  2234. da_bgfx_alloc bgfx_alloc;
  2235. /**
  2236. * Allocate buffer and copy data into it. Data will be freed inside bgfx.
  2237. * Params:
  2238. * _data = Pointer to data to be copied.
  2239. * _size = Size of data to be copied.
  2240. */
  2241. alias da_bgfx_copy = const(bgfx_memory_t)* function(const(void)* _data, uint _size);
  2242. da_bgfx_copy bgfx_copy;
  2243. /**
  2244. * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  2245. * doesn't allocate memory for data. It just copies the _data pointer. You
  2246. * can pass `ReleaseFn` function pointer to release this memory after it's
  2247. * consumed, otherwise you must make sure _data is available for at least 2
  2248. * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  2249. * from any thread.
  2250. * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
  2251. * Params:
  2252. * _data = Pointer to data.
  2253. * _size = Size of data.
  2254. */
  2255. alias da_bgfx_make_ref = const(bgfx_memory_t)* function(const(void)* _data, uint _size);
  2256. da_bgfx_make_ref bgfx_make_ref;
  2257. /**
  2258. * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call
  2259. * doesn't allocate memory for data. It just copies the _data pointer. You
  2260. * can pass `ReleaseFn` function pointer to release this memory after it's
  2261. * consumed, otherwise you must make sure _data is available for at least 2
  2262. * `bgfx::frame` calls. `ReleaseFn` function must be able to be called
  2263. * from any thread.
  2264. * Attention: Data passed must be available for at least 2 `bgfx::frame` calls.
  2265. * Params:
  2266. * _data = Pointer to data.
  2267. * _size = Size of data.
  2268. * _releaseFn = Callback function to release memory after use.
  2269. * _userData = User data to be passed to callback function.
  2270. */
  2271. alias da_bgfx_make_ref_release = const(bgfx_memory_t)* function(const(void)* _data, uint _size, void* _releaseFn, void* _userData);
  2272. da_bgfx_make_ref_release bgfx_make_ref_release;
  2273. /**
  2274. * Set debug flags.
  2275. * Params:
  2276. * _debug = Available flags:
  2277. * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set
  2278. * all rendering calls will be skipped. This is useful when profiling
  2279. * to quickly assess potential bottlenecks between CPU and GPU.
  2280. * - `BGFX_DEBUG_PROFILER` - Enable profiler.
  2281. * - `BGFX_DEBUG_STATS` - Display internal statistics.
  2282. * - `BGFX_DEBUG_TEXT` - Display debug text.
  2283. * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
  2284. * primitives will be rendered as lines.
  2285. */
  2286. alias da_bgfx_set_debug = void function(uint _debug);
  2287. da_bgfx_set_debug bgfx_set_debug;
  2288. /**
  2289. * Clear internal debug text buffer.
  2290. * Params:
  2291. * _attr = Background color.
  2292. * _small = Default 8x16 or 8x8 font.
  2293. */
  2294. alias da_bgfx_dbg_text_clear = void function(ubyte _attr, bool _small);
  2295. da_bgfx_dbg_text_clear bgfx_dbg_text_clear;
  2296. /**
  2297. * Print formatted data to internal debug text character-buffer (VGA-compatible text mode).
  2298. * Params:
  2299. * _x = Position x from the left corner of the window.
  2300. * _y = Position y from the top corner of the window.
  2301. * _attr = Color palette. Where top 4-bits represent index of background, and bottom
  2302. * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  2303. * _format = `printf` style format.
  2304. */
  2305. alias da_bgfx_dbg_text_printf = void function(ushort _x, ushort _y, ubyte _attr, const(char)* _format, ... );
  2306. da_bgfx_dbg_text_printf bgfx_dbg_text_printf;
  2307. /**
  2308. * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode).
  2309. * Params:
  2310. * _x = Position x from the left corner of the window.
  2311. * _y = Position y from the top corner of the window.
  2312. * _attr = Color palette. Where top 4-bits represent index of background, and bottom
  2313. * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
  2314. * _format = `printf` style format.
  2315. * _argList = Variable arguments list for format string.
  2316. */
  2317. alias da_bgfx_dbg_text_vprintf = void function(ushort _x, ushort _y, ubyte _attr, const(char)* _format, va_list _argList);
  2318. da_bgfx_dbg_text_vprintf bgfx_dbg_text_vprintf;
  2319. /**
  2320. * Draw image into internal debug text buffer.
  2321. * Params:
  2322. * _x = Position x from the left corner of the window.
  2323. * _y = Position y from the top corner of the window.
  2324. * _width = Image width.
  2325. * _height = Image height.
  2326. * _data = Raw image data (character/attribute raw encoding).
  2327. * _pitch = Image pitch in bytes.
  2328. */
  2329. alias da_bgfx_dbg_text_image = void function(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch);
  2330. da_bgfx_dbg_text_image bgfx_dbg_text_image;
  2331. /**
  2332. * Create static index buffer.
  2333. * Params:
  2334. * _mem = Index buffer data.
  2335. * _flags = Buffer creation flags.
  2336. * - `BGFX_BUFFER_NONE` - No flags.
  2337. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2338. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2339. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2340. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2341. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2342. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2343. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2344. * buffers.
  2345. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2346. * index buffers.
  2347. */
  2348. alias da_bgfx_create_index_buffer = bgfx_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags);
  2349. da_bgfx_create_index_buffer bgfx_create_index_buffer;
  2350. /**
  2351. * Set static index buffer debug name.
  2352. * Params:
  2353. * _handle = Static index buffer handle.
  2354. * _name = Static index buffer name.
  2355. * _len = Static index buffer name length (if length is INT32_MAX, it's expected
  2356. * that _name is zero terminated string.
  2357. */
  2358. alias da_bgfx_set_index_buffer_name = void function(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len);
  2359. da_bgfx_set_index_buffer_name bgfx_set_index_buffer_name;
  2360. /**
  2361. * Destroy static index buffer.
  2362. * Params:
  2363. * _handle = Static index buffer handle.
  2364. */
  2365. alias da_bgfx_destroy_index_buffer = void function(bgfx_index_buffer_handle_t _handle);
  2366. da_bgfx_destroy_index_buffer bgfx_destroy_index_buffer;
  2367. /**
  2368. * Create vertex layout.
  2369. * Params:
  2370. * _layout = Vertex layout.
  2371. */
  2372. alias da_bgfx_create_vertex_layout = bgfx_vertex_layout_handle_t function(const(bgfx_vertex_layout_t)* _layout);
  2373. da_bgfx_create_vertex_layout bgfx_create_vertex_layout;
  2374. /**
  2375. * Destroy vertex layout.
  2376. * Params:
  2377. * _layoutHandle = Vertex layout handle.
  2378. */
  2379. alias da_bgfx_destroy_vertex_layout = void function(bgfx_vertex_layout_handle_t _layoutHandle);
  2380. da_bgfx_destroy_vertex_layout bgfx_destroy_vertex_layout;
  2381. /**
  2382. * Create static vertex buffer.
  2383. * Params:
  2384. * _mem = Vertex buffer data.
  2385. * _layout = Vertex layout.
  2386. * _flags = Buffer creation flags.
  2387. * - `BGFX_BUFFER_NONE` - No flags.
  2388. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2389. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2390. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2391. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2392. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2393. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2394. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers.
  2395. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers.
  2396. */
  2397. 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);
  2398. da_bgfx_create_vertex_buffer bgfx_create_vertex_buffer;
  2399. /**
  2400. * Set static vertex buffer debug name.
  2401. * Params:
  2402. * _handle = Static vertex buffer handle.
  2403. * _name = Static vertex buffer name.
  2404. * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected
  2405. * that _name is zero terminated string.
  2406. */
  2407. alias da_bgfx_set_vertex_buffer_name = void function(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len);
  2408. da_bgfx_set_vertex_buffer_name bgfx_set_vertex_buffer_name;
  2409. /**
  2410. * Destroy static vertex buffer.
  2411. * Params:
  2412. * _handle = Static vertex buffer handle.
  2413. */
  2414. alias da_bgfx_destroy_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle);
  2415. da_bgfx_destroy_vertex_buffer bgfx_destroy_vertex_buffer;
  2416. /**
  2417. * Create empty dynamic index buffer.
  2418. * Params:
  2419. * _num = Number of indices.
  2420. * _flags = Buffer creation flags.
  2421. * - `BGFX_BUFFER_NONE` - No flags.
  2422. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2423. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2424. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2425. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2426. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2427. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2428. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2429. * buffers.
  2430. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2431. * index buffers.
  2432. */
  2433. alias da_bgfx_create_dynamic_index_buffer = bgfx_dynamic_index_buffer_handle_t function(uint _num, ushort _flags);
  2434. da_bgfx_create_dynamic_index_buffer bgfx_create_dynamic_index_buffer;
  2435. /**
  2436. * Create a dynamic index buffer and initialize it.
  2437. * Params:
  2438. * _mem = Index buffer data.
  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_index_buffer_mem = bgfx_dynamic_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags);
  2453. da_bgfx_create_dynamic_index_buffer_mem bgfx_create_dynamic_index_buffer_mem;
  2454. /**
  2455. * Update dynamic index buffer.
  2456. * Params:
  2457. * _handle = Dynamic index buffer handle.
  2458. * _startIndex = Start index.
  2459. * _mem = Index buffer data.
  2460. */
  2461. alias da_bgfx_update_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem);
  2462. da_bgfx_update_dynamic_index_buffer bgfx_update_dynamic_index_buffer;
  2463. /**
  2464. * Destroy dynamic index buffer.
  2465. * Params:
  2466. * _handle = Dynamic index buffer handle.
  2467. */
  2468. alias da_bgfx_destroy_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle);
  2469. da_bgfx_destroy_dynamic_index_buffer bgfx_destroy_dynamic_index_buffer;
  2470. /**
  2471. * Create empty dynamic vertex buffer.
  2472. * Params:
  2473. * _num = Number of vertices.
  2474. * _layout = Vertex layout.
  2475. * _flags = Buffer creation flags.
  2476. * - `BGFX_BUFFER_NONE` - No flags.
  2477. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2478. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2479. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2480. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2481. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2482. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2483. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2484. * buffers.
  2485. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2486. * index buffers.
  2487. */
  2488. alias da_bgfx_create_dynamic_vertex_buffer = bgfx_dynamic_vertex_buffer_handle_t function(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags);
  2489. da_bgfx_create_dynamic_vertex_buffer bgfx_create_dynamic_vertex_buffer;
  2490. /**
  2491. * Create dynamic vertex buffer and initialize it.
  2492. * Params:
  2493. * _mem = Vertex buffer data.
  2494. * _layout = Vertex layout.
  2495. * _flags = Buffer creation flags.
  2496. * - `BGFX_BUFFER_NONE` - No flags.
  2497. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader.
  2498. * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer
  2499. * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU.
  2500. * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader.
  2501. * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of
  2502. * data is passed. If this flag is not specified, and more data is passed on update, the buffer
  2503. * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic
  2504. * buffers.
  2505. * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
  2506. * index buffers.
  2507. */
  2508. 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);
  2509. da_bgfx_create_dynamic_vertex_buffer_mem bgfx_create_dynamic_vertex_buffer_mem;
  2510. /**
  2511. * Update dynamic vertex buffer.
  2512. * Params:
  2513. * _handle = Dynamic vertex buffer handle.
  2514. * _startVertex = Start vertex.
  2515. * _mem = Vertex buffer data.
  2516. */
  2517. alias da_bgfx_update_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem);
  2518. da_bgfx_update_dynamic_vertex_buffer bgfx_update_dynamic_vertex_buffer;
  2519. /**
  2520. * Destroy dynamic vertex buffer.
  2521. * Params:
  2522. * _handle = Dynamic vertex buffer handle.
  2523. */
  2524. alias da_bgfx_destroy_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle);
  2525. da_bgfx_destroy_dynamic_vertex_buffer bgfx_destroy_dynamic_vertex_buffer;
  2526. /**
  2527. * Returns number of requested or maximum available indices.
  2528. * Params:
  2529. * _num = Number of required indices.
  2530. * _index32 = Set to `true` if input indices will be 32-bit.
  2531. */
  2532. alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num, bool _index32);
  2533. da_bgfx_get_avail_transient_index_buffer bgfx_get_avail_transient_index_buffer;
  2534. /**
  2535. * Returns number of requested or maximum available vertices.
  2536. * Params:
  2537. * _num = Number of required vertices.
  2538. * _layout = Vertex layout.
  2539. */
  2540. alias da_bgfx_get_avail_transient_vertex_buffer = uint function(uint _num, const(bgfx_vertex_layout_t)* _layout);
  2541. da_bgfx_get_avail_transient_vertex_buffer bgfx_get_avail_transient_vertex_buffer;
  2542. /**
  2543. * Returns number of requested or maximum available instance buffer slots.
  2544. * Params:
  2545. * _num = Number of required instances.
  2546. * _stride = Stride per instance.
  2547. */
  2548. alias da_bgfx_get_avail_instance_data_buffer = uint function(uint _num, ushort _stride);
  2549. da_bgfx_get_avail_instance_data_buffer bgfx_get_avail_instance_data_buffer;
  2550. /**
  2551. * Allocate transient index buffer.
  2552. * Params:
  2553. * _tib = TransientIndexBuffer structure will be filled, and will be valid
  2554. * for the duration of frame, and can be reused for multiple draw
  2555. * calls.
  2556. * _num = Number of indices to allocate.
  2557. * _index32 = Set to `true` if input indices will be 32-bit.
  2558. */
  2559. alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32);
  2560. da_bgfx_alloc_transient_index_buffer bgfx_alloc_transient_index_buffer;
  2561. /**
  2562. * Allocate transient vertex buffer.
  2563. * Params:
  2564. * _tvb = TransientVertexBuffer structure will be filled, and will be valid
  2565. * for the duration of frame, and can be reused for multiple draw
  2566. * calls.
  2567. * _num = Number of vertices to allocate.
  2568. * _layout = Vertex layout.
  2569. */
  2570. alias da_bgfx_alloc_transient_vertex_buffer = void function(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout);
  2571. da_bgfx_alloc_transient_vertex_buffer bgfx_alloc_transient_vertex_buffer;
  2572. /**
  2573. * Check for required space and allocate transient vertex and index
  2574. * buffers. If both space requirements are satisfied function returns
  2575. * true.
  2576. * Params:
  2577. * _tvb = TransientVertexBuffer structure will be filled, and will be valid
  2578. * for the duration of frame, and can be reused for multiple draw
  2579. * calls.
  2580. * _layout = Vertex layout.
  2581. * _numVertices = Number of vertices to allocate.
  2582. * _tib = TransientIndexBuffer structure will be filled, and will be valid
  2583. * for the duration of frame, and can be reused for multiple draw
  2584. * calls.
  2585. * _numIndices = Number of indices to allocate.
  2586. * _index32 = Set to `true` if input indices will be 32-bit.
  2587. */
  2588. 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);
  2589. da_bgfx_alloc_transient_buffers bgfx_alloc_transient_buffers;
  2590. /**
  2591. * Allocate instance data buffer.
  2592. * Params:
  2593. * _idb = InstanceDataBuffer structure will be filled, and will be valid
  2594. * for duration of frame, and can be reused for multiple draw
  2595. * calls.
  2596. * _num = Number of instances.
  2597. * _stride = Instance stride. Must be multiple of 16.
  2598. */
  2599. alias da_bgfx_alloc_instance_data_buffer = void function(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride);
  2600. da_bgfx_alloc_instance_data_buffer bgfx_alloc_instance_data_buffer;
  2601. /**
  2602. * Create draw indirect buffer.
  2603. * Params:
  2604. * _num = Number of indirect calls.
  2605. */
  2606. alias da_bgfx_create_indirect_buffer = bgfx_indirect_buffer_handle_t function(uint _num);
  2607. da_bgfx_create_indirect_buffer bgfx_create_indirect_buffer;
  2608. /**
  2609. * Destroy draw indirect buffer.
  2610. * Params:
  2611. * _handle = Indirect buffer handle.
  2612. */
  2613. alias da_bgfx_destroy_indirect_buffer = void function(bgfx_indirect_buffer_handle_t _handle);
  2614. da_bgfx_destroy_indirect_buffer bgfx_destroy_indirect_buffer;
  2615. /**
  2616. * Create shader from memory buffer.
  2617. * Params:
  2618. * _mem = Shader binary.
  2619. */
  2620. alias da_bgfx_create_shader = bgfx_shader_handle_t function(const(bgfx_memory_t)* _mem);
  2621. da_bgfx_create_shader bgfx_create_shader;
  2622. /**
  2623. * Returns the number of uniforms and uniform handles used inside a shader.
  2624. * Remarks:
  2625. * Only non-predefined uniforms are returned.
  2626. * Params:
  2627. * _handle = Shader handle.
  2628. * _uniforms = UniformHandle array where data will be stored.
  2629. * _max = Maximum capacity of array.
  2630. */
  2631. alias da_bgfx_get_shader_uniforms = ushort function(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max);
  2632. da_bgfx_get_shader_uniforms bgfx_get_shader_uniforms;
  2633. /**
  2634. * Set shader debug name.
  2635. * Params:
  2636. * _handle = Shader handle.
  2637. * _name = Shader name.
  2638. * _len = Shader name length (if length is INT32_MAX, it's expected
  2639. * that _name is zero terminated string).
  2640. */
  2641. alias da_bgfx_set_shader_name = void function(bgfx_shader_handle_t _handle, const(char)* _name, int _len);
  2642. da_bgfx_set_shader_name bgfx_set_shader_name;
  2643. /**
  2644. * Destroy shader.
  2645. * Remarks: Once a shader program is created with _handle,
  2646. * it is safe to destroy that shader.
  2647. * Params:
  2648. * _handle = Shader handle.
  2649. */
  2650. alias da_bgfx_destroy_shader = void function(bgfx_shader_handle_t _handle);
  2651. da_bgfx_destroy_shader bgfx_destroy_shader;
  2652. /**
  2653. * Create program with vertex and fragment shaders.
  2654. * Params:
  2655. * _vsh = Vertex shader.
  2656. * _fsh = Fragment shader.
  2657. * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
  2658. */
  2659. alias da_bgfx_create_program = bgfx_program_handle_t function(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
  2660. da_bgfx_create_program bgfx_create_program;
  2661. /**
  2662. * Create program with compute shader.
  2663. * Params:
  2664. * _csh = Compute shader.
  2665. * _destroyShaders = If true, shaders will be destroyed when program is destroyed.
  2666. */
  2667. alias da_bgfx_create_compute_program = bgfx_program_handle_t function(bgfx_shader_handle_t _csh, bool _destroyShaders);
  2668. da_bgfx_create_compute_program bgfx_create_compute_program;
  2669. /**
  2670. * Destroy program.
  2671. * Params:
  2672. * _handle = Program handle.
  2673. */
  2674. alias da_bgfx_destroy_program = void function(bgfx_program_handle_t _handle);
  2675. da_bgfx_destroy_program bgfx_destroy_program;
  2676. /**
  2677. * Validate texture parameters.
  2678. * Params:
  2679. * _depth = Depth dimension of volume texture.
  2680. * _cubeMap = Indicates that texture contains cubemap.
  2681. * _numLayers = Number of layers in texture array.
  2682. * _format = Texture format. See: `TextureFormat::Enum`.
  2683. * _flags = Texture flags. See `BGFX_TEXTURE_*`.
  2684. */
  2685. alias da_bgfx_is_texture_valid = bool function(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags);
  2686. da_bgfx_is_texture_valid bgfx_is_texture_valid;
  2687. /**
  2688. * Validate frame buffer parameters.
  2689. * Params:
  2690. * _num = Number of attachments.
  2691. * _attachment = Attachment texture info. See: `bgfx::Attachment`.
  2692. */
  2693. alias da_bgfx_is_frame_buffer_valid = bool function(ubyte _num, const(bgfx_attachment_t)* _attachment);
  2694. da_bgfx_is_frame_buffer_valid bgfx_is_frame_buffer_valid;
  2695. /**
  2696. * Calculate amount of memory required for texture.
  2697. * Params:
  2698. * _info = Resulting texture info structure. See: `TextureInfo`.
  2699. * _width = Width.
  2700. * _height = Height.
  2701. * _depth = Depth dimension of volume texture.
  2702. * _cubeMap = Indicates that texture contains cubemap.
  2703. * _hasMips = Indicates that texture contains full mip-map chain.
  2704. * _numLayers = Number of layers in texture array.
  2705. * _format = Texture format. See: `TextureFormat::Enum`.
  2706. */
  2707. 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);
  2708. da_bgfx_calc_texture_size bgfx_calc_texture_size;
  2709. /**
  2710. * Create texture from memory buffer.
  2711. * Params:
  2712. * _mem = DDS, KTX or PVR texture binary data.
  2713. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2714. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2715. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2716. * mode.
  2717. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2718. * sampling.
  2719. * _skip = Skip top level mips when parsing texture.
  2720. * _info = When non-`NULL` is specified it returns parsed texture information.
  2721. */
  2722. alias da_bgfx_create_texture = bgfx_texture_handle_t function(const(bgfx_memory_t)* _mem, ulong _flags, ubyte _skip, bgfx_texture_info_t* _info);
  2723. da_bgfx_create_texture bgfx_create_texture;
  2724. /**
  2725. * Create 2D texture.
  2726. * Params:
  2727. * _width = Width.
  2728. * _height = Height.
  2729. * _hasMips = Indicates that texture contains full mip-map chain.
  2730. * _numLayers = Number of layers in texture array. Must be 1 if caps
  2731. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  2732. * _format = Texture format. See: `TextureFormat::Enum`.
  2733. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2734. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2735. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2736. * mode.
  2737. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2738. * sampling.
  2739. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  2740. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  2741. * 1, expected memory layout is texture and all mips together for each array element.
  2742. */
  2743. 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);
  2744. da_bgfx_create_texture_2d bgfx_create_texture_2d;
  2745. /**
  2746. * Create texture with size based on back-buffer ratio. Texture will maintain ratio
  2747. * if back buffer resolution changes.
  2748. * Params:
  2749. * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`.
  2750. * _hasMips = Indicates that texture contains full mip-map chain.
  2751. * _numLayers = Number of layers in texture array. Must be 1 if caps
  2752. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  2753. * _format = Texture format. See: `TextureFormat::Enum`.
  2754. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2755. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2756. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2757. * mode.
  2758. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2759. * sampling.
  2760. */
  2761. 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);
  2762. da_bgfx_create_texture_2d_scaled bgfx_create_texture_2d_scaled;
  2763. /**
  2764. * Create 3D texture.
  2765. * Params:
  2766. * _width = Width.
  2767. * _height = Height.
  2768. * _depth = Depth.
  2769. * _hasMips = Indicates that texture contains full mip-map chain.
  2770. * _format = Texture format. See: `TextureFormat::Enum`.
  2771. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2772. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2773. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2774. * mode.
  2775. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2776. * sampling.
  2777. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  2778. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  2779. * 1, expected memory layout is texture and all mips together for each array element.
  2780. */
  2781. 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);
  2782. da_bgfx_create_texture_3d bgfx_create_texture_3d;
  2783. /**
  2784. * Create Cube texture.
  2785. * Params:
  2786. * _size = Cube side size.
  2787. * _hasMips = Indicates that texture contains full mip-map chain.
  2788. * _numLayers = Number of layers in texture array. Must be 1 if caps
  2789. * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
  2790. * _format = Texture format. See: `TextureFormat::Enum`.
  2791. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2792. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2793. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2794. * mode.
  2795. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2796. * sampling.
  2797. * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If
  2798. * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
  2799. * 1, expected memory layout is texture and all mips together for each array element.
  2800. */
  2801. 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);
  2802. da_bgfx_create_texture_cube bgfx_create_texture_cube;
  2803. /**
  2804. * Update 2D texture.
  2805. * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info.
  2806. * Params:
  2807. * _handle = Texture handle.
  2808. * _layer = Layer in texture array.
  2809. * _mip = Mip level.
  2810. * _x = X offset in texture.
  2811. * _y = Y offset in texture.
  2812. * _width = Width of texture block.
  2813. * _height = Height of texture block.
  2814. * _mem = Texture update data.
  2815. * _pitch = Pitch of input image (bytes). When _pitch is set to
  2816. * UINT16_MAX, it will be calculated internally based on _width.
  2817. */
  2818. 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);
  2819. da_bgfx_update_texture_2d bgfx_update_texture_2d;
  2820. /**
  2821. * Update 3D texture.
  2822. * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info.
  2823. * Params:
  2824. * _handle = Texture handle.
  2825. * _mip = Mip level.
  2826. * _x = X offset in texture.
  2827. * _y = Y offset in texture.
  2828. * _z = Z offset in texture.
  2829. * _width = Width of texture block.
  2830. * _height = Height of texture block.
  2831. * _depth = Depth of texture block.
  2832. * _mem = Texture update data.
  2833. */
  2834. 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);
  2835. da_bgfx_update_texture_3d bgfx_update_texture_3d;
  2836. /**
  2837. * Update Cube texture.
  2838. * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info.
  2839. * Params:
  2840. * _handle = Texture handle.
  2841. * _layer = Layer in texture array.
  2842. * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
  2843. * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
  2844. * +----------+
  2845. * |-z 2|
  2846. * | ^ +y |
  2847. * | | | Unfolded cube:
  2848. * | +---->+x |
  2849. * +----------+----------+----------+----------+
  2850. * |+y 1|+y 4|+y 0|+y 5|
  2851. * | ^ -x | ^ +z | ^ +x | ^ -z |
  2852. * | | | | | | | | |
  2853. * | +---->+z | +---->+x | +---->-z | +---->-x |
  2854. * +----------+----------+----------+----------+
  2855. * |+z 3|
  2856. * | ^ -y |
  2857. * | | |
  2858. * | +---->+x |
  2859. * +----------+
  2860. * _mip = Mip level.
  2861. * _x = X offset in texture.
  2862. * _y = Y offset in texture.
  2863. * _width = Width of texture block.
  2864. * _height = Height of texture block.
  2865. * _mem = Texture update data.
  2866. * _pitch = Pitch of input image (bytes). When _pitch is set to
  2867. * UINT16_MAX, it will be calculated internally based on _width.
  2868. */
  2869. 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);
  2870. da_bgfx_update_texture_cube bgfx_update_texture_cube;
  2871. /**
  2872. * Read back texture content.
  2873. * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag.
  2874. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`.
  2875. * Params:
  2876. * _handle = Texture handle.
  2877. * _data = Destination buffer.
  2878. * _mip = Mip level.
  2879. */
  2880. alias da_bgfx_read_texture = uint function(bgfx_texture_handle_t _handle, void* _data, ubyte _mip);
  2881. da_bgfx_read_texture bgfx_read_texture;
  2882. /**
  2883. * Set texture debug name.
  2884. * Params:
  2885. * _handle = Texture handle.
  2886. * _name = Texture name.
  2887. * _len = Texture name length (if length is INT32_MAX, it's expected
  2888. * that _name is zero terminated string.
  2889. */
  2890. alias da_bgfx_set_texture_name = void function(bgfx_texture_handle_t _handle, const(char)* _name, int _len);
  2891. da_bgfx_set_texture_name bgfx_set_texture_name;
  2892. /**
  2893. * Returns texture direct access pointer.
  2894. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature
  2895. * is available on GPUs that have unified memory architecture (UMA) support.
  2896. * Params:
  2897. * _handle = Texture handle.
  2898. */
  2899. alias da_bgfx_get_direct_access_ptr = void* function(bgfx_texture_handle_t _handle);
  2900. da_bgfx_get_direct_access_ptr bgfx_get_direct_access_ptr;
  2901. /**
  2902. * Destroy texture.
  2903. * Params:
  2904. * _handle = Texture handle.
  2905. */
  2906. alias da_bgfx_destroy_texture = void function(bgfx_texture_handle_t _handle);
  2907. da_bgfx_destroy_texture bgfx_destroy_texture;
  2908. /**
  2909. * Create frame buffer (simple).
  2910. * Params:
  2911. * _width = Texture width.
  2912. * _height = Texture height.
  2913. * _format = Texture format. See: `TextureFormat::Enum`.
  2914. * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2915. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2916. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2917. * mode.
  2918. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2919. * sampling.
  2920. */
  2921. alias da_bgfx_create_frame_buffer = bgfx_frame_buffer_handle_t function(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags);
  2922. da_bgfx_create_frame_buffer bgfx_create_frame_buffer;
  2923. /**
  2924. * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio
  2925. * if back buffer resolution changes.
  2926. * Params:
  2927. * _ratio = Frame buffer size in respect to back-buffer size. See:
  2928. * `BackbufferRatio::Enum`.
  2929. * _format = Texture format. See: `TextureFormat::Enum`.
  2930. * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  2931. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  2932. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  2933. * mode.
  2934. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  2935. * sampling.
  2936. */
  2937. 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);
  2938. da_bgfx_create_frame_buffer_scaled bgfx_create_frame_buffer_scaled;
  2939. /**
  2940. * Create MRT frame buffer from texture handles (simple).
  2941. * Params:
  2942. * _num = Number of texture handles.
  2943. * _handles = Texture attachments.
  2944. * _destroyTexture = If true, textures will be destroyed when
  2945. * frame buffer is destroyed.
  2946. */
  2947. alias da_bgfx_create_frame_buffer_from_handles = bgfx_frame_buffer_handle_t function(ubyte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture);
  2948. da_bgfx_create_frame_buffer_from_handles bgfx_create_frame_buffer_from_handles;
  2949. /**
  2950. * Create MRT frame buffer from texture handles with specific layer and
  2951. * mip level.
  2952. * Params:
  2953. * _num = Number of attachments.
  2954. * _attachment = Attachment texture info. See: `bgfx::Attachment`.
  2955. * _destroyTexture = If true, textures will be destroyed when
  2956. * frame buffer is destroyed.
  2957. */
  2958. alias da_bgfx_create_frame_buffer_from_attachment = bgfx_frame_buffer_handle_t function(ubyte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture);
  2959. da_bgfx_create_frame_buffer_from_attachment bgfx_create_frame_buffer_from_attachment;
  2960. /**
  2961. * Create frame buffer for multiple window rendering.
  2962. * Remarks:
  2963. * Frame buffer cannot be used for sampling.
  2964. * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`.
  2965. * Params:
  2966. * _nwh = OS' target native window handle.
  2967. * _width = Window back buffer width.
  2968. * _height = Window back buffer height.
  2969. * _format = Window back buffer color format.
  2970. * _depthFormat = Window back buffer depth format.
  2971. */
  2972. 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);
  2973. da_bgfx_create_frame_buffer_from_nwh bgfx_create_frame_buffer_from_nwh;
  2974. /**
  2975. * Set frame buffer debug name.
  2976. * Params:
  2977. * _handle = Frame buffer handle.
  2978. * _name = Frame buffer name.
  2979. * _len = Frame buffer name length (if length is INT32_MAX, it's expected
  2980. * that _name is zero terminated string.
  2981. */
  2982. alias da_bgfx_set_frame_buffer_name = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len);
  2983. da_bgfx_set_frame_buffer_name bgfx_set_frame_buffer_name;
  2984. /**
  2985. * Obtain texture handle of frame buffer attachment.
  2986. * Params:
  2987. * _handle = Frame buffer handle.
  2988. */
  2989. alias da_bgfx_get_texture = bgfx_texture_handle_t function(bgfx_frame_buffer_handle_t _handle, ubyte _attachment);
  2990. da_bgfx_get_texture bgfx_get_texture;
  2991. /**
  2992. * Destroy frame buffer.
  2993. * Params:
  2994. * _handle = Frame buffer handle.
  2995. */
  2996. alias da_bgfx_destroy_frame_buffer = void function(bgfx_frame_buffer_handle_t _handle);
  2997. da_bgfx_destroy_frame_buffer bgfx_destroy_frame_buffer;
  2998. /**
  2999. * Create shader uniform parameter.
  3000. * Remarks:
  3001. * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
  3002. * multiple times with the same uniform name. The library will always
  3003. * return the same handle, but the handle reference count will be
  3004. * incremented. This means that the same number of `bgfx::destroyUniform`
  3005. * must be called to properly destroy the uniform.
  3006. * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
  3007. * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
  3008. * view, in pixels.
  3009. * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
  3010. * width and height
  3011. * - `u_view mat4` - view matrix
  3012. * - `u_invView mat4` - inverted view matrix
  3013. * - `u_proj mat4` - projection matrix
  3014. * - `u_invProj mat4` - inverted projection matrix
  3015. * - `u_viewProj mat4` - concatenated view projection matrix
  3016. * - `u_invViewProj mat4` - concatenated inverted view projection matrix
  3017. * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
  3018. * - `u_modelView mat4` - concatenated model view matrix, only first
  3019. * model matrix from array is used.
  3020. * - `u_modelViewProj mat4` - concatenated model view projection matrix.
  3021. * - `u_alphaRef float` - alpha reference value for alpha test.
  3022. * Params:
  3023. * _name = Uniform name in shader.
  3024. * _type = Type of uniform (See: `bgfx::UniformType`).
  3025. * _num = Number of elements in array.
  3026. */
  3027. alias da_bgfx_create_uniform = bgfx_uniform_handle_t function(const(char)* _name, bgfx_uniform_type_t _type, ushort _num);
  3028. da_bgfx_create_uniform bgfx_create_uniform;
  3029. /**
  3030. * Retrieve uniform info.
  3031. * Params:
  3032. * _handle = Handle to uniform object.
  3033. * _info = Uniform info.
  3034. */
  3035. alias da_bgfx_get_uniform_info = void function(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info);
  3036. da_bgfx_get_uniform_info bgfx_get_uniform_info;
  3037. /**
  3038. * Destroy shader uniform parameter.
  3039. * Params:
  3040. * _handle = Handle to uniform object.
  3041. */
  3042. alias da_bgfx_destroy_uniform = void function(bgfx_uniform_handle_t _handle);
  3043. da_bgfx_destroy_uniform bgfx_destroy_uniform;
  3044. /**
  3045. * Create occlusion query.
  3046. */
  3047. alias da_bgfx_create_occlusion_query = bgfx_occlusion_query_handle_t function();
  3048. da_bgfx_create_occlusion_query bgfx_create_occlusion_query;
  3049. /**
  3050. * Retrieve occlusion query result from previous frame.
  3051. * Params:
  3052. * _handle = Handle to occlusion query object.
  3053. * _result = Number of pixels that passed test. This argument
  3054. * can be `NULL` if result of occlusion query is not needed.
  3055. */
  3056. alias da_bgfx_get_result = bgfx_occlusion_query_result_t function(bgfx_occlusion_query_handle_t _handle, int* _result);
  3057. da_bgfx_get_result bgfx_get_result;
  3058. /**
  3059. * Destroy occlusion query.
  3060. * Params:
  3061. * _handle = Handle to occlusion query object.
  3062. */
  3063. alias da_bgfx_destroy_occlusion_query = void function(bgfx_occlusion_query_handle_t _handle);
  3064. da_bgfx_destroy_occlusion_query bgfx_destroy_occlusion_query;
  3065. /**
  3066. * Set palette color value.
  3067. * Params:
  3068. * _index = Index into palette.
  3069. * _rgba = RGBA floating point values.
  3070. */
  3071. alias da_bgfx_set_palette_color = void function(ubyte _index, const float[4] _rgba);
  3072. da_bgfx_set_palette_color bgfx_set_palette_color;
  3073. /**
  3074. * Set palette color value.
  3075. * Params:
  3076. * _index = Index into palette.
  3077. * _rgba = Packed 32-bit RGBA value.
  3078. */
  3079. alias da_bgfx_set_palette_color_rgba8 = void function(ubyte _index, uint _rgba);
  3080. da_bgfx_set_palette_color_rgba8 bgfx_set_palette_color_rgba8;
  3081. /**
  3082. * Set view name.
  3083. * Remarks:
  3084. * This is debug only feature.
  3085. * In graphics debugger view name will appear as:
  3086. * "nnnc <view name>"
  3087. * ^ ^ ^
  3088. * | +--- compute (C)
  3089. * +------ view id
  3090. * Params:
  3091. * _id = View id.
  3092. * _name = View name.
  3093. */
  3094. alias da_bgfx_set_view_name = void function(bgfx_view_id_t _id, const(char)* _name);
  3095. da_bgfx_set_view_name bgfx_set_view_name;
  3096. /**
  3097. * Set view rectangle. Draw primitive outside view will be clipped.
  3098. * Params:
  3099. * _id = View id.
  3100. * _x = Position x from the left corner of the window.
  3101. * _y = Position y from the top corner of the window.
  3102. * _width = Width of view port region.
  3103. * _height = Height of view port region.
  3104. */
  3105. alias da_bgfx_set_view_rect = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
  3106. da_bgfx_set_view_rect bgfx_set_view_rect;
  3107. /**
  3108. * Set view rectangle. Draw primitive outside view will be clipped.
  3109. * Params:
  3110. * _id = View id.
  3111. * _x = Position x from the left corner of the window.
  3112. * _y = Position y from the top corner of the window.
  3113. * _ratio = Width and height will be set in respect to back-buffer size.
  3114. * See: `BackbufferRatio::Enum`.
  3115. */
  3116. alias da_bgfx_set_view_rect_ratio = void function(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio);
  3117. da_bgfx_set_view_rect_ratio bgfx_set_view_rect_ratio;
  3118. /**
  3119. * Set view scissor. Draw primitive outside view will be clipped. When
  3120. * _x, _y, _width and _height are set to 0, scissor will be disabled.
  3121. * Params:
  3122. * _id = View id.
  3123. * _x = Position x from the left corner of the window.
  3124. * _y = Position y from the top corner of the window.
  3125. * _width = Width of view scissor region.
  3126. * _height = Height of view scissor region.
  3127. */
  3128. alias da_bgfx_set_view_scissor = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height);
  3129. da_bgfx_set_view_scissor bgfx_set_view_scissor;
  3130. /**
  3131. * Set view clear flags.
  3132. * Params:
  3133. * _id = View id.
  3134. * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  3135. * operation. See: `BGFX_CLEAR_*`.
  3136. * _rgba = Color clear value.
  3137. * _depth = Depth clear value.
  3138. * _stencil = Stencil clear value.
  3139. */
  3140. alias da_bgfx_set_view_clear = void function(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, ubyte _stencil);
  3141. da_bgfx_set_view_clear bgfx_set_view_clear;
  3142. /**
  3143. * Set view clear flags with different clear color for each
  3144. * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a
  3145. * clear color palette.
  3146. * Params:
  3147. * _id = View id.
  3148. * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear
  3149. * operation. See: `BGFX_CLEAR_*`.
  3150. * _depth = Depth clear value.
  3151. * _stencil = Stencil clear value.
  3152. * _c0 = Palette index for frame buffer attachment 0.
  3153. * _c1 = Palette index for frame buffer attachment 1.
  3154. * _c2 = Palette index for frame buffer attachment 2.
  3155. * _c3 = Palette index for frame buffer attachment 3.
  3156. * _c4 = Palette index for frame buffer attachment 4.
  3157. * _c5 = Palette index for frame buffer attachment 5.
  3158. * _c6 = Palette index for frame buffer attachment 6.
  3159. * _c7 = Palette index for frame buffer attachment 7.
  3160. */
  3161. 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);
  3162. da_bgfx_set_view_clear_mrt bgfx_set_view_clear_mrt;
  3163. /**
  3164. * Set view sorting mode.
  3165. * Remarks:
  3166. * View mode must be set prior calling `bgfx::submit` for the view.
  3167. * Params:
  3168. * _id = View id.
  3169. * _mode = View sort mode. See `ViewMode::Enum`.
  3170. */
  3171. alias da_bgfx_set_view_mode = void function(bgfx_view_id_t _id, bgfx_view_mode_t _mode);
  3172. da_bgfx_set_view_mode bgfx_set_view_mode;
  3173. /**
  3174. * Set view frame buffer.
  3175. * Remarks:
  3176. * Not persistent after `bgfx::reset` call.
  3177. * Params:
  3178. * _id = View id.
  3179. * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as
  3180. * frame buffer handle will draw primitives from this view into
  3181. * default back buffer.
  3182. */
  3183. alias da_bgfx_set_view_frame_buffer = void function(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle);
  3184. da_bgfx_set_view_frame_buffer bgfx_set_view_frame_buffer;
  3185. /**
  3186. * Set view's view matrix and projection matrix,
  3187. * all draw primitives in this view will use these two matrices.
  3188. * Params:
  3189. * _id = View id.
  3190. * _view = View matrix.
  3191. * _proj = Projection matrix.
  3192. */
  3193. alias da_bgfx_set_view_transform = void function(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj);
  3194. da_bgfx_set_view_transform bgfx_set_view_transform;
  3195. /**
  3196. * Post submit view reordering.
  3197. * Params:
  3198. * _id = First view id.
  3199. * _num = Number of views to remap.
  3200. * _order = View remap id table. Passing `NULL` will reset view ids
  3201. * to default state.
  3202. */
  3203. alias da_bgfx_set_view_order = void function(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order);
  3204. da_bgfx_set_view_order bgfx_set_view_order;
  3205. /**
  3206. * Reset all view settings to default.
  3207. */
  3208. alias da_bgfx_reset_view = void function(bgfx_view_id_t _id);
  3209. da_bgfx_reset_view bgfx_reset_view;
  3210. /**
  3211. * Begin submitting draw calls from thread.
  3212. * Params:
  3213. * _forThread = Explicitly request an encoder for a worker thread.
  3214. */
  3215. alias da_bgfx_encoder_begin = bgfx_encoder_t* function(bool _forThread);
  3216. da_bgfx_encoder_begin bgfx_encoder_begin;
  3217. /**
  3218. * End submitting draw calls from thread.
  3219. * Params:
  3220. * _encoder = Encoder.
  3221. */
  3222. alias da_bgfx_encoder_end = void function(bgfx_encoder_t* _encoder);
  3223. da_bgfx_encoder_end bgfx_encoder_end;
  3224. /**
  3225. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  3226. * graphics debugging tools.
  3227. * Params:
  3228. * _marker = Marker string.
  3229. */
  3230. alias da_bgfx_encoder_set_marker = void function(bgfx_encoder_t* _this, const(char)* _marker);
  3231. da_bgfx_encoder_set_marker bgfx_encoder_set_marker;
  3232. /**
  3233. * Set render states for draw primitive.
  3234. * Remarks:
  3235. * 1. To set up more complex states use:
  3236. * `BGFX_STATE_ALPHA_REF(_ref)`,
  3237. * `BGFX_STATE_POINT_SIZE(_size)`,
  3238. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  3239. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  3240. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  3241. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  3242. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  3243. * equation is specified.
  3244. * Params:
  3245. * _state = State flags. Default state for primitive type is
  3246. * triangles. See: `BGFX_STATE_DEFAULT`.
  3247. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  3248. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  3249. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  3250. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  3251. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  3252. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  3253. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  3254. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  3255. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  3256. */
  3257. alias da_bgfx_encoder_set_state = void function(bgfx_encoder_t* _this, ulong _state, uint _rgba);
  3258. da_bgfx_encoder_set_state bgfx_encoder_set_state;
  3259. /**
  3260. * Set condition for rendering.
  3261. * Params:
  3262. * _handle = Occlusion query handle.
  3263. * _visible = Render if occlusion query is visible.
  3264. */
  3265. alias da_bgfx_encoder_set_condition = void function(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible);
  3266. da_bgfx_encoder_set_condition bgfx_encoder_set_condition;
  3267. /**
  3268. * Set stencil test state.
  3269. * Params:
  3270. * _fstencil = Front stencil state.
  3271. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  3272. * _fstencil is applied to both front and back facing primitives.
  3273. */
  3274. alias da_bgfx_encoder_set_stencil = void function(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil);
  3275. da_bgfx_encoder_set_stencil bgfx_encoder_set_stencil;
  3276. /**
  3277. * Set scissor for draw primitive.
  3278. * Remarks:
  3279. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3280. * Params:
  3281. * _x = Position x from the left corner of the window.
  3282. * _y = Position y from the top corner of the window.
  3283. * _width = Width of view scissor region.
  3284. * _height = Height of view scissor region.
  3285. */
  3286. alias da_bgfx_encoder_set_scissor = ushort function(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height);
  3287. da_bgfx_encoder_set_scissor bgfx_encoder_set_scissor;
  3288. /**
  3289. * Set scissor from cache for draw primitive.
  3290. * Remarks:
  3291. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3292. * Params:
  3293. * _cache = Index in scissor cache.
  3294. */
  3295. alias da_bgfx_encoder_set_scissor_cached = void function(bgfx_encoder_t* _this, ushort _cache);
  3296. da_bgfx_encoder_set_scissor_cached bgfx_encoder_set_scissor_cached;
  3297. /**
  3298. * Set model matrix for draw primitive. If it is not called,
  3299. * the model will be rendered with an identity model matrix.
  3300. * Params:
  3301. * _mtx = Pointer to first matrix in array.
  3302. * _num = Number of matrices in array.
  3303. */
  3304. alias da_bgfx_encoder_set_transform = uint function(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num);
  3305. da_bgfx_encoder_set_transform bgfx_encoder_set_transform;
  3306. /**
  3307. * Set model matrix from matrix cache for draw primitive.
  3308. * Params:
  3309. * _cache = Index in matrix cache.
  3310. * _num = Number of matrices from cache.
  3311. */
  3312. alias da_bgfx_encoder_set_transform_cached = void function(bgfx_encoder_t* _this, uint _cache, ushort _num);
  3313. da_bgfx_encoder_set_transform_cached bgfx_encoder_set_transform_cached;
  3314. /**
  3315. * Reserve matrices in internal matrix cache.
  3316. * Attention: Pointer returned can be modified until `bgfx::frame` is called.
  3317. * Params:
  3318. * _transform = Pointer to `Transform` structure.
  3319. * _num = Number of matrices.
  3320. */
  3321. alias da_bgfx_encoder_alloc_transform = uint function(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num);
  3322. da_bgfx_encoder_alloc_transform bgfx_encoder_alloc_transform;
  3323. /**
  3324. * Set shader uniform parameter for draw primitive.
  3325. * Params:
  3326. * _handle = Uniform.
  3327. * _value = Pointer to uniform data.
  3328. * _num = Number of elements. Passing `UINT16_MAX` will
  3329. * use the _num passed on uniform creation.
  3330. */
  3331. alias da_bgfx_encoder_set_uniform = void function(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  3332. da_bgfx_encoder_set_uniform bgfx_encoder_set_uniform;
  3333. /**
  3334. * Set index buffer for draw primitive.
  3335. * Params:
  3336. * _handle = Index buffer.
  3337. * _firstIndex = First index to render.
  3338. * _numIndices = Number of indices to render.
  3339. */
  3340. alias da_bgfx_encoder_set_index_buffer = void function(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3341. da_bgfx_encoder_set_index_buffer bgfx_encoder_set_index_buffer;
  3342. /**
  3343. * Set index buffer for draw primitive.
  3344. * Params:
  3345. * _handle = Dynamic index buffer.
  3346. * _firstIndex = First index to render.
  3347. * _numIndices = Number of indices to render.
  3348. */
  3349. 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);
  3350. da_bgfx_encoder_set_dynamic_index_buffer bgfx_encoder_set_dynamic_index_buffer;
  3351. /**
  3352. * Set index buffer for draw primitive.
  3353. * Params:
  3354. * _tib = Transient index buffer.
  3355. * _firstIndex = First index to render.
  3356. * _numIndices = Number of indices to render.
  3357. */
  3358. 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);
  3359. da_bgfx_encoder_set_transient_index_buffer bgfx_encoder_set_transient_index_buffer;
  3360. /**
  3361. * Set vertex buffer for draw primitive.
  3362. * Params:
  3363. * _stream = Vertex stream.
  3364. * _handle = Vertex buffer.
  3365. * _startVertex = First vertex to render.
  3366. * _numVertices = Number of vertices to render.
  3367. */
  3368. 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);
  3369. da_bgfx_encoder_set_vertex_buffer bgfx_encoder_set_vertex_buffer;
  3370. /**
  3371. * Set vertex buffer for draw primitive.
  3372. * Params:
  3373. * _stream = Vertex stream.
  3374. * _handle = Vertex buffer.
  3375. * _startVertex = First vertex to render.
  3376. * _numVertices = Number of vertices to render.
  3377. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3378. * handle is used, vertex layout used for creation
  3379. * of vertex buffer will be used.
  3380. */
  3381. 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);
  3382. da_bgfx_encoder_set_vertex_buffer_with_layout bgfx_encoder_set_vertex_buffer_with_layout;
  3383. /**
  3384. * Set vertex buffer for draw primitive.
  3385. * Params:
  3386. * _stream = Vertex stream.
  3387. * _handle = Dynamic vertex buffer.
  3388. * _startVertex = First vertex to render.
  3389. * _numVertices = Number of vertices to render.
  3390. */
  3391. 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);
  3392. da_bgfx_encoder_set_dynamic_vertex_buffer bgfx_encoder_set_dynamic_vertex_buffer;
  3393. 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);
  3394. da_bgfx_encoder_set_dynamic_vertex_buffer_with_layout bgfx_encoder_set_dynamic_vertex_buffer_with_layout;
  3395. /**
  3396. * Set vertex buffer for draw primitive.
  3397. * Params:
  3398. * _stream = Vertex stream.
  3399. * _tvb = Transient vertex buffer.
  3400. * _startVertex = First vertex to render.
  3401. * _numVertices = Number of vertices to render.
  3402. */
  3403. 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);
  3404. da_bgfx_encoder_set_transient_vertex_buffer bgfx_encoder_set_transient_vertex_buffer;
  3405. /**
  3406. * Set vertex buffer for draw primitive.
  3407. * Params:
  3408. * _stream = Vertex stream.
  3409. * _tvb = Transient vertex buffer.
  3410. * _startVertex = First vertex to render.
  3411. * _numVertices = Number of vertices to render.
  3412. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3413. * handle is used, vertex layout used for creation
  3414. * of vertex buffer will be used.
  3415. */
  3416. 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);
  3417. da_bgfx_encoder_set_transient_vertex_buffer_with_layout bgfx_encoder_set_transient_vertex_buffer_with_layout;
  3418. /**
  3419. * Set number of vertices for auto generated vertices use in conjunction
  3420. * with gl_VertexID.
  3421. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3422. * Params:
  3423. * _numVertices = Number of vertices.
  3424. */
  3425. alias da_bgfx_encoder_set_vertex_count = void function(bgfx_encoder_t* _this, uint _numVertices);
  3426. da_bgfx_encoder_set_vertex_count bgfx_encoder_set_vertex_count;
  3427. /**
  3428. * Set instance data buffer for draw primitive.
  3429. * Params:
  3430. * _idb = Transient instance data buffer.
  3431. * _start = First instance data.
  3432. * _num = Number of data instances.
  3433. */
  3434. 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);
  3435. da_bgfx_encoder_set_instance_data_buffer bgfx_encoder_set_instance_data_buffer;
  3436. /**
  3437. * Set instance data buffer for draw primitive.
  3438. * Params:
  3439. * _handle = Vertex buffer.
  3440. * _startVertex = First instance data.
  3441. * _num = Number of data instances.
  3442. * Set instance data buffer for draw primitive.
  3443. */
  3444. 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);
  3445. da_bgfx_encoder_set_instance_data_from_vertex_buffer bgfx_encoder_set_instance_data_from_vertex_buffer;
  3446. /**
  3447. * Set instance data buffer for draw primitive.
  3448. * Params:
  3449. * _handle = Dynamic vertex buffer.
  3450. * _startVertex = First instance data.
  3451. * _num = Number of data instances.
  3452. */
  3453. 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);
  3454. da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer;
  3455. /**
  3456. * Set number of instances for auto generated instances use in conjunction
  3457. * with gl_InstanceID.
  3458. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3459. */
  3460. alias da_bgfx_encoder_set_instance_count = void function(bgfx_encoder_t* _this, uint _numInstances);
  3461. da_bgfx_encoder_set_instance_count bgfx_encoder_set_instance_count;
  3462. /**
  3463. * Set texture stage for draw primitive.
  3464. * Params:
  3465. * _stage = Texture unit.
  3466. * _sampler = Program sampler.
  3467. * _handle = Texture handle.
  3468. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  3469. * texture sampling settings from the texture.
  3470. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  3471. * mode.
  3472. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  3473. * sampling.
  3474. */
  3475. 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);
  3476. da_bgfx_encoder_set_texture bgfx_encoder_set_texture;
  3477. /**
  3478. * Submit an empty primitive for rendering. Uniforms and draw state
  3479. * will be applied but no geometry will be submitted. Useful in cases
  3480. * when no other draw/compute primitive is submitted to view, but it's
  3481. * desired to execute clear view.
  3482. * Remarks:
  3483. * These empty draw calls will sort before ordinary draw calls.
  3484. * Params:
  3485. * _id = View id.
  3486. */
  3487. alias da_bgfx_encoder_touch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id);
  3488. da_bgfx_encoder_touch bgfx_encoder_touch;
  3489. /**
  3490. * Submit primitive for rendering.
  3491. * Params:
  3492. * _id = View id.
  3493. * _program = Program.
  3494. * _depth = Depth for sorting.
  3495. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3496. */
  3497. 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);
  3498. da_bgfx_encoder_submit bgfx_encoder_submit;
  3499. /**
  3500. * Submit primitive with occlusion query for rendering.
  3501. * Params:
  3502. * _id = View id.
  3503. * _program = Program.
  3504. * _occlusionQuery = Occlusion query.
  3505. * _depth = Depth for sorting.
  3506. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3507. */
  3508. 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);
  3509. da_bgfx_encoder_submit_occlusion_query bgfx_encoder_submit_occlusion_query;
  3510. /**
  3511. * Submit primitive for rendering with index and instance data info from
  3512. * indirect buffer.
  3513. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
  3514. * Params:
  3515. * _id = View id.
  3516. * _program = Program.
  3517. * _indirectHandle = Indirect buffer.
  3518. * _start = First element in indirect buffer.
  3519. * _num = Number of draws.
  3520. * _depth = Depth for sorting.
  3521. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3522. */
  3523. 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);
  3524. da_bgfx_encoder_submit_indirect bgfx_encoder_submit_indirect;
  3525. /**
  3526. * Submit primitive for rendering with index and instance data info and
  3527. * draw count from indirect buffers.
  3528. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
  3529. * Params:
  3530. * _id = View id.
  3531. * _program = Program.
  3532. * _indirectHandle = Indirect buffer.
  3533. * _start = First element in indirect buffer.
  3534. * _numHandle = Buffer for number of draws. Must be
  3535. * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
  3536. * _numIndex = Element in number buffer.
  3537. * _numMax = Max number of draws.
  3538. * _depth = Depth for sorting.
  3539. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3540. */
  3541. alias da_bgfx_encoder_submit_indirect_count = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
  3542. da_bgfx_encoder_submit_indirect_count bgfx_encoder_submit_indirect_count;
  3543. /**
  3544. * Set compute index buffer.
  3545. * Params:
  3546. * _stage = Compute stage.
  3547. * _handle = Index buffer handle.
  3548. * _access = Buffer access. See `Access::Enum`.
  3549. */
  3550. 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);
  3551. da_bgfx_encoder_set_compute_index_buffer bgfx_encoder_set_compute_index_buffer;
  3552. /**
  3553. * Set compute vertex buffer.
  3554. * Params:
  3555. * _stage = Compute stage.
  3556. * _handle = Vertex buffer handle.
  3557. * _access = Buffer access. See `Access::Enum`.
  3558. */
  3559. 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);
  3560. da_bgfx_encoder_set_compute_vertex_buffer bgfx_encoder_set_compute_vertex_buffer;
  3561. /**
  3562. * Set compute dynamic index buffer.
  3563. * Params:
  3564. * _stage = Compute stage.
  3565. * _handle = Dynamic index buffer handle.
  3566. * _access = Buffer access. See `Access::Enum`.
  3567. */
  3568. 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);
  3569. da_bgfx_encoder_set_compute_dynamic_index_buffer bgfx_encoder_set_compute_dynamic_index_buffer;
  3570. /**
  3571. * Set compute dynamic vertex buffer.
  3572. * Params:
  3573. * _stage = Compute stage.
  3574. * _handle = Dynamic vertex buffer handle.
  3575. * _access = Buffer access. See `Access::Enum`.
  3576. */
  3577. 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);
  3578. da_bgfx_encoder_set_compute_dynamic_vertex_buffer bgfx_encoder_set_compute_dynamic_vertex_buffer;
  3579. /**
  3580. * Set compute indirect buffer.
  3581. * Params:
  3582. * _stage = Compute stage.
  3583. * _handle = Indirect buffer handle.
  3584. * _access = Buffer access. See `Access::Enum`.
  3585. */
  3586. 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);
  3587. da_bgfx_encoder_set_compute_indirect_buffer bgfx_encoder_set_compute_indirect_buffer;
  3588. /**
  3589. * Set compute image from texture.
  3590. * Params:
  3591. * _stage = Compute stage.
  3592. * _handle = Texture handle.
  3593. * _mip = Mip level.
  3594. * _access = Image access. See `Access::Enum`.
  3595. * _format = Texture format. See: `TextureFormat::Enum`.
  3596. */
  3597. 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);
  3598. da_bgfx_encoder_set_image bgfx_encoder_set_image;
  3599. /**
  3600. * Dispatch compute.
  3601. * Params:
  3602. * _id = View id.
  3603. * _program = Compute program.
  3604. * _numX = Number of groups X.
  3605. * _numY = Number of groups Y.
  3606. * _numZ = Number of groups Z.
  3607. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3608. */
  3609. 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);
  3610. da_bgfx_encoder_dispatch bgfx_encoder_dispatch;
  3611. /**
  3612. * Dispatch compute indirect.
  3613. * Params:
  3614. * _id = View id.
  3615. * _program = Compute program.
  3616. * _indirectHandle = Indirect buffer.
  3617. * _start = First element in indirect buffer.
  3618. * _num = Number of dispatches.
  3619. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3620. */
  3621. 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);
  3622. da_bgfx_encoder_dispatch_indirect bgfx_encoder_dispatch_indirect;
  3623. /**
  3624. * Discard previously set state for draw or compute call.
  3625. * Params:
  3626. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  3627. */
  3628. alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, ubyte _flags);
  3629. da_bgfx_encoder_discard bgfx_encoder_discard;
  3630. /**
  3631. * Blit 2D texture region between two 2D textures.
  3632. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  3633. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  3634. * Params:
  3635. * _id = View id.
  3636. * _dst = Destination texture handle.
  3637. * _dstMip = Destination texture mip level.
  3638. * _dstX = Destination texture X position.
  3639. * _dstY = Destination texture Y position.
  3640. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  3641. * this argument represents destination texture cube face. For 3D texture this argument
  3642. * represents destination texture Z position.
  3643. * _src = Source texture handle.
  3644. * _srcMip = Source texture mip level.
  3645. * _srcX = Source texture X position.
  3646. * _srcY = Source texture Y position.
  3647. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  3648. * this argument represents source texture cube face. For 3D texture this argument
  3649. * represents source texture Z position.
  3650. * _width = Width of region.
  3651. * _height = Height of region.
  3652. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  3653. * unused.
  3654. */
  3655. 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);
  3656. da_bgfx_encoder_blit bgfx_encoder_blit;
  3657. /**
  3658. * Request screen shot of window back buffer.
  3659. * Remarks:
  3660. * `bgfx::CallbackI::screenShot` must be implemented.
  3661. * Attention: Frame buffer handle must be created with OS' target native window handle.
  3662. * Params:
  3663. * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be
  3664. * made for main window back buffer.
  3665. * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback.
  3666. */
  3667. alias da_bgfx_request_screen_shot = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath);
  3668. da_bgfx_request_screen_shot bgfx_request_screen_shot;
  3669. /**
  3670. * Render frame.
  3671. * Attention: `bgfx::renderFrame` is blocking call. It waits for
  3672. * `bgfx::frame` to be called from API thread to process frame.
  3673. * If timeout value is passed call will timeout and return even
  3674. * if `bgfx::frame` is not called.
  3675. * Warning: This call should be only used on platforms that don't
  3676. * allow creating separate rendering thread. If it is called before
  3677. * to bgfx::init, render thread won't be created by bgfx::init call.
  3678. * Params:
  3679. * _msecs = Timeout in milliseconds.
  3680. */
  3681. alias da_bgfx_render_frame = bgfx_render_frame_t function(int _msecs);
  3682. da_bgfx_render_frame bgfx_render_frame;
  3683. /**
  3684. * Set platform data.
  3685. * Warning: Must be called before `bgfx::init`.
  3686. * Params:
  3687. * _data = Platform data.
  3688. */
  3689. alias da_bgfx_set_platform_data = void function(const(bgfx_platform_data_t)* _data);
  3690. da_bgfx_set_platform_data bgfx_set_platform_data;
  3691. /**
  3692. * Get internal data for interop.
  3693. * Attention: It's expected you understand some bgfx internals before you
  3694. * use this call.
  3695. * Warning: Must be called only on render thread.
  3696. */
  3697. alias da_bgfx_get_internal_data = const(bgfx_internal_data_t)* function();
  3698. da_bgfx_get_internal_data bgfx_get_internal_data;
  3699. /**
  3700. * Override internal texture with externally created texture. Previously
  3701. * created internal texture will released.
  3702. * Attention: It's expected you understand some bgfx internals before you
  3703. * use this call.
  3704. * Warning: Must be called only on render thread.
  3705. * Params:
  3706. * _handle = Texture handle.
  3707. * _ptr = Native API pointer to texture.
  3708. */
  3709. alias da_bgfx_override_internal_texture_ptr = ulong function(bgfx_texture_handle_t _handle, ulong _ptr);
  3710. da_bgfx_override_internal_texture_ptr bgfx_override_internal_texture_ptr;
  3711. /**
  3712. * Override internal texture by creating new texture. Previously created
  3713. * internal texture will released.
  3714. * Attention: It's expected you understand some bgfx internals before you
  3715. * use this call.
  3716. * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the
  3717. * main thread.
  3718. * Warning: Must be called only on render thread.
  3719. * Params:
  3720. * _handle = Texture handle.
  3721. * _width = Width.
  3722. * _height = Height.
  3723. * _numMips = Number of mip-maps.
  3724. * _format = Texture format. See: `TextureFormat::Enum`.
  3725. * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
  3726. * flags. Default texture sampling mode is linear, and wrap mode is repeat.
  3727. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  3728. * mode.
  3729. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  3730. * sampling.
  3731. */
  3732. 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);
  3733. da_bgfx_override_internal_texture bgfx_override_internal_texture;
  3734. /**
  3735. * Sets a debug marker. This allows you to group graphics calls together for easy browsing in
  3736. * graphics debugging tools.
  3737. * Params:
  3738. * _marker = Marker string.
  3739. */
  3740. alias da_bgfx_set_marker = void function(const(char)* _marker);
  3741. da_bgfx_set_marker bgfx_set_marker;
  3742. /**
  3743. * Set render states for draw primitive.
  3744. * Remarks:
  3745. * 1. To set up more complex states use:
  3746. * `BGFX_STATE_ALPHA_REF(_ref)`,
  3747. * `BGFX_STATE_POINT_SIZE(_size)`,
  3748. * `BGFX_STATE_BLEND_FUNC(_src, _dst)`,
  3749. * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`,
  3750. * `BGFX_STATE_BLEND_EQUATION(_equation)`,
  3751. * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)`
  3752. * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
  3753. * equation is specified.
  3754. * Params:
  3755. * _state = State flags. Default state for primitive type is
  3756. * triangles. See: `BGFX_STATE_DEFAULT`.
  3757. * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function.
  3758. * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC.
  3759. * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2.
  3760. * - `BGFX_STATE_CULL_*` - Backface culling mode.
  3761. * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write.
  3762. * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing.
  3763. * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type.
  3764. * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and
  3765. * `BGFX_STATE_BLEND_INV_FACTOR` blend modes.
  3766. */
  3767. alias da_bgfx_set_state = void function(ulong _state, uint _rgba);
  3768. da_bgfx_set_state bgfx_set_state;
  3769. /**
  3770. * Set condition for rendering.
  3771. * Params:
  3772. * _handle = Occlusion query handle.
  3773. * _visible = Render if occlusion query is visible.
  3774. */
  3775. alias da_bgfx_set_condition = void function(bgfx_occlusion_query_handle_t _handle, bool _visible);
  3776. da_bgfx_set_condition bgfx_set_condition;
  3777. /**
  3778. * Set stencil test state.
  3779. * Params:
  3780. * _fstencil = Front stencil state.
  3781. * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE`
  3782. * _fstencil is applied to both front and back facing primitives.
  3783. */
  3784. alias da_bgfx_set_stencil = void function(uint _fstencil, uint _bstencil);
  3785. da_bgfx_set_stencil bgfx_set_stencil;
  3786. /**
  3787. * Set scissor for draw primitive.
  3788. * Remarks:
  3789. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3790. * Params:
  3791. * _x = Position x from the left corner of the window.
  3792. * _y = Position y from the top corner of the window.
  3793. * _width = Width of view scissor region.
  3794. * _height = Height of view scissor region.
  3795. */
  3796. alias da_bgfx_set_scissor = ushort function(ushort _x, ushort _y, ushort _width, ushort _height);
  3797. da_bgfx_set_scissor bgfx_set_scissor;
  3798. /**
  3799. * Set scissor from cache for draw primitive.
  3800. * Remarks:
  3801. * To scissor for all primitives in view see `bgfx::setViewScissor`.
  3802. * Params:
  3803. * _cache = Index in scissor cache.
  3804. */
  3805. alias da_bgfx_set_scissor_cached = void function(ushort _cache);
  3806. da_bgfx_set_scissor_cached bgfx_set_scissor_cached;
  3807. /**
  3808. * Set model matrix for draw primitive. If it is not called,
  3809. * the model will be rendered with an identity model matrix.
  3810. * Params:
  3811. * _mtx = Pointer to first matrix in array.
  3812. * _num = Number of matrices in array.
  3813. */
  3814. alias da_bgfx_set_transform = uint function(const(void)* _mtx, ushort _num);
  3815. da_bgfx_set_transform bgfx_set_transform;
  3816. /**
  3817. * Set model matrix from matrix cache for draw primitive.
  3818. * Params:
  3819. * _cache = Index in matrix cache.
  3820. * _num = Number of matrices from cache.
  3821. */
  3822. alias da_bgfx_set_transform_cached = void function(uint _cache, ushort _num);
  3823. da_bgfx_set_transform_cached bgfx_set_transform_cached;
  3824. /**
  3825. * Reserve matrices in internal matrix cache.
  3826. * Attention: Pointer returned can be modified until `bgfx::frame` is called.
  3827. * Params:
  3828. * _transform = Pointer to `Transform` structure.
  3829. * _num = Number of matrices.
  3830. */
  3831. alias da_bgfx_alloc_transform = uint function(bgfx_transform_t* _transform, ushort _num);
  3832. da_bgfx_alloc_transform bgfx_alloc_transform;
  3833. /**
  3834. * Set shader uniform parameter for draw primitive.
  3835. * Params:
  3836. * _handle = Uniform.
  3837. * _value = Pointer to uniform data.
  3838. * _num = Number of elements. Passing `UINT16_MAX` will
  3839. * use the _num passed on uniform creation.
  3840. */
  3841. alias da_bgfx_set_uniform = void function(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num);
  3842. da_bgfx_set_uniform bgfx_set_uniform;
  3843. /**
  3844. * Set index buffer for draw primitive.
  3845. * Params:
  3846. * _handle = Index buffer.
  3847. * _firstIndex = First index to render.
  3848. * _numIndices = Number of indices to render.
  3849. */
  3850. alias da_bgfx_set_index_buffer = void function(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3851. da_bgfx_set_index_buffer bgfx_set_index_buffer;
  3852. /**
  3853. * Set index buffer for draw primitive.
  3854. * Params:
  3855. * _handle = Dynamic index buffer.
  3856. * _firstIndex = First index to render.
  3857. * _numIndices = Number of indices to render.
  3858. */
  3859. alias da_bgfx_set_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices);
  3860. da_bgfx_set_dynamic_index_buffer bgfx_set_dynamic_index_buffer;
  3861. /**
  3862. * Set index buffer for draw primitive.
  3863. * Params:
  3864. * _tib = Transient index buffer.
  3865. * _firstIndex = First index to render.
  3866. * _numIndices = Number of indices to render.
  3867. */
  3868. alias da_bgfx_set_transient_index_buffer = void function(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices);
  3869. da_bgfx_set_transient_index_buffer bgfx_set_transient_index_buffer;
  3870. /**
  3871. * Set vertex buffer for draw primitive.
  3872. * Params:
  3873. * _stream = Vertex stream.
  3874. * _handle = Vertex buffer.
  3875. * _startVertex = First vertex to render.
  3876. * _numVertices = Number of vertices to render.
  3877. */
  3878. alias da_bgfx_set_vertex_buffer = void function(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  3879. da_bgfx_set_vertex_buffer bgfx_set_vertex_buffer;
  3880. /**
  3881. * Set vertex buffer for draw primitive.
  3882. * Params:
  3883. * _stream = Vertex stream.
  3884. * _handle = Vertex buffer.
  3885. * _startVertex = First vertex to render.
  3886. * _numVertices = Number of vertices to render.
  3887. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3888. * handle is used, vertex layout used for creation
  3889. * of vertex buffer will be used.
  3890. */
  3891. 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);
  3892. da_bgfx_set_vertex_buffer_with_layout bgfx_set_vertex_buffer_with_layout;
  3893. /**
  3894. * Set vertex buffer for draw primitive.
  3895. * Params:
  3896. * _stream = Vertex stream.
  3897. * _handle = Dynamic vertex buffer.
  3898. * _startVertex = First vertex to render.
  3899. * _numVertices = Number of vertices to render.
  3900. */
  3901. alias da_bgfx_set_dynamic_vertex_buffer = void function(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices);
  3902. da_bgfx_set_dynamic_vertex_buffer bgfx_set_dynamic_vertex_buffer;
  3903. /**
  3904. * Set vertex buffer for draw primitive.
  3905. * Params:
  3906. * _stream = Vertex stream.
  3907. * _handle = Dynamic vertex buffer.
  3908. * _startVertex = First vertex to render.
  3909. * _numVertices = Number of vertices to render.
  3910. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3911. * handle is used, vertex layout used for creation
  3912. * of vertex buffer will be used.
  3913. */
  3914. 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);
  3915. da_bgfx_set_dynamic_vertex_buffer_with_layout bgfx_set_dynamic_vertex_buffer_with_layout;
  3916. /**
  3917. * Set vertex buffer for draw primitive.
  3918. * Params:
  3919. * _stream = Vertex stream.
  3920. * _tvb = Transient vertex buffer.
  3921. * _startVertex = First vertex to render.
  3922. * _numVertices = Number of vertices to render.
  3923. */
  3924. alias da_bgfx_set_transient_vertex_buffer = void function(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices);
  3925. da_bgfx_set_transient_vertex_buffer bgfx_set_transient_vertex_buffer;
  3926. /**
  3927. * Set vertex buffer for draw primitive.
  3928. * Params:
  3929. * _stream = Vertex stream.
  3930. * _tvb = Transient vertex buffer.
  3931. * _startVertex = First vertex to render.
  3932. * _numVertices = Number of vertices to render.
  3933. * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid
  3934. * handle is used, vertex layout used for creation
  3935. * of vertex buffer will be used.
  3936. */
  3937. 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);
  3938. da_bgfx_set_transient_vertex_buffer_with_layout bgfx_set_transient_vertex_buffer_with_layout;
  3939. /**
  3940. * Set number of vertices for auto generated vertices use in conjunction
  3941. * with gl_VertexID.
  3942. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3943. * Params:
  3944. * _numVertices = Number of vertices.
  3945. */
  3946. alias da_bgfx_set_vertex_count = void function(uint _numVertices);
  3947. da_bgfx_set_vertex_count bgfx_set_vertex_count;
  3948. /**
  3949. * Set instance data buffer for draw primitive.
  3950. * Params:
  3951. * _idb = Transient instance data buffer.
  3952. * _start = First instance data.
  3953. * _num = Number of data instances.
  3954. */
  3955. alias da_bgfx_set_instance_data_buffer = void function(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num);
  3956. da_bgfx_set_instance_data_buffer bgfx_set_instance_data_buffer;
  3957. /**
  3958. * Set instance data buffer for draw primitive.
  3959. * Params:
  3960. * _handle = Vertex buffer.
  3961. * _startVertex = First instance data.
  3962. * _num = Number of data instances.
  3963. * Set instance data buffer for draw primitive.
  3964. */
  3965. alias da_bgfx_set_instance_data_from_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  3966. da_bgfx_set_instance_data_from_vertex_buffer bgfx_set_instance_data_from_vertex_buffer;
  3967. /**
  3968. * Set instance data buffer for draw primitive.
  3969. * Params:
  3970. * _handle = Dynamic vertex buffer.
  3971. * _startVertex = First instance data.
  3972. * _num = Number of data instances.
  3973. */
  3974. alias da_bgfx_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num);
  3975. da_bgfx_set_instance_data_from_dynamic_vertex_buffer bgfx_set_instance_data_from_dynamic_vertex_buffer;
  3976. /**
  3977. * Set number of instances for auto generated instances use in conjunction
  3978. * with gl_InstanceID.
  3979. * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`.
  3980. */
  3981. alias da_bgfx_set_instance_count = void function(uint _numInstances);
  3982. da_bgfx_set_instance_count bgfx_set_instance_count;
  3983. /**
  3984. * Set texture stage for draw primitive.
  3985. * Params:
  3986. * _stage = Texture unit.
  3987. * _sampler = Program sampler.
  3988. * _handle = Texture handle.
  3989. * _flags = Texture sampling mode. Default value UINT32_MAX uses
  3990. * texture sampling settings from the texture.
  3991. * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
  3992. * mode.
  3993. * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
  3994. * sampling.
  3995. */
  3996. alias da_bgfx_set_texture = void function(ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags);
  3997. da_bgfx_set_texture bgfx_set_texture;
  3998. /**
  3999. * Submit an empty primitive for rendering. Uniforms and draw state
  4000. * will be applied but no geometry will be submitted.
  4001. * Remarks:
  4002. * These empty draw calls will sort before ordinary draw calls.
  4003. * Params:
  4004. * _id = View id.
  4005. */
  4006. alias da_bgfx_touch = void function(bgfx_view_id_t _id);
  4007. da_bgfx_touch bgfx_touch;
  4008. /**
  4009. * Submit primitive for rendering.
  4010. * Params:
  4011. * _id = View id.
  4012. * _program = Program.
  4013. * _depth = Depth for sorting.
  4014. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  4015. */
  4016. alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags);
  4017. da_bgfx_submit bgfx_submit;
  4018. /**
  4019. * Submit primitive with occlusion query for rendering.
  4020. * Params:
  4021. * _id = View id.
  4022. * _program = Program.
  4023. * _occlusionQuery = Occlusion query.
  4024. * _depth = Depth for sorting.
  4025. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  4026. */
  4027. 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);
  4028. da_bgfx_submit_occlusion_query bgfx_submit_occlusion_query;
  4029. /**
  4030. * Submit primitive for rendering with index and instance data info from
  4031. * indirect buffer.
  4032. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`.
  4033. * Params:
  4034. * _id = View id.
  4035. * _program = Program.
  4036. * _indirectHandle = Indirect buffer.
  4037. * _start = First element in indirect buffer.
  4038. * _num = Number of draws.
  4039. * _depth = Depth for sorting.
  4040. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  4041. */
  4042. 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);
  4043. da_bgfx_submit_indirect bgfx_submit_indirect;
  4044. /**
  4045. * Submit primitive for rendering with index and instance data info and
  4046. * draw count from indirect buffers.
  4047. * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`.
  4048. * Params:
  4049. * _id = View id.
  4050. * _program = Program.
  4051. * _indirectHandle = Indirect buffer.
  4052. * _start = First element in indirect buffer.
  4053. * _numHandle = Buffer for number of draws. Must be
  4054. * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`.
  4055. * _numIndex = Element in number buffer.
  4056. * _numMax = Max number of draws.
  4057. * _depth = Depth for sorting.
  4058. * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`.
  4059. */
  4060. alias da_bgfx_submit_indirect_count = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags);
  4061. da_bgfx_submit_indirect_count bgfx_submit_indirect_count;
  4062. /**
  4063. * Set compute index buffer.
  4064. * Params:
  4065. * _stage = Compute stage.
  4066. * _handle = Index buffer handle.
  4067. * _access = Buffer access. See `Access::Enum`.
  4068. */
  4069. alias da_bgfx_set_compute_index_buffer = void function(ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
  4070. da_bgfx_set_compute_index_buffer bgfx_set_compute_index_buffer;
  4071. /**
  4072. * Set compute vertex buffer.
  4073. * Params:
  4074. * _stage = Compute stage.
  4075. * _handle = Vertex buffer handle.
  4076. * _access = Buffer access. See `Access::Enum`.
  4077. */
  4078. alias da_bgfx_set_compute_vertex_buffer = void function(ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  4079. da_bgfx_set_compute_vertex_buffer bgfx_set_compute_vertex_buffer;
  4080. /**
  4081. * Set compute dynamic index buffer.
  4082. * Params:
  4083. * _stage = Compute stage.
  4084. * _handle = Dynamic index buffer handle.
  4085. * _access = Buffer access. See `Access::Enum`.
  4086. */
  4087. alias da_bgfx_set_compute_dynamic_index_buffer = void function(ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
  4088. da_bgfx_set_compute_dynamic_index_buffer bgfx_set_compute_dynamic_index_buffer;
  4089. /**
  4090. * Set compute dynamic vertex buffer.
  4091. * Params:
  4092. * _stage = Compute stage.
  4093. * _handle = Dynamic vertex buffer handle.
  4094. * _access = Buffer access. See `Access::Enum`.
  4095. */
  4096. alias da_bgfx_set_compute_dynamic_vertex_buffer = void function(ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
  4097. da_bgfx_set_compute_dynamic_vertex_buffer bgfx_set_compute_dynamic_vertex_buffer;
  4098. /**
  4099. * Set compute indirect buffer.
  4100. * Params:
  4101. * _stage = Compute stage.
  4102. * _handle = Indirect buffer handle.
  4103. * _access = Buffer access. See `Access::Enum`.
  4104. */
  4105. alias da_bgfx_set_compute_indirect_buffer = void function(ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
  4106. da_bgfx_set_compute_indirect_buffer bgfx_set_compute_indirect_buffer;
  4107. /**
  4108. * Set compute image from texture.
  4109. * Params:
  4110. * _stage = Compute stage.
  4111. * _handle = Texture handle.
  4112. * _mip = Mip level.
  4113. * _access = Image access. See `Access::Enum`.
  4114. * _format = Texture format. See: `TextureFormat::Enum`.
  4115. */
  4116. 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);
  4117. da_bgfx_set_image bgfx_set_image;
  4118. /**
  4119. * Dispatch compute.
  4120. * Params:
  4121. * _id = View id.
  4122. * _program = Compute program.
  4123. * _numX = Number of groups X.
  4124. * _numY = Number of groups Y.
  4125. * _numZ = Number of groups Z.
  4126. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  4127. */
  4128. alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags);
  4129. da_bgfx_dispatch bgfx_dispatch;
  4130. /**
  4131. * Dispatch compute indirect.
  4132. * Params:
  4133. * _id = View id.
  4134. * _program = Compute program.
  4135. * _indirectHandle = Indirect buffer.
  4136. * _start = First element in indirect buffer.
  4137. * _num = Number of dispatches.
  4138. * _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
  4139. */
  4140. 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);
  4141. da_bgfx_dispatch_indirect bgfx_dispatch_indirect;
  4142. /**
  4143. * Discard previously set state for draw or compute call.
  4144. * Params:
  4145. * _flags = Draw/compute states to discard.
  4146. */
  4147. alias da_bgfx_discard = void function(ubyte _flags);
  4148. da_bgfx_discard bgfx_discard;
  4149. /**
  4150. * Blit 2D texture region between two 2D textures.
  4151. * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag.
  4152. * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`.
  4153. * Params:
  4154. * _id = View id.
  4155. * _dst = Destination texture handle.
  4156. * _dstMip = Destination texture mip level.
  4157. * _dstX = Destination texture X position.
  4158. * _dstY = Destination texture Y position.
  4159. * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube
  4160. * this argument represents destination texture cube face. For 3D texture this argument
  4161. * represents destination texture Z position.
  4162. * _src = Source texture handle.
  4163. * _srcMip = Source texture mip level.
  4164. * _srcX = Source texture X position.
  4165. * _srcY = Source texture Y position.
  4166. * _srcZ = If texture is 2D this argument should be 0. If source texture is cube
  4167. * this argument represents source texture cube face. For 3D texture this argument
  4168. * represents source texture Z position.
  4169. * _width = Width of region.
  4170. * _height = Height of region.
  4171. * _depth = If texture is 3D this argument represents depth of region, otherwise it's
  4172. * unused.
  4173. */
  4174. 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);
  4175. da_bgfx_blit bgfx_blit;
  4176. }
  4177. }