funcs.d 171 KB

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