funcs.d 171 KB

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