Hlsl.FromFile.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. //
  2. // Copyright (C) 2016 Google, Inc.
  3. // Copyright (C) 2016 LunarG, Inc.
  4. //
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions
  9. // are met:
  10. //
  11. // Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. //
  14. // Redistributions in binary form must reproduce the above
  15. // copyright notice, this list of conditions and the following
  16. // disclaimer in the documentation and/or other materials provided
  17. // with the distribution.
  18. //
  19. // Neither the name of Google Inc. nor the names of its
  20. // contributors may be used to endorse or promote products derived
  21. // from this software without specific prior written permission.
  22. //
  23. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  26. // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  27. // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  30. // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. // POSSIBILITY OF SUCH DAMAGE.
  35. #include <gtest/gtest.h>
  36. #include "TestFixture.h"
  37. namespace glslangtest {
  38. namespace {
  39. struct FileNameEntryPointPair {
  40. const char* fileName;
  41. const char* entryPoint;
  42. };
  43. // We are using FileNameEntryPointPair objects as parameters for instantiating
  44. // the template, so the global FileNameAsCustomTestSuffix() won't work since
  45. // it assumes std::string as parameters. Thus, an overriding one here.
  46. std::string FileNameAsCustomTestSuffix(
  47. const ::testing::TestParamInfo<FileNameEntryPointPair>& info) {
  48. std::string name = info.param.fileName;
  49. // A valid test case suffix cannot have '.' and '-' inside.
  50. std::replace(name.begin(), name.end(), '.', '_');
  51. std::replace(name.begin(), name.end(), '-', '_');
  52. return name;
  53. }
  54. using HlslCompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  55. using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  56. using HlslVulkan1_2CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  57. using HlslSpv1_6CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  58. using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  59. using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  60. using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  61. using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  62. using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  63. using HlslNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
  64. // Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
  65. // to successfully generate both AST and SPIR-V.
  66. TEST_P(HlslCompileTest, FromFile)
  67. {
  68. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  69. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  70. Target::BothASTAndSpv, true, GetParam().entryPoint);
  71. }
  72. TEST_P(HlslVulkan1_1CompileTest, FromFile)
  73. {
  74. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  75. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
  76. Target::BothASTAndSpv, true, GetParam().entryPoint);
  77. }
  78. TEST_P(HlslVulkan1_2CompileTest, FromFile)
  79. {
  80. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL, Semantics::Vulkan,
  81. glslang::EShTargetVulkan_1_2, glslang::EShTargetSpv_1_4, Target::BothASTAndSpv, true,
  82. GetParam().entryPoint);
  83. }
  84. TEST_P(HlslSpv1_6CompileTest, FromFile)
  85. {
  86. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  87. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_3, glslang::EShTargetSpv_1_6,
  88. Target::BothASTAndSpv, true, GetParam().entryPoint);
  89. }
  90. TEST_P(HlslCompileAndFlattenTest, FromFile)
  91. {
  92. loadFileCompileFlattenUniformsAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  93. Source::HLSL, Semantics::Vulkan,
  94. Target::BothASTAndSpv, GetParam().entryPoint);
  95. }
  96. // Compiling HLSL to legal SPIR-V under Vulkan semantics. Expected to
  97. // successfully generate SPIR-V.
  98. TEST_P(HlslLegalizeTest, FromFile)
  99. {
  100. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  101. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  102. Target::Spv, true, GetParam().entryPoint,
  103. "/baseLegalResults/", true);
  104. }
  105. // Compiling HLSL to pre-legalized SPIR-V. Expected to successfully generate
  106. // SPIR-V with debug instructions, particularly line info.
  107. TEST_P(HlslDebugTest, FromFile)
  108. {
  109. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  110. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  111. Target::Spv, true, GetParam().entryPoint,
  112. "/baseResults/", false, true);
  113. }
  114. TEST_P(HlslDX9CompatibleTest, FromFile)
  115. {
  116. loadFileCompileAndCheckWithOptions(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL,
  117. Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  118. Target::BothASTAndSpv, true,
  119. GetParam().entryPoint, "/baseResults/",
  120. EShMessages::EShMsgHlslDX9Compatible);
  121. }
  122. // Compiling HLSL to legalized SPIR-V with debug instructions. Expected to
  123. // successfully generate SPIR-V with debug instructions preserved through
  124. // legalization, particularly line info.
  125. TEST_P(HlslLegalDebugTest, FromFile)
  126. {
  127. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  128. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  129. Target::Spv, true, GetParam().entryPoint,
  130. "/baseResults/", true, true);
  131. }
  132. TEST_P(HlslNonSemanticShaderDebugInfoTest, FromFile)
  133. {
  134. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  135. Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  136. Target::Spv, true, GetParam().entryPoint, "/baseResults/", false, true, true);
  137. }
  138. // clang-format off
  139. INSTANTIATE_TEST_SUITE_P(
  140. ToSpirv, HlslCompileTest,
  141. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  142. {"hlsl.amend.frag", "f1"},
  143. {"hlsl.aliasOpaque.frag", "main"},
  144. {"hlsl.array.frag", "PixelShaderFunction"},
  145. {"hlsl.array.implicit-size.frag", "PixelShaderFunction"},
  146. {"hlsl.array.multidim.frag", "main"},
  147. {"hlsl.assoc.frag", "PixelShaderFunction"},
  148. {"hlsl.attribute.frag", "PixelShaderFunction"},
  149. {"hlsl.attribute.expression.comp", "main"},
  150. {"hlsl.attributeC11.frag", "main"},
  151. {"hlsl.attributeGlobalBuffer.frag", "main"},
  152. {"hlsl.basic.comp", "main"},
  153. {"hlsl.basic.geom", "main"},
  154. {"hlsl.boolConv.vert", "main"},
  155. {"hlsl.buffer.frag", "PixelShaderFunction"},
  156. {"hlsl.buffer-offsets.comp", "main"},
  157. {"hlsl.calculatelod.dx10.frag", "main"},
  158. {"hlsl.calculatelodunclamped.dx10.frag", "main"},
  159. {"hlsl.cast.frag", "PixelShaderFunction"},
  160. {"hlsl.cbuffer-identifier.vert", "main"},
  161. {"hlsl.cbuffer-offsets.comp", "main"},
  162. {"hlsl.charLit.vert", "main"},
  163. {"hlsl.clip.frag", "main"},
  164. {"hlsl.clipdistance-1.frag", "main"},
  165. {"hlsl.clipdistance-1.geom", "main"},
  166. {"hlsl.clipdistance-1.vert", "main"},
  167. {"hlsl.clipdistance-2.frag", "main"},
  168. {"hlsl.clipdistance-2.geom", "main"},
  169. {"hlsl.clipdistance-2.vert", "main"},
  170. {"hlsl.clipdistance-3.frag", "main"},
  171. {"hlsl.clipdistance-3.geom", "main"},
  172. {"hlsl.clipdistance-3.vert", "main"},
  173. {"hlsl.clipdistance-4.frag", "main"},
  174. {"hlsl.clipdistance-4.geom", "main"},
  175. {"hlsl.clipdistance-4.vert", "main"},
  176. {"hlsl.clipdistance-5.frag", "main"},
  177. {"hlsl.clipdistance-5.vert", "main"},
  178. {"hlsl.clipdistance-6.frag", "main"},
  179. {"hlsl.clipdistance-6.vert", "main"},
  180. {"hlsl.clipdistance-7.frag", "main"},
  181. {"hlsl.clipdistance-7.vert", "main"},
  182. {"hlsl.clipdistance-8.frag", "main"},
  183. {"hlsl.clipdistance-8.vert", "main"},
  184. {"hlsl.clipdistance-9.frag", "main"},
  185. {"hlsl.clipdistance-9.vert", "main"},
  186. {"hlsl.color.hull.tesc", "main"},
  187. {"hlsl.comparison.vec.frag", "main"},
  188. {"hlsl.conditional.frag", "PixelShaderFunction"},
  189. {"hlsl.constantbuffer.frag", "main"},
  190. {"hlsl.constructArray.vert", "main"},
  191. {"hlsl.constructexpr.frag", "main"},
  192. {"hlsl.constructimat.frag", "main"},
  193. {"hlsl.coverage.frag", "main"},
  194. {"hlsl.depthGreater.frag", "PixelShaderFunction"},
  195. {"hlsl.depthLess.frag", "PixelShaderFunction"},
  196. {"hlsl.discard.frag", "PixelShaderFunction"},
  197. {"hlsl.doLoop.frag", "PixelShaderFunction"},
  198. {"hlsl.earlydepthstencil.frag", "main"},
  199. {"hlsl.emptystructreturn.frag", "main"},
  200. {"hlsl.emptystructreturn.vert", "main"},
  201. {"hlsl.emptystructreturn.tesc", "main"},
  202. {"hlsl.emptystruct.init.vert", "main"},
  203. {"hlsl.entry-in.frag", "PixelShaderFunction"},
  204. {"hlsl.entry-inout.vert", "main"},
  205. {"hlsl.entry-out.frag", "PixelShaderFunction"},
  206. {"hlsl.fraggeom.frag", "main"},
  207. {"hlsl.float1.frag", "PixelShaderFunction"},
  208. {"hlsl.float4.frag", "PixelShaderFunction"},
  209. {"hlsl.flatten.return.frag", "main"},
  210. {"hlsl.flattenOpaque.frag", "main"},
  211. {"hlsl.flattenOpaqueInit.vert", "main"},
  212. {"hlsl.flattenOpaqueInitMix.vert", "main"},
  213. {"hlsl.flattenSubset.frag", "main"},
  214. {"hlsl.flattenSubset2.frag", "main"},
  215. {"hlsl.forLoop.frag", "PixelShaderFunction"},
  216. {"hlsl.gather.array.dx10.frag", "main"},
  217. {"hlsl.gather.basic.dx10.frag", "main"},
  218. {"hlsl.gather.basic.dx10.vert", "main"},
  219. {"hlsl.gather.offset.dx10.frag", "main"},
  220. {"hlsl.gather.offsetarray.dx10.frag", "main"},
  221. {"hlsl.gathercmpRGBA.offset.dx10.frag", "main"},
  222. {"hlsl.gatherRGBA.array.dx10.frag", "main"},
  223. {"hlsl.gatherRGBA.basic.dx10.frag", "main"},
  224. {"hlsl.gatherRGBA.offset.dx10.frag", "main"},
  225. {"hlsl.gatherRGBA.offsetarray.dx10.frag", "main"},
  226. {"hlsl.getdimensions.dx10.frag", "main"},
  227. {"hlsl.getdimensions.rw.dx10.frag", "main"},
  228. {"hlsl.getdimensions.dx10.vert", "main"},
  229. {"hlsl.getsampleposition.dx10.frag", "main"},
  230. {"hlsl.global-const-init.frag", "main"},
  231. {"hlsl.gs-hs-mix.tesc", "HSMain"},
  232. {"hlsl.domain.1.tese", "main"},
  233. {"hlsl.domain.2.tese", "main"},
  234. {"hlsl.domain.3.tese", "main"},
  235. {"hlsl.function.frag", "main"},
  236. {"hlsl.hull.1.tesc", "main"},
  237. {"hlsl.hull.2.tesc", "main"},
  238. {"hlsl.hull.3.tesc", "main"},
  239. {"hlsl.hull.4.tesc", "main"},
  240. {"hlsl.hull.5.tesc", "main"},
  241. {"hlsl.hull.6.tesc", "main"},
  242. {"hlsl.hull.void.tesc", "main"},
  243. {"hlsl.hull.ctrlpt-1.tesc", "main"},
  244. {"hlsl.hull.ctrlpt-2.tesc", "main"},
  245. {"hlsl.format.rwtexture.frag", "main"},
  246. {"hlsl.groupid.comp", "main"},
  247. {"hlsl.identifier.sample.frag", "main"},
  248. {"hlsl.if.frag", "PixelShaderFunction"},
  249. {"hlsl.imageload-subvec4.comp", "main"},
  250. {"hlsl.imagefetch-subvec4.comp", "main"},
  251. {"hlsl.implicitBool.frag", "main"},
  252. {"hlsl.inf.vert", "main"},
  253. {"hlsl.inoutquals.frag", "main"},
  254. {"hlsl.inoutquals.negative.frag", "main"},
  255. {"hlsl.init.frag", "ShaderFunction"},
  256. {"hlsl.init2.frag", "main"},
  257. {"hlsl.isfinite.frag", "main"},
  258. {"hlsl.intrinsics.barriers.comp", "ComputeShaderFunction"},
  259. {"hlsl.intrinsics.comp", "ComputeShaderFunction"},
  260. {"hlsl.intrinsics.d3dcolortoubyte4.frag", "main"},
  261. {"hlsl.intrinsics.double.frag", "PixelShaderFunction"},
  262. {"hlsl.intrinsics.f1632.frag", "main"},
  263. {"hlsl.intrinsics.f3216.frag", "main"},
  264. {"hlsl.intrinsics.frag", "main"},
  265. {"hlsl.intrinsic.frexp.frag", "main"},
  266. {"hlsl.intrinsics.lit.frag", "PixelShaderFunction"},
  267. {"hlsl.intrinsics.negative.comp", "ComputeShaderFunction"},
  268. {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"},
  269. {"hlsl.intrinsics.negative.vert", "VertexShaderFunction"},
  270. {"hlsl.intrinsics.promote.frag", "main"},
  271. {"hlsl.intrinsics.promote.down.frag", "main"},
  272. {"hlsl.intrinsics.promote.outputs.frag", "main"},
  273. {"hlsl.layout.frag", "main"},
  274. {"hlsl.layoutOverride.vert", "main"},
  275. {"hlsl.load.2dms.dx10.frag", "main"},
  276. {"hlsl.load.array.dx10.frag", "main"},
  277. {"hlsl.load.basic.dx10.frag", "main"},
  278. {"hlsl.load.basic.dx10.vert", "main"},
  279. {"hlsl.load.buffer.dx10.frag", "main"},
  280. {"hlsl.load.buffer.float.dx10.frag", "main"},
  281. {"hlsl.load.rwbuffer.dx10.frag", "main"},
  282. {"hlsl.load.rwtexture.dx10.frag", "main"},
  283. {"hlsl.load.rwtexture.array.dx10.frag", "main"},
  284. {"hlsl.load.offset.dx10.frag", "main"},
  285. {"hlsl.load.offsetarray.dx10.frag", "main"},
  286. {"hlsl.localStructuredBuffer.comp", "main"},
  287. {"hlsl.logical.binary.frag", "main"},
  288. {"hlsl.logical.binary.vec.frag", "main"},
  289. {"hlsl.logicalConvert.frag", "main"},
  290. {"hlsl.logical.unary.frag", "main"},
  291. {"hlsl.loopattr.frag", "main"},
  292. {"hlsl.matpack-pragma.frag", "main"},
  293. {"hlsl.matpack-pragma-global.frag", "main"},
  294. {"hlsl.mip.operator.frag", "main"},
  295. {"hlsl.mip.negative.frag", "main"},
  296. {"hlsl.mip.negative2.frag", "main"},
  297. {"hlsl.namespace.frag", "main"},
  298. {"hlsl.nonint-index.frag", "main"},
  299. {"hlsl.matNx1.frag", "main"},
  300. {"hlsl.matpack-1.frag", "main"},
  301. {"hlsl.matrixSwizzle.vert", "ShaderFunction"},
  302. {"hlsl.memberFunCall.frag", "main"},
  303. {"hlsl.mintypes.frag", "main"},
  304. {"hlsl.mul-truncate.frag", "main"},
  305. {"hlsl.multiEntry.vert", "RealEntrypoint"},
  306. {"hlsl.multiReturn.frag", "main"},
  307. {"hlsl.multiView.frag", "main"},
  308. {"hlsl.matrixindex.frag", "main"},
  309. {"hlsl.nonstaticMemberFunction.frag", "main"},
  310. {"hlsl.numericsuffixes.frag", "main"},
  311. {"hlsl.numericsuffixes.negative.frag", "main"},
  312. {"hlsl.numthreads.comp", "main_aux2"},
  313. {"hlsl.overload.frag", "PixelShaderFunction"},
  314. {"hlsl.opaque-type-bug.frag", "main"},
  315. {"hlsl.params.default.frag", "main"},
  316. {"hlsl.params.default.negative.frag", "main"},
  317. {"hlsl.partialInit.frag", "PixelShaderFunction"},
  318. {"hlsl.partialFlattenLocal.vert", "main"},
  319. {"hlsl.PointSize.geom", "main"},
  320. {"hlsl.PointSize.vert", "main"},
  321. {"hlsl.pp.vert", "main"},
  322. {"hlsl.pp.line.frag", "main"},
  323. {"hlsl.precise.frag", "main"},
  324. {"hlsl.printf.comp", "main"},
  325. {"hlsl.promote.atomic.frag", "main"},
  326. {"hlsl.promote.binary.frag", "main"},
  327. {"hlsl.promote.vec1.frag", "main"},
  328. {"hlsl.promotions.frag", "main"},
  329. {"hlsl.round.dx10.frag", "main"},
  330. {"hlsl.rw.atomics.frag", "main"},
  331. {"hlsl.rw.bracket.frag", "main"},
  332. {"hlsl.rw.register.frag", "main"},
  333. {"hlsl.rw.scalar.bracket.frag", "main"},
  334. {"hlsl.rw.swizzle.frag", "main"},
  335. {"hlsl.rw.vec2.bracket.frag", "main"},
  336. {"hlsl.sample.array.dx10.frag", "main"},
  337. {"hlsl.sample.basic.dx10.frag", "main"},
  338. {"hlsl.sample.offset.dx10.frag", "main"},
  339. {"hlsl.sample.offsetarray.dx10.frag", "main"},
  340. {"hlsl.samplebias.array.dx10.frag", "main"},
  341. {"hlsl.samplebias.basic.dx10.frag", "main"},
  342. {"hlsl.samplebias.offset.dx10.frag", "main"},
  343. {"hlsl.samplebias.offsetarray.dx10.frag", "main"},
  344. {"hlsl.samplecmp.array.dx10.frag", "main"},
  345. {"hlsl.samplecmp.basic.dx10.frag", "main"},
  346. {"hlsl.samplecmp.dualmode.frag", "main"},
  347. {"hlsl.samplecmp.offset.dx10.frag", "main"},
  348. {"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
  349. {"hlsl.samplecmp.negative.frag", "main"},
  350. {"hlsl.samplecmp.negative2.frag", "main"},
  351. {"hlsl.samplecmplevelzero.array.dx10.frag", "main"},
  352. {"hlsl.samplecmplevelzero.basic.dx10.frag", "main"},
  353. {"hlsl.samplecmplevelzero.offset.dx10.frag", "main"},
  354. {"hlsl.samplecmplevelzero.offsetarray.dx10.frag", "main"},
  355. {"hlsl.samplegrad.array.dx10.frag", "main"},
  356. {"hlsl.samplegrad.basic.dx10.frag", "main"},
  357. {"hlsl.samplegrad.basic.dx10.vert", "main"},
  358. {"hlsl.samplegrad.offset.dx10.frag", "main"},
  359. {"hlsl.samplegrad.offsetarray.dx10.frag", "main"},
  360. {"hlsl.samplelevel.array.dx10.frag", "main"},
  361. {"hlsl.samplelevel.basic.dx10.frag", "main"},
  362. {"hlsl.samplelevel.basic.dx10.vert", "main"},
  363. {"hlsl.samplelevel.offset.dx10.frag", "main"},
  364. {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
  365. {"hlsl.sample.sub-vec4.dx10.frag", "main"},
  366. {"hlsl.scalar-length.frag", "main"},
  367. {"hlsl.scalarCast.vert", "main"},
  368. {"hlsl.semicolons.frag", "main"},
  369. {"hlsl.shapeConv.frag", "main"},
  370. {"hlsl.shapeConvRet.frag", "main"},
  371. {"hlsl.singleArgIntPromo.vert", "main"},
  372. {"hlsl.self_cast.frag", "main"},
  373. {"hlsl.snorm.uav.comp", "main"},
  374. {"hlsl.specConstant.frag", "main"},
  375. {"hlsl.staticMemberFunction.frag", "main"},
  376. {"hlsl.staticFuncInit.frag", "main"},
  377. {"hlsl.store.rwbyteaddressbuffer.type.comp", "main"},
  378. {"hlsl.stringtoken.frag", "main"},
  379. {"hlsl.string.frag", "main"},
  380. {"hlsl.struct.split-1.vert", "main"},
  381. {"hlsl.struct.split.array.geom", "main"},
  382. {"hlsl.struct.split.assign.frag", "main"},
  383. {"hlsl.struct.split.call.vert", "main"},
  384. {"hlsl.struct.split.nested.geom", "main"},
  385. {"hlsl.struct.split.trivial.geom", "main"},
  386. {"hlsl.struct.split.trivial.vert", "main"},
  387. {"hlsl.structarray.flatten.frag", "main"},
  388. {"hlsl.structarray.flatten.geom", "main"},
  389. {"hlsl.structbuffer.frag", "main"},
  390. {"hlsl.structbuffer.append.frag", "main"},
  391. {"hlsl.structbuffer.append.fn.frag", "main"},
  392. {"hlsl.structbuffer.atomics.frag", "main"},
  393. {"hlsl.structbuffer.byte.frag", "main"},
  394. {"hlsl.structbuffer.coherent.frag", "main"},
  395. {"hlsl.structbuffer.floatidx.comp", "main"},
  396. {"hlsl.structbuffer.incdec.frag", "main"},
  397. {"hlsl.structbuffer.fn.frag", "main"},
  398. {"hlsl.structbuffer.fn2.comp", "main"},
  399. {"hlsl.structbuffer.rw.frag", "main"},
  400. {"hlsl.structbuffer.rwbyte.frag", "main"},
  401. {"hlsl.structbuffer.rwbyte2.comp", "main"},
  402. {"hlsl.structcopy.comp", "main"},
  403. {"hlsl.structin.vert", "main"},
  404. {"hlsl.structIoFourWay.frag", "main"},
  405. {"hlsl.structStructName.frag", "main"},
  406. {"hlsl.subpass.frag", "main"},
  407. {"hlsl.swizzle.vec1.comp", "main"},
  408. {"hlsl.synthesizeInput.frag", "main"},
  409. {"hlsl.texturebuffer.frag", "main"},
  410. {"hlsl.texture.struct.frag", "main"},
  411. {"hlsl.texture.subvec4.frag", "main"},
  412. {"hlsl.this.frag", "main"},
  413. {"hlsl.intrinsics.vert", "VertexShaderFunction"},
  414. {"hlsl.intrinsic.frexp.vert", "VertexShaderFunction"},
  415. {"hlsl.matType.frag", "PixelShaderFunction"},
  416. {"hlsl.matType.bool.frag", "main"},
  417. {"hlsl.matType.int.frag", "main"},
  418. {"hlsl.max.frag", "PixelShaderFunction"},
  419. {"hlsl.nested-runtimeArray.frag", "main"},
  420. {"hlsl.preprocessor.frag", "main"},
  421. {"hlsl.precedence.frag", "PixelShaderFunction"},
  422. {"hlsl.precedence2.frag", "PixelShaderFunction"},
  423. {"hlsl.scalar2matrix.frag", "main"},
  424. {"hlsl.semantic.geom", "main"},
  425. {"hlsl.semantic.vert", "main"},
  426. {"hlsl.semantic-1.vert", "main"},
  427. {"hlsl.scope.frag", "PixelShaderFunction"},
  428. {"hlsl.sin.frag", "PixelShaderFunction"},
  429. {"hlsl.struct.frag", "PixelShaderFunction"},
  430. {"hlsl.switch.frag", "PixelShaderFunction"},
  431. {"hlsl.swizzle.frag", "PixelShaderFunction"},
  432. {"hlsl.target.frag", "main"},
  433. {"hlsl.targetStruct1.frag", "main"},
  434. {"hlsl.targetStruct2.frag", "main"},
  435. {"hlsl.templatetypes.frag", "PixelShaderFunction"},
  436. {"hlsl.tristream-append.geom", "main"},
  437. {"hlsl.tx.bracket.frag", "main"},
  438. {"hlsl.tx.overload.frag", "main"},
  439. {"hlsl.type.half.frag", "main"},
  440. {"hlsl.type.identifier.frag", "main"},
  441. {"hlsl.typeGraphCopy.vert", "main"},
  442. {"hlsl.typedef.frag", "PixelShaderFunction"},
  443. {"hlsl.whileLoop.frag", "PixelShaderFunction"},
  444. {"hlsl.void.frag", "PixelShaderFunction"},
  445. {"hlsl.type.type.conversion.all.frag", "main"},
  446. {"hlsl.instance.geom", "GeometryShader"}
  447. }),
  448. FileNameAsCustomTestSuffix
  449. );
  450. // clang-format on
  451. // clang-format off
  452. INSTANTIATE_TEST_SUITE_P(
  453. ToSpirv, HlslVulkan1_1CompileTest,
  454. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  455. {"hlsl.wavebroadcast.comp", "CSMain"},
  456. {"hlsl.waveprefix.comp", "CSMain"},
  457. {"hlsl.wavequad.comp", "CSMain"},
  458. {"hlsl.wavequery.comp", "CSMain"},
  459. {"hlsl.wavequery.frag", "PixelShaderFunction"},
  460. {"hlsl.wavereduction.comp", "CSMain"},
  461. {"hlsl.wavevote.comp", "CSMain"},
  462. { "hlsl.type.type.conversion.valid.frag", "main" },
  463. {"hlsl.int.dot.frag", "main"}
  464. }),
  465. FileNameAsCustomTestSuffix
  466. );
  467. INSTANTIATE_TEST_SUITE_P(
  468. ToSpirv, HlslVulkan1_2CompileTest,
  469. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  470. {"hlsl.buffer_ref_parameter.comp", "main"},
  471. }),
  472. FileNameAsCustomTestSuffix
  473. );
  474. // clang-format on
  475. // clang-format off
  476. INSTANTIATE_TEST_SUITE_P(
  477. ToSpirv, HlslSpv1_6CompileTest,
  478. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  479. {"hlsl.spv.1.6.discard.frag", "PixelShaderFunction"},
  480. {"hlsl.structcopylogical.comp","main"},
  481. }),
  482. FileNameAsCustomTestSuffix
  483. );
  484. // clang-format on
  485. // clang-format off
  486. INSTANTIATE_TEST_SUITE_P(
  487. ToSpirv, HlslCompileAndFlattenTest,
  488. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  489. {"hlsl.array.flatten.frag", "main"},
  490. {"hlsl.partialFlattenMixed.vert", "main"},
  491. }),
  492. FileNameAsCustomTestSuffix
  493. );
  494. // clang-format on
  495. #if ENABLE_OPT
  496. // clang-format off
  497. INSTANTIATE_TEST_SUITE_P(
  498. ToSpirv, HlslLegalizeTest,
  499. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  500. {"hlsl.aliasOpaque.frag", "main"},
  501. {"hlsl.flattenOpaque.frag", "main"},
  502. {"hlsl.flattenOpaqueInit.vert", "main"},
  503. {"hlsl.flattenOpaqueInitMix.vert", "main"},
  504. {"hlsl.flattenSubset.frag", "main"},
  505. {"hlsl.flattenSubset2.frag", "main"},
  506. {"hlsl.intrinsics.evalfns.frag", "main"},
  507. {"hlsl.partialFlattenLocal.vert", "main"},
  508. {"hlsl.partialFlattenMixed.vert", "main"}
  509. }),
  510. FileNameAsCustomTestSuffix
  511. );
  512. // clang-format on
  513. #endif
  514. // clang-format off
  515. INSTANTIATE_TEST_SUITE_P(
  516. ToSpirv, HlslDebugTest,
  517. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  518. {"hlsl.pp.line2.frag", "MainPs"}
  519. }),
  520. FileNameAsCustomTestSuffix
  521. );
  522. INSTANTIATE_TEST_SUITE_P(
  523. ToSpirv, HlslDX9CompatibleTest,
  524. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  525. {"hlsl.round.dx9.frag", "main"},
  526. {"hlsl.sample.dx9.frag", "main"},
  527. {"hlsl.sample.dx9.vert", "main"},
  528. }),
  529. FileNameAsCustomTestSuffix
  530. );
  531. // clang-format off
  532. INSTANTIATE_TEST_SUITE_P(
  533. ToSpirv, HlslLegalDebugTest,
  534. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  535. {"hlsl.pp.line4.frag", "MainPs"}
  536. }),
  537. FileNameAsCustomTestSuffix
  538. );
  539. // clang-format on
  540. // clang-format off
  541. INSTANTIATE_TEST_SUITE_P(
  542. ToSpirv, HlslNonSemanticShaderDebugInfoTest,
  543. ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
  544. {"spv.debuginfo.hlsl.vert", "main"},
  545. {"spv.debuginfo.hlsl.frag", "main"},
  546. {"spv.debuginfo.hlsl.comp", "main"},
  547. {"spv.debuginfo.hlsl.geom", "main"},
  548. {"spv.debuginfo.hlsl.tesc", "main"},
  549. {"spv.debuginfo.hlsl.tese", "main"},
  550. }),
  551. FileNameAsCustomTestSuffix
  552. );
  553. // clang-format on
  554. } // anonymous namespace
  555. } // namespace glslangtest