funcs.d 173 KB

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