CompilerTest.cpp 193 KB

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