funcs.d 178 KB

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