CompilerTest.cpp 199 KB

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