hcttestcmds.cmd 19 KB

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