hcttestcmds.cmd 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. @echo off
  2. if "%1"=="" (
  3. echo First argument to hcttestcmds should be directory with command-line tools.
  4. exit /b 1
  5. )
  6. if "%2"=="" (
  7. echo Second argument to hcttestcmds should be the absolute path to tools\clang\test\HLSL
  8. exit /b 1
  9. )
  10. echo Testing command line programs at %1 ...
  11. setlocal
  12. set script_dir=%~dp0
  13. pushd %1
  14. echo Smoke test for dxr command line program ...
  15. dxr.exe -remove-unused-globals %script_dir%\smoke.hlsl -Emain 1>nul 2>nul
  16. if %errorlevel% neq 0 (
  17. echo Failed - %CD%\dxr.exe -remove-unused-globals %script_dir%\smoke.hlsl -Emain
  18. call :cleanup 2>nul
  19. exit /b 1
  20. )
  21. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fc smoke.hlsl.c 1>nul
  22. if %errorlevel% neq 0 (
  23. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fc %CD%\smoke.hlsl.c
  24. call :cleanup 2>nul
  25. exit /b 1
  26. )
  27. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd smoke.hlsl.d 1>nul
  28. if %errorlevel% neq 0 (
  29. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd %CD%\smoke.hlsl.d
  30. call :cleanup 2>nul
  31. exit /b 1
  32. )
  33. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd %CD%\ /Fo smoke.hlsl.strip 1>nul
  34. if %errorlevel% neq 0 (
  35. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fd %CD%\
  36. call :cleanup 2>nul
  37. exit /b 1
  38. )
  39. rem .lld file should be produced
  40. dir %CD%\*.lld 1>nul
  41. if %errorlevel% neq 0 (
  42. echo Failed to find some .lld file at %CD%
  43. call :cleanup 2>nul
  44. exit /b 1
  45. )
  46. rem /Fd with trailing backslash implies /Qstrip_debug
  47. dxc.exe -dumpbin smoke.hlsl.strip | findstr "shader debug name" 1>nul
  48. if %errorlevel% neq 0 (
  49. echo Failed to find shader debug name.
  50. call :cleanup 2>nul
  51. exit /b 1
  52. )
  53. dxc.exe -dumpbin smoke.hlsl.strip | findstr "DICompileUnit" 1>nul
  54. if %errorlevel% equ 0 (
  55. echo Found DICompileUnit after implied strip.
  56. call :cleanup 2>nul
  57. exit /b 1
  58. )
  59. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fe smoke.hlsl.e 1>nul
  60. if %errorlevel% neq 0 (
  61. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fe %CD%\smoke.hlsl.e
  62. call :cleanup 2>nul
  63. exit /b 1
  64. )
  65. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /ast-dump 1>nul
  66. if %errorlevel% neq 0 (
  67. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /ast-dump
  68. call :cleanup 2>nul
  69. exit /b 1
  70. )
  71. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning 1>nul 2>smoke.warning.txt
  72. if %errorlevel% neq 0 (
  73. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning
  74. call :cleanup 2>nul
  75. exit /b 1
  76. )
  77. findstr warning: %CD%\smoke.warning.txt 1>nul
  78. if %errorlevel% neq 0 (
  79. echo Failed to get warning message from command %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning
  80. call :cleanup 2>nul
  81. exit /b 1
  82. )
  83. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning /no-warnings 1>nul 2>smoke.no.warning.txt
  84. if %errorlevel% neq 0 (
  85. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning /no-warnings
  86. call :cleanup 2>nul
  87. exit /b 1
  88. )
  89. findstr warning: %CD%\smoke.no.warning.txt 1>nul
  90. if %errorlevel% equ 0 (
  91. echo no-warning option failed : %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Dcheck_warning /no-warnings
  92. call :cleanup 2>nul
  93. exit /b 1
  94. )
  95. echo Smoke test for dxc command line program ...
  96. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fh smoke.hlsl.h /Vn g_myvar 1> nul
  97. if %errorlevel% neq 0 (
  98. echo Failed - %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fh %CD%\smoke.hlsl.h /Vn g_myvar
  99. call :cleanup 2>nul
  100. exit /b 1
  101. )
  102. findstr g_myvar %CD%\smoke.hlsl.h 1>nul
  103. if %errorlevel% neq 0 (
  104. echo Failed to find the variable g_myvar in %CD%\smoke.hlsl.h
  105. echo Debug with start devenv /debugexe %CD%\dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Fh %CD%\smoke.hlsl.h /Vn g_myvar
  106. call :cleanup 2>nul
  107. exit /b 1
  108. )
  109. findstr "0x44, 0x58" %CD%\smoke.hlsl.h 1>nul
  110. if %errorlevel% neq 0 (
  111. echo Failed to find the bytecode for DXBC container in %CD%\smoke.hlsl.h
  112. call :cleanup 2>nul
  113. exit /b 1
  114. )
  115. dxc.exe %script_dir%\smoke.hlsl /P preprocessed.hlsl 1>nul
  116. if %errorlevel% neq 0 (
  117. echo Failed to preprocess smoke.hlsl
  118. call :cleanup 2>nul
  119. exit /b 1
  120. )
  121. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl -force_rootsig_ver rootsig_1_0 1>nul
  122. if %errorlevel% neq 0 (
  123. echo Failed to compile with forcing rootsignature rootsig_1_0
  124. call :cleanup 2>nul
  125. exit /b 1
  126. )
  127. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl -force_rootsig_ver rootsig_1_1 1>nul
  128. if %errorlevel% neq 0 (
  129. echo Failed to compile with forcing rootsignature rootsig_1_1
  130. call :cleanup 2>nul
  131. exit /b 1
  132. )
  133. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl -force_rootsig_ver rootsig_2_0 2>nul
  134. if %errorlevel% equ 0 (
  135. echo rootsig_2_0 is not supported but compilation passed
  136. call :cleanup 2>nul
  137. exit /b 1
  138. )
  139. echo #define main "CBV(b0)"> test-global-rs.hlsl
  140. dxc -T rootsig_1_1 test-global-rs.hlsl -rootsig-define main -Fo test-global-rs.cso 1>nul
  141. if %errorlevel% neq 0 (
  142. echo Failed to compile rootsig_1_1 from define
  143. call :cleanup 2>nul
  144. exit /b 1
  145. )
  146. echo #define main "CBV(b0), RootFlags(LOCAL_ROOT_SIGNATURE)"> test-local-rs.hlsl
  147. dxc -T rootsig_1_1 test-local-rs.hlsl -rootsig-define main -Fo test-local-rs.cso 1>nul
  148. if %errorlevel% neq 0 (
  149. echo Failed to compile rootsig_1_1 from define with LOCAL_ROOT_SIGNATURE
  150. call :cleanup 2>nul
  151. exit /b 1
  152. )
  153. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /HV 2016 1>nul
  154. if %errorlevel% neq 0 (
  155. echo Failed to compile with HLSL version 2016
  156. call :cleanup 2>nul
  157. exit /b 1
  158. )
  159. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /HV 2015 2>nul
  160. if %errorlevel% equ 0 (
  161. echo Unsupported HLSL version 2015 should fail but did not fail
  162. call :cleanup 2>nul
  163. exit /b 1
  164. )
  165. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fo smoke.cso 1> nul
  166. if %errorlevel% neq 0 (
  167. echo Failed to compile to binary object from %CD%\smoke.hlsl
  168. call :cleanup 2>nul
  169. exit /b 1
  170. )
  171. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fo smoke.cso /Cc /Ni /No /Lx 1> nul
  172. if %errorlevel% neq 0 (
  173. echo Failed to compile to binary object from %script_dir%\smoke.hlsl with disassembly options
  174. call :cleanup 2>nul
  175. exit /b 1
  176. )
  177. dxc.exe -dumpbin smoke.cso 1> nul
  178. if %errorlevel% neq 0 (
  179. echo Failed to disassemble binary object from %CD%\smoke.hlsl
  180. call :cleanup 2>nul
  181. exit /b 1
  182. )
  183. dxc.exe smoke.cso /recompile 1>nul
  184. if %errorlevel% neq 0 (
  185. echo Failed to recompile binary object compiled from %CD%\smoke.hlsl
  186. call :cleanup 2>nul
  187. exit /b 1
  188. )
  189. dxc.exe smoke.cso /recompile /T ps_6_0 /E main 1>nul
  190. if %errorlevel% neq 0 (
  191. echo Failed to recompile binary object with target ps_6_0 from %CD%\smoke.hlsl
  192. call :cleanup 2>nul
  193. exit /b 1
  194. )
  195. dxc.exe %script_dir%\smoke.hlsl /D "semantic = SV_Position" /T vs_6_0 /Zi /DDX12 /Fo smoke.cso 1> nul
  196. if %errorlevel% neq 0 (
  197. echo Failed to compile %script_dir%\smoke.hlsl with command line defines
  198. call :cleanup 2>nul
  199. exit /b 1
  200. )
  201. dxc.exe smoke.cso /recompile 1> nul
  202. if %errorlevel% neq 0 (
  203. echo Failed to recompile smoke.cso with command line defines
  204. call :cleanup 2>nul
  205. exit /b 1
  206. )
  207. dxc.exe smoke.cso /dumpbin /Qstrip_debug /Fo nodebug.cso 1>nul
  208. if %errorlevel% neq 0 (
  209. echo Failed to strip debug part from DXIL container blob
  210. call :cleanup 2>nul
  211. exit /b 1
  212. )
  213. dxc.exe smoke.cso /dumpbin /Qstrip_rootsignature /Fo norootsignature.cso 1>nul
  214. if %errorlevel% neq 0 (
  215. echo Failed to strip rootsignature from DXIL container blob
  216. call :cleanup 2>nul
  217. exit /b 1
  218. )
  219. dxc.exe smoke.cso /dumpbin /extractrootsignature /Fo rootsig.cso 1>nul
  220. if %errorlevel% neq 0 (
  221. echo Failed to extract rootsignature from DXIL container blob
  222. call :cleanup 2>nul
  223. exit /b 1
  224. )
  225. dxc.exe norootsignature.cso /dumpbin /setrootsignature rootsig.cso /Fo smoke.cso 1>nul
  226. if %errorlevel% neq 0 (
  227. echo Failed to setrootsignature to DXIL conatiner with no root signature
  228. call :cleanup 2>nul
  229. exit /b 1
  230. )
  231. dxc.exe "%2"\..\CodeGenHLSL\NonUniform.hlsl /T ps_6_0 /DDX12 /Fo NonUniform.cso 1>nul
  232. if %errorlevel% neq 0 (
  233. echo Failed to compile NonUniform.hlsl
  234. call :cleanup 2>nul
  235. exit /b 1
  236. )
  237. dxc.exe NonUniform.cso /dumpbin /Qstrip_rootsignature /Fo NonUniformNoRootSig.cso 1>nul
  238. if %errorlevel% neq 0 (
  239. echo Failed to strip rootsignature from DXIL container blob for NonUniform.cso
  240. call :cleanup 2>nul
  241. exit /b 1
  242. )
  243. dxc.exe NonUniform.cso /dumpbin /extractrootsignature /Fo NonUniformRootSig.cso 1>nul
  244. if %errorlevel% neq 0 (
  245. echo Failed to extract rootsignature from DXIL container blob for NonUniform.cso
  246. call :cleanup 2>nul
  247. exit /b 1
  248. )
  249. dxc.exe smoke.cso /dumpbin /verifyrootsignature rootsig.cso 1>nul
  250. if %errorlevel% neq 0 (
  251. echo Failed to verify root signature for somke.cso
  252. call :cleanup 2>nul
  253. exit /b 1
  254. )
  255. dxc.exe norootsignature.cso /dumpbin /verifyrootsignature rootsig.cso 1>nul
  256. if %errorlevel% neq 0 (
  257. echo Failed to verify root signature for smoke.cso without root signature
  258. call :cleanup 2>nul
  259. exit /b 1
  260. )
  261. dxc.exe NonUniform.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso 1>nul
  262. if %errorlevel% neq 0 (
  263. echo Failed to verify root signature for NonUniform.cso
  264. call :cleanup 2>nul
  265. exit /b 1
  266. )
  267. dxc.exe NonUniformNoRootSig.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso 1>nul
  268. if %errorlevel% neq 0 (
  269. echo Failed to verify root signature for somke1.cso without root signature
  270. call :cleanup 2>nul
  271. exit /b 1
  272. )
  273. dxc.exe NonUniformNoRootSig.cso /dumpbin /verifyrootsignature rootsig.cso 2>nul
  274. if %errorlevel% equ 0 (
  275. echo Verifying invalid root signature for NonUniformNoRootSig.cso should fail but passed
  276. call :cleanup 2>nul
  277. exit /b 1
  278. )
  279. dxc.exe norootsignature.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso 2>nul
  280. if %errorlevel% equ 0 (
  281. echo Verifying invalid root signature for norootsignature.cso should fail but passed
  282. call :cleanup 2>nul
  283. exit /b 1
  284. )
  285. dxc.exe smoke.cso /dumpbin /setrootsignature rootsig.cso /Fo smoke.cso 1>nul
  286. if %errorlevel% neq 0 (
  287. echo Failed to setrootsignature to DXIL container that already contains root signature
  288. call :cleanup 2>nul
  289. exit /b 1
  290. )
  291. dxc.exe smoke.cso /dumpbin /setrootsignature NonUniformRootSig.cso /Fo smoke.cso 2>nul
  292. if %errorlevel% equ 0 (
  293. echo setrootsignature of invalid root signature should fail but passed
  294. call :cleanup 2>nul
  295. exit /b 1
  296. )
  297. dxc.exe %2\..\CodeGenHLSL\Samples\MiniEngine\TextVS.hlsl /Tvs_6_0 /Zi /Fo TextVS.cso 1>nul
  298. if %errorlevel% neq 0 (
  299. echo failed to compile %2\..\CodeGenHLSL\Samples\MiniEngine\TextVS.hlsl
  300. call :cleanup 2>nul
  301. exit /b 1
  302. )
  303. dxc.exe smoke.cso /dumpbin /verifyrootsignature TextVS.cso 1>nul
  304. if %errorlevel% neq 0 (
  305. echo Verifying valid replacement of root signature failed
  306. call :cleanup 2>nul
  307. exit /b 1
  308. )
  309. echo private data > private.txt
  310. dxc.exe smoke.cso /dumpbin /setprivate private.txt /Fo private.cso 1>nul
  311. if %errorlevel% neq 0 (
  312. echo Failed to set private data to DXIL container with no private data
  313. call :cleanup 2>nul
  314. exit /b 1
  315. )
  316. dxc.exe private.cso /dumpbin /setprivate private.txt /Fo private.cso 1>nul
  317. if %errorlevel% neq 0 (
  318. echo Failed to set private data to DXIL container that already contains private data
  319. call :cleanup 2>nul
  320. exit /b 1
  321. )
  322. dxc.exe private.cso /dumpbin /Qstrip_priv /Fo noprivate.cso 1>nul
  323. if %errorlevel% neq 0 (
  324. echo Failed to strip private data from DXIL container blob
  325. call :cleanup 2>nul
  326. exit /b 1
  327. )
  328. dxc.exe private.cso /dumpbin /getprivate private1.txt 1>nul
  329. if %errorlevel% neq 0 (
  330. echo Failed to get private data from DXIL container blob
  331. call :cleanup 2>nul
  332. exit /b 1
  333. )
  334. findstr "private data" %CD%\private1.txt 1>nul
  335. if %errorlevel% neq 0 (
  336. echo Failed to get private data content from DXIL container blob
  337. call :cleanup 2>nul
  338. exit /b 1
  339. )
  340. FC smoke.cso noprivate.cso 1>nul
  341. if %errorlevel% neq 0 (
  342. echo Appending and removing blob roundtrip failed.
  343. call :cleanup 2>nul
  344. exit /b 1
  345. )
  346. dxc.exe private.cso /dumpbin /Qstrip_priv /Qstrip_debug /Qstrip_rootsignature /Fo noprivdebugroot.cso 1>nul
  347. if %errorlevel% neq 0 (
  348. echo Failed to extract multiple parts from DXIL container blob
  349. call :cleanup 2>nul
  350. exit /b 1
  351. )
  352. echo Smoke test for dxc.exe shader model upgrade...
  353. dxc.exe /T ps_5_0 %script_dir%\smoke.hlsl 1> nul
  354. if %errorlevel% neq 0 (
  355. echo Failed shader model upgrade test - %CD%\dxc.exe /T ps_5_0 %CD%\smoke.hlsl
  356. call :cleanup 2>nul
  357. exit /b 1
  358. )
  359. dxc.exe -dumpbin smoke.cso > smoke.ll
  360. if %errorlevel% neq 0 (
  361. echo Failed to dumpbin from blob.
  362. call :cleanup 2>nul
  363. exit /b 1
  364. )
  365. echo Smoke test for dxa command line program ...
  366. dxa.exe smoke.cso -listfiles 1> nul
  367. if %errorlevel% neq 0 (
  368. echo Failed to list files from blob
  369. call :cleanup 2>nul
  370. exit /b 1
  371. )
  372. dxa.exe smoke.cso -listparts 1> nul
  373. if %errorlevel% neq 0 (
  374. echo Failed to list parts from blob
  375. call :cleanup 2>nul
  376. exit /b 1
  377. )
  378. dxa.exe smoke.cso -extractpart dbgmodule -o smoke.cso.ll 1>nul
  379. if %errorlevel% neq 0 (
  380. echo Failed to extract DXIL part from the blob generated by %CD%\smoke.hlsl
  381. call :cleanup 2>nul
  382. exit /b 1
  383. )
  384. dxa.exe smoke.cso.ll -listfiles 1> nul
  385. if %errorlevel% neq 0 (
  386. echo Failed to list files from Dxil part with Dxil with Debug Info
  387. call :cleanup 2>nul
  388. exit /b 1
  389. )
  390. dxa.exe smoke.cso.ll -extractfile * 1> nul
  391. if %errorlevel% neq 0 (
  392. echo Failed to extract files from Dxil part with Dxil with Debug Info
  393. call :cleanup 2>nul
  394. exit /b 1
  395. )
  396. dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc 1>nul
  397. if %errorlevel% neq 0 (
  398. echo Failed to extract plain module via dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc
  399. call :cleanup 2>nul
  400. exit /b 1
  401. )
  402. dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso 1>nul
  403. if %errorlevel% neq 0 (
  404. echo Failed to rebuild container from plain module via dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso
  405. call :cleanup 2>nul
  406. exit /b 1
  407. )
  408. dxa.exe smoke.ll -o smoke.rebuilt-container2.cso 1>nul
  409. if %errorlevel% neq 0 (
  410. echo Failed to rebuild container from plain module via dxa.exe smoke.ll -o smoke.rebuilt-container2.cso
  411. call :cleanup 2>nul
  412. exit /b 1
  413. )
  414. echo Smoke test for dxopt command line ...
  415. dxc /Odump /T ps_6_0 %script_dir%\smoke.hlsl > passes.txt
  416. if %errorlevel% neq 0 (
  417. echo Failed to /ODump
  418. call :cleanup 2>nul
  419. exit /b 1
  420. )
  421. findstr emit passes.txt 1>nul
  422. if %errorlevel% neq 0 (
  423. echo Failed to find an emit in the default pass configuration.
  424. call :cleanup 2>nul
  425. exit /b 1
  426. )
  427. echo -print-module >> passes.txt
  428. dxc /T ps_6_0 %script_dir%\smoke.hlsl /fcgl > smoke.hl.txt
  429. if %errorlevel% neq 0 (
  430. echo Failed to do a high-level codegen.
  431. call :cleanup 2>nul
  432. exit /b 1
  433. )
  434. dxopt -pf passes.txt -o=smoke.opt.ll smoke.hl.txt >smoke.opt.prn.txt
  435. if %errorlevel% neq 0 (
  436. echo Failed to run the optimizer with default passes.
  437. call :cleanup 2>nul
  438. exit /b 1
  439. )
  440. findstr MODULE-PRINT smoke.opt.prn.txt 1>nul
  441. if %errorlevel% neq 0 (
  442. echo Failed to find the MODULE-PRINT log in the dxcopt output.
  443. call :cleanup 2>nul
  444. exit /b 1
  445. )
  446. echo Smoke test for dxc_batch command line ...
  447. dxc_batch.exe -lib-link -multi-thread "%2"\..\CodeGenHLSL\batch_cmds2.txt 1>nul
  448. if %errorlevel% neq 0 (
  449. echo Failed to run dxc_batch -lib-link -multi-thread %2\..\CodeGenHLSL\batch_cmds2.txt
  450. call :cleanup 2>nul
  451. exit /b 1
  452. )
  453. dxc_batch.exe -lib-link -multi-thread "%2"\..\CodeGenHLSL\batch_cmds.txt 1>nul
  454. if %errorlevel% neq 0 (
  455. echo Failed to run dxc_batch -lib-link -multi-thread %2\..\CodeGenHLSL\batch_cmds.txt
  456. call :cleanup 2>nul
  457. exit /b 1
  458. )
  459. dxc_batch.exe -multi-thread "%2"\..\CodeGenHLSL\batch_cmds.txt 1>nul
  460. if %errorlevel% neq 0 (
  461. echo Failed to run dxc_batch -multi-thread %2\..\CodeGenHLSL\batch_cmds.txt
  462. call :cleanup 2>nul
  463. exit /b 1
  464. )
  465. echo Smoke test for dxl command line ...
  466. dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_entry4.hlsl -Fo lib_entry4.dxbc 1>nul
  467. if %errorlevel% neq 0 (
  468. echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_entry4.hlsl -Fo lib_entry4.dxbc
  469. call :cleanup 2>nul
  470. exit /b 1
  471. )
  472. dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_res_match.hlsl -Fo lib_res_match.dxbc 1>nul
  473. if %errorlevel% neq 0 (
  474. echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_res_match.hlsl -Fo lib_res_match.dxbc
  475. call :cleanup 2>nul
  476. exit /b 1
  477. )
  478. dxl.exe -T ps_6_0 lib_res_match.dxbc;lib_entry4.dxbc -Fo res_match_entry.dxbc 1>nul
  479. if %errorlevel% neq 0 (
  480. echo Failed to run dxl.exe -T ps_6_0 lib_res_match.dxbc;lib_entry4.dxbc -Fo res_match_entry.dxbc
  481. call :cleanup 2>nul
  482. exit /b 1
  483. )
  484. echo Test for denorm options ...
  485. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm preserve 1>nul
  486. if %errorlevel% neq 0 (
  487. echo Failed to compile %script_dir%\smoke.hlsl with /denorm ieee option
  488. call :cleanup 2>nul
  489. exit /b 1
  490. )
  491. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm ftz 1>nul
  492. if %errorlevel% neq 0 (
  493. echo Failed to compile %script_dir%\smoke.hlsl with /denorm ftz option
  494. call :cleanup 2>nul
  495. exit /b 1
  496. )
  497. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm abc 2>nul
  498. if %errorlevel% equ 0 (
  499. echo dxc incorrectly compiled %script_dir%\smoke.hlsl with invalid /denorm option
  500. call :cleanup 2>nul
  501. exit /b 1
  502. )
  503. dxc.exe %script_dir%\smoke.hlsl /Tps_6_1 /denorm any 2>nul
  504. if %errorlevel% equ 0 (
  505. echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.1 with /denorm option
  506. call :cleanup 2>nul
  507. exit /b 1
  508. )
  509. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /enable-16bit-types 1>nul
  510. if %errorlevel% neq 0 (
  511. echo Failed to compile %script_dir%\smoke.hlsl with /enable-16bit-types option
  512. call :cleanup 2>nul
  513. exit /b 1
  514. )
  515. dxc.exe %script_dir%\smoke.hlsl /Tps_6_1 /enable-16bit-types 2>nul
  516. if %errorlevel% equ 0 (
  517. echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.1 with /enable-16bit-types option
  518. call :cleanup 2>nul
  519. exit /b 1
  520. )
  521. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /enable-16bit-types /HV 2017 2>nul
  522. if %errorlevel% equ 0 (
  523. echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.2 with /enable-16bit-types and /HV 2017 option
  524. call :cleanup 2>nul
  525. exit /b 1
  526. )
  527. echo Test file with relative path and include
  528. mkdir subfolder 2>nul
  529. mkdir inc 2>nul
  530. copy "%2"\include-main.hlsl subfolder >nul
  531. copy "%2"\include-declarations.h inc >nul
  532. dxc.exe -Tps_6_0 -I inc subfolder\include-main.hlsl >nul
  533. if %errorlevel% neq 0 (
  534. echo Failed to compile subfolder\include-main.hlsl
  535. call :cleanup 2>nul
  536. exit /b 1
  537. )
  538. dxc.exe -P include-main.hlsl.pp -I inc subfolder\include-main.hlsl >nul
  539. if %errorlevel% neq 0 (
  540. echo Failed to preprocess subfolder\include-main.hlsl
  541. call :cleanup 2>nul
  542. exit /b 1
  543. )
  544. rem SPIR-V Change Starts
  545. echo Smoke test for SPIR-V CodeGen ...
  546. set spirv_smoke_success=0
  547. dxc.exe %script_dir%\smoke.hlsl /T ps_6_0 -spirv 1>%CD%\smoke.spirv.log 2>&1
  548. if %errorlevel% equ 0 set spirv_smoke_success=1
  549. findstr /c:"SPIR-V CodeGen not available" %CD%\smoke.spirv.log >nul
  550. if %errorlevel% equ 0 set spirv_smoke_success=1
  551. if %spirv_smoke_success% neq 1 (
  552. echo dxc failed SPIR-V smoke test
  553. call :cleanup 2>nul
  554. exit /b 1
  555. )
  556. rem SPIR-V Change Ends
  557. call :cleanup
  558. exit /b 0
  559. :cleanup
  560. del %CD%\*.lld
  561. del %CD%\NonUniform.cso
  562. del %CD%\NonUniformNoRootSig.cso
  563. del %CD%\NonUniformRootSig.cso
  564. del %CD%\TextVS.cso
  565. del %CD%\nodebug.cso
  566. del %CD%\noprivate.cso
  567. del %CD%\noprivdebugroot.cso
  568. del %CD%\norootsignature.cso
  569. del %CD%\passes.txt
  570. del %CD%\preprocessed.hlsl
  571. del %CD%\private.cso
  572. del %CD%\private.txt
  573. del %CD%\private1.txt
  574. del %CD%\rootsig.cso
  575. del %CD%\smoke.cso
  576. del %CD%\smoke.cso.ll
  577. del %CD%\smoke.cso.plain.bc
  578. del %CD%\smoke.hl.txt
  579. del %CD%\smoke.hlsl.c
  580. del %CD%\smoke.hlsl.d
  581. del %CD%\smoke.hlsl.e
  582. del %CD%\smoke.hlsl.h
  583. del %CD%\smoke.hlsl.strip
  584. del %CD%\smoke.ll
  585. del %CD%\smoke.opt.ll
  586. del %CD%\smoke.opt.prn.txt
  587. del %CD%\smoke.rebuilt-container.cso
  588. del %CD%\smoke.rebuilt-container2.cso
  589. del %CD%\include-main.hlsl.pp
  590. rem SPIR-V Change Starts
  591. del %CD%\smoke.spirv.log
  592. rem SPIR-V Change Ends
  593. del %CD%\lib_res_match.dxbc
  594. del %CD%\lib_entry4.dxbc
  595. del %CD%\res_match_entry.dxbc
  596. del %CD%\test-global-rs.hlsl
  597. del %CD%\test-local-rs.hlsl
  598. del %CD%\test-global-rs.cso
  599. del %CD%\test-local-rs.cso
  600. exit /b 0