CompilerTest.cpp 192 KB

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