CoreGrammar.cs 182 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315
  1. // AUTOGENERATED: DO NOT EDIT
  2. // Last update date: 2021-01-06 23:02:26.837899
  3. #region Grammar License
  4. // Copyright (c) 2014-2020 The Khronos Group Inc.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and/or associated documentation files (the "Materials"),
  8. // to deal in the Materials without restriction, including without limitation
  9. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. // and/or sell copies of the Materials, and to permit persons to whom the
  11. // Materials are furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Materials.
  15. //
  16. // MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
  17. // STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
  18. // HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
  19. //
  20. // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  23. // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  24. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  25. // FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
  26. // IN THE MATERIALS.
  27. #endregion
  28. using static Spv.Specification;
  29. namespace Spv.Generator
  30. {
  31. public partial class Module
  32. {
  33. // Miscellaneous
  34. public Instruction Nop()
  35. {
  36. Instruction result = NewInstruction(Op.OpNop);
  37. AddToFunctionDefinitions(result);
  38. return result;
  39. }
  40. public Instruction Undef(Instruction resultType)
  41. {
  42. Instruction result = NewInstruction(Op.OpUndef, GetNewId(), resultType);
  43. AddToFunctionDefinitions(result);
  44. return result;
  45. }
  46. public Instruction SizeOf(Instruction resultType, Instruction pointer)
  47. {
  48. Instruction result = NewInstruction(Op.OpSizeOf, GetNewId(), resultType);
  49. result.AddOperand(pointer);
  50. AddToFunctionDefinitions(result);
  51. return result;
  52. }
  53. // Debug
  54. public Instruction SourceContinued(string continuedSource)
  55. {
  56. Instruction result = NewInstruction(Op.OpSourceContinued);
  57. result.AddOperand(continuedSource);
  58. AddDebug(result);
  59. return result;
  60. }
  61. public Instruction Source(SourceLanguage sourceLanguage, LiteralInteger version, Instruction file = null, string source = null)
  62. {
  63. Instruction result = NewInstruction(Op.OpSource);
  64. result.AddOperand(sourceLanguage);
  65. result.AddOperand(version);
  66. if (file != null)
  67. {
  68. result.AddOperand(file);
  69. }
  70. if (source != null)
  71. {
  72. result.AddOperand(source);
  73. }
  74. AddDebug(result);
  75. return result;
  76. }
  77. public Instruction SourceExtension(string extension)
  78. {
  79. Instruction result = NewInstruction(Op.OpSourceExtension);
  80. result.AddOperand(extension);
  81. AddDebug(result);
  82. return result;
  83. }
  84. public Instruction Name(Instruction target, string name)
  85. {
  86. Instruction result = NewInstruction(Op.OpName);
  87. result.AddOperand(target);
  88. result.AddOperand(name);
  89. AddDebug(result);
  90. return result;
  91. }
  92. public Instruction MemberName(Instruction type, LiteralInteger member, string name)
  93. {
  94. Instruction result = NewInstruction(Op.OpMemberName);
  95. result.AddOperand(type);
  96. result.AddOperand(member);
  97. result.AddOperand(name);
  98. AddDebug(result);
  99. return result;
  100. }
  101. public Instruction String(string str)
  102. {
  103. Instruction result = NewInstruction(Op.OpString, GetNewId());
  104. result.AddOperand(str);
  105. AddDebug(result);
  106. return result;
  107. }
  108. public Instruction Line(Instruction file, LiteralInteger line, LiteralInteger column)
  109. {
  110. Instruction result = NewInstruction(Op.OpLine);
  111. result.AddOperand(file);
  112. result.AddOperand(line);
  113. result.AddOperand(column);
  114. AddDebug(result);
  115. return result;
  116. }
  117. public Instruction NoLine()
  118. {
  119. Instruction result = NewInstruction(Op.OpNoLine);
  120. AddDebug(result);
  121. return result;
  122. }
  123. public Instruction ModuleProcessed(string process)
  124. {
  125. Instruction result = NewInstruction(Op.OpModuleProcessed);
  126. result.AddOperand(process);
  127. AddDebug(result);
  128. return result;
  129. }
  130. // Annotation
  131. public Instruction Decorate(Instruction target, Decoration decoration)
  132. {
  133. Instruction result = NewInstruction(Op.OpDecorate);
  134. result.AddOperand(target);
  135. result.AddOperand(decoration);
  136. AddAnnotation(result);
  137. return result;
  138. }
  139. public Instruction Decorate(Instruction target, Decoration decoration, Operand parameter)
  140. {
  141. Instruction result = NewInstruction(Op.OpDecorate);
  142. result.AddOperand(target);
  143. result.AddOperand(decoration);
  144. result.AddOperand(parameter);
  145. AddAnnotation(result);
  146. return result;
  147. }
  148. public Instruction Decorate(Instruction target, Decoration decoration, params Operand[] parameters)
  149. {
  150. Instruction result = NewInstruction(Op.OpDecorate);
  151. result.AddOperand(target);
  152. result.AddOperand(decoration);
  153. result.AddOperand(parameters);
  154. AddAnnotation(result);
  155. return result;
  156. }
  157. public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration)
  158. {
  159. Instruction result = NewInstruction(Op.OpMemberDecorate);
  160. result.AddOperand(structureType);
  161. result.AddOperand(member);
  162. result.AddOperand(decoration);
  163. AddAnnotation(result);
  164. return result;
  165. }
  166. public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, Operand parameter)
  167. {
  168. Instruction result = NewInstruction(Op.OpMemberDecorate);
  169. result.AddOperand(structureType);
  170. result.AddOperand(member);
  171. result.AddOperand(decoration);
  172. result.AddOperand(parameter);
  173. AddAnnotation(result);
  174. return result;
  175. }
  176. public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
  177. {
  178. Instruction result = NewInstruction(Op.OpMemberDecorate);
  179. result.AddOperand(structureType);
  180. result.AddOperand(member);
  181. result.AddOperand(decoration);
  182. result.AddOperand(parameters);
  183. AddAnnotation(result);
  184. return result;
  185. }
  186. public Instruction DecorationGroup()
  187. {
  188. Instruction result = NewInstruction(Op.OpDecorationGroup, GetNewId());
  189. AddAnnotation(result);
  190. return result;
  191. }
  192. public Instruction GroupDecorate(Instruction decorationGroup, params Instruction[] targets)
  193. {
  194. Instruction result = NewInstruction(Op.OpGroupDecorate);
  195. result.AddOperand(decorationGroup);
  196. result.AddOperand(targets);
  197. AddAnnotation(result);
  198. return result;
  199. }
  200. public Instruction GroupMemberDecorate(Instruction decorationGroup, params Operand[] targets)
  201. {
  202. Instruction result = NewInstruction(Op.OpGroupMemberDecorate);
  203. result.AddOperand(decorationGroup);
  204. result.AddOperand(targets);
  205. AddAnnotation(result);
  206. return result;
  207. }
  208. public Instruction DecorateId(Instruction target, Decoration decoration, params Operand[] parameters)
  209. {
  210. Instruction result = NewInstruction(Op.OpDecorateId);
  211. result.AddOperand(target);
  212. result.AddOperand(decoration);
  213. result.AddOperand(parameters);
  214. AddAnnotation(result);
  215. return result;
  216. }
  217. public Instruction DecorateString(Instruction target, Decoration decoration, params Operand[] parameters)
  218. {
  219. Instruction result = NewInstruction(Op.OpDecorateString);
  220. result.AddOperand(target);
  221. result.AddOperand(decoration);
  222. result.AddOperand(parameters);
  223. AddAnnotation(result);
  224. return result;
  225. }
  226. public Instruction DecorateStringGOOGLE(Instruction target, Decoration decoration, params Operand[] parameters)
  227. {
  228. Instruction result = NewInstruction(Op.OpDecorateStringGOOGLE);
  229. result.AddOperand(target);
  230. result.AddOperand(decoration);
  231. result.AddOperand(parameters);
  232. AddAnnotation(result);
  233. return result;
  234. }
  235. public Instruction MemberDecorateString(Instruction structType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
  236. {
  237. Instruction result = NewInstruction(Op.OpMemberDecorateString);
  238. result.AddOperand(structType);
  239. result.AddOperand(member);
  240. result.AddOperand(decoration);
  241. result.AddOperand(parameters);
  242. AddAnnotation(result);
  243. return result;
  244. }
  245. public Instruction MemberDecorateStringGOOGLE(Instruction structType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
  246. {
  247. Instruction result = NewInstruction(Op.OpMemberDecorateStringGOOGLE);
  248. result.AddOperand(structType);
  249. result.AddOperand(member);
  250. result.AddOperand(decoration);
  251. result.AddOperand(parameters);
  252. AddAnnotation(result);
  253. return result;
  254. }
  255. // Type-Declaration
  256. public Instruction TypeVoid(bool forceIdAllocation = false)
  257. {
  258. Instruction result = NewInstruction(Op.OpTypeVoid);
  259. AddTypeDeclaration(result, forceIdAllocation);
  260. return result;
  261. }
  262. public Instruction TypeBool(bool forceIdAllocation = false)
  263. {
  264. Instruction result = NewInstruction(Op.OpTypeBool);
  265. AddTypeDeclaration(result, forceIdAllocation);
  266. return result;
  267. }
  268. public Instruction TypeInt(LiteralInteger width, LiteralInteger signedness, bool forceIdAllocation = false)
  269. {
  270. Instruction result = NewInstruction(Op.OpTypeInt);
  271. result.AddOperand(width);
  272. result.AddOperand(signedness);
  273. AddTypeDeclaration(result, forceIdAllocation);
  274. return result;
  275. }
  276. public Instruction TypeFloat(LiteralInteger width, bool forceIdAllocation = false)
  277. {
  278. Instruction result = NewInstruction(Op.OpTypeFloat);
  279. result.AddOperand(width);
  280. AddTypeDeclaration(result, forceIdAllocation);
  281. return result;
  282. }
  283. public Instruction TypeVector(Instruction componentType, LiteralInteger componentCount, bool forceIdAllocation = false)
  284. {
  285. Instruction result = NewInstruction(Op.OpTypeVector);
  286. result.AddOperand(componentType);
  287. result.AddOperand(componentCount);
  288. AddTypeDeclaration(result, forceIdAllocation);
  289. return result;
  290. }
  291. public Instruction TypeMatrix(Instruction columnType, LiteralInteger columnCount, bool forceIdAllocation = false)
  292. {
  293. Instruction result = NewInstruction(Op.OpTypeMatrix);
  294. result.AddOperand(columnType);
  295. result.AddOperand(columnCount);
  296. AddTypeDeclaration(result, forceIdAllocation);
  297. return result;
  298. }
  299. public Instruction TypeImage(Instruction sampledType, Dim dim, LiteralInteger depth, LiteralInteger arrayed, LiteralInteger mS, LiteralInteger sampled, ImageFormat imageFormat, AccessQualifier accessQualifier = (AccessQualifier)int.MaxValue, bool forceIdAllocation = false)
  300. {
  301. Instruction result = NewInstruction(Op.OpTypeImage);
  302. result.AddOperand(sampledType);
  303. result.AddOperand(dim);
  304. result.AddOperand(depth);
  305. result.AddOperand(arrayed);
  306. result.AddOperand(mS);
  307. result.AddOperand(sampled);
  308. result.AddOperand(imageFormat);
  309. if (accessQualifier != (AccessQualifier)int.MaxValue)
  310. {
  311. result.AddOperand(accessQualifier);
  312. }
  313. AddTypeDeclaration(result, forceIdAllocation);
  314. return result;
  315. }
  316. public Instruction TypeSampler(bool forceIdAllocation = false)
  317. {
  318. Instruction result = NewInstruction(Op.OpTypeSampler);
  319. AddTypeDeclaration(result, forceIdAllocation);
  320. return result;
  321. }
  322. public Instruction TypeSampledImage(Instruction imageType, bool forceIdAllocation = false)
  323. {
  324. Instruction result = NewInstruction(Op.OpTypeSampledImage);
  325. result.AddOperand(imageType);
  326. AddTypeDeclaration(result, forceIdAllocation);
  327. return result;
  328. }
  329. public Instruction TypeArray(Instruction elementType, Instruction length, bool forceIdAllocation = false)
  330. {
  331. Instruction result = NewInstruction(Op.OpTypeArray);
  332. result.AddOperand(elementType);
  333. result.AddOperand(length);
  334. AddTypeDeclaration(result, forceIdAllocation);
  335. return result;
  336. }
  337. public Instruction TypeRuntimeArray(Instruction elementType, bool forceIdAllocation = false)
  338. {
  339. Instruction result = NewInstruction(Op.OpTypeRuntimeArray);
  340. result.AddOperand(elementType);
  341. AddTypeDeclaration(result, forceIdAllocation);
  342. return result;
  343. }
  344. public Instruction TypeStruct(bool forceIdAllocation, params Instruction[] parameters)
  345. {
  346. Instruction result = NewInstruction(Op.OpTypeStruct);
  347. result.AddOperand(parameters);
  348. AddTypeDeclaration(result, forceIdAllocation);
  349. return result;
  350. }
  351. public Instruction TypeOpaque(string thenameoftheopaquetype, bool forceIdAllocation = false)
  352. {
  353. Instruction result = NewInstruction(Op.OpTypeOpaque);
  354. result.AddOperand(thenameoftheopaquetype);
  355. AddTypeDeclaration(result, forceIdAllocation);
  356. return result;
  357. }
  358. public Instruction TypePointer(StorageClass storageClass, Instruction type, bool forceIdAllocation = false)
  359. {
  360. Instruction result = NewInstruction(Op.OpTypePointer);
  361. result.AddOperand(storageClass);
  362. result.AddOperand(type);
  363. AddTypeDeclaration(result, forceIdAllocation);
  364. return result;
  365. }
  366. public Instruction TypeFunction(Instruction returnType, bool forceIdAllocation, params Instruction[] parameters)
  367. {
  368. Instruction result = NewInstruction(Op.OpTypeFunction);
  369. result.AddOperand(returnType);
  370. result.AddOperand(parameters);
  371. AddTypeDeclaration(result, forceIdAllocation);
  372. return result;
  373. }
  374. public Instruction TypeEvent(bool forceIdAllocation = false)
  375. {
  376. Instruction result = NewInstruction(Op.OpTypeEvent);
  377. AddTypeDeclaration(result, forceIdAllocation);
  378. return result;
  379. }
  380. public Instruction TypeDeviceEvent(bool forceIdAllocation = false)
  381. {
  382. Instruction result = NewInstruction(Op.OpTypeDeviceEvent);
  383. AddTypeDeclaration(result, forceIdAllocation);
  384. return result;
  385. }
  386. public Instruction TypeReserveId(bool forceIdAllocation = false)
  387. {
  388. Instruction result = NewInstruction(Op.OpTypeReserveId);
  389. AddTypeDeclaration(result, forceIdAllocation);
  390. return result;
  391. }
  392. public Instruction TypeQueue(bool forceIdAllocation = false)
  393. {
  394. Instruction result = NewInstruction(Op.OpTypeQueue);
  395. AddTypeDeclaration(result, forceIdAllocation);
  396. return result;
  397. }
  398. public Instruction TypePipe(AccessQualifier qualifier, bool forceIdAllocation = false)
  399. {
  400. Instruction result = NewInstruction(Op.OpTypePipe);
  401. result.AddOperand(qualifier);
  402. AddTypeDeclaration(result, forceIdAllocation);
  403. return result;
  404. }
  405. public Instruction TypeForwardPointer(Instruction pointerType, StorageClass storageClass, bool forceIdAllocation = false)
  406. {
  407. Instruction result = NewInstruction(Op.OpTypeForwardPointer);
  408. result.AddOperand(pointerType);
  409. result.AddOperand(storageClass);
  410. AddTypeDeclaration(result, forceIdAllocation);
  411. return result;
  412. }
  413. public Instruction TypePipeStorage(bool forceIdAllocation = false)
  414. {
  415. Instruction result = NewInstruction(Op.OpTypePipeStorage);
  416. AddTypeDeclaration(result, forceIdAllocation);
  417. return result;
  418. }
  419. public Instruction TypeNamedBarrier(bool forceIdAllocation = false)
  420. {
  421. Instruction result = NewInstruction(Op.OpTypeNamedBarrier);
  422. AddTypeDeclaration(result, forceIdAllocation);
  423. return result;
  424. }
  425. // Constant-Creation
  426. public Instruction ConstantTrue(Instruction resultType)
  427. {
  428. Instruction result = NewInstruction(Op.OpConstantTrue, Instruction.InvalidId, resultType);
  429. AddConstant(result);
  430. return result;
  431. }
  432. public Instruction ConstantFalse(Instruction resultType)
  433. {
  434. Instruction result = NewInstruction(Op.OpConstantFalse, Instruction.InvalidId, resultType);
  435. AddConstant(result);
  436. return result;
  437. }
  438. public Instruction Constant(Instruction resultType, LiteralInteger value)
  439. {
  440. Instruction result = NewInstruction(Op.OpConstant, Instruction.InvalidId, resultType);
  441. result.AddOperand(value);
  442. AddConstant(result);
  443. return result;
  444. }
  445. public Instruction ConstantComposite(Instruction resultType, params Instruction[] constituents)
  446. {
  447. Instruction result = NewInstruction(Op.OpConstantComposite, Instruction.InvalidId, resultType);
  448. result.AddOperand(constituents);
  449. AddConstant(result);
  450. return result;
  451. }
  452. public Instruction ConstantSampler(Instruction resultType, SamplerAddressingMode samplerAddressingMode, LiteralInteger param, SamplerFilterMode samplerFilterMode)
  453. {
  454. Instruction result = NewInstruction(Op.OpConstantSampler, Instruction.InvalidId, resultType);
  455. result.AddOperand(samplerAddressingMode);
  456. result.AddOperand(param);
  457. result.AddOperand(samplerFilterMode);
  458. AddConstant(result);
  459. return result;
  460. }
  461. public Instruction ConstantNull(Instruction resultType)
  462. {
  463. Instruction result = NewInstruction(Op.OpConstantNull, Instruction.InvalidId, resultType);
  464. AddConstant(result);
  465. return result;
  466. }
  467. public Instruction SpecConstantTrue(Instruction resultType)
  468. {
  469. Instruction result = NewInstruction(Op.OpSpecConstantTrue, GetNewId(), resultType);
  470. AddToFunctionDefinitions(result);
  471. return result;
  472. }
  473. public Instruction SpecConstantFalse(Instruction resultType)
  474. {
  475. Instruction result = NewInstruction(Op.OpSpecConstantFalse, GetNewId(), resultType);
  476. AddToFunctionDefinitions(result);
  477. return result;
  478. }
  479. public Instruction SpecConstant(Instruction resultType, LiteralInteger value)
  480. {
  481. Instruction result = NewInstruction(Op.OpSpecConstant, GetNewId(), resultType);
  482. result.AddOperand(value);
  483. AddToFunctionDefinitions(result);
  484. return result;
  485. }
  486. public Instruction SpecConstantComposite(Instruction resultType, params Instruction[] constituents)
  487. {
  488. Instruction result = NewInstruction(Op.OpSpecConstantComposite, GetNewId(), resultType);
  489. result.AddOperand(constituents);
  490. AddToFunctionDefinitions(result);
  491. return result;
  492. }
  493. public Instruction SpecConstantOp(Instruction resultType, LiteralInteger opcode)
  494. {
  495. Instruction result = NewInstruction(Op.OpSpecConstantOp, GetNewId(), resultType);
  496. result.AddOperand(opcode);
  497. AddToFunctionDefinitions(result);
  498. return result;
  499. }
  500. // Memory
  501. public Instruction Variable(Instruction resultType, StorageClass storageClass, Instruction initializer = null)
  502. {
  503. Instruction result = NewInstruction(Op.OpVariable, GetNewId(), resultType);
  504. result.AddOperand(storageClass);
  505. if (initializer != null)
  506. {
  507. result.AddOperand(initializer);
  508. }
  509. return result;
  510. }
  511. public Instruction ImageTexelPointer(Instruction resultType, Instruction image, Instruction coordinate, Instruction sample)
  512. {
  513. Instruction result = NewInstruction(Op.OpImageTexelPointer, GetNewId(), resultType);
  514. result.AddOperand(image);
  515. result.AddOperand(coordinate);
  516. result.AddOperand(sample);
  517. AddToFunctionDefinitions(result);
  518. return result;
  519. }
  520. public Instruction Load(Instruction resultType, Instruction pointer, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
  521. {
  522. Instruction result = NewInstruction(Op.OpLoad, GetNewId(), resultType);
  523. result.AddOperand(pointer);
  524. if (memoryAccess != (MemoryAccessMask)int.MaxValue)
  525. {
  526. result.AddOperand(memoryAccess);
  527. }
  528. AddToFunctionDefinitions(result);
  529. return result;
  530. }
  531. public Instruction Store(Instruction pointer, Instruction obj, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
  532. {
  533. Instruction result = NewInstruction(Op.OpStore);
  534. result.AddOperand(pointer);
  535. result.AddOperand(obj);
  536. if (memoryAccess != (MemoryAccessMask)int.MaxValue)
  537. {
  538. result.AddOperand(memoryAccess);
  539. }
  540. AddToFunctionDefinitions(result);
  541. return result;
  542. }
  543. public Instruction CopyMemory(Instruction target, Instruction source, MemoryAccessMask memoryAccess0 = (MemoryAccessMask)int.MaxValue, MemoryAccessMask memoryAccess1 = (MemoryAccessMask)int.MaxValue)
  544. {
  545. Instruction result = NewInstruction(Op.OpCopyMemory);
  546. result.AddOperand(target);
  547. result.AddOperand(source);
  548. if (memoryAccess0 != (MemoryAccessMask)int.MaxValue)
  549. {
  550. result.AddOperand(memoryAccess0);
  551. }
  552. if (memoryAccess1 != (MemoryAccessMask)int.MaxValue)
  553. {
  554. result.AddOperand(memoryAccess1);
  555. }
  556. AddToFunctionDefinitions(result);
  557. return result;
  558. }
  559. public Instruction CopyMemorySized(Instruction target, Instruction source, Instruction size, MemoryAccessMask memoryAccess0 = (MemoryAccessMask)int.MaxValue, MemoryAccessMask memoryAccess1 = (MemoryAccessMask)int.MaxValue)
  560. {
  561. Instruction result = NewInstruction(Op.OpCopyMemorySized);
  562. result.AddOperand(target);
  563. result.AddOperand(source);
  564. result.AddOperand(size);
  565. if (memoryAccess0 != (MemoryAccessMask)int.MaxValue)
  566. {
  567. result.AddOperand(memoryAccess0);
  568. }
  569. if (memoryAccess1 != (MemoryAccessMask)int.MaxValue)
  570. {
  571. result.AddOperand(memoryAccess1);
  572. }
  573. AddToFunctionDefinitions(result);
  574. return result;
  575. }
  576. public Instruction AccessChain(Instruction resultType, Instruction baseObj, Instruction index)
  577. {
  578. Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
  579. result.AddOperand(baseObj);
  580. result.AddOperand(index);
  581. AddToFunctionDefinitions(result);
  582. return result;
  583. }
  584. public Instruction AccessChain(Instruction resultType, Instruction baseObj, Instruction index0, Instruction index1)
  585. {
  586. Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
  587. result.AddOperand(baseObj);
  588. result.AddOperand(index0);
  589. result.AddOperand(index1);
  590. AddToFunctionDefinitions(result);
  591. return result;
  592. }
  593. public Instruction AccessChain(Instruction resultType, Instruction baseObj, Instruction index0, Instruction index1, Instruction index2)
  594. {
  595. Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
  596. result.AddOperand(baseObj);
  597. result.AddOperand(index0);
  598. result.AddOperand(index1);
  599. result.AddOperand(index2);
  600. AddToFunctionDefinitions(result);
  601. return result;
  602. }
  603. public Instruction AccessChain(Instruction resultType, Instruction baseObj, params Instruction[] indexes)
  604. {
  605. Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
  606. result.AddOperand(baseObj);
  607. result.AddOperand(indexes);
  608. AddToFunctionDefinitions(result);
  609. return result;
  610. }
  611. public Instruction InBoundsAccessChain(Instruction resultType, Instruction baseObj, params Instruction[] indexes)
  612. {
  613. Instruction result = NewInstruction(Op.OpInBoundsAccessChain, GetNewId(), resultType);
  614. result.AddOperand(baseObj);
  615. result.AddOperand(indexes);
  616. AddToFunctionDefinitions(result);
  617. return result;
  618. }
  619. public Instruction PtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params Instruction[] indexes)
  620. {
  621. Instruction result = NewInstruction(Op.OpPtrAccessChain, GetNewId(), resultType);
  622. result.AddOperand(baseObj);
  623. result.AddOperand(element);
  624. result.AddOperand(indexes);
  625. AddToFunctionDefinitions(result);
  626. return result;
  627. }
  628. public Instruction ArrayLength(Instruction resultType, Instruction structure, LiteralInteger arraymember)
  629. {
  630. Instruction result = NewInstruction(Op.OpArrayLength, GetNewId(), resultType);
  631. result.AddOperand(structure);
  632. result.AddOperand(arraymember);
  633. AddToFunctionDefinitions(result);
  634. return result;
  635. }
  636. public Instruction GenericPtrMemSemantics(Instruction resultType, Instruction pointer)
  637. {
  638. Instruction result = NewInstruction(Op.OpGenericPtrMemSemantics, GetNewId(), resultType);
  639. result.AddOperand(pointer);
  640. AddToFunctionDefinitions(result);
  641. return result;
  642. }
  643. public Instruction InBoundsPtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params Instruction[] indexes)
  644. {
  645. Instruction result = NewInstruction(Op.OpInBoundsPtrAccessChain, GetNewId(), resultType);
  646. result.AddOperand(baseObj);
  647. result.AddOperand(element);
  648. result.AddOperand(indexes);
  649. AddToFunctionDefinitions(result);
  650. return result;
  651. }
  652. public Instruction PtrEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  653. {
  654. Instruction result = NewInstruction(Op.OpPtrEqual, GetNewId(), resultType);
  655. result.AddOperand(operand1);
  656. result.AddOperand(operand2);
  657. AddToFunctionDefinitions(result);
  658. return result;
  659. }
  660. public Instruction PtrNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  661. {
  662. Instruction result = NewInstruction(Op.OpPtrNotEqual, GetNewId(), resultType);
  663. result.AddOperand(operand1);
  664. result.AddOperand(operand2);
  665. AddToFunctionDefinitions(result);
  666. return result;
  667. }
  668. public Instruction PtrDiff(Instruction resultType, Instruction operand1, Instruction operand2)
  669. {
  670. Instruction result = NewInstruction(Op.OpPtrDiff, GetNewId(), resultType);
  671. result.AddOperand(operand1);
  672. result.AddOperand(operand2);
  673. AddToFunctionDefinitions(result);
  674. return result;
  675. }
  676. // Function
  677. public Instruction Function(Instruction resultType, FunctionControlMask functionControl, Instruction functionType)
  678. {
  679. Instruction result = NewInstruction(Op.OpFunction, GetNewId(), resultType);
  680. result.AddOperand(functionControl);
  681. result.AddOperand(functionType);
  682. return result;
  683. }
  684. public void AddFunction(Instruction function)
  685. {
  686. AddToFunctionDefinitions(function);
  687. }
  688. public Instruction FunctionParameter(Instruction resultType)
  689. {
  690. Instruction result = NewInstruction(Op.OpFunctionParameter, GetNewId(), resultType);
  691. AddToFunctionDefinitions(result);
  692. return result;
  693. }
  694. public Instruction FunctionEnd()
  695. {
  696. Instruction result = NewInstruction(Op.OpFunctionEnd);
  697. AddToFunctionDefinitions(result);
  698. return result;
  699. }
  700. public Instruction FunctionCall(Instruction resultType, Instruction function, params Instruction[] parameters)
  701. {
  702. Instruction result = NewInstruction(Op.OpFunctionCall, GetNewId(), resultType);
  703. result.AddOperand(function);
  704. result.AddOperand(parameters);
  705. AddToFunctionDefinitions(result);
  706. return result;
  707. }
  708. // Image
  709. public Instruction SampledImage(Instruction resultType, Instruction image, Instruction sampler)
  710. {
  711. Instruction result = NewInstruction(Op.OpSampledImage, GetNewId(), resultType);
  712. result.AddOperand(image);
  713. result.AddOperand(sampler);
  714. AddToFunctionDefinitions(result);
  715. return result;
  716. }
  717. public Instruction ImageSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  718. {
  719. Instruction result = NewInstruction(Op.OpImageSampleImplicitLod, GetNewId(), resultType);
  720. result.AddOperand(sampledImage);
  721. result.AddOperand(coordinate);
  722. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  723. {
  724. result.AddOperand(imageOperands);
  725. }
  726. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  727. {
  728. result.AddOperand(imageOperandIds);
  729. }
  730. AddToFunctionDefinitions(result);
  731. return result;
  732. }
  733. public Instruction ImageSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  734. {
  735. Instruction result = NewInstruction(Op.OpImageSampleExplicitLod, GetNewId(), resultType);
  736. result.AddOperand(sampledImage);
  737. result.AddOperand(coordinate);
  738. result.AddOperand(imageOperands);
  739. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  740. {
  741. result.AddOperand(imageOperandIds);
  742. }
  743. AddToFunctionDefinitions(result);
  744. return result;
  745. }
  746. public Instruction ImageSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  747. {
  748. Instruction result = NewInstruction(Op.OpImageSampleDrefImplicitLod, GetNewId(), resultType);
  749. result.AddOperand(sampledImage);
  750. result.AddOperand(coordinate);
  751. result.AddOperand(dRef);
  752. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  753. {
  754. result.AddOperand(imageOperands);
  755. }
  756. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  757. {
  758. result.AddOperand(imageOperandIds);
  759. }
  760. AddToFunctionDefinitions(result);
  761. return result;
  762. }
  763. public Instruction ImageSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  764. {
  765. Instruction result = NewInstruction(Op.OpImageSampleDrefExplicitLod, GetNewId(), resultType);
  766. result.AddOperand(sampledImage);
  767. result.AddOperand(coordinate);
  768. result.AddOperand(dRef);
  769. result.AddOperand(imageOperands);
  770. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  771. {
  772. result.AddOperand(imageOperandIds);
  773. }
  774. AddToFunctionDefinitions(result);
  775. return result;
  776. }
  777. public Instruction ImageSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  778. {
  779. Instruction result = NewInstruction(Op.OpImageSampleProjImplicitLod, GetNewId(), resultType);
  780. result.AddOperand(sampledImage);
  781. result.AddOperand(coordinate);
  782. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  783. {
  784. result.AddOperand(imageOperands);
  785. }
  786. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  787. {
  788. result.AddOperand(imageOperandIds);
  789. }
  790. AddToFunctionDefinitions(result);
  791. return result;
  792. }
  793. public Instruction ImageSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  794. {
  795. Instruction result = NewInstruction(Op.OpImageSampleProjExplicitLod, GetNewId(), resultType);
  796. result.AddOperand(sampledImage);
  797. result.AddOperand(coordinate);
  798. result.AddOperand(imageOperands);
  799. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  800. {
  801. result.AddOperand(imageOperandIds);
  802. }
  803. AddToFunctionDefinitions(result);
  804. return result;
  805. }
  806. public Instruction ImageSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  807. {
  808. Instruction result = NewInstruction(Op.OpImageSampleProjDrefImplicitLod, GetNewId(), resultType);
  809. result.AddOperand(sampledImage);
  810. result.AddOperand(coordinate);
  811. result.AddOperand(dRef);
  812. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  813. {
  814. result.AddOperand(imageOperands);
  815. }
  816. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  817. {
  818. result.AddOperand(imageOperandIds);
  819. }
  820. AddToFunctionDefinitions(result);
  821. return result;
  822. }
  823. public Instruction ImageSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  824. {
  825. Instruction result = NewInstruction(Op.OpImageSampleProjDrefExplicitLod, GetNewId(), resultType);
  826. result.AddOperand(sampledImage);
  827. result.AddOperand(coordinate);
  828. result.AddOperand(dRef);
  829. result.AddOperand(imageOperands);
  830. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  831. {
  832. result.AddOperand(imageOperandIds);
  833. }
  834. AddToFunctionDefinitions(result);
  835. return result;
  836. }
  837. public Instruction ImageFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  838. {
  839. Instruction result = NewInstruction(Op.OpImageFetch, GetNewId(), resultType);
  840. result.AddOperand(image);
  841. result.AddOperand(coordinate);
  842. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  843. {
  844. result.AddOperand(imageOperands);
  845. }
  846. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  847. {
  848. result.AddOperand(imageOperandIds);
  849. }
  850. AddToFunctionDefinitions(result);
  851. return result;
  852. }
  853. public Instruction ImageGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  854. {
  855. Instruction result = NewInstruction(Op.OpImageGather, GetNewId(), resultType);
  856. result.AddOperand(sampledImage);
  857. result.AddOperand(coordinate);
  858. result.AddOperand(component);
  859. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  860. {
  861. result.AddOperand(imageOperands);
  862. }
  863. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  864. {
  865. result.AddOperand(imageOperandIds);
  866. }
  867. AddToFunctionDefinitions(result);
  868. return result;
  869. }
  870. public Instruction ImageDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  871. {
  872. Instruction result = NewInstruction(Op.OpImageDrefGather, GetNewId(), resultType);
  873. result.AddOperand(sampledImage);
  874. result.AddOperand(coordinate);
  875. result.AddOperand(dRef);
  876. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  877. {
  878. result.AddOperand(imageOperands);
  879. }
  880. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  881. {
  882. result.AddOperand(imageOperandIds);
  883. }
  884. AddToFunctionDefinitions(result);
  885. return result;
  886. }
  887. public Instruction ImageRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  888. {
  889. Instruction result = NewInstruction(Op.OpImageRead, GetNewId(), resultType);
  890. result.AddOperand(image);
  891. result.AddOperand(coordinate);
  892. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  893. {
  894. result.AddOperand(imageOperands);
  895. }
  896. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  897. {
  898. result.AddOperand(imageOperandIds);
  899. }
  900. AddToFunctionDefinitions(result);
  901. return result;
  902. }
  903. public Instruction ImageWrite(Instruction image, Instruction coordinate, Instruction texel, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  904. {
  905. Instruction result = NewInstruction(Op.OpImageWrite);
  906. result.AddOperand(image);
  907. result.AddOperand(coordinate);
  908. result.AddOperand(texel);
  909. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  910. {
  911. result.AddOperand(imageOperands);
  912. }
  913. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  914. {
  915. result.AddOperand(imageOperandIds);
  916. }
  917. AddToFunctionDefinitions(result);
  918. return result;
  919. }
  920. public Instruction Image(Instruction resultType, Instruction sampledImage)
  921. {
  922. Instruction result = NewInstruction(Op.OpImage, GetNewId(), resultType);
  923. result.AddOperand(sampledImage);
  924. AddToFunctionDefinitions(result);
  925. return result;
  926. }
  927. public Instruction ImageQueryFormat(Instruction resultType, Instruction image)
  928. {
  929. Instruction result = NewInstruction(Op.OpImageQueryFormat, GetNewId(), resultType);
  930. result.AddOperand(image);
  931. AddToFunctionDefinitions(result);
  932. return result;
  933. }
  934. public Instruction ImageQueryOrder(Instruction resultType, Instruction image)
  935. {
  936. Instruction result = NewInstruction(Op.OpImageQueryOrder, GetNewId(), resultType);
  937. result.AddOperand(image);
  938. AddToFunctionDefinitions(result);
  939. return result;
  940. }
  941. public Instruction ImageQuerySizeLod(Instruction resultType, Instruction image, Instruction levelofDetail)
  942. {
  943. Instruction result = NewInstruction(Op.OpImageQuerySizeLod, GetNewId(), resultType);
  944. result.AddOperand(image);
  945. result.AddOperand(levelofDetail);
  946. AddToFunctionDefinitions(result);
  947. return result;
  948. }
  949. public Instruction ImageQuerySize(Instruction resultType, Instruction image)
  950. {
  951. Instruction result = NewInstruction(Op.OpImageQuerySize, GetNewId(), resultType);
  952. result.AddOperand(image);
  953. AddToFunctionDefinitions(result);
  954. return result;
  955. }
  956. public Instruction ImageQueryLod(Instruction resultType, Instruction sampledImage, Instruction coordinate)
  957. {
  958. Instruction result = NewInstruction(Op.OpImageQueryLod, GetNewId(), resultType);
  959. result.AddOperand(sampledImage);
  960. result.AddOperand(coordinate);
  961. AddToFunctionDefinitions(result);
  962. return result;
  963. }
  964. public Instruction ImageQueryLevels(Instruction resultType, Instruction image)
  965. {
  966. Instruction result = NewInstruction(Op.OpImageQueryLevels, GetNewId(), resultType);
  967. result.AddOperand(image);
  968. AddToFunctionDefinitions(result);
  969. return result;
  970. }
  971. public Instruction ImageQuerySamples(Instruction resultType, Instruction image)
  972. {
  973. Instruction result = NewInstruction(Op.OpImageQuerySamples, GetNewId(), resultType);
  974. result.AddOperand(image);
  975. AddToFunctionDefinitions(result);
  976. return result;
  977. }
  978. public Instruction ImageSparseSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  979. {
  980. Instruction result = NewInstruction(Op.OpImageSparseSampleImplicitLod, GetNewId(), resultType);
  981. result.AddOperand(sampledImage);
  982. result.AddOperand(coordinate);
  983. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  984. {
  985. result.AddOperand(imageOperands);
  986. }
  987. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  988. {
  989. result.AddOperand(imageOperandIds);
  990. }
  991. AddToFunctionDefinitions(result);
  992. return result;
  993. }
  994. public Instruction ImageSparseSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  995. {
  996. Instruction result = NewInstruction(Op.OpImageSparseSampleExplicitLod, GetNewId(), resultType);
  997. result.AddOperand(sampledImage);
  998. result.AddOperand(coordinate);
  999. result.AddOperand(imageOperands);
  1000. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1001. {
  1002. result.AddOperand(imageOperandIds);
  1003. }
  1004. AddToFunctionDefinitions(result);
  1005. return result;
  1006. }
  1007. public Instruction ImageSparseSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1008. {
  1009. Instruction result = NewInstruction(Op.OpImageSparseSampleDrefImplicitLod, GetNewId(), resultType);
  1010. result.AddOperand(sampledImage);
  1011. result.AddOperand(coordinate);
  1012. result.AddOperand(dRef);
  1013. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1014. {
  1015. result.AddOperand(imageOperands);
  1016. }
  1017. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1018. {
  1019. result.AddOperand(imageOperandIds);
  1020. }
  1021. AddToFunctionDefinitions(result);
  1022. return result;
  1023. }
  1024. public Instruction ImageSparseSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1025. {
  1026. Instruction result = NewInstruction(Op.OpImageSparseSampleDrefExplicitLod, GetNewId(), resultType);
  1027. result.AddOperand(sampledImage);
  1028. result.AddOperand(coordinate);
  1029. result.AddOperand(dRef);
  1030. result.AddOperand(imageOperands);
  1031. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1032. {
  1033. result.AddOperand(imageOperandIds);
  1034. }
  1035. AddToFunctionDefinitions(result);
  1036. return result;
  1037. }
  1038. public Instruction ImageSparseSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1039. {
  1040. Instruction result = NewInstruction(Op.OpImageSparseSampleProjImplicitLod, GetNewId(), resultType);
  1041. result.AddOperand(sampledImage);
  1042. result.AddOperand(coordinate);
  1043. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1044. {
  1045. result.AddOperand(imageOperands);
  1046. }
  1047. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1048. {
  1049. result.AddOperand(imageOperandIds);
  1050. }
  1051. AddToFunctionDefinitions(result);
  1052. return result;
  1053. }
  1054. public Instruction ImageSparseSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1055. {
  1056. Instruction result = NewInstruction(Op.OpImageSparseSampleProjExplicitLod, GetNewId(), resultType);
  1057. result.AddOperand(sampledImage);
  1058. result.AddOperand(coordinate);
  1059. result.AddOperand(imageOperands);
  1060. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1061. {
  1062. result.AddOperand(imageOperandIds);
  1063. }
  1064. AddToFunctionDefinitions(result);
  1065. return result;
  1066. }
  1067. public Instruction ImageSparseSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1068. {
  1069. Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefImplicitLod, GetNewId(), resultType);
  1070. result.AddOperand(sampledImage);
  1071. result.AddOperand(coordinate);
  1072. result.AddOperand(dRef);
  1073. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1074. {
  1075. result.AddOperand(imageOperands);
  1076. }
  1077. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1078. {
  1079. result.AddOperand(imageOperandIds);
  1080. }
  1081. AddToFunctionDefinitions(result);
  1082. return result;
  1083. }
  1084. public Instruction ImageSparseSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1085. {
  1086. Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefExplicitLod, GetNewId(), resultType);
  1087. result.AddOperand(sampledImage);
  1088. result.AddOperand(coordinate);
  1089. result.AddOperand(dRef);
  1090. result.AddOperand(imageOperands);
  1091. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1092. {
  1093. result.AddOperand(imageOperandIds);
  1094. }
  1095. AddToFunctionDefinitions(result);
  1096. return result;
  1097. }
  1098. public Instruction ImageSparseFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1099. {
  1100. Instruction result = NewInstruction(Op.OpImageSparseFetch, GetNewId(), resultType);
  1101. result.AddOperand(image);
  1102. result.AddOperand(coordinate);
  1103. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1104. {
  1105. result.AddOperand(imageOperands);
  1106. }
  1107. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1108. {
  1109. result.AddOperand(imageOperandIds);
  1110. }
  1111. AddToFunctionDefinitions(result);
  1112. return result;
  1113. }
  1114. public Instruction ImageSparseGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1115. {
  1116. Instruction result = NewInstruction(Op.OpImageSparseGather, GetNewId(), resultType);
  1117. result.AddOperand(sampledImage);
  1118. result.AddOperand(coordinate);
  1119. result.AddOperand(component);
  1120. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1121. {
  1122. result.AddOperand(imageOperands);
  1123. }
  1124. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1125. {
  1126. result.AddOperand(imageOperandIds);
  1127. }
  1128. AddToFunctionDefinitions(result);
  1129. return result;
  1130. }
  1131. public Instruction ImageSparseDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1132. {
  1133. Instruction result = NewInstruction(Op.OpImageSparseDrefGather, GetNewId(), resultType);
  1134. result.AddOperand(sampledImage);
  1135. result.AddOperand(coordinate);
  1136. result.AddOperand(dRef);
  1137. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1138. {
  1139. result.AddOperand(imageOperands);
  1140. }
  1141. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1142. {
  1143. result.AddOperand(imageOperandIds);
  1144. }
  1145. AddToFunctionDefinitions(result);
  1146. return result;
  1147. }
  1148. public Instruction ImageSparseTexelsResident(Instruction resultType, Instruction residentCode)
  1149. {
  1150. Instruction result = NewInstruction(Op.OpImageSparseTexelsResident, GetNewId(), resultType);
  1151. result.AddOperand(residentCode);
  1152. AddToFunctionDefinitions(result);
  1153. return result;
  1154. }
  1155. public Instruction ImageSparseRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1156. {
  1157. Instruction result = NewInstruction(Op.OpImageSparseRead, GetNewId(), resultType);
  1158. result.AddOperand(image);
  1159. result.AddOperand(coordinate);
  1160. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1161. {
  1162. result.AddOperand(imageOperands);
  1163. }
  1164. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1165. {
  1166. result.AddOperand(imageOperandIds);
  1167. }
  1168. AddToFunctionDefinitions(result);
  1169. return result;
  1170. }
  1171. public Instruction ImageSampleFootprintNV(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction granularity, Instruction coarse, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
  1172. {
  1173. Instruction result = NewInstruction(Op.OpImageSampleFootprintNV, GetNewId(), resultType);
  1174. result.AddOperand(sampledImage);
  1175. result.AddOperand(coordinate);
  1176. result.AddOperand(granularity);
  1177. result.AddOperand(coarse);
  1178. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1179. {
  1180. result.AddOperand(imageOperands);
  1181. }
  1182. if (imageOperands != (ImageOperandsMask)int.MaxValue)
  1183. {
  1184. result.AddOperand(imageOperandIds);
  1185. }
  1186. AddToFunctionDefinitions(result);
  1187. return result;
  1188. }
  1189. // Conversion
  1190. public Instruction ConvertFToU(Instruction resultType, Instruction floatValue)
  1191. {
  1192. Instruction result = NewInstruction(Op.OpConvertFToU, GetNewId(), resultType);
  1193. result.AddOperand(floatValue);
  1194. AddToFunctionDefinitions(result);
  1195. return result;
  1196. }
  1197. public Instruction ConvertFToS(Instruction resultType, Instruction floatValue)
  1198. {
  1199. Instruction result = NewInstruction(Op.OpConvertFToS, GetNewId(), resultType);
  1200. result.AddOperand(floatValue);
  1201. AddToFunctionDefinitions(result);
  1202. return result;
  1203. }
  1204. public Instruction ConvertSToF(Instruction resultType, Instruction signedValue)
  1205. {
  1206. Instruction result = NewInstruction(Op.OpConvertSToF, GetNewId(), resultType);
  1207. result.AddOperand(signedValue);
  1208. AddToFunctionDefinitions(result);
  1209. return result;
  1210. }
  1211. public Instruction ConvertUToF(Instruction resultType, Instruction unsignedValue)
  1212. {
  1213. Instruction result = NewInstruction(Op.OpConvertUToF, GetNewId(), resultType);
  1214. result.AddOperand(unsignedValue);
  1215. AddToFunctionDefinitions(result);
  1216. return result;
  1217. }
  1218. public Instruction UConvert(Instruction resultType, Instruction unsignedValue)
  1219. {
  1220. Instruction result = NewInstruction(Op.OpUConvert, GetNewId(), resultType);
  1221. result.AddOperand(unsignedValue);
  1222. AddToFunctionDefinitions(result);
  1223. return result;
  1224. }
  1225. public Instruction SConvert(Instruction resultType, Instruction signedValue)
  1226. {
  1227. Instruction result = NewInstruction(Op.OpSConvert, GetNewId(), resultType);
  1228. result.AddOperand(signedValue);
  1229. AddToFunctionDefinitions(result);
  1230. return result;
  1231. }
  1232. public Instruction FConvert(Instruction resultType, Instruction floatValue)
  1233. {
  1234. Instruction result = NewInstruction(Op.OpFConvert, GetNewId(), resultType);
  1235. result.AddOperand(floatValue);
  1236. AddToFunctionDefinitions(result);
  1237. return result;
  1238. }
  1239. public Instruction QuantizeToF16(Instruction resultType, Instruction value)
  1240. {
  1241. Instruction result = NewInstruction(Op.OpQuantizeToF16, GetNewId(), resultType);
  1242. result.AddOperand(value);
  1243. AddToFunctionDefinitions(result);
  1244. return result;
  1245. }
  1246. public Instruction ConvertPtrToU(Instruction resultType, Instruction pointer)
  1247. {
  1248. Instruction result = NewInstruction(Op.OpConvertPtrToU, GetNewId(), resultType);
  1249. result.AddOperand(pointer);
  1250. AddToFunctionDefinitions(result);
  1251. return result;
  1252. }
  1253. public Instruction SatConvertSToU(Instruction resultType, Instruction signedValue)
  1254. {
  1255. Instruction result = NewInstruction(Op.OpSatConvertSToU, GetNewId(), resultType);
  1256. result.AddOperand(signedValue);
  1257. AddToFunctionDefinitions(result);
  1258. return result;
  1259. }
  1260. public Instruction SatConvertUToS(Instruction resultType, Instruction unsignedValue)
  1261. {
  1262. Instruction result = NewInstruction(Op.OpSatConvertUToS, GetNewId(), resultType);
  1263. result.AddOperand(unsignedValue);
  1264. AddToFunctionDefinitions(result);
  1265. return result;
  1266. }
  1267. public Instruction ConvertUToPtr(Instruction resultType, Instruction integerValue)
  1268. {
  1269. Instruction result = NewInstruction(Op.OpConvertUToPtr, GetNewId(), resultType);
  1270. result.AddOperand(integerValue);
  1271. AddToFunctionDefinitions(result);
  1272. return result;
  1273. }
  1274. public Instruction PtrCastToGeneric(Instruction resultType, Instruction pointer)
  1275. {
  1276. Instruction result = NewInstruction(Op.OpPtrCastToGeneric, GetNewId(), resultType);
  1277. result.AddOperand(pointer);
  1278. AddToFunctionDefinitions(result);
  1279. return result;
  1280. }
  1281. public Instruction GenericCastToPtr(Instruction resultType, Instruction pointer)
  1282. {
  1283. Instruction result = NewInstruction(Op.OpGenericCastToPtr, GetNewId(), resultType);
  1284. result.AddOperand(pointer);
  1285. AddToFunctionDefinitions(result);
  1286. return result;
  1287. }
  1288. public Instruction GenericCastToPtrExplicit(Instruction resultType, Instruction pointer, StorageClass storage)
  1289. {
  1290. Instruction result = NewInstruction(Op.OpGenericCastToPtrExplicit, GetNewId(), resultType);
  1291. result.AddOperand(pointer);
  1292. result.AddOperand(storage);
  1293. AddToFunctionDefinitions(result);
  1294. return result;
  1295. }
  1296. public Instruction Bitcast(Instruction resultType, Instruction operand)
  1297. {
  1298. Instruction result = NewInstruction(Op.OpBitcast, GetNewId(), resultType);
  1299. result.AddOperand(operand);
  1300. AddToFunctionDefinitions(result);
  1301. return result;
  1302. }
  1303. // Composite
  1304. public Instruction VectorExtractDynamic(Instruction resultType, Instruction vector, Instruction index)
  1305. {
  1306. Instruction result = NewInstruction(Op.OpVectorExtractDynamic, GetNewId(), resultType);
  1307. result.AddOperand(vector);
  1308. result.AddOperand(index);
  1309. AddToFunctionDefinitions(result);
  1310. return result;
  1311. }
  1312. public Instruction VectorInsertDynamic(Instruction resultType, Instruction vector, Instruction component, Instruction index)
  1313. {
  1314. Instruction result = NewInstruction(Op.OpVectorInsertDynamic, GetNewId(), resultType);
  1315. result.AddOperand(vector);
  1316. result.AddOperand(component);
  1317. result.AddOperand(index);
  1318. AddToFunctionDefinitions(result);
  1319. return result;
  1320. }
  1321. public Instruction VectorShuffle(Instruction resultType, Instruction vector1, Instruction vector2, params LiteralInteger[] components)
  1322. {
  1323. Instruction result = NewInstruction(Op.OpVectorShuffle, GetNewId(), resultType);
  1324. result.AddOperand(vector1);
  1325. result.AddOperand(vector2);
  1326. result.AddOperand(components);
  1327. AddToFunctionDefinitions(result);
  1328. return result;
  1329. }
  1330. public Instruction CompositeConstruct(Instruction resultType, params Instruction[] constituents)
  1331. {
  1332. Instruction result = NewInstruction(Op.OpCompositeConstruct, GetNewId(), resultType);
  1333. result.AddOperand(constituents);
  1334. AddToFunctionDefinitions(result);
  1335. return result;
  1336. }
  1337. public Instruction CompositeExtract(Instruction resultType, Instruction composite, params LiteralInteger[] indexes)
  1338. {
  1339. Instruction result = NewInstruction(Op.OpCompositeExtract, GetNewId(), resultType);
  1340. result.AddOperand(composite);
  1341. result.AddOperand(indexes);
  1342. AddToFunctionDefinitions(result);
  1343. return result;
  1344. }
  1345. public Instruction CompositeInsert(Instruction resultType, Instruction obj, Instruction composite, params LiteralInteger[] indexes)
  1346. {
  1347. Instruction result = NewInstruction(Op.OpCompositeInsert, GetNewId(), resultType);
  1348. result.AddOperand(obj);
  1349. result.AddOperand(composite);
  1350. result.AddOperand(indexes);
  1351. AddToFunctionDefinitions(result);
  1352. return result;
  1353. }
  1354. public Instruction CopyObject(Instruction resultType, Instruction operand)
  1355. {
  1356. Instruction result = NewInstruction(Op.OpCopyObject, GetNewId(), resultType);
  1357. result.AddOperand(operand);
  1358. AddToFunctionDefinitions(result);
  1359. return result;
  1360. }
  1361. public Instruction Transpose(Instruction resultType, Instruction matrix)
  1362. {
  1363. Instruction result = NewInstruction(Op.OpTranspose, GetNewId(), resultType);
  1364. result.AddOperand(matrix);
  1365. AddToFunctionDefinitions(result);
  1366. return result;
  1367. }
  1368. public Instruction CopyLogical(Instruction resultType, Instruction operand)
  1369. {
  1370. Instruction result = NewInstruction(Op.OpCopyLogical, GetNewId(), resultType);
  1371. result.AddOperand(operand);
  1372. AddToFunctionDefinitions(result);
  1373. return result;
  1374. }
  1375. // Arithmetic
  1376. public Instruction SNegate(Instruction resultType, Instruction operand)
  1377. {
  1378. Instruction result = NewInstruction(Op.OpSNegate, GetNewId(), resultType);
  1379. result.AddOperand(operand);
  1380. AddToFunctionDefinitions(result);
  1381. return result;
  1382. }
  1383. public Instruction FNegate(Instruction resultType, Instruction operand)
  1384. {
  1385. Instruction result = NewInstruction(Op.OpFNegate, GetNewId(), resultType);
  1386. result.AddOperand(operand);
  1387. AddToFunctionDefinitions(result);
  1388. return result;
  1389. }
  1390. public Instruction IAdd(Instruction resultType, Instruction operand1, Instruction operand2)
  1391. {
  1392. Instruction result = NewInstruction(Op.OpIAdd, GetNewId(), resultType);
  1393. result.AddOperand(operand1);
  1394. result.AddOperand(operand2);
  1395. AddToFunctionDefinitions(result);
  1396. return result;
  1397. }
  1398. public Instruction FAdd(Instruction resultType, Instruction operand1, Instruction operand2)
  1399. {
  1400. Instruction result = NewInstruction(Op.OpFAdd, GetNewId(), resultType);
  1401. result.AddOperand(operand1);
  1402. result.AddOperand(operand2);
  1403. AddToFunctionDefinitions(result);
  1404. return result;
  1405. }
  1406. public Instruction ISub(Instruction resultType, Instruction operand1, Instruction operand2)
  1407. {
  1408. Instruction result = NewInstruction(Op.OpISub, GetNewId(), resultType);
  1409. result.AddOperand(operand1);
  1410. result.AddOperand(operand2);
  1411. AddToFunctionDefinitions(result);
  1412. return result;
  1413. }
  1414. public Instruction FSub(Instruction resultType, Instruction operand1, Instruction operand2)
  1415. {
  1416. Instruction result = NewInstruction(Op.OpFSub, GetNewId(), resultType);
  1417. result.AddOperand(operand1);
  1418. result.AddOperand(operand2);
  1419. AddToFunctionDefinitions(result);
  1420. return result;
  1421. }
  1422. public Instruction IMul(Instruction resultType, Instruction operand1, Instruction operand2)
  1423. {
  1424. Instruction result = NewInstruction(Op.OpIMul, GetNewId(), resultType);
  1425. result.AddOperand(operand1);
  1426. result.AddOperand(operand2);
  1427. AddToFunctionDefinitions(result);
  1428. return result;
  1429. }
  1430. public Instruction FMul(Instruction resultType, Instruction operand1, Instruction operand2)
  1431. {
  1432. Instruction result = NewInstruction(Op.OpFMul, GetNewId(), resultType);
  1433. result.AddOperand(operand1);
  1434. result.AddOperand(operand2);
  1435. AddToFunctionDefinitions(result);
  1436. return result;
  1437. }
  1438. public Instruction UDiv(Instruction resultType, Instruction operand1, Instruction operand2)
  1439. {
  1440. Instruction result = NewInstruction(Op.OpUDiv, GetNewId(), resultType);
  1441. result.AddOperand(operand1);
  1442. result.AddOperand(operand2);
  1443. AddToFunctionDefinitions(result);
  1444. return result;
  1445. }
  1446. public Instruction SDiv(Instruction resultType, Instruction operand1, Instruction operand2)
  1447. {
  1448. Instruction result = NewInstruction(Op.OpSDiv, GetNewId(), resultType);
  1449. result.AddOperand(operand1);
  1450. result.AddOperand(operand2);
  1451. AddToFunctionDefinitions(result);
  1452. return result;
  1453. }
  1454. public Instruction FDiv(Instruction resultType, Instruction operand1, Instruction operand2)
  1455. {
  1456. Instruction result = NewInstruction(Op.OpFDiv, GetNewId(), resultType);
  1457. result.AddOperand(operand1);
  1458. result.AddOperand(operand2);
  1459. AddToFunctionDefinitions(result);
  1460. return result;
  1461. }
  1462. public Instruction UMod(Instruction resultType, Instruction operand1, Instruction operand2)
  1463. {
  1464. Instruction result = NewInstruction(Op.OpUMod, GetNewId(), resultType);
  1465. result.AddOperand(operand1);
  1466. result.AddOperand(operand2);
  1467. AddToFunctionDefinitions(result);
  1468. return result;
  1469. }
  1470. public Instruction SRem(Instruction resultType, Instruction operand1, Instruction operand2)
  1471. {
  1472. Instruction result = NewInstruction(Op.OpSRem, GetNewId(), resultType);
  1473. result.AddOperand(operand1);
  1474. result.AddOperand(operand2);
  1475. AddToFunctionDefinitions(result);
  1476. return result;
  1477. }
  1478. public Instruction SMod(Instruction resultType, Instruction operand1, Instruction operand2)
  1479. {
  1480. Instruction result = NewInstruction(Op.OpSMod, GetNewId(), resultType);
  1481. result.AddOperand(operand1);
  1482. result.AddOperand(operand2);
  1483. AddToFunctionDefinitions(result);
  1484. return result;
  1485. }
  1486. public Instruction FRem(Instruction resultType, Instruction operand1, Instruction operand2)
  1487. {
  1488. Instruction result = NewInstruction(Op.OpFRem, GetNewId(), resultType);
  1489. result.AddOperand(operand1);
  1490. result.AddOperand(operand2);
  1491. AddToFunctionDefinitions(result);
  1492. return result;
  1493. }
  1494. public Instruction FMod(Instruction resultType, Instruction operand1, Instruction operand2)
  1495. {
  1496. Instruction result = NewInstruction(Op.OpFMod, GetNewId(), resultType);
  1497. result.AddOperand(operand1);
  1498. result.AddOperand(operand2);
  1499. AddToFunctionDefinitions(result);
  1500. return result;
  1501. }
  1502. public Instruction VectorTimesScalar(Instruction resultType, Instruction vector, Instruction scalar)
  1503. {
  1504. Instruction result = NewInstruction(Op.OpVectorTimesScalar, GetNewId(), resultType);
  1505. result.AddOperand(vector);
  1506. result.AddOperand(scalar);
  1507. AddToFunctionDefinitions(result);
  1508. return result;
  1509. }
  1510. public Instruction MatrixTimesScalar(Instruction resultType, Instruction matrix, Instruction scalar)
  1511. {
  1512. Instruction result = NewInstruction(Op.OpMatrixTimesScalar, GetNewId(), resultType);
  1513. result.AddOperand(matrix);
  1514. result.AddOperand(scalar);
  1515. AddToFunctionDefinitions(result);
  1516. return result;
  1517. }
  1518. public Instruction VectorTimesMatrix(Instruction resultType, Instruction vector, Instruction matrix)
  1519. {
  1520. Instruction result = NewInstruction(Op.OpVectorTimesMatrix, GetNewId(), resultType);
  1521. result.AddOperand(vector);
  1522. result.AddOperand(matrix);
  1523. AddToFunctionDefinitions(result);
  1524. return result;
  1525. }
  1526. public Instruction MatrixTimesVector(Instruction resultType, Instruction matrix, Instruction vector)
  1527. {
  1528. Instruction result = NewInstruction(Op.OpMatrixTimesVector, GetNewId(), resultType);
  1529. result.AddOperand(matrix);
  1530. result.AddOperand(vector);
  1531. AddToFunctionDefinitions(result);
  1532. return result;
  1533. }
  1534. public Instruction MatrixTimesMatrix(Instruction resultType, Instruction leftMatrix, Instruction rightMatrix)
  1535. {
  1536. Instruction result = NewInstruction(Op.OpMatrixTimesMatrix, GetNewId(), resultType);
  1537. result.AddOperand(leftMatrix);
  1538. result.AddOperand(rightMatrix);
  1539. AddToFunctionDefinitions(result);
  1540. return result;
  1541. }
  1542. public Instruction OuterProduct(Instruction resultType, Instruction vector1, Instruction vector2)
  1543. {
  1544. Instruction result = NewInstruction(Op.OpOuterProduct, GetNewId(), resultType);
  1545. result.AddOperand(vector1);
  1546. result.AddOperand(vector2);
  1547. AddToFunctionDefinitions(result);
  1548. return result;
  1549. }
  1550. public Instruction Dot(Instruction resultType, Instruction vector1, Instruction vector2)
  1551. {
  1552. Instruction result = NewInstruction(Op.OpDot, GetNewId(), resultType);
  1553. result.AddOperand(vector1);
  1554. result.AddOperand(vector2);
  1555. AddToFunctionDefinitions(result);
  1556. return result;
  1557. }
  1558. public Instruction IAddCarry(Instruction resultType, Instruction operand1, Instruction operand2)
  1559. {
  1560. Instruction result = NewInstruction(Op.OpIAddCarry, GetNewId(), resultType);
  1561. result.AddOperand(operand1);
  1562. result.AddOperand(operand2);
  1563. AddToFunctionDefinitions(result);
  1564. return result;
  1565. }
  1566. public Instruction ISubBorrow(Instruction resultType, Instruction operand1, Instruction operand2)
  1567. {
  1568. Instruction result = NewInstruction(Op.OpISubBorrow, GetNewId(), resultType);
  1569. result.AddOperand(operand1);
  1570. result.AddOperand(operand2);
  1571. AddToFunctionDefinitions(result);
  1572. return result;
  1573. }
  1574. public Instruction UMulExtended(Instruction resultType, Instruction operand1, Instruction operand2)
  1575. {
  1576. Instruction result = NewInstruction(Op.OpUMulExtended, GetNewId(), resultType);
  1577. result.AddOperand(operand1);
  1578. result.AddOperand(operand2);
  1579. AddToFunctionDefinitions(result);
  1580. return result;
  1581. }
  1582. public Instruction SMulExtended(Instruction resultType, Instruction operand1, Instruction operand2)
  1583. {
  1584. Instruction result = NewInstruction(Op.OpSMulExtended, GetNewId(), resultType);
  1585. result.AddOperand(operand1);
  1586. result.AddOperand(operand2);
  1587. AddToFunctionDefinitions(result);
  1588. return result;
  1589. }
  1590. // Bit
  1591. public Instruction ShiftRightLogical(Instruction resultType, Instruction baseObj, Instruction shift)
  1592. {
  1593. Instruction result = NewInstruction(Op.OpShiftRightLogical, GetNewId(), resultType);
  1594. result.AddOperand(baseObj);
  1595. result.AddOperand(shift);
  1596. AddToFunctionDefinitions(result);
  1597. return result;
  1598. }
  1599. public Instruction ShiftRightArithmetic(Instruction resultType, Instruction baseObj, Instruction shift)
  1600. {
  1601. Instruction result = NewInstruction(Op.OpShiftRightArithmetic, GetNewId(), resultType);
  1602. result.AddOperand(baseObj);
  1603. result.AddOperand(shift);
  1604. AddToFunctionDefinitions(result);
  1605. return result;
  1606. }
  1607. public Instruction ShiftLeftLogical(Instruction resultType, Instruction baseObj, Instruction shift)
  1608. {
  1609. Instruction result = NewInstruction(Op.OpShiftLeftLogical, GetNewId(), resultType);
  1610. result.AddOperand(baseObj);
  1611. result.AddOperand(shift);
  1612. AddToFunctionDefinitions(result);
  1613. return result;
  1614. }
  1615. public Instruction BitwiseOr(Instruction resultType, Instruction operand1, Instruction operand2)
  1616. {
  1617. Instruction result = NewInstruction(Op.OpBitwiseOr, GetNewId(), resultType);
  1618. result.AddOperand(operand1);
  1619. result.AddOperand(operand2);
  1620. AddToFunctionDefinitions(result);
  1621. return result;
  1622. }
  1623. public Instruction BitwiseXor(Instruction resultType, Instruction operand1, Instruction operand2)
  1624. {
  1625. Instruction result = NewInstruction(Op.OpBitwiseXor, GetNewId(), resultType);
  1626. result.AddOperand(operand1);
  1627. result.AddOperand(operand2);
  1628. AddToFunctionDefinitions(result);
  1629. return result;
  1630. }
  1631. public Instruction BitwiseAnd(Instruction resultType, Instruction operand1, Instruction operand2)
  1632. {
  1633. Instruction result = NewInstruction(Op.OpBitwiseAnd, GetNewId(), resultType);
  1634. result.AddOperand(operand1);
  1635. result.AddOperand(operand2);
  1636. AddToFunctionDefinitions(result);
  1637. return result;
  1638. }
  1639. public Instruction Not(Instruction resultType, Instruction operand)
  1640. {
  1641. Instruction result = NewInstruction(Op.OpNot, GetNewId(), resultType);
  1642. result.AddOperand(operand);
  1643. AddToFunctionDefinitions(result);
  1644. return result;
  1645. }
  1646. public Instruction BitFieldInsert(Instruction resultType, Instruction baseObj, Instruction insert, Instruction offset, Instruction count)
  1647. {
  1648. Instruction result = NewInstruction(Op.OpBitFieldInsert, GetNewId(), resultType);
  1649. result.AddOperand(baseObj);
  1650. result.AddOperand(insert);
  1651. result.AddOperand(offset);
  1652. result.AddOperand(count);
  1653. AddToFunctionDefinitions(result);
  1654. return result;
  1655. }
  1656. public Instruction BitFieldSExtract(Instruction resultType, Instruction baseObj, Instruction offset, Instruction count)
  1657. {
  1658. Instruction result = NewInstruction(Op.OpBitFieldSExtract, GetNewId(), resultType);
  1659. result.AddOperand(baseObj);
  1660. result.AddOperand(offset);
  1661. result.AddOperand(count);
  1662. AddToFunctionDefinitions(result);
  1663. return result;
  1664. }
  1665. public Instruction BitFieldUExtract(Instruction resultType, Instruction baseObj, Instruction offset, Instruction count)
  1666. {
  1667. Instruction result = NewInstruction(Op.OpBitFieldUExtract, GetNewId(), resultType);
  1668. result.AddOperand(baseObj);
  1669. result.AddOperand(offset);
  1670. result.AddOperand(count);
  1671. AddToFunctionDefinitions(result);
  1672. return result;
  1673. }
  1674. public Instruction BitReverse(Instruction resultType, Instruction baseObj)
  1675. {
  1676. Instruction result = NewInstruction(Op.OpBitReverse, GetNewId(), resultType);
  1677. result.AddOperand(baseObj);
  1678. AddToFunctionDefinitions(result);
  1679. return result;
  1680. }
  1681. public Instruction BitCount(Instruction resultType, Instruction baseObj)
  1682. {
  1683. Instruction result = NewInstruction(Op.OpBitCount, GetNewId(), resultType);
  1684. result.AddOperand(baseObj);
  1685. AddToFunctionDefinitions(result);
  1686. return result;
  1687. }
  1688. // Relational_and_Logical
  1689. public Instruction Any(Instruction resultType, Instruction vector)
  1690. {
  1691. Instruction result = NewInstruction(Op.OpAny, GetNewId(), resultType);
  1692. result.AddOperand(vector);
  1693. AddToFunctionDefinitions(result);
  1694. return result;
  1695. }
  1696. public Instruction All(Instruction resultType, Instruction vector)
  1697. {
  1698. Instruction result = NewInstruction(Op.OpAll, GetNewId(), resultType);
  1699. result.AddOperand(vector);
  1700. AddToFunctionDefinitions(result);
  1701. return result;
  1702. }
  1703. public Instruction IsNan(Instruction resultType, Instruction x)
  1704. {
  1705. Instruction result = NewInstruction(Op.OpIsNan, GetNewId(), resultType);
  1706. result.AddOperand(x);
  1707. AddToFunctionDefinitions(result);
  1708. return result;
  1709. }
  1710. public Instruction IsInf(Instruction resultType, Instruction x)
  1711. {
  1712. Instruction result = NewInstruction(Op.OpIsInf, GetNewId(), resultType);
  1713. result.AddOperand(x);
  1714. AddToFunctionDefinitions(result);
  1715. return result;
  1716. }
  1717. public Instruction IsFinite(Instruction resultType, Instruction x)
  1718. {
  1719. Instruction result = NewInstruction(Op.OpIsFinite, GetNewId(), resultType);
  1720. result.AddOperand(x);
  1721. AddToFunctionDefinitions(result);
  1722. return result;
  1723. }
  1724. public Instruction IsNormal(Instruction resultType, Instruction x)
  1725. {
  1726. Instruction result = NewInstruction(Op.OpIsNormal, GetNewId(), resultType);
  1727. result.AddOperand(x);
  1728. AddToFunctionDefinitions(result);
  1729. return result;
  1730. }
  1731. public Instruction SignBitSet(Instruction resultType, Instruction x)
  1732. {
  1733. Instruction result = NewInstruction(Op.OpSignBitSet, GetNewId(), resultType);
  1734. result.AddOperand(x);
  1735. AddToFunctionDefinitions(result);
  1736. return result;
  1737. }
  1738. public Instruction LessOrGreater(Instruction resultType, Instruction x, Instruction y)
  1739. {
  1740. Instruction result = NewInstruction(Op.OpLessOrGreater, GetNewId(), resultType);
  1741. result.AddOperand(x);
  1742. result.AddOperand(y);
  1743. AddToFunctionDefinitions(result);
  1744. return result;
  1745. }
  1746. public Instruction Ordered(Instruction resultType, Instruction x, Instruction y)
  1747. {
  1748. Instruction result = NewInstruction(Op.OpOrdered, GetNewId(), resultType);
  1749. result.AddOperand(x);
  1750. result.AddOperand(y);
  1751. AddToFunctionDefinitions(result);
  1752. return result;
  1753. }
  1754. public Instruction Unordered(Instruction resultType, Instruction x, Instruction y)
  1755. {
  1756. Instruction result = NewInstruction(Op.OpUnordered, GetNewId(), resultType);
  1757. result.AddOperand(x);
  1758. result.AddOperand(y);
  1759. AddToFunctionDefinitions(result);
  1760. return result;
  1761. }
  1762. public Instruction LogicalEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1763. {
  1764. Instruction result = NewInstruction(Op.OpLogicalEqual, GetNewId(), resultType);
  1765. result.AddOperand(operand1);
  1766. result.AddOperand(operand2);
  1767. AddToFunctionDefinitions(result);
  1768. return result;
  1769. }
  1770. public Instruction LogicalNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1771. {
  1772. Instruction result = NewInstruction(Op.OpLogicalNotEqual, GetNewId(), resultType);
  1773. result.AddOperand(operand1);
  1774. result.AddOperand(operand2);
  1775. AddToFunctionDefinitions(result);
  1776. return result;
  1777. }
  1778. public Instruction LogicalOr(Instruction resultType, Instruction operand1, Instruction operand2)
  1779. {
  1780. Instruction result = NewInstruction(Op.OpLogicalOr, GetNewId(), resultType);
  1781. result.AddOperand(operand1);
  1782. result.AddOperand(operand2);
  1783. AddToFunctionDefinitions(result);
  1784. return result;
  1785. }
  1786. public Instruction LogicalAnd(Instruction resultType, Instruction operand1, Instruction operand2)
  1787. {
  1788. Instruction result = NewInstruction(Op.OpLogicalAnd, GetNewId(), resultType);
  1789. result.AddOperand(operand1);
  1790. result.AddOperand(operand2);
  1791. AddToFunctionDefinitions(result);
  1792. return result;
  1793. }
  1794. public Instruction LogicalNot(Instruction resultType, Instruction operand)
  1795. {
  1796. Instruction result = NewInstruction(Op.OpLogicalNot, GetNewId(), resultType);
  1797. result.AddOperand(operand);
  1798. AddToFunctionDefinitions(result);
  1799. return result;
  1800. }
  1801. public Instruction Select(Instruction resultType, Instruction condition, Instruction object1, Instruction object2)
  1802. {
  1803. Instruction result = NewInstruction(Op.OpSelect, GetNewId(), resultType);
  1804. result.AddOperand(condition);
  1805. result.AddOperand(object1);
  1806. result.AddOperand(object2);
  1807. AddToFunctionDefinitions(result);
  1808. return result;
  1809. }
  1810. public Instruction IEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1811. {
  1812. Instruction result = NewInstruction(Op.OpIEqual, GetNewId(), resultType);
  1813. result.AddOperand(operand1);
  1814. result.AddOperand(operand2);
  1815. AddToFunctionDefinitions(result);
  1816. return result;
  1817. }
  1818. public Instruction INotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1819. {
  1820. Instruction result = NewInstruction(Op.OpINotEqual, GetNewId(), resultType);
  1821. result.AddOperand(operand1);
  1822. result.AddOperand(operand2);
  1823. AddToFunctionDefinitions(result);
  1824. return result;
  1825. }
  1826. public Instruction UGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1827. {
  1828. Instruction result = NewInstruction(Op.OpUGreaterThan, GetNewId(), resultType);
  1829. result.AddOperand(operand1);
  1830. result.AddOperand(operand2);
  1831. AddToFunctionDefinitions(result);
  1832. return result;
  1833. }
  1834. public Instruction SGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1835. {
  1836. Instruction result = NewInstruction(Op.OpSGreaterThan, GetNewId(), resultType);
  1837. result.AddOperand(operand1);
  1838. result.AddOperand(operand2);
  1839. AddToFunctionDefinitions(result);
  1840. return result;
  1841. }
  1842. public Instruction UGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1843. {
  1844. Instruction result = NewInstruction(Op.OpUGreaterThanEqual, GetNewId(), resultType);
  1845. result.AddOperand(operand1);
  1846. result.AddOperand(operand2);
  1847. AddToFunctionDefinitions(result);
  1848. return result;
  1849. }
  1850. public Instruction SGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1851. {
  1852. Instruction result = NewInstruction(Op.OpSGreaterThanEqual, GetNewId(), resultType);
  1853. result.AddOperand(operand1);
  1854. result.AddOperand(operand2);
  1855. AddToFunctionDefinitions(result);
  1856. return result;
  1857. }
  1858. public Instruction ULessThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1859. {
  1860. Instruction result = NewInstruction(Op.OpULessThan, GetNewId(), resultType);
  1861. result.AddOperand(operand1);
  1862. result.AddOperand(operand2);
  1863. AddToFunctionDefinitions(result);
  1864. return result;
  1865. }
  1866. public Instruction SLessThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1867. {
  1868. Instruction result = NewInstruction(Op.OpSLessThan, GetNewId(), resultType);
  1869. result.AddOperand(operand1);
  1870. result.AddOperand(operand2);
  1871. AddToFunctionDefinitions(result);
  1872. return result;
  1873. }
  1874. public Instruction ULessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1875. {
  1876. Instruction result = NewInstruction(Op.OpULessThanEqual, GetNewId(), resultType);
  1877. result.AddOperand(operand1);
  1878. result.AddOperand(operand2);
  1879. AddToFunctionDefinitions(result);
  1880. return result;
  1881. }
  1882. public Instruction SLessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1883. {
  1884. Instruction result = NewInstruction(Op.OpSLessThanEqual, GetNewId(), resultType);
  1885. result.AddOperand(operand1);
  1886. result.AddOperand(operand2);
  1887. AddToFunctionDefinitions(result);
  1888. return result;
  1889. }
  1890. public Instruction FOrdEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1891. {
  1892. Instruction result = NewInstruction(Op.OpFOrdEqual, GetNewId(), resultType);
  1893. result.AddOperand(operand1);
  1894. result.AddOperand(operand2);
  1895. AddToFunctionDefinitions(result);
  1896. return result;
  1897. }
  1898. public Instruction FUnordEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1899. {
  1900. Instruction result = NewInstruction(Op.OpFUnordEqual, GetNewId(), resultType);
  1901. result.AddOperand(operand1);
  1902. result.AddOperand(operand2);
  1903. AddToFunctionDefinitions(result);
  1904. return result;
  1905. }
  1906. public Instruction FOrdNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1907. {
  1908. Instruction result = NewInstruction(Op.OpFOrdNotEqual, GetNewId(), resultType);
  1909. result.AddOperand(operand1);
  1910. result.AddOperand(operand2);
  1911. AddToFunctionDefinitions(result);
  1912. return result;
  1913. }
  1914. public Instruction FUnordNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1915. {
  1916. Instruction result = NewInstruction(Op.OpFUnordNotEqual, GetNewId(), resultType);
  1917. result.AddOperand(operand1);
  1918. result.AddOperand(operand2);
  1919. AddToFunctionDefinitions(result);
  1920. return result;
  1921. }
  1922. public Instruction FOrdLessThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1923. {
  1924. Instruction result = NewInstruction(Op.OpFOrdLessThan, GetNewId(), resultType);
  1925. result.AddOperand(operand1);
  1926. result.AddOperand(operand2);
  1927. AddToFunctionDefinitions(result);
  1928. return result;
  1929. }
  1930. public Instruction FUnordLessThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1931. {
  1932. Instruction result = NewInstruction(Op.OpFUnordLessThan, GetNewId(), resultType);
  1933. result.AddOperand(operand1);
  1934. result.AddOperand(operand2);
  1935. AddToFunctionDefinitions(result);
  1936. return result;
  1937. }
  1938. public Instruction FOrdGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1939. {
  1940. Instruction result = NewInstruction(Op.OpFOrdGreaterThan, GetNewId(), resultType);
  1941. result.AddOperand(operand1);
  1942. result.AddOperand(operand2);
  1943. AddToFunctionDefinitions(result);
  1944. return result;
  1945. }
  1946. public Instruction FUnordGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
  1947. {
  1948. Instruction result = NewInstruction(Op.OpFUnordGreaterThan, GetNewId(), resultType);
  1949. result.AddOperand(operand1);
  1950. result.AddOperand(operand2);
  1951. AddToFunctionDefinitions(result);
  1952. return result;
  1953. }
  1954. public Instruction FOrdLessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1955. {
  1956. Instruction result = NewInstruction(Op.OpFOrdLessThanEqual, GetNewId(), resultType);
  1957. result.AddOperand(operand1);
  1958. result.AddOperand(operand2);
  1959. AddToFunctionDefinitions(result);
  1960. return result;
  1961. }
  1962. public Instruction FUnordLessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1963. {
  1964. Instruction result = NewInstruction(Op.OpFUnordLessThanEqual, GetNewId(), resultType);
  1965. result.AddOperand(operand1);
  1966. result.AddOperand(operand2);
  1967. AddToFunctionDefinitions(result);
  1968. return result;
  1969. }
  1970. public Instruction FOrdGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1971. {
  1972. Instruction result = NewInstruction(Op.OpFOrdGreaterThanEqual, GetNewId(), resultType);
  1973. result.AddOperand(operand1);
  1974. result.AddOperand(operand2);
  1975. AddToFunctionDefinitions(result);
  1976. return result;
  1977. }
  1978. public Instruction FUnordGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
  1979. {
  1980. Instruction result = NewInstruction(Op.OpFUnordGreaterThanEqual, GetNewId(), resultType);
  1981. result.AddOperand(operand1);
  1982. result.AddOperand(operand2);
  1983. AddToFunctionDefinitions(result);
  1984. return result;
  1985. }
  1986. // Derivative
  1987. public Instruction DPdx(Instruction resultType, Instruction p)
  1988. {
  1989. Instruction result = NewInstruction(Op.OpDPdx, GetNewId(), resultType);
  1990. result.AddOperand(p);
  1991. AddToFunctionDefinitions(result);
  1992. return result;
  1993. }
  1994. public Instruction DPdy(Instruction resultType, Instruction p)
  1995. {
  1996. Instruction result = NewInstruction(Op.OpDPdy, GetNewId(), resultType);
  1997. result.AddOperand(p);
  1998. AddToFunctionDefinitions(result);
  1999. return result;
  2000. }
  2001. public Instruction Fwidth(Instruction resultType, Instruction p)
  2002. {
  2003. Instruction result = NewInstruction(Op.OpFwidth, GetNewId(), resultType);
  2004. result.AddOperand(p);
  2005. AddToFunctionDefinitions(result);
  2006. return result;
  2007. }
  2008. public Instruction DPdxFine(Instruction resultType, Instruction p)
  2009. {
  2010. Instruction result = NewInstruction(Op.OpDPdxFine, GetNewId(), resultType);
  2011. result.AddOperand(p);
  2012. AddToFunctionDefinitions(result);
  2013. return result;
  2014. }
  2015. public Instruction DPdyFine(Instruction resultType, Instruction p)
  2016. {
  2017. Instruction result = NewInstruction(Op.OpDPdyFine, GetNewId(), resultType);
  2018. result.AddOperand(p);
  2019. AddToFunctionDefinitions(result);
  2020. return result;
  2021. }
  2022. public Instruction FwidthFine(Instruction resultType, Instruction p)
  2023. {
  2024. Instruction result = NewInstruction(Op.OpFwidthFine, GetNewId(), resultType);
  2025. result.AddOperand(p);
  2026. AddToFunctionDefinitions(result);
  2027. return result;
  2028. }
  2029. public Instruction DPdxCoarse(Instruction resultType, Instruction p)
  2030. {
  2031. Instruction result = NewInstruction(Op.OpDPdxCoarse, GetNewId(), resultType);
  2032. result.AddOperand(p);
  2033. AddToFunctionDefinitions(result);
  2034. return result;
  2035. }
  2036. public Instruction DPdyCoarse(Instruction resultType, Instruction p)
  2037. {
  2038. Instruction result = NewInstruction(Op.OpDPdyCoarse, GetNewId(), resultType);
  2039. result.AddOperand(p);
  2040. AddToFunctionDefinitions(result);
  2041. return result;
  2042. }
  2043. public Instruction FwidthCoarse(Instruction resultType, Instruction p)
  2044. {
  2045. Instruction result = NewInstruction(Op.OpFwidthCoarse, GetNewId(), resultType);
  2046. result.AddOperand(p);
  2047. AddToFunctionDefinitions(result);
  2048. return result;
  2049. }
  2050. // Control-Flow
  2051. public Instruction Phi(Instruction resultType, params Instruction[] parameters)
  2052. {
  2053. Instruction result = NewInstruction(Op.OpPhi, GetNewId(), resultType);
  2054. result.AddOperand(parameters);
  2055. AddToFunctionDefinitions(result);
  2056. return result;
  2057. }
  2058. public Instruction LoopMerge(Instruction mergeBlock, Instruction continueTarget, LoopControlMask loopControl)
  2059. {
  2060. Instruction result = NewInstruction(Op.OpLoopMerge);
  2061. result.AddOperand(mergeBlock);
  2062. result.AddOperand(continueTarget);
  2063. result.AddOperand(loopControl);
  2064. AddToFunctionDefinitions(result);
  2065. return result;
  2066. }
  2067. public Instruction SelectionMerge(Instruction mergeBlock, SelectionControlMask selectionControl)
  2068. {
  2069. Instruction result = NewInstruction(Op.OpSelectionMerge);
  2070. result.AddOperand(mergeBlock);
  2071. result.AddOperand(selectionControl);
  2072. AddToFunctionDefinitions(result);
  2073. return result;
  2074. }
  2075. public Instruction Label()
  2076. {
  2077. Instruction result = NewInstruction(Op.OpLabel);
  2078. return result;
  2079. }
  2080. public Instruction Branch(Instruction targetLabel)
  2081. {
  2082. Instruction result = NewInstruction(Op.OpBranch);
  2083. result.AddOperand(targetLabel);
  2084. AddToFunctionDefinitions(result);
  2085. return result;
  2086. }
  2087. public Instruction BranchConditional(Instruction condition, Instruction trueLabel, Instruction falseLabel, params LiteralInteger[] branchweights)
  2088. {
  2089. Instruction result = NewInstruction(Op.OpBranchConditional);
  2090. result.AddOperand(condition);
  2091. result.AddOperand(trueLabel);
  2092. result.AddOperand(falseLabel);
  2093. result.AddOperand(branchweights);
  2094. AddToFunctionDefinitions(result);
  2095. return result;
  2096. }
  2097. public Instruction Switch(Instruction selector, Instruction defaultObj, params Operand[] target)
  2098. {
  2099. Instruction result = NewInstruction(Op.OpSwitch);
  2100. result.AddOperand(selector);
  2101. result.AddOperand(defaultObj);
  2102. result.AddOperand(target);
  2103. AddToFunctionDefinitions(result);
  2104. return result;
  2105. }
  2106. public Instruction Kill()
  2107. {
  2108. Instruction result = NewInstruction(Op.OpKill);
  2109. AddToFunctionDefinitions(result);
  2110. return result;
  2111. }
  2112. public Instruction Return()
  2113. {
  2114. Instruction result = NewInstruction(Op.OpReturn);
  2115. AddToFunctionDefinitions(result);
  2116. return result;
  2117. }
  2118. public Instruction ReturnValue(Instruction value)
  2119. {
  2120. Instruction result = NewInstruction(Op.OpReturnValue);
  2121. result.AddOperand(value);
  2122. AddToFunctionDefinitions(result);
  2123. return result;
  2124. }
  2125. public Instruction Unreachable()
  2126. {
  2127. Instruction result = NewInstruction(Op.OpUnreachable);
  2128. AddToFunctionDefinitions(result);
  2129. return result;
  2130. }
  2131. public Instruction LifetimeStart(Instruction pointer, LiteralInteger size)
  2132. {
  2133. Instruction result = NewInstruction(Op.OpLifetimeStart);
  2134. result.AddOperand(pointer);
  2135. result.AddOperand(size);
  2136. AddToFunctionDefinitions(result);
  2137. return result;
  2138. }
  2139. public Instruction LifetimeStop(Instruction pointer, LiteralInteger size)
  2140. {
  2141. Instruction result = NewInstruction(Op.OpLifetimeStop);
  2142. result.AddOperand(pointer);
  2143. result.AddOperand(size);
  2144. AddToFunctionDefinitions(result);
  2145. return result;
  2146. }
  2147. public Instruction TerminateInvocation()
  2148. {
  2149. Instruction result = NewInstruction(Op.OpTerminateInvocation);
  2150. AddToFunctionDefinitions(result);
  2151. return result;
  2152. }
  2153. // Atomic
  2154. public Instruction AtomicLoad(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
  2155. {
  2156. Instruction result = NewInstruction(Op.OpAtomicLoad, GetNewId(), resultType);
  2157. result.AddOperand(pointer);
  2158. result.AddOperand(memory);
  2159. result.AddOperand(semantics);
  2160. AddToFunctionDefinitions(result);
  2161. return result;
  2162. }
  2163. public Instruction AtomicStore(Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2164. {
  2165. Instruction result = NewInstruction(Op.OpAtomicStore);
  2166. result.AddOperand(pointer);
  2167. result.AddOperand(memory);
  2168. result.AddOperand(semantics);
  2169. result.AddOperand(value);
  2170. AddToFunctionDefinitions(result);
  2171. return result;
  2172. }
  2173. public Instruction AtomicExchange(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2174. {
  2175. Instruction result = NewInstruction(Op.OpAtomicExchange, GetNewId(), resultType);
  2176. result.AddOperand(pointer);
  2177. result.AddOperand(memory);
  2178. result.AddOperand(semantics);
  2179. result.AddOperand(value);
  2180. AddToFunctionDefinitions(result);
  2181. return result;
  2182. }
  2183. public Instruction AtomicCompareExchange(Instruction resultType, Instruction pointer, Instruction memory, Instruction equal, Instruction unequal, Instruction value, Instruction comparator)
  2184. {
  2185. Instruction result = NewInstruction(Op.OpAtomicCompareExchange, GetNewId(), resultType);
  2186. result.AddOperand(pointer);
  2187. result.AddOperand(memory);
  2188. result.AddOperand(equal);
  2189. result.AddOperand(unequal);
  2190. result.AddOperand(value);
  2191. result.AddOperand(comparator);
  2192. AddToFunctionDefinitions(result);
  2193. return result;
  2194. }
  2195. public Instruction AtomicCompareExchangeWeak(Instruction resultType, Instruction pointer, Instruction memory, Instruction equal, Instruction unequal, Instruction value, Instruction comparator)
  2196. {
  2197. Instruction result = NewInstruction(Op.OpAtomicCompareExchangeWeak, GetNewId(), resultType);
  2198. result.AddOperand(pointer);
  2199. result.AddOperand(memory);
  2200. result.AddOperand(equal);
  2201. result.AddOperand(unequal);
  2202. result.AddOperand(value);
  2203. result.AddOperand(comparator);
  2204. AddToFunctionDefinitions(result);
  2205. return result;
  2206. }
  2207. public Instruction AtomicIIncrement(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
  2208. {
  2209. Instruction result = NewInstruction(Op.OpAtomicIIncrement, GetNewId(), resultType);
  2210. result.AddOperand(pointer);
  2211. result.AddOperand(memory);
  2212. result.AddOperand(semantics);
  2213. AddToFunctionDefinitions(result);
  2214. return result;
  2215. }
  2216. public Instruction AtomicIDecrement(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
  2217. {
  2218. Instruction result = NewInstruction(Op.OpAtomicIDecrement, GetNewId(), resultType);
  2219. result.AddOperand(pointer);
  2220. result.AddOperand(memory);
  2221. result.AddOperand(semantics);
  2222. AddToFunctionDefinitions(result);
  2223. return result;
  2224. }
  2225. public Instruction AtomicIAdd(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2226. {
  2227. Instruction result = NewInstruction(Op.OpAtomicIAdd, GetNewId(), resultType);
  2228. result.AddOperand(pointer);
  2229. result.AddOperand(memory);
  2230. result.AddOperand(semantics);
  2231. result.AddOperand(value);
  2232. AddToFunctionDefinitions(result);
  2233. return result;
  2234. }
  2235. public Instruction AtomicISub(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2236. {
  2237. Instruction result = NewInstruction(Op.OpAtomicISub, GetNewId(), resultType);
  2238. result.AddOperand(pointer);
  2239. result.AddOperand(memory);
  2240. result.AddOperand(semantics);
  2241. result.AddOperand(value);
  2242. AddToFunctionDefinitions(result);
  2243. return result;
  2244. }
  2245. public Instruction AtomicSMin(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2246. {
  2247. Instruction result = NewInstruction(Op.OpAtomicSMin, GetNewId(), resultType);
  2248. result.AddOperand(pointer);
  2249. result.AddOperand(memory);
  2250. result.AddOperand(semantics);
  2251. result.AddOperand(value);
  2252. AddToFunctionDefinitions(result);
  2253. return result;
  2254. }
  2255. public Instruction AtomicUMin(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2256. {
  2257. Instruction result = NewInstruction(Op.OpAtomicUMin, GetNewId(), resultType);
  2258. result.AddOperand(pointer);
  2259. result.AddOperand(memory);
  2260. result.AddOperand(semantics);
  2261. result.AddOperand(value);
  2262. AddToFunctionDefinitions(result);
  2263. return result;
  2264. }
  2265. public Instruction AtomicSMax(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2266. {
  2267. Instruction result = NewInstruction(Op.OpAtomicSMax, GetNewId(), resultType);
  2268. result.AddOperand(pointer);
  2269. result.AddOperand(memory);
  2270. result.AddOperand(semantics);
  2271. result.AddOperand(value);
  2272. AddToFunctionDefinitions(result);
  2273. return result;
  2274. }
  2275. public Instruction AtomicUMax(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2276. {
  2277. Instruction result = NewInstruction(Op.OpAtomicUMax, GetNewId(), resultType);
  2278. result.AddOperand(pointer);
  2279. result.AddOperand(memory);
  2280. result.AddOperand(semantics);
  2281. result.AddOperand(value);
  2282. AddToFunctionDefinitions(result);
  2283. return result;
  2284. }
  2285. public Instruction AtomicAnd(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2286. {
  2287. Instruction result = NewInstruction(Op.OpAtomicAnd, GetNewId(), resultType);
  2288. result.AddOperand(pointer);
  2289. result.AddOperand(memory);
  2290. result.AddOperand(semantics);
  2291. result.AddOperand(value);
  2292. AddToFunctionDefinitions(result);
  2293. return result;
  2294. }
  2295. public Instruction AtomicOr(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2296. {
  2297. Instruction result = NewInstruction(Op.OpAtomicOr, GetNewId(), resultType);
  2298. result.AddOperand(pointer);
  2299. result.AddOperand(memory);
  2300. result.AddOperand(semantics);
  2301. result.AddOperand(value);
  2302. AddToFunctionDefinitions(result);
  2303. return result;
  2304. }
  2305. public Instruction AtomicXor(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2306. {
  2307. Instruction result = NewInstruction(Op.OpAtomicXor, GetNewId(), resultType);
  2308. result.AddOperand(pointer);
  2309. result.AddOperand(memory);
  2310. result.AddOperand(semantics);
  2311. result.AddOperand(value);
  2312. AddToFunctionDefinitions(result);
  2313. return result;
  2314. }
  2315. public Instruction AtomicFlagTestAndSet(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
  2316. {
  2317. Instruction result = NewInstruction(Op.OpAtomicFlagTestAndSet, GetNewId(), resultType);
  2318. result.AddOperand(pointer);
  2319. result.AddOperand(memory);
  2320. result.AddOperand(semantics);
  2321. AddToFunctionDefinitions(result);
  2322. return result;
  2323. }
  2324. public Instruction AtomicFlagClear(Instruction pointer, Instruction memory, Instruction semantics)
  2325. {
  2326. Instruction result = NewInstruction(Op.OpAtomicFlagClear);
  2327. result.AddOperand(pointer);
  2328. result.AddOperand(memory);
  2329. result.AddOperand(semantics);
  2330. AddToFunctionDefinitions(result);
  2331. return result;
  2332. }
  2333. public Instruction AtomicFAddEXT(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
  2334. {
  2335. Instruction result = NewInstruction(Op.OpAtomicFAddEXT, GetNewId(), resultType);
  2336. result.AddOperand(pointer);
  2337. result.AddOperand(memory);
  2338. result.AddOperand(semantics);
  2339. result.AddOperand(value);
  2340. AddToFunctionDefinitions(result);
  2341. return result;
  2342. }
  2343. // Primitive
  2344. public Instruction EmitVertex()
  2345. {
  2346. Instruction result = NewInstruction(Op.OpEmitVertex);
  2347. AddToFunctionDefinitions(result);
  2348. return result;
  2349. }
  2350. public Instruction EndPrimitive()
  2351. {
  2352. Instruction result = NewInstruction(Op.OpEndPrimitive);
  2353. AddToFunctionDefinitions(result);
  2354. return result;
  2355. }
  2356. public Instruction EmitStreamVertex(Instruction stream)
  2357. {
  2358. Instruction result = NewInstruction(Op.OpEmitStreamVertex);
  2359. result.AddOperand(stream);
  2360. AddToFunctionDefinitions(result);
  2361. return result;
  2362. }
  2363. public Instruction EndStreamPrimitive(Instruction stream)
  2364. {
  2365. Instruction result = NewInstruction(Op.OpEndStreamPrimitive);
  2366. result.AddOperand(stream);
  2367. AddToFunctionDefinitions(result);
  2368. return result;
  2369. }
  2370. // Barrier
  2371. public Instruction ControlBarrier(Instruction execution, Instruction memory, Instruction semantics)
  2372. {
  2373. Instruction result = NewInstruction(Op.OpControlBarrier);
  2374. result.AddOperand(execution);
  2375. result.AddOperand(memory);
  2376. result.AddOperand(semantics);
  2377. AddToFunctionDefinitions(result);
  2378. return result;
  2379. }
  2380. public Instruction MemoryBarrier(Instruction memory, Instruction semantics)
  2381. {
  2382. Instruction result = NewInstruction(Op.OpMemoryBarrier);
  2383. result.AddOperand(memory);
  2384. result.AddOperand(semantics);
  2385. AddToFunctionDefinitions(result);
  2386. return result;
  2387. }
  2388. public Instruction NamedBarrierInitialize(Instruction resultType, Instruction subgroupCount)
  2389. {
  2390. Instruction result = NewInstruction(Op.OpNamedBarrierInitialize, GetNewId(), resultType);
  2391. result.AddOperand(subgroupCount);
  2392. AddToFunctionDefinitions(result);
  2393. return result;
  2394. }
  2395. public Instruction MemoryNamedBarrier(Instruction namedBarrier, Instruction memory, Instruction semantics)
  2396. {
  2397. Instruction result = NewInstruction(Op.OpMemoryNamedBarrier);
  2398. result.AddOperand(namedBarrier);
  2399. result.AddOperand(memory);
  2400. result.AddOperand(semantics);
  2401. AddToFunctionDefinitions(result);
  2402. return result;
  2403. }
  2404. // Group
  2405. public Instruction GroupAsyncCopy(Instruction resultType, Instruction execution, Instruction destination, Instruction source, Instruction numElements, Instruction stride, Instruction eventObj)
  2406. {
  2407. Instruction result = NewInstruction(Op.OpGroupAsyncCopy, GetNewId(), resultType);
  2408. result.AddOperand(execution);
  2409. result.AddOperand(destination);
  2410. result.AddOperand(source);
  2411. result.AddOperand(numElements);
  2412. result.AddOperand(stride);
  2413. result.AddOperand(eventObj);
  2414. AddToFunctionDefinitions(result);
  2415. return result;
  2416. }
  2417. public Instruction GroupWaitEvents(Instruction execution, Instruction numEvents, Instruction eventsList)
  2418. {
  2419. Instruction result = NewInstruction(Op.OpGroupWaitEvents);
  2420. result.AddOperand(execution);
  2421. result.AddOperand(numEvents);
  2422. result.AddOperand(eventsList);
  2423. AddToFunctionDefinitions(result);
  2424. return result;
  2425. }
  2426. public Instruction GroupAll(Instruction resultType, Instruction execution, Instruction predicate)
  2427. {
  2428. Instruction result = NewInstruction(Op.OpGroupAll, GetNewId(), resultType);
  2429. result.AddOperand(execution);
  2430. result.AddOperand(predicate);
  2431. AddToFunctionDefinitions(result);
  2432. return result;
  2433. }
  2434. public Instruction GroupAny(Instruction resultType, Instruction execution, Instruction predicate)
  2435. {
  2436. Instruction result = NewInstruction(Op.OpGroupAny, GetNewId(), resultType);
  2437. result.AddOperand(execution);
  2438. result.AddOperand(predicate);
  2439. AddToFunctionDefinitions(result);
  2440. return result;
  2441. }
  2442. public Instruction GroupBroadcast(Instruction resultType, Instruction execution, Instruction value, Instruction localId)
  2443. {
  2444. Instruction result = NewInstruction(Op.OpGroupBroadcast, GetNewId(), resultType);
  2445. result.AddOperand(execution);
  2446. result.AddOperand(value);
  2447. result.AddOperand(localId);
  2448. AddToFunctionDefinitions(result);
  2449. return result;
  2450. }
  2451. public Instruction GroupIAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2452. {
  2453. Instruction result = NewInstruction(Op.OpGroupIAdd, GetNewId(), resultType);
  2454. result.AddOperand(execution);
  2455. result.AddOperand(operation);
  2456. result.AddOperand(x);
  2457. AddToFunctionDefinitions(result);
  2458. return result;
  2459. }
  2460. public Instruction GroupFAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2461. {
  2462. Instruction result = NewInstruction(Op.OpGroupFAdd, GetNewId(), resultType);
  2463. result.AddOperand(execution);
  2464. result.AddOperand(operation);
  2465. result.AddOperand(x);
  2466. AddToFunctionDefinitions(result);
  2467. return result;
  2468. }
  2469. public Instruction GroupFMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2470. {
  2471. Instruction result = NewInstruction(Op.OpGroupFMin, GetNewId(), resultType);
  2472. result.AddOperand(execution);
  2473. result.AddOperand(operation);
  2474. result.AddOperand(x);
  2475. AddToFunctionDefinitions(result);
  2476. return result;
  2477. }
  2478. public Instruction GroupUMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2479. {
  2480. Instruction result = NewInstruction(Op.OpGroupUMin, GetNewId(), resultType);
  2481. result.AddOperand(execution);
  2482. result.AddOperand(operation);
  2483. result.AddOperand(x);
  2484. AddToFunctionDefinitions(result);
  2485. return result;
  2486. }
  2487. public Instruction GroupSMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2488. {
  2489. Instruction result = NewInstruction(Op.OpGroupSMin, GetNewId(), resultType);
  2490. result.AddOperand(execution);
  2491. result.AddOperand(operation);
  2492. result.AddOperand(x);
  2493. AddToFunctionDefinitions(result);
  2494. return result;
  2495. }
  2496. public Instruction GroupFMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2497. {
  2498. Instruction result = NewInstruction(Op.OpGroupFMax, GetNewId(), resultType);
  2499. result.AddOperand(execution);
  2500. result.AddOperand(operation);
  2501. result.AddOperand(x);
  2502. AddToFunctionDefinitions(result);
  2503. return result;
  2504. }
  2505. public Instruction GroupUMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2506. {
  2507. Instruction result = NewInstruction(Op.OpGroupUMax, GetNewId(), resultType);
  2508. result.AddOperand(execution);
  2509. result.AddOperand(operation);
  2510. result.AddOperand(x);
  2511. AddToFunctionDefinitions(result);
  2512. return result;
  2513. }
  2514. public Instruction GroupSMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2515. {
  2516. Instruction result = NewInstruction(Op.OpGroupSMax, GetNewId(), resultType);
  2517. result.AddOperand(execution);
  2518. result.AddOperand(operation);
  2519. result.AddOperand(x);
  2520. AddToFunctionDefinitions(result);
  2521. return result;
  2522. }
  2523. public Instruction SubgroupBallotKHR(Instruction resultType, Instruction predicate)
  2524. {
  2525. Instruction result = NewInstruction(Op.OpSubgroupBallotKHR, GetNewId(), resultType);
  2526. result.AddOperand(predicate);
  2527. AddToFunctionDefinitions(result);
  2528. return result;
  2529. }
  2530. public Instruction SubgroupFirstInvocationKHR(Instruction resultType, Instruction value)
  2531. {
  2532. Instruction result = NewInstruction(Op.OpSubgroupFirstInvocationKHR, GetNewId(), resultType);
  2533. result.AddOperand(value);
  2534. AddToFunctionDefinitions(result);
  2535. return result;
  2536. }
  2537. public Instruction SubgroupAllKHR(Instruction resultType, Instruction predicate)
  2538. {
  2539. Instruction result = NewInstruction(Op.OpSubgroupAllKHR, GetNewId(), resultType);
  2540. result.AddOperand(predicate);
  2541. AddToFunctionDefinitions(result);
  2542. return result;
  2543. }
  2544. public Instruction SubgroupAnyKHR(Instruction resultType, Instruction predicate)
  2545. {
  2546. Instruction result = NewInstruction(Op.OpSubgroupAnyKHR, GetNewId(), resultType);
  2547. result.AddOperand(predicate);
  2548. AddToFunctionDefinitions(result);
  2549. return result;
  2550. }
  2551. public Instruction SubgroupAllEqualKHR(Instruction resultType, Instruction predicate)
  2552. {
  2553. Instruction result = NewInstruction(Op.OpSubgroupAllEqualKHR, GetNewId(), resultType);
  2554. result.AddOperand(predicate);
  2555. AddToFunctionDefinitions(result);
  2556. return result;
  2557. }
  2558. public Instruction SubgroupReadInvocationKHR(Instruction resultType, Instruction value, Instruction index)
  2559. {
  2560. Instruction result = NewInstruction(Op.OpSubgroupReadInvocationKHR, GetNewId(), resultType);
  2561. result.AddOperand(value);
  2562. result.AddOperand(index);
  2563. AddToFunctionDefinitions(result);
  2564. return result;
  2565. }
  2566. public Instruction GroupIAddNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2567. {
  2568. Instruction result = NewInstruction(Op.OpGroupIAddNonUniformAMD, GetNewId(), resultType);
  2569. result.AddOperand(execution);
  2570. result.AddOperand(operation);
  2571. result.AddOperand(x);
  2572. AddToFunctionDefinitions(result);
  2573. return result;
  2574. }
  2575. public Instruction GroupFAddNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2576. {
  2577. Instruction result = NewInstruction(Op.OpGroupFAddNonUniformAMD, GetNewId(), resultType);
  2578. result.AddOperand(execution);
  2579. result.AddOperand(operation);
  2580. result.AddOperand(x);
  2581. AddToFunctionDefinitions(result);
  2582. return result;
  2583. }
  2584. public Instruction GroupFMinNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2585. {
  2586. Instruction result = NewInstruction(Op.OpGroupFMinNonUniformAMD, GetNewId(), resultType);
  2587. result.AddOperand(execution);
  2588. result.AddOperand(operation);
  2589. result.AddOperand(x);
  2590. AddToFunctionDefinitions(result);
  2591. return result;
  2592. }
  2593. public Instruction GroupUMinNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2594. {
  2595. Instruction result = NewInstruction(Op.OpGroupUMinNonUniformAMD, GetNewId(), resultType);
  2596. result.AddOperand(execution);
  2597. result.AddOperand(operation);
  2598. result.AddOperand(x);
  2599. AddToFunctionDefinitions(result);
  2600. return result;
  2601. }
  2602. public Instruction GroupSMinNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2603. {
  2604. Instruction result = NewInstruction(Op.OpGroupSMinNonUniformAMD, GetNewId(), resultType);
  2605. result.AddOperand(execution);
  2606. result.AddOperand(operation);
  2607. result.AddOperand(x);
  2608. AddToFunctionDefinitions(result);
  2609. return result;
  2610. }
  2611. public Instruction GroupFMaxNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2612. {
  2613. Instruction result = NewInstruction(Op.OpGroupFMaxNonUniformAMD, GetNewId(), resultType);
  2614. result.AddOperand(execution);
  2615. result.AddOperand(operation);
  2616. result.AddOperand(x);
  2617. AddToFunctionDefinitions(result);
  2618. return result;
  2619. }
  2620. public Instruction GroupUMaxNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2621. {
  2622. Instruction result = NewInstruction(Op.OpGroupUMaxNonUniformAMD, GetNewId(), resultType);
  2623. result.AddOperand(execution);
  2624. result.AddOperand(operation);
  2625. result.AddOperand(x);
  2626. AddToFunctionDefinitions(result);
  2627. return result;
  2628. }
  2629. public Instruction GroupSMaxNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
  2630. {
  2631. Instruction result = NewInstruction(Op.OpGroupSMaxNonUniformAMD, GetNewId(), resultType);
  2632. result.AddOperand(execution);
  2633. result.AddOperand(operation);
  2634. result.AddOperand(x);
  2635. AddToFunctionDefinitions(result);
  2636. return result;
  2637. }
  2638. public Instruction SubgroupShuffleINTEL(Instruction resultType, Instruction data, Instruction invocationId)
  2639. {
  2640. Instruction result = NewInstruction(Op.OpSubgroupShuffleINTEL, GetNewId(), resultType);
  2641. result.AddOperand(data);
  2642. result.AddOperand(invocationId);
  2643. AddToFunctionDefinitions(result);
  2644. return result;
  2645. }
  2646. public Instruction SubgroupShuffleDownINTEL(Instruction resultType, Instruction current, Instruction next, Instruction delta)
  2647. {
  2648. Instruction result = NewInstruction(Op.OpSubgroupShuffleDownINTEL, GetNewId(), resultType);
  2649. result.AddOperand(current);
  2650. result.AddOperand(next);
  2651. result.AddOperand(delta);
  2652. AddToFunctionDefinitions(result);
  2653. return result;
  2654. }
  2655. public Instruction SubgroupShuffleUpINTEL(Instruction resultType, Instruction previous, Instruction current, Instruction delta)
  2656. {
  2657. Instruction result = NewInstruction(Op.OpSubgroupShuffleUpINTEL, GetNewId(), resultType);
  2658. result.AddOperand(previous);
  2659. result.AddOperand(current);
  2660. result.AddOperand(delta);
  2661. AddToFunctionDefinitions(result);
  2662. return result;
  2663. }
  2664. public Instruction SubgroupShuffleXorINTEL(Instruction resultType, Instruction data, Instruction value)
  2665. {
  2666. Instruction result = NewInstruction(Op.OpSubgroupShuffleXorINTEL, GetNewId(), resultType);
  2667. result.AddOperand(data);
  2668. result.AddOperand(value);
  2669. AddToFunctionDefinitions(result);
  2670. return result;
  2671. }
  2672. public Instruction SubgroupBlockReadINTEL(Instruction resultType, Instruction ptr)
  2673. {
  2674. Instruction result = NewInstruction(Op.OpSubgroupBlockReadINTEL, GetNewId(), resultType);
  2675. result.AddOperand(ptr);
  2676. AddToFunctionDefinitions(result);
  2677. return result;
  2678. }
  2679. public Instruction SubgroupBlockWriteINTEL(Instruction ptr, Instruction data)
  2680. {
  2681. Instruction result = NewInstruction(Op.OpSubgroupBlockWriteINTEL);
  2682. result.AddOperand(ptr);
  2683. result.AddOperand(data);
  2684. AddToFunctionDefinitions(result);
  2685. return result;
  2686. }
  2687. public Instruction SubgroupImageBlockReadINTEL(Instruction resultType, Instruction image, Instruction coordinate)
  2688. {
  2689. Instruction result = NewInstruction(Op.OpSubgroupImageBlockReadINTEL, GetNewId(), resultType);
  2690. result.AddOperand(image);
  2691. result.AddOperand(coordinate);
  2692. AddToFunctionDefinitions(result);
  2693. return result;
  2694. }
  2695. public Instruction SubgroupImageBlockWriteINTEL(Instruction image, Instruction coordinate, Instruction data)
  2696. {
  2697. Instruction result = NewInstruction(Op.OpSubgroupImageBlockWriteINTEL);
  2698. result.AddOperand(image);
  2699. result.AddOperand(coordinate);
  2700. result.AddOperand(data);
  2701. AddToFunctionDefinitions(result);
  2702. return result;
  2703. }
  2704. public Instruction SubgroupImageMediaBlockReadINTEL(Instruction resultType, Instruction image, Instruction coordinate, Instruction width, Instruction height)
  2705. {
  2706. Instruction result = NewInstruction(Op.OpSubgroupImageMediaBlockReadINTEL, GetNewId(), resultType);
  2707. result.AddOperand(image);
  2708. result.AddOperand(coordinate);
  2709. result.AddOperand(width);
  2710. result.AddOperand(height);
  2711. AddToFunctionDefinitions(result);
  2712. return result;
  2713. }
  2714. public Instruction SubgroupImageMediaBlockWriteINTEL(Instruction image, Instruction coordinate, Instruction width, Instruction height, Instruction data)
  2715. {
  2716. Instruction result = NewInstruction(Op.OpSubgroupImageMediaBlockWriteINTEL);
  2717. result.AddOperand(image);
  2718. result.AddOperand(coordinate);
  2719. result.AddOperand(width);
  2720. result.AddOperand(height);
  2721. result.AddOperand(data);
  2722. AddToFunctionDefinitions(result);
  2723. return result;
  2724. }
  2725. // Device-Side_Enqueue
  2726. public Instruction EnqueueMarker(Instruction resultType, Instruction queue, Instruction numEvents, Instruction waitEvents, Instruction retEvent)
  2727. {
  2728. Instruction result = NewInstruction(Op.OpEnqueueMarker, GetNewId(), resultType);
  2729. result.AddOperand(queue);
  2730. result.AddOperand(numEvents);
  2731. result.AddOperand(waitEvents);
  2732. result.AddOperand(retEvent);
  2733. AddToFunctionDefinitions(result);
  2734. return result;
  2735. }
  2736. public Instruction EnqueueKernel(Instruction resultType, Instruction queue, Instruction flags, Instruction nDRange, Instruction numEvents, Instruction waitEvents, Instruction retEvent, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign, params Instruction[] localSize)
  2737. {
  2738. Instruction result = NewInstruction(Op.OpEnqueueKernel, GetNewId(), resultType);
  2739. result.AddOperand(queue);
  2740. result.AddOperand(flags);
  2741. result.AddOperand(nDRange);
  2742. result.AddOperand(numEvents);
  2743. result.AddOperand(waitEvents);
  2744. result.AddOperand(retEvent);
  2745. result.AddOperand(invoke);
  2746. result.AddOperand(param);
  2747. result.AddOperand(paramSize);
  2748. result.AddOperand(paramAlign);
  2749. result.AddOperand(localSize);
  2750. AddToFunctionDefinitions(result);
  2751. return result;
  2752. }
  2753. public Instruction GetKernelNDrangeSubGroupCount(Instruction resultType, Instruction nDRange, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
  2754. {
  2755. Instruction result = NewInstruction(Op.OpGetKernelNDrangeSubGroupCount, GetNewId(), resultType);
  2756. result.AddOperand(nDRange);
  2757. result.AddOperand(invoke);
  2758. result.AddOperand(param);
  2759. result.AddOperand(paramSize);
  2760. result.AddOperand(paramAlign);
  2761. AddToFunctionDefinitions(result);
  2762. return result;
  2763. }
  2764. public Instruction GetKernelNDrangeMaxSubGroupSize(Instruction resultType, Instruction nDRange, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
  2765. {
  2766. Instruction result = NewInstruction(Op.OpGetKernelNDrangeMaxSubGroupSize, GetNewId(), resultType);
  2767. result.AddOperand(nDRange);
  2768. result.AddOperand(invoke);
  2769. result.AddOperand(param);
  2770. result.AddOperand(paramSize);
  2771. result.AddOperand(paramAlign);
  2772. AddToFunctionDefinitions(result);
  2773. return result;
  2774. }
  2775. public Instruction GetKernelWorkGroupSize(Instruction resultType, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
  2776. {
  2777. Instruction result = NewInstruction(Op.OpGetKernelWorkGroupSize, GetNewId(), resultType);
  2778. result.AddOperand(invoke);
  2779. result.AddOperand(param);
  2780. result.AddOperand(paramSize);
  2781. result.AddOperand(paramAlign);
  2782. AddToFunctionDefinitions(result);
  2783. return result;
  2784. }
  2785. public Instruction GetKernelPreferredWorkGroupSizeMultiple(Instruction resultType, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
  2786. {
  2787. Instruction result = NewInstruction(Op.OpGetKernelPreferredWorkGroupSizeMultiple, GetNewId(), resultType);
  2788. result.AddOperand(invoke);
  2789. result.AddOperand(param);
  2790. result.AddOperand(paramSize);
  2791. result.AddOperand(paramAlign);
  2792. AddToFunctionDefinitions(result);
  2793. return result;
  2794. }
  2795. public Instruction RetainEvent(Instruction eventObj)
  2796. {
  2797. Instruction result = NewInstruction(Op.OpRetainEvent);
  2798. result.AddOperand(eventObj);
  2799. AddToFunctionDefinitions(result);
  2800. return result;
  2801. }
  2802. public Instruction ReleaseEvent(Instruction eventObj)
  2803. {
  2804. Instruction result = NewInstruction(Op.OpReleaseEvent);
  2805. result.AddOperand(eventObj);
  2806. AddToFunctionDefinitions(result);
  2807. return result;
  2808. }
  2809. public Instruction CreateUserEvent(Instruction resultType)
  2810. {
  2811. Instruction result = NewInstruction(Op.OpCreateUserEvent, GetNewId(), resultType);
  2812. AddToFunctionDefinitions(result);
  2813. return result;
  2814. }
  2815. public Instruction IsValidEvent(Instruction resultType, Instruction eventObj)
  2816. {
  2817. Instruction result = NewInstruction(Op.OpIsValidEvent, GetNewId(), resultType);
  2818. result.AddOperand(eventObj);
  2819. AddToFunctionDefinitions(result);
  2820. return result;
  2821. }
  2822. public Instruction SetUserEventStatus(Instruction eventObj, Instruction status)
  2823. {
  2824. Instruction result = NewInstruction(Op.OpSetUserEventStatus);
  2825. result.AddOperand(eventObj);
  2826. result.AddOperand(status);
  2827. AddToFunctionDefinitions(result);
  2828. return result;
  2829. }
  2830. public Instruction CaptureEventProfilingInfo(Instruction eventObj, Instruction profilingInfo, Instruction value)
  2831. {
  2832. Instruction result = NewInstruction(Op.OpCaptureEventProfilingInfo);
  2833. result.AddOperand(eventObj);
  2834. result.AddOperand(profilingInfo);
  2835. result.AddOperand(value);
  2836. AddToFunctionDefinitions(result);
  2837. return result;
  2838. }
  2839. public Instruction GetDefaultQueue(Instruction resultType)
  2840. {
  2841. Instruction result = NewInstruction(Op.OpGetDefaultQueue, GetNewId(), resultType);
  2842. AddToFunctionDefinitions(result);
  2843. return result;
  2844. }
  2845. public Instruction BuildNDRange(Instruction resultType, Instruction globalWorkSize, Instruction localWorkSize, Instruction globalWorkOffset)
  2846. {
  2847. Instruction result = NewInstruction(Op.OpBuildNDRange, GetNewId(), resultType);
  2848. result.AddOperand(globalWorkSize);
  2849. result.AddOperand(localWorkSize);
  2850. result.AddOperand(globalWorkOffset);
  2851. AddToFunctionDefinitions(result);
  2852. return result;
  2853. }
  2854. public Instruction GetKernelLocalSizeForSubgroupCount(Instruction resultType, Instruction subgroupCount, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
  2855. {
  2856. Instruction result = NewInstruction(Op.OpGetKernelLocalSizeForSubgroupCount, GetNewId(), resultType);
  2857. result.AddOperand(subgroupCount);
  2858. result.AddOperand(invoke);
  2859. result.AddOperand(param);
  2860. result.AddOperand(paramSize);
  2861. result.AddOperand(paramAlign);
  2862. AddToFunctionDefinitions(result);
  2863. return result;
  2864. }
  2865. public Instruction GetKernelMaxNumSubgroups(Instruction resultType, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
  2866. {
  2867. Instruction result = NewInstruction(Op.OpGetKernelMaxNumSubgroups, GetNewId(), resultType);
  2868. result.AddOperand(invoke);
  2869. result.AddOperand(param);
  2870. result.AddOperand(paramSize);
  2871. result.AddOperand(paramAlign);
  2872. AddToFunctionDefinitions(result);
  2873. return result;
  2874. }
  2875. // Pipe
  2876. public Instruction ReadPipe(Instruction resultType, Instruction pipe, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
  2877. {
  2878. Instruction result = NewInstruction(Op.OpReadPipe, GetNewId(), resultType);
  2879. result.AddOperand(pipe);
  2880. result.AddOperand(pointer);
  2881. result.AddOperand(packetSize);
  2882. result.AddOperand(packetAlignment);
  2883. AddToFunctionDefinitions(result);
  2884. return result;
  2885. }
  2886. public Instruction WritePipe(Instruction resultType, Instruction pipe, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
  2887. {
  2888. Instruction result = NewInstruction(Op.OpWritePipe, GetNewId(), resultType);
  2889. result.AddOperand(pipe);
  2890. result.AddOperand(pointer);
  2891. result.AddOperand(packetSize);
  2892. result.AddOperand(packetAlignment);
  2893. AddToFunctionDefinitions(result);
  2894. return result;
  2895. }
  2896. public Instruction ReservedReadPipe(Instruction resultType, Instruction pipe, Instruction reserveId, Instruction index, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
  2897. {
  2898. Instruction result = NewInstruction(Op.OpReservedReadPipe, GetNewId(), resultType);
  2899. result.AddOperand(pipe);
  2900. result.AddOperand(reserveId);
  2901. result.AddOperand(index);
  2902. result.AddOperand(pointer);
  2903. result.AddOperand(packetSize);
  2904. result.AddOperand(packetAlignment);
  2905. AddToFunctionDefinitions(result);
  2906. return result;
  2907. }
  2908. public Instruction ReservedWritePipe(Instruction resultType, Instruction pipe, Instruction reserveId, Instruction index, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
  2909. {
  2910. Instruction result = NewInstruction(Op.OpReservedWritePipe, GetNewId(), resultType);
  2911. result.AddOperand(pipe);
  2912. result.AddOperand(reserveId);
  2913. result.AddOperand(index);
  2914. result.AddOperand(pointer);
  2915. result.AddOperand(packetSize);
  2916. result.AddOperand(packetAlignment);
  2917. AddToFunctionDefinitions(result);
  2918. return result;
  2919. }
  2920. public Instruction ReserveReadPipePackets(Instruction resultType, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
  2921. {
  2922. Instruction result = NewInstruction(Op.OpReserveReadPipePackets, GetNewId(), resultType);
  2923. result.AddOperand(pipe);
  2924. result.AddOperand(numPackets);
  2925. result.AddOperand(packetSize);
  2926. result.AddOperand(packetAlignment);
  2927. AddToFunctionDefinitions(result);
  2928. return result;
  2929. }
  2930. public Instruction ReserveWritePipePackets(Instruction resultType, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
  2931. {
  2932. Instruction result = NewInstruction(Op.OpReserveWritePipePackets, GetNewId(), resultType);
  2933. result.AddOperand(pipe);
  2934. result.AddOperand(numPackets);
  2935. result.AddOperand(packetSize);
  2936. result.AddOperand(packetAlignment);
  2937. AddToFunctionDefinitions(result);
  2938. return result;
  2939. }
  2940. public Instruction CommitReadPipe(Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
  2941. {
  2942. Instruction result = NewInstruction(Op.OpCommitReadPipe);
  2943. result.AddOperand(pipe);
  2944. result.AddOperand(reserveId);
  2945. result.AddOperand(packetSize);
  2946. result.AddOperand(packetAlignment);
  2947. AddToFunctionDefinitions(result);
  2948. return result;
  2949. }
  2950. public Instruction CommitWritePipe(Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
  2951. {
  2952. Instruction result = NewInstruction(Op.OpCommitWritePipe);
  2953. result.AddOperand(pipe);
  2954. result.AddOperand(reserveId);
  2955. result.AddOperand(packetSize);
  2956. result.AddOperand(packetAlignment);
  2957. AddToFunctionDefinitions(result);
  2958. return result;
  2959. }
  2960. public Instruction IsValidReserveId(Instruction resultType, Instruction reserveId)
  2961. {
  2962. Instruction result = NewInstruction(Op.OpIsValidReserveId, GetNewId(), resultType);
  2963. result.AddOperand(reserveId);
  2964. AddToFunctionDefinitions(result);
  2965. return result;
  2966. }
  2967. public Instruction GetNumPipePackets(Instruction resultType, Instruction pipe, Instruction packetSize, Instruction packetAlignment)
  2968. {
  2969. Instruction result = NewInstruction(Op.OpGetNumPipePackets, GetNewId(), resultType);
  2970. result.AddOperand(pipe);
  2971. result.AddOperand(packetSize);
  2972. result.AddOperand(packetAlignment);
  2973. AddToFunctionDefinitions(result);
  2974. return result;
  2975. }
  2976. public Instruction GetMaxPipePackets(Instruction resultType, Instruction pipe, Instruction packetSize, Instruction packetAlignment)
  2977. {
  2978. Instruction result = NewInstruction(Op.OpGetMaxPipePackets, GetNewId(), resultType);
  2979. result.AddOperand(pipe);
  2980. result.AddOperand(packetSize);
  2981. result.AddOperand(packetAlignment);
  2982. AddToFunctionDefinitions(result);
  2983. return result;
  2984. }
  2985. public Instruction GroupReserveReadPipePackets(Instruction resultType, Instruction execution, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
  2986. {
  2987. Instruction result = NewInstruction(Op.OpGroupReserveReadPipePackets, GetNewId(), resultType);
  2988. result.AddOperand(execution);
  2989. result.AddOperand(pipe);
  2990. result.AddOperand(numPackets);
  2991. result.AddOperand(packetSize);
  2992. result.AddOperand(packetAlignment);
  2993. AddToFunctionDefinitions(result);
  2994. return result;
  2995. }
  2996. public Instruction GroupReserveWritePipePackets(Instruction resultType, Instruction execution, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
  2997. {
  2998. Instruction result = NewInstruction(Op.OpGroupReserveWritePipePackets, GetNewId(), resultType);
  2999. result.AddOperand(execution);
  3000. result.AddOperand(pipe);
  3001. result.AddOperand(numPackets);
  3002. result.AddOperand(packetSize);
  3003. result.AddOperand(packetAlignment);
  3004. AddToFunctionDefinitions(result);
  3005. return result;
  3006. }
  3007. public Instruction GroupCommitReadPipe(Instruction execution, Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
  3008. {
  3009. Instruction result = NewInstruction(Op.OpGroupCommitReadPipe);
  3010. result.AddOperand(execution);
  3011. result.AddOperand(pipe);
  3012. result.AddOperand(reserveId);
  3013. result.AddOperand(packetSize);
  3014. result.AddOperand(packetAlignment);
  3015. AddToFunctionDefinitions(result);
  3016. return result;
  3017. }
  3018. public Instruction GroupCommitWritePipe(Instruction execution, Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
  3019. {
  3020. Instruction result = NewInstruction(Op.OpGroupCommitWritePipe);
  3021. result.AddOperand(execution);
  3022. result.AddOperand(pipe);
  3023. result.AddOperand(reserveId);
  3024. result.AddOperand(packetSize);
  3025. result.AddOperand(packetAlignment);
  3026. AddToFunctionDefinitions(result);
  3027. return result;
  3028. }
  3029. public Instruction ConstantPipeStorage(Instruction resultType, LiteralInteger packetSize, LiteralInteger packetAlignment, LiteralInteger capacity)
  3030. {
  3031. Instruction result = NewInstruction(Op.OpConstantPipeStorage, GetNewId(), resultType);
  3032. result.AddOperand(packetSize);
  3033. result.AddOperand(packetAlignment);
  3034. result.AddOperand(capacity);
  3035. AddToFunctionDefinitions(result);
  3036. return result;
  3037. }
  3038. public Instruction CreatePipeFromPipeStorage(Instruction resultType, Instruction pipeStorage)
  3039. {
  3040. Instruction result = NewInstruction(Op.OpCreatePipeFromPipeStorage, GetNewId(), resultType);
  3041. result.AddOperand(pipeStorage);
  3042. AddToFunctionDefinitions(result);
  3043. return result;
  3044. }
  3045. public Instruction ReadPipeBlockingINTEL(Instruction resultType, Instruction packetSize, Instruction packetAlignment)
  3046. {
  3047. Instruction result = NewInstruction(Op.OpReadPipeBlockingINTEL, GetNewId(), resultType);
  3048. result.AddOperand(packetSize);
  3049. result.AddOperand(packetAlignment);
  3050. AddToFunctionDefinitions(result);
  3051. return result;
  3052. }
  3053. public Instruction WritePipeBlockingINTEL(Instruction resultType, Instruction packetSize, Instruction packetAlignment)
  3054. {
  3055. Instruction result = NewInstruction(Op.OpWritePipeBlockingINTEL, GetNewId(), resultType);
  3056. result.AddOperand(packetSize);
  3057. result.AddOperand(packetAlignment);
  3058. AddToFunctionDefinitions(result);
  3059. return result;
  3060. }
  3061. // Non-Uniform
  3062. public Instruction GroupNonUniformElect(Instruction resultType, Instruction execution)
  3063. {
  3064. Instruction result = NewInstruction(Op.OpGroupNonUniformElect, GetNewId(), resultType);
  3065. result.AddOperand(execution);
  3066. AddToFunctionDefinitions(result);
  3067. return result;
  3068. }
  3069. public Instruction GroupNonUniformAll(Instruction resultType, Instruction execution, Instruction predicate)
  3070. {
  3071. Instruction result = NewInstruction(Op.OpGroupNonUniformAll, GetNewId(), resultType);
  3072. result.AddOperand(execution);
  3073. result.AddOperand(predicate);
  3074. AddToFunctionDefinitions(result);
  3075. return result;
  3076. }
  3077. public Instruction GroupNonUniformAny(Instruction resultType, Instruction execution, Instruction predicate)
  3078. {
  3079. Instruction result = NewInstruction(Op.OpGroupNonUniformAny, GetNewId(), resultType);
  3080. result.AddOperand(execution);
  3081. result.AddOperand(predicate);
  3082. AddToFunctionDefinitions(result);
  3083. return result;
  3084. }
  3085. public Instruction GroupNonUniformAllEqual(Instruction resultType, Instruction execution, Instruction value)
  3086. {
  3087. Instruction result = NewInstruction(Op.OpGroupNonUniformAllEqual, GetNewId(), resultType);
  3088. result.AddOperand(execution);
  3089. result.AddOperand(value);
  3090. AddToFunctionDefinitions(result);
  3091. return result;
  3092. }
  3093. public Instruction GroupNonUniformBroadcast(Instruction resultType, Instruction execution, Instruction value, Instruction id)
  3094. {
  3095. Instruction result = NewInstruction(Op.OpGroupNonUniformBroadcast, GetNewId(), resultType);
  3096. result.AddOperand(execution);
  3097. result.AddOperand(value);
  3098. result.AddOperand(id);
  3099. AddToFunctionDefinitions(result);
  3100. return result;
  3101. }
  3102. public Instruction GroupNonUniformBroadcastFirst(Instruction resultType, Instruction execution, Instruction value)
  3103. {
  3104. Instruction result = NewInstruction(Op.OpGroupNonUniformBroadcastFirst, GetNewId(), resultType);
  3105. result.AddOperand(execution);
  3106. result.AddOperand(value);
  3107. AddToFunctionDefinitions(result);
  3108. return result;
  3109. }
  3110. public Instruction GroupNonUniformBallot(Instruction resultType, Instruction execution, Instruction predicate)
  3111. {
  3112. Instruction result = NewInstruction(Op.OpGroupNonUniformBallot, GetNewId(), resultType);
  3113. result.AddOperand(execution);
  3114. result.AddOperand(predicate);
  3115. AddToFunctionDefinitions(result);
  3116. return result;
  3117. }
  3118. public Instruction GroupNonUniformInverseBallot(Instruction resultType, Instruction execution, Instruction value)
  3119. {
  3120. Instruction result = NewInstruction(Op.OpGroupNonUniformInverseBallot, GetNewId(), resultType);
  3121. result.AddOperand(execution);
  3122. result.AddOperand(value);
  3123. AddToFunctionDefinitions(result);
  3124. return result;
  3125. }
  3126. public Instruction GroupNonUniformBallotBitExtract(Instruction resultType, Instruction execution, Instruction value, Instruction index)
  3127. {
  3128. Instruction result = NewInstruction(Op.OpGroupNonUniformBallotBitExtract, GetNewId(), resultType);
  3129. result.AddOperand(execution);
  3130. result.AddOperand(value);
  3131. result.AddOperand(index);
  3132. AddToFunctionDefinitions(result);
  3133. return result;
  3134. }
  3135. public Instruction GroupNonUniformBallotBitCount(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value)
  3136. {
  3137. Instruction result = NewInstruction(Op.OpGroupNonUniformBallotBitCount, GetNewId(), resultType);
  3138. result.AddOperand(execution);
  3139. result.AddOperand(operation);
  3140. result.AddOperand(value);
  3141. AddToFunctionDefinitions(result);
  3142. return result;
  3143. }
  3144. public Instruction GroupNonUniformBallotFindLSB(Instruction resultType, Instruction execution, Instruction value)
  3145. {
  3146. Instruction result = NewInstruction(Op.OpGroupNonUniformBallotFindLSB, GetNewId(), resultType);
  3147. result.AddOperand(execution);
  3148. result.AddOperand(value);
  3149. AddToFunctionDefinitions(result);
  3150. return result;
  3151. }
  3152. public Instruction GroupNonUniformBallotFindMSB(Instruction resultType, Instruction execution, Instruction value)
  3153. {
  3154. Instruction result = NewInstruction(Op.OpGroupNonUniformBallotFindMSB, GetNewId(), resultType);
  3155. result.AddOperand(execution);
  3156. result.AddOperand(value);
  3157. AddToFunctionDefinitions(result);
  3158. return result;
  3159. }
  3160. public Instruction GroupNonUniformShuffle(Instruction resultType, Instruction execution, Instruction value, Instruction id)
  3161. {
  3162. Instruction result = NewInstruction(Op.OpGroupNonUniformShuffle, GetNewId(), resultType);
  3163. result.AddOperand(execution);
  3164. result.AddOperand(value);
  3165. result.AddOperand(id);
  3166. AddToFunctionDefinitions(result);
  3167. return result;
  3168. }
  3169. public Instruction GroupNonUniformShuffleXor(Instruction resultType, Instruction execution, Instruction value, Instruction mask)
  3170. {
  3171. Instruction result = NewInstruction(Op.OpGroupNonUniformShuffleXor, GetNewId(), resultType);
  3172. result.AddOperand(execution);
  3173. result.AddOperand(value);
  3174. result.AddOperand(mask);
  3175. AddToFunctionDefinitions(result);
  3176. return result;
  3177. }
  3178. public Instruction GroupNonUniformShuffleUp(Instruction resultType, Instruction execution, Instruction value, Instruction delta)
  3179. {
  3180. Instruction result = NewInstruction(Op.OpGroupNonUniformShuffleUp, GetNewId(), resultType);
  3181. result.AddOperand(execution);
  3182. result.AddOperand(value);
  3183. result.AddOperand(delta);
  3184. AddToFunctionDefinitions(result);
  3185. return result;
  3186. }
  3187. public Instruction GroupNonUniformShuffleDown(Instruction resultType, Instruction execution, Instruction value, Instruction delta)
  3188. {
  3189. Instruction result = NewInstruction(Op.OpGroupNonUniformShuffleDown, GetNewId(), resultType);
  3190. result.AddOperand(execution);
  3191. result.AddOperand(value);
  3192. result.AddOperand(delta);
  3193. AddToFunctionDefinitions(result);
  3194. return result;
  3195. }
  3196. public Instruction GroupNonUniformIAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3197. {
  3198. Instruction result = NewInstruction(Op.OpGroupNonUniformIAdd, GetNewId(), resultType);
  3199. result.AddOperand(execution);
  3200. result.AddOperand(operation);
  3201. result.AddOperand(value);
  3202. if (clusterSize != null)
  3203. {
  3204. result.AddOperand(clusterSize);
  3205. }
  3206. AddToFunctionDefinitions(result);
  3207. return result;
  3208. }
  3209. public Instruction GroupNonUniformFAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3210. {
  3211. Instruction result = NewInstruction(Op.OpGroupNonUniformFAdd, GetNewId(), resultType);
  3212. result.AddOperand(execution);
  3213. result.AddOperand(operation);
  3214. result.AddOperand(value);
  3215. if (clusterSize != null)
  3216. {
  3217. result.AddOperand(clusterSize);
  3218. }
  3219. AddToFunctionDefinitions(result);
  3220. return result;
  3221. }
  3222. public Instruction GroupNonUniformIMul(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3223. {
  3224. Instruction result = NewInstruction(Op.OpGroupNonUniformIMul, GetNewId(), resultType);
  3225. result.AddOperand(execution);
  3226. result.AddOperand(operation);
  3227. result.AddOperand(value);
  3228. if (clusterSize != null)
  3229. {
  3230. result.AddOperand(clusterSize);
  3231. }
  3232. AddToFunctionDefinitions(result);
  3233. return result;
  3234. }
  3235. public Instruction GroupNonUniformFMul(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3236. {
  3237. Instruction result = NewInstruction(Op.OpGroupNonUniformFMul, GetNewId(), resultType);
  3238. result.AddOperand(execution);
  3239. result.AddOperand(operation);
  3240. result.AddOperand(value);
  3241. if (clusterSize != null)
  3242. {
  3243. result.AddOperand(clusterSize);
  3244. }
  3245. AddToFunctionDefinitions(result);
  3246. return result;
  3247. }
  3248. public Instruction GroupNonUniformSMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3249. {
  3250. Instruction result = NewInstruction(Op.OpGroupNonUniformSMin, GetNewId(), resultType);
  3251. result.AddOperand(execution);
  3252. result.AddOperand(operation);
  3253. result.AddOperand(value);
  3254. if (clusterSize != null)
  3255. {
  3256. result.AddOperand(clusterSize);
  3257. }
  3258. AddToFunctionDefinitions(result);
  3259. return result;
  3260. }
  3261. public Instruction GroupNonUniformUMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3262. {
  3263. Instruction result = NewInstruction(Op.OpGroupNonUniformUMin, GetNewId(), resultType);
  3264. result.AddOperand(execution);
  3265. result.AddOperand(operation);
  3266. result.AddOperand(value);
  3267. if (clusterSize != null)
  3268. {
  3269. result.AddOperand(clusterSize);
  3270. }
  3271. AddToFunctionDefinitions(result);
  3272. return result;
  3273. }
  3274. public Instruction GroupNonUniformFMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3275. {
  3276. Instruction result = NewInstruction(Op.OpGroupNonUniformFMin, GetNewId(), resultType);
  3277. result.AddOperand(execution);
  3278. result.AddOperand(operation);
  3279. result.AddOperand(value);
  3280. if (clusterSize != null)
  3281. {
  3282. result.AddOperand(clusterSize);
  3283. }
  3284. AddToFunctionDefinitions(result);
  3285. return result;
  3286. }
  3287. public Instruction GroupNonUniformSMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3288. {
  3289. Instruction result = NewInstruction(Op.OpGroupNonUniformSMax, GetNewId(), resultType);
  3290. result.AddOperand(execution);
  3291. result.AddOperand(operation);
  3292. result.AddOperand(value);
  3293. if (clusterSize != null)
  3294. {
  3295. result.AddOperand(clusterSize);
  3296. }
  3297. AddToFunctionDefinitions(result);
  3298. return result;
  3299. }
  3300. public Instruction GroupNonUniformUMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3301. {
  3302. Instruction result = NewInstruction(Op.OpGroupNonUniformUMax, GetNewId(), resultType);
  3303. result.AddOperand(execution);
  3304. result.AddOperand(operation);
  3305. result.AddOperand(value);
  3306. if (clusterSize != null)
  3307. {
  3308. result.AddOperand(clusterSize);
  3309. }
  3310. AddToFunctionDefinitions(result);
  3311. return result;
  3312. }
  3313. public Instruction GroupNonUniformFMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3314. {
  3315. Instruction result = NewInstruction(Op.OpGroupNonUniformFMax, GetNewId(), resultType);
  3316. result.AddOperand(execution);
  3317. result.AddOperand(operation);
  3318. result.AddOperand(value);
  3319. if (clusterSize != null)
  3320. {
  3321. result.AddOperand(clusterSize);
  3322. }
  3323. AddToFunctionDefinitions(result);
  3324. return result;
  3325. }
  3326. public Instruction GroupNonUniformBitwiseAnd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3327. {
  3328. Instruction result = NewInstruction(Op.OpGroupNonUniformBitwiseAnd, GetNewId(), resultType);
  3329. result.AddOperand(execution);
  3330. result.AddOperand(operation);
  3331. result.AddOperand(value);
  3332. if (clusterSize != null)
  3333. {
  3334. result.AddOperand(clusterSize);
  3335. }
  3336. AddToFunctionDefinitions(result);
  3337. return result;
  3338. }
  3339. public Instruction GroupNonUniformBitwiseOr(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3340. {
  3341. Instruction result = NewInstruction(Op.OpGroupNonUniformBitwiseOr, GetNewId(), resultType);
  3342. result.AddOperand(execution);
  3343. result.AddOperand(operation);
  3344. result.AddOperand(value);
  3345. if (clusterSize != null)
  3346. {
  3347. result.AddOperand(clusterSize);
  3348. }
  3349. AddToFunctionDefinitions(result);
  3350. return result;
  3351. }
  3352. public Instruction GroupNonUniformBitwiseXor(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3353. {
  3354. Instruction result = NewInstruction(Op.OpGroupNonUniformBitwiseXor, GetNewId(), resultType);
  3355. result.AddOperand(execution);
  3356. result.AddOperand(operation);
  3357. result.AddOperand(value);
  3358. if (clusterSize != null)
  3359. {
  3360. result.AddOperand(clusterSize);
  3361. }
  3362. AddToFunctionDefinitions(result);
  3363. return result;
  3364. }
  3365. public Instruction GroupNonUniformLogicalAnd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3366. {
  3367. Instruction result = NewInstruction(Op.OpGroupNonUniformLogicalAnd, GetNewId(), resultType);
  3368. result.AddOperand(execution);
  3369. result.AddOperand(operation);
  3370. result.AddOperand(value);
  3371. if (clusterSize != null)
  3372. {
  3373. result.AddOperand(clusterSize);
  3374. }
  3375. AddToFunctionDefinitions(result);
  3376. return result;
  3377. }
  3378. public Instruction GroupNonUniformLogicalOr(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3379. {
  3380. Instruction result = NewInstruction(Op.OpGroupNonUniformLogicalOr, GetNewId(), resultType);
  3381. result.AddOperand(execution);
  3382. result.AddOperand(operation);
  3383. result.AddOperand(value);
  3384. if (clusterSize != null)
  3385. {
  3386. result.AddOperand(clusterSize);
  3387. }
  3388. AddToFunctionDefinitions(result);
  3389. return result;
  3390. }
  3391. public Instruction GroupNonUniformLogicalXor(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
  3392. {
  3393. Instruction result = NewInstruction(Op.OpGroupNonUniformLogicalXor, GetNewId(), resultType);
  3394. result.AddOperand(execution);
  3395. result.AddOperand(operation);
  3396. result.AddOperand(value);
  3397. if (clusterSize != null)
  3398. {
  3399. result.AddOperand(clusterSize);
  3400. }
  3401. AddToFunctionDefinitions(result);
  3402. return result;
  3403. }
  3404. public Instruction GroupNonUniformQuadBroadcast(Instruction resultType, Instruction execution, Instruction value, Instruction index)
  3405. {
  3406. Instruction result = NewInstruction(Op.OpGroupNonUniformQuadBroadcast, GetNewId(), resultType);
  3407. result.AddOperand(execution);
  3408. result.AddOperand(value);
  3409. result.AddOperand(index);
  3410. AddToFunctionDefinitions(result);
  3411. return result;
  3412. }
  3413. public Instruction GroupNonUniformQuadSwap(Instruction resultType, Instruction execution, Instruction value, Instruction direction)
  3414. {
  3415. Instruction result = NewInstruction(Op.OpGroupNonUniformQuadSwap, GetNewId(), resultType);
  3416. result.AddOperand(execution);
  3417. result.AddOperand(value);
  3418. result.AddOperand(direction);
  3419. AddToFunctionDefinitions(result);
  3420. return result;
  3421. }
  3422. public Instruction GroupNonUniformPartitionNV(Instruction resultType, Instruction value)
  3423. {
  3424. Instruction result = NewInstruction(Op.OpGroupNonUniformPartitionNV, GetNewId(), resultType);
  3425. result.AddOperand(value);
  3426. AddToFunctionDefinitions(result);
  3427. return result;
  3428. }
  3429. // Reserved
  3430. public Instruction TraceRayKHR(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payload)
  3431. {
  3432. Instruction result = NewInstruction(Op.OpTraceRayKHR);
  3433. result.AddOperand(accel);
  3434. result.AddOperand(rayFlags);
  3435. result.AddOperand(cullMask);
  3436. result.AddOperand(sBTOffset);
  3437. result.AddOperand(sBTStride);
  3438. result.AddOperand(missIndex);
  3439. result.AddOperand(rayOrigin);
  3440. result.AddOperand(rayTmin);
  3441. result.AddOperand(rayDirection);
  3442. result.AddOperand(rayTmax);
  3443. result.AddOperand(payload);
  3444. AddToFunctionDefinitions(result);
  3445. return result;
  3446. }
  3447. public Instruction ExecuteCallableKHR(Instruction sBTIndex, Instruction callableData)
  3448. {
  3449. Instruction result = NewInstruction(Op.OpExecuteCallableKHR);
  3450. result.AddOperand(sBTIndex);
  3451. result.AddOperand(callableData);
  3452. AddToFunctionDefinitions(result);
  3453. return result;
  3454. }
  3455. public Instruction ConvertUToAccelerationStructureKHR(Instruction resultType, Instruction accel)
  3456. {
  3457. Instruction result = NewInstruction(Op.OpConvertUToAccelerationStructureKHR, GetNewId(), resultType);
  3458. result.AddOperand(accel);
  3459. AddToFunctionDefinitions(result);
  3460. return result;
  3461. }
  3462. public Instruction IgnoreIntersectionKHR()
  3463. {
  3464. Instruction result = NewInstruction(Op.OpIgnoreIntersectionKHR);
  3465. AddToFunctionDefinitions(result);
  3466. return result;
  3467. }
  3468. public Instruction TerminateRayKHR()
  3469. {
  3470. Instruction result = NewInstruction(Op.OpTerminateRayKHR);
  3471. AddToFunctionDefinitions(result);
  3472. return result;
  3473. }
  3474. public Instruction TypeRayQueryKHR()
  3475. {
  3476. Instruction result = NewInstruction(Op.OpTypeRayQueryKHR, GetNewId());
  3477. AddToFunctionDefinitions(result);
  3478. return result;
  3479. }
  3480. public Instruction RayQueryInitializeKHR(Instruction rayQuery, Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction rayOrigin, Instruction rayTMin, Instruction rayDirection, Instruction rayTMax)
  3481. {
  3482. Instruction result = NewInstruction(Op.OpRayQueryInitializeKHR);
  3483. result.AddOperand(rayQuery);
  3484. result.AddOperand(accel);
  3485. result.AddOperand(rayFlags);
  3486. result.AddOperand(cullMask);
  3487. result.AddOperand(rayOrigin);
  3488. result.AddOperand(rayTMin);
  3489. result.AddOperand(rayDirection);
  3490. result.AddOperand(rayTMax);
  3491. AddToFunctionDefinitions(result);
  3492. return result;
  3493. }
  3494. public Instruction RayQueryTerminateKHR(Instruction rayQuery)
  3495. {
  3496. Instruction result = NewInstruction(Op.OpRayQueryTerminateKHR);
  3497. result.AddOperand(rayQuery);
  3498. AddToFunctionDefinitions(result);
  3499. return result;
  3500. }
  3501. public Instruction RayQueryGenerateIntersectionKHR(Instruction rayQuery, Instruction hitT)
  3502. {
  3503. Instruction result = NewInstruction(Op.OpRayQueryGenerateIntersectionKHR);
  3504. result.AddOperand(rayQuery);
  3505. result.AddOperand(hitT);
  3506. AddToFunctionDefinitions(result);
  3507. return result;
  3508. }
  3509. public Instruction RayQueryConfirmIntersectionKHR(Instruction rayQuery)
  3510. {
  3511. Instruction result = NewInstruction(Op.OpRayQueryConfirmIntersectionKHR);
  3512. result.AddOperand(rayQuery);
  3513. AddToFunctionDefinitions(result);
  3514. return result;
  3515. }
  3516. public Instruction RayQueryProceedKHR(Instruction resultType, Instruction rayQuery)
  3517. {
  3518. Instruction result = NewInstruction(Op.OpRayQueryProceedKHR, GetNewId(), resultType);
  3519. result.AddOperand(rayQuery);
  3520. AddToFunctionDefinitions(result);
  3521. return result;
  3522. }
  3523. public Instruction RayQueryGetIntersectionTypeKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3524. {
  3525. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionTypeKHR, GetNewId(), resultType);
  3526. result.AddOperand(rayQuery);
  3527. result.AddOperand(intersection);
  3528. AddToFunctionDefinitions(result);
  3529. return result;
  3530. }
  3531. public Instruction FragmentMaskFetchAMD(Instruction resultType, Instruction image, Instruction coordinate)
  3532. {
  3533. Instruction result = NewInstruction(Op.OpFragmentMaskFetchAMD, GetNewId(), resultType);
  3534. result.AddOperand(image);
  3535. result.AddOperand(coordinate);
  3536. AddToFunctionDefinitions(result);
  3537. return result;
  3538. }
  3539. public Instruction FragmentFetchAMD(Instruction resultType, Instruction image, Instruction coordinate, Instruction fragmentIndex)
  3540. {
  3541. Instruction result = NewInstruction(Op.OpFragmentFetchAMD, GetNewId(), resultType);
  3542. result.AddOperand(image);
  3543. result.AddOperand(coordinate);
  3544. result.AddOperand(fragmentIndex);
  3545. AddToFunctionDefinitions(result);
  3546. return result;
  3547. }
  3548. public Instruction ReadClockKHR(Instruction resultType, Instruction execution)
  3549. {
  3550. Instruction result = NewInstruction(Op.OpReadClockKHR, GetNewId(), resultType);
  3551. result.AddOperand(execution);
  3552. AddToFunctionDefinitions(result);
  3553. return result;
  3554. }
  3555. public Instruction WritePackedPrimitiveIndices4x8NV(Instruction indexOffset, Instruction packedIndices)
  3556. {
  3557. Instruction result = NewInstruction(Op.OpWritePackedPrimitiveIndices4x8NV);
  3558. result.AddOperand(indexOffset);
  3559. result.AddOperand(packedIndices);
  3560. AddToFunctionDefinitions(result);
  3561. return result;
  3562. }
  3563. public Instruction ReportIntersectionNV(Instruction resultType, Instruction hit, Instruction hitKind)
  3564. {
  3565. Instruction result = NewInstruction(Op.OpReportIntersectionNV, GetNewId(), resultType);
  3566. result.AddOperand(hit);
  3567. result.AddOperand(hitKind);
  3568. AddToFunctionDefinitions(result);
  3569. return result;
  3570. }
  3571. public Instruction ReportIntersectionKHR(Instruction resultType, Instruction hit, Instruction hitKind)
  3572. {
  3573. Instruction result = NewInstruction(Op.OpReportIntersectionKHR, GetNewId(), resultType);
  3574. result.AddOperand(hit);
  3575. result.AddOperand(hitKind);
  3576. AddToFunctionDefinitions(result);
  3577. return result;
  3578. }
  3579. public Instruction IgnoreIntersectionNV()
  3580. {
  3581. Instruction result = NewInstruction(Op.OpIgnoreIntersectionNV);
  3582. AddToFunctionDefinitions(result);
  3583. return result;
  3584. }
  3585. public Instruction TerminateRayNV()
  3586. {
  3587. Instruction result = NewInstruction(Op.OpTerminateRayNV);
  3588. AddToFunctionDefinitions(result);
  3589. return result;
  3590. }
  3591. public Instruction TraceNV(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payloadId)
  3592. {
  3593. Instruction result = NewInstruction(Op.OpTraceNV);
  3594. result.AddOperand(accel);
  3595. result.AddOperand(rayFlags);
  3596. result.AddOperand(cullMask);
  3597. result.AddOperand(sBTOffset);
  3598. result.AddOperand(sBTStride);
  3599. result.AddOperand(missIndex);
  3600. result.AddOperand(rayOrigin);
  3601. result.AddOperand(rayTmin);
  3602. result.AddOperand(rayDirection);
  3603. result.AddOperand(rayTmax);
  3604. result.AddOperand(payloadId);
  3605. AddToFunctionDefinitions(result);
  3606. return result;
  3607. }
  3608. public Instruction TypeAccelerationStructureNV()
  3609. {
  3610. Instruction result = NewInstruction(Op.OpTypeAccelerationStructureNV, GetNewId());
  3611. AddToFunctionDefinitions(result);
  3612. return result;
  3613. }
  3614. public Instruction TypeAccelerationStructureKHR()
  3615. {
  3616. Instruction result = NewInstruction(Op.OpTypeAccelerationStructureKHR, GetNewId());
  3617. AddToFunctionDefinitions(result);
  3618. return result;
  3619. }
  3620. public Instruction ExecuteCallableNV(Instruction sBTIndex, Instruction callableDataId)
  3621. {
  3622. Instruction result = NewInstruction(Op.OpExecuteCallableNV);
  3623. result.AddOperand(sBTIndex);
  3624. result.AddOperand(callableDataId);
  3625. AddToFunctionDefinitions(result);
  3626. return result;
  3627. }
  3628. public Instruction TypeCooperativeMatrixNV(Instruction componentType, Instruction execution, Instruction rows, Instruction columns)
  3629. {
  3630. Instruction result = NewInstruction(Op.OpTypeCooperativeMatrixNV, GetNewId());
  3631. result.AddOperand(componentType);
  3632. result.AddOperand(execution);
  3633. result.AddOperand(rows);
  3634. result.AddOperand(columns);
  3635. AddToFunctionDefinitions(result);
  3636. return result;
  3637. }
  3638. public Instruction CooperativeMatrixLoadNV(Instruction resultType, Instruction pointer, Instruction stride, Instruction columnMajor, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
  3639. {
  3640. Instruction result = NewInstruction(Op.OpCooperativeMatrixLoadNV, GetNewId(), resultType);
  3641. result.AddOperand(pointer);
  3642. result.AddOperand(stride);
  3643. result.AddOperand(columnMajor);
  3644. if (memoryAccess != (MemoryAccessMask)int.MaxValue)
  3645. {
  3646. result.AddOperand(memoryAccess);
  3647. }
  3648. AddToFunctionDefinitions(result);
  3649. return result;
  3650. }
  3651. public Instruction CooperativeMatrixStoreNV(Instruction pointer, Instruction obj, Instruction stride, Instruction columnMajor, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
  3652. {
  3653. Instruction result = NewInstruction(Op.OpCooperativeMatrixStoreNV);
  3654. result.AddOperand(pointer);
  3655. result.AddOperand(obj);
  3656. result.AddOperand(stride);
  3657. result.AddOperand(columnMajor);
  3658. if (memoryAccess != (MemoryAccessMask)int.MaxValue)
  3659. {
  3660. result.AddOperand(memoryAccess);
  3661. }
  3662. AddToFunctionDefinitions(result);
  3663. return result;
  3664. }
  3665. public Instruction CooperativeMatrixMulAddNV(Instruction resultType, Instruction a, Instruction b, Instruction c)
  3666. {
  3667. Instruction result = NewInstruction(Op.OpCooperativeMatrixMulAddNV, GetNewId(), resultType);
  3668. result.AddOperand(a);
  3669. result.AddOperand(b);
  3670. result.AddOperand(c);
  3671. AddToFunctionDefinitions(result);
  3672. return result;
  3673. }
  3674. public Instruction CooperativeMatrixLengthNV(Instruction resultType, Instruction type)
  3675. {
  3676. Instruction result = NewInstruction(Op.OpCooperativeMatrixLengthNV, GetNewId(), resultType);
  3677. result.AddOperand(type);
  3678. AddToFunctionDefinitions(result);
  3679. return result;
  3680. }
  3681. public Instruction BeginInvocationInterlockEXT()
  3682. {
  3683. Instruction result = NewInstruction(Op.OpBeginInvocationInterlockEXT);
  3684. AddToFunctionDefinitions(result);
  3685. return result;
  3686. }
  3687. public Instruction EndInvocationInterlockEXT()
  3688. {
  3689. Instruction result = NewInstruction(Op.OpEndInvocationInterlockEXT);
  3690. AddToFunctionDefinitions(result);
  3691. return result;
  3692. }
  3693. public Instruction DemoteToHelperInvocationEXT()
  3694. {
  3695. Instruction result = NewInstruction(Op.OpDemoteToHelperInvocationEXT);
  3696. AddToFunctionDefinitions(result);
  3697. return result;
  3698. }
  3699. public Instruction IsHelperInvocationEXT(Instruction resultType)
  3700. {
  3701. Instruction result = NewInstruction(Op.OpIsHelperInvocationEXT, GetNewId(), resultType);
  3702. AddToFunctionDefinitions(result);
  3703. return result;
  3704. }
  3705. public Instruction UCountLeadingZerosINTEL(Instruction resultType, Instruction operand)
  3706. {
  3707. Instruction result = NewInstruction(Op.OpUCountLeadingZerosINTEL, GetNewId(), resultType);
  3708. result.AddOperand(operand);
  3709. AddToFunctionDefinitions(result);
  3710. return result;
  3711. }
  3712. public Instruction UCountTrailingZerosINTEL(Instruction resultType, Instruction operand)
  3713. {
  3714. Instruction result = NewInstruction(Op.OpUCountTrailingZerosINTEL, GetNewId(), resultType);
  3715. result.AddOperand(operand);
  3716. AddToFunctionDefinitions(result);
  3717. return result;
  3718. }
  3719. public Instruction AbsISubINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3720. {
  3721. Instruction result = NewInstruction(Op.OpAbsISubINTEL, GetNewId(), resultType);
  3722. result.AddOperand(operand1);
  3723. result.AddOperand(operand2);
  3724. AddToFunctionDefinitions(result);
  3725. return result;
  3726. }
  3727. public Instruction AbsUSubINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3728. {
  3729. Instruction result = NewInstruction(Op.OpAbsUSubINTEL, GetNewId(), resultType);
  3730. result.AddOperand(operand1);
  3731. result.AddOperand(operand2);
  3732. AddToFunctionDefinitions(result);
  3733. return result;
  3734. }
  3735. public Instruction IAddSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3736. {
  3737. Instruction result = NewInstruction(Op.OpIAddSatINTEL, GetNewId(), resultType);
  3738. result.AddOperand(operand1);
  3739. result.AddOperand(operand2);
  3740. AddToFunctionDefinitions(result);
  3741. return result;
  3742. }
  3743. public Instruction UAddSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3744. {
  3745. Instruction result = NewInstruction(Op.OpUAddSatINTEL, GetNewId(), resultType);
  3746. result.AddOperand(operand1);
  3747. result.AddOperand(operand2);
  3748. AddToFunctionDefinitions(result);
  3749. return result;
  3750. }
  3751. public Instruction IAverageINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3752. {
  3753. Instruction result = NewInstruction(Op.OpIAverageINTEL, GetNewId(), resultType);
  3754. result.AddOperand(operand1);
  3755. result.AddOperand(operand2);
  3756. AddToFunctionDefinitions(result);
  3757. return result;
  3758. }
  3759. public Instruction UAverageINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3760. {
  3761. Instruction result = NewInstruction(Op.OpUAverageINTEL, GetNewId(), resultType);
  3762. result.AddOperand(operand1);
  3763. result.AddOperand(operand2);
  3764. AddToFunctionDefinitions(result);
  3765. return result;
  3766. }
  3767. public Instruction IAverageRoundedINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3768. {
  3769. Instruction result = NewInstruction(Op.OpIAverageRoundedINTEL, GetNewId(), resultType);
  3770. result.AddOperand(operand1);
  3771. result.AddOperand(operand2);
  3772. AddToFunctionDefinitions(result);
  3773. return result;
  3774. }
  3775. public Instruction UAverageRoundedINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3776. {
  3777. Instruction result = NewInstruction(Op.OpUAverageRoundedINTEL, GetNewId(), resultType);
  3778. result.AddOperand(operand1);
  3779. result.AddOperand(operand2);
  3780. AddToFunctionDefinitions(result);
  3781. return result;
  3782. }
  3783. public Instruction ISubSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3784. {
  3785. Instruction result = NewInstruction(Op.OpISubSatINTEL, GetNewId(), resultType);
  3786. result.AddOperand(operand1);
  3787. result.AddOperand(operand2);
  3788. AddToFunctionDefinitions(result);
  3789. return result;
  3790. }
  3791. public Instruction USubSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3792. {
  3793. Instruction result = NewInstruction(Op.OpUSubSatINTEL, GetNewId(), resultType);
  3794. result.AddOperand(operand1);
  3795. result.AddOperand(operand2);
  3796. AddToFunctionDefinitions(result);
  3797. return result;
  3798. }
  3799. public Instruction IMul32x16INTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3800. {
  3801. Instruction result = NewInstruction(Op.OpIMul32x16INTEL, GetNewId(), resultType);
  3802. result.AddOperand(operand1);
  3803. result.AddOperand(operand2);
  3804. AddToFunctionDefinitions(result);
  3805. return result;
  3806. }
  3807. public Instruction UMul32x16INTEL(Instruction resultType, Instruction operand1, Instruction operand2)
  3808. {
  3809. Instruction result = NewInstruction(Op.OpUMul32x16INTEL, GetNewId(), resultType);
  3810. result.AddOperand(operand1);
  3811. result.AddOperand(operand2);
  3812. AddToFunctionDefinitions(result);
  3813. return result;
  3814. }
  3815. public Instruction LoopControlINTEL(params LiteralInteger[] loopControlParameters)
  3816. {
  3817. Instruction result = NewInstruction(Op.OpLoopControlINTEL);
  3818. result.AddOperand(loopControlParameters);
  3819. AddToFunctionDefinitions(result);
  3820. return result;
  3821. }
  3822. public Instruction FPGARegINTEL(Instruction resultType, Instruction resultObj, Instruction input)
  3823. {
  3824. Instruction result = NewInstruction(Op.OpFPGARegINTEL, GetNewId(), resultType);
  3825. result.AddOperand(resultObj);
  3826. result.AddOperand(input);
  3827. AddToFunctionDefinitions(result);
  3828. return result;
  3829. }
  3830. public Instruction RayQueryGetRayTMinKHR(Instruction resultType, Instruction rayQuery)
  3831. {
  3832. Instruction result = NewInstruction(Op.OpRayQueryGetRayTMinKHR, GetNewId(), resultType);
  3833. result.AddOperand(rayQuery);
  3834. AddToFunctionDefinitions(result);
  3835. return result;
  3836. }
  3837. public Instruction RayQueryGetRayFlagsKHR(Instruction resultType, Instruction rayQuery)
  3838. {
  3839. Instruction result = NewInstruction(Op.OpRayQueryGetRayFlagsKHR, GetNewId(), resultType);
  3840. result.AddOperand(rayQuery);
  3841. AddToFunctionDefinitions(result);
  3842. return result;
  3843. }
  3844. public Instruction RayQueryGetIntersectionTKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3845. {
  3846. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionTKHR, GetNewId(), resultType);
  3847. result.AddOperand(rayQuery);
  3848. result.AddOperand(intersection);
  3849. AddToFunctionDefinitions(result);
  3850. return result;
  3851. }
  3852. public Instruction RayQueryGetIntersectionInstanceCustomIndexKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3853. {
  3854. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionInstanceCustomIndexKHR, GetNewId(), resultType);
  3855. result.AddOperand(rayQuery);
  3856. result.AddOperand(intersection);
  3857. AddToFunctionDefinitions(result);
  3858. return result;
  3859. }
  3860. public Instruction RayQueryGetIntersectionInstanceIdKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3861. {
  3862. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionInstanceIdKHR, GetNewId(), resultType);
  3863. result.AddOperand(rayQuery);
  3864. result.AddOperand(intersection);
  3865. AddToFunctionDefinitions(result);
  3866. return result;
  3867. }
  3868. public Instruction RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3869. {
  3870. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR, GetNewId(), resultType);
  3871. result.AddOperand(rayQuery);
  3872. result.AddOperand(intersection);
  3873. AddToFunctionDefinitions(result);
  3874. return result;
  3875. }
  3876. public Instruction RayQueryGetIntersectionGeometryIndexKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3877. {
  3878. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionGeometryIndexKHR, GetNewId(), resultType);
  3879. result.AddOperand(rayQuery);
  3880. result.AddOperand(intersection);
  3881. AddToFunctionDefinitions(result);
  3882. return result;
  3883. }
  3884. public Instruction RayQueryGetIntersectionPrimitiveIndexKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3885. {
  3886. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionPrimitiveIndexKHR, GetNewId(), resultType);
  3887. result.AddOperand(rayQuery);
  3888. result.AddOperand(intersection);
  3889. AddToFunctionDefinitions(result);
  3890. return result;
  3891. }
  3892. public Instruction RayQueryGetIntersectionBarycentricsKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3893. {
  3894. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionBarycentricsKHR, GetNewId(), resultType);
  3895. result.AddOperand(rayQuery);
  3896. result.AddOperand(intersection);
  3897. AddToFunctionDefinitions(result);
  3898. return result;
  3899. }
  3900. public Instruction RayQueryGetIntersectionFrontFaceKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3901. {
  3902. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionFrontFaceKHR, GetNewId(), resultType);
  3903. result.AddOperand(rayQuery);
  3904. result.AddOperand(intersection);
  3905. AddToFunctionDefinitions(result);
  3906. return result;
  3907. }
  3908. public Instruction RayQueryGetIntersectionCandidateAABBOpaqueKHR(Instruction resultType, Instruction rayQuery)
  3909. {
  3910. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionCandidateAABBOpaqueKHR, GetNewId(), resultType);
  3911. result.AddOperand(rayQuery);
  3912. AddToFunctionDefinitions(result);
  3913. return result;
  3914. }
  3915. public Instruction RayQueryGetIntersectionObjectRayDirectionKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3916. {
  3917. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionObjectRayDirectionKHR, GetNewId(), resultType);
  3918. result.AddOperand(rayQuery);
  3919. result.AddOperand(intersection);
  3920. AddToFunctionDefinitions(result);
  3921. return result;
  3922. }
  3923. public Instruction RayQueryGetIntersectionObjectRayOriginKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3924. {
  3925. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionObjectRayOriginKHR, GetNewId(), resultType);
  3926. result.AddOperand(rayQuery);
  3927. result.AddOperand(intersection);
  3928. AddToFunctionDefinitions(result);
  3929. return result;
  3930. }
  3931. public Instruction RayQueryGetWorldRayDirectionKHR(Instruction resultType, Instruction rayQuery)
  3932. {
  3933. Instruction result = NewInstruction(Op.OpRayQueryGetWorldRayDirectionKHR, GetNewId(), resultType);
  3934. result.AddOperand(rayQuery);
  3935. AddToFunctionDefinitions(result);
  3936. return result;
  3937. }
  3938. public Instruction RayQueryGetWorldRayOriginKHR(Instruction resultType, Instruction rayQuery)
  3939. {
  3940. Instruction result = NewInstruction(Op.OpRayQueryGetWorldRayOriginKHR, GetNewId(), resultType);
  3941. result.AddOperand(rayQuery);
  3942. AddToFunctionDefinitions(result);
  3943. return result;
  3944. }
  3945. public Instruction RayQueryGetIntersectionObjectToWorldKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3946. {
  3947. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionObjectToWorldKHR, GetNewId(), resultType);
  3948. result.AddOperand(rayQuery);
  3949. result.AddOperand(intersection);
  3950. AddToFunctionDefinitions(result);
  3951. return result;
  3952. }
  3953. public Instruction RayQueryGetIntersectionWorldToObjectKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
  3954. {
  3955. Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionWorldToObjectKHR, GetNewId(), resultType);
  3956. result.AddOperand(rayQuery);
  3957. result.AddOperand(intersection);
  3958. AddToFunctionDefinitions(result);
  3959. return result;
  3960. }
  3961. }
  3962. }