CompilerTest.cpp 194 KB

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