CompilerTest.cpp 205 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // CompilerTest.cpp //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Provides tests for the compiler API. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #ifndef UNICODE
  12. #define UNICODE
  13. #endif
  14. #include <memory>
  15. #include <vector>
  16. #include <string>
  17. #include <map>
  18. #include <cassert>
  19. #include <sstream>
  20. #include <algorithm>
  21. #include "dxc/HLSL/DxilContainer.h"
  22. #include "dxc/Support/WinIncludes.h"
  23. #include "dxc/dxcapi.h"
  24. #include <atlfile.h>
  25. #include "HLSLTestData.h"
  26. #include "WexTestClass.h"
  27. #include "HlslTestUtils.h"
  28. #include "DxcTestUtils.h"
  29. #include "llvm/Support/raw_os_ostream.h"
  30. #include "dxc/Support/Global.h"
  31. #include "dxc/Support/dxcapi.use.h"
  32. #include "dxc/Support/microcom.h"
  33. #include "dxc/Support/HLSLOptions.h"
  34. #include "dxc/Support/Unicode.h"
  35. #include "dia2.h"
  36. #include <fstream>
  37. #include "llvm/Support/FileSystem.h"
  38. #include "llvm/Support/MSFileSystem.h"
  39. #include "llvm/Support/Path.h"
  40. #include "llvm/ADT/SmallString.h"
  41. #include "llvm/ADT/StringSwitch.h"
  42. using namespace std;
  43. using namespace hlsl_test;
  44. void AssembleToContainer(dxc::DxcDllSupport &dllSupport, IDxcBlob *pModule, IDxcBlob **pContainer) {
  45. CComPtr<IDxcAssembler> pAssembler;
  46. CComPtr<IDxcOperationResult> pResult;
  47. VERIFY_SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcAssembler, &pAssembler));
  48. VERIFY_SUCCEEDED(pAssembler->AssembleToContainer(pModule, &pResult));
  49. CheckOperationSucceeded(pResult, pContainer);
  50. }
  51. std::wstring BlobToUtf16(_In_ IDxcBlob *pBlob) {
  52. CComPtr<IDxcBlobEncoding> pBlobEncoding;
  53. const UINT CP_UTF16 = 1200;
  54. IFT(pBlob->QueryInterface(&pBlobEncoding));
  55. BOOL known;
  56. UINT32 codePage;
  57. IFT(pBlobEncoding->GetEncoding(&known, &codePage));
  58. std::wstring result;
  59. if (codePage == CP_UTF16) {
  60. result.resize(pBlob->GetBufferSize() + 1);
  61. memcpy((void *)result.data(), pBlob->GetBufferPointer(),
  62. pBlob->GetBufferSize());
  63. return result;
  64. } else if (codePage == CP_UTF8) {
  65. Unicode::UTF8ToUTF16String((char *)pBlob->GetBufferPointer(),
  66. pBlob->GetBufferSize(), &result);
  67. return result;
  68. } else {
  69. throw std::exception("Unsupported codepage.");
  70. }
  71. }
  72. void GetDxilPart(dxc::DxcDllSupport &dllSupport, IDxcBlob *pProgram, IDxcBlob **pDxilPart) {
  73. const UINT32 DxilPartKind = 'LIXD'; // DXIL
  74. UINT32 DxilIndex;
  75. CComPtr<IDxcContainerReflection> pContainerReflection;
  76. VERIFY_SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcContainerReflection, &pContainerReflection));
  77. VERIFY_SUCCEEDED(pContainerReflection->Load(pProgram));
  78. VERIFY_SUCCEEDED(pContainerReflection->FindFirstPartKind(DxilPartKind, &DxilIndex));
  79. VERIFY_SUCCEEDED(pContainerReflection->GetPartContent(DxilIndex, pDxilPart));
  80. }
  81. void Utf8ToBlob(dxc::DxcDllSupport &dllSupport, const char *pVal, _Outptr_ IDxcBlobEncoding **ppBlob) {
  82. CComPtr<IDxcLibrary> library;
  83. IFT(dllSupport.CreateInstance(CLSID_DxcLibrary, &library));
  84. IFT(library->CreateBlobWithEncodingOnHeapCopy(pVal, strlen(pVal), CP_UTF8, ppBlob));
  85. }
  86. void Utf8ToBlob(dxc::DxcDllSupport &dllSupport, const std::string &val, _Outptr_ IDxcBlobEncoding **ppBlob) {
  87. CComPtr<IDxcLibrary> library;
  88. IFT(dllSupport.CreateInstance(CLSID_DxcLibrary, &library));
  89. IFT(library->CreateBlobWithEncodingOnHeapCopy(val.data(), val.size(), CP_UTF8, ppBlob));
  90. }
  91. void Utf8ToBlob(dxc::DxcDllSupport &dllSupport, const std::string &val, _Outptr_ IDxcBlob **ppBlob) {
  92. Utf8ToBlob(dllSupport, val, (IDxcBlobEncoding**)ppBlob);
  93. }
  94. void Utf16ToBlob(dxc::DxcDllSupport &dllSupport, const std::wstring &val, _Outptr_ IDxcBlobEncoding **ppBlob) {
  95. const UINT32 CP_UTF16 = 1200;
  96. CComPtr<IDxcLibrary> library;
  97. IFT(dllSupport.CreateInstance(CLSID_DxcLibrary, &library));
  98. IFT(library->CreateBlobWithEncodingOnHeapCopy(val.data(), val.size() * sizeof(wchar_t), CP_UTF16, ppBlob));
  99. }
  100. void Utf16ToBlob(dxc::DxcDllSupport &dllSupport, const std::wstring &val, _Outptr_ IDxcBlob **ppBlob) {
  101. Utf16ToBlob(dllSupport, val, (IDxcBlobEncoding**)ppBlob);
  102. }
  103. void VerifyCompileOK(dxc::DxcDllSupport &dllSupport, LPCSTR pText,
  104. LPWSTR pTargetProfile, LPCWSTR pArgs,
  105. _Outptr_ IDxcBlob **ppResult) {
  106. std::vector<std::wstring> argsW;
  107. std::vector<LPCWSTR> args;
  108. if (pArgs) {
  109. wistringstream argsS(pArgs);
  110. copy(istream_iterator<wstring, wchar_t>(argsS),
  111. istream_iterator<wstring, wchar_t>(), back_inserter(argsW));
  112. transform(argsW.begin(), argsW.end(), back_inserter(args),
  113. [](const wstring &w) { return w.data(); });
  114. }
  115. VerifyCompileOK(dllSupport, pText, pTargetProfile, args, ppResult);
  116. }
  117. void VerifyCompileOK(dxc::DxcDllSupport &dllSupport, LPCSTR pText,
  118. LPWSTR pTargetProfile, std::vector<LPCWSTR> &args,
  119. _Outptr_ IDxcBlob **ppResult) {
  120. CComPtr<IDxcCompiler> pCompiler;
  121. CComPtr<IDxcBlobEncoding> pSource;
  122. CComPtr<IDxcOperationResult> pResult;
  123. HRESULT hrCompile;
  124. *ppResult = nullptr;
  125. VERIFY_SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcCompiler, &pCompiler));
  126. Utf8ToBlob(dllSupport, pText, &pSource);
  127. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  128. pTargetProfile, args.data(), args.size(),
  129. nullptr, 0, nullptr, &pResult));
  130. VERIFY_SUCCEEDED(pResult->GetStatus(&hrCompile));
  131. VERIFY_SUCCEEDED(hrCompile);
  132. VERIFY_SUCCEEDED(pResult->GetResult(ppResult));
  133. }
  134. // VersionSupportInfo Implementation
  135. VersionSupportInfo::VersionSupportInfo() :
  136. m_CompilerIsDebugBuild(false),
  137. m_InternalValidator(false),
  138. m_DxilMajor(0),
  139. m_DxilMinor(0),
  140. m_ValMajor(0),
  141. m_ValMinor(0)
  142. {}
  143. void VersionSupportInfo::Initialize(dxc::DxcDllSupport &dllSupport) {
  144. VERIFY_IS_TRUE(dllSupport.IsEnabled());
  145. // Default to Dxil 1.0 and internal Val 1.0
  146. m_DxilMajor = m_ValMajor = 1;
  147. m_DxilMinor = m_ValMinor = 0;
  148. m_InternalValidator = true;
  149. CComPtr<IDxcVersionInfo> pVersionInfo;
  150. UINT32 VersionFlags = 0;
  151. // If the following fails, we have Dxil 1.0 compiler
  152. if (SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcCompiler, &pVersionInfo))) {
  153. VERIFY_SUCCEEDED(pVersionInfo->GetVersion(&m_DxilMajor, &m_DxilMinor));
  154. VERIFY_SUCCEEDED(pVersionInfo->GetFlags(&VersionFlags));
  155. m_CompilerIsDebugBuild = (VersionFlags & DxcVersionInfoFlags_Debug) ? true : false;
  156. pVersionInfo.Release();
  157. }
  158. if (SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcValidator, &pVersionInfo))) {
  159. VERIFY_SUCCEEDED(pVersionInfo->GetVersion(&m_ValMajor, &m_ValMinor));
  160. VERIFY_SUCCEEDED(pVersionInfo->GetFlags(&VersionFlags));
  161. if (m_ValMinor > 0) {
  162. // flag only exists on newer validator, assume internal otherwise.
  163. m_InternalValidator = (VersionFlags & DxcVersionInfoFlags_Internal) ? true : false;
  164. } else {
  165. // With old compiler, validator is the only way to get this
  166. m_CompilerIsDebugBuild = (VersionFlags & DxcVersionInfoFlags_Debug) ? true : false;
  167. }
  168. } else {
  169. // If create instance of IDxcVersionInfo on validator failed, we have an old validator from dxil.dll
  170. m_InternalValidator = false;
  171. }
  172. }
  173. bool VersionSupportInfo::SkipIRSensitiveTest() {
  174. // Only debug builds preserve BB names.
  175. if (!m_CompilerIsDebugBuild) {
  176. WEX::Logging::Log::Comment(L"Test skipped due to name preservation requirement.");
  177. return true;
  178. }
  179. return false;
  180. }
  181. bool VersionSupportInfo::SkipDxilVersion(unsigned major, unsigned minor) {
  182. if (m_DxilMajor < major || (m_DxilMajor == major && m_DxilMinor < minor) ||
  183. m_ValMajor < major || (m_ValMajor == major && m_ValMinor < minor)) {
  184. WEX::Logging::Log::Comment(WEX::Common::String().Format(
  185. L"Test skipped because it requires Dxil %u.%u and Validator %u.%u.",
  186. major, minor, major, minor));
  187. return true;
  188. }
  189. return false;
  190. }
  191. bool VersionSupportInfo::SkipOutOfMemoryTest() {
  192. return false;
  193. }
  194. // Aligned to SymTagEnum.
  195. const char *SymTagEnumText[] =
  196. {
  197. "Null", // SymTagNull
  198. "Exe", // SymTagExe
  199. "Compiland", // SymTagCompiland
  200. "CompilandDetails", // SymTagCompilandDetails
  201. "CompilandEnv", // SymTagCompilandEnv
  202. "Function", // SymTagFunction
  203. "Block", // SymTagBlock
  204. "Data", // SymTagData
  205. "Annotation", // SymTagAnnotation
  206. "Label", // SymTagLabel
  207. "PublicSymbol", // SymTagPublicSymbol
  208. "UDT", // SymTagUDT
  209. "Enum", // SymTagEnum
  210. "FunctionType", // SymTagFunctionType
  211. "PointerType", // SymTagPointerType
  212. "ArrayType", // SymTagArrayType
  213. "BaseType", // SymTagBaseType
  214. "Typedef", // SymTagTypedef
  215. "BaseClass", // SymTagBaseClass
  216. "Friend", // SymTagFriend
  217. "FunctionArgType", // SymTagFunctionArgType
  218. "FuncDebugStart", // SymTagFuncDebugStart
  219. "FuncDebugEnd", // SymTagFuncDebugEnd
  220. "UsingNamespace", // SymTagUsingNamespace
  221. "VTableShape", // SymTagVTableShape
  222. "VTable", // SymTagVTable
  223. "Custom", // SymTagCustom
  224. "Thunk", // SymTagThunk
  225. "CustomType", // SymTagCustomType
  226. "ManagedType", // SymTagManagedType
  227. "Dimension", // SymTagDimension
  228. "CallSite", // SymTagCallSite
  229. "InlineSite", // SymTagInlineSite
  230. "BaseInterface", // SymTagBaseInterface
  231. "VectorType", // SymTagVectorType
  232. "MatrixType", // SymTagMatrixType
  233. "HLSLType", // SymTagHLSLType
  234. "Caller", // SymTagCaller
  235. "Callee", // SymTagCallee
  236. "Export", // SymTagExport
  237. "HeapAllocationSite", // SymTagHeapAllocationSite
  238. "CoffGroup", // SymTagCoffGroup
  239. };
  240. // Aligned to LocationType.
  241. const char *LocationTypeText[] =
  242. {
  243. "Null",
  244. "Static",
  245. "TLS",
  246. "RegRel",
  247. "ThisRel",
  248. "Enregistered",
  249. "BitField",
  250. "Slot",
  251. "IlRel",
  252. "MetaData",
  253. "Constant",
  254. };
  255. // Aligned to DataKind.
  256. const char *DataKindText[] =
  257. {
  258. "Unknown",
  259. "Local",
  260. "StaticLocal",
  261. "Param",
  262. "ObjectPtr",
  263. "FileStatic",
  264. "Global",
  265. "Member",
  266. "StaticMember",
  267. "Constant",
  268. };
  269. // Aligned to UdtKind.
  270. const char *UdtKindText[] =
  271. {
  272. "Struct",
  273. "Class",
  274. "Union",
  275. "Interface",
  276. };
  277. // BasicType is not contiguous.
  278. const char *GetBasicTypeText(enum BasicType value) {
  279. switch (value) {
  280. case btNoType: return "NoType";
  281. case btVoid: return "Void";
  282. case btChar: return "Char";
  283. case btWChar: return "WChar";
  284. case btInt: return "Int";
  285. case btUInt: return "UInt";
  286. case btFloat: return "Float";
  287. case btBCD: return "BCD";
  288. case btBool: return "Bool";
  289. case btLong: return "Long";
  290. case btULong: return "ULong";
  291. case btCurrency: return "Currency";
  292. case btDate: return "Date";
  293. case btVariant: return "Variant";
  294. case btComplex: return "Complex";
  295. case btBit: return "Bit";
  296. case btBSTR: return "BSTR";
  297. case btHresult: return "Hresult";
  298. // The following may not be present in cvconst.h
  299. //case btChar16: return "Char16";
  300. //case btChar32: return "Char32";
  301. }
  302. return "?";
  303. }
  304. class TestIncludeHandler : public IDxcIncludeHandler {
  305. DXC_MICROCOM_REF_FIELD(m_dwRef)
  306. public:
  307. DXC_MICROCOM_ADDREF_RELEASE_IMPL(m_dwRef)
  308. dxc::DxcDllSupport &m_dllSupport;
  309. HRESULT m_defaultErrorCode = E_FAIL;
  310. TestIncludeHandler(dxc::DxcDllSupport &dllSupport) : m_dwRef(0), callIndex(0), m_dllSupport(dllSupport) { }
  311. __override HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObject) {
  312. return DoBasicQueryInterface<IDxcIncludeHandler>(this, iid, ppvObject);
  313. }
  314. struct LoadSourceCallInfo {
  315. std::wstring Filename; // Filename as written in #include statement
  316. LoadSourceCallInfo(LPCWSTR pFilename) :
  317. Filename(pFilename) { }
  318. };
  319. std::vector<LoadSourceCallInfo> CallInfos;
  320. std::wstring GetAllFileNames() const {
  321. std::wstringstream s;
  322. for (size_t i = 0; i < CallInfos.size(); ++i) {
  323. s << CallInfos[i].Filename << ';';
  324. }
  325. return s.str();
  326. }
  327. struct LoadSourceCallResult {
  328. HRESULT hr;
  329. std::string source;
  330. LoadSourceCallResult() : hr(E_FAIL) { }
  331. LoadSourceCallResult(const char *pSource) : hr(S_OK), source(pSource) { }
  332. };
  333. std::vector<LoadSourceCallResult> CallResults;
  334. size_t callIndex;
  335. __override HRESULT STDMETHODCALLTYPE LoadSource(
  336. _In_ LPCWSTR pFilename, // Filename as written in #include statement
  337. _COM_Outptr_ IDxcBlob **ppIncludeSource // Resultant source object for included file
  338. ) {
  339. CallInfos.push_back(LoadSourceCallInfo(pFilename));
  340. *ppIncludeSource = nullptr;
  341. if (callIndex >= CallResults.size()) {
  342. return m_defaultErrorCode;
  343. }
  344. if (FAILED(CallResults[callIndex].hr)) {
  345. return CallResults[callIndex++].hr;
  346. }
  347. Utf8ToBlob(m_dllSupport, CallResults[callIndex].source, ppIncludeSource);
  348. return CallResults[callIndex++].hr;
  349. }
  350. };
  351. class CompilerTest {
  352. public:
  353. BEGIN_TEST_CLASS(CompilerTest)
  354. TEST_CLASS_PROPERTY(L"Parallel", L"true")
  355. TEST_METHOD_PROPERTY(L"Priority", L"0")
  356. END_TEST_CLASS()
  357. TEST_CLASS_SETUP(InitSupport);
  358. TEST_METHOD(CompileWhenDebugThenDIPresent)
  359. TEST_METHOD(CompileDebugLines)
  360. TEST_METHOD(CompileWhenDefinesThenApplied)
  361. TEST_METHOD(CompileWhenDefinesManyThenApplied)
  362. TEST_METHOD(CompileWhenEmptyThenFails)
  363. TEST_METHOD(CompileWhenIncorrectThenFails)
  364. TEST_METHOD(CompileWhenWorksThenDisassembleWorks)
  365. TEST_METHOD(CompileWhenDebugWorksThenStripDebug)
  366. TEST_METHOD(CompileWhenWorksThenAddRemovePrivate)
  367. TEST_METHOD(CompileThenAddCustomDebugName)
  368. TEST_METHOD(CompileWithRootSignatureThenStripRootSignature)
  369. TEST_METHOD(CompileWhenIncludeThenLoadInvoked)
  370. TEST_METHOD(CompileWhenIncludeThenLoadUsed)
  371. TEST_METHOD(CompileWhenIncludeAbsoluteThenLoadAbsolute)
  372. TEST_METHOD(CompileWhenIncludeLocalThenLoadRelative)
  373. TEST_METHOD(CompileWhenIncludeSystemThenLoadNotRelative)
  374. TEST_METHOD(CompileWhenIncludeSystemMissingThenLoadAttempt)
  375. TEST_METHOD(CompileWhenIncludeFlagsThenIncludeUsed)
  376. TEST_METHOD(CompileWhenIncludeMissingThenFail)
  377. TEST_METHOD(CompileWhenIncludeHasPathThenOK)
  378. TEST_METHOD(CompileWhenODumpThenPassConfig)
  379. TEST_METHOD(CompileWhenODumpThenOptimizerMatch)
  380. TEST_METHOD(CompileWhenVdThenProducesDxilContainer)
  381. TEST_METHOD(CompileWhenNoMemThenOOM)
  382. TEST_METHOD(CompileWhenShaderModelMismatchAttributeThenFail)
  383. TEST_METHOD(CompileBadHlslThenFail)
  384. TEST_METHOD(CompileLegacyShaderModelThenFail)
  385. TEST_METHOD(CompileWhenRecursiveAlbeitStaticTermThenFail)
  386. TEST_METHOD(CompileWhenRecursiveThenFail)
  387. TEST_METHOD(CompileHlsl2015ThenFail)
  388. TEST_METHOD(CompileHlsl2016ThenOK)
  389. TEST_METHOD(CompileHlsl2017ThenOK)
  390. TEST_METHOD(CompileHlsl2018ThenOK)
  391. TEST_METHOD(CompileHlsl2019ThenFail)
  392. TEST_METHOD(CompileCBufferTBufferASTDump)
  393. TEST_METHOD(DiaLoadBadBitcodeThenFail)
  394. TEST_METHOD(DiaLoadDebugThenOK)
  395. TEST_METHOD(DiaTableIndexThenOK)
  396. TEST_METHOD(PixMSAAToSample0)
  397. TEST_METHOD(PixRemoveDiscards)
  398. TEST_METHOD(PixPixelCounter)
  399. TEST_METHOD(PixPixelCounterEarlyZ)
  400. TEST_METHOD(PixPixelCounterNoSvPosition)
  401. TEST_METHOD(PixPixelCounterAddPixelCost)
  402. TEST_METHOD(PixConstantColor)
  403. TEST_METHOD(PixConstantColorInt)
  404. TEST_METHOD(PixConstantColorMRT)
  405. TEST_METHOD(PixConstantColorUAVs)
  406. TEST_METHOD(PixConstantColorOtherSIVs)
  407. TEST_METHOD(PixConstantColorFromCB)
  408. TEST_METHOD(PixConstantColorFromCBint)
  409. TEST_METHOD(PixForceEarlyZ)
  410. TEST_METHOD(PixDebugBasic)
  411. TEST_METHOD(PixDebugUAVSize)
  412. TEST_METHOD(PixDebugGSParameters)
  413. TEST_METHOD(PixDebugPSParameters)
  414. TEST_METHOD(PixDebugVSParameters)
  415. TEST_METHOD(PixDebugCSParameters)
  416. TEST_METHOD(PixDebugFlowControl)
  417. TEST_METHOD(PixDebugPreexistingSVPosition)
  418. TEST_METHOD(PixDebugPreexistingSVVertex)
  419. TEST_METHOD(PixDebugPreexistingSVInstance)
  420. TEST_METHOD(PixAccessTracking)
  421. TEST_METHOD(CodeGenAbs1)
  422. TEST_METHOD(CodeGenAbs2)
  423. TEST_METHOD(CodeGenAllLit)
  424. TEST_METHOD(CodeGenAllocaAtEntryBlk)
  425. TEST_METHOD(CodeGenAddUint64)
  426. TEST_METHOD(CodeGenArrayArg)
  427. TEST_METHOD(CodeGenArrayArg2)
  428. TEST_METHOD(CodeGenArrayArg3)
  429. TEST_METHOD(CodeGenArrayOfStruct)
  430. TEST_METHOD(CodeGenAsUint)
  431. TEST_METHOD(CodeGenAsUint2)
  432. TEST_METHOD(CodeGenAtomic)
  433. TEST_METHOD(CodeGenAtomic2)
  434. TEST_METHOD(CodeGenAttributeAtVertex)
  435. TEST_METHOD(CodeGenAttributeAtVertexNoOpt)
  436. TEST_METHOD(CodeGenBarycentrics)
  437. TEST_METHOD(CodeGenBarycentrics1)
  438. TEST_METHOD(CodeGenBarycentricsThreeSV)
  439. TEST_METHOD(CodeGenBinary1)
  440. TEST_METHOD(CodeGenBitCast)
  441. TEST_METHOD(CodeGenBitCast16Bits)
  442. TEST_METHOD(CodeGenBoolComb)
  443. TEST_METHOD(CodeGenBoolSvTarget)
  444. TEST_METHOD(CodeGenCalcLod2DArray)
  445. TEST_METHOD(CodeGenCall1)
  446. TEST_METHOD(CodeGenCall3)
  447. TEST_METHOD(CodeGenCast1)
  448. TEST_METHOD(CodeGenCast2)
  449. TEST_METHOD(CodeGenCast3)
  450. TEST_METHOD(CodeGenCast4)
  451. TEST_METHOD(CodeGenCast5)
  452. TEST_METHOD(CodeGenCast6)
  453. TEST_METHOD(CodeGenCast7)
  454. TEST_METHOD(CodeGenCbuf_init_static)
  455. TEST_METHOD(CodeGenCbufferCopy)
  456. TEST_METHOD(CodeGenCbufferCopy1)
  457. TEST_METHOD(CodeGenCbufferCopy2)
  458. TEST_METHOD(CodeGenCbufferCopy3)
  459. TEST_METHOD(CodeGenCbufferCopy4)
  460. TEST_METHOD(CodeGenCbufferWithFunction)
  461. TEST_METHOD(CodeGenCbufferWithFunctionCopy)
  462. TEST_METHOD(CodeGenCbuffer_unused)
  463. TEST_METHOD(CodeGenCbuffer1_50)
  464. TEST_METHOD(CodeGenCbuffer1_51)
  465. TEST_METHOD(CodeGenCbuffer2_50)
  466. TEST_METHOD(CodeGenCbuffer2_51)
  467. TEST_METHOD(CodeGenCbuffer3_50)
  468. TEST_METHOD(CodeGenCbuffer3_51)
  469. TEST_METHOD(CodeGenCbuffer5_51)
  470. TEST_METHOD(CodeGenCbuffer6_51)
  471. TEST_METHOD(CodeGenCbuffer64Types)
  472. TEST_METHOD(CodeGenCbufferAlloc)
  473. TEST_METHOD(CodeGenCbufferAllocLegacy)
  474. TEST_METHOD(CodeGenCbufferHalf)
  475. TEST_METHOD(CodeGenCbufferHalfStruct)
  476. TEST_METHOD(CodeGenCbufferInLoop)
  477. TEST_METHOD(CodeGenCbufferInt16)
  478. TEST_METHOD(CodeGenCbufferInt16Struct)
  479. TEST_METHOD(CodeGenCbufferMinPrec)
  480. TEST_METHOD(CodeGenClass)
  481. TEST_METHOD(CodeGenClip)
  482. TEST_METHOD(CodeGenClipPlanes)
  483. TEST_METHOD(CodeGenConstoperand1)
  484. TEST_METHOD(CodeGenConstMat)
  485. TEST_METHOD(CodeGenConstMat2)
  486. TEST_METHOD(CodeGenConstMat3)
  487. TEST_METHOD(CodeGenConstMat4)
  488. TEST_METHOD(CodeGenCorrectDelay)
  489. TEST_METHOD(CodeGenDataLayout)
  490. TEST_METHOD(CodeGenDataLayoutHalf)
  491. TEST_METHOD(CodeGenDiscard)
  492. TEST_METHOD(CodeGenDivZero)
  493. TEST_METHOD(CodeGenDot1)
  494. TEST_METHOD(CodeGenDynamic_Resources)
  495. TEST_METHOD(CodeGenEffectSkip)
  496. TEST_METHOD(CodeGenEliminateDynamicIndexing)
  497. TEST_METHOD(CodeGenEliminateDynamicIndexing2)
  498. TEST_METHOD(CodeGenEliminateDynamicIndexing3)
  499. TEST_METHOD(CodeGenEliminateDynamicIndexing4)
  500. TEST_METHOD(CodeGenEliminateDynamicIndexing5)
  501. TEST_METHOD(CodeGenEliminateDynamicIndexing6)
  502. TEST_METHOD(CodeGenEmpty)
  503. TEST_METHOD(CodeGenEmptyStruct)
  504. TEST_METHOD(CodeGenEnum1)
  505. TEST_METHOD(CodeGenEnum2)
  506. TEST_METHOD(CodeGenEnum3)
  507. TEST_METHOD(CodeGenEnum4)
  508. TEST_METHOD(CodeGenEnum5)
  509. TEST_METHOD(CodeGenEnum6)
  510. TEST_METHOD(CodeGenEarlyDepthStencil)
  511. TEST_METHOD(CodeGenEval)
  512. TEST_METHOD(CodeGenEvalInvalid)
  513. TEST_METHOD(CodeGenEvalMat)
  514. TEST_METHOD(CodeGenEvalMatMember)
  515. TEST_METHOD(CodeGenEvalPos)
  516. TEST_METHOD(CodeGenExternRes)
  517. TEST_METHOD(CodeGenExpandTrig)
  518. TEST_METHOD(CodeGenFloatCast)
  519. TEST_METHOD(CodeGenFloatToBool)
  520. TEST_METHOD(CodeGenFirstbitHi)
  521. TEST_METHOD(CodeGenFirstbitLo)
  522. TEST_METHOD(CodeGenFixedWidthTypes)
  523. TEST_METHOD(CodeGenFixedWidthTypes16Bit)
  524. TEST_METHOD(CodeGenFloatMaxtessfactor)
  525. TEST_METHOD(CodeGenFModPS)
  526. TEST_METHOD(CodeGenFuncCast)
  527. TEST_METHOD(CodeGenFunctionalCast)
  528. TEST_METHOD(CodeGenFunctionAttribute)
  529. TEST_METHOD(CodeGenGather)
  530. TEST_METHOD(CodeGenGatherCmp)
  531. TEST_METHOD(CodeGenGatherCubeOffset)
  532. TEST_METHOD(CodeGenGatherOffset)
  533. TEST_METHOD(CodeGenGepZeroIdx)
  534. TEST_METHOD(CodeGenGloballyCoherent)
  535. TEST_METHOD(CodeGenI32ColIdx)
  536. TEST_METHOD(CodeGenIcb1)
  537. TEST_METHOD(CodeGenIf1)
  538. TEST_METHOD(CodeGenIf2)
  539. TEST_METHOD(CodeGenIf3)
  540. TEST_METHOD(CodeGenIf4)
  541. TEST_METHOD(CodeGenIf5)
  542. TEST_METHOD(CodeGenIf6)
  543. TEST_METHOD(CodeGenIf7)
  544. TEST_METHOD(CodeGenIf8)
  545. TEST_METHOD(CodeGenIf9)
  546. TEST_METHOD(CodeGenImm0)
  547. TEST_METHOD(CodeGenInclude)
  548. TEST_METHOD(CodeGenIncompletePos)
  549. TEST_METHOD(CodeGenIndexableinput1)
  550. TEST_METHOD(CodeGenIndexableinput2)
  551. TEST_METHOD(CodeGenIndexableinput3)
  552. TEST_METHOD(CodeGenIndexableinput4)
  553. TEST_METHOD(CodeGenIndexableoutput1)
  554. TEST_METHOD(CodeGenIndexabletemp1)
  555. TEST_METHOD(CodeGenIndexabletemp2)
  556. TEST_METHOD(CodeGenIndexabletemp3)
  557. TEST_METHOD(CodeGenInitListType)
  558. TEST_METHOD(CodeGenInoutSE)
  559. TEST_METHOD(CodeGenInout1)
  560. TEST_METHOD(CodeGenInout2)
  561. TEST_METHOD(CodeGenInout3)
  562. TEST_METHOD(CodeGenInout4)
  563. TEST_METHOD(CodeGenInout5)
  564. TEST_METHOD(CodeGenInput1)
  565. TEST_METHOD(CodeGenInput2)
  566. TEST_METHOD(CodeGenInput3)
  567. TEST_METHOD(CodeGenInt16Op)
  568. TEST_METHOD(CodeGenInt16OpBits)
  569. TEST_METHOD(CodeGenIntrinsic1)
  570. TEST_METHOD(CodeGenIntrinsic1Minprec)
  571. TEST_METHOD(CodeGenIntrinsic2)
  572. TEST_METHOD(CodeGenIntrinsic2Minprec)
  573. TEST_METHOD(CodeGenIntrinsic3_even)
  574. TEST_METHOD(CodeGenIntrinsic3_integer)
  575. TEST_METHOD(CodeGenIntrinsic3_odd)
  576. TEST_METHOD(CodeGenIntrinsic3_pow2)
  577. TEST_METHOD(CodeGenIntrinsic4)
  578. TEST_METHOD(CodeGenIntrinsic4_dbg)
  579. TEST_METHOD(CodeGenIntrinsic5)
  580. TEST_METHOD(CodeGenIntrinsic5Minprec)
  581. TEST_METHOD(CodeGenInvalidInputOutputTypes)
  582. TEST_METHOD(CodeGenLegacyStruct)
  583. TEST_METHOD(CodeGenLibCsEntry)
  584. TEST_METHOD(CodeGenLibCsEntry2)
  585. TEST_METHOD(CodeGenLibCsEntry3)
  586. TEST_METHOD(CodeGenLibEntries)
  587. TEST_METHOD(CodeGenLibEntries2)
  588. TEST_METHOD(CodeGenLibNoAlias)
  589. TEST_METHOD(CodeGenLibResource)
  590. TEST_METHOD(CodeGenLibUnusedFunc)
  591. TEST_METHOD(CodeGenLitInParen)
  592. TEST_METHOD(CodeGenLiteralShift)
  593. TEST_METHOD(CodeGenLiveness1)
  594. TEST_METHOD(CodeGenLocalRes1)
  595. TEST_METHOD(CodeGenLocalRes4)
  596. TEST_METHOD(CodeGenLocalRes7)
  597. TEST_METHOD(CodeGenLocalRes7Dbg)
  598. TEST_METHOD(CodeGenLoop1)
  599. TEST_METHOD(CodeGenLoop2)
  600. TEST_METHOD(CodeGenLoop3)
  601. TEST_METHOD(CodeGenLoop4)
  602. TEST_METHOD(CodeGenLoop5)
  603. TEST_METHOD(CodeGenLoop6)
  604. TEST_METHOD(CodeGenMatParam)
  605. TEST_METHOD(CodeGenMatParam2)
  606. // TEST_METHOD(CodeGenMatParam3)
  607. TEST_METHOD(CodeGenMatArrayOutput)
  608. TEST_METHOD(CodeGenMatArrayOutput2)
  609. TEST_METHOD(CodeGenMatElt)
  610. TEST_METHOD(CodeGenMatInit)
  611. TEST_METHOD(CodeGenMatMulMat)
  612. TEST_METHOD(CodeGenMatOps)
  613. TEST_METHOD(CodeGenMatInStruct)
  614. TEST_METHOD(CodeGenMatInStructRet)
  615. TEST_METHOD(CodeGenMatIn)
  616. TEST_METHOD(CodeGenMatIn1)
  617. TEST_METHOD(CodeGenMatIn2)
  618. TEST_METHOD(CodeGenMatOut)
  619. TEST_METHOD(CodeGenMatOut1)
  620. TEST_METHOD(CodeGenMatOut2)
  621. TEST_METHOD(CodeGenMatSubscript)
  622. TEST_METHOD(CodeGenMatSubscript2)
  623. TEST_METHOD(CodeGenMatSubscript3)
  624. TEST_METHOD(CodeGenMatSubscript4)
  625. TEST_METHOD(CodeGenMatSubscript5)
  626. TEST_METHOD(CodeGenMatSubscript6)
  627. TEST_METHOD(CodeGenMatSubscript7)
  628. TEST_METHOD(CodeGenMaxMin)
  629. TEST_METHOD(CodeGenMinprec1)
  630. TEST_METHOD(CodeGenMinprec2)
  631. TEST_METHOD(CodeGenMinprec3)
  632. TEST_METHOD(CodeGenMinprec4)
  633. TEST_METHOD(CodeGenMinprec5)
  634. TEST_METHOD(CodeGenMinprec6)
  635. TEST_METHOD(CodeGenMinprec7)
  636. TEST_METHOD(CodeGenMinprecCoord)
  637. TEST_METHOD(CodeGenModf)
  638. TEST_METHOD(CodeGenMinprecCast)
  639. TEST_METHOD(CodeGenMinprecImm)
  640. TEST_METHOD(CodeGenMultiUAVLoad1)
  641. TEST_METHOD(CodeGenMultiUAVLoad2)
  642. TEST_METHOD(CodeGenMultiUAVLoad3)
  643. TEST_METHOD(CodeGenMultiUAVLoad4)
  644. TEST_METHOD(CodeGenMultiUAVLoad5)
  645. TEST_METHOD(CodeGenMultiUAVLoad6)
  646. TEST_METHOD(CodeGenMultiUAVLoad7)
  647. TEST_METHOD(CodeGenMultiStream)
  648. TEST_METHOD(CodeGenMultiStream2)
  649. TEST_METHOD(CodeGenNeg1)
  650. TEST_METHOD(CodeGenNeg2)
  651. TEST_METHOD(CodeGenNegabs1)
  652. TEST_METHOD(CodeGenNoise)
  653. TEST_METHOD(CodeGenNonUniform)
  654. TEST_METHOD(CodeGenOptForNoOpt)
  655. TEST_METHOD(CodeGenOptForNoOpt2)
  656. TEST_METHOD(CodeGenOptionGis)
  657. TEST_METHOD(CodeGenOptionWX)
  658. TEST_METHOD(CodeGenOutput1)
  659. TEST_METHOD(CodeGenOutput2)
  660. TEST_METHOD(CodeGenOutput3)
  661. TEST_METHOD(CodeGenOutput4)
  662. TEST_METHOD(CodeGenOutput5)
  663. TEST_METHOD(CodeGenOutput6)
  664. TEST_METHOD(CodeGenOutputArray)
  665. TEST_METHOD(CodeGenPassthrough1)
  666. TEST_METHOD(CodeGenPassthrough2)
  667. TEST_METHOD(CodeGenPrecise1)
  668. TEST_METHOD(CodeGenPrecise2)
  669. TEST_METHOD(CodeGenPrecise3)
  670. TEST_METHOD(CodeGenPrecise4)
  671. TEST_METHOD(CodeGenPreciseOnCall)
  672. TEST_METHOD(CodeGenPreciseOnCallNot)
  673. TEST_METHOD(CodeGenPreserveAllOutputs)
  674. TEST_METHOD(CodeGenRaceCond2)
  675. TEST_METHOD(CodeGenRaw_Buf1)
  676. TEST_METHOD(CodeGenRaw_Buf2)
  677. TEST_METHOD(CodeGenRaw_Buf3)
  678. TEST_METHOD(CodeGenRaw_Buf4)
  679. TEST_METHOD(CodeGenRaw_Buf5)
  680. TEST_METHOD(CodeGenRcp1)
  681. TEST_METHOD(CodeGenReadFromOutput)
  682. TEST_METHOD(CodeGenReadFromOutput2)
  683. TEST_METHOD(CodeGenReadFromOutput3)
  684. TEST_METHOD(CodeGenRedundantinput1)
  685. TEST_METHOD(CodeGenRes64bit)
  686. TEST_METHOD(CodeGenRovs)
  687. TEST_METHOD(CodeGenRValAssign)
  688. TEST_METHOD(CodeGenRValSubscript)
  689. TEST_METHOD(CodeGenSample1)
  690. TEST_METHOD(CodeGenSample2)
  691. TEST_METHOD(CodeGenSample3)
  692. TEST_METHOD(CodeGenSample4)
  693. TEST_METHOD(CodeGenSample5)
  694. TEST_METHOD(CodeGenSampleBias)
  695. TEST_METHOD(CodeGenSampleCmp)
  696. TEST_METHOD(CodeGenSampleCmpLZ)
  697. TEST_METHOD(CodeGenSampleCmpLZ2)
  698. TEST_METHOD(CodeGenSampleGrad)
  699. TEST_METHOD(CodeGenSampleL)
  700. TEST_METHOD(CodeGenSaturate1)
  701. TEST_METHOD(CodeGenScalarOnVecIntrinsic)
  702. TEST_METHOD(CodeGenScalarToVec)
  703. TEST_METHOD(CodeGenSelectObj)
  704. TEST_METHOD(CodeGenSelectObj2)
  705. TEST_METHOD(CodeGenSelectObj3)
  706. TEST_METHOD(CodeGenSelectObj4)
  707. TEST_METHOD(CodeGenSelectObj5)
  708. TEST_METHOD(CodeGenSelfCopy)
  709. TEST_METHOD(CodeGenSelMat)
  710. TEST_METHOD(CodeGenSignaturePacking)
  711. TEST_METHOD(CodeGenSignaturePackingByWidth)
  712. TEST_METHOD(CodeGenShaderAttr)
  713. TEST_METHOD(CodeGenShare_Mem_Dbg)
  714. TEST_METHOD(CodeGenShare_Mem_Phi)
  715. TEST_METHOD(CodeGenShare_Mem1)
  716. TEST_METHOD(CodeGenShare_Mem2)
  717. TEST_METHOD(CodeGenShare_Mem2Dim)
  718. TEST_METHOD(CodeGenShift)
  719. TEST_METHOD(CodeGenShortCircuiting0)
  720. TEST_METHOD(CodeGenShortCircuiting1)
  721. TEST_METHOD(CodeGenShortCircuiting2)
  722. TEST_METHOD(CodeGenShortCircuiting3)
  723. TEST_METHOD(CodeGenSimpleDS1)
  724. TEST_METHOD(CodeGenSimpleGS1)
  725. TEST_METHOD(CodeGenSimpleGS2)
  726. TEST_METHOD(CodeGenSimpleGS3)
  727. TEST_METHOD(CodeGenSimpleGS4)
  728. TEST_METHOD(CodeGenSimpleGS5)
  729. TEST_METHOD(CodeGenSimpleGS6)
  730. TEST_METHOD(CodeGenSimpleGS7)
  731. TEST_METHOD(CodeGenSimpleGS11)
  732. TEST_METHOD(CodeGenSimpleGS12)
  733. TEST_METHOD(CodeGenSimpleHS1)
  734. TEST_METHOD(CodeGenSimpleHS2)
  735. TEST_METHOD(CodeGenSimpleHS3)
  736. TEST_METHOD(CodeGenSimpleHS4)
  737. TEST_METHOD(CodeGenSimpleHS5)
  738. TEST_METHOD(CodeGenSimpleHS6)
  739. TEST_METHOD(CodeGenSimpleHS7)
  740. TEST_METHOD(CodeGenSimpleHS8)
  741. TEST_METHOD(CodeGenSimpleHS9)
  742. TEST_METHOD(CodeGenSimpleHS10)
  743. TEST_METHOD(CodeGenSimpleHS11)
  744. TEST_METHOD(CodeGenSMFail)
  745. TEST_METHOD(CodeGenSrv_Ms_Load1)
  746. TEST_METHOD(CodeGenSrv_Ms_Load2)
  747. TEST_METHOD(CodeGenSrv_Typed_Load1)
  748. TEST_METHOD(CodeGenSrv_Typed_Load2)
  749. TEST_METHOD(CodeGenStaticConstGlobal)
  750. TEST_METHOD(CodeGenStaticConstGlobal2)
  751. TEST_METHOD(CodeGenStaticGlobals)
  752. TEST_METHOD(CodeGenStaticGlobals2)
  753. TEST_METHOD(CodeGenStaticGlobals3)
  754. TEST_METHOD(CodeGenStaticGlobals4)
  755. TEST_METHOD(CodeGenStaticGlobals5)
  756. TEST_METHOD(CodeGenStaticMatrix)
  757. TEST_METHOD(CodeGenStaticResource)
  758. TEST_METHOD(CodeGenStaticResource2)
  759. TEST_METHOD(CodeGenStruct_Buf1)
  760. TEST_METHOD(CodeGenStruct_Buf2)
  761. TEST_METHOD(CodeGenStruct_Buf3)
  762. TEST_METHOD(CodeGenStruct_Buf4)
  763. TEST_METHOD(CodeGenStruct_Buf5)
  764. TEST_METHOD(CodeGenStruct_Buf6)
  765. TEST_METHOD(CodeGenStruct_Buf_New_Layout)
  766. TEST_METHOD(CodeGenStruct_BufHasCounter)
  767. TEST_METHOD(CodeGenStruct_BufHasCounter2)
  768. TEST_METHOD(CodeGenStructArray)
  769. TEST_METHOD(CodeGenStructCast)
  770. TEST_METHOD(CodeGenStructCast2)
  771. TEST_METHOD(CodeGenStructInBuffer)
  772. TEST_METHOD(CodeGenStructInBuffer2)
  773. TEST_METHOD(CodeGenStructInBuffer3)
  774. TEST_METHOD(CodeGenSwitchFloat)
  775. TEST_METHOD(CodeGenSwitch1)
  776. TEST_METHOD(CodeGenSwitch2)
  777. TEST_METHOD(CodeGenSwitch3)
  778. TEST_METHOD(CodeGenSwizzle1)
  779. TEST_METHOD(CodeGenSwizzle2)
  780. TEST_METHOD(CodeGenSwizzleAtomic)
  781. TEST_METHOD(CodeGenSwizzleAtomic2)
  782. TEST_METHOD(CodeGenSwizzleIndexing)
  783. TEST_METHOD(CodeGenTempDbgInfo)
  784. TEST_METHOD(CodeGenTemp1)
  785. TEST_METHOD(CodeGenTemp2)
  786. TEST_METHOD(CodeGenTexSubscript)
  787. TEST_METHOD(CodeGenUav_Raw1)
  788. TEST_METHOD(CodeGenUav_Typed_Load_Store1)
  789. TEST_METHOD(CodeGenUav_Typed_Load_Store2)
  790. TEST_METHOD(CodeGenUav_Typed_Load_Store3)
  791. TEST_METHOD(CodeGenUint64_1)
  792. TEST_METHOD(CodeGenUint64_2)
  793. TEST_METHOD(CodeGenUintSample)
  794. TEST_METHOD(CodeGenUmaxObjectAtomic)
  795. TEST_METHOD(CodeGenUnrollDbg)
  796. TEST_METHOD(CodeGenUnsignedShortHandMatrixVector)
  797. TEST_METHOD(CodeGenUnusedFunc)
  798. TEST_METHOD(CodeGenUnusedCB)
  799. TEST_METHOD(CodeGenUpdateCounter)
  800. TEST_METHOD(CodeGenUpperCaseRegister1);
  801. TEST_METHOD(CodeGenVcmp)
  802. TEST_METHOD(CodeGenVecBitCast)
  803. TEST_METHOD(CodeGenVec_Comp_Arg)
  804. TEST_METHOD(CodeGenVecCmpCond)
  805. TEST_METHOD(CodeGenVecTrunc)
  806. TEST_METHOD(CodeGenWave)
  807. TEST_METHOD(CodeGenWaveNoOpt)
  808. TEST_METHOD(CodeGenWriteMaskBuf)
  809. TEST_METHOD(CodeGenWriteMaskBuf2)
  810. TEST_METHOD(CodeGenWriteMaskBuf3)
  811. TEST_METHOD(CodeGenWriteMaskBuf4)
  812. TEST_METHOD(CodeGenWriteToInput)
  813. TEST_METHOD(CodeGenWriteToInput2)
  814. TEST_METHOD(CodeGenWriteToInput3)
  815. TEST_METHOD(CodeGenWriteToInput4)
  816. TEST_METHOD(CodeGenAttributes_Mod)
  817. TEST_METHOD(CodeGenConst_Exprb_Mod)
  818. TEST_METHOD(CodeGenConst_Expr_Mod)
  819. TEST_METHOD(CodeGenFunctions_Mod)
  820. TEST_METHOD(CodeGenImplicit_Casts_Mod)
  821. TEST_METHOD(CodeGenIndexing_Operator_Mod)
  822. TEST_METHOD(CodeGenIntrinsic_Examples_Mod)
  823. TEST_METHOD(CodeGenLiterals_Mod)
  824. TEST_METHOD(CodeGenLiterals_Exact_Precision_Mod)
  825. TEST_METHOD(CodeGenMatrix_Assignments_Mod)
  826. TEST_METHOD(CodeGenMatrix_Syntax_Mod)
  827. //TEST_METHOD(CodeGenMore_Operators_Mod)
  828. //TEST_METHOD(CodeGenObject_Operators_Mod)
  829. TEST_METHOD(CodeGenPackreg_Mod)
  830. TEST_METHOD(CodeGenParentMethod)
  831. TEST_METHOD(CodeGenParameter_Types)
  832. TEST_METHOD(CodeGenScalar_Assignments_Mod)
  833. TEST_METHOD(CodeGenScalar_Operators_Assign_Mod)
  834. TEST_METHOD(CodeGenScalar_Operators_Mod)
  835. TEST_METHOD(CodeGenSemantics_Mod)
  836. //TEST_METHOD(CodeGenSpec_Mod)
  837. TEST_METHOD(CodeGenString_Mod)
  838. TEST_METHOD(CodeGenStruct_Assignments_Mod)
  839. TEST_METHOD(CodeGenStruct_AssignmentsFull_Mod)
  840. TEST_METHOD(CodeGenTemplate_Checks_Mod)
  841. TEST_METHOD(CodeGenToinclude2_Mod)
  842. TEST_METHOD(CodeGenTypemods_Syntax_Mod)
  843. TEST_METHOD(CodeGenTypedBufferHalf)
  844. TEST_METHOD(CodeGenTypedefNewType)
  845. TEST_METHOD(CodeGenVarmods_Syntax_Mod)
  846. TEST_METHOD(CodeGenVector_Assignments_Mod)
  847. TEST_METHOD(CodeGenVector_Syntax_Mix_Mod)
  848. TEST_METHOD(CodeGenVector_Syntax_Mod)
  849. TEST_METHOD(CodeGenBasicHLSL11_PS)
  850. TEST_METHOD(CodeGenBasicHLSL11_PS2)
  851. TEST_METHOD(CodeGenBasicHLSL11_PS3)
  852. TEST_METHOD(CodeGenBasicHLSL11_VS)
  853. TEST_METHOD(CodeGenBasicHLSL11_VS2)
  854. TEST_METHOD(CodeGenVecIndexingInput)
  855. TEST_METHOD(CodeGenVecMulMat)
  856. TEST_METHOD(CodeGenVecArrayParam)
  857. TEST_METHOD(CodeGenBindings1)
  858. TEST_METHOD(CodeGenBindings2)
  859. TEST_METHOD(CodeGenBindings3)
  860. TEST_METHOD(CodeGenResCopy)
  861. TEST_METHOD(CodeGenResourceParam)
  862. TEST_METHOD(CodeGenResourceInCB)
  863. TEST_METHOD(CodeGenResourceInCB2)
  864. TEST_METHOD(CodeGenResourceInCB3)
  865. TEST_METHOD(CodeGenResourceInCB4)
  866. TEST_METHOD(CodeGenResourceInCBV)
  867. TEST_METHOD(CodeGenResourceInCBV2)
  868. TEST_METHOD(CodeGenResourceInStruct)
  869. TEST_METHOD(CodeGenResourceInStruct2)
  870. TEST_METHOD(CodeGenResourceInStruct3)
  871. TEST_METHOD(CodeGenResourceInTB)
  872. TEST_METHOD(CodeGenResourceInTB2)
  873. TEST_METHOD(CodeGenResourceInTBV)
  874. TEST_METHOD(CodeGenResourceInTBV2)
  875. TEST_METHOD(CodeGenResourceArrayParam)
  876. TEST_METHOD(CodeGenResPhi)
  877. TEST_METHOD(CodeGenResPhi2)
  878. TEST_METHOD(CodeGenRootSigEntry)
  879. TEST_METHOD(CodeGenRootSigProfile)
  880. TEST_METHOD(CodeGenRootSigProfile2)
  881. TEST_METHOD(CodeGenRootSigProfile3)
  882. TEST_METHOD(CodeGenRootSigProfile4)
  883. TEST_METHOD(CodeGenRootSigProfile5)
  884. TEST_METHOD(CodeGenRootSigDefine1)
  885. TEST_METHOD(CodeGenRootSigDefine2)
  886. TEST_METHOD(CodeGenRootSigDefine3)
  887. TEST_METHOD(CodeGenRootSigDefine4)
  888. TEST_METHOD(CodeGenRootSigDefine5)
  889. TEST_METHOD(CodeGenRootSigDefine6)
  890. TEST_METHOD(CodeGenRootSigDefine7)
  891. TEST_METHOD(CodeGenRootSigDefine8)
  892. TEST_METHOD(CodeGenRootSigDefine9)
  893. TEST_METHOD(CodeGenRootSigDefine10)
  894. TEST_METHOD(CodeGenRootSigDefine11)
  895. TEST_METHOD(CodeGenCBufferStruct)
  896. TEST_METHOD(CodeGenCBufferStructArray)
  897. TEST_METHOD(CodeGenPatchLength)
  898. TEST_METHOD(PreprocessWhenValidThenOK)
  899. TEST_METHOD(PreprocessWhenExpandTokenPastingOperandThenAccept)
  900. TEST_METHOD(WhenSigMismatchPCFunctionThenFail)
  901. // Dx11 Sample
  902. TEST_METHOD(CodeGenDX11Sample_2Dquadshaders_Blurx_Ps)
  903. TEST_METHOD(CodeGenDX11Sample_2Dquadshaders_Blury_Ps)
  904. TEST_METHOD(CodeGenDX11Sample_2Dquadshaders_Vs)
  905. TEST_METHOD(CodeGenDX11Sample_Bc6Hdecode)
  906. TEST_METHOD(CodeGenDX11Sample_Bc6Hencode_Encodeblockcs)
  907. TEST_METHOD(CodeGenDX11Sample_Bc6Hencode_Trymodeg10Cs)
  908. TEST_METHOD(CodeGenDX11Sample_Bc6Hencode_Trymodele10Cs)
  909. TEST_METHOD(CodeGenDX11Sample_Bc7Decode)
  910. TEST_METHOD(CodeGenDX11Sample_Bc7Encode_Encodeblockcs)
  911. TEST_METHOD(CodeGenDX11Sample_Bc7Encode_Trymode02Cs)
  912. TEST_METHOD(CodeGenDX11Sample_Bc7Encode_Trymode137Cs)
  913. TEST_METHOD(CodeGenDX11Sample_Bc7Encode_Trymode456Cs)
  914. TEST_METHOD(CodeGenDX11Sample_Brightpassandhorizfiltercs)
  915. TEST_METHOD(CodeGenDX11Sample_Computeshadersort11)
  916. TEST_METHOD(CodeGenDX11Sample_Computeshadersort11_Matrixtranspose)
  917. TEST_METHOD(CodeGenDX11Sample_Contacthardeningshadows11_Ps)
  918. TEST_METHOD(CodeGenDX11Sample_Contacthardeningshadows11_Sm_Vs)
  919. TEST_METHOD(CodeGenDX11Sample_Contacthardeningshadows11_Vs)
  920. TEST_METHOD(CodeGenDX11Sample_Decaltessellation11_Ds)
  921. TEST_METHOD(CodeGenDX11Sample_Decaltessellation11_Hs)
  922. TEST_METHOD(CodeGenDX11Sample_Decaltessellation11_Ps)
  923. TEST_METHOD(CodeGenDX11Sample_Decaltessellation11_Tessvs)
  924. TEST_METHOD(CodeGenDX11Sample_Decaltessellation11_Vs)
  925. TEST_METHOD(CodeGenDX11Sample_Detailtessellation11_Ds)
  926. TEST_METHOD(CodeGenDX11Sample_Detailtessellation11_Hs)
  927. TEST_METHOD(CodeGenDX11Sample_Detailtessellation11_Ps)
  928. TEST_METHOD(CodeGenDX11Sample_Detailtessellation11_Tessvs)
  929. TEST_METHOD(CodeGenDX11Sample_Detailtessellation11_Vs)
  930. TEST_METHOD(CodeGenDX11Sample_Dumptotexture)
  931. TEST_METHOD(CodeGenDX11Sample_Filtercs_Horz)
  932. TEST_METHOD(CodeGenDX11Sample_Filtercs_Vertical)
  933. TEST_METHOD(CodeGenDX11Sample_Finalpass_Cpu_Ps)
  934. TEST_METHOD(CodeGenDX11Sample_Finalpass_Ps)
  935. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Buildgridcs)
  936. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Buildgridindicescs)
  937. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Cleargridindicescs)
  938. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Densitycs_Grid)
  939. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Densitycs_Shared)
  940. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Densitycs_Simple)
  941. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Forcecs_Grid)
  942. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Forcecs_Shared)
  943. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Forcecs_Simple)
  944. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Integratecs)
  945. TEST_METHOD(CodeGenDX11Sample_Fluidcs11_Rearrangeparticlescs)
  946. TEST_METHOD(CodeGenDX11Sample_Fluidrender_Gs)
  947. TEST_METHOD(CodeGenDX11Sample_Fluidrender_Vs)
  948. TEST_METHOD(CodeGenDX11Sample_Nbodygravitycs11)
  949. TEST_METHOD(CodeGenDX11Sample_Oit_Createprefixsum_Pass0_Cs)
  950. TEST_METHOD(CodeGenDX11Sample_Oit_Createprefixsum_Pass1_Cs)
  951. TEST_METHOD(CodeGenDX11Sample_Oit_Fragmentcountps)
  952. TEST_METHOD(CodeGenDX11Sample_Oit_Ps)
  953. TEST_METHOD(CodeGenDX11Sample_Oit_Sortandrendercs)
  954. TEST_METHOD(CodeGenDX11Sample_Particledraw_Gs)
  955. TEST_METHOD(CodeGenDX11Sample_Particledraw_Vs)
  956. TEST_METHOD(CodeGenDX11Sample_Particle_Gs)
  957. TEST_METHOD(CodeGenDX11Sample_Particle_Ps)
  958. TEST_METHOD(CodeGenDX11Sample_Particle_Vs)
  959. TEST_METHOD(CodeGenDX11Sample_Pntriangles11_Ds)
  960. TEST_METHOD(CodeGenDX11Sample_Pntriangles11_Hs)
  961. TEST_METHOD(CodeGenDX11Sample_Pntriangles11_Tessvs)
  962. TEST_METHOD(CodeGenDX11Sample_Pntriangles11_Vs)
  963. TEST_METHOD(CodeGenDX11Sample_Pom_Ps)
  964. TEST_METHOD(CodeGenDX11Sample_Pom_Vs)
  965. TEST_METHOD(CodeGenDX11Sample_Psapproach_Bloomps)
  966. TEST_METHOD(CodeGenDX11Sample_Psapproach_Downscale2X2_Lumps)
  967. TEST_METHOD(CodeGenDX11Sample_Psapproach_Downscale3X3Ps)
  968. TEST_METHOD(CodeGenDX11Sample_Psapproach_Downscale3X3_Brightpassps)
  969. TEST_METHOD(CodeGenDX11Sample_Psapproach_Finalpassps)
  970. TEST_METHOD(CodeGenDX11Sample_Reduceto1Dcs)
  971. TEST_METHOD(CodeGenDX11Sample_Reducetosinglecs)
  972. TEST_METHOD(CodeGenDX11Sample_Rendervariancesceneps)
  973. TEST_METHOD(CodeGenDX11Sample_Rendervs)
  974. TEST_METHOD(CodeGenDX11Sample_Simplebezier11Ds)
  975. TEST_METHOD(CodeGenDX11Sample_Simplebezier11Hs)
  976. TEST_METHOD(CodeGenDX11Sample_Simplebezier11Ps)
  977. TEST_METHOD(CodeGenDX11Sample_Subd11_Bezierevalds)
  978. TEST_METHOD(CodeGenDX11Sample_Subd11_Meshskinningvs)
  979. TEST_METHOD(CodeGenDX11Sample_Subd11_Patchskinningvs)
  980. TEST_METHOD(CodeGenDX11Sample_Subd11_Smoothps)
  981. TEST_METHOD(CodeGenDX11Sample_Subd11_Subdtobezierhs)
  982. TEST_METHOD(CodeGenDX11Sample_Subd11_Subdtobezierhs4444)
  983. TEST_METHOD(CodeGenDX11Sample_Tessellatorcs40_Edgefactorcs)
  984. TEST_METHOD(CodeGenDX11Sample_Tessellatorcs40_Numverticesindicescs)
  985. TEST_METHOD(CodeGenDX11Sample_Tessellatorcs40_Scatteridcs)
  986. TEST_METHOD(CodeGenDX11Sample_Tessellatorcs40_Tessellateindicescs)
  987. TEST_METHOD(CodeGenDX11Sample_Tessellatorcs40_Tessellateverticescs)
  988. // Dx12 Sample
  989. TEST_METHOD(CodeGenSamplesD12_DynamicIndexing_PS)
  990. TEST_METHOD(CodeGenSamplesD12_ExecuteIndirect_CS)
  991. TEST_METHOD(CodeGenSamplesD12_MultiThreading_VS)
  992. TEST_METHOD(CodeGenSamplesD12_MultiThreading_PS)
  993. TEST_METHOD(CodeGenSamplesD12_NBodyGravity_CS)
  994. // Dx12 samples/MiniEngine.
  995. TEST_METHOD(CodeGenDx12MiniEngineAdaptexposurecs)
  996. TEST_METHOD(CodeGenDx12MiniEngineAoblurupsampleblendoutcs)
  997. TEST_METHOD(CodeGenDx12MiniEngineAoblurupsamplecs)
  998. TEST_METHOD(CodeGenDx12MiniEngineAoblurupsamplepreminblendoutcs)
  999. TEST_METHOD(CodeGenDx12MiniEngineAoblurupsamplepremincs)
  1000. TEST_METHOD(CodeGenDx12MiniEngineAopreparedepthbuffers1Cs)
  1001. TEST_METHOD(CodeGenDx12MiniEngineAopreparedepthbuffers2Cs)
  1002. TEST_METHOD(CodeGenDx12MiniEngineAorender1Cs)
  1003. TEST_METHOD(CodeGenDx12MiniEngineAorender2Cs)
  1004. TEST_METHOD(CodeGenDx12MiniEngineApplybloomcs)
  1005. TEST_METHOD(CodeGenDx12MiniEngineAveragelumacs)
  1006. TEST_METHOD(CodeGenDx12MiniEngineBicubichorizontalupsampleps)
  1007. TEST_METHOD(CodeGenDx12MiniEngineBicubicupsamplegammaps)
  1008. TEST_METHOD(CodeGenDx12MiniEngineBicubicupsampleps)
  1009. TEST_METHOD(CodeGenDx12MiniEngineBicubicverticalupsampleps)
  1010. TEST_METHOD(CodeGenDx12MiniEngineBilinearupsampleps)
  1011. TEST_METHOD(CodeGenDx12MiniEngineBloomextractanddownsamplehdrcs)
  1012. TEST_METHOD(CodeGenDx12MiniEngineBloomextractanddownsampleldrcs)
  1013. TEST_METHOD(CodeGenDx12MiniEngineBlurcs)
  1014. TEST_METHOD(CodeGenDx12MiniEngineBuffercopyps)
  1015. TEST_METHOD(CodeGenDx12MiniEngineCameramotionblurprepasscs)
  1016. TEST_METHOD(CodeGenDx12MiniEngineCameramotionblurprepasslinearzcs)
  1017. TEST_METHOD(CodeGenDx12MiniEngineCameravelocitycs)
  1018. TEST_METHOD(CodeGenDx12MiniEngineConvertldrtodisplayaltps)
  1019. TEST_METHOD(CodeGenDx12MiniEngineConvertldrtodisplayps)
  1020. TEST_METHOD(CodeGenDx12MiniEngineDebugdrawhistogramcs)
  1021. TEST_METHOD(CodeGenDx12MiniEngineDebugluminancehdrcs)
  1022. TEST_METHOD(CodeGenDx12MiniEngineDebugluminanceldrcs)
  1023. TEST_METHOD(CodeGenDx12MiniEngineDebugssaocs)
  1024. TEST_METHOD(CodeGenDx12MiniEngineDepthviewerps)
  1025. TEST_METHOD(CodeGenDx12MiniEngineDepthviewervs)
  1026. TEST_METHOD(CodeGenDx12MiniEngineDownsamplebloomallcs)
  1027. TEST_METHOD(CodeGenDx12MiniEngineDownsamplebloomcs)
  1028. TEST_METHOD(CodeGenDx12MiniEngineExtractlumacs)
  1029. TEST_METHOD(CodeGenDx12MiniEngineFxaapass1_Luma_Cs)
  1030. TEST_METHOD(CodeGenDx12MiniEngineFxaapass1_Rgb_Cs)
  1031. TEST_METHOD(CodeGenDx12MiniEngineFxaapass2Hcs)
  1032. TEST_METHOD(CodeGenDx12MiniEngineFxaapass2Hdebugcs)
  1033. TEST_METHOD(CodeGenDx12MiniEngineFxaapass2Vcs)
  1034. TEST_METHOD(CodeGenDx12MiniEngineFxaapass2Vdebugcs)
  1035. TEST_METHOD(CodeGenDx12MiniEngineFxaaresolveworkqueuecs)
  1036. TEST_METHOD(CodeGenDx12MiniEngineGeneratehistogramcs)
  1037. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipsgammacs)
  1038. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipsgammaoddcs)
  1039. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipsgammaoddxcs)
  1040. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipsgammaoddycs)
  1041. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipslinearcs)
  1042. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipslinearoddcs)
  1043. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipslinearoddxcs)
  1044. TEST_METHOD(CodeGenDx12MiniEngineGeneratemipslinearoddycs)
  1045. TEST_METHOD(CodeGenDx12MiniEngineLinearizedepthcs)
  1046. TEST_METHOD(CodeGenDx12MiniEngineMagnifypixelsps)
  1047. TEST_METHOD(CodeGenDx12MiniEngineModelviewerps)
  1048. TEST_METHOD(CodeGenDx12MiniEngineModelviewervs)
  1049. TEST_METHOD(CodeGenDx12MiniEngineMotionblurfinalpasscs)
  1050. TEST_METHOD(CodeGenDx12MiniEngineMotionblurfinalpasstemporalcs)
  1051. TEST_METHOD(CodeGenDx12MiniEngineMotionblurprepasscs)
  1052. TEST_METHOD(CodeGenDx12MiniEngineParticlebincullingcs)
  1053. TEST_METHOD(CodeGenDx12MiniEngineParticledepthboundscs)
  1054. TEST_METHOD(CodeGenDx12MiniEngineParticledispatchindirectargscs)
  1055. TEST_METHOD(CodeGenDx12MiniEngineParticlefinaldispatchindirectargscs)
  1056. TEST_METHOD(CodeGenDx12MiniEngineParticleinnersortcs)
  1057. TEST_METHOD(CodeGenDx12MiniEngineParticlelargebincullingcs)
  1058. TEST_METHOD(CodeGenDx12MiniEngineParticleoutersortcs)
  1059. TEST_METHOD(CodeGenDx12MiniEngineParticlepresortcs)
  1060. TEST_METHOD(CodeGenDx12MiniEngineParticleps)
  1061. TEST_METHOD(CodeGenDx12MiniEngineParticlesortindirectargscs)
  1062. TEST_METHOD(CodeGenDx12MiniEngineParticlespawncs)
  1063. TEST_METHOD(CodeGenDx12MiniEngineParticletilecullingcs)
  1064. TEST_METHOD(CodeGenDx12MiniEngineParticletilerendercs)
  1065. TEST_METHOD(CodeGenDx12MiniEngineParticletilerenderfastcs)
  1066. TEST_METHOD(CodeGenDx12MiniEngineParticletilerenderfastdynamiccs)
  1067. TEST_METHOD(CodeGenDx12MiniEngineParticletilerenderfastlowrescs)
  1068. TEST_METHOD(CodeGenDx12MiniEngineParticletilerenderslowdynamiccs)
  1069. TEST_METHOD(CodeGenDx12MiniEngineParticletilerenderslowlowrescs)
  1070. TEST_METHOD(CodeGenDx12MiniEngineParticleupdatecs)
  1071. TEST_METHOD(CodeGenDx12MiniEngineParticlevs)
  1072. TEST_METHOD(CodeGenDx12MiniEnginePerfgraphbackgroundvs)
  1073. TEST_METHOD(CodeGenDx12MiniEnginePerfgraphps)
  1074. TEST_METHOD(CodeGenDx12MiniEnginePerfgraphvs)
  1075. TEST_METHOD(CodeGenDx12MiniEngineScreenquadvs)
  1076. TEST_METHOD(CodeGenDx12MiniEngineSharpeningupsamplegammaps)
  1077. TEST_METHOD(CodeGenDx12MiniEngineSharpeningupsampleps)
  1078. TEST_METHOD(CodeGenDx12MiniEngineTemporalblendcs)
  1079. TEST_METHOD(CodeGenDx12MiniEngineTextantialiasps)
  1080. TEST_METHOD(CodeGenDx12MiniEngineTextshadowps)
  1081. TEST_METHOD(CodeGenDx12MiniEngineTextvs)
  1082. TEST_METHOD(CodeGenDx12MiniEngineTonemap2Cs)
  1083. TEST_METHOD(CodeGenDx12MiniEngineTonemapcs)
  1084. TEST_METHOD(CodeGenDx12MiniEngineUpsampleandblurcs)
  1085. TEST_METHOD(DxilGen_StoreOutput)
  1086. TEST_METHOD(ConstantFolding)
  1087. TEST_METHOD(HoistConstantArray)
  1088. TEST_METHOD(VecElemConstEval)
  1089. TEST_METHOD(ViewID)
  1090. TEST_METHOD(ShaderCompatSuite)
  1091. TEST_METHOD(QuickTest)
  1092. TEST_METHOD(QuickLlTest)
  1093. BEGIN_TEST_METHOD(SingleFileCheckTest)
  1094. TEST_METHOD_PROPERTY(L"Ignore", L"true")
  1095. END_TEST_METHOD()
  1096. dxc::DxcDllSupport m_dllSupport;
  1097. VersionSupportInfo m_ver;
  1098. void CreateBlobPinned(_In_bytecount_(size) LPCVOID data, SIZE_T size,
  1099. UINT32 codePage, _Outptr_ IDxcBlobEncoding **ppBlob) {
  1100. CComPtr<IDxcLibrary> library;
  1101. IFT(m_dllSupport.CreateInstance(CLSID_DxcLibrary, &library));
  1102. IFT(library->CreateBlobWithEncodingFromPinned((LPBYTE)data, size, codePage,
  1103. ppBlob));
  1104. }
  1105. void CreateBlobFromFile(LPCWSTR name, _Outptr_ IDxcBlobEncoding **ppBlob) {
  1106. CComPtr<IDxcLibrary> library;
  1107. IFT(m_dllSupport.CreateInstance(CLSID_DxcLibrary, &library));
  1108. const std::wstring path = hlsl_test::GetPathToHlslDataFile(name);
  1109. IFT(library->CreateBlobFromFile(path.c_str(), nullptr, ppBlob));
  1110. }
  1111. void CreateBlobFromText(_In_z_ const char *pText,
  1112. _Outptr_ IDxcBlobEncoding **ppBlob) {
  1113. CreateBlobPinned(pText, strlen(pText), CP_UTF8, ppBlob);
  1114. }
  1115. HRESULT CreateCompiler(IDxcCompiler **ppResult) {
  1116. return m_dllSupport.CreateInstance(CLSID_DxcCompiler, ppResult);
  1117. }
  1118. HRESULT CreateContainerBuilder(IDxcContainerBuilder **ppResult) {
  1119. return m_dllSupport.CreateInstance(CLSID_DxcContainerBuilder, ppResult);
  1120. }
  1121. template <typename T, typename TDefault, typename TIface>
  1122. void WriteIfValue(TIface *pSymbol, std::wstringstream &o,
  1123. TDefault defaultValue, LPCWSTR valueLabel,
  1124. HRESULT (__stdcall TIface::*pFn)(T *)) {
  1125. T value;
  1126. HRESULT hr = (pSymbol->*(pFn))(&value);
  1127. if (SUCCEEDED(hr) && value != defaultValue) {
  1128. o << L", " << valueLabel << L": " << value;
  1129. }
  1130. }
  1131. template <typename TIface>
  1132. void WriteIfValue(TIface *pSymbol, std::wstringstream &o,
  1133. LPCWSTR valueLabel, HRESULT(__stdcall TIface::*pFn)(BSTR *)) {
  1134. CComBSTR value;
  1135. HRESULT hr = (pSymbol->*(pFn))(&value);
  1136. if (SUCCEEDED(hr) && value.Length()) {
  1137. o << L", " << valueLabel << L": " << (LPCWSTR)value;
  1138. }
  1139. }
  1140. template <typename TIface>
  1141. void WriteIfValue(TIface *pSymbol, std::wstringstream &o,
  1142. LPCWSTR valueLabel, HRESULT(__stdcall TIface::*pFn)(VARIANT *)) {
  1143. CComVariant value;
  1144. HRESULT hr = (pSymbol->*(pFn))(&value);
  1145. if (SUCCEEDED(hr) && value.vt != VT_NULL && value.vt != VT_EMPTY) {
  1146. if (SUCCEEDED(value.ChangeType(VT_BSTR))) {
  1147. o << L", " << valueLabel << L": " << (LPCWSTR)value.bstrVal;
  1148. }
  1149. }
  1150. }
  1151. template <typename TIface>
  1152. void WriteIfValue(TIface *pSymbol, std::wstringstream &o,
  1153. LPCWSTR valueLabel, HRESULT(__stdcall TIface::*pFn)(IDiaSymbol **)) {
  1154. CComPtr<IDiaSymbol> value;
  1155. HRESULT hr = (pSymbol->*(pFn))(&value);
  1156. if (SUCCEEDED(hr) && value.p != nullptr) {
  1157. DWORD symId;
  1158. value->get_symIndexId(&symId);
  1159. o << L", " << valueLabel << L": id=" << symId;
  1160. }
  1161. }
  1162. std::wstring GetDebugInfoAsText(_In_ IDiaDataSource* pDataSource) {
  1163. CComPtr<IDiaSession> pSession;
  1164. CComPtr<IDiaTable> pTable;
  1165. CComPtr<IDiaEnumTables> pEnumTables;
  1166. std::wstringstream o;
  1167. VERIFY_SUCCEEDED(pDataSource->openSession(&pSession));
  1168. VERIFY_SUCCEEDED(pSession->getEnumTables(&pEnumTables));
  1169. LONG count;
  1170. VERIFY_SUCCEEDED(pEnumTables->get_Count(&count));
  1171. for (LONG i = 0; i < count; ++i) {
  1172. pTable.Release();
  1173. ULONG fetched;
  1174. VERIFY_SUCCEEDED(pEnumTables->Next(1, &pTable, &fetched));
  1175. VERIFY_ARE_EQUAL(fetched, 1);
  1176. CComBSTR tableName;
  1177. VERIFY_SUCCEEDED(pTable->get_name(&tableName));
  1178. o << L"Table: " << (LPWSTR)tableName << std::endl;
  1179. LONG rowCount;
  1180. IFT(pTable->get_Count(&rowCount));
  1181. o << L" Row count: " << rowCount << std::endl;
  1182. for (LONG rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
  1183. CComPtr<IUnknown> item;
  1184. o << L'#' << rowIndex;
  1185. IFT(pTable->Item(rowIndex, &item));
  1186. CComPtr<IDiaSymbol> pSymbol;
  1187. if (SUCCEEDED(item.QueryInterface(&pSymbol))) {
  1188. DWORD symTag;
  1189. DWORD dataKind;
  1190. DWORD locationType;
  1191. DWORD registerId;
  1192. pSymbol->get_symTag(&symTag);
  1193. pSymbol->get_dataKind(&dataKind);
  1194. pSymbol->get_locationType(&locationType);
  1195. pSymbol->get_registerId(&registerId);
  1196. //pSymbol->get_value(&value);
  1197. WriteIfValue(pSymbol.p, o, 0, L"symIndexId", &IDiaSymbol::get_symIndexId);
  1198. o << L", " << SymTagEnumText[symTag];
  1199. if (dataKind != 0) o << L", " << DataKindText[dataKind];
  1200. WriteIfValue(pSymbol.p, o, L"name", &IDiaSymbol::get_name);
  1201. WriteIfValue(pSymbol.p, o, L"lexicalParent", &IDiaSymbol::get_lexicalParent);
  1202. WriteIfValue(pSymbol.p, o, L"type", &IDiaSymbol::get_type);
  1203. WriteIfValue(pSymbol.p, o, 0, L"slot", &IDiaSymbol::get_slot);
  1204. WriteIfValue(pSymbol.p, o, 0, L"platform", &IDiaSymbol::get_platform);
  1205. WriteIfValue(pSymbol.p, o, 0, L"language", &IDiaSymbol::get_language);
  1206. WriteIfValue(pSymbol.p, o, 0, L"frontEndMajor", &IDiaSymbol::get_frontEndMajor);
  1207. WriteIfValue(pSymbol.p, o, 0, L"frontEndMinor", &IDiaSymbol::get_frontEndMinor);
  1208. WriteIfValue(pSymbol.p, o, 0, L"token", &IDiaSymbol::get_token);
  1209. WriteIfValue(pSymbol.p, o, L"value", &IDiaSymbol::get_value);
  1210. WriteIfValue(pSymbol.p, o, 0, L"code", &IDiaSymbol::get_code);
  1211. WriteIfValue(pSymbol.p, o, 0, L"function", &IDiaSymbol::get_function);
  1212. WriteIfValue(pSymbol.p, o, 0, L"udtKind", &IDiaSymbol::get_udtKind);
  1213. WriteIfValue(pSymbol.p, o, 0, L"hasDebugInfo", &IDiaSymbol::get_hasDebugInfo);
  1214. WriteIfValue(pSymbol.p, o, L"compilerName", &IDiaSymbol::get_compilerName);
  1215. WriteIfValue(pSymbol.p, o, 0, L"isLocationControlFlowDependent", &IDiaSymbol::get_isLocationControlFlowDependent);
  1216. WriteIfValue(pSymbol.p, o, 0, L"numberOfRows", &IDiaSymbol::get_numberOfRows);
  1217. WriteIfValue(pSymbol.p, o, 0, L"numberOfColumns", &IDiaSymbol::get_numberOfColumns);
  1218. WriteIfValue(pSymbol.p, o, 0, L"length", &IDiaSymbol::get_length);
  1219. WriteIfValue(pSymbol.p, o, 0, L"isMatrixRowMajor", &IDiaSymbol::get_isMatrixRowMajor);
  1220. WriteIfValue(pSymbol.p, o, 0, L"builtInKind", &IDiaSymbol::get_builtInKind);
  1221. WriteIfValue(pSymbol.p, o, 0, L"textureSlot", &IDiaSymbol::get_textureSlot);
  1222. WriteIfValue(pSymbol.p, o, 0, L"memorySpaceKind", &IDiaSymbol::get_memorySpaceKind);
  1223. WriteIfValue(pSymbol.p, o, 0, L"isHLSLData", &IDiaSymbol::get_isHLSLData);
  1224. }
  1225. CComPtr<IDiaSourceFile> pSourceFile;
  1226. if (SUCCEEDED(item.QueryInterface(&pSourceFile))) {
  1227. WriteIfValue(pSourceFile.p, o, 0, L"uniqueId", &IDiaSourceFile::get_uniqueId);
  1228. WriteIfValue(pSourceFile.p, o, L"fileName", &IDiaSourceFile::get_fileName);
  1229. }
  1230. CComPtr<IDiaLineNumber> pLineNumber;
  1231. if (SUCCEEDED(item.QueryInterface(&pLineNumber))) {
  1232. WriteIfValue(pLineNumber.p, o, L"compiland", &IDiaLineNumber::get_compiland);
  1233. //WriteIfValue(pLineNumber.p, o, L"sourceFile", &IDiaLineNumber::get_sourceFile);
  1234. WriteIfValue(pLineNumber.p, o, 0, L"lineNumber", &IDiaLineNumber::get_lineNumber);
  1235. WriteIfValue(pLineNumber.p, o, 0, L"lineNumberEnd", &IDiaLineNumber::get_lineNumberEnd);
  1236. WriteIfValue(pLineNumber.p, o, 0, L"columnNumber", &IDiaLineNumber::get_columnNumber);
  1237. WriteIfValue(pLineNumber.p, o, 0, L"columnNumberEnd", &IDiaLineNumber::get_columnNumberEnd);
  1238. WriteIfValue(pLineNumber.p, o, 0, L"addressSection", &IDiaLineNumber::get_addressSection);
  1239. WriteIfValue(pLineNumber.p, o, 0, L"addressOffset", &IDiaLineNumber::get_addressOffset);
  1240. WriteIfValue(pLineNumber.p, o, 0, L"relativeVirtualAddress", &IDiaLineNumber::get_relativeVirtualAddress);
  1241. WriteIfValue(pLineNumber.p, o, 0, L"virtualAddress", &IDiaLineNumber::get_virtualAddress);
  1242. WriteIfValue(pLineNumber.p, o, 0, L"length", &IDiaLineNumber::get_length);
  1243. WriteIfValue(pLineNumber.p, o, 0, L"sourceFileId", &IDiaLineNumber::get_sourceFileId);
  1244. WriteIfValue(pLineNumber.p, o, 0, L"statement", &IDiaLineNumber::get_statement);
  1245. WriteIfValue(pLineNumber.p, o, 0, L"compilandId", &IDiaLineNumber::get_compilandId);
  1246. }
  1247. CComPtr<IDiaSectionContrib> pSectionContrib;
  1248. if (SUCCEEDED(item.QueryInterface(&pSectionContrib))) {
  1249. WriteIfValue(pSectionContrib.p, o, L"compiland", &IDiaSectionContrib::get_compiland);
  1250. WriteIfValue(pSectionContrib.p, o, 0, L"addressSection", &IDiaSectionContrib::get_addressSection);
  1251. WriteIfValue(pSectionContrib.p, o, 0, L"addressOffset", &IDiaSectionContrib::get_addressOffset);
  1252. WriteIfValue(pSectionContrib.p, o, 0, L"relativeVirtualAddress", &IDiaSectionContrib::get_relativeVirtualAddress);
  1253. WriteIfValue(pSectionContrib.p, o, 0, L"virtualAddress", &IDiaSectionContrib::get_virtualAddress);
  1254. WriteIfValue(pSectionContrib.p, o, 0, L"length", &IDiaSectionContrib::get_length);
  1255. WriteIfValue(pSectionContrib.p, o, 0, L"notPaged", &IDiaSectionContrib::get_notPaged);
  1256. WriteIfValue(pSectionContrib.p, o, 0, L"code", &IDiaSectionContrib::get_code);
  1257. WriteIfValue(pSectionContrib.p, o, 0, L"initializedData", &IDiaSectionContrib::get_initializedData);
  1258. WriteIfValue(pSectionContrib.p, o, 0, L"uninitializedData", &IDiaSectionContrib::get_uninitializedData);
  1259. WriteIfValue(pSectionContrib.p, o, 0, L"remove", &IDiaSectionContrib::get_remove);
  1260. WriteIfValue(pSectionContrib.p, o, 0, L"comdat", &IDiaSectionContrib::get_comdat);
  1261. WriteIfValue(pSectionContrib.p, o, 0, L"discardable", &IDiaSectionContrib::get_discardable);
  1262. WriteIfValue(pSectionContrib.p, o, 0, L"notCached", &IDiaSectionContrib::get_notCached);
  1263. WriteIfValue(pSectionContrib.p, o, 0, L"share", &IDiaSectionContrib::get_share);
  1264. WriteIfValue(pSectionContrib.p, o, 0, L"execute", &IDiaSectionContrib::get_execute);
  1265. WriteIfValue(pSectionContrib.p, o, 0, L"read", &IDiaSectionContrib::get_read);
  1266. WriteIfValue(pSectionContrib.p, o, 0, L"write", &IDiaSectionContrib::get_write);
  1267. WriteIfValue(pSectionContrib.p, o, 0, L"dataCrc", &IDiaSectionContrib::get_dataCrc);
  1268. WriteIfValue(pSectionContrib.p, o, 0, L"relocationsCrc", &IDiaSectionContrib::get_relocationsCrc);
  1269. WriteIfValue(pSectionContrib.p, o, 0, L"compilandId", &IDiaSectionContrib::get_compilandId);
  1270. }
  1271. CComPtr<IDiaSegment> pSegment;
  1272. if (SUCCEEDED(item.QueryInterface(&pSegment))) {
  1273. WriteIfValue(pSegment.p, o, 0, L"frame", &IDiaSegment::get_frame);
  1274. WriteIfValue(pSegment.p, o, 0, L"offset", &IDiaSegment::get_offset);
  1275. WriteIfValue(pSegment.p, o, 0, L"length", &IDiaSegment::get_length);
  1276. WriteIfValue(pSegment.p, o, 0, L"read", &IDiaSegment::get_read);
  1277. WriteIfValue(pSegment.p, o, 0, L"write", &IDiaSegment::get_write);
  1278. WriteIfValue(pSegment.p, o, 0, L"execute", &IDiaSegment::get_execute);
  1279. WriteIfValue(pSegment.p, o, 0, L"addressSection", &IDiaSegment::get_addressSection);
  1280. WriteIfValue(pSegment.p, o, 0, L"relativeVirtualAddress", &IDiaSegment::get_relativeVirtualAddress);
  1281. WriteIfValue(pSegment.p, o, 0, L"virtualAddress", &IDiaSegment::get_virtualAddress);
  1282. }
  1283. CComPtr<IDiaInjectedSource> pInjectedSource;
  1284. if (SUCCEEDED(item.QueryInterface(&pInjectedSource))) {
  1285. WriteIfValue(pInjectedSource.p, o, 0, L"crc", &IDiaInjectedSource::get_crc);
  1286. WriteIfValue(pInjectedSource.p, o, 0, L"length", &IDiaInjectedSource::get_length);
  1287. WriteIfValue(pInjectedSource.p, o, L"filename", &IDiaInjectedSource::get_filename);
  1288. WriteIfValue(pInjectedSource.p, o, L"objectFilename", &IDiaInjectedSource::get_objectFilename);
  1289. WriteIfValue(pInjectedSource.p, o, L"virtualFilename", &IDiaInjectedSource::get_virtualFilename);
  1290. WriteIfValue(pInjectedSource.p, o, 0, L"sourceCompression", &IDiaInjectedSource::get_sourceCompression);
  1291. // get_source is also available
  1292. }
  1293. CComPtr<IDiaFrameData> pFrameData;
  1294. if (SUCCEEDED(item.QueryInterface(&pFrameData))) {
  1295. }
  1296. o << std::endl;
  1297. }
  1298. }
  1299. return o.str();
  1300. }
  1301. std::wstring GetDebugFileContent(_In_ IDiaDataSource *pDataSource) {
  1302. CComPtr<IDiaSession> pSession;
  1303. CComPtr<IDiaTable> pTable;
  1304. CComPtr<IDiaTable> pSourcesTable;
  1305. CComPtr<IDiaEnumTables> pEnumTables;
  1306. std::wstringstream o;
  1307. VERIFY_SUCCEEDED(pDataSource->openSession(&pSession));
  1308. VERIFY_SUCCEEDED(pSession->getEnumTables(&pEnumTables));
  1309. ULONG fetched = 0;
  1310. while (pEnumTables->Next(1, &pTable, &fetched) == S_OK && fetched == 1) {
  1311. CComBSTR name;
  1312. IFT(pTable->get_name(&name));
  1313. if (wcscmp(name, L"SourceFiles") == 0) {
  1314. pSourcesTable = pTable.Detach();
  1315. continue;
  1316. }
  1317. pTable.Release();
  1318. }
  1319. if (!pSourcesTable) {
  1320. return L"cannot find source";
  1321. }
  1322. // Get source file contents.
  1323. // NOTE: "SourceFiles" has the root file first while "InjectedSources" is in
  1324. // alphabetical order.
  1325. // It is important to keep the root file first for recompilation, so
  1326. // iterate "SourceFiles" and look up the corresponding injected
  1327. // source.
  1328. LONG count;
  1329. IFT(pSourcesTable->get_Count(&count));
  1330. CComPtr<IDiaSourceFile> pSourceFile;
  1331. CComBSTR pName;
  1332. CComPtr<IUnknown> pSymbolUnk;
  1333. CComPtr<IDiaEnumInjectedSources> pEnumInjectedSources;
  1334. CComPtr<IDiaInjectedSource> pInjectedSource;
  1335. std::wstring sourceText, sourceFilename;
  1336. while (SUCCEEDED(pSourcesTable->Next(1, &pSymbolUnk, &fetched)) &&
  1337. fetched == 1) {
  1338. sourceText = sourceFilename = L"";
  1339. IFT(pSymbolUnk->QueryInterface(&pSourceFile));
  1340. IFT(pSourceFile->get_fileName(&pName));
  1341. IFT(pSession->findInjectedSource(pName, &pEnumInjectedSources));
  1342. if (SUCCEEDED(pEnumInjectedSources->get_Count(&count)) && count == 1) {
  1343. IFT(pEnumInjectedSources->Item(0, &pInjectedSource));
  1344. DWORD cbData = 0;
  1345. std::string tempString;
  1346. CComBSTR bstr;
  1347. IFT(pInjectedSource->get_filename(&bstr));
  1348. IFT(pInjectedSource->get_source(0, &cbData, nullptr));
  1349. tempString.resize(cbData);
  1350. IFT(pInjectedSource->get_source(
  1351. cbData, &cbData, reinterpret_cast<BYTE *>(&tempString[0])));
  1352. CA2W tempWString(tempString.data());
  1353. o << tempWString.m_psz;
  1354. }
  1355. pSymbolUnk.Release();
  1356. }
  1357. return o.str();
  1358. }
  1359. struct LineNumber { DWORD line; DWORD rva; };
  1360. std::vector<LineNumber> ReadLineNumbers(IDiaEnumLineNumbers *pEnumLineNumbers) {
  1361. std::vector<LineNumber> lines;
  1362. CComPtr<IDiaLineNumber> pLineNumber;
  1363. DWORD lineCount;
  1364. while (SUCCEEDED(pEnumLineNumbers->Next(1, &pLineNumber, &lineCount)) && lineCount == 1)
  1365. {
  1366. DWORD line;
  1367. DWORD rva;
  1368. VERIFY_SUCCEEDED(pLineNumber->get_lineNumber(&line));
  1369. VERIFY_SUCCEEDED(pLineNumber->get_relativeVirtualAddress(&rva));
  1370. lines.push_back({ line, rva });
  1371. pLineNumber.Release();
  1372. }
  1373. return lines;
  1374. }
  1375. std::string GetOption(std::string &cmd, char *opt) {
  1376. std::string option = cmd.substr(cmd.find(opt));
  1377. option = option.substr(option.find_first_of(' '));
  1378. option = option.substr(option.find_first_not_of(' '));
  1379. return option.substr(0, option.find_first_of(' '));
  1380. }
  1381. void CodeGenTest(LPCWSTR name) {
  1382. CComPtr<IDxcCompiler> pCompiler;
  1383. CComPtr<IDxcOperationResult> pResult;
  1384. CComPtr<IDxcBlobEncoding> pSource;
  1385. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1386. CreateBlobFromFile(name, &pSource);
  1387. std::string cmdLine = GetFirstLine(name);
  1388. llvm::StringRef argsRef = cmdLine;
  1389. llvm::SmallVector<llvm::StringRef, 8> splitArgs;
  1390. argsRef.split(splitArgs, " ");
  1391. hlsl::options::MainArgs argStrings(splitArgs);
  1392. std::string errorString;
  1393. llvm::raw_string_ostream errorStream(errorString);
  1394. hlsl::options::DxcOpts opts;
  1395. IFT(ReadDxcOpts(hlsl::options::getHlslOptTable(), /*flagsToInclude*/ 0,
  1396. argStrings, opts, errorStream));
  1397. std::wstring entry =
  1398. Unicode::UTF8ToUTF16StringOrThrow(opts.EntryPoint.str().c_str());
  1399. std::wstring profile =
  1400. Unicode::UTF8ToUTF16StringOrThrow(opts.TargetProfile.str().c_str());
  1401. std::vector<std::wstring> argLists;
  1402. CopyArgsToWStrings(opts.Args, hlsl::options::CoreOption, argLists);
  1403. std::vector<LPCWSTR> args;
  1404. args.reserve(argLists.size());
  1405. for (const std::wstring &a : argLists)
  1406. args.push_back(a.data());
  1407. VERIFY_SUCCEEDED(pCompiler->Compile(
  1408. pSource, name, entry.c_str(), profile.c_str(), args.data(), args.size(),
  1409. opts.Defines.data(), opts.Defines.size(), nullptr, &pResult));
  1410. HRESULT result;
  1411. VERIFY_SUCCEEDED(pResult->GetStatus(&result));
  1412. if (FAILED(result)) {
  1413. CComPtr<IDxcBlobEncoding> pErr;
  1414. IFT(pResult->GetErrorBuffer(&pErr));
  1415. std::string errString(BlobToUtf8(pErr));
  1416. CA2W errStringW(errString.c_str(), CP_UTF8);
  1417. WEX::Logging::Log::Comment(L"Failed to compile - errors follow");
  1418. WEX::Logging::Log::Comment(errStringW);
  1419. }
  1420. VERIFY_SUCCEEDED(result);
  1421. CComPtr<IDxcBlob> pProgram;
  1422. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  1423. if (opts.IsRootSignatureProfile())
  1424. return;
  1425. CComPtr<IDxcBlobEncoding> pDisassembleBlob;
  1426. VERIFY_SUCCEEDED(pCompiler->Disassemble(pProgram, &pDisassembleBlob));
  1427. std::string disassembleString(BlobToUtf8(pDisassembleBlob));
  1428. VERIFY_ARE_NOT_EQUAL(0, disassembleString.size());
  1429. }
  1430. void CodeGenTestCheckFullPath(LPCWSTR fullPath) {
  1431. FileRunTestResult t = FileRunTestResult::RunFromFileCommands(fullPath);
  1432. if (t.RunResult != 0) {
  1433. CA2W commentWide(t.ErrorMessage.c_str(), CP_UTF8);
  1434. WEX::Logging::Log::Comment(commentWide);
  1435. WEX::Logging::Log::Error(L"Run result is not zero");
  1436. }
  1437. }
  1438. void CodeGenTestCheck(LPCWSTR name) {
  1439. std::wstring fullPath = hlsl_test::GetPathToHlslDataFile(name);
  1440. CodeGenTestCheckFullPath(fullPath.c_str());
  1441. }
  1442. void CodeGenTestCheckBatch(LPCWSTR name, unsigned option) {
  1443. WEX::Logging::Log::StartGroup(name);
  1444. CodeGenTestCheckFullPath(name);
  1445. WEX::Logging::Log::EndGroup(name);
  1446. }
  1447. void CodeGenTestCheckBatchDir(std::wstring suitePath) {
  1448. using namespace llvm;
  1449. using namespace WEX::TestExecution;
  1450. ::llvm::sys::fs::MSFileSystem *msfPtr;
  1451. VERIFY_SUCCEEDED(CreateMSFileSystemForDisk(&msfPtr));
  1452. std::unique_ptr<::llvm::sys::fs::MSFileSystem> msf(msfPtr);
  1453. ::llvm::sys::fs::AutoPerThreadSystem pts(msf.get());
  1454. IFTLLVM(pts.error_code());
  1455. CW2A pUtf8Filename(suitePath.c_str());
  1456. if (!llvm::sys::path::is_absolute(pUtf8Filename.m_psz)) {
  1457. suitePath = hlsl_test::GetPathToHlslDataFile(suitePath.c_str());
  1458. }
  1459. CW2A utf8SuitePath(suitePath.c_str());
  1460. std::error_code EC;
  1461. llvm::SmallString<128> DirNative;
  1462. llvm::sys::path::native(utf8SuitePath.m_psz, DirNative);
  1463. for (llvm::sys::fs::recursive_directory_iterator Dir(DirNative, EC), DirEnd;
  1464. Dir != DirEnd && !EC; Dir.increment(EC)) {
  1465. // Check whether this entry has an extension typically associated with
  1466. // headers.
  1467. if (!llvm::StringSwitch<bool>(llvm::sys::path::extension(Dir->path()))
  1468. .Cases(".hlsl", ".hlsl", true)
  1469. .Cases(".ll", ".ll", true)
  1470. .Default(false))
  1471. continue;
  1472. StringRef filename = Dir->path();
  1473. CA2W wRelPath(filename.data());
  1474. CodeGenTestCheckBatch(wRelPath.m_psz, 0);
  1475. }
  1476. }
  1477. std::string VerifyCompileFailed(LPCSTR pText, LPWSTR pTargetProfile, LPCSTR pErrorMsg) {
  1478. return VerifyCompileFailed(pText, pTargetProfile, pErrorMsg, L"main");
  1479. }
  1480. std::string VerifyCompileFailed(LPCSTR pText, LPWSTR pTargetProfile, LPCSTR pErrorMsg, LPCWSTR pEntryPoint) {
  1481. CComPtr<IDxcCompiler> pCompiler;
  1482. CComPtr<IDxcOperationResult> pResult;
  1483. CComPtr<IDxcBlobEncoding> pSource;
  1484. CComPtr<IDxcBlobEncoding> pErrors;
  1485. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1486. CreateBlobFromText(pText, &pSource);
  1487. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", pEntryPoint,
  1488. pTargetProfile, nullptr, 0, nullptr, 0, nullptr, &pResult));
  1489. HRESULT status;
  1490. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  1491. VERIFY_FAILED(status);
  1492. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrors));
  1493. if (pErrorMsg && *pErrorMsg) {
  1494. CheckOperationResultMsgs(pResult, &pErrorMsg, 1, false, false);
  1495. }
  1496. return BlobToUtf8(pErrors);
  1497. }
  1498. void VerifyOperationSucceeded(IDxcOperationResult *pResult) {
  1499. HRESULT result;
  1500. VERIFY_SUCCEEDED(pResult->GetStatus(&result));
  1501. if (FAILED(result)) {
  1502. CComPtr<IDxcBlobEncoding> pErrors;
  1503. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrors));
  1504. CA2W errorsWide(BlobToUtf8(pErrors).c_str(), CP_UTF8);
  1505. WEX::Logging::Log::Comment(errorsWide);
  1506. }
  1507. VERIFY_SUCCEEDED(result);
  1508. }
  1509. std::string VerifyOperationFailed(IDxcOperationResult *pResult) {
  1510. HRESULT result;
  1511. VERIFY_SUCCEEDED(pResult->GetStatus(&result));
  1512. VERIFY_FAILED(result);
  1513. CComPtr<IDxcBlobEncoding> pErrors;
  1514. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrors));
  1515. return BlobToUtf8(pErrors);
  1516. }
  1517. HRESULT CreateDiaSourceForCompile(const char *hlsl, IDiaDataSource **ppDiaSource)
  1518. {
  1519. if (!ppDiaSource)
  1520. return E_POINTER;
  1521. CComPtr<IDxcCompiler> pCompiler;
  1522. CComPtr<IDxcOperationResult> pResult;
  1523. CComPtr<IDxcBlobEncoding> pSource;
  1524. CComPtr<IDxcBlob> pProgram;
  1525. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1526. CreateBlobFromText(hlsl, &pSource);
  1527. LPCWSTR args[] = { L"/Zi" };
  1528. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1529. L"ps_6_0", args, _countof(args), nullptr, 0, nullptr, &pResult));
  1530. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  1531. // Disassemble the compiled (stripped) program.
  1532. {
  1533. CComPtr<IDxcBlobEncoding> pDisassembly;
  1534. VERIFY_SUCCEEDED(pCompiler->Disassemble(pProgram, &pDisassembly));
  1535. std::string disText = BlobToUtf8(pDisassembly);
  1536. CA2W disTextW(disText.c_str(), CP_UTF8);
  1537. //WEX::Logging::Log::Comment(disTextW);
  1538. }
  1539. // CONSIDER: have the dia data source look for the part if passed a whole container.
  1540. CComPtr<IDiaDataSource> pDiaSource;
  1541. CComPtr<IStream> pProgramStream;
  1542. CComPtr<IDxcLibrary> pLib;
  1543. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcLibrary, &pLib));
  1544. const hlsl::DxilContainerHeader *pContainer = hlsl::IsDxilContainerLike(
  1545. pProgram->GetBufferPointer(), pProgram->GetBufferSize());
  1546. VERIFY_IS_NOT_NULL(pContainer);
  1547. hlsl::DxilPartIterator partIter =
  1548. std::find_if(hlsl::begin(pContainer), hlsl::end(pContainer),
  1549. hlsl::DxilPartIsType(hlsl::DFCC_ShaderDebugInfoDXIL));
  1550. const hlsl::DxilProgramHeader *pProgramHeader =
  1551. (const hlsl::DxilProgramHeader *)hlsl::GetDxilPartData(*partIter);
  1552. uint32_t bitcodeLength;
  1553. const char *pBitcode;
  1554. CComPtr<IDxcBlob> pProgramPdb;
  1555. hlsl::GetDxilProgramBitcode(pProgramHeader, &pBitcode, &bitcodeLength);
  1556. VERIFY_SUCCEEDED(pLib->CreateBlobFromBlob(
  1557. pProgram, pBitcode - (char *)pProgram->GetBufferPointer(), bitcodeLength,
  1558. &pProgramPdb));
  1559. // Disassemble the program with debug information.
  1560. {
  1561. CComPtr<IDxcBlobEncoding> pDbgDisassembly;
  1562. VERIFY_SUCCEEDED(pCompiler->Disassemble(pProgramPdb, &pDbgDisassembly));
  1563. std::string disText = BlobToUtf8(pDbgDisassembly);
  1564. CA2W disTextW(disText.c_str(), CP_UTF8);
  1565. //WEX::Logging::Log::Comment(disTextW);
  1566. }
  1567. // Create a short text dump of debug information.
  1568. VERIFY_SUCCEEDED(pLib->CreateStreamFromBlobReadOnly(pProgramPdb, &pProgramStream));
  1569. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcDiaDataSource, &pDiaSource));
  1570. VERIFY_SUCCEEDED(pDiaSource->loadDataFromIStream(pProgramStream));
  1571. *ppDiaSource = pDiaSource.Detach();
  1572. return S_OK;
  1573. }
  1574. };
  1575. // Useful for debugging.
  1576. #if SUPPORT_FXC_PDB
  1577. #include <d3dcompiler.h>
  1578. #pragma comment(lib, "d3dcompiler.lib")
  1579. HRESULT GetBlobPdb(IDxcBlob *pBlob, IDxcBlob **ppDebugInfo) {
  1580. return D3DGetBlobPart(pBlob->GetBufferPointer(), pBlob->GetBufferSize(),
  1581. D3D_BLOB_PDB, 0, (ID3DBlob **)ppDebugInfo);
  1582. }
  1583. std::string FourCCStr(uint32_t val) {
  1584. std::stringstream o;
  1585. char c[5];
  1586. c[0] = val & 0xFF;
  1587. c[1] = (val & 0xFF00) >> 8;
  1588. c[2] = (val & 0xFF0000) >> 16;
  1589. c[3] = (val & 0xFF000000) >> 24;
  1590. c[4] = '\0';
  1591. o << c << " (" << std::hex << val << std::dec << ")";
  1592. return o.str();
  1593. }
  1594. std::string DumpParts(IDxcBlob *pBlob) {
  1595. std::stringstream o;
  1596. hlsl::DxilContainerHeader *pContainer = (hlsl::DxilContainerHeader *)pBlob->GetBufferPointer();
  1597. o << "Container:" << std::endl
  1598. << " Size: " << pContainer->ContainerSizeInBytes << std::endl
  1599. << " FourCC: " << FourCCStr(pContainer->HeaderFourCC) << std::endl
  1600. << " Part count: " << pContainer->PartCount << std::endl;
  1601. for (uint32_t i = 0; i < pContainer->PartCount; ++i) {
  1602. hlsl::DxilPartHeader *pPart = hlsl::GetDxilContainerPart(pContainer, i);
  1603. o << "Part " << i << std::endl
  1604. << " FourCC: " << FourCCStr(pPart->PartFourCC) << std::endl
  1605. << " Size: " << pPart->PartSize << std::endl;
  1606. }
  1607. return o.str();
  1608. }
  1609. HRESULT CreateDiaSourceFromDxbcBlob(IDxcLibrary *pLib, IDxcBlob *pDxbcBlob,
  1610. IDiaDataSource **ppDiaSource) {
  1611. HRESULT hr = S_OK;
  1612. CComPtr<IDxcBlob> pdbBlob;
  1613. CComPtr<IStream> pPdbStream;
  1614. CComPtr<IDiaDataSource> pDiaSource;
  1615. IFR(GetBlobPdb(pDxbcBlob, &pdbBlob));
  1616. IFR(pLib->CreateStreamFromBlobReadOnly(pdbBlob, &pPdbStream));
  1617. IFR(CoCreateInstance(CLSID_DiaSource, NULL, CLSCTX_INPROC_SERVER,
  1618. __uuidof(IDiaDataSource), (void **)&pDiaSource));
  1619. IFR(pDiaSource->loadDataFromIStream(pPdbStream));
  1620. *ppDiaSource = pDiaSource.Detach();
  1621. return hr;
  1622. }
  1623. #endif
  1624. bool CompilerTest::InitSupport() {
  1625. if (!m_dllSupport.IsEnabled()) {
  1626. VERIFY_SUCCEEDED(m_dllSupport.Initialize());
  1627. m_ver.Initialize(m_dllSupport);
  1628. }
  1629. return true;
  1630. }
  1631. TEST_F(CompilerTest, CompileWhenDebugThenDIPresent) {
  1632. // BUG: the first test written was of this form:
  1633. // float4 local = 0; return local;
  1634. //
  1635. // However we get no numbers because of the _wrapper form
  1636. // that exports the zero initialization from main into
  1637. // a global can't be attributed to any particular location
  1638. // within main, and everything in main is eventually folded away.
  1639. //
  1640. // Making the function do a bit more work by calling an intrinsic
  1641. // helps this case.
  1642. CComPtr<IDiaDataSource> pDiaSource;
  1643. VERIFY_SUCCEEDED(CreateDiaSourceForCompile(
  1644. "float4 main(float4 pos : SV_Position) : SV_Target {\r\n"
  1645. " float4 local = abs(pos);\r\n"
  1646. " return local;\r\n"
  1647. "}", &pDiaSource));
  1648. std::wstring diaDump = GetDebugInfoAsText(pDiaSource).c_str();
  1649. //WEX::Logging::Log::Comment(GetDebugInfoAsText(pDiaSource).c_str());
  1650. // Very basic tests - we have basic symbols, line numbers, and files with sources.
  1651. VERIFY_IS_NOT_NULL(wcsstr(diaDump.c_str(), L"symIndexId: 5, CompilandEnv, name: hlslTarget, value: ps_6_0"));
  1652. VERIFY_IS_NOT_NULL(wcsstr(diaDump.c_str(), L"lineNumber: 2"));
  1653. VERIFY_IS_NOT_NULL(wcsstr(diaDump.c_str(), L"length: 99, filename: source.hlsl"));
  1654. std::wstring diaFileContent = GetDebugFileContent(pDiaSource).c_str();
  1655. VERIFY_IS_NOT_NULL(wcsstr(diaFileContent.c_str(), L"loat4 main(float4 pos : SV_Position) : SV_Target"));
  1656. #if SUPPORT_FXC_PDB
  1657. // Now, fake it by loading from a .pdb!
  1658. VERIFY_SUCCEEDED(CoInitializeEx(0, COINITBASE_MULTITHREADED));
  1659. const wchar_t path[] = L"path-to-fxc-blob.bin";
  1660. pDiaSource.Release();
  1661. pProgramStream.Release();
  1662. CComPtr<IDxcBlobEncoding> fxcBlob;
  1663. CComPtr<IDxcBlob> pdbBlob;
  1664. VERIFY_SUCCEEDED(pLib->CreateBlobFromFile(path, nullptr, &fxcBlob));
  1665. std::string s = DumpParts(fxcBlob);
  1666. CA2W sW(s.c_str(), CP_UTF8);
  1667. WEX::Logging::Log::Comment(sW);
  1668. VERIFY_SUCCEEDED(CreateDiaSourceFromDxbcBlob(pLib, fxcBlob, &pDiaSource));
  1669. WEX::Logging::Log::Comment(GetDebugInfoAsText(pDiaSource).c_str());
  1670. #endif
  1671. }
  1672. TEST_F(CompilerTest, CompileDebugLines) {
  1673. CComPtr<IDiaDataSource> pDiaSource;
  1674. VERIFY_SUCCEEDED(CreateDiaSourceForCompile(
  1675. "float main(float pos : A) : SV_Target {\r\n"
  1676. " float x = abs(pos);\r\n"
  1677. " float y = sin(pos);\r\n"
  1678. " float z = x + y;\r\n"
  1679. " return z;\r\n"
  1680. "}", &pDiaSource));
  1681. const int numExpectedRVAs = 6;
  1682. auto verifyLines = [=](const std::vector<LineNumber> lines) {
  1683. VERIFY_ARE_EQUAL(lines.size(), numExpectedRVAs);
  1684. // 0: loadInput
  1685. VERIFY_ARE_EQUAL(lines[0].rva, 0);
  1686. VERIFY_ARE_EQUAL(lines[0].line, 1);
  1687. // 1: abs
  1688. VERIFY_ARE_EQUAL(lines[1].rva, 1);
  1689. VERIFY_ARE_EQUAL(lines[1].line, 2);
  1690. // 2: sin
  1691. VERIFY_ARE_EQUAL(lines[2].rva, 2);
  1692. VERIFY_ARE_EQUAL(lines[2].line, 3);
  1693. // 3: add
  1694. VERIFY_ARE_EQUAL(lines[3].rva, 3);
  1695. VERIFY_ARE_EQUAL(lines[3].line, 4);
  1696. // 4: storeOutput
  1697. VERIFY_ARE_EQUAL(lines[4].rva, 4);
  1698. VERIFY_ARE_EQUAL(lines[4].line, 5);
  1699. // 5: ret
  1700. VERIFY_ARE_EQUAL(lines[5].rva, 5);
  1701. VERIFY_ARE_EQUAL(lines[5].line, 5);
  1702. };
  1703. CComPtr<IDiaSession> pSession;
  1704. CComPtr<IDiaEnumLineNumbers> pEnumLineNumbers;
  1705. // Verify lines are ok when getting one RVA at a time.
  1706. std::vector<LineNumber> linesOneByOne;
  1707. VERIFY_SUCCEEDED(pDiaSource->openSession(&pSession));
  1708. for (int i = 0; i < numExpectedRVAs; ++i) {
  1709. VERIFY_SUCCEEDED(pSession->findLinesByRVA(i, 1, &pEnumLineNumbers));
  1710. std::vector<LineNumber> lines = ReadLineNumbers(pEnumLineNumbers);
  1711. std::copy(lines.begin(), lines.end(), std::back_inserter(linesOneByOne));
  1712. pEnumLineNumbers.Release();
  1713. }
  1714. verifyLines(linesOneByOne);
  1715. // Verify lines are ok when getting all RVAs at once.
  1716. std::vector<LineNumber> linesAllAtOnce;
  1717. pEnumLineNumbers.Release();
  1718. VERIFY_SUCCEEDED(pSession->findLinesByRVA(0, numExpectedRVAs, &pEnumLineNumbers));
  1719. linesAllAtOnce = ReadLineNumbers(pEnumLineNumbers);
  1720. verifyLines(linesAllAtOnce);
  1721. // Verify lines are ok when getting all lines through enum tables.
  1722. std::vector<LineNumber> linesFromTable;
  1723. pEnumLineNumbers.Release();
  1724. CComPtr<IDiaEnumTables> pTables;
  1725. CComPtr<IDiaTable> pTable;
  1726. VERIFY_SUCCEEDED(pSession->getEnumTables(&pTables));
  1727. DWORD celt;
  1728. while (SUCCEEDED(pTables->Next(1, &pTable, &celt)) && celt == 1)
  1729. {
  1730. if (SUCCEEDED(pTable->QueryInterface(&pEnumLineNumbers))) {
  1731. linesFromTable = ReadLineNumbers(pEnumLineNumbers);
  1732. break;
  1733. }
  1734. pTable.Release();
  1735. }
  1736. verifyLines(linesFromTable);
  1737. // Verify lines are ok when getting by address.
  1738. std::vector<LineNumber> linesByAddr;
  1739. pEnumLineNumbers.Release();
  1740. VERIFY_SUCCEEDED(pSession->findLinesByAddr(0, 0, numExpectedRVAs, &pEnumLineNumbers));
  1741. linesByAddr = ReadLineNumbers(pEnumLineNumbers);
  1742. verifyLines(linesByAddr);
  1743. // Verify findFileById.
  1744. CComPtr<IDiaSourceFile> pFile;
  1745. VERIFY_SUCCEEDED(pSession->findFileById(0, &pFile));
  1746. CComBSTR pName;
  1747. VERIFY_SUCCEEDED(pFile->get_fileName(&pName));
  1748. VERIFY_ARE_EQUAL_WSTR(pName, L"source.hlsl");
  1749. }
  1750. TEST_F(CompilerTest, CompileWhenDefinesThenApplied) {
  1751. CComPtr<IDxcCompiler> pCompiler;
  1752. CComPtr<IDxcOperationResult> pResult;
  1753. CComPtr<IDxcBlobEncoding> pSource;
  1754. DxcDefine defines[] = {{L"F4", L"float4"}};
  1755. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1756. CreateBlobFromText("F4 main() : SV_Target { return 0; }", &pSource);
  1757. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1758. L"ps_6_0", nullptr, 0, defines,
  1759. _countof(defines), nullptr, &pResult));
  1760. }
  1761. TEST_F(CompilerTest, CompileWhenDefinesManyThenApplied) {
  1762. CComPtr<IDxcCompiler> pCompiler;
  1763. CComPtr<IDxcOperationResult> pResult;
  1764. CComPtr<IDxcBlobEncoding> pSource;
  1765. LPCWSTR args[] = {L"/DVAL1=1", L"/DVAL2=2", L"/DVAL3=3", L"/DVAL4=2",
  1766. L"/DVAL5=4", L"/DNVAL1", L"/DNVAL2", L"/DNVAL3",
  1767. L"/DNVAL4", L"/DNVAL5", L"/DCVAL1=1", L"/DCVAL2=2",
  1768. L"/DCVAL3=3", L"/DCVAL4=2", L"/DCVAL5=4", L"/DCVALNONE="};
  1769. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1770. CreateBlobFromText("float4 main() : SV_Target {\r\n"
  1771. "#ifndef VAL1\r\n"
  1772. "#error VAL1 not defined\r\n"
  1773. "#endif\r\n"
  1774. "#ifndef NVAL5\r\n"
  1775. "#error NVAL5 not defined\r\n"
  1776. "#endif\r\n"
  1777. "#ifndef CVALNONE\r\n"
  1778. "#error CVALNONE not defined\r\n"
  1779. "#endif\r\n"
  1780. "return 0; }",
  1781. &pSource);
  1782. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1783. L"ps_6_0", args, _countof(args), nullptr,
  1784. 0, nullptr, &pResult));
  1785. HRESULT compileStatus;
  1786. VERIFY_SUCCEEDED(pResult->GetStatus(&compileStatus));
  1787. if (FAILED(compileStatus)) {
  1788. CComPtr<IDxcBlobEncoding> pErrors;
  1789. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrors));
  1790. OutputDebugStringA((LPCSTR)pErrors->GetBufferPointer());
  1791. }
  1792. VERIFY_SUCCEEDED(compileStatus);
  1793. }
  1794. TEST_F(CompilerTest, CompileWhenEmptyThenFails) {
  1795. CComPtr<IDxcCompiler> pCompiler;
  1796. CComPtr<IDxcOperationResult> pResult;
  1797. CComPtr<IDxcBlobEncoding> pSource;
  1798. CComPtr<IDxcBlobEncoding> pSourceBad;
  1799. LPCWSTR pProfile = L"ps_6_0";
  1800. LPCWSTR pEntryPoint = L"main";
  1801. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1802. CreateBlobFromText("float4 main() : SV_Target { return 0; }", &pSource);
  1803. CreateBlobFromText("float4 main() : SV_Target { return undef; }", &pSourceBad);
  1804. // correct version
  1805. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", pEntryPoint,
  1806. pProfile, nullptr, 0, nullptr, 0, nullptr,
  1807. &pResult));
  1808. pResult.Release();
  1809. // correct version with compilation errors
  1810. VERIFY_SUCCEEDED(pCompiler->Compile(pSourceBad, L"source.hlsl", pEntryPoint,
  1811. pProfile, nullptr, 0, nullptr, 0, nullptr,
  1812. &pResult));
  1813. pResult.Release();
  1814. // null source
  1815. VERIFY_FAILED(pCompiler->Compile(nullptr, L"source.hlsl", pEntryPoint, pProfile,
  1816. nullptr, 0, nullptr, 0, nullptr, &pResult));
  1817. // null profile
  1818. VERIFY_FAILED(pCompiler->Compile(pSourceBad, L"source.hlsl", pEntryPoint,
  1819. nullptr, nullptr, 0, nullptr, 0, nullptr,
  1820. &pResult));
  1821. // null source name succeeds
  1822. VERIFY_SUCCEEDED(pCompiler->Compile(pSourceBad, nullptr, pEntryPoint, pProfile,
  1823. nullptr, 0, nullptr, 0, nullptr, &pResult));
  1824. pResult.Release();
  1825. // empty source name (as opposed to null) also suceeds
  1826. VERIFY_SUCCEEDED(pCompiler->Compile(pSourceBad, L"", pEntryPoint, pProfile,
  1827. nullptr, 0, nullptr, 0, nullptr,
  1828. &pResult));
  1829. pResult.Release();
  1830. // null result
  1831. VERIFY_FAILED(pCompiler->Compile(pSource, L"source.hlsl", pEntryPoint,
  1832. pProfile, nullptr, 0, nullptr, 0, nullptr,
  1833. nullptr));
  1834. }
  1835. TEST_F(CompilerTest, CompileWhenIncorrectThenFails) {
  1836. CComPtr<IDxcCompiler> pCompiler;
  1837. CComPtr<IDxcOperationResult> pResult;
  1838. CComPtr<IDxcBlobEncoding> pSource;
  1839. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1840. CreateBlobFromText("float4_undefined main() : SV_Target { return 0; }",
  1841. &pSource);
  1842. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main", L"ps_6_0",
  1843. nullptr, 0, nullptr, 0, nullptr,
  1844. &pResult));
  1845. HRESULT result;
  1846. VERIFY_SUCCEEDED(pResult->GetStatus(&result));
  1847. VERIFY_FAILED(result);
  1848. CComPtr<IDxcBlobEncoding> pErrorBuffer;
  1849. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrorBuffer));
  1850. std::string errorString(BlobToUtf8(pErrorBuffer));
  1851. VERIFY_ARE_NOT_EQUAL(0, errorString.size());
  1852. // Useful for examining actual error message:
  1853. // CA2W errorStringW(errorString.c_str(), CP_UTF8);
  1854. // WEX::Logging::Log::Comment(errorStringW.m_psz);
  1855. }
  1856. TEST_F(CompilerTest, CompileWhenWorksThenDisassembleWorks) {
  1857. CComPtr<IDxcCompiler> pCompiler;
  1858. CComPtr<IDxcOperationResult> pResult;
  1859. CComPtr<IDxcBlobEncoding> pSource;
  1860. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1861. CreateBlobFromText("float4 main() : SV_Target { return 0; }", &pSource);
  1862. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1863. L"ps_6_0", nullptr, 0, nullptr, 0,
  1864. nullptr, &pResult));
  1865. HRESULT result;
  1866. VERIFY_SUCCEEDED(pResult->GetStatus(&result));
  1867. VERIFY_SUCCEEDED(result);
  1868. CComPtr<IDxcBlob> pProgram;
  1869. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  1870. CComPtr<IDxcBlobEncoding> pDisassembleBlob;
  1871. VERIFY_SUCCEEDED(pCompiler->Disassemble(pProgram, &pDisassembleBlob));
  1872. std::string disassembleString(BlobToUtf8(pDisassembleBlob));
  1873. VERIFY_ARE_NOT_EQUAL(0, disassembleString.size());
  1874. // Useful for examining disassembly:
  1875. // CA2W disassembleStringW(disassembleString.c_str(), CP_UTF8);
  1876. // WEX::Logging::Log::Comment(disassembleStringW.m_psz);
  1877. }
  1878. TEST_F(CompilerTest, CompileWhenDebugWorksThenStripDebug) {
  1879. CComPtr<IDxcCompiler> pCompiler;
  1880. CComPtr<IDxcOperationResult> pResult;
  1881. CComPtr<IDxcBlobEncoding> pSource;
  1882. CComPtr<IDxcBlob> pProgram;
  1883. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1884. CreateBlobFromText("float4 main(float4 pos : SV_Position) : SV_Target {\r\n"
  1885. " float4 local = abs(pos);\r\n"
  1886. " return local;\r\n"
  1887. "}",
  1888. &pSource);
  1889. LPCWSTR args[] = {L"/Zi"};
  1890. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1891. L"ps_6_0", args, _countof(args), nullptr,
  1892. 0, nullptr, &pResult));
  1893. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  1894. // Check if it contains debug blob
  1895. hlsl::DxilContainerHeader *pHeader =
  1896. (hlsl::DxilContainerHeader *)(pProgram->GetBufferPointer());
  1897. hlsl::DxilPartHeader *pPartHeader = hlsl::GetDxilPartByType(
  1898. pHeader, hlsl::DxilFourCC::DFCC_ShaderDebugInfoDXIL);
  1899. VERIFY_IS_NOT_NULL(pPartHeader);
  1900. // Check debug info part does not exist after strip debug info
  1901. CComPtr<IDxcBlob> pNewProgram;
  1902. CComPtr<IDxcContainerBuilder> pBuilder;
  1903. VERIFY_SUCCEEDED(CreateContainerBuilder(&pBuilder));
  1904. VERIFY_SUCCEEDED(pBuilder->Load(pProgram));
  1905. VERIFY_SUCCEEDED(pBuilder->RemovePart(hlsl::DxilFourCC::DFCC_ShaderDebugInfoDXIL));
  1906. pResult.Release();
  1907. VERIFY_SUCCEEDED(pBuilder->SerializeContainer(&pResult));
  1908. VERIFY_SUCCEEDED(pResult->GetResult(&pNewProgram));
  1909. pHeader = (hlsl::DxilContainerHeader *)(pNewProgram->GetBufferPointer());
  1910. pPartHeader = hlsl::GetDxilPartByType(
  1911. pHeader, hlsl::DxilFourCC::DFCC_ShaderDebugInfoDXIL);
  1912. VERIFY_IS_NULL(pPartHeader);
  1913. }
  1914. TEST_F(CompilerTest, CompileWhenWorksThenAddRemovePrivate) {
  1915. CComPtr<IDxcCompiler> pCompiler;
  1916. CComPtr<IDxcOperationResult> pResult;
  1917. CComPtr<IDxcBlobEncoding> pSource;
  1918. CComPtr<IDxcBlob> pProgram;
  1919. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1920. CreateBlobFromText("float4 main() : SV_Target {\r\n"
  1921. " return 0;\r\n"
  1922. "}",
  1923. &pSource);
  1924. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1925. L"ps_6_0", nullptr, 0, nullptr, 0,
  1926. nullptr, &pResult));
  1927. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  1928. // Append private data blob
  1929. CComPtr<IDxcContainerBuilder> pBuilder;
  1930. VERIFY_SUCCEEDED(CreateContainerBuilder(&pBuilder));
  1931. std::string privateTxt("private data");
  1932. CComPtr<IDxcBlobEncoding> pPrivate;
  1933. CreateBlobFromText(privateTxt.c_str(), &pPrivate);
  1934. VERIFY_SUCCEEDED(pBuilder->Load(pProgram));
  1935. VERIFY_SUCCEEDED(pBuilder->AddPart(hlsl::DxilFourCC::DFCC_PrivateData, pPrivate));
  1936. pResult.Release();
  1937. VERIFY_SUCCEEDED(pBuilder->SerializeContainer(&pResult));
  1938. CComPtr<IDxcBlob> pNewProgram;
  1939. VERIFY_SUCCEEDED(pResult->GetResult(&pNewProgram));
  1940. hlsl::DxilContainerHeader *pContainerHeader =
  1941. (hlsl::DxilContainerHeader *)(pNewProgram->GetBufferPointer());
  1942. hlsl::DxilPartHeader *pPartHeader = hlsl::GetDxilPartByType(
  1943. pContainerHeader, hlsl::DxilFourCC::DFCC_PrivateData);
  1944. VERIFY_IS_NOT_NULL(pPartHeader);
  1945. // compare data
  1946. std::string privatePart((const char *)(pPartHeader + 1), privateTxt.size());
  1947. VERIFY_IS_TRUE(strcmp(privatePart.c_str(), privateTxt.c_str()) == 0);
  1948. // Remove private data blob
  1949. pBuilder.Release();
  1950. VERIFY_SUCCEEDED(CreateContainerBuilder(&pBuilder));
  1951. VERIFY_SUCCEEDED(pBuilder->Load(pNewProgram));
  1952. VERIFY_SUCCEEDED(pBuilder->RemovePart(hlsl::DxilFourCC::DFCC_PrivateData));
  1953. pResult.Release();
  1954. VERIFY_SUCCEEDED(pBuilder->SerializeContainer(&pResult));
  1955. pNewProgram.Release();
  1956. VERIFY_SUCCEEDED(pResult->GetResult(&pNewProgram));
  1957. pContainerHeader =
  1958. (hlsl::DxilContainerHeader *)(pNewProgram->GetBufferPointer());
  1959. pPartHeader = hlsl::GetDxilPartByType(
  1960. pContainerHeader, hlsl::DxilFourCC::DFCC_PrivateData);
  1961. VERIFY_IS_NULL(pPartHeader);
  1962. }
  1963. TEST_F(CompilerTest, CompileThenAddCustomDebugName) {
  1964. // container builders prior to 1.3 did not support adding debug name parts
  1965. if (m_ver.SkipDxilVersion(1, 3)) return;
  1966. CComPtr<IDxcCompiler> pCompiler;
  1967. CComPtr<IDxcOperationResult> pResult;
  1968. CComPtr<IDxcBlobEncoding> pSource;
  1969. CComPtr<IDxcBlob> pProgram;
  1970. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  1971. CreateBlobFromText("float4 main() : SV_Target {\r\n"
  1972. " return 0;\r\n"
  1973. "}",
  1974. &pSource);
  1975. LPCWSTR args[] = { L"/Zi", L"/Zss" };
  1976. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  1977. L"ps_6_0", args, _countof(args), nullptr, 0,
  1978. nullptr, &pResult));
  1979. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  1980. // Append private data blob
  1981. CComPtr<IDxcContainerBuilder> pBuilder;
  1982. VERIFY_SUCCEEDED(CreateContainerBuilder(&pBuilder));
  1983. const char pNewName[] = "MyOwnUniqueName.lld";
  1984. //include null terminator:
  1985. size_t nameBlobPartSize = sizeof(hlsl::DxilShaderDebugName) + _countof(pNewName);
  1986. // round up to four-byte size:
  1987. size_t allocatedSize = (nameBlobPartSize + 3) & ~3;
  1988. auto pNameBlobContent = reinterpret_cast<hlsl::DxilShaderDebugName*>(malloc(allocatedSize));
  1989. ZeroMemory(pNameBlobContent, allocatedSize); //just to make sure trailing nulls are nulls.
  1990. pNameBlobContent->Flags = 0;
  1991. pNameBlobContent->NameLength = _countof(pNewName) - 1; //this is not supposed to include null terminator
  1992. memcpy(pNameBlobContent + 1, pNewName, _countof(pNewName));
  1993. CComPtr<IDxcBlobEncoding> pDebugName;
  1994. CreateBlobPinned(pNameBlobContent, allocatedSize, CP_UTF8, &pDebugName);
  1995. VERIFY_SUCCEEDED(pBuilder->Load(pProgram));
  1996. // should fail since it already exists:
  1997. VERIFY_FAILED(pBuilder->AddPart(hlsl::DxilFourCC::DFCC_ShaderDebugName, pDebugName));
  1998. VERIFY_SUCCEEDED(pBuilder->RemovePart(hlsl::DxilFourCC::DFCC_ShaderDebugName));
  1999. VERIFY_SUCCEEDED(pBuilder->AddPart(hlsl::DxilFourCC::DFCC_ShaderDebugName, pDebugName));
  2000. pResult.Release();
  2001. VERIFY_SUCCEEDED(pBuilder->SerializeContainer(&pResult));
  2002. CComPtr<IDxcBlob> pNewProgram;
  2003. VERIFY_SUCCEEDED(pResult->GetResult(&pNewProgram));
  2004. hlsl::DxilContainerHeader *pContainerHeader =
  2005. (hlsl::DxilContainerHeader *)(pNewProgram->GetBufferPointer());
  2006. hlsl::DxilPartHeader *pPartHeader = hlsl::GetDxilPartByType(
  2007. pContainerHeader, hlsl::DxilFourCC::DFCC_ShaderDebugName);
  2008. VERIFY_IS_NOT_NULL(pPartHeader);
  2009. // compare data
  2010. VERIFY_IS_TRUE(memcmp(pPartHeader + 1, pNameBlobContent, allocatedSize) == 0);
  2011. free(pNameBlobContent);
  2012. // Remove private data blob
  2013. pBuilder.Release();
  2014. VERIFY_SUCCEEDED(CreateContainerBuilder(&pBuilder));
  2015. VERIFY_SUCCEEDED(pBuilder->Load(pNewProgram));
  2016. VERIFY_SUCCEEDED(pBuilder->RemovePart(hlsl::DxilFourCC::DFCC_ShaderDebugName));
  2017. pResult.Release();
  2018. VERIFY_SUCCEEDED(pBuilder->SerializeContainer(&pResult));
  2019. pNewProgram.Release();
  2020. VERIFY_SUCCEEDED(pResult->GetResult(&pNewProgram));
  2021. pContainerHeader =
  2022. (hlsl::DxilContainerHeader *)(pNewProgram->GetBufferPointer());
  2023. pPartHeader = hlsl::GetDxilPartByType(
  2024. pContainerHeader, hlsl::DxilFourCC::DFCC_ShaderDebugName);
  2025. VERIFY_IS_NULL(pPartHeader);
  2026. }
  2027. TEST_F(CompilerTest, CompileWithRootSignatureThenStripRootSignature) {
  2028. CComPtr<IDxcCompiler> pCompiler;
  2029. CComPtr<IDxcOperationResult> pResult;
  2030. CComPtr<IDxcBlobEncoding> pSource;
  2031. CComPtr<IDxcBlob> pProgram;
  2032. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2033. CreateBlobFromText("[RootSignature(\"\")] \r\n"
  2034. "float4 main(float a : A) : SV_Target {\r\n"
  2035. " return a;\r\n"
  2036. "}",
  2037. &pSource);
  2038. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2039. L"ps_6_0", nullptr, 0, nullptr,
  2040. 0, nullptr, &pResult));
  2041. VERIFY_IS_NOT_NULL(pResult);
  2042. HRESULT status;
  2043. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2044. VERIFY_SUCCEEDED(status);
  2045. VERIFY_SUCCEEDED(pResult->GetResult(&pProgram));
  2046. VERIFY_IS_NOT_NULL(pProgram);
  2047. hlsl::DxilContainerHeader *pContainerHeader =
  2048. (hlsl::DxilContainerHeader *)(pProgram->GetBufferPointer());
  2049. hlsl::DxilPartHeader *pPartHeader = hlsl::GetDxilPartByType(
  2050. pContainerHeader, hlsl::DxilFourCC::DFCC_RootSignature);
  2051. VERIFY_IS_NOT_NULL(pPartHeader);
  2052. // Remove root signature
  2053. CComPtr<IDxcBlob> pNewProgram;
  2054. CComPtr<IDxcContainerBuilder> pBuilder;
  2055. VERIFY_SUCCEEDED(CreateContainerBuilder(&pBuilder));
  2056. VERIFY_SUCCEEDED(pBuilder->Load(pProgram));
  2057. VERIFY_SUCCEEDED(pBuilder->RemovePart(hlsl::DxilFourCC::DFCC_RootSignature));
  2058. pResult.Release();
  2059. VERIFY_SUCCEEDED(pBuilder->SerializeContainer(&pResult));
  2060. VERIFY_SUCCEEDED(pResult->GetResult(&pNewProgram));
  2061. pContainerHeader = (hlsl::DxilContainerHeader *)(pNewProgram->GetBufferPointer());
  2062. pPartHeader = hlsl::GetDxilPartByType(pContainerHeader,
  2063. hlsl::DxilFourCC::DFCC_RootSignature);
  2064. VERIFY_IS_NULL(pPartHeader);
  2065. }
  2066. TEST_F(CompilerTest, CompileWhenIncludeThenLoadInvoked) {
  2067. CComPtr<IDxcCompiler> pCompiler;
  2068. CComPtr<IDxcOperationResult> pResult;
  2069. CComPtr<IDxcBlobEncoding> pSource;
  2070. CComPtr<TestIncludeHandler> pInclude;
  2071. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2072. CreateBlobFromText(
  2073. "#include \"helper.h\"\r\n"
  2074. "float4 main() : SV_Target { return 0; }", &pSource);
  2075. pInclude = new TestIncludeHandler(m_dllSupport);
  2076. pInclude->CallResults.emplace_back("");
  2077. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2078. L"ps_6_0", nullptr, 0, nullptr, 0, pInclude, &pResult));
  2079. VerifyOperationSucceeded(pResult);
  2080. VERIFY_ARE_EQUAL_WSTR(L"./helper.h;", pInclude->GetAllFileNames().c_str());
  2081. }
  2082. TEST_F(CompilerTest, CompileWhenIncludeThenLoadUsed) {
  2083. CComPtr<IDxcCompiler> pCompiler;
  2084. CComPtr<IDxcOperationResult> pResult;
  2085. CComPtr<IDxcBlobEncoding> pSource;
  2086. CComPtr<TestIncludeHandler> pInclude;
  2087. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2088. CreateBlobFromText(
  2089. "#include \"helper.h\"\r\n"
  2090. "float4 main() : SV_Target { return ZERO; }", &pSource);
  2091. pInclude = new TestIncludeHandler(m_dllSupport);
  2092. pInclude->CallResults.emplace_back("#define ZERO 0");
  2093. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2094. L"ps_6_0", nullptr, 0, nullptr, 0, pInclude, &pResult));
  2095. VerifyOperationSucceeded(pResult);
  2096. VERIFY_ARE_EQUAL_WSTR(L"./helper.h;", pInclude->GetAllFileNames().c_str());
  2097. }
  2098. TEST_F(CompilerTest, CompileWhenIncludeAbsoluteThenLoadAbsolute) {
  2099. CComPtr<IDxcCompiler> pCompiler;
  2100. CComPtr<IDxcOperationResult> pResult;
  2101. CComPtr<IDxcBlobEncoding> pSource;
  2102. CComPtr<TestIncludeHandler> pInclude;
  2103. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2104. CreateBlobFromText(
  2105. "#include \"C:\\helper.h\"\r\n"
  2106. "float4 main() : SV_Target { return ZERO; }", &pSource);
  2107. pInclude = new TestIncludeHandler(m_dllSupport);
  2108. pInclude->CallResults.emplace_back("#define ZERO 0");
  2109. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2110. L"ps_6_0", nullptr, 0, nullptr, 0, pInclude, &pResult));
  2111. VerifyOperationSucceeded(pResult);
  2112. VERIFY_ARE_EQUAL_WSTR(L"C:\\helper.h;", pInclude->GetAllFileNames().c_str());
  2113. }
  2114. TEST_F(CompilerTest, CompileWhenIncludeLocalThenLoadRelative) {
  2115. CComPtr<IDxcCompiler> pCompiler;
  2116. CComPtr<IDxcOperationResult> pResult;
  2117. CComPtr<IDxcBlobEncoding> pSource;
  2118. CComPtr<TestIncludeHandler> pInclude;
  2119. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2120. CreateBlobFromText(
  2121. "#include \"..\\helper.h\"\r\n"
  2122. "float4 main() : SV_Target { return ZERO; }", &pSource);
  2123. pInclude = new TestIncludeHandler(m_dllSupport);
  2124. pInclude->CallResults.emplace_back("#define ZERO 0");
  2125. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2126. L"ps_6_0", nullptr, 0, nullptr, 0, pInclude, &pResult));
  2127. VerifyOperationSucceeded(pResult);
  2128. VERIFY_ARE_EQUAL_WSTR(L"./..\\helper.h;", pInclude->GetAllFileNames().c_str());
  2129. }
  2130. TEST_F(CompilerTest, CompileWhenIncludeSystemThenLoadNotRelative) {
  2131. CComPtr<IDxcCompiler> pCompiler;
  2132. CComPtr<IDxcOperationResult> pResult;
  2133. CComPtr<IDxcBlobEncoding> pSource;
  2134. CComPtr<TestIncludeHandler> pInclude;
  2135. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2136. CreateBlobFromText(
  2137. "#include \"subdir/other/file.h\"\r\n"
  2138. "float4 main() : SV_Target { return ZERO; }", &pSource);
  2139. LPCWSTR args[] = {
  2140. L"-Ifoo"
  2141. };
  2142. pInclude = new TestIncludeHandler(m_dllSupport);
  2143. pInclude->CallResults.emplace_back("#include <helper.h>");
  2144. pInclude->CallResults.emplace_back("#define ZERO 0");
  2145. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2146. L"ps_6_0", args, _countof(args), nullptr, 0, pInclude, &pResult));
  2147. VerifyOperationSucceeded(pResult);
  2148. VERIFY_ARE_EQUAL_WSTR(L"./subdir/other/file.h;./foo\\helper.h;", pInclude->GetAllFileNames().c_str());
  2149. }
  2150. TEST_F(CompilerTest, CompileWhenIncludeSystemMissingThenLoadAttempt) {
  2151. CComPtr<IDxcCompiler> pCompiler;
  2152. CComPtr<IDxcOperationResult> pResult;
  2153. CComPtr<IDxcBlobEncoding> pSource;
  2154. CComPtr<TestIncludeHandler> pInclude;
  2155. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2156. CreateBlobFromText(
  2157. "#include \"subdir/other/file.h\"\r\n"
  2158. "float4 main() : SV_Target { return ZERO; }", &pSource);
  2159. pInclude = new TestIncludeHandler(m_dllSupport);
  2160. pInclude->CallResults.emplace_back("#include <helper.h>");
  2161. pInclude->CallResults.emplace_back("#define ZERO 0");
  2162. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2163. L"ps_6_0", nullptr, 0, nullptr, 0, pInclude, &pResult));
  2164. std::string failLog(VerifyOperationFailed(pResult));
  2165. VERIFY_ARE_NOT_EQUAL(std::string::npos, failLog.find("<angled>")); // error message should prompt to use <angled> rather than "quotes"
  2166. VERIFY_ARE_EQUAL_WSTR(L"./subdir/other/file.h;./subdir/other/helper.h;", pInclude->GetAllFileNames().c_str());
  2167. }
  2168. TEST_F(CompilerTest, CompileWhenIncludeFlagsThenIncludeUsed) {
  2169. CComPtr<IDxcCompiler> pCompiler;
  2170. CComPtr<IDxcOperationResult> pResult;
  2171. CComPtr<IDxcBlobEncoding> pSource;
  2172. CComPtr<TestIncludeHandler> pInclude;
  2173. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2174. CreateBlobFromText(
  2175. "#include <helper.h>\r\n"
  2176. "float4 main() : SV_Target { return ZERO; }", &pSource);
  2177. pInclude = new TestIncludeHandler(m_dllSupport);
  2178. pInclude->CallResults.emplace_back("#define ZERO 0");
  2179. LPCWSTR args[] = {
  2180. L"-I\\\\server\\share"
  2181. };
  2182. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2183. L"ps_6_0", args, _countof(args), nullptr, 0, pInclude, &pResult));
  2184. VerifyOperationSucceeded(pResult);
  2185. VERIFY_ARE_EQUAL_WSTR(L"\\\\server\\share\\helper.h;", pInclude->GetAllFileNames().c_str());
  2186. }
  2187. TEST_F(CompilerTest, CompileWhenIncludeMissingThenFail) {
  2188. CComPtr<IDxcCompiler> pCompiler;
  2189. CComPtr<IDxcOperationResult> pResult;
  2190. CComPtr<IDxcBlobEncoding> pSource;
  2191. CComPtr<TestIncludeHandler> pInclude;
  2192. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2193. CreateBlobFromText(
  2194. "#include \"file.h\"\r\n"
  2195. "float4 main() : SV_Target { return 0; }", &pSource);
  2196. pInclude = new TestIncludeHandler(m_dllSupport);
  2197. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2198. L"ps_6_0", nullptr, 0, nullptr, 0, pInclude, &pResult));
  2199. HRESULT hr;
  2200. VERIFY_SUCCEEDED(pResult->GetStatus(&hr));
  2201. VERIFY_FAILED(hr);
  2202. }
  2203. TEST_F(CompilerTest, CompileWhenIncludeHasPathThenOK) {
  2204. CComPtr<IDxcCompiler> pCompiler;
  2205. LPCWSTR Source = L"c:\\temp\\OddIncludes\\main.hlsl";
  2206. LPCWSTR Args[] = { L"/I", L"c:\\temp" };
  2207. LPCWSTR ArgsUp[] = { L"/I", L"c:\\Temp" };
  2208. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2209. bool useUpValues[] = { false, true };
  2210. for (bool useUp : useUpValues) {
  2211. CComPtr<IDxcOperationResult> pResult;
  2212. CComPtr<IDxcBlobEncoding> pSource;
  2213. #if TEST_ON_DISK
  2214. CComPtr<IDxcLibrary> pLibrary;
  2215. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcLibrary, &pLibrary));
  2216. VERIFY_SUCCEEDED(pLibrary->CreateIncludeHandler(&pInclude));
  2217. VERIFY_SUCCEEDED(pLibrary->CreateBlobFromFile(Source, nullptr, &pSource));
  2218. #else
  2219. CComPtr<TestIncludeHandler> pInclude;
  2220. pInclude = new TestIncludeHandler(m_dllSupport);
  2221. pInclude->CallResults.emplace_back("// Empty");
  2222. CreateBlobFromText("#include \"include.hlsl\"\r\n"
  2223. "float4 main() : SV_Target { return 0; }",
  2224. &pSource);
  2225. #endif
  2226. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, Source, L"main",
  2227. L"ps_6_0", useUp ? ArgsUp : Args, _countof(Args), nullptr, 0, pInclude, &pResult));
  2228. HRESULT hr;
  2229. VERIFY_SUCCEEDED(pResult->GetStatus(&hr));
  2230. VERIFY_SUCCEEDED(hr);
  2231. }
  2232. }
  2233. static const char EmptyCompute[] = "[numthreads(8,8,1)] void main() { }";
  2234. TEST_F(CompilerTest, CompileWhenODumpThenPassConfig) {
  2235. CComPtr<IDxcCompiler> pCompiler;
  2236. CComPtr<IDxcOperationResult> pResult;
  2237. CComPtr<IDxcBlobEncoding> pSource;
  2238. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2239. CreateBlobFromText(EmptyCompute, &pSource);
  2240. LPCWSTR Args[] = { L"/Odump" };
  2241. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2242. L"cs_6_0", Args, _countof(Args), nullptr, 0, nullptr, &pResult));
  2243. VerifyOperationSucceeded(pResult);
  2244. CComPtr<IDxcBlob> pResultBlob;
  2245. VERIFY_SUCCEEDED(pResult->GetResult(&pResultBlob));
  2246. string passes((char *)pResultBlob->GetBufferPointer(), pResultBlob->GetBufferSize());
  2247. VERIFY_ARE_NOT_EQUAL(string::npos, passes.find("inline"));
  2248. }
  2249. TEST_F(CompilerTest, CompileWhenVdThenProducesDxilContainer) {
  2250. CComPtr<IDxcCompiler> pCompiler;
  2251. CComPtr<IDxcOperationResult> pResult;
  2252. CComPtr<IDxcBlobEncoding> pSource;
  2253. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2254. CreateBlobFromText(EmptyCompute, &pSource);
  2255. LPCWSTR Args[] = { L"/Vd" };
  2256. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2257. L"cs_6_0", Args, _countof(Args), nullptr, 0, nullptr, &pResult));
  2258. VerifyOperationSucceeded(pResult);
  2259. CComPtr<IDxcBlob> pResultBlob;
  2260. VERIFY_SUCCEEDED(pResult->GetResult(&pResultBlob));
  2261. VERIFY_IS_TRUE(hlsl::IsValidDxilContainer(reinterpret_cast<hlsl::DxilContainerHeader *>(pResultBlob->GetBufferPointer()), pResultBlob->GetBufferSize()));
  2262. }
  2263. TEST_F(CompilerTest, CompileWhenODumpThenOptimizerMatch) {
  2264. LPCWSTR OptLevels[] = { L"/Od", L"/O1", L"/O2" };
  2265. CComPtr<IDxcCompiler> pCompiler;
  2266. CComPtr<IDxcOptimizer> pOptimizer;
  2267. CComPtr<IDxcAssembler> pAssembler;
  2268. CComPtr<IDxcValidator> pValidator;
  2269. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcAssembler, &pAssembler));
  2270. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcCompiler, &pCompiler));
  2271. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcOptimizer, &pOptimizer));
  2272. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcValidator, &pValidator));
  2273. for (LPCWSTR OptLevel : OptLevels) {
  2274. CComPtr<IDxcOperationResult> pResult;
  2275. CComPtr<IDxcBlobEncoding> pSource;
  2276. CComPtr<IDxcBlob> pHighLevelBlob;
  2277. CComPtr<IDxcBlob> pOptimizedModule;
  2278. CComPtr<IDxcBlob> pAssembledBlob;
  2279. // Could use EmptyCompute and cs_6_0, but there is an issue where properties
  2280. // don't round-trip properly at high-level, so validation fails because
  2281. // dimensions are set to zero. Workaround by using pixel shader instead.
  2282. LPCWSTR Target = L"ps_6_0";
  2283. CreateBlobFromText("float4 main() : SV_Target { return 0; }", &pSource);
  2284. LPCWSTR Args[2] = { OptLevel, L"/Odump" };
  2285. // Get the passes for this optimization level.
  2286. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2287. Target, Args, _countof(Args), nullptr, 0, nullptr, &pResult));
  2288. VerifyOperationSucceeded(pResult);
  2289. CComPtr<IDxcBlob> pResultBlob;
  2290. VERIFY_SUCCEEDED(pResult->GetResult(&pResultBlob));
  2291. string passes((char *)pResultBlob->GetBufferPointer(), pResultBlob->GetBufferSize());
  2292. // Get wchar_t version and prepend hlsl-hlensure, to do a split high-level/opt compilation pass.
  2293. CA2W passesW(passes.c_str(), CP_UTF8);
  2294. std::vector<LPCWSTR> Options;
  2295. SplitPassList(passesW.m_psz, Options);
  2296. // Now compile directly.
  2297. pResult.Release();
  2298. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2299. Target, Args, 1, nullptr, 0, nullptr, &pResult));
  2300. VerifyOperationSucceeded(pResult);
  2301. // Now compile via a high-level compile followed by the optimization passes.
  2302. pResult.Release();
  2303. Args[_countof(Args)-1] = L"/fcgl";
  2304. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2305. Target, Args, _countof(Args), nullptr, 0, nullptr, &pResult));
  2306. VerifyOperationSucceeded(pResult);
  2307. VERIFY_SUCCEEDED(pResult->GetResult(&pHighLevelBlob));
  2308. VERIFY_SUCCEEDED(pOptimizer->RunOptimizer(pHighLevelBlob, Options.data(),
  2309. Options.size(), &pOptimizedModule,
  2310. nullptr));
  2311. string text = DisassembleProgram(m_dllSupport, pOptimizedModule);
  2312. LogCommentFmt(L"Final program:\r\n%S", text.c_str());
  2313. // At the very least, the module should be valid.
  2314. pResult.Release();
  2315. VERIFY_SUCCEEDED(pAssembler->AssembleToContainer(pOptimizedModule, &pResult));
  2316. VerifyOperationSucceeded(pResult);
  2317. VERIFY_SUCCEEDED(pResult->GetResult(&pAssembledBlob));
  2318. pResult.Release();
  2319. VERIFY_SUCCEEDED(pValidator->Validate(pAssembledBlob, DxcValidatorFlags_Default, &pResult));
  2320. VerifyOperationSucceeded(pResult);
  2321. }
  2322. }
  2323. static const UINT CaptureStacks = 0; // Set to 1 to enable captures
  2324. static const UINT StackFrameCount = 12;
  2325. static const UINT StackFrameCountForRefs = 4;
  2326. struct InstrumentedHeapMalloc : public IMalloc {
  2327. private:
  2328. HANDLE m_Handle; // Heap handle.
  2329. ULONG m_RefCount = 0; // Reference count. Used for reference leaks, not for lifetime.
  2330. ULONG m_AllocCount = 0; // Total # of alloc and realloc requests.
  2331. ULONG m_AllocSize = 0; // Total # of alloc and realloc bytes.
  2332. ULONG m_Size = 0; // Current # of alloc'ed bytes.
  2333. ULONG m_FailAlloc = 0; // If nonzero, the alloc/realloc call to fail.
  2334. // Each allocation also tracks the following information:
  2335. // - allocation callstack
  2336. // - deallocation callstack
  2337. // - prior/next blocks in a list of allocated blocks
  2338. LIST_ENTRY AllocList;
  2339. struct PtrData {
  2340. LIST_ENTRY Entry;
  2341. PVOID AllocFrames[CaptureStacks ? StackFrameCount * CaptureStacks : 1];
  2342. PVOID FreeFrames[CaptureStacks ? StackFrameCount * CaptureStacks : 1];
  2343. UINT64 AllocAtCount;
  2344. DWORD AllocFrameCount;
  2345. DWORD FreeFrameCount;
  2346. SIZE_T Size;
  2347. PtrData *Self;
  2348. };
  2349. PtrData *DataFromPtr(void *p) {
  2350. if (p == nullptr) return nullptr;
  2351. PtrData *R = ((PtrData *)p) - 1;
  2352. if (R != R->Self) {
  2353. VERIFY_FAIL(); // p is invalid or underrun
  2354. }
  2355. return R;
  2356. }
  2357. public:
  2358. InstrumentedHeapMalloc() : m_Handle(nullptr) {
  2359. ResetCounts();
  2360. }
  2361. ~InstrumentedHeapMalloc() {
  2362. if (m_Handle)
  2363. HeapDestroy(m_Handle);
  2364. }
  2365. void ResetHeap() {
  2366. if (m_Handle) {
  2367. HeapDestroy(m_Handle);
  2368. m_Handle = nullptr;
  2369. }
  2370. m_Handle = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
  2371. }
  2372. ULONG GetRefCount() const { return m_RefCount; }
  2373. ULONG GetAllocCount() const { return m_AllocCount; }
  2374. ULONG GetAllocSize() const { return m_AllocSize; }
  2375. ULONG GetSize() const { return m_Size; }
  2376. void ResetCounts() {
  2377. m_RefCount = m_AllocCount = m_AllocSize = m_Size = 0;
  2378. AllocList.Blink = AllocList.Flink = &AllocList;
  2379. }
  2380. void SetFailAlloc(ULONG index) {
  2381. m_FailAlloc = index;
  2382. }
  2383. ULONG STDMETHODCALLTYPE AddRef() {
  2384. return ++m_RefCount;
  2385. }
  2386. ULONG STDMETHODCALLTYPE Release() {
  2387. if (m_RefCount == 0) VERIFY_FAIL();
  2388. return --m_RefCount;
  2389. }
  2390. STDMETHODIMP QueryInterface(REFIID iid, void** ppvObject) {
  2391. return DoBasicQueryInterface<IMalloc>(this, iid, ppvObject);
  2392. }
  2393. virtual void *STDMETHODCALLTYPE Alloc(_In_ SIZE_T cb) {
  2394. ++m_AllocCount;
  2395. if (m_FailAlloc && m_AllocCount >= m_FailAlloc) {
  2396. return nullptr; // breakpoint for i failure - m_FailAlloc == 1+VAL
  2397. }
  2398. m_AllocSize += cb;
  2399. m_Size += cb;
  2400. PtrData *P = (PtrData *)HeapAlloc(m_Handle, HEAP_ZERO_MEMORY, sizeof(PtrData) + cb);
  2401. P->Entry.Flink = AllocList.Flink;
  2402. P->Entry.Blink = &AllocList;
  2403. AllocList.Flink->Blink = &(P->Entry);
  2404. AllocList.Flink = &(P->Entry);
  2405. // breakpoint for i failure on NN alloc - m_FailAlloc == 1+VAL && m_AllocCount == NN
  2406. // breakpoint for happy path for NN alloc - m_AllocCount == NN
  2407. P->AllocAtCount = m_AllocCount;
  2408. if (CaptureStacks)
  2409. P->AllocFrameCount = CaptureStackBackTrace(1, StackFrameCount, P->AllocFrames, nullptr);
  2410. P->Size = cb;
  2411. P->Self = P;
  2412. return P + 1;
  2413. }
  2414. virtual void *STDMETHODCALLTYPE Realloc(_In_opt_ void *pv, _In_ SIZE_T cb) {
  2415. SIZE_T priorSize = pv == nullptr ? (SIZE_T)0 : GetSize(pv);
  2416. void *R = Alloc(cb);
  2417. if (!R)
  2418. return nullptr;
  2419. SIZE_T copySize = std::min(cb, priorSize);
  2420. memcpy(R, pv, copySize);
  2421. Free(pv);
  2422. return R;
  2423. }
  2424. virtual void STDMETHODCALLTYPE Free(_In_opt_ void *pv) {
  2425. if (!pv)
  2426. return;
  2427. PtrData *P = DataFromPtr(pv);
  2428. if (P->FreeFrameCount)
  2429. VERIFY_FAIL(); // double-free detected
  2430. m_Size -= P->Size;
  2431. P->Entry.Flink->Blink = P->Entry.Blink;
  2432. P->Entry.Blink->Flink = P->Entry.Flink;
  2433. if (CaptureStacks)
  2434. P->FreeFrameCount =
  2435. CaptureStackBackTrace(1, StackFrameCount, P->FreeFrames, nullptr);
  2436. }
  2437. virtual SIZE_T STDMETHODCALLTYPE GetSize(
  2438. /* [annotation][in] */
  2439. _In_opt_ _Post_writable_byte_size_(return) void *pv)
  2440. {
  2441. if (pv == nullptr) return 0;
  2442. return DataFromPtr(pv)->Size;
  2443. }
  2444. virtual int STDMETHODCALLTYPE DidAlloc(
  2445. _In_opt_ void *pv) {
  2446. return -1; // don't know
  2447. }
  2448. virtual void STDMETHODCALLTYPE HeapMinimize(void) {}
  2449. };
  2450. TEST_F(CompilerTest, CompileWhenNoMemThenOOM) {
  2451. WEX::TestExecution::SetVerifyOutput verifySettings(WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
  2452. CComPtr<IDxcBlobEncoding> pSource;
  2453. CreateBlobFromText(EmptyCompute, &pSource);
  2454. InstrumentedHeapMalloc InstrMalloc;
  2455. CComPtr<IDxcCompiler> pCompiler;
  2456. CComPtr<IDxcOperationResult> pResult;
  2457. ULONG allocCount = 0;
  2458. ULONG allocSize = 0;
  2459. ULONG initialRefCount;
  2460. InstrMalloc.ResetHeap();
  2461. VERIFY_IS_TRUE(m_dllSupport.HasCreateWithMalloc());
  2462. // Verify a simple object creation.
  2463. initialRefCount = InstrMalloc.GetRefCount();
  2464. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance2(&InstrMalloc, CLSID_DxcCompiler, &pCompiler));
  2465. pCompiler.Release();
  2466. VERIFY_IS_TRUE(0 == InstrMalloc.GetSize());
  2467. VERIFY_ARE_EQUAL(initialRefCount, InstrMalloc.GetRefCount());
  2468. InstrMalloc.ResetCounts();
  2469. InstrMalloc.ResetHeap();
  2470. // First time, run to completion and capture stats.
  2471. initialRefCount = InstrMalloc.GetRefCount();
  2472. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance2(&InstrMalloc, CLSID_DxcCompiler, &pCompiler));
  2473. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2474. L"cs_6_0", nullptr, 0, nullptr, 0, nullptr, &pResult));
  2475. allocCount = InstrMalloc.GetAllocCount();
  2476. allocSize = InstrMalloc.GetAllocSize();
  2477. HRESULT hrWithMemory;
  2478. VERIFY_SUCCEEDED(pResult->GetStatus(&hrWithMemory));
  2479. VERIFY_SUCCEEDED(hrWithMemory);
  2480. pCompiler.Release();
  2481. pResult.Release();
  2482. VERIFY_IS_TRUE(allocSize > allocCount);
  2483. // Ensure that after all resources are released, there are no outstanding
  2484. // allocations or references.
  2485. //
  2486. // First leak is in ((InstrumentedHeapMalloc::PtrData *)InstrMalloc.AllocList.Flink)
  2487. VERIFY_IS_TRUE(0 == InstrMalloc.GetSize());
  2488. VERIFY_ARE_EQUAL(initialRefCount, InstrMalloc.GetRefCount());
  2489. // In Debug, without /D_ITERATOR_DEBUG_LEVEL=0, debug iterators will be used;
  2490. // this causes a problem where std::string is specified as noexcept, and yet
  2491. // a sentinel is allocated that may fail and throw.
  2492. if (m_ver.SkipOutOfMemoryTest()) return;
  2493. // Now, fail each allocation and make sure we get an error.
  2494. for (ULONG i = 0; i <= allocCount; ++i) {
  2495. // LogCommentFmt(L"alloc fail %u", i);
  2496. bool isLast = i == allocCount;
  2497. InstrMalloc.ResetCounts();
  2498. InstrMalloc.ResetHeap();
  2499. InstrMalloc.SetFailAlloc(i + 1);
  2500. HRESULT hrOp = m_dllSupport.CreateInstance2(&InstrMalloc, CLSID_DxcCompiler, &pCompiler);
  2501. if (SUCCEEDED(hrOp)) {
  2502. hrOp = pCompiler->Compile(pSource, L"source.hlsl", L"main", L"cs_6_0",
  2503. nullptr, 0, nullptr, 0, nullptr, &pResult);
  2504. if (SUCCEEDED(hrOp)) {
  2505. pResult->GetStatus(&hrOp);
  2506. }
  2507. }
  2508. if (FAILED(hrOp)) {
  2509. // This is true in *almost* every case. When the OOM happens during stream
  2510. // handling, there is no specific error set; by the time it's detected,
  2511. // it propagates as E_FAIL.
  2512. //VERIFY_ARE_EQUAL(hrOp, E_OUTOFMEMORY);
  2513. VERIFY_IS_TRUE(hrOp == E_OUTOFMEMORY || hrOp == E_FAIL);
  2514. }
  2515. if (isLast)
  2516. VERIFY_SUCCEEDED(hrOp);
  2517. else
  2518. VERIFY_FAILED(hrOp);
  2519. pCompiler.Release();
  2520. pResult.Release();
  2521. VERIFY_IS_TRUE(0 == InstrMalloc.GetSize()); // breakpoint for i failure - i == val
  2522. VERIFY_ARE_EQUAL(initialRefCount, InstrMalloc.GetRefCount());
  2523. }
  2524. }
  2525. TEST_F(CompilerTest, CompileWhenShaderModelMismatchAttributeThenFail) {
  2526. CComPtr<IDxcCompiler> pCompiler;
  2527. CComPtr<IDxcOperationResult> pResult;
  2528. CComPtr<IDxcBlobEncoding> pSource;
  2529. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2530. CreateBlobFromText(EmptyCompute, &pSource);
  2531. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2532. L"ps_6_0", nullptr, 0, nullptr, 0, nullptr, &pResult));
  2533. std::string failLog(VerifyOperationFailed(pResult));
  2534. VERIFY_ARE_NOT_EQUAL(string::npos, failLog.find("attribute numthreads only valid for CS"));
  2535. }
  2536. TEST_F(CompilerTest, CompileBadHlslThenFail) {
  2537. CComPtr<IDxcCompiler> pCompiler;
  2538. CComPtr<IDxcOperationResult> pResult;
  2539. CComPtr<IDxcBlobEncoding> pSource;
  2540. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2541. CreateBlobFromText(
  2542. "bad hlsl", &pSource);
  2543. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2544. L"ps_6_0", nullptr, 0, nullptr, 0, nullptr, &pResult));
  2545. HRESULT status;
  2546. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2547. VERIFY_FAILED(status);
  2548. }
  2549. TEST_F(CompilerTest, CompileLegacyShaderModelThenFail) {
  2550. VerifyCompileFailed(
  2551. "float4 main(float4 pos : SV_Position) : SV_Target { return pos; }", L"ps_5_1", nullptr);
  2552. }
  2553. TEST_F(CompilerTest, CompileWhenRecursiveAlbeitStaticTermThenFail) {
  2554. // This shader will compile under fxc because if execution is
  2555. // simulated statically, it does terminate. dxc changes this behavior
  2556. // to avoid imposing the requirement on the compiler.
  2557. const char ShaderText[] =
  2558. "static int i = 10;\r\n"
  2559. "float4 f(); // Forward declaration\r\n"
  2560. "float4 g() { if (i > 10) { i--; return f(); } else return 0; } // Recursive call to 'f'\r\n"
  2561. "float4 f() { return g(); } // First call to 'g'\r\n"
  2562. "float4 VS() : SV_Position{\r\n"
  2563. " return f(); // First call to 'f'\r\n"
  2564. "}\r\n";
  2565. VerifyCompileFailed(ShaderText, L"vs_6_0", "recursive functions not allowed", L"VS");
  2566. }
  2567. TEST_F(CompilerTest, CompileWhenRecursiveThenFail) {
  2568. const char ShaderTextSimple[] =
  2569. "float4 f(); // Forward declaration\r\n"
  2570. "float4 g() { return f(); } // Recursive call to 'f'\r\n"
  2571. "float4 f() { return g(); } // First call to 'g'\r\n"
  2572. "float4 main() : SV_Position{\r\n"
  2573. " return f(); // First call to 'f'\r\n"
  2574. "}\r\n";
  2575. VerifyCompileFailed(ShaderTextSimple, L"vs_6_0", "recursive functions not allowed");
  2576. const char ShaderTextIndirect[] =
  2577. "float4 f(); // Forward declaration\r\n"
  2578. "float4 g() { return f(); } // Recursive call to 'f'\r\n"
  2579. "float4 f() { return g(); } // First call to 'g'\r\n"
  2580. "float4 main() : SV_Position{\r\n"
  2581. " return f(); // First call to 'f'\r\n"
  2582. "}\r\n";
  2583. VerifyCompileFailed(ShaderTextIndirect, L"vs_6_0", "recursive functions not allowed");
  2584. const char ShaderTextSelf[] =
  2585. "float4 main() : SV_Position{\r\n"
  2586. " return main();\r\n"
  2587. "}\r\n";
  2588. VerifyCompileFailed(ShaderTextSelf, L"vs_6_0", "recursive functions not allowed");
  2589. const char ShaderTextMissing[] =
  2590. "float4 mainz() : SV_Position{\r\n"
  2591. " return 1;\r\n"
  2592. "}\r\n";
  2593. VerifyCompileFailed(ShaderTextMissing, L"vs_6_0", "missing entry point definition");
  2594. }
  2595. TEST_F(CompilerTest, CompileHlsl2015ThenFail) {
  2596. CComPtr<IDxcCompiler> pCompiler;
  2597. CComPtr<IDxcOperationResult> pResult;
  2598. CComPtr<IDxcBlobEncoding> pSource;
  2599. CComPtr<IDxcBlobEncoding> pErrors;
  2600. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2601. CreateBlobFromText("float4 main(float4 pos : SV_Position) : SV_Target { return pos; }", &pSource);
  2602. LPCWSTR args[2] = { L"-HV", L"2015" };
  2603. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2604. L"ps_6_0", args, 2, nullptr, 0, nullptr, &pResult));
  2605. HRESULT status;
  2606. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2607. VERIFY_ARE_EQUAL(status, E_INVALIDARG);
  2608. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrors));
  2609. LPCSTR pErrorMsg = "HLSL Version 2015 is only supported for language services";
  2610. CheckOperationResultMsgs(pResult, &pErrorMsg, 1, false, false);
  2611. }
  2612. TEST_F(CompilerTest, CompileHlsl2016ThenOK) {
  2613. CComPtr<IDxcCompiler> pCompiler;
  2614. CComPtr<IDxcOperationResult> pResult;
  2615. CComPtr<IDxcBlobEncoding> pSource;
  2616. CComPtr<IDxcBlobEncoding> pErrors;
  2617. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2618. CreateBlobFromText("float4 main(float4 pos : SV_Position) : SV_Target { return pos; }", &pSource);
  2619. LPCWSTR args[2] = { L"-HV", L"2016" };
  2620. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2621. L"ps_6_0", args, 2, nullptr, 0, nullptr, &pResult));
  2622. HRESULT status;
  2623. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2624. VERIFY_SUCCEEDED(status);
  2625. }
  2626. TEST_F(CompilerTest, CompileHlsl2017ThenOK) {
  2627. CComPtr<IDxcCompiler> pCompiler;
  2628. CComPtr<IDxcOperationResult> pResult;
  2629. CComPtr<IDxcBlobEncoding> pSource;
  2630. CComPtr<IDxcBlobEncoding> pErrors;
  2631. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2632. CreateBlobFromText("float4 main(float4 pos : SV_Position) : SV_Target { return pos; }", &pSource);
  2633. LPCWSTR args[2] = { L"-HV", L"2017" };
  2634. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2635. L"ps_6_0", args, 2, nullptr, 0, nullptr, &pResult));
  2636. HRESULT status;
  2637. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2638. VERIFY_SUCCEEDED(status);
  2639. }
  2640. TEST_F(CompilerTest, CompileHlsl2018ThenOK) {
  2641. CComPtr<IDxcCompiler> pCompiler;
  2642. CComPtr<IDxcOperationResult> pResult;
  2643. CComPtr<IDxcBlobEncoding> pSource;
  2644. CComPtr<IDxcBlobEncoding> pErrors;
  2645. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2646. CreateBlobFromText("float4 main(float4 pos : SV_Position) : SV_Target { return pos; }", &pSource);
  2647. LPCWSTR args[2] = { L"-HV", L"2018" };
  2648. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2649. L"ps_6_0", args, 2, nullptr, 0, nullptr, &pResult));
  2650. HRESULT status;
  2651. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2652. VERIFY_SUCCEEDED(status);
  2653. }
  2654. TEST_F(CompilerTest, CompileHlsl2019ThenFail) {
  2655. CComPtr<IDxcCompiler> pCompiler;
  2656. CComPtr<IDxcOperationResult> pResult;
  2657. CComPtr<IDxcBlobEncoding> pSource;
  2658. CComPtr<IDxcBlobEncoding> pErrors;
  2659. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  2660. CreateBlobFromText("float4 main(float4 pos : SV_Position) : SV_Target { return pos; }", &pSource);
  2661. LPCWSTR args[2] = { L"-HV", L"2019" };
  2662. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  2663. L"ps_6_0", args, 2, nullptr, 0, nullptr, &pResult));
  2664. HRESULT status;
  2665. VERIFY_SUCCEEDED(pResult->GetStatus(&status));
  2666. VERIFY_ARE_EQUAL(status, E_INVALIDARG);
  2667. VERIFY_SUCCEEDED(pResult->GetErrorBuffer(&pErrors));
  2668. LPCSTR pErrorMsg = "Unknown HLSL version";
  2669. CheckOperationResultMsgs(pResult, &pErrorMsg, 1, false, false);
  2670. }
  2671. TEST_F(CompilerTest, CompileCBufferTBufferASTDump) {
  2672. CodeGenTestCheck(L"ctbuf.hlsl");
  2673. }
  2674. TEST_F(CompilerTest, DiaLoadBadBitcodeThenFail) {
  2675. CComPtr<IDxcBlob> pBadBitcode;
  2676. CComPtr<IDiaDataSource> pDiaSource;
  2677. CComPtr<IStream> pStream;
  2678. CComPtr<IDxcLibrary> pLib;
  2679. Utf8ToBlob(m_dllSupport, "badcode", &pBadBitcode);
  2680. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcLibrary, &pLib));
  2681. VERIFY_SUCCEEDED(pLib->CreateStreamFromBlobReadOnly(pBadBitcode, &pStream));
  2682. VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcDiaDataSource, &pDiaSource));
  2683. VERIFY_FAILED(pDiaSource->loadDataFromIStream(pStream));
  2684. }
  2685. static void CompileTestAndLoadDia(dxc::DxcDllSupport &dllSupport, IDiaDataSource **ppDataSource) {
  2686. CComPtr<IDxcBlob> pContainer;
  2687. CComPtr<IDxcBlob> pDebugContent;
  2688. CComPtr<IDiaDataSource> pDiaSource;
  2689. CComPtr<IStream> pStream;
  2690. CComPtr<IDxcLibrary> pLib;
  2691. CComPtr<IDxcContainerReflection> pReflection;
  2692. UINT32 index;
  2693. VerifyCompileOK(dllSupport, EmptyCompute, L"cs_6_0", L"/Zi", &pContainer);
  2694. VERIFY_SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcLibrary, &pLib));
  2695. VERIFY_SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcContainerReflection, &pReflection));
  2696. VERIFY_SUCCEEDED(pReflection->Load(pContainer));
  2697. VERIFY_SUCCEEDED(pReflection->FindFirstPartKind(hlsl::DFCC_ShaderDebugInfoDXIL, &index));
  2698. VERIFY_SUCCEEDED(pReflection->GetPartContent(index, &pDebugContent));
  2699. VERIFY_SUCCEEDED(pLib->CreateStreamFromBlobReadOnly(pDebugContent, &pStream));
  2700. VERIFY_SUCCEEDED(dllSupport.CreateInstance(CLSID_DxcDiaDataSource, &pDiaSource));
  2701. VERIFY_SUCCEEDED(pDiaSource->loadDataFromIStream(pStream));
  2702. if (ppDataSource) {
  2703. *ppDataSource = pDiaSource.Detach();
  2704. }
  2705. }
  2706. TEST_F(CompilerTest, DiaLoadDebugThenOK) {
  2707. CompileTestAndLoadDia(m_dllSupport, nullptr);
  2708. }
  2709. TEST_F(CompilerTest, DiaTableIndexThenOK) {
  2710. CComPtr<IDiaDataSource> pDiaSource;
  2711. CComPtr<IDiaSession> pDiaSession;
  2712. CComPtr<IDiaEnumTables> pEnumTables;
  2713. CComPtr<IDiaTable> pTable;
  2714. VARIANT vtIndex;
  2715. CompileTestAndLoadDia(m_dllSupport, &pDiaSource);
  2716. VERIFY_SUCCEEDED(pDiaSource->openSession(&pDiaSession));
  2717. VERIFY_SUCCEEDED(pDiaSession->getEnumTables(&pEnumTables));
  2718. vtIndex.vt = VT_EMPTY;
  2719. VERIFY_FAILED(pEnumTables->Item(vtIndex, &pTable));
  2720. vtIndex.vt = VT_I4;
  2721. vtIndex.intVal = 1;
  2722. VERIFY_SUCCEEDED(pEnumTables->Item(vtIndex, &pTable));
  2723. VERIFY_IS_NOT_NULL(pTable.p);
  2724. pTable.Release();
  2725. vtIndex.vt = VT_UI4;
  2726. vtIndex.uintVal = 1;
  2727. VERIFY_SUCCEEDED(pEnumTables->Item(vtIndex, &pTable));
  2728. VERIFY_IS_NOT_NULL(pTable.p);
  2729. pTable.Release();
  2730. vtIndex.uintVal = 100;
  2731. VERIFY_FAILED(pEnumTables->Item(vtIndex, &pTable));
  2732. }
  2733. TEST_F(CompilerTest, PixMSAAToSample0) {
  2734. CodeGenTestCheck(L"pix\\msaaLoad.hlsl");
  2735. }
  2736. TEST_F(CompilerTest, PixRemoveDiscards) {
  2737. CodeGenTestCheck(L"pix\\removeDiscards.hlsl");
  2738. }
  2739. TEST_F(CompilerTest, PixPixelCounter) {
  2740. CodeGenTestCheck(L"pix\\pixelCounter.hlsl");
  2741. }
  2742. TEST_F(CompilerTest, PixPixelCounterEarlyZ) {
  2743. CodeGenTestCheck(L"pix\\pixelCounterEarlyZ.hlsl");
  2744. }
  2745. TEST_F(CompilerTest, PixPixelCounterNoSvPosition) {
  2746. CodeGenTestCheck(L"pix\\pixelCounterNoSvPosition.hlsl");
  2747. }
  2748. TEST_F(CompilerTest, PixPixelCounterAddPixelCost) {
  2749. CodeGenTestCheck(L"pix\\pixelCounterAddPixelCost.hlsl");
  2750. }
  2751. TEST_F(CompilerTest, PixConstantColor) {
  2752. CodeGenTestCheck(L"pix\\constantcolor.hlsl");
  2753. }
  2754. TEST_F(CompilerTest, PixConstantColorInt) {
  2755. CodeGenTestCheck(L"pix\\constantcolorint.hlsl");
  2756. }
  2757. TEST_F(CompilerTest, PixConstantColorMRT) {
  2758. CodeGenTestCheck(L"pix\\constantcolorMRT.hlsl");
  2759. }
  2760. TEST_F(CompilerTest, PixConstantColorUAVs) {
  2761. CodeGenTestCheck(L"pix\\constantcolorUAVs.hlsl");
  2762. }
  2763. TEST_F(CompilerTest, PixConstantColorOtherSIVs) {
  2764. CodeGenTestCheck(L"pix\\constantcolorOtherSIVs.hlsl");
  2765. }
  2766. TEST_F(CompilerTest, PixConstantColorFromCB) {
  2767. CodeGenTestCheck(L"pix\\constantcolorFromCB.hlsl");
  2768. }
  2769. TEST_F(CompilerTest, PixConstantColorFromCBint) {
  2770. CodeGenTestCheck(L"pix\\constantcolorFromCBint.hlsl");
  2771. }
  2772. TEST_F(CompilerTest, PixForceEarlyZ) {
  2773. CodeGenTestCheck(L"pix\\forceEarlyZ.hlsl");
  2774. }
  2775. TEST_F(CompilerTest, PixDebugBasic) {
  2776. CodeGenTestCheck(L"pix\\DebugBasic.hlsl");
  2777. }
  2778. TEST_F(CompilerTest, PixDebugUAVSize) {
  2779. CodeGenTestCheck(L"pix\\DebugUAVSize.hlsl");
  2780. }
  2781. TEST_F(CompilerTest, PixDebugGSParameters) {
  2782. CodeGenTestCheck(L"pix\\DebugGSParameters.hlsl");
  2783. }
  2784. TEST_F(CompilerTest, PixDebugPSParameters) {
  2785. CodeGenTestCheck(L"pix\\DebugPSParameters.hlsl");
  2786. }
  2787. TEST_F(CompilerTest, PixDebugVSParameters) {
  2788. CodeGenTestCheck(L"pix\\DebugVSParameters.hlsl");
  2789. }
  2790. TEST_F(CompilerTest, PixDebugCSParameters) {
  2791. CodeGenTestCheck(L"pix\\DebugCSParameters.hlsl");
  2792. }
  2793. TEST_F(CompilerTest, PixDebugFlowControl) {
  2794. CodeGenTestCheck(L"pix\\DebugFlowControl.hlsl");
  2795. }
  2796. TEST_F(CompilerTest, PixDebugPreexistingSVPosition) {
  2797. CodeGenTestCheck(L"pix\\DebugPreexistingSVPosition.hlsl");
  2798. }
  2799. TEST_F(CompilerTest, PixDebugPreexistingSVVertex) {
  2800. CodeGenTestCheck(L"pix\\DebugPreexistingSVVertex.hlsl");
  2801. }
  2802. TEST_F(CompilerTest, PixDebugPreexistingSVInstance) {
  2803. CodeGenTestCheck(L"pix\\DebugPreexistingSVInstance.hlsl");
  2804. }
  2805. TEST_F(CompilerTest, PixAccessTracking) {
  2806. CodeGenTestCheck(L"pix\\AccessTracking.hlsl");
  2807. }
  2808. TEST_F(CompilerTest, CodeGenAbs1) {
  2809. CodeGenTestCheck(L"..\\CodeGenHLSL\\abs1.hlsl");
  2810. }
  2811. TEST_F(CompilerTest, CodeGenAbs2) {
  2812. CodeGenTest(L"..\\CodeGenHLSL\\abs2.hlsl");
  2813. }
  2814. TEST_F(CompilerTest, CodeGenAllLit) {
  2815. CodeGenTest(L"..\\CodeGenHLSL\\all_lit.hlsl");
  2816. }
  2817. TEST_F(CompilerTest, CodeGenAllocaAtEntryBlk) {
  2818. CodeGenTest(L"..\\CodeGenHLSL\\alloca_at_entry_blk.hlsl");
  2819. }
  2820. TEST_F(CompilerTest, CodeGenAddUint64) {
  2821. CodeGenTestCheck(L"..\\CodeGenHLSL\\AddUint64.hlsl");
  2822. }
  2823. TEST_F(CompilerTest, CodeGenArrayArg){
  2824. CodeGenTest(L"..\\CodeGenHLSL\\arrayArg.hlsl");
  2825. }
  2826. TEST_F(CompilerTest, CodeGenArrayArg2){
  2827. CodeGenTest(L"..\\CodeGenHLSL\\arrayArg2.hlsl");
  2828. }
  2829. TEST_F(CompilerTest, CodeGenArrayArg3){
  2830. CodeGenTest(L"..\\CodeGenHLSL\\arrayArg3.hlsl");
  2831. }
  2832. TEST_F(CompilerTest, CodeGenArrayOfStruct){
  2833. CodeGenTest(L"..\\CodeGenHLSL\\arrayOfStruct.hlsl");
  2834. }
  2835. TEST_F(CompilerTest, CodeGenAsUint) {
  2836. CodeGenTestCheck(L"..\\CodeGenHLSL\\asuint.hlsl");
  2837. }
  2838. TEST_F(CompilerTest, CodeGenAsUint2) {
  2839. CodeGenTestCheck(L"..\\CodeGenHLSL\\asuint2.hlsl");
  2840. }
  2841. TEST_F(CompilerTest, CodeGenAtomic) {
  2842. CodeGenTestCheck(L"..\\CodeGenHLSL\\atomic.hlsl");
  2843. }
  2844. TEST_F(CompilerTest, CodeGenAtomic2) {
  2845. CodeGenTestCheck(L"..\\CodeGenHLSL\\atomic2.hlsl");
  2846. }
  2847. TEST_F(CompilerTest, CodeGenAttributeAtVertex) {
  2848. if (m_ver.SkipDxilVersion(1,1)) return;
  2849. CodeGenTestCheck(L"..\\CodeGenHLSL\\attributeAtVertex.hlsl");
  2850. }
  2851. TEST_F(CompilerTest, CodeGenAttributeAtVertexNoOpt) {
  2852. if (m_ver.SkipDxilVersion(1,1)) return;
  2853. CodeGenTestCheck(L"..\\CodeGenHLSL\\attributeAtVertexNoOpt.hlsl");
  2854. }
  2855. TEST_F(CompilerTest, CodeGenBarycentrics) {
  2856. if (m_ver.SkipDxilVersion(1,1)) return;
  2857. CodeGenTestCheck(L"..\\CodeGenHLSL\\barycentrics.hlsl");
  2858. }
  2859. TEST_F(CompilerTest, CodeGenBarycentrics1) {
  2860. if (m_ver.SkipDxilVersion(1,1)) return;
  2861. CodeGenTestCheck(L"..\\CodeGenHLSL\\barycentrics1.hlsl");
  2862. }
  2863. TEST_F(CompilerTest, CodeGenBarycentricsThreeSV) {
  2864. if (m_ver.SkipDxilVersion(1,1)) return;
  2865. CodeGenTestCheck(L"..\\CodeGenHLSL\\barycentricsThreeSV.hlsl");
  2866. }
  2867. TEST_F(CompilerTest, CodeGenBinary1) {
  2868. CodeGenTest(L"..\\CodeGenHLSL\\binary1.hlsl");
  2869. }
  2870. TEST_F(CompilerTest, CodeGenBitCast) {
  2871. CodeGenTestCheck(L"..\\CodeGenHLSL\\bitcast.hlsl");
  2872. }
  2873. TEST_F(CompilerTest, CodeGenBitCast16Bits) {
  2874. if (m_ver.SkipDxilVersion(1, 2)) return;
  2875. CodeGenTestCheck(L"..\\CodeGenHLSL\\bitcast_16bits.hlsl");
  2876. }
  2877. TEST_F(CompilerTest, CodeGenBoolComb) {
  2878. CodeGenTest(L"..\\CodeGenHLSL\\boolComb.hlsl");
  2879. }
  2880. TEST_F(CompilerTest, CodeGenBoolSvTarget) {
  2881. CodeGenTestCheck(L"..\\CodeGenHLSL\\boolSvTarget.hlsl");
  2882. }
  2883. TEST_F(CompilerTest, CodeGenCalcLod2DArray) {
  2884. CodeGenTestCheck(L"..\\CodeGenHLSL\\calcLod2DArray.hlsl");
  2885. }
  2886. TEST_F(CompilerTest, CodeGenCall1) {
  2887. CodeGenTest(L"..\\CodeGenHLSL\\call1.hlsl");
  2888. }
  2889. TEST_F(CompilerTest, CodeGenCall3) {
  2890. CodeGenTest(L"..\\CodeGenHLSL\\call3.hlsl");
  2891. }
  2892. TEST_F(CompilerTest, CodeGenCast1) {
  2893. CodeGenTest(L"..\\CodeGenHLSL\\cast1.hlsl");
  2894. }
  2895. TEST_F(CompilerTest, CodeGenCast2) {
  2896. CodeGenTest(L"..\\CodeGenHLSL\\cast2.hlsl");
  2897. }
  2898. TEST_F(CompilerTest, CodeGenCast3) {
  2899. CodeGenTest(L"..\\CodeGenHLSL\\cast3.hlsl");
  2900. }
  2901. TEST_F(CompilerTest, CodeGenCast4) {
  2902. CodeGenTest(L"..\\CodeGenHLSL\\cast4.hlsl");
  2903. }
  2904. TEST_F(CompilerTest, CodeGenCast5) {
  2905. CodeGenTestCheck(L"..\\CodeGenHLSL\\cast5.hlsl");
  2906. }
  2907. TEST_F(CompilerTest, CodeGenCast6) {
  2908. CodeGenTestCheck(L"..\\CodeGenHLSL\\cast6.hlsl");
  2909. }
  2910. TEST_F(CompilerTest, CodeGenCast7) {
  2911. CodeGenTestCheck(L"..\\CodeGenHLSL\\cast7.hlsl");
  2912. }
  2913. TEST_F(CompilerTest, CodeGenCbuf_init_static) {
  2914. CodeGenTest(L"..\\CodeGenHLSL\\cbuf_init_static.hlsl");
  2915. }
  2916. TEST_F(CompilerTest, CodeGenCbufferCopy) {
  2917. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_copy.hlsl");
  2918. }
  2919. TEST_F(CompilerTest, CodeGenCbufferCopy1) {
  2920. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_copy1.hlsl");
  2921. }
  2922. TEST_F(CompilerTest, CodeGenCbufferCopy2) {
  2923. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_copy2.hlsl");
  2924. }
  2925. TEST_F(CompilerTest, CodeGenCbufferCopy3) {
  2926. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_copy3.hlsl");
  2927. }
  2928. TEST_F(CompilerTest, CodeGenCbufferCopy4) {
  2929. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_copy4.hlsl");
  2930. }
  2931. TEST_F(CompilerTest, CodeGenCbufferWithFunction) {
  2932. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_fn.hlsl");
  2933. }
  2934. TEST_F(CompilerTest, CodeGenCbufferWithFunctionCopy) {
  2935. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer_fn_copy.hlsl");
  2936. }
  2937. TEST_F(CompilerTest, CodeGenCbuffer_unused) {
  2938. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer_unused.hlsl");
  2939. }
  2940. TEST_F(CompilerTest, CodeGenCbuffer1_50) {
  2941. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer1.50.hlsl");
  2942. }
  2943. TEST_F(CompilerTest, CodeGenCbuffer1_51) {
  2944. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer1.51.hlsl");
  2945. }
  2946. TEST_F(CompilerTest, CodeGenCbuffer2_50) {
  2947. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer2.50.hlsl");
  2948. }
  2949. TEST_F(CompilerTest, CodeGenCbuffer2_51) {
  2950. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer2.51.hlsl");
  2951. }
  2952. TEST_F(CompilerTest, CodeGenCbuffer3_50) {
  2953. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer3.50.hlsl");
  2954. }
  2955. TEST_F(CompilerTest, CodeGenCbuffer3_51) {
  2956. CodeGenTest(L"..\\CodeGenHLSL\\cbuffer3.51.hlsl");
  2957. }
  2958. TEST_F(CompilerTest, CodeGenCbuffer5_51) {
  2959. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer5.51.hlsl");
  2960. }
  2961. TEST_F(CompilerTest, CodeGenCbuffer6_51) {
  2962. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer6.51.hlsl");
  2963. }
  2964. TEST_F(CompilerTest, CodeGenCbuffer64Types) {
  2965. if (m_ver.SkipDxilVersion(1, 2)) return;
  2966. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer64Types.hlsl");
  2967. }
  2968. TEST_F(CompilerTest, CodeGenCbufferAlloc) {
  2969. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferAlloc.hlsl");
  2970. }
  2971. TEST_F(CompilerTest, CodeGenCbufferAllocLegacy) {
  2972. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferAlloc_legacy.hlsl");
  2973. }
  2974. TEST_F(CompilerTest, CodeGenCbufferHalf) {
  2975. if (m_ver.SkipDxilVersion(1, 2)) return;
  2976. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferHalf.hlsl");
  2977. }
  2978. TEST_F(CompilerTest, CodeGenCbufferHalfStruct) {
  2979. if (m_ver.SkipDxilVersion(1, 2)) return;
  2980. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferHalf-struct.hlsl");
  2981. }
  2982. TEST_F(CompilerTest, CodeGenCbufferInLoop) {
  2983. CodeGenTest(L"..\\CodeGenHLSL\\cbufferInLoop.hlsl");
  2984. }
  2985. TEST_F(CompilerTest, CodeGenCbufferInt16) {
  2986. if (m_ver.SkipDxilVersion(1, 2)) return;
  2987. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferInt16.hlsl");
  2988. }
  2989. TEST_F(CompilerTest, CodeGenCbufferInt16Struct) {
  2990. if (m_ver.SkipDxilVersion(1, 2)) return;
  2991. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferInt16-struct.hlsl");
  2992. }
  2993. TEST_F(CompilerTest, CodeGenCbufferMinPrec) {
  2994. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbufferMinPrec.hlsl");
  2995. }
  2996. TEST_F(CompilerTest, CodeGenClass) {
  2997. CodeGenTestCheck(L"..\\CodeGenHLSL\\class.hlsl");
  2998. }
  2999. TEST_F(CompilerTest, CodeGenClip) {
  3000. CodeGenTestCheck(L"..\\CodeGenHLSL\\clip.hlsl");
  3001. }
  3002. TEST_F(CompilerTest, CodeGenClipPlanes) {
  3003. CodeGenTestCheck(L"..\\CodeGenHLSL\\clip_planes.hlsl");
  3004. }
  3005. TEST_F(CompilerTest, CodeGenConstoperand1) {
  3006. CodeGenTest(L"..\\CodeGenHLSL\\constoperand1.hlsl");
  3007. }
  3008. TEST_F(CompilerTest, CodeGenConstMat) {
  3009. CodeGenTestCheck(L"..\\CodeGenHLSL\\constMat.hlsl");
  3010. }
  3011. TEST_F(CompilerTest, CodeGenConstMat2) {
  3012. CodeGenTestCheck(L"..\\CodeGenHLSL\\constMat2.hlsl");
  3013. }
  3014. TEST_F(CompilerTest, CodeGenConstMat3) {
  3015. CodeGenTestCheck(L"..\\CodeGenHLSL\\constMat3.hlsl");
  3016. }
  3017. TEST_F(CompilerTest, CodeGenConstMat4) {
  3018. CodeGenTestCheck(L"..\\CodeGenHLSL\\constMat4.hlsl");
  3019. }
  3020. TEST_F(CompilerTest, CodeGenCorrectDelay) {
  3021. CodeGenTestCheck(L"..\\CodeGenHLSL\\correct_delay.hlsl");
  3022. }
  3023. TEST_F(CompilerTest, CodeGenDataLayout) {
  3024. CodeGenTestCheck(L"..\\CodeGenHLSL\\dataLayout.hlsl");
  3025. }
  3026. TEST_F(CompilerTest, CodeGenDataLayoutHalf) {
  3027. if (m_ver.SkipDxilVersion(1, 2)) return;
  3028. CodeGenTestCheck(L"..\\CodeGenHLSL\\dataLayoutHalf.hlsl");
  3029. }
  3030. TEST_F(CompilerTest, CodeGenDiscard) {
  3031. CodeGenTestCheck(L"..\\CodeGenHLSL\\discard.hlsl");
  3032. }
  3033. TEST_F(CompilerTest, CodeGenDivZero) {
  3034. CodeGenTestCheck(L"..\\CodeGenHLSL\\divZero.hlsl");
  3035. }
  3036. TEST_F(CompilerTest, CodeGenDot1) {
  3037. CodeGenTest(L"..\\CodeGenHLSL\\dot1.hlsl");
  3038. }
  3039. TEST_F(CompilerTest, CodeGenDynamic_Resources) {
  3040. CodeGenTestCheck(L"..\\CodeGenHLSL\\dynamic-resources.hlsl");
  3041. }
  3042. TEST_F(CompilerTest, CodeGenEffectSkip) {
  3043. CodeGenTestCheck(L"..\\CodeGenHLSL\\effect_skip.hlsl");
  3044. }
  3045. TEST_F(CompilerTest, CodeGenEliminateDynamicIndexing) {
  3046. CodeGenTestCheck(L"eliminate_dynamic_output.hlsl");
  3047. }
  3048. TEST_F(CompilerTest, CodeGenEliminateDynamicIndexing2) {
  3049. CodeGenTestCheck(L"eliminate_dynamic_output2.hlsl");
  3050. }
  3051. TEST_F(CompilerTest, CodeGenEliminateDynamicIndexing3) {
  3052. CodeGenTestCheck(L"eliminate_dynamic_output3.hlsl");
  3053. }
  3054. TEST_F(CompilerTest, CodeGenEliminateDynamicIndexing4) {
  3055. CodeGenTestCheck(L"eliminate_dynamic_output4.hlsl");
  3056. }
  3057. TEST_F(CompilerTest, CodeGenEliminateDynamicIndexing5) {
  3058. CodeGenTestCheck(L"eliminate_dynamic_output5.hlsl");
  3059. }
  3060. TEST_F(CompilerTest, CodeGenEliminateDynamicIndexing6) {
  3061. CodeGenTestCheck(L"eliminate_dynamic_output6.hlsl");
  3062. }
  3063. TEST_F(CompilerTest, CodeGenEmpty) {
  3064. CodeGenTest(L"..\\CodeGenHLSL\\empty.hlsl");
  3065. }
  3066. TEST_F(CompilerTest, CodeGenEmptyStruct) {
  3067. CodeGenTestCheck(L"..\\CodeGenHLSL\\emptyStruct.hlsl");
  3068. }
  3069. TEST_F(CompilerTest, CodeGenEnum1) {
  3070. CodeGenTestCheck(L"..\\CodeGenHLSL\\enum1.hlsl");
  3071. }
  3072. TEST_F(CompilerTest, CodeGenEnum2) {
  3073. CodeGenTestCheck(L"..\\CodeGenHLSL\\enum2.hlsl");
  3074. }
  3075. TEST_F(CompilerTest, CodeGenEnum3) {
  3076. if (m_ver.SkipDxilVersion(1,1)) return;
  3077. CodeGenTestCheck(L"..\\CodeGenHLSL\\enum3.hlsl");
  3078. }
  3079. TEST_F(CompilerTest, CodeGenEnum4) {
  3080. CodeGenTestCheck(L"..\\CodeGenHLSL\\enum4.hlsl");
  3081. }
  3082. TEST_F(CompilerTest, CodeGenEnum5) {
  3083. CodeGenTestCheck(L"..\\CodeGenHLSL\\enum5.hlsl");
  3084. }
  3085. TEST_F(CompilerTest, CodeGenEnum6) {
  3086. CodeGenTestCheck(L"..\\CodeGenHLSL\\enum6.hlsl");
  3087. }
  3088. TEST_F(CompilerTest, CodeGenEarlyDepthStencil) {
  3089. CodeGenTestCheck(L"..\\CodeGenHLSL\\earlyDepthStencil.hlsl");
  3090. }
  3091. TEST_F(CompilerTest, CodeGenEval) {
  3092. CodeGenTestCheck(L"..\\CodeGenHLSL\\eval.hlsl");
  3093. }
  3094. TEST_F(CompilerTest, CodeGenEvalInvalid) {
  3095. CodeGenTestCheck(L"..\\CodeGenHLSL\\evalInvalid.hlsl");
  3096. }
  3097. TEST_F(CompilerTest, CodeGenEvalMat) {
  3098. CodeGenTestCheck(L"..\\CodeGenHLSL\\evalMat.hlsl");
  3099. }
  3100. TEST_F(CompilerTest, CodeGenEvalMatMember) {
  3101. CodeGenTestCheck(L"..\\CodeGenHLSL\\evalMatMember.hlsl");
  3102. }
  3103. TEST_F(CompilerTest, CodeGenEvalPos) {
  3104. CodeGenTestCheck(L"..\\CodeGenHLSL\\evalPos.hlsl");
  3105. }
  3106. TEST_F(CompilerTest, CodeGenExternRes) {
  3107. CodeGenTestCheck(L"..\\CodeGenHLSL\\extern_res.hlsl");
  3108. }
  3109. TEST_F(CompilerTest, CodeGenExpandTrig) {
  3110. CodeGenTestCheck(L"expand_trig\\acos.hlsl");
  3111. CodeGenTestCheck(L"expand_trig\\acos_h.hlsl");
  3112. CodeGenTestCheck(L"expand_trig\\asin.hlsl");
  3113. CodeGenTestCheck(L"expand_trig\\asin_h.hlsl");
  3114. CodeGenTestCheck(L"expand_trig\\atan.hlsl");
  3115. CodeGenTestCheck(L"expand_trig\\atan_h.hlsl");
  3116. CodeGenTestCheck(L"expand_trig\\hcos.hlsl");
  3117. CodeGenTestCheck(L"expand_trig\\hcos_h.hlsl");
  3118. CodeGenTestCheck(L"expand_trig\\hsin.hlsl");
  3119. CodeGenTestCheck(L"expand_trig\\hsin_h.hlsl");
  3120. CodeGenTestCheck(L"expand_trig\\htan.hlsl");
  3121. CodeGenTestCheck(L"expand_trig\\htan_h.hlsl");
  3122. CodeGenTestCheck(L"expand_trig\\tan.hlsl");
  3123. CodeGenTestCheck(L"expand_trig\\keep_precise.0.hlsl");
  3124. CodeGenTestCheck(L"expand_trig\\keep_precise.1.hlsl");
  3125. }
  3126. TEST_F(CompilerTest, CodeGenFloatCast) {
  3127. CodeGenTestCheck(L"..\\CodeGenHLSL\\float_cast.hlsl");
  3128. }
  3129. TEST_F(CompilerTest, CodeGenFloatToBool) {
  3130. CodeGenTestCheck(L"..\\CodeGenHLSL\\float_to_bool.hlsl");
  3131. }
  3132. TEST_F(CompilerTest, CodeGenFirstbitHi) {
  3133. CodeGenTestCheck(L"..\\CodeGenHLSL\\firstbitHi.hlsl");
  3134. CodeGenTestCheck(L"..\\CodeGenHLSL\\firstbitshi_const.hlsl");
  3135. }
  3136. TEST_F(CompilerTest, CodeGenFirstbitLo) {
  3137. CodeGenTestCheck(L"..\\CodeGenHLSL\\firstbitLo.hlsl");
  3138. }
  3139. TEST_F(CompilerTest, CodeGenFixedWidthTypes) {
  3140. if (m_ver.SkipDxilVersion(1, 2)) return;
  3141. CodeGenTestCheck(L"..\\CodeGenHLSL\\fixedWidth.hlsl");
  3142. }
  3143. TEST_F(CompilerTest, CodeGenFixedWidthTypes16Bit) {
  3144. if (m_ver.SkipDxilVersion(1, 2)) return;
  3145. CodeGenTestCheck(L"..\\CodeGenHLSL\\fixedWidth16Bit.hlsl");
  3146. }
  3147. TEST_F(CompilerTest, CodeGenFloatMaxtessfactor) {
  3148. CodeGenTestCheck(L"..\\CodeGenHLSL\\FloatMaxtessfactorHs.hlsl");
  3149. }
  3150. TEST_F(CompilerTest, CodeGenFModPS) {
  3151. CodeGenTestCheck(L"..\\CodeGenHLSL\\fmodPS.hlsl");
  3152. }
  3153. TEST_F(CompilerTest, CodeGenFuncCast) {
  3154. CodeGenTestCheck(L"..\\CodeGenHLSL\\func_cast.hlsl");
  3155. }
  3156. TEST_F(CompilerTest, CodeGenFunctionalCast) {
  3157. CodeGenTestCheck(L"..\\CodeGenHLSL\\functionalCast.hlsl");
  3158. }
  3159. TEST_F(CompilerTest, CodeGenFunctionAttribute) {
  3160. if (m_ver.SkipDxilVersion(1, 2)) return;
  3161. CodeGenTestCheck(L"..\\CodeGenHLSL\\functionAttribute.hlsl");
  3162. }
  3163. TEST_F(CompilerTest, CodeGenGather) {
  3164. CodeGenTestCheck(L"..\\CodeGenHLSL\\gather.hlsl");
  3165. }
  3166. TEST_F(CompilerTest, CodeGenGatherCmp) {
  3167. CodeGenTestCheck(L"..\\CodeGenHLSL\\gatherCmp.hlsl");
  3168. }
  3169. TEST_F(CompilerTest, CodeGenGatherCubeOffset) {
  3170. CodeGenTestCheck(L"..\\CodeGenHLSL\\gatherCubeOffset.hlsl");
  3171. }
  3172. TEST_F(CompilerTest, CodeGenGatherOffset) {
  3173. CodeGenTestCheck(L"..\\CodeGenHLSL\\gatherOffset.hlsl");
  3174. }
  3175. TEST_F(CompilerTest, CodeGenGepZeroIdx) {
  3176. CodeGenTestCheck(L"..\\CodeGenHLSL\\gep_zero_idx.hlsl");
  3177. }
  3178. TEST_F(CompilerTest, CodeGenGloballyCoherent) {
  3179. CodeGenTestCheck(L"..\\CodeGenHLSL\\globallycoherent.hlsl");
  3180. }
  3181. TEST_F(CompilerTest, CodeGenI32ColIdx) {
  3182. CodeGenTest(L"..\\CodeGenHLSL\\i32colIdx.hlsl");
  3183. }
  3184. TEST_F(CompilerTest, CodeGenIcb1) {
  3185. CodeGenTest(L"..\\CodeGenHLSL\\icb1.hlsl");
  3186. }
  3187. TEST_F(CompilerTest, CodeGenIf1) { CodeGenTestCheck(L"..\\CodeGenHLSL\\if1.hlsl"); }
  3188. TEST_F(CompilerTest, CodeGenIf2) { CodeGenTestCheck(L"..\\CodeGenHLSL\\if2.hlsl"); }
  3189. TEST_F(CompilerTest, CodeGenIf3) { CodeGenTest(L"..\\CodeGenHLSL\\if3.hlsl"); }
  3190. TEST_F(CompilerTest, CodeGenIf4) { CodeGenTest(L"..\\CodeGenHLSL\\if4.hlsl"); }
  3191. TEST_F(CompilerTest, CodeGenIf5) { CodeGenTest(L"..\\CodeGenHLSL\\if5.hlsl"); }
  3192. TEST_F(CompilerTest, CodeGenIf6) { CodeGenTestCheck(L"..\\CodeGenHLSL\\if6.hlsl"); }
  3193. TEST_F(CompilerTest, CodeGenIf7) { CodeGenTestCheck(L"..\\CodeGenHLSL\\if7.hlsl"); }
  3194. TEST_F(CompilerTest, CodeGenIf8) { CodeGenTestCheck(L"..\\CodeGenHLSL\\if8.hlsl"); }
  3195. TEST_F(CompilerTest, CodeGenIf9) { CodeGenTestCheck(L"..\\CodeGenHLSL\\if9.hlsl"); }
  3196. TEST_F(CompilerTest, CodeGenImm0) {
  3197. CodeGenTestCheck(L"..\\CodeGenHLSL\\imm0.hlsl");
  3198. }
  3199. TEST_F(CompilerTest, CodeGenInclude) {
  3200. CodeGenTestCheck(L"..\\CodeGenHLSL\\Include.hlsl");
  3201. }
  3202. TEST_F(CompilerTest, CodeGenIncompletePos) {
  3203. CodeGenTestCheck(L"..\\CodeGenHLSL\\incompletePos.hlsl");
  3204. }
  3205. TEST_F(CompilerTest, CodeGenIndexableinput1) {
  3206. CodeGenTest(L"..\\CodeGenHLSL\\indexableinput1.hlsl");
  3207. }
  3208. TEST_F(CompilerTest, CodeGenIndexableinput2) {
  3209. CodeGenTest(L"..\\CodeGenHLSL\\indexableinput2.hlsl");
  3210. }
  3211. TEST_F(CompilerTest, CodeGenIndexableinput3) {
  3212. CodeGenTest(L"..\\CodeGenHLSL\\indexableinput3.hlsl");
  3213. }
  3214. TEST_F(CompilerTest, CodeGenIndexableinput4) {
  3215. CodeGenTest(L"..\\CodeGenHLSL\\indexableinput4.hlsl");
  3216. }
  3217. TEST_F(CompilerTest, CodeGenIndexableoutput1) {
  3218. CodeGenTest(L"..\\CodeGenHLSL\\indexableoutput1.hlsl");
  3219. }
  3220. TEST_F(CompilerTest, CodeGenIndexabletemp1) {
  3221. CodeGenTest(L"..\\CodeGenHLSL\\indexabletemp1.hlsl");
  3222. }
  3223. TEST_F(CompilerTest, CodeGenIndexabletemp2) {
  3224. CodeGenTest(L"..\\CodeGenHLSL\\indexabletemp2.hlsl");
  3225. }
  3226. TEST_F(CompilerTest, CodeGenIndexabletemp3) {
  3227. CodeGenTest(L"..\\CodeGenHLSL\\indexabletemp3.hlsl");
  3228. }
  3229. TEST_F(CompilerTest, CodeGenInitListType) {
  3230. CodeGenTestCheck(L"..\\CodeGenHLSL\\initlist_type.hlsl");
  3231. }
  3232. TEST_F(CompilerTest, CodeGenInoutSE) {
  3233. CodeGenTestCheck(L"..\\CodeGenHLSL\\inout_se.hlsl");
  3234. }
  3235. TEST_F(CompilerTest, CodeGenInout1) {
  3236. CodeGenTestCheck(L"..\\CodeGenHLSL\\inout1.hlsl");
  3237. }
  3238. TEST_F(CompilerTest, CodeGenInout2) {
  3239. CodeGenTestCheck(L"..\\CodeGenHLSL\\inout2.hlsl");
  3240. }
  3241. TEST_F(CompilerTest, CodeGenInout3) {
  3242. CodeGenTestCheck(L"..\\CodeGenHLSL\\inout3.hlsl");
  3243. }
  3244. TEST_F(CompilerTest, CodeGenInout4) {
  3245. CodeGenTestCheck(L"..\\CodeGenHLSL\\inout4.hlsl");
  3246. }
  3247. TEST_F(CompilerTest, CodeGenInout5) {
  3248. CodeGenTestCheck(L"..\\CodeGenHLSL\\inout5.hlsl");
  3249. }
  3250. TEST_F(CompilerTest, CodeGenInput1) {
  3251. CodeGenTestCheck(L"..\\CodeGenHLSL\\input1.hlsl");
  3252. }
  3253. TEST_F(CompilerTest, CodeGenInput2) {
  3254. CodeGenTest(L"..\\CodeGenHLSL\\input2.hlsl");
  3255. }
  3256. TEST_F(CompilerTest, CodeGenInput3) {
  3257. CodeGenTest(L"..\\CodeGenHLSL\\input3.hlsl");
  3258. }
  3259. TEST_F(CompilerTest, CodeGenInt16Op) {
  3260. if (m_ver.SkipDxilVersion(1, 2)) return;
  3261. CodeGenTestCheck(L"..\\CodeGenHLSL\\int16Op.hlsl");
  3262. }
  3263. TEST_F(CompilerTest, CodeGenInt16OpBits) {
  3264. if (m_ver.SkipDxilVersion(1, 2)) return;
  3265. CodeGenTestCheck(L"..\\CodeGenHLSL\\int16OpBits.hlsl");
  3266. }
  3267. TEST_F(CompilerTest, CodeGenIntrinsic1) {
  3268. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic1.hlsl");
  3269. }
  3270. TEST_F(CompilerTest, CodeGenIntrinsic1Minprec) {
  3271. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic1_minprec.hlsl");
  3272. }
  3273. TEST_F(CompilerTest, CodeGenIntrinsic2) {
  3274. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic2.hlsl");
  3275. }
  3276. TEST_F(CompilerTest, CodeGenIntrinsic2Minprec) {
  3277. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic2_minprec.hlsl");
  3278. }
  3279. TEST_F(CompilerTest, CodeGenIntrinsic3_even) {
  3280. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic3_even.hlsl");
  3281. }
  3282. TEST_F(CompilerTest, CodeGenIntrinsic3_integer) {
  3283. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic3_integer.hlsl");
  3284. }
  3285. TEST_F(CompilerTest, CodeGenIntrinsic3_odd) {
  3286. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic3_odd.hlsl");
  3287. }
  3288. TEST_F(CompilerTest, CodeGenIntrinsic3_pow2) {
  3289. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic3_pow2.hlsl");
  3290. }
  3291. TEST_F(CompilerTest, CodeGenIntrinsic4) {
  3292. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic4.hlsl");
  3293. }
  3294. TEST_F(CompilerTest, CodeGenIntrinsic4_dbg) {
  3295. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic4_dbg.hlsl");
  3296. }
  3297. TEST_F(CompilerTest, CodeGenIntrinsic5) {
  3298. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic5.hlsl");
  3299. }
  3300. TEST_F(CompilerTest, CodeGenIntrinsic5Minprec) {
  3301. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic5_minprec.hlsl");
  3302. }
  3303. TEST_F(CompilerTest, CodeGenInvalidInputOutputTypes) {
  3304. CodeGenTestCheck(L"..\\CodeGenHLSL\\invalid_input_output_types.hlsl");
  3305. }
  3306. TEST_F(CompilerTest, CodeGenLegacyStruct) {
  3307. CodeGenTestCheck(L"..\\CodeGenHLSL\\legacy_struct.hlsl");
  3308. }
  3309. TEST_F(CompilerTest, CodeGenLibCsEntry) {
  3310. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_cs_entry.hlsl");
  3311. }
  3312. TEST_F(CompilerTest, CodeGenLibCsEntry2) {
  3313. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_cs_entry2.hlsl");
  3314. }
  3315. TEST_F(CompilerTest, CodeGenLibCsEntry3) {
  3316. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_cs_entry3.hlsl");
  3317. }
  3318. TEST_F(CompilerTest, CodeGenLibEntries) {
  3319. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_entries.hlsl");
  3320. }
  3321. TEST_F(CompilerTest, CodeGenLibEntries2) {
  3322. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_entries2.hlsl");
  3323. }
  3324. TEST_F(CompilerTest, CodeGenLibNoAlias) {
  3325. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_no_alias.hlsl");
  3326. }
  3327. TEST_F(CompilerTest, CodeGenLibResource) {
  3328. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_resource.hlsl");
  3329. }
  3330. TEST_F(CompilerTest, CodeGenLibUnusedFunc) {
  3331. CodeGenTestCheck(L"..\\CodeGenHLSL\\lib_unused_func.hlsl");
  3332. }
  3333. TEST_F(CompilerTest, CodeGenLitInParen) {
  3334. CodeGenTestCheck(L"..\\CodeGenHLSL\\lit_in_paren.hlsl");
  3335. }
  3336. TEST_F(CompilerTest, CodeGenLiteralShift) {
  3337. CodeGenTestCheck(L"..\\CodeGenHLSL\\literalShift.hlsl");
  3338. }
  3339. TEST_F(CompilerTest, CodeGenLiveness1) {
  3340. CodeGenTest(L"..\\CodeGenHLSL\\liveness1.hlsl");
  3341. }
  3342. TEST_F(CompilerTest, CodeGenLoop1) {
  3343. CodeGenTestCheck(L"..\\CodeGenHLSL\\loop1.hlsl");
  3344. }
  3345. TEST_F(CompilerTest, CodeGenLocalRes1) {
  3346. CodeGenTestCheck(L"..\\CodeGenHLSL\\local_resource1.hlsl");
  3347. }
  3348. TEST_F(CompilerTest, CodeGenLocalRes4) {
  3349. CodeGenTestCheck(L"..\\CodeGenHLSL\\local_resource4.hlsl");
  3350. }
  3351. TEST_F(CompilerTest, CodeGenLocalRes7) {
  3352. CodeGenTestCheck(L"..\\CodeGenHLSL\\local_resource7.hlsl");
  3353. }
  3354. TEST_F(CompilerTest, CodeGenLocalRes7Dbg) {
  3355. CodeGenTestCheck(L"..\\CodeGenHLSL\\local_resource7_dbg.hlsl");
  3356. }
  3357. TEST_F(CompilerTest, CodeGenLoop2) {
  3358. CodeGenTestCheck(L"..\\CodeGenHLSL\\loop2.hlsl");
  3359. }
  3360. TEST_F(CompilerTest, CodeGenLoop3) {
  3361. CodeGenTestCheck(L"..\\CodeGenHLSL\\loop3.hlsl");
  3362. }
  3363. TEST_F(CompilerTest, CodeGenLoop4) {
  3364. CodeGenTest(L"..\\CodeGenHLSL\\loop4.hlsl");
  3365. }
  3366. TEST_F(CompilerTest, CodeGenLoop5) {
  3367. CodeGenTest(L"..\\CodeGenHLSL\\loop5.hlsl");
  3368. }
  3369. TEST_F(CompilerTest, CodeGenLoop6) {
  3370. CodeGenTestCheck(L"..\\CodeGenHLSL\\loop6.hlsl");
  3371. }
  3372. TEST_F(CompilerTest, CodeGenMatParam) {
  3373. CodeGenTestCheck(L"..\\CodeGenHLSL\\mat_param.hlsl");
  3374. }
  3375. TEST_F(CompilerTest, CodeGenMatParam2) {
  3376. CodeGenTestCheck(L"..\\CodeGenHLSL\\mat_param2.hlsl");
  3377. }
  3378. //TEST_F(CompilerTest, CodeGenMatParam3) {
  3379. // CodeGenTestCheck(L"..\\CodeGenHLSL\\mat_param3.hlsl");
  3380. //}
  3381. TEST_F(CompilerTest, CodeGenMatArrayOutput) {
  3382. CodeGenTestCheck(L"..\\CodeGenHLSL\\MatArrayOutput.hlsl");
  3383. }
  3384. TEST_F(CompilerTest, CodeGenMatArrayOutput2) {
  3385. CodeGenTestCheck(L"..\\CodeGenHLSL\\MatArrayOutput2.hlsl");
  3386. }
  3387. TEST_F(CompilerTest, CodeGenMatElt) {
  3388. CodeGenTestCheck(L"..\\CodeGenHLSL\\matElt.hlsl");
  3389. }
  3390. TEST_F(CompilerTest, CodeGenMatInit) {
  3391. CodeGenTest(L"..\\CodeGenHLSL\\matInit.hlsl");
  3392. }
  3393. TEST_F(CompilerTest, CodeGenMatMulMat) {
  3394. CodeGenTest(L"..\\CodeGenHLSL\\matMulMat.hlsl");
  3395. }
  3396. TEST_F(CompilerTest, CodeGenMatOps) {
  3397. // TODO: change to CodeGenTestCheck
  3398. CodeGenTest(L"..\\CodeGenHLSL\\matOps.hlsl");
  3399. }
  3400. TEST_F(CompilerTest, CodeGenMatInStruct) {
  3401. CodeGenTestCheck(L"..\\CodeGenHLSL\\matrix_in_struct.hlsl");
  3402. }
  3403. TEST_F(CompilerTest, CodeGenMatInStructRet) {
  3404. CodeGenTestCheck(L"..\\CodeGenHLSL\\matrix_in_struct_ret.hlsl");
  3405. }
  3406. TEST_F(CompilerTest, CodeGenMatIn) {
  3407. CodeGenTest(L"..\\CodeGenHLSL\\matrixIn.hlsl");
  3408. }
  3409. TEST_F(CompilerTest, CodeGenMatIn1) {
  3410. if (m_ver.SkipIRSensitiveTest()) return;
  3411. CodeGenTestCheck(L"..\\CodeGenHLSL\\matrixIn1.hlsl");
  3412. }
  3413. TEST_F(CompilerTest, CodeGenMatIn2) {
  3414. if (m_ver.SkipIRSensitiveTest()) return;
  3415. CodeGenTestCheck(L"..\\CodeGenHLSL\\matrixIn2.hlsl");
  3416. }
  3417. TEST_F(CompilerTest, CodeGenMatOut) {
  3418. CodeGenTest(L"..\\CodeGenHLSL\\matrixOut.hlsl");
  3419. }
  3420. TEST_F(CompilerTest, CodeGenMatOut1) {
  3421. CodeGenTestCheck(L"..\\CodeGenHLSL\\matrixOut1.hlsl");
  3422. }
  3423. TEST_F(CompilerTest, CodeGenMatOut2) {
  3424. CodeGenTestCheck(L"..\\CodeGenHLSL\\matrixOut2.hlsl");
  3425. }
  3426. TEST_F(CompilerTest, CodeGenMatSubscript) {
  3427. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript.hlsl");
  3428. }
  3429. TEST_F(CompilerTest, CodeGenMatSubscript2) {
  3430. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript2.hlsl");
  3431. }
  3432. TEST_F(CompilerTest, CodeGenMatSubscript3) {
  3433. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript3.hlsl");
  3434. }
  3435. TEST_F(CompilerTest, CodeGenMatSubscript4) {
  3436. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript4.hlsl");
  3437. }
  3438. TEST_F(CompilerTest, CodeGenMatSubscript5) {
  3439. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript5.hlsl");
  3440. }
  3441. TEST_F(CompilerTest, CodeGenMatSubscript6) {
  3442. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript6.hlsl");
  3443. }
  3444. TEST_F(CompilerTest, CodeGenMatSubscript7) {
  3445. CodeGenTestCheck(L"..\\CodeGenHLSL\\matSubscript7.hlsl");
  3446. }
  3447. TEST_F(CompilerTest, CodeGenMaxMin) {
  3448. CodeGenTestCheck(L"..\\CodeGenHLSL\\max_min.hlsl");
  3449. }
  3450. TEST_F(CompilerTest, CodeGenMinprec1) {
  3451. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec1.hlsl");
  3452. }
  3453. TEST_F(CompilerTest, CodeGenMinprec2) {
  3454. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec2.hlsl");
  3455. }
  3456. TEST_F(CompilerTest, CodeGenMinprec3) {
  3457. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec3.hlsl");
  3458. }
  3459. TEST_F(CompilerTest, CodeGenMinprec4) {
  3460. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec4.hlsl");
  3461. }
  3462. TEST_F(CompilerTest, CodeGenMinprec5) {
  3463. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec5.hlsl");
  3464. }
  3465. TEST_F(CompilerTest, CodeGenMinprec6) {
  3466. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec6.hlsl");
  3467. }
  3468. TEST_F(CompilerTest, CodeGenMinprec7) {
  3469. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec7.hlsl");
  3470. }
  3471. TEST_F(CompilerTest, CodeGenMinprecCoord) {
  3472. CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec_coord.hlsl");
  3473. }
  3474. TEST_F(CompilerTest, CodeGenModf) {
  3475. CodeGenTestCheck(L"..\\CodeGenHLSL\\modf.hlsl");
  3476. }
  3477. TEST_F(CompilerTest, CodeGenMinprecCast) {
  3478. CodeGenTest(L"..\\CodeGenHLSL\\minprec_cast.hlsl");
  3479. }
  3480. TEST_F(CompilerTest, CodeGenMinprecImm) {
  3481. CodeGenTest(L"..\\CodeGenHLSL\\minprec_imm.hlsl");
  3482. }
  3483. TEST_F(CompilerTest, CodeGenMultiUAVLoad1) {
  3484. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad1.hlsl");
  3485. }
  3486. TEST_F(CompilerTest, CodeGenMultiUAVLoad2) {
  3487. if (m_ver.SkipDxilVersion(1,1)) return;
  3488. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad2.hlsl");
  3489. }
  3490. TEST_F(CompilerTest, CodeGenMultiUAVLoad3) {
  3491. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad3.hlsl");
  3492. }
  3493. TEST_F(CompilerTest, CodeGenMultiUAVLoad4) {
  3494. if (m_ver.SkipDxilVersion(1,1)) return;
  3495. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad4.hlsl");
  3496. }
  3497. TEST_F(CompilerTest, CodeGenMultiUAVLoad5) {
  3498. if (m_ver.SkipDxilVersion(1,1)) return;
  3499. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad5.hlsl");
  3500. }
  3501. TEST_F(CompilerTest, CodeGenMultiUAVLoad6) {
  3502. if (m_ver.SkipDxilVersion(1,1)) return;
  3503. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad6.hlsl");
  3504. }
  3505. TEST_F(CompilerTest, CodeGenMultiUAVLoad7) {
  3506. if (m_ver.SkipDxilVersion(1,1)) return;
  3507. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiUAVLoad7.hlsl");
  3508. }
  3509. TEST_F(CompilerTest, CodeGenMultiStream) {
  3510. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiStreamGS.hlsl");
  3511. }
  3512. TEST_F(CompilerTest, CodeGenMultiStream2) {
  3513. CodeGenTestCheck(L"..\\CodeGenHLSL\\multiStreamGS2.hlsl");
  3514. }
  3515. TEST_F(CompilerTest, CodeGenNeg1) {
  3516. CodeGenTest(L"..\\CodeGenHLSL\\neg1.hlsl");
  3517. }
  3518. TEST_F(CompilerTest, CodeGenNeg2) {
  3519. CodeGenTest(L"..\\CodeGenHLSL\\neg2.hlsl");
  3520. }
  3521. TEST_F(CompilerTest, CodeGenNegabs1) {
  3522. CodeGenTest(L"..\\CodeGenHLSL\\negabs1.hlsl");
  3523. }
  3524. TEST_F(CompilerTest, CodeGenNoise) {
  3525. CodeGenTestCheck(L"..\\CodeGenHLSL\\noise.hlsl");
  3526. }
  3527. TEST_F(CompilerTest, CodeGenNonUniform) {
  3528. CodeGenTestCheck(L"..\\CodeGenHLSL\\NonUniform.hlsl");
  3529. }
  3530. TEST_F(CompilerTest, CodeGenOptForNoOpt) {
  3531. CodeGenTestCheck(L"..\\CodeGenHLSL\\optForNoOpt.hlsl");
  3532. }
  3533. TEST_F(CompilerTest, CodeGenOptForNoOpt2) {
  3534. CodeGenTestCheck(L"..\\CodeGenHLSL\\optForNoOpt2.hlsl");
  3535. }
  3536. TEST_F(CompilerTest, CodeGenOptionGis) {
  3537. CodeGenTestCheck(L"..\\CodeGenHLSL\\option_gis.hlsl");
  3538. }
  3539. TEST_F(CompilerTest, CodeGenOptionWX) {
  3540. CodeGenTestCheck(L"..\\CodeGenHLSL\\option_WX.hlsl");
  3541. }
  3542. TEST_F(CompilerTest, CodeGenOutput1) {
  3543. CodeGenTestCheck(L"..\\CodeGenHLSL\\output1.hlsl");
  3544. }
  3545. TEST_F(CompilerTest, CodeGenOutput2) {
  3546. CodeGenTestCheck(L"..\\CodeGenHLSL\\output2.hlsl");
  3547. }
  3548. TEST_F(CompilerTest, CodeGenOutput3) {
  3549. CodeGenTestCheck(L"..\\CodeGenHLSL\\output3.hlsl");
  3550. }
  3551. TEST_F(CompilerTest, CodeGenOutput4) {
  3552. CodeGenTestCheck(L"..\\CodeGenHLSL\\output4.hlsl");
  3553. }
  3554. TEST_F(CompilerTest, CodeGenOutput5) {
  3555. CodeGenTestCheck(L"..\\CodeGenHLSL\\output5.hlsl");
  3556. }
  3557. TEST_F(CompilerTest, CodeGenOutput6) {
  3558. CodeGenTestCheck(L"..\\CodeGenHLSL\\output6.hlsl");
  3559. }
  3560. TEST_F(CompilerTest, CodeGenOutputArray) {
  3561. CodeGenTestCheck(L"..\\CodeGenHLSL\\outputArray.hlsl");
  3562. }
  3563. TEST_F(CompilerTest, CodeGenPassthrough1) {
  3564. CodeGenTest(L"..\\CodeGenHLSL\\passthrough1.hlsl");
  3565. }
  3566. TEST_F(CompilerTest, CodeGenPassthrough2) {
  3567. CodeGenTest(L"..\\CodeGenHLSL\\passthrough2.hlsl");
  3568. }
  3569. TEST_F(CompilerTest, CodeGenPrecise1) {
  3570. CodeGenTestCheck(L"..\\CodeGenHLSL\\precise1.hlsl");
  3571. }
  3572. TEST_F(CompilerTest, CodeGenPrecise2) {
  3573. CodeGenTestCheck(L"..\\CodeGenHLSL\\precise2.hlsl");
  3574. }
  3575. TEST_F(CompilerTest, CodeGenPrecise3) {
  3576. CodeGenTestCheck(L"..\\CodeGenHLSL\\precise3.hlsl");
  3577. }
  3578. TEST_F(CompilerTest, CodeGenPrecise4) {
  3579. CodeGenTestCheck(L"..\\CodeGenHLSL\\precise4.hlsl");
  3580. }
  3581. TEST_F(CompilerTest, CodeGenPreciseOnCall) {
  3582. CodeGenTestCheck(L"..\\CodeGenHLSL\\precise_call.hlsl");
  3583. }
  3584. TEST_F(CompilerTest, CodeGenPreciseOnCallNot) {
  3585. CodeGenTestCheck(L"..\\CodeGenHLSL\\precise_call_not.hlsl");
  3586. }
  3587. TEST_F(CompilerTest, CodeGenPreserveAllOutputs) {
  3588. CodeGenTestCheck(L"preserve_all_outputs_1.hlsl");
  3589. CodeGenTestCheck(L"preserve_all_outputs_2.hlsl");
  3590. CodeGenTestCheck(L"preserve_all_outputs_3.hlsl");
  3591. CodeGenTestCheck(L"preserve_all_outputs_4.hlsl");
  3592. CodeGenTestCheck(L"preserve_all_outputs_5.hlsl");
  3593. CodeGenTestCheck(L"preserve_all_outputs_6.hlsl");
  3594. CodeGenTestCheck(L"preserve_all_outputs_7.hlsl");
  3595. }
  3596. TEST_F(CompilerTest, CodeGenRaceCond2) {
  3597. CodeGenTest(L"..\\CodeGenHLSL\\RaceCond2.hlsl");
  3598. }
  3599. TEST_F(CompilerTest, CodeGenRaw_Buf1) {
  3600. CodeGenTest(L"..\\CodeGenHLSL\\raw_buf1.hlsl");
  3601. }
  3602. TEST_F(CompilerTest, CodeGenRaw_Buf2) {
  3603. if (m_ver.SkipDxilVersion(1, 2)) return;
  3604. CodeGenTestCheck(L"..\\CodeGenHLSL\\raw_buf2.hlsl");
  3605. }
  3606. TEST_F(CompilerTest, CodeGenRaw_Buf3) {
  3607. CodeGenTestCheck(L"..\\CodeGenHLSL\\raw_buf3.hlsl");
  3608. }
  3609. TEST_F(CompilerTest, CodeGenRaw_Buf4) {
  3610. if (m_ver.SkipDxilVersion(1, 2)) return;
  3611. CodeGenTestCheck(L"..\\CodeGenHLSL\\raw_buf4.hlsl");
  3612. }
  3613. TEST_F(CompilerTest, CodeGenRaw_Buf5) {
  3614. if (m_ver.SkipDxilVersion(1, 2)) return;
  3615. CodeGenTestCheck(L"..\\CodeGenHLSL\\raw_buf5.hlsl");
  3616. }
  3617. TEST_F(CompilerTest, CodeGenRcp1) {
  3618. CodeGenTest(L"..\\CodeGenHLSL\\rcp1.hlsl");
  3619. }
  3620. TEST_F(CompilerTest, CodeGenReadFromOutput) {
  3621. CodeGenTestCheck(L"..\\CodeGenHLSL\\readFromOutput.hlsl");
  3622. }
  3623. TEST_F(CompilerTest, CodeGenReadFromOutput2) {
  3624. CodeGenTestCheck(L"..\\CodeGenHLSL\\readFromOutput2.hlsl");
  3625. }
  3626. TEST_F(CompilerTest, CodeGenReadFromOutput3) {
  3627. CodeGenTestCheck(L"..\\CodeGenHLSL\\readFromOutput3.hlsl");
  3628. }
  3629. TEST_F(CompilerTest, CodeGenRedundantinput1) {
  3630. CodeGenTest(L"..\\CodeGenHLSL\\redundantinput1.hlsl");
  3631. }
  3632. TEST_F(CompilerTest, CodeGenRes64bit) {
  3633. CodeGenTestCheck(L"..\\CodeGenHLSL\\res64bit.hlsl");
  3634. }
  3635. TEST_F(CompilerTest, CodeGenRovs) {
  3636. CodeGenTestCheck(L"..\\CodeGenHLSL\\rovs.hlsl");
  3637. }
  3638. TEST_F(CompilerTest, CodeGenRValAssign) {
  3639. CodeGenTestCheck(L"..\\CodeGenHLSL\\rval_assign.hlsl");
  3640. }
  3641. TEST_F(CompilerTest, CodeGenRValSubscript) {
  3642. CodeGenTestCheck(L"..\\CodeGenHLSL\\RValSubscript.hlsl");
  3643. }
  3644. TEST_F(CompilerTest, CodeGenSample1) {
  3645. CodeGenTestCheck(L"..\\CodeGenHLSL\\sample1.hlsl");
  3646. }
  3647. TEST_F(CompilerTest, CodeGenSample2) {
  3648. CodeGenTest(L"..\\CodeGenHLSL\\sample2.hlsl");
  3649. }
  3650. TEST_F(CompilerTest, CodeGenSample3) {
  3651. CodeGenTest(L"..\\CodeGenHLSL\\sample3.hlsl");
  3652. }
  3653. TEST_F(CompilerTest, CodeGenSample4) {
  3654. CodeGenTest(L"..\\CodeGenHLSL\\sample4.hlsl");
  3655. }
  3656. TEST_F(CompilerTest, CodeGenSample5) {
  3657. CodeGenTest(L"..\\CodeGenHLSL\\sample5.hlsl");
  3658. }
  3659. TEST_F(CompilerTest, CodeGenSampleBias) {
  3660. CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleBias.hlsl");
  3661. }
  3662. TEST_F(CompilerTest, CodeGenSampleCmp) {
  3663. CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleCmp.hlsl");
  3664. }
  3665. TEST_F(CompilerTest, CodeGenSampleCmpLZ) {
  3666. CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleCmpLZ.hlsl");
  3667. }
  3668. TEST_F(CompilerTest, CodeGenSampleCmpLZ2) {
  3669. CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleCmpLZ2.hlsl");
  3670. }
  3671. TEST_F(CompilerTest, CodeGenSampleGrad) {
  3672. CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleGrad.hlsl");
  3673. }
  3674. TEST_F(CompilerTest, CodeGenSampleL) {
  3675. CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleL.hlsl");
  3676. }
  3677. TEST_F(CompilerTest, CodeGenSaturate1) {
  3678. CodeGenTest(L"..\\CodeGenHLSL\\saturate1.hlsl");
  3679. }
  3680. TEST_F(CompilerTest, CodeGenScalarOnVecIntrinsic) {
  3681. CodeGenTest(L"..\\CodeGenHLSL\\scalarOnVecIntrisic.hlsl");
  3682. }
  3683. TEST_F(CompilerTest, CodeGenScalarToVec) {
  3684. CodeGenTest(L"..\\CodeGenHLSL\\scalarToVec.hlsl");
  3685. }
  3686. TEST_F(CompilerTest, CodeGenSelectObj) {
  3687. CodeGenTestCheck(L"..\\CodeGenHLSL\\selectObj.hlsl");
  3688. }
  3689. TEST_F(CompilerTest, CodeGenSelectObj2) {
  3690. CodeGenTestCheck(L"..\\CodeGenHLSL\\selectObj2.hlsl");
  3691. }
  3692. TEST_F(CompilerTest, CodeGenSelectObj3) {
  3693. CodeGenTestCheck(L"..\\CodeGenHLSL\\selectObj3.hlsl");
  3694. }
  3695. TEST_F(CompilerTest, CodeGenSelectObj4) {
  3696. CodeGenTestCheck(L"..\\CodeGenHLSL\\selectObj4.hlsl");
  3697. }
  3698. TEST_F(CompilerTest, CodeGenSelectObj5) {
  3699. CodeGenTestCheck(L"..\\CodeGenHLSL\\selectObj5.hlsl");
  3700. }
  3701. TEST_F(CompilerTest, CodeGenSelfCopy) {
  3702. CodeGenTest(L"..\\CodeGenHLSL\\self_copy.hlsl");
  3703. }
  3704. TEST_F(CompilerTest, CodeGenSelMat) {
  3705. CodeGenTestCheck(L"..\\CodeGenHLSL\\selMat.hlsl");
  3706. }
  3707. TEST_F(CompilerTest, CodeGenSignaturePacking) {
  3708. CodeGenTestCheck(L"..\\CodeGenHLSL\\signature_packing.hlsl");
  3709. }
  3710. TEST_F(CompilerTest, CodeGenSignaturePackingByWidth) {
  3711. if (m_ver.SkipDxilVersion(1, 2)) return;
  3712. CodeGenTestCheck(L"..\\CodeGenHLSL\\signature_packing_by_width.hlsl");
  3713. }
  3714. TEST_F(CompilerTest, CodeGenShaderAttr) {
  3715. CodeGenTestCheck(L"..\\CodeGenHLSL\\shader_attr.hlsl");
  3716. }
  3717. TEST_F(CompilerTest, CodeGenShare_Mem_Dbg) {
  3718. CodeGenTestCheck(L"..\\CodeGenHLSL\\share_mem_dbg.hlsl");
  3719. }
  3720. TEST_F(CompilerTest, CodeGenShare_Mem_Phi) {
  3721. CodeGenTestCheck(L"..\\CodeGenHLSL\\share_mem_phi.hlsl");
  3722. }
  3723. TEST_F(CompilerTest, CodeGenShare_Mem1) {
  3724. CodeGenTestCheck(L"..\\CodeGenHLSL\\share_mem1.hlsl");
  3725. }
  3726. TEST_F(CompilerTest, CodeGenShare_Mem2) {
  3727. CodeGenTestCheck(L"..\\CodeGenHLSL\\share_mem2.hlsl");
  3728. }
  3729. TEST_F(CompilerTest, CodeGenShare_Mem2Dim) {
  3730. CodeGenTestCheck(L"..\\CodeGenHLSL\\share_mem2Dim.hlsl");
  3731. }
  3732. TEST_F(CompilerTest, CodeGenShift) {
  3733. CodeGenTestCheck(L"..\\CodeGenHLSL\\shift.hlsl");
  3734. }
  3735. TEST_F(CompilerTest, CodeGenShortCircuiting0) {
  3736. CodeGenTestCheck(L"..\\CodeGenHLSL\\short_circuiting0.hlsl");
  3737. }
  3738. TEST_F(CompilerTest, CodeGenShortCircuiting1) {
  3739. CodeGenTestCheck(L"..\\CodeGenHLSL\\short_circuiting1.hlsl");
  3740. }
  3741. TEST_F(CompilerTest, CodeGenShortCircuiting2) {
  3742. CodeGenTestCheck(L"..\\CodeGenHLSL\\short_circuiting2.hlsl");
  3743. }
  3744. TEST_F(CompilerTest, CodeGenShortCircuiting3) {
  3745. CodeGenTestCheck(L"..\\CodeGenHLSL\\short_circuiting3.hlsl");
  3746. }
  3747. TEST_F(CompilerTest, CodeGenSimpleDS1) {
  3748. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleDS1.hlsl");
  3749. }
  3750. TEST_F(CompilerTest, CodeGenSimpleGS1) {
  3751. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS1.hlsl");
  3752. }
  3753. TEST_F(CompilerTest, CodeGenSimpleGS2) {
  3754. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS2.hlsl");
  3755. }
  3756. TEST_F(CompilerTest, CodeGenSimpleGS3) {
  3757. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS3.hlsl");
  3758. }
  3759. TEST_F(CompilerTest, CodeGenSimpleGS4) {
  3760. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS4.hlsl");
  3761. }
  3762. TEST_F(CompilerTest, CodeGenSimpleGS5) {
  3763. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS5.hlsl");
  3764. }
  3765. TEST_F(CompilerTest, CodeGenSimpleGS6) {
  3766. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS6.hlsl");
  3767. }
  3768. TEST_F(CompilerTest, CodeGenSimpleGS7) {
  3769. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS7.hlsl");
  3770. }
  3771. TEST_F(CompilerTest, CodeGenSimpleGS11) {
  3772. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS11.hlsl");
  3773. }
  3774. TEST_F(CompilerTest, CodeGenSimpleGS12) {
  3775. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleGS12.hlsl");
  3776. }
  3777. TEST_F(CompilerTest, CodeGenSimpleHS1) {
  3778. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS1.hlsl");
  3779. }
  3780. TEST_F(CompilerTest, CodeGenSimpleHS2) {
  3781. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS2.hlsl");
  3782. }
  3783. TEST_F(CompilerTest, CodeGenSimpleHS3) {
  3784. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS3.hlsl");
  3785. }
  3786. TEST_F(CompilerTest, CodeGenSimpleHS4) {
  3787. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS4.hlsl");
  3788. }
  3789. TEST_F(CompilerTest, CodeGenSimpleHS5) {
  3790. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS5.hlsl");
  3791. }
  3792. TEST_F(CompilerTest, CodeGenSimpleHS6) {
  3793. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS6.hlsl");
  3794. }
  3795. TEST_F(CompilerTest, CodeGenSimpleHS7) {
  3796. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS7.hlsl");
  3797. }
  3798. TEST_F(CompilerTest, CodeGenSimpleHS8) {
  3799. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS8.hlsl");
  3800. }
  3801. TEST_F(CompilerTest, CodeGenSimpleHS9) {
  3802. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS9.hlsl");
  3803. }
  3804. TEST_F(CompilerTest, CodeGenSimpleHS10) {
  3805. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS10.hlsl");
  3806. }
  3807. TEST_F(CompilerTest, CodeGenSimpleHS11) {
  3808. CodeGenTestCheck(L"..\\CodeGenHLSL\\SimpleHS11.hlsl");
  3809. }
  3810. TEST_F(CompilerTest, CodeGenSMFail) {
  3811. CodeGenTestCheck(L"sm-fail.hlsl");
  3812. }
  3813. TEST_F(CompilerTest, CodeGenSrv_Ms_Load1) {
  3814. CodeGenTestCheck(L"..\\CodeGenHLSL\\srv_ms_load1.hlsl");
  3815. }
  3816. TEST_F(CompilerTest, CodeGenSrv_Ms_Load2) {
  3817. CodeGenTestCheck(L"..\\CodeGenHLSL\\srv_ms_load2.hlsl");
  3818. }
  3819. TEST_F(CompilerTest, CodeGenSrv_Typed_Load1) {
  3820. CodeGenTest(L"..\\CodeGenHLSL\\srv_typed_load1.hlsl");
  3821. }
  3822. TEST_F(CompilerTest, CodeGenSrv_Typed_Load2) {
  3823. CodeGenTest(L"..\\CodeGenHLSL\\srv_typed_load2.hlsl");
  3824. }
  3825. TEST_F(CompilerTest, CodeGenStaticConstGlobal) {
  3826. CodeGenTestCheck(L"..\\CodeGenHLSL\\static_const_global.hlsl");
  3827. }
  3828. TEST_F(CompilerTest, CodeGenStaticConstGlobal2) {
  3829. CodeGenTestCheck(L"..\\CodeGenHLSL\\static_const_global2.hlsl");
  3830. }
  3831. TEST_F(CompilerTest, CodeGenStaticGlobals) {
  3832. CodeGenTestCheck(L"..\\CodeGenHLSL\\staticGlobals.hlsl");
  3833. }
  3834. TEST_F(CompilerTest, CodeGenStaticGlobals2) {
  3835. CodeGenTest(L"..\\CodeGenHLSL\\staticGlobals2.hlsl");
  3836. }
  3837. TEST_F(CompilerTest, CodeGenStaticGlobals3) {
  3838. CodeGenTestCheck(L"..\\CodeGenHLSL\\staticGlobals3.hlsl");
  3839. }
  3840. TEST_F(CompilerTest, CodeGenStaticGlobals4) {
  3841. CodeGenTest(L"..\\CodeGenHLSL\\staticGlobals4.hlsl");
  3842. }
  3843. TEST_F(CompilerTest, CodeGenStaticGlobals5) {
  3844. CodeGenTestCheck(L"..\\CodeGenHLSL\\staticGlobals5.hlsl");
  3845. }
  3846. TEST_F(CompilerTest, CodeGenStaticMatrix) {
  3847. CodeGenTestCheck(L"..\\CodeGenHLSL\\static_matrix.hlsl");
  3848. }
  3849. TEST_F(CompilerTest, CodeGenStaticResource) {
  3850. CodeGenTest(L"..\\CodeGenHLSL\\static_resource.hlsl");
  3851. }
  3852. TEST_F(CompilerTest, CodeGenStaticResource2) {
  3853. CodeGenTest(L"..\\CodeGenHLSL\\static_resource2.hlsl");
  3854. }
  3855. TEST_F(CompilerTest, CodeGenStruct_Buf1) {
  3856. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf1.hlsl");
  3857. }
  3858. TEST_F(CompilerTest, CodeGenStruct_Buf2) {
  3859. if (m_ver.SkipDxilVersion(1, 2)) return;
  3860. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf2.hlsl");
  3861. }
  3862. TEST_F(CompilerTest, CodeGenStruct_Buf3) {
  3863. if (m_ver.SkipDxilVersion(1, 2)) return;
  3864. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf3.hlsl");
  3865. }
  3866. TEST_F(CompilerTest, CodeGenStruct_Buf4) {
  3867. if (m_ver.SkipDxilVersion(1, 2)) return;
  3868. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf4.hlsl");
  3869. }
  3870. TEST_F(CompilerTest, CodeGenStruct_Buf5) {
  3871. if (m_ver.SkipDxilVersion(1, 2)) return;
  3872. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf5.hlsl");
  3873. }
  3874. TEST_F(CompilerTest, CodeGenStruct_Buf6) {
  3875. if (m_ver.SkipDxilVersion(1, 2)) return;
  3876. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf6.hlsl");
  3877. }
  3878. TEST_F(CompilerTest, CodeGenStruct_Buf_New_Layout) {
  3879. if (m_ver.SkipDxilVersion(1, 2)) return;
  3880. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_buf_new_layout.hlsl");
  3881. }
  3882. TEST_F(CompilerTest, CodeGenStruct_BufHasCounter) {
  3883. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_bufHasCounter.hlsl");
  3884. }
  3885. TEST_F(CompilerTest, CodeGenStruct_BufHasCounter2) {
  3886. CodeGenTestCheck(L"..\\CodeGenHLSL\\struct_bufHasCounter2.hlsl");
  3887. }
  3888. TEST_F(CompilerTest, CodeGenStructArray) {
  3889. CodeGenTest(L"..\\CodeGenHLSL\\structArray.hlsl");
  3890. }
  3891. TEST_F(CompilerTest, CodeGenStructCast) {
  3892. CodeGenTest(L"..\\CodeGenHLSL\\StructCast.hlsl");
  3893. }
  3894. TEST_F(CompilerTest, CodeGenStructCast2) {
  3895. CodeGenTest(L"..\\CodeGenHLSL\\StructCast2.hlsl");
  3896. }
  3897. TEST_F(CompilerTest, CodeGenStructInBuffer) {
  3898. CodeGenTest(L"..\\CodeGenHLSL\\structInBuffer.hlsl");
  3899. }
  3900. TEST_F(CompilerTest, CodeGenStructInBuffer2) {
  3901. CodeGenTest(L"..\\CodeGenHLSL\\structInBuffer2.hlsl");
  3902. }
  3903. TEST_F(CompilerTest, CodeGenStructInBuffer3) {
  3904. CodeGenTestCheck(L"..\\CodeGenHLSL\\structInBuffer3.hlsl");
  3905. }
  3906. TEST_F(CompilerTest, CodeGenSwitchFloat) {
  3907. CodeGenTestCheck(L"..\\CodeGenHLSL\\switch_float.hlsl");
  3908. }
  3909. TEST_F(CompilerTest, CodeGenSwitch1) {
  3910. CodeGenTestCheck(L"..\\CodeGenHLSL\\switch1.hlsl");
  3911. }
  3912. TEST_F(CompilerTest, CodeGenSwitch2) {
  3913. CodeGenTest(L"..\\CodeGenHLSL\\switch2.hlsl");
  3914. }
  3915. TEST_F(CompilerTest, CodeGenSwitch3) {
  3916. CodeGenTest(L"..\\CodeGenHLSL\\switch3.hlsl");
  3917. }
  3918. TEST_F(CompilerTest, CodeGenSwizzle1) {
  3919. CodeGenTest(L"..\\CodeGenHLSL\\swizzle1.hlsl");
  3920. }
  3921. TEST_F(CompilerTest, CodeGenSwizzle2) {
  3922. CodeGenTest(L"..\\CodeGenHLSL\\swizzle2.hlsl");
  3923. }
  3924. TEST_F(CompilerTest, CodeGenSwizzleAtomic) {
  3925. CodeGenTestCheck(L"..\\CodeGenHLSL\\swizzleAtomic.hlsl");
  3926. }
  3927. TEST_F(CompilerTest, CodeGenSwizzleAtomic2) {
  3928. CodeGenTestCheck(L"..\\CodeGenHLSL\\swizzleAtomic2.hlsl");
  3929. }
  3930. TEST_F(CompilerTest, CodeGenSwizzleIndexing) {
  3931. CodeGenTestCheck(L"..\\CodeGenHLSL\\swizzleIndexing.hlsl");
  3932. }
  3933. TEST_F(CompilerTest, CodeGenTemp1) {
  3934. CodeGenTest(L"..\\CodeGenHLSL\\temp1.hlsl");
  3935. }
  3936. TEST_F(CompilerTest, CodeGenTemp2) {
  3937. CodeGenTest(L"..\\CodeGenHLSL\\temp2.hlsl");
  3938. }
  3939. TEST_F(CompilerTest, CodeGenTempDbgInfo) {
  3940. CodeGenTestCheck(L"..\\CodeGenHLSL\\temp_dbg_info.hlsl");
  3941. }
  3942. TEST_F(CompilerTest, CodeGenTexSubscript) {
  3943. CodeGenTestCheck(L"..\\CodeGenHLSL\\TexSubscript.hlsl");
  3944. }
  3945. TEST_F(CompilerTest, CodeGenUav_Raw1){
  3946. CodeGenTestCheck(L"..\\CodeGenHLSL\\uav_raw1.hlsl");
  3947. }
  3948. TEST_F(CompilerTest, CodeGenUav_Typed_Load_Store1) {
  3949. CodeGenTest(L"..\\CodeGenHLSL\\uav_typed_load_store1.hlsl");
  3950. }
  3951. TEST_F(CompilerTest, CodeGenUav_Typed_Load_Store2) {
  3952. CodeGenTest(L"..\\CodeGenHLSL\\uav_typed_load_store2.hlsl");
  3953. }
  3954. TEST_F(CompilerTest, CodeGenUav_Typed_Load_Store3) {
  3955. if (m_ver.SkipDxilVersion(1,2)) return;
  3956. CodeGenTestCheck(L"..\\CodeGenHLSL\\uav_typed_load_store3.hlsl");
  3957. }
  3958. TEST_F(CompilerTest, CodeGenUint64_1) {
  3959. CodeGenTestCheck(L"..\\CodeGenHLSL\\uint64_1.hlsl");
  3960. }
  3961. TEST_F(CompilerTest, CodeGenUint64_2) {
  3962. if (m_ver.SkipDxilVersion(1,1)) return;
  3963. CodeGenTestCheck(L"..\\CodeGenHLSL\\uint64_2.hlsl");
  3964. }
  3965. TEST_F(CompilerTest, CodeGenUintSample) {
  3966. CodeGenTestCheck(L"..\\CodeGenHLSL\\uintSample.hlsl");
  3967. }
  3968. TEST_F(CompilerTest, CodeGenUmaxObjectAtomic) {
  3969. CodeGenTestCheck(L"..\\CodeGenHLSL\\umaxObjectAtomic.hlsl");
  3970. }
  3971. TEST_F(CompilerTest, CodeGenUnrollDbg) {
  3972. CodeGenTest(L"..\\CodeGenHLSL\\unroll_dbg.hlsl");
  3973. }
  3974. TEST_F(CompilerTest, CodeGenUnsignedShortHandMatrixVector) {
  3975. CodeGenTestCheck(L"..\\CodeGenHLSL\\unsignedShortHandMatrixVector.hlsl");
  3976. }
  3977. TEST_F(CompilerTest, CodeGenUnusedFunc) {
  3978. CodeGenTestCheck(L"..\\CodeGenHLSL\\unused_func.hlsl");
  3979. }
  3980. TEST_F(CompilerTest, CodeGenUnusedCB) {
  3981. CodeGenTestCheck(L"..\\CodeGenHLSL\\unusedCB.hlsl");
  3982. }
  3983. TEST_F(CompilerTest, CodeGenUpdateCounter) {
  3984. CodeGenTestCheck(L"..\\CodeGenHLSL\\updateCounter.hlsl");
  3985. }
  3986. TEST_F(CompilerTest, CodeGenUpperCaseRegister1) {
  3987. CodeGenTestCheck(L"..\\CodeGenHLSL\\uppercase-register1.hlsl");
  3988. }
  3989. TEST_F(CompilerTest, CodeGenVcmp) {
  3990. CodeGenTestCheck(L"..\\CodeGenHLSL\\vcmp.hlsl");
  3991. }
  3992. TEST_F(CompilerTest, CodeGenVecBitCast) {
  3993. CodeGenTest(L"..\\CodeGenHLSL\\vec_bitcast.hlsl");
  3994. }
  3995. TEST_F(CompilerTest, CodeGenVec_Comp_Arg){
  3996. CodeGenTest(L"..\\CodeGenHLSL\\vec_comp_arg.hlsl");
  3997. }
  3998. TEST_F(CompilerTest, CodeGenVecCmpCond) {
  3999. CodeGenTestCheck(L"..\\CodeGenHLSL\\vecCmpCond.hlsl");
  4000. }
  4001. TEST_F(CompilerTest, CodeGenVecTrunc) {
  4002. CodeGenTestCheck(L"..\\CodeGenHLSL\\vecTrunc.hlsl");
  4003. }
  4004. TEST_F(CompilerTest, CodeGenWave) {
  4005. CodeGenTestCheck(L"..\\CodeGenHLSL\\wave.hlsl");
  4006. }
  4007. TEST_F(CompilerTest, CodeGenWaveNoOpt) {
  4008. CodeGenTestCheck(L"..\\CodeGenHLSL\\wave_no_opt.hlsl");
  4009. }
  4010. TEST_F(CompilerTest, CodeGenWriteMaskBuf) {
  4011. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeMaskBuf.hlsl");
  4012. }
  4013. TEST_F(CompilerTest, CodeGenWriteMaskBuf2) {
  4014. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeMaskBuf2.hlsl");
  4015. }
  4016. TEST_F(CompilerTest, CodeGenWriteMaskBuf3) {
  4017. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeMaskBuf3.hlsl");
  4018. }
  4019. TEST_F(CompilerTest, CodeGenWriteMaskBuf4) {
  4020. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeMaskBuf4.hlsl");
  4021. }
  4022. TEST_F(CompilerTest, CodeGenWriteToInput) {
  4023. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeToInput.hlsl");
  4024. }
  4025. TEST_F(CompilerTest, CodeGenWriteToInput2) {
  4026. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeToInput2.hlsl");
  4027. }
  4028. TEST_F(CompilerTest, CodeGenWriteToInput3) {
  4029. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeToInput3.hlsl");
  4030. }
  4031. TEST_F(CompilerTest, CodeGenWriteToInput4) {
  4032. CodeGenTestCheck(L"..\\CodeGenHLSL\\writeToInput4.hlsl");
  4033. }
  4034. TEST_F(CompilerTest, CodeGenAttributes_Mod) {
  4035. CodeGenTest(L"..\\CodeGenHLSL\\attributes_Mod.hlsl");
  4036. }
  4037. TEST_F(CompilerTest, CodeGenConst_Exprb_Mod) {
  4038. CodeGenTest(L"..\\CodeGenHLSL\\const-exprB_Mod.hlsl");
  4039. }
  4040. TEST_F(CompilerTest, CodeGenConst_Expr_Mod) {
  4041. CodeGenTest(L"..\\CodeGenHLSL\\const-expr_Mod.hlsl");
  4042. }
  4043. TEST_F(CompilerTest, CodeGenFunctions_Mod){
  4044. CodeGenTest(L"..\\CodeGenHLSL\\functions_Mod.hlsl");
  4045. }
  4046. TEST_F(CompilerTest, CodeGenImplicit_Casts_Mod) {
  4047. CodeGenTest(L"..\\CodeGenHLSL\\implicit-casts_Mod.hlsl");
  4048. }
  4049. TEST_F(CompilerTest, CodeGenIndexing_Operator_Mod) {
  4050. CodeGenTest(L"..\\CodeGenHLSL\\indexing-operator_Mod.hlsl");
  4051. }
  4052. TEST_F(CompilerTest, CodeGenIntrinsic_Examples_Mod) {
  4053. CodeGenTestCheck(L"..\\CodeGenHLSL\\intrinsic-examples_Mod.hlsl");
  4054. }
  4055. TEST_F(CompilerTest, CodeGenLiterals_Mod) {
  4056. CodeGenTest(L"..\\CodeGenHLSL\\literals_Mod.hlsl");
  4057. }
  4058. TEST_F(CompilerTest, CodeGenLiterals_Exact_Precision_Mod) {
  4059. if (m_ver.SkipDxilVersion(1, 2)) return;
  4060. CodeGenTest(L"..\\CodeGenHLSL\\literals_exact_precision_Mod.hlsl");
  4061. }
  4062. TEST_F(CompilerTest, CodeGenMatrix_Assignments_Mod) {
  4063. CodeGenTest(L"..\\CodeGenHLSL\\matrix-assignments_Mod.hlsl");
  4064. }
  4065. TEST_F(CompilerTest, CodeGenMatrix_Syntax_Mod) {
  4066. CodeGenTest(L"..\\CodeGenHLSL\\matrix-syntax_Mod.hlsl");
  4067. }
  4068. //TEST_F(CompilerTest, CodeGenMore_Operators_Mod){
  4069. // CodeGenTest(L"..\\CodeGenHLSL\\more-operators_Mod.hlsl");
  4070. //}
  4071. // TODO: enable this after support local/parameter resource.
  4072. //TEST_F(CompilerTest, CodeGenObject_Operators_Mod) {
  4073. // CodeGenTest(L"..\\CodeGenHLSL\\object-operators_Mod.hlsl");
  4074. //}
  4075. TEST_F(CompilerTest, CodeGenPackreg_Mod) {
  4076. CodeGenTest(L"..\\CodeGenHLSL\\packreg_Mod.hlsl");
  4077. }
  4078. TEST_F(CompilerTest, CodeGenParentMethod) {
  4079. CodeGenTestCheck(L"..\\CodeGenHLSL\\parent_method.hlsl");
  4080. }
  4081. TEST_F(CompilerTest, CodeGenParameter_Types) {
  4082. CodeGenTestCheck(L"..\\CodeGenHLSL\\parameter_types.hlsl");
  4083. }
  4084. TEST_F(CompilerTest, CodeGenScalar_Assignments_Mod) {
  4085. CodeGenTest(L"..\\CodeGenHLSL\\scalar-assignments_Mod.hlsl");
  4086. }
  4087. TEST_F(CompilerTest, CodeGenScalar_Operators_Assign_Mod) {
  4088. CodeGenTest(L"..\\CodeGenHLSL\\scalar-operators-assign_Mod.hlsl");
  4089. }
  4090. TEST_F(CompilerTest, CodeGenScalar_Operators_Mod) {
  4091. CodeGenTest(L"..\\CodeGenHLSL\\scalar-operators_Mod.hlsl");
  4092. }
  4093. TEST_F(CompilerTest, CodeGenSemantics_Mod) {
  4094. CodeGenTest(L"..\\CodeGenHLSL\\semantics_Mod.hlsl");
  4095. }
  4096. // TEST_F(CompilerTest, CodeGenSpec_Mod){
  4097. // CodeGenTest(L"..\\CodeGenHLSL\\spec_Mod.hlsl");
  4098. //}
  4099. TEST_F(CompilerTest, CodeGenString_Mod) {
  4100. CodeGenTest(L"..\\CodeGenHLSL\\string_Mod.hlsl");
  4101. }
  4102. TEST_F(CompilerTest, CodeGenStruct_Assignments_Mod) {
  4103. CodeGenTest(L"..\\CodeGenHLSL\\struct-assignments_Mod.hlsl");
  4104. }
  4105. TEST_F(CompilerTest, CodeGenStruct_AssignmentsFull_Mod){
  4106. CodeGenTest(L"..\\CodeGenHLSL\\struct-assignmentsFull_Mod.hlsl");
  4107. }
  4108. TEST_F(CompilerTest, CodeGenTemplate_Checks_Mod) {
  4109. CodeGenTestCheck(L"..\\CodeGenHLSL\\template-checks_Mod.hlsl");
  4110. }
  4111. TEST_F(CompilerTest, CodeGenToinclude2_Mod) {
  4112. CodeGenTest(L"..\\CodeGenHLSL\\toinclude2_Mod.hlsl");
  4113. }
  4114. TEST_F(CompilerTest, CodeGenTypemods_Syntax_Mod) {
  4115. CodeGenTest(L"..\\CodeGenHLSL\\typemods-syntax_Mod.hlsl");
  4116. }
  4117. TEST_F(CompilerTest, CodeGenTypedBufferHalf) {
  4118. if (m_ver.SkipDxilVersion(1, 2)) return;
  4119. CodeGenTestCheck(L"..\\CodeGenHLSL\\typed_buffer_half.hlsl");
  4120. }
  4121. TEST_F(CompilerTest, CodeGenTypedefNewType) {
  4122. CodeGenTestCheck(L"..\\CodeGenHLSL\\typedef_new_type.hlsl");
  4123. }
  4124. TEST_F(CompilerTest, CodeGenVarmods_Syntax_Mod) {
  4125. CodeGenTest(L"..\\CodeGenHLSL\\varmods-syntax_Mod.hlsl");
  4126. }
  4127. TEST_F(CompilerTest, CodeGenVector_Assignments_Mod) {
  4128. CodeGenTest(L"..\\CodeGenHLSL\\vector-assignments_Mod.hlsl");
  4129. }
  4130. TEST_F(CompilerTest, CodeGenVector_Syntax_Mix_Mod) {
  4131. CodeGenTest(L"..\\CodeGenHLSL\\vector-syntax-mix_Mod.hlsl");
  4132. }
  4133. TEST_F(CompilerTest, CodeGenVector_Syntax_Mod) {
  4134. CodeGenTest(L"..\\CodeGenHLSL\\vector-syntax_Mod.hlsl");
  4135. }
  4136. TEST_F(CompilerTest, CodeGenBasicHLSL11_PS) {
  4137. CodeGenTestCheck(L"..\\CodeGenHLSL\\BasicHLSL11_PS.hlsl");
  4138. }
  4139. TEST_F(CompilerTest, CodeGenBasicHLSL11_PS2) {
  4140. CodeGenTestCheck(L"..\\CodeGenHLSL\\BasicHLSL11_PS2.hlsl");
  4141. }
  4142. TEST_F(CompilerTest, CodeGenBasicHLSL11_PS3) {
  4143. CodeGenTestCheck(L"..\\CodeGenHLSL\\BasicHLSL11_PS3.hlsl");
  4144. }
  4145. TEST_F(CompilerTest, CodeGenBasicHLSL11_VS) {
  4146. CodeGenTestCheck(L"..\\CodeGenHLSL\\BasicHLSL11_VS.hlsl");
  4147. }
  4148. TEST_F(CompilerTest, CodeGenBasicHLSL11_VS2) {
  4149. CodeGenTestCheck(L"..\\CodeGenHLSL\\BasicHLSL11_VS2.hlsl");
  4150. }
  4151. TEST_F(CompilerTest, CodeGenVecIndexingInput) {
  4152. CodeGenTestCheck(L"..\\CodeGenHLSL\\vecIndexingInput.hlsl");
  4153. }
  4154. TEST_F(CompilerTest, CodeGenVecMulMat) {
  4155. CodeGenTest(L"..\\CodeGenHLSL\\vecMulMat.hlsl");
  4156. }
  4157. TEST_F(CompilerTest, CodeGenVecArrayParam) {
  4158. CodeGenTestCheck(L"..\\CodeGenHLSL\\vector_array_param.hlsl");
  4159. }
  4160. TEST_F(CompilerTest, CodeGenBindings1) {
  4161. CodeGenTestCheck(L"..\\CodeGenHLSL\\bindings1.hlsl");
  4162. }
  4163. TEST_F(CompilerTest, CodeGenBindings2) {
  4164. CodeGenTestCheck(L"..\\CodeGenHLSL\\bindings2.hlsl");
  4165. }
  4166. TEST_F(CompilerTest, CodeGenBindings3) {
  4167. CodeGenTestCheck(L"..\\CodeGenHLSL\\bindings2.hlsl");
  4168. }
  4169. TEST_F(CompilerTest, CodeGenResCopy) {
  4170. CodeGenTestCheck(L"..\\CodeGenHLSL\\resCopy.hlsl");
  4171. }
  4172. TEST_F(CompilerTest, CodeGenResourceInStruct) {
  4173. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-struct.hlsl");
  4174. }
  4175. TEST_F(CompilerTest, CodeGenResourceParam) {
  4176. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource_param.hlsl");
  4177. }
  4178. TEST_F(CompilerTest, CodeGenResourceInCB) {
  4179. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-cb.hlsl");
  4180. }
  4181. TEST_F(CompilerTest, CodeGenResourceInCBV) {
  4182. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-cbv.hlsl");
  4183. }
  4184. TEST_F(CompilerTest, CodeGenResourceInTB) {
  4185. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-tb.hlsl");
  4186. }
  4187. TEST_F(CompilerTest, CodeGenResourceInTBV) {
  4188. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-tbv.hlsl");
  4189. }
  4190. TEST_F(CompilerTest, CodeGenResourceInStruct2) {
  4191. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-struct2.hlsl");
  4192. }
  4193. TEST_F(CompilerTest, CodeGenResourceInStruct3) {
  4194. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-struct3.hlsl");
  4195. }
  4196. TEST_F(CompilerTest, CodeGenResourceInCB2) {
  4197. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-cb2.hlsl");
  4198. }
  4199. TEST_F(CompilerTest, CodeGenResourceInCB3) {
  4200. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-cb3.hlsl");
  4201. }
  4202. TEST_F(CompilerTest, CodeGenResourceInCB4) {
  4203. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-cb4.hlsl");
  4204. }
  4205. TEST_F(CompilerTest, CodeGenResourceInCBV2) {
  4206. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-cbv2.hlsl");
  4207. }
  4208. TEST_F(CompilerTest, CodeGenResourceInTB2) {
  4209. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-tb2.hlsl");
  4210. }
  4211. TEST_F(CompilerTest, CodeGenResourceInTBV2) {
  4212. CodeGenTestCheck(L"..\\CodeGenHLSL\\resource-in-tbv2.hlsl");
  4213. }
  4214. TEST_F(CompilerTest, CodeGenResourceArrayParam) {
  4215. CodeGenTest(L"..\\CodeGenHLSL\\resource-array-param.hlsl");
  4216. }
  4217. TEST_F(CompilerTest, CodeGenResPhi) {
  4218. CodeGenTestCheck(L"..\\CodeGenHLSL\\resPhi.hlsl");
  4219. }
  4220. TEST_F(CompilerTest, CodeGenResPhi2) {
  4221. CodeGenTestCheck(L"..\\CodeGenHLSL\\resPhi2.hlsl");
  4222. }
  4223. TEST_F(CompilerTest, CodeGenRootSigEntry) {
  4224. CodeGenTest(L"..\\CodeGenHLSL\\rootSigEntry.hlsl");
  4225. }
  4226. TEST_F(CompilerTest, CodeGenRootSigProfile) {
  4227. CodeGenTest(L"..\\CodeGenHLSL\\rootSigProfile.hlsl");
  4228. }
  4229. TEST_F(CompilerTest, CodeGenRootSigProfile2) {
  4230. // TODO: Verify the result when reflect the structures.
  4231. CodeGenTest(L"..\\CodeGenHLSL\\rootSigProfile2.hlsl");
  4232. }
  4233. TEST_F(CompilerTest, CodeGenRootSigProfile3) {
  4234. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigProfile3.hlsl");
  4235. }
  4236. TEST_F(CompilerTest, CodeGenRootSigProfile4) {
  4237. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigProfile4.hlsl");
  4238. }
  4239. TEST_F(CompilerTest, CodeGenRootSigProfile5) {
  4240. CodeGenTest(L"..\\CodeGenHLSL\\rootSigProfile5.hlsl");
  4241. }
  4242. TEST_F(CompilerTest, CodeGenRootSigDefine1) {
  4243. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine1.hlsl");
  4244. }
  4245. TEST_F(CompilerTest, CodeGenRootSigDefine2) {
  4246. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine2.hlsl");
  4247. }
  4248. TEST_F(CompilerTest, CodeGenRootSigDefine3) {
  4249. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine3.hlsl");
  4250. }
  4251. TEST_F(CompilerTest, CodeGenRootSigDefine4) {
  4252. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine4.hlsl");
  4253. }
  4254. TEST_F(CompilerTest, CodeGenRootSigDefine5) {
  4255. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine5.hlsl");
  4256. }
  4257. TEST_F(CompilerTest, CodeGenRootSigDefine6) {
  4258. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine6.hlsl");
  4259. }
  4260. TEST_F(CompilerTest, CodeGenRootSigDefine7) {
  4261. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine7.hlsl");
  4262. }
  4263. TEST_F(CompilerTest, CodeGenRootSigDefine8) {
  4264. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine8.hlsl");
  4265. }
  4266. TEST_F(CompilerTest, CodeGenRootSigDefine9) {
  4267. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine9.hlsl");
  4268. }
  4269. TEST_F(CompilerTest, CodeGenRootSigDefine10) {
  4270. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine10.hlsl");
  4271. }
  4272. TEST_F(CompilerTest, CodeGenRootSigDefine11) {
  4273. CodeGenTestCheck(L"..\\CodeGenHLSL\\rootSigDefine11.hlsl");
  4274. }
  4275. TEST_F(CompilerTest, CodeGenCBufferStruct) {
  4276. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer-struct.hlsl");
  4277. }
  4278. TEST_F(CompilerTest, CodeGenCBufferStructArray) {
  4279. CodeGenTestCheck(L"..\\CodeGenHLSL\\cbuffer-structarray.hlsl");
  4280. }
  4281. TEST_F(CompilerTest, CodeGenPatchLength) {
  4282. CodeGenTestCheck(L"..\\CodeGenHLSL\\PatchLength1.hlsl");
  4283. }
  4284. // Dx11 Sample
  4285. TEST_F(CompilerTest, CodeGenDX11Sample_2Dquadshaders_Blurx_Ps){
  4286. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\2DQuadShaders_BlurX_PS.hlsl");
  4287. }
  4288. TEST_F(CompilerTest, CodeGenDX11Sample_2Dquadshaders_Blury_Ps){
  4289. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\2DQuadShaders_BlurY_PS.hlsl");
  4290. }
  4291. TEST_F(CompilerTest, CodeGenDX11Sample_2Dquadshaders_Vs){
  4292. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\2DQuadShaders_VS.hlsl");
  4293. }
  4294. TEST_F(CompilerTest, CodeGenDX11Sample_Bc6Hdecode){
  4295. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC6HDecode.hlsl");
  4296. }
  4297. TEST_F(CompilerTest, CodeGenDX11Sample_Bc6Hencode_Encodeblockcs){
  4298. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC6HEncode_EncodeBlockCS.hlsl");
  4299. }
  4300. TEST_F(CompilerTest, CodeGenDX11Sample_Bc6Hencode_Trymodeg10Cs){
  4301. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC6HEncode_TryModeG10CS.hlsl");
  4302. }
  4303. TEST_F(CompilerTest, CodeGenDX11Sample_Bc6Hencode_Trymodele10Cs){
  4304. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC6HEncode_TryModeLE10CS.hlsl");
  4305. }
  4306. TEST_F(CompilerTest, CodeGenDX11Sample_Bc7Decode){
  4307. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC7Decode.hlsl");
  4308. }
  4309. TEST_F(CompilerTest, CodeGenDX11Sample_Bc7Encode_Encodeblockcs){
  4310. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC7Encode_EncodeBlockCS.hlsl");
  4311. }
  4312. TEST_F(CompilerTest, CodeGenDX11Sample_Bc7Encode_Trymode02Cs){
  4313. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC7Encode_TryMode02CS.hlsl");
  4314. }
  4315. TEST_F(CompilerTest, CodeGenDX11Sample_Bc7Encode_Trymode137Cs){
  4316. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC7Encode_TryMode137CS.hlsl");
  4317. }
  4318. TEST_F(CompilerTest, CodeGenDX11Sample_Bc7Encode_Trymode456Cs){
  4319. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BC7Encode_TryMode456CS.hlsl");
  4320. }
  4321. TEST_F(CompilerTest, CodeGenDX11Sample_Brightpassandhorizfiltercs){
  4322. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\BrightPassAndHorizFilterCS.hlsl");
  4323. }
  4324. TEST_F(CompilerTest, CodeGenDX11Sample_Computeshadersort11){
  4325. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ComputeShaderSort11.hlsl");
  4326. }
  4327. TEST_F(CompilerTest, CodeGenDX11Sample_Computeshadersort11_Matrixtranspose){
  4328. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ComputeShaderSort11_MatrixTranspose.hlsl");
  4329. }
  4330. TEST_F(CompilerTest, CodeGenDX11Sample_Contacthardeningshadows11_Ps){
  4331. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ContactHardeningShadows11_PS.hlsl");
  4332. }
  4333. TEST_F(CompilerTest, CodeGenDX11Sample_Contacthardeningshadows11_Sm_Vs){
  4334. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ContactHardeningShadows11_SM_VS.hlsl");
  4335. }
  4336. TEST_F(CompilerTest, CodeGenDX11Sample_Contacthardeningshadows11_Vs){
  4337. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ContactHardeningShadows11_VS.hlsl");
  4338. }
  4339. TEST_F(CompilerTest, CodeGenDX11Sample_Decaltessellation11_Ds){
  4340. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DecalTessellation11_DS.hlsl");
  4341. }
  4342. TEST_F(CompilerTest, CodeGenDX11Sample_Decaltessellation11_Hs){
  4343. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DecalTessellation11_HS.hlsl");
  4344. }
  4345. TEST_F(CompilerTest, CodeGenDX11Sample_Decaltessellation11_Ps){
  4346. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DecalTessellation11_PS.hlsl");
  4347. }
  4348. TEST_F(CompilerTest, CodeGenDX11Sample_Decaltessellation11_Tessvs){
  4349. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DecalTessellation11_TessVS.hlsl");
  4350. }
  4351. TEST_F(CompilerTest, CodeGenDX11Sample_Decaltessellation11_Vs){
  4352. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DecalTessellation11_VS.hlsl");
  4353. }
  4354. TEST_F(CompilerTest, CodeGenDX11Sample_Detailtessellation11_Ds){
  4355. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DetailTessellation11_DS.hlsl");
  4356. }
  4357. TEST_F(CompilerTest, CodeGenDX11Sample_Detailtessellation11_Hs){
  4358. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DetailTessellation11_HS.hlsl");
  4359. }
  4360. TEST_F(CompilerTest, CodeGenDX11Sample_Detailtessellation11_Ps){
  4361. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DetailTessellation11_PS.hlsl");
  4362. }
  4363. TEST_F(CompilerTest, CodeGenDX11Sample_Detailtessellation11_Tessvs){
  4364. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DetailTessellation11_TessVS.hlsl");
  4365. }
  4366. TEST_F(CompilerTest, CodeGenDX11Sample_Detailtessellation11_Vs){
  4367. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DetailTessellation11_VS.hlsl");
  4368. }
  4369. TEST_F(CompilerTest, CodeGenDX11Sample_Dumptotexture){
  4370. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\DumpToTexture.hlsl");
  4371. }
  4372. TEST_F(CompilerTest, CodeGenDX11Sample_Filtercs_Horz){
  4373. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FilterCS_Horz.hlsl");
  4374. }
  4375. TEST_F(CompilerTest, CodeGenDX11Sample_Filtercs_Vertical){
  4376. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FilterCS_Vertical.hlsl");
  4377. }
  4378. TEST_F(CompilerTest, CodeGenDX11Sample_Finalpass_Cpu_Ps){
  4379. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FinalPass_CPU_PS.hlsl");
  4380. }
  4381. TEST_F(CompilerTest, CodeGenDX11Sample_Finalpass_Ps){
  4382. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FinalPass_PS.hlsl");
  4383. }
  4384. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Buildgridcs){
  4385. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_BuildGridCS.hlsl");
  4386. }
  4387. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Buildgridindicescs){
  4388. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_BuildGridIndicesCS.hlsl");
  4389. }
  4390. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Cleargridindicescs){
  4391. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_ClearGridIndicesCS.hlsl");
  4392. }
  4393. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Densitycs_Grid){
  4394. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_DensityCS_Grid.hlsl");
  4395. }
  4396. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Densitycs_Shared){
  4397. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_DensityCS_Shared.hlsl");
  4398. }
  4399. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Densitycs_Simple){
  4400. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_DensityCS_Simple.hlsl");
  4401. }
  4402. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Forcecs_Grid){
  4403. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_ForceCS_Grid.hlsl");
  4404. }
  4405. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Forcecs_Shared){
  4406. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_ForceCS_Shared.hlsl");
  4407. }
  4408. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Forcecs_Simple){
  4409. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_ForceCS_Simple.hlsl");
  4410. }
  4411. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Integratecs){
  4412. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_IntegrateCS.hlsl");
  4413. }
  4414. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidcs11_Rearrangeparticlescs){
  4415. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidCS11_RearrangeParticlesCS.hlsl");
  4416. }
  4417. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidrender_Gs){
  4418. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidRender_GS.hlsl");
  4419. }
  4420. TEST_F(CompilerTest, CodeGenDX11Sample_Fluidrender_Vs){
  4421. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\FluidRender_VS.hlsl");
  4422. }
  4423. TEST_F(CompilerTest, CodeGenDX11Sample_Nbodygravitycs11){
  4424. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\NBodyGravityCS11.hlsl");
  4425. }
  4426. TEST_F(CompilerTest, CodeGenDX11Sample_Oit_Createprefixsum_Pass0_Cs){
  4427. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\OIT_CreatePrefixSum_Pass0_CS.hlsl");
  4428. }
  4429. TEST_F(CompilerTest, CodeGenDX11Sample_Oit_Createprefixsum_Pass1_Cs){
  4430. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\OIT_CreatePrefixSum_Pass1_CS.hlsl");
  4431. }
  4432. TEST_F(CompilerTest, CodeGenDX11Sample_Oit_Fragmentcountps){
  4433. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\OIT_FragmentCountPS.hlsl");
  4434. }
  4435. TEST_F(CompilerTest, CodeGenDX11Sample_Oit_Ps){
  4436. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\OIT_PS.hlsl");
  4437. }
  4438. TEST_F(CompilerTest, CodeGenDX11Sample_Oit_Sortandrendercs){
  4439. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\OIT_SortAndRenderCS.hlsl");
  4440. }
  4441. TEST_F(CompilerTest, CodeGenDX11Sample_Particledraw_Gs){
  4442. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ParticleDraw_GS.hlsl");
  4443. }
  4444. TEST_F(CompilerTest, CodeGenDX11Sample_Particledraw_Vs){
  4445. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ParticleDraw_VS.hlsl");
  4446. }
  4447. TEST_F(CompilerTest, CodeGenDX11Sample_Particle_Gs){
  4448. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\Particle_GS.hlsl");
  4449. }
  4450. TEST_F(CompilerTest, CodeGenDX11Sample_Particle_Ps){
  4451. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\Particle_PS.hlsl");
  4452. }
  4453. TEST_F(CompilerTest, CodeGenDX11Sample_Particle_Vs){
  4454. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\Particle_VS.hlsl");
  4455. }
  4456. TEST_F(CompilerTest, CodeGenDX11Sample_Pntriangles11_Ds){
  4457. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PNTriangles11_DS.hlsl");
  4458. }
  4459. TEST_F(CompilerTest, CodeGenDX11Sample_Pntriangles11_Hs){
  4460. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PNTriangles11_HS.hlsl");
  4461. }
  4462. TEST_F(CompilerTest, CodeGenDX11Sample_Pntriangles11_Tessvs){
  4463. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PNTriangles11_TessVS.hlsl");
  4464. }
  4465. TEST_F(CompilerTest, CodeGenDX11Sample_Pntriangles11_Vs){
  4466. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PNTriangles11_VS.hlsl");
  4467. }
  4468. TEST_F(CompilerTest, CodeGenDX11Sample_Pom_Ps){
  4469. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\POM_PS.hlsl");
  4470. }
  4471. TEST_F(CompilerTest, CodeGenDX11Sample_Pom_Vs){
  4472. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\POM_VS.hlsl");
  4473. }
  4474. TEST_F(CompilerTest, CodeGenDX11Sample_Psapproach_Bloomps){
  4475. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PSApproach_BloomPS.hlsl");
  4476. }
  4477. TEST_F(CompilerTest, CodeGenDX11Sample_Psapproach_Downscale2X2_Lumps){
  4478. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PSApproach_DownScale2x2_LumPS.hlsl");
  4479. }
  4480. TEST_F(CompilerTest, CodeGenDX11Sample_Psapproach_Downscale3X3Ps){
  4481. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PSApproach_DownScale3x3PS.hlsl");
  4482. }
  4483. TEST_F(CompilerTest, CodeGenDX11Sample_Psapproach_Downscale3X3_Brightpassps){
  4484. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PSApproach_DownScale3x3_BrightPassPS.hlsl");
  4485. }
  4486. TEST_F(CompilerTest, CodeGenDX11Sample_Psapproach_Finalpassps){
  4487. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\PSApproach_FinalPassPS.hlsl");
  4488. }
  4489. TEST_F(CompilerTest, CodeGenDX11Sample_Reduceto1Dcs){
  4490. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ReduceTo1DCS.hlsl");
  4491. }
  4492. TEST_F(CompilerTest, CodeGenDX11Sample_Reducetosinglecs){
  4493. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\ReduceToSingleCS.hlsl");
  4494. }
  4495. TEST_F(CompilerTest, CodeGenDX11Sample_Rendervariancesceneps){
  4496. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\RenderVarianceScenePS.hlsl");
  4497. }
  4498. TEST_F(CompilerTest, CodeGenDX11Sample_Rendervs){
  4499. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\RenderVS.hlsl");
  4500. }
  4501. TEST_F(CompilerTest, CodeGenDX11Sample_Simplebezier11Ds){
  4502. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SimpleBezier11DS.hlsl");
  4503. }
  4504. TEST_F(CompilerTest, CodeGenDX11Sample_Simplebezier11Hs){
  4505. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SimpleBezier11HS.hlsl");
  4506. }
  4507. TEST_F(CompilerTest, CodeGenDX11Sample_Simplebezier11Ps){
  4508. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SimpleBezier11PS.hlsl");
  4509. }
  4510. TEST_F(CompilerTest, CodeGenDX11Sample_Subd11_Bezierevalds){
  4511. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_BezierEvalDS.hlsl");
  4512. }
  4513. TEST_F(CompilerTest, CodeGenDX11Sample_Subd11_Meshskinningvs){
  4514. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_MeshSkinningVS.hlsl");
  4515. }
  4516. TEST_F(CompilerTest, CodeGenDX11Sample_Subd11_Patchskinningvs){
  4517. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_PatchSkinningVS.hlsl");
  4518. }
  4519. TEST_F(CompilerTest, CodeGenDX11Sample_Subd11_Smoothps){
  4520. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_SmoothPS.hlsl");
  4521. }
  4522. TEST_F(CompilerTest, CodeGenDX11Sample_Subd11_Subdtobezierhs){
  4523. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_SubDToBezierHS.hlsl");
  4524. }
  4525. TEST_F(CompilerTest, CodeGenDX11Sample_Subd11_Subdtobezierhs4444){
  4526. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\SubD11_SubDToBezierHS4444.hlsl");
  4527. }
  4528. TEST_F(CompilerTest, CodeGenDX11Sample_Tessellatorcs40_Edgefactorcs){
  4529. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\TessellatorCS40_EdgeFactorCS.hlsl");
  4530. }
  4531. TEST_F(CompilerTest, CodeGenDX11Sample_Tessellatorcs40_Numverticesindicescs){
  4532. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\TessellatorCS40_NumVerticesIndicesCS.hlsl");
  4533. }
  4534. TEST_F(CompilerTest, CodeGenDX11Sample_Tessellatorcs40_Scatteridcs){
  4535. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\TessellatorCS40_ScatterIDCS.hlsl");
  4536. }
  4537. TEST_F(CompilerTest, CodeGenDX11Sample_Tessellatorcs40_Tessellateindicescs){
  4538. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\TessellatorCS40_TessellateIndicesCS.hlsl");
  4539. }
  4540. TEST_F(CompilerTest, CodeGenDX11Sample_Tessellatorcs40_Tessellateverticescs){
  4541. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\DX11\\TessellatorCS40_TessellateVerticesCS.hlsl");
  4542. }
  4543. // Dx12 Sample
  4544. TEST_F(CompilerTest, CodeGenSamplesD12_DynamicIndexing_PS) {
  4545. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\d12_dynamic_indexing_pixel.hlsl");
  4546. }
  4547. TEST_F(CompilerTest, CodeGenSamplesD12_ExecuteIndirect_CS) {
  4548. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\d12_execute_indirect_cs.hlsl");
  4549. }
  4550. TEST_F(CompilerTest, CodeGenSamplesD12_MultiThreading_VS) {
  4551. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\d12_multithreading_vs.hlsl");
  4552. }
  4553. TEST_F(CompilerTest, CodeGenSamplesD12_MultiThreading_PS) {
  4554. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\d12_multithreading_ps.hlsl");
  4555. }
  4556. TEST_F(CompilerTest, CodeGenSamplesD12_NBodyGravity_CS) {
  4557. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\d12_nBodyGravityCS.hlsl");
  4558. }
  4559. // Dx12 sample/MiniEngine
  4560. TEST_F(CompilerTest, CodeGenDx12MiniEngineAdaptexposurecs){
  4561. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AdaptExposureCS.hlsl");
  4562. }
  4563. TEST_F(CompilerTest, CodeGenDx12MiniEngineAoblurupsampleblendoutcs){
  4564. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoBlurUpsampleBlendOutCS.hlsl");
  4565. }
  4566. TEST_F(CompilerTest, CodeGenDx12MiniEngineAoblurupsamplecs){
  4567. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoBlurUpsampleCS.hlsl");
  4568. }
  4569. TEST_F(CompilerTest, CodeGenDx12MiniEngineAoblurupsamplepreminblendoutcs){
  4570. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoBlurUpsamplePreMinBlendOutCS.hlsl");
  4571. }
  4572. TEST_F(CompilerTest, CodeGenDx12MiniEngineAoblurupsamplepremincs){
  4573. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoBlurUpsamplePreMinCS.hlsl");
  4574. }
  4575. TEST_F(CompilerTest, CodeGenDx12MiniEngineAopreparedepthbuffers1Cs){
  4576. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoPrepareDepthBuffers1CS.hlsl");
  4577. }
  4578. TEST_F(CompilerTest, CodeGenDx12MiniEngineAopreparedepthbuffers2Cs){
  4579. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoPrepareDepthBuffers2CS.hlsl");
  4580. }
  4581. TEST_F(CompilerTest, CodeGenDx12MiniEngineAorender1Cs){
  4582. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoRender1CS.hlsl");
  4583. }
  4584. TEST_F(CompilerTest, CodeGenDx12MiniEngineAorender2Cs){
  4585. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AoRender2CS.hlsl");
  4586. }
  4587. TEST_F(CompilerTest, CodeGenDx12MiniEngineApplybloomcs){
  4588. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ApplyBloomCS.hlsl");
  4589. }
  4590. TEST_F(CompilerTest, CodeGenDx12MiniEngineAveragelumacs){
  4591. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\AverageLumaCS.hlsl");
  4592. }
  4593. TEST_F(CompilerTest, CodeGenDx12MiniEngineBicubichorizontalupsampleps){
  4594. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BicubicHorizontalUpsamplePS.hlsl");
  4595. }
  4596. TEST_F(CompilerTest, CodeGenDx12MiniEngineBicubicupsamplegammaps){
  4597. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BicubicUpsampleGammaPS.hlsl");
  4598. }
  4599. TEST_F(CompilerTest, CodeGenDx12MiniEngineBicubicupsampleps){
  4600. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BicubicUpsamplePS.hlsl");
  4601. }
  4602. TEST_F(CompilerTest, CodeGenDx12MiniEngineBicubicverticalupsampleps){
  4603. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BicubicVerticalUpsamplePS.hlsl");
  4604. }
  4605. TEST_F(CompilerTest, CodeGenDx12MiniEngineBilinearupsampleps){
  4606. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BilinearUpsamplePS.hlsl");
  4607. }
  4608. TEST_F(CompilerTest, CodeGenDx12MiniEngineBloomextractanddownsamplehdrcs){
  4609. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BloomExtractAndDownsampleHdrCS.hlsl");
  4610. }
  4611. TEST_F(CompilerTest, CodeGenDx12MiniEngineBloomextractanddownsampleldrcs){
  4612. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BloomExtractAndDownsampleLdrCS.hlsl");
  4613. }
  4614. TEST_F(CompilerTest, CodeGenDx12MiniEngineBlurcs){
  4615. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BlurCS.hlsl");
  4616. }
  4617. TEST_F(CompilerTest, CodeGenDx12MiniEngineBuffercopyps){
  4618. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\BufferCopyPS.hlsl");
  4619. }
  4620. TEST_F(CompilerTest, CodeGenDx12MiniEngineCameramotionblurprepasscs){
  4621. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\CameraMotionBlurPrePassCS.hlsl");
  4622. }
  4623. TEST_F(CompilerTest, CodeGenDx12MiniEngineCameramotionblurprepasslinearzcs){
  4624. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\CameraMotionBlurPrePassLinearZCS.hlsl");
  4625. }
  4626. TEST_F(CompilerTest, CodeGenDx12MiniEngineCameravelocitycs){
  4627. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\CameraVelocityCS.hlsl");
  4628. }
  4629. TEST_F(CompilerTest, CodeGenDx12MiniEngineConvertldrtodisplayaltps){
  4630. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ConvertLDRToDisplayAltPS.hlsl");
  4631. }
  4632. TEST_F(CompilerTest, CodeGenDx12MiniEngineConvertldrtodisplayps){
  4633. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ConvertLDRToDisplayPS.hlsl");
  4634. }
  4635. TEST_F(CompilerTest, CodeGenDx12MiniEngineDebugdrawhistogramcs){
  4636. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DebugDrawHistogramCS.hlsl");
  4637. }
  4638. TEST_F(CompilerTest, CodeGenDx12MiniEngineDebugluminancehdrcs){
  4639. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DebugLuminanceHdrCS.hlsl");
  4640. }
  4641. TEST_F(CompilerTest, CodeGenDx12MiniEngineDebugluminanceldrcs){
  4642. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DebugLuminanceLdrCS.hlsl");
  4643. }
  4644. TEST_F(CompilerTest, CodeGenDx12MiniEngineDebugssaocs){
  4645. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DebugSSAOCS.hlsl");
  4646. }
  4647. TEST_F(CompilerTest, CodeGenDx12MiniEngineDepthviewerps){
  4648. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DepthViewerPS.hlsl");
  4649. }
  4650. TEST_F(CompilerTest, CodeGenDx12MiniEngineDepthviewervs){
  4651. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DepthViewerVS.hlsl");
  4652. }
  4653. TEST_F(CompilerTest, CodeGenDx12MiniEngineDownsamplebloomallcs){
  4654. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DownsampleBloomAllCS.hlsl");
  4655. }
  4656. TEST_F(CompilerTest, CodeGenDx12MiniEngineDownsamplebloomcs){
  4657. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\DownsampleBloomCS.hlsl");
  4658. }
  4659. TEST_F(CompilerTest, CodeGenDx12MiniEngineExtractlumacs){
  4660. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ExtractLumaCS.hlsl");
  4661. }
  4662. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaapass1_Luma_Cs){
  4663. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAPass1_Luma_CS.hlsl");
  4664. }
  4665. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaapass1_Rgb_Cs){
  4666. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAPass1_RGB_CS.hlsl");
  4667. }
  4668. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaapass2Hcs){
  4669. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAPass2HCS.hlsl");
  4670. }
  4671. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaapass2Hdebugcs){
  4672. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAPass2HDebugCS.hlsl");
  4673. }
  4674. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaapass2Vcs){
  4675. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAPass2VCS.hlsl");
  4676. }
  4677. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaapass2Vdebugcs){
  4678. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAPass2VDebugCS.hlsl");
  4679. }
  4680. TEST_F(CompilerTest, CodeGenDx12MiniEngineFxaaresolveworkqueuecs){
  4681. if (m_ver.SkipIRSensitiveTest()) return;
  4682. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\FXAAResolveWorkQueueCS.hlsl");
  4683. }
  4684. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratehistogramcs){
  4685. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateHistogramCS.hlsl");
  4686. }
  4687. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipsgammacs){
  4688. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsGammaCS.hlsl");
  4689. }
  4690. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipsgammaoddcs){
  4691. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsGammaOddCS.hlsl");
  4692. }
  4693. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipsgammaoddxcs){
  4694. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsGammaOddXCS.hlsl");
  4695. }
  4696. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipsgammaoddycs){
  4697. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsGammaOddYCS.hlsl");
  4698. }
  4699. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipslinearcs){
  4700. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsLinearCS.hlsl");
  4701. }
  4702. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipslinearoddcs){
  4703. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsLinearOddCS.hlsl");
  4704. }
  4705. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipslinearoddxcs){
  4706. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsLinearOddXCS.hlsl");
  4707. }
  4708. TEST_F(CompilerTest, CodeGenDx12MiniEngineGeneratemipslinearoddycs){
  4709. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\GenerateMipsLinearOddYCS.hlsl");
  4710. }
  4711. TEST_F(CompilerTest, CodeGenDx12MiniEngineLinearizedepthcs){
  4712. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\LinearizeDepthCS.hlsl");
  4713. }
  4714. TEST_F(CompilerTest, CodeGenDx12MiniEngineMagnifypixelsps){
  4715. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\MagnifyPixelsPS.hlsl");
  4716. }
  4717. TEST_F(CompilerTest, CodeGenDx12MiniEngineModelviewerps){
  4718. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ModelViewerPS.hlsl");
  4719. }
  4720. TEST_F(CompilerTest, CodeGenDx12MiniEngineModelviewervs){
  4721. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ModelViewerVS.hlsl");
  4722. }
  4723. TEST_F(CompilerTest, CodeGenDx12MiniEngineMotionblurfinalpasscs){
  4724. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\MotionBlurFinalPassCS.hlsl");
  4725. }
  4726. TEST_F(CompilerTest, CodeGenDx12MiniEngineMotionblurfinalpasstemporalcs){
  4727. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\MotionBlurFinalPassTemporalCS.hlsl");
  4728. }
  4729. TEST_F(CompilerTest, CodeGenDx12MiniEngineMotionblurprepasscs){
  4730. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\MotionBlurPrePassCS.hlsl");
  4731. }
  4732. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlebincullingcs){
  4733. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleBinCullingCS.hlsl");
  4734. }
  4735. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticledepthboundscs){
  4736. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleDepthBoundsCS.hlsl");
  4737. }
  4738. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticledispatchindirectargscs){
  4739. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleDispatchIndirectArgsCS.hlsl");
  4740. }
  4741. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlefinaldispatchindirectargscs){
  4742. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleFinalDispatchIndirectArgsCS.hlsl");
  4743. }
  4744. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticleinnersortcs){
  4745. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleInnerSortCS.hlsl");
  4746. }
  4747. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlelargebincullingcs){
  4748. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleLargeBinCullingCS.hlsl");
  4749. }
  4750. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticleoutersortcs){
  4751. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleOuterSortCS.hlsl");
  4752. }
  4753. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlepresortcs){
  4754. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticlePreSortCS.hlsl");
  4755. }
  4756. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticleps){
  4757. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticlePS.hlsl");
  4758. }
  4759. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlesortindirectargscs){
  4760. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleSortIndirectArgsCS.hlsl");
  4761. }
  4762. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlespawncs){
  4763. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleSpawnCS.hlsl");
  4764. }
  4765. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilecullingcs){
  4766. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileCullingCS.hlsl");
  4767. }
  4768. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilerendercs){
  4769. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileRenderCS.hlsl");
  4770. }
  4771. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilerenderfastcs){
  4772. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileRenderFastCS.hlsl");
  4773. }
  4774. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilerenderfastdynamiccs){
  4775. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileRenderFastDynamicCS.hlsl");
  4776. }
  4777. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilerenderfastlowrescs){
  4778. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileRenderFastLowResCS.hlsl");
  4779. }
  4780. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilerenderslowdynamiccs){
  4781. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileRenderSlowDynamicCS.hlsl");
  4782. }
  4783. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticletilerenderslowlowrescs){
  4784. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleTileRenderSlowLowResCS.hlsl");
  4785. }
  4786. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticleupdatecs){
  4787. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleUpdateCS.hlsl");
  4788. }
  4789. TEST_F(CompilerTest, CodeGenDx12MiniEngineParticlevs){
  4790. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ParticleVS.hlsl");
  4791. }
  4792. TEST_F(CompilerTest, CodeGenDx12MiniEnginePerfgraphbackgroundvs){
  4793. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\PerfGraphBackgroundVS.hlsl");
  4794. }
  4795. TEST_F(CompilerTest, CodeGenDx12MiniEnginePerfgraphps){
  4796. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\PerfGraphPS.hlsl");
  4797. }
  4798. TEST_F(CompilerTest, CodeGenDx12MiniEnginePerfgraphvs){
  4799. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\PerfGraphVS.hlsl");
  4800. }
  4801. TEST_F(CompilerTest, CodeGenDx12MiniEngineScreenquadvs){
  4802. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ScreenQuadVS.hlsl");
  4803. }
  4804. TEST_F(CompilerTest, CodeGenDx12MiniEngineSharpeningupsamplegammaps){
  4805. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\SharpeningUpsampleGammaPS.hlsl");
  4806. }
  4807. TEST_F(CompilerTest, CodeGenDx12MiniEngineSharpeningupsampleps){
  4808. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\SharpeningUpsamplePS.hlsl");
  4809. }
  4810. TEST_F(CompilerTest, CodeGenDx12MiniEngineTemporalblendcs){
  4811. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\TemporalBlendCS.hlsl");
  4812. }
  4813. TEST_F(CompilerTest, CodeGenDx12MiniEngineTextantialiasps){
  4814. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\TextAntialiasPS.hlsl");
  4815. }
  4816. TEST_F(CompilerTest, CodeGenDx12MiniEngineTextshadowps){
  4817. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\TextShadowPS.hlsl");
  4818. }
  4819. TEST_F(CompilerTest, CodeGenDx12MiniEngineTextvs){
  4820. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\TextVS.hlsl");
  4821. }
  4822. TEST_F(CompilerTest, CodeGenDx12MiniEngineTonemap2Cs){
  4823. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ToneMap2CS.hlsl");
  4824. }
  4825. TEST_F(CompilerTest, CodeGenDx12MiniEngineTonemapcs){
  4826. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\ToneMapCS.hlsl");
  4827. }
  4828. TEST_F(CompilerTest, CodeGenDx12MiniEngineUpsampleandblurcs){
  4829. CodeGenTestCheck(L"..\\CodeGenHLSL\\Samples\\MiniEngine\\UpsampleAndBlurCS.hlsl");
  4830. }
  4831. TEST_F(CompilerTest, DxilGen_StoreOutput) {
  4832. CodeGenTestCheck(L"..\\CodeGenHLSL\\dxilgen_storeoutput.hlsl");
  4833. }
  4834. TEST_F(CompilerTest, ConstantFolding) {
  4835. CodeGenTestCheck(L"constprop\\FAbs.hlsl");
  4836. CodeGenTestCheck(L"constprop\\Saturate_half.hlsl");
  4837. CodeGenTestCheck(L"constprop\\Saturate_float.hlsl");
  4838. CodeGenTestCheck(L"constprop\\Saturate_double.hlsl");
  4839. CodeGenTestCheck(L"constprop\\Cos.hlsl");
  4840. CodeGenTestCheck(L"constprop\\Sin.hlsl");
  4841. CodeGenTestCheck(L"constprop\\Tan.hlsl");
  4842. CodeGenTestCheck(L"constprop\\Acos.hlsl");
  4843. CodeGenTestCheck(L"constprop\\Asin.hlsl");
  4844. CodeGenTestCheck(L"constprop\\Atan.hlsl");
  4845. CodeGenTestCheck(L"constprop\\Hcos.hlsl");
  4846. CodeGenTestCheck(L"constprop\\Hsin.hlsl");
  4847. CodeGenTestCheck(L"constprop\\Htan.hlsl");
  4848. CodeGenTestCheck(L"constprop\\Exp.hlsl");
  4849. CodeGenTestCheck(L"constprop\\Frc.hlsl");
  4850. CodeGenTestCheck(L"constprop\\Log.hlsl");
  4851. CodeGenTestCheck(L"constprop\\Sqrt.hlsl");
  4852. CodeGenTestCheck(L"constprop\\Rsqrt.hlsl");
  4853. CodeGenTestCheck(L"constprop\\Round_ne.hlsl");
  4854. CodeGenTestCheck(L"constprop\\Round_ni.hlsl");
  4855. CodeGenTestCheck(L"constprop\\Round_pi.hlsl");
  4856. CodeGenTestCheck(L"constprop\\Round_z.hlsl");
  4857. CodeGenTestCheck(L"constprop\\Bfrev.hlsl");
  4858. CodeGenTestCheck(L"constprop\\Countbits.hlsl");
  4859. CodeGenTestCheck(L"constprop\\Firstbitlo.hlsl");
  4860. CodeGenTestCheck(L"constprop\\Firstbithi.hlsl");
  4861. CodeGenTestCheck(L"constprop\\FMin.hlsl");
  4862. CodeGenTestCheck(L"constprop\\FMax.hlsl");
  4863. CodeGenTestCheck(L"constprop\\IMin.hlsl");
  4864. CodeGenTestCheck(L"constprop\\IMax.hlsl");
  4865. CodeGenTestCheck(L"constprop\\UMin.hlsl");
  4866. CodeGenTestCheck(L"constprop\\UMax.hlsl");
  4867. CodeGenTestCheck(L"constprop\\FMad.hlsl");
  4868. CodeGenTestCheck(L"constprop\\Fma.hlsl");
  4869. CodeGenTestCheck(L"constprop\\IMad.hlsl");
  4870. CodeGenTestCheck(L"constprop\\UMad.hlsl");
  4871. CodeGenTestCheck(L"constprop\\Dot2.hlsl");
  4872. CodeGenTestCheck(L"constprop\\Dot3.hlsl");
  4873. CodeGenTestCheck(L"constprop\\Dot4.hlsl");
  4874. CodeGenTestCheck(L"constprop\\ibfe.ll");
  4875. CodeGenTestCheck(L"constprop\\ubfe.ll");
  4876. CodeGenTestCheck(L"constprop\\bfi.ll");
  4877. }
  4878. TEST_F(CompilerTest, HoistConstantArray) {
  4879. CodeGenTestCheck(L"hca\\01.hlsl");
  4880. CodeGenTestCheck(L"hca\\02.hlsl");
  4881. CodeGenTestCheck(L"hca\\03.hlsl");
  4882. CodeGenTestCheck(L"hca\\04.hlsl");
  4883. CodeGenTestCheck(L"hca\\05.hlsl");
  4884. CodeGenTestCheck(L"hca\\06.hlsl");
  4885. CodeGenTestCheck(L"hca\\07.hlsl");
  4886. CodeGenTestCheck(L"hca\\08.hlsl");
  4887. CodeGenTestCheck(L"hca\\09.hlsl");
  4888. CodeGenTestCheck(L"hca\\10.hlsl");
  4889. CodeGenTestCheck(L"hca\\11.hlsl");
  4890. CodeGenTestCheck(L"hca\\12.hlsl");
  4891. CodeGenTestCheck(L"hca\\13.hlsl");
  4892. CodeGenTestCheck(L"hca\\14.hlsl");
  4893. CodeGenTestCheck(L"hca\\15.ll");
  4894. }
  4895. TEST_F(CompilerTest, VecElemConstEval) {
  4896. CodeGenTestCheck(L"..\\CodeGenHLSL\\vec_elem_const_eval.hlsl");
  4897. }
  4898. TEST_F(CompilerTest, PreprocessWhenValidThenOK) {
  4899. CComPtr<IDxcCompiler> pCompiler;
  4900. CComPtr<IDxcOperationResult> pResult;
  4901. CComPtr<IDxcBlobEncoding> pSource;
  4902. DxcDefine defines[2];
  4903. defines[0].Name = L"MYDEF";
  4904. defines[0].Value = L"int";
  4905. defines[1].Name = L"MYOTHERDEF";
  4906. defines[1].Value = L"123";
  4907. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  4908. CreateBlobFromText(
  4909. "// First line\r\n"
  4910. "MYDEF g_int = MYOTHERDEF;\r\n"
  4911. "#define FOO BAR\r\n"
  4912. "int FOO;", &pSource);
  4913. VERIFY_SUCCEEDED(pCompiler->Preprocess(pSource, L"file.hlsl", nullptr, 0,
  4914. defines, _countof(defines), nullptr,
  4915. &pResult));
  4916. HRESULT hrOp;
  4917. VERIFY_SUCCEEDED(pResult->GetStatus(&hrOp));
  4918. VERIFY_SUCCEEDED(hrOp);
  4919. CComPtr<IDxcBlob> pOutText;
  4920. VERIFY_SUCCEEDED(pResult->GetResult(&pOutText));
  4921. std::string text(BlobToUtf8(pOutText));
  4922. VERIFY_ARE_EQUAL_STR(
  4923. "#line 1 \"file.hlsl\"\n"
  4924. "\n"
  4925. "int g_int = 123;\n"
  4926. "\n"
  4927. "int BAR;\n", text.c_str());
  4928. }
  4929. TEST_F(CompilerTest, PreprocessWhenExpandTokenPastingOperandThenAccept) {
  4930. // Tests that we can turn on fxc's behavior (pre-expanding operands before
  4931. // performing token-pasting) using -flegacy-macro-expansion
  4932. CComPtr<IDxcCompiler> pCompiler;
  4933. CComPtr<IDxcOperationResult> pResult;
  4934. CComPtr<IDxcBlobEncoding> pSource;
  4935. LPCWSTR expandOption = L"-flegacy-macro-expansion";
  4936. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  4937. CreateBlobFromText(R"(
  4938. #define SET_INDEX0 10
  4939. #define BINDING_INDEX0 5
  4940. #define SET(INDEX) SET_INDEX##INDEX
  4941. #define BINDING(INDEX) BINDING_INDEX##INDEX
  4942. #define SET_BIND(NAME,SET,BIND) resource_set_##SET##_bind_##BIND##_##NAME
  4943. #define RESOURCE(NAME,INDEX) SET_BIND(NAME, SET(INDEX), BINDING(INDEX))
  4944. Texture2D<float4> resource_set_10_bind_5_tex;
  4945. float4 main() : SV_Target{
  4946. return RESOURCE(tex, 0)[uint2(1, 2)];
  4947. }
  4948. )",
  4949. &pSource);
  4950. VERIFY_SUCCEEDED(pCompiler->Preprocess(pSource, L"file.hlsl", &expandOption,
  4951. 1, nullptr, 0, nullptr, &pResult));
  4952. HRESULT hrOp;
  4953. VERIFY_SUCCEEDED(pResult->GetStatus(&hrOp));
  4954. VERIFY_SUCCEEDED(hrOp);
  4955. CComPtr<IDxcBlob> pOutText;
  4956. VERIFY_SUCCEEDED(pResult->GetResult(&pOutText));
  4957. std::string text(BlobToUtf8(pOutText));
  4958. VERIFY_ARE_EQUAL_STR(R"(#line 1 "file.hlsl"
  4959. #line 12 "file.hlsl"
  4960. Texture2D<float4> resource_set_10_bind_5_tex;
  4961. float4 main() : SV_Target{
  4962. return resource_set_10_bind_5_tex[uint2(1, 2)];
  4963. }
  4964. )",
  4965. text.c_str());
  4966. }
  4967. TEST_F(CompilerTest, WhenSigMismatchPCFunctionThenFail) {
  4968. CComPtr<IDxcCompiler> pCompiler;
  4969. CComPtr<IDxcOperationResult> pResult;
  4970. CComPtr<IDxcBlobEncoding> pSource;
  4971. VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
  4972. CreateBlobFromText(
  4973. "struct PSSceneIn \n\
  4974. { \n\
  4975. float4 pos : SV_Position; \n\
  4976. float2 tex : TEXCOORD0; \n\
  4977. float3 norm : NORMAL; \n\
  4978. }; \n"
  4979. "struct HSPerPatchData { \n\
  4980. float edges[ 3 ] : SV_TessFactor; \n\
  4981. float inside : SV_InsideTessFactor; \n\
  4982. float foo : FOO; \n\
  4983. }; \n"
  4984. "HSPerPatchData HSPerPatchFunc( InputPatch< PSSceneIn, 3 > points, \n\
  4985. OutputPatch<PSSceneIn, 3> outpoints) { \n\
  4986. HSPerPatchData d = (HSPerPatchData)0; \n\
  4987. d.edges[ 0 ] = points[0].tex.x + outpoints[0].tex.x; \n\
  4988. d.edges[ 1 ] = 1; \n\
  4989. d.edges[ 2 ] = 1; \n\
  4990. d.inside = 1; \n\
  4991. return d; \n\
  4992. } \n"
  4993. "[domain(\"tri\")] \n\
  4994. [partitioning(\"fractional_odd\")] \n\
  4995. [outputtopology(\"triangle_cw\")] \n\
  4996. [patchconstantfunc(\"HSPerPatchFunc\")] \n\
  4997. [outputcontrolpoints(3)] \n"
  4998. "void main(const uint id : SV_OutputControlPointID, \n\
  4999. const InputPatch< PSSceneIn, 3 > points ) { \n\
  5000. } \n"
  5001. , &pSource);
  5002. VERIFY_SUCCEEDED(pCompiler->Compile(pSource, L"source.hlsl", L"main",
  5003. L"hs_6_0", nullptr, 0, nullptr, 0, nullptr, &pResult));
  5004. std::string failLog(VerifyOperationFailed(pResult));
  5005. VERIFY_ARE_NOT_EQUAL(string::npos, failLog.find(
  5006. "Signature element SV_Position, referred to by patch constant function, is not found in corresponding hull shader output."));
  5007. }
  5008. TEST_F(CompilerTest, ViewID) {
  5009. if (m_ver.SkipDxilVersion(1,1)) return;
  5010. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid01.hlsl");
  5011. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid02.hlsl");
  5012. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid03.hlsl");
  5013. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid04.hlsl");
  5014. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid05.hlsl");
  5015. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid06.hlsl");
  5016. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid07.hlsl");
  5017. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid08.hlsl");
  5018. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid09.hlsl");
  5019. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid10.hlsl");
  5020. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid11.hlsl");
  5021. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid12.hlsl");
  5022. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid13.hlsl");
  5023. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid14.hlsl");
  5024. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid15.hlsl");
  5025. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid16.hlsl");
  5026. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid17.hlsl");
  5027. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid18.hlsl");
  5028. CodeGenTestCheck(L"..\\CodeGenHLSL\\viewid\\viewid19.hlsl");
  5029. }
  5030. TEST_F(CompilerTest, ShaderCompatSuite) {
  5031. using namespace WEX::TestExecution;
  5032. std::wstring suitePath = L"..\\CodeGenHLSL\\shader-compat-suite";
  5033. WEX::Common::String value;
  5034. if (!DXC_FAILED(RuntimeParameters::TryGetValue(L"SuitePath", value)))
  5035. {
  5036. suitePath = value;
  5037. }
  5038. CodeGenTestCheckBatchDir(suitePath);
  5039. }
  5040. TEST_F(CompilerTest, QuickTest) {
  5041. CodeGenTestCheckBatchDir(L"..\\CodeGenHLSL\\quick-test");
  5042. }
  5043. TEST_F(CompilerTest, QuickLlTest) {
  5044. CodeGenTestCheckBatchDir(L"..\\CodeGenHLSL\\quick-ll-test");
  5045. }
  5046. TEST_F(CompilerTest, SingleFileCheckTest) {
  5047. using namespace llvm;
  5048. using namespace WEX::TestExecution;
  5049. WEX::Common::String value;
  5050. VERIFY_SUCCEEDED(RuntimeParameters::TryGetValue(L"InputFile", value));
  5051. std::wstring filename = value;
  5052. CW2A pUtf8Filename(filename.c_str());
  5053. if (!llvm::sys::path::is_absolute(pUtf8Filename.m_psz)) {
  5054. filename = hlsl_test::GetPathToHlslDataFile(filename.c_str());
  5055. }
  5056. CodeGenTestCheckBatch(filename.c_str(), 0);
  5057. }