funcs.d 179 KB

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