funcs.d 172 KB

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