funcs.d 179 KB

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