CompilerTest.cpp 188 KB

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