hcttestcmds.cmd 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /HV 2016 1>nul
  140. if %errorlevel% neq 0 (
  141. echo Failed to compile with HLSL version 2016
  142. call :cleanup 2>nul
  143. exit /b 1
  144. )
  145. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /HV 2015 2>nul
  146. if %errorlevel% equ 0 (
  147. echo Unsupported HLSL version 2015 should fail but did not fail
  148. call :cleanup 2>nul
  149. exit /b 1
  150. )
  151. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fo smoke.cso 1> nul
  152. if %errorlevel% neq 0 (
  153. echo Failed to compile to binary object from %CD%\smoke.hlsl
  154. call :cleanup 2>nul
  155. exit /b 1
  156. )
  157. dxc.exe /T ps_6_0 %script_dir%\smoke.hlsl /Zi /Fo smoke.cso /Cc /Ni /No /Lx 1> nul
  158. if %errorlevel% neq 0 (
  159. echo Failed to compile to binary object from %script_dir%\smoke.hlsl with disassembly options
  160. call :cleanup 2>nul
  161. exit /b 1
  162. )
  163. dxc.exe -dumpbin smoke.cso 1> nul
  164. if %errorlevel% neq 0 (
  165. echo Failed to disassemble binary object from %CD%\smoke.hlsl
  166. call :cleanup 2>nul
  167. exit /b 1
  168. )
  169. dxc.exe smoke.cso /recompile 1>nul
  170. if %errorlevel% neq 0 (
  171. echo Failed to recompile binary object compiled from %CD%\smoke.hlsl
  172. call :cleanup 2>nul
  173. exit /b 1
  174. )
  175. dxc.exe smoke.cso /recompile /T ps_6_0 /E main 1>nul
  176. if %errorlevel% neq 0 (
  177. echo Failed to recompile binary object with target ps_6_0 from %CD%\smoke.hlsl
  178. call :cleanup 2>nul
  179. exit /b 1
  180. )
  181. dxc.exe %script_dir%\smoke.hlsl /D "semantic = SV_Position" /T vs_6_0 /Zi /DDX12 /Fo smoke.cso 1> nul
  182. if %errorlevel% neq 0 (
  183. echo Failed to compile %script_dir%\smoke.hlsl with command line defines
  184. call :cleanup 2>nul
  185. exit /b 1
  186. )
  187. dxc.exe smoke.cso /recompile 1> nul
  188. if %errorlevel% neq 0 (
  189. echo Failed to recompile smoke.cso with command line defines
  190. call :cleanup 2>nul
  191. exit /b 1
  192. )
  193. dxc.exe smoke.cso /dumpbin /Qstrip_debug /Fo nodebug.cso 1>nul
  194. if %errorlevel% neq 0 (
  195. echo Failed to strip debug part from DXIL container blob
  196. call :cleanup 2>nul
  197. exit /b 1
  198. )
  199. dxc.exe smoke.cso /dumpbin /Qstrip_rootsignature /Fo norootsignature.cso 1>nul
  200. if %errorlevel% neq 0 (
  201. echo Failed to strip rootsignature from DXIL container blob
  202. call :cleanup 2>nul
  203. exit /b 1
  204. )
  205. dxc.exe smoke.cso /dumpbin /extractrootsignature /Fo rootsig.cso 1>nul
  206. if %errorlevel% neq 0 (
  207. echo Failed to extract rootsignature from DXIL container blob
  208. call :cleanup 2>nul
  209. exit /b 1
  210. )
  211. dxc.exe norootsignature.cso /dumpbin /setrootsignature rootsig.cso /Fo smoke.cso 1>nul
  212. if %errorlevel% neq 0 (
  213. echo Failed to setrootsignature to DXIL conatiner with no root signature
  214. call :cleanup 2>nul
  215. exit /b 1
  216. )
  217. dxc.exe "%2"\..\CodeGenHLSL\NonUniform.hlsl /T ps_6_0 /DDX12 /Fo NonUniform.cso 1>nul
  218. if %errorlevel% neq 0 (
  219. echo Failed to compile NonUniform.hlsl
  220. call :cleanup 2>nul
  221. exit /b 1
  222. )
  223. dxc.exe NonUniform.cso /dumpbin /Qstrip_rootsignature /Fo NonUniformNoRootSig.cso 1>nul
  224. if %errorlevel% neq 0 (
  225. echo Failed to strip rootsignature from DXIL container blob for NonUniform.cso
  226. call :cleanup 2>nul
  227. exit /b 1
  228. )
  229. dxc.exe NonUniform.cso /dumpbin /extractrootsignature /Fo NonUniformRootSig.cso 1>nul
  230. if %errorlevel% neq 0 (
  231. echo Failed to extract rootsignature from DXIL container blob for NonUniform.cso
  232. call :cleanup 2>nul
  233. exit /b 1
  234. )
  235. dxc.exe smoke.cso /dumpbin /verifyrootsignature rootsig.cso 1>nul
  236. if %errorlevel% neq 0 (
  237. echo Failed to verify root signature for somke.cso
  238. call :cleanup 2>nul
  239. exit /b 1
  240. )
  241. dxc.exe norootsignature.cso /dumpbin /verifyrootsignature rootsig.cso 1>nul
  242. if %errorlevel% neq 0 (
  243. echo Failed to verify root signature for smoke.cso without root signature
  244. call :cleanup 2>nul
  245. exit /b 1
  246. )
  247. dxc.exe NonUniform.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso 1>nul
  248. if %errorlevel% neq 0 (
  249. echo Failed to verify root signature for NonUniform.cso
  250. call :cleanup 2>nul
  251. exit /b 1
  252. )
  253. dxc.exe NonUniformNoRootSig.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso 1>nul
  254. if %errorlevel% neq 0 (
  255. echo Failed to verify root signature for somke1.cso without root signature
  256. call :cleanup 2>nul
  257. exit /b 1
  258. )
  259. dxc.exe NonUniformNoRootSig.cso /dumpbin /verifyrootsignature rootsig.cso 2>nul
  260. if %errorlevel% equ 0 (
  261. echo Verifying invalid root signature for NonUniformNoRootSig.cso should fail but passed
  262. call :cleanup 2>nul
  263. exit /b 1
  264. )
  265. dxc.exe norootsignature.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso 2>nul
  266. if %errorlevel% equ 0 (
  267. echo Verifying invalid root signature for norootsignature.cso should fail but passed
  268. call :cleanup 2>nul
  269. exit /b 1
  270. )
  271. dxc.exe smoke.cso /dumpbin /setrootsignature rootsig.cso /Fo smoke.cso 1>nul
  272. if %errorlevel% neq 0 (
  273. echo Failed to setrootsignature to DXIL container that already contains root signature
  274. call :cleanup 2>nul
  275. exit /b 1
  276. )
  277. dxc.exe smoke.cso /dumpbin /setrootsignature NonUniformRootSig.cso /Fo smoke.cso 2>nul
  278. if %errorlevel% equ 0 (
  279. echo setrootsignature of invalid root signature should fail but passed
  280. call :cleanup 2>nul
  281. exit /b 1
  282. )
  283. dxc.exe %2\..\CodeGenHLSL\Samples\MiniEngine\TextVS.hlsl /Tvs_6_0 /Zi /Fo TextVS.cso 1>nul
  284. if %errorlevel% neq 0 (
  285. echo failed to compile %2\..\CodeGenHLSL\Samples\MiniEngine\TextVS.hlsl
  286. call :cleanup 2>nul
  287. exit /b 1
  288. )
  289. dxc.exe smoke.cso /dumpbin /verifyrootsignature TextVS.cso 1>nul
  290. if %errorlevel% neq 0 (
  291. echo Verifying valid replacement of root signature failed
  292. call :cleanup 2>nul
  293. exit /b 1
  294. )
  295. echo private data > private.txt
  296. dxc.exe smoke.cso /dumpbin /setprivate private.txt /Fo private.cso 1>nul
  297. if %errorlevel% neq 0 (
  298. echo Failed to set private data to DXIL container with no private data
  299. call :cleanup 2>nul
  300. exit /b 1
  301. )
  302. dxc.exe private.cso /dumpbin /setprivate private.txt /Fo private.cso 1>nul
  303. if %errorlevel% neq 0 (
  304. echo Failed to set private data to DXIL container that already contains private data
  305. call :cleanup 2>nul
  306. exit /b 1
  307. )
  308. dxc.exe private.cso /dumpbin /Qstrip_priv /Fo noprivate.cso 1>nul
  309. if %errorlevel% neq 0 (
  310. echo Failed to strip private data from DXIL container blob
  311. call :cleanup 2>nul
  312. exit /b 1
  313. )
  314. dxc.exe private.cso /dumpbin /getprivate private1.txt 1>nul
  315. if %errorlevel% neq 0 (
  316. echo Failed to get private data from DXIL container blob
  317. call :cleanup 2>nul
  318. exit /b 1
  319. )
  320. findstr "private data" %CD%\private1.txt 1>nul
  321. if %errorlevel% neq 0 (
  322. echo Failed to get private data content from DXIL container blob
  323. call :cleanup 2>nul
  324. exit /b 1
  325. )
  326. FC smoke.cso noprivate.cso 1>nul
  327. if %errorlevel% neq 0 (
  328. echo Appending and removing blob roundtrip failed.
  329. call :cleanup 2>nul
  330. exit /b 1
  331. )
  332. dxc.exe private.cso /dumpbin /Qstrip_priv /Qstrip_debug /Qstrip_rootsignature /Fo noprivdebugroot.cso 1>nul
  333. if %errorlevel% neq 0 (
  334. echo Failed to extract multiple parts from DXIL container blob
  335. call :cleanup 2>nul
  336. exit /b 1
  337. )
  338. echo Smoke test for dxc.exe shader model upgrade...
  339. dxc.exe /T ps_5_0 %script_dir%\smoke.hlsl 1> nul
  340. if %errorlevel% neq 0 (
  341. echo Failed shader model upgrade test - %CD%\dxc.exe /T ps_5_0 %CD%\smoke.hlsl
  342. call :cleanup 2>nul
  343. exit /b 1
  344. )
  345. dxc.exe -dumpbin smoke.cso > smoke.ll
  346. if %errorlevel% neq 0 (
  347. echo Failed to dumpbin from blob.
  348. call :cleanup 2>nul
  349. exit /b 1
  350. )
  351. echo Smoke test for dxa command line program ...
  352. dxa.exe smoke.cso -listfiles 1> nul
  353. if %errorlevel% neq 0 (
  354. echo Failed to list files from blob
  355. call :cleanup 2>nul
  356. exit /b 1
  357. )
  358. dxa.exe smoke.cso -listparts 1> nul
  359. if %errorlevel% neq 0 (
  360. echo Failed to list parts from blob
  361. call :cleanup 2>nul
  362. exit /b 1
  363. )
  364. dxa.exe smoke.cso -extractpart dbgmodule -o smoke.cso.ll 1>nul
  365. if %errorlevel% neq 0 (
  366. echo Failed to extract DXIL part from the blob generated by %CD%\smoke.hlsl
  367. call :cleanup 2>nul
  368. exit /b 1
  369. )
  370. dxa.exe smoke.cso.ll -listfiles 1> nul
  371. if %errorlevel% neq 0 (
  372. echo Failed to list files from Dxil part with Dxil with Debug Info
  373. call :cleanup 2>nul
  374. exit /b 1
  375. )
  376. dxa.exe smoke.cso.ll -extractfile * 1> nul
  377. if %errorlevel% neq 0 (
  378. echo Failed to extract files from Dxil part with Dxil with Debug Info
  379. call :cleanup 2>nul
  380. exit /b 1
  381. )
  382. dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc 1>nul
  383. if %errorlevel% neq 0 (
  384. echo Failed to extract plain module via dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc
  385. call :cleanup 2>nul
  386. exit /b 1
  387. )
  388. dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso 1>nul
  389. if %errorlevel% neq 0 (
  390. echo Failed to rebuild container from plain module via dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso
  391. call :cleanup 2>nul
  392. exit /b 1
  393. )
  394. dxa.exe smoke.ll -o smoke.rebuilt-container2.cso 1>nul
  395. if %errorlevel% neq 0 (
  396. echo Failed to rebuild container from plain module via dxa.exe smoke.ll -o smoke.rebuilt-container2.cso
  397. call :cleanup 2>nul
  398. exit /b 1
  399. )
  400. echo Smoke test for dxopt command line ...
  401. dxc /Odump /T ps_6_0 %script_dir%\smoke.hlsl > passes.txt
  402. if %errorlevel% neq 0 (
  403. echo Failed to /ODump
  404. call :cleanup 2>nul
  405. exit /b 1
  406. )
  407. findstr emit passes.txt 1>nul
  408. if %errorlevel% neq 0 (
  409. echo Failed to find an emit in the default pass configuration.
  410. call :cleanup 2>nul
  411. exit /b 1
  412. )
  413. echo -print-module >> passes.txt
  414. dxc /T ps_6_0 %script_dir%\smoke.hlsl /fcgl > smoke.hl.txt
  415. if %errorlevel% neq 0 (
  416. echo Failed to do a high-level codegen.
  417. call :cleanup 2>nul
  418. exit /b 1
  419. )
  420. dxopt -pf passes.txt -o=smoke.opt.ll smoke.hl.txt >smoke.opt.prn.txt
  421. if %errorlevel% neq 0 (
  422. echo Failed to run the optimizer with default passes.
  423. call :cleanup 2>nul
  424. exit /b 1
  425. )
  426. findstr MODULE-PRINT smoke.opt.prn.txt 1>nul
  427. if %errorlevel% neq 0 (
  428. echo Failed to find the MODULE-PRINT log in the dxcopt output.
  429. call :cleanup 2>nul
  430. exit /b 1
  431. )
  432. echo Smoke test for dxc_batch command line ...
  433. dxc_batch.exe -lib-link -multi-thread "%2"\..\CodeGenHLSL\batch_cmds2.txt 1>nul
  434. if %errorlevel% neq 0 (
  435. echo Failed to run dxc_batch -lib-link -multi-thread %2\..\CodeGenHLSL\batch_cmds2.txt
  436. call :cleanup 2>nul
  437. exit /b 1
  438. )
  439. dxc_batch.exe -lib-link -multi-thread "%2"\..\CodeGenHLSL\batch_cmds.txt 1>nul
  440. if %errorlevel% neq 0 (
  441. echo Failed to run dxc_batch -lib-link -multi-thread %2\..\CodeGenHLSL\batch_cmds.txt
  442. call :cleanup 2>nul
  443. exit /b 1
  444. )
  445. dxc_batch.exe -multi-thread "%2"\..\CodeGenHLSL\batch_cmds.txt 1>nul
  446. if %errorlevel% neq 0 (
  447. echo Failed to run dxc_batch -multi-thread %2\..\CodeGenHLSL\batch_cmds.txt
  448. call :cleanup 2>nul
  449. exit /b 1
  450. )
  451. echo Smoke test for dxl command line ...
  452. dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_entry4.hlsl -Fo lib_entry4.dxbc 1>nul
  453. if %errorlevel% neq 0 (
  454. echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_entry4.hlsl -Fo lib_entry4.dxbc
  455. call :cleanup 2>nul
  456. exit /b 1
  457. )
  458. dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_res_match.hlsl -Fo lib_res_match.dxbc 1>nul
  459. if %errorlevel% neq 0 (
  460. echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_res_match.hlsl -Fo lib_res_match.dxbc
  461. call :cleanup 2>nul
  462. exit /b 1
  463. )
  464. dxl.exe -T ps_6_0 lib_res_match.dxbc;lib_entry4.dxbc -Fo res_match_entry.dxbc 1>nul
  465. if %errorlevel% neq 0 (
  466. echo Failed to run dxl.exe -T ps_6_0 lib_res_match.dxbc;lib_entry4.dxbc -Fo res_match_entry.dxbc
  467. call :cleanup 2>nul
  468. exit /b 1
  469. )
  470. echo Test for denorm options ...
  471. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm preserve 1>nul
  472. if %errorlevel% neq 0 (
  473. echo Failed to compile %script_dir%\smoke.hlsl with /denorm ieee option
  474. call :cleanup 2>nul
  475. exit /b 1
  476. )
  477. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm ftz 1>nul
  478. if %errorlevel% neq 0 (
  479. echo Failed to compile %script_dir%\smoke.hlsl with /denorm ftz option
  480. call :cleanup 2>nul
  481. exit /b 1
  482. )
  483. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /denorm abc 2>nul
  484. if %errorlevel% equ 0 (
  485. echo dxc incorrectly compiled %script_dir%\smoke.hlsl with invalid /denorm option
  486. call :cleanup 2>nul
  487. exit /b 1
  488. )
  489. dxc.exe %script_dir%\smoke.hlsl /Tps_6_1 /denorm any 2>nul
  490. if %errorlevel% equ 0 (
  491. echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.1 with /denorm option
  492. call :cleanup 2>nul
  493. exit /b 1
  494. )
  495. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /enable-16bit-types 1>nul
  496. if %errorlevel% neq 0 (
  497. echo Failed to compile %script_dir%\smoke.hlsl with /enable-16bit-types option
  498. call :cleanup 2>nul
  499. exit /b 1
  500. )
  501. dxc.exe %script_dir%\smoke.hlsl /Tps_6_1 /enable-16bit-types 2>nul
  502. if %errorlevel% equ 0 (
  503. echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.1 with /enable-16bit-types option
  504. call :cleanup 2>nul
  505. exit /b 1
  506. )
  507. dxc.exe %script_dir%\smoke.hlsl /Tps_6_2 /enable-16bit-types /HV 2017 2>nul
  508. if %errorlevel% equ 0 (
  509. echo dxc incorrectly compiled %script_dir%\smoke.hlsl shader model 6.2 with /enable-16bit-types and /HV 2017 option
  510. call :cleanup 2>nul
  511. exit /b 1
  512. )
  513. echo Test file with relative path and include
  514. mkdir subfolder 2>nul
  515. mkdir inc 2>nul
  516. copy "%2"\include-main.hlsl subfolder >nul
  517. copy "%2"\include-declarations.h inc >nul
  518. dxc.exe -Tps_6_0 -I inc subfolder\include-main.hlsl >nul
  519. if %errorlevel% neq 0 (
  520. echo Failed to compile subfolder\include-main.hlsl
  521. call :cleanup 2>nul
  522. exit /b 1
  523. )
  524. rem SPIR-V Change Starts
  525. echo Smoke test for SPIR-V CodeGen ...
  526. set spirv_smoke_success=0
  527. dxc.exe %script_dir%\smoke.hlsl /T ps_6_0 -spirv 1>%CD%\smoke.spirv.log 2>&1
  528. if %errorlevel% equ 0 set spirv_smoke_success=1
  529. findstr /c:"SPIR-V CodeGen not available" %CD%\smoke.spirv.log >nul
  530. if %errorlevel% equ 0 set spirv_smoke_success=1
  531. if %spirv_smoke_success% neq 1 (
  532. echo dxc failed SPIR-V smoke test
  533. call :cleanup 2>nul
  534. exit /b 1
  535. )
  536. rem SPIR-V Change Ends
  537. call :cleanup
  538. exit /b 0
  539. :cleanup
  540. del %CD%\*.lld
  541. del %CD%\NonUniform.cso
  542. del %CD%\NonUniformNoRootSig.cso
  543. del %CD%\NonUniformRootSig.cso
  544. del %CD%\TextVS.cso
  545. del %CD%\nodebug.cso
  546. del %CD%\noprivate.cso
  547. del %CD%\noprivdebugroot.cso
  548. del %CD%\norootsignature.cso
  549. del %CD%\passes.txt
  550. del %CD%\preprocessed.hlsl
  551. del %CD%\private.cso
  552. del %CD%\private.txt
  553. del %CD%\private1.txt
  554. del %CD%\rootsig.cso
  555. del %CD%\smoke.cso
  556. del %CD%\smoke.cso.ll
  557. del %CD%\smoke.cso.plain.bc
  558. del %CD%\smoke.hl.txt
  559. del %CD%\smoke.hlsl.c
  560. del %CD%\smoke.hlsl.d
  561. del %CD%\smoke.hlsl.e
  562. del %CD%\smoke.hlsl.h
  563. del %CD%\smoke.hlsl.strip
  564. del %CD%\smoke.ll
  565. del %CD%\smoke.opt.ll
  566. del %CD%\smoke.opt.prn.txt
  567. del %CD%\smoke.rebuilt-container.cso
  568. del %CD%\smoke.rebuilt-container2.cso
  569. rem SPIR-V Change Starts
  570. del %CD%\smoke.spirv.log
  571. rem SPIR-V Change Ends
  572. del %CD%\lib_res_match.dxbc
  573. del %CD%\lib_entry4.dxbc
  574. del %CD%\res_match_entry.dxbc
  575. exit /b 0