CompilerTest.cpp 185 KB

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