CompilerTest.cpp 205 KB

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