Spv.FromFile.cpp 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. //
  2. // Copyright (C) 2016 Google, Inc.
  3. // Copyright (C) 2019 ARM Limited.
  4. // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
  5. //
  6. // All rights reserved.
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions
  10. // are met:
  11. //
  12. // Redistributions of source code must retain the above copyright
  13. // notice, this list of conditions and the following disclaimer.
  14. //
  15. // Redistributions in binary form must reproduce the above
  16. // copyright notice, this list of conditions and the following
  17. // disclaimer in the documentation and/or other materials provided
  18. // with the distribution.
  19. //
  20. // Neither the name of Google Inc. nor the names of its
  21. // contributors may be used to endorse or promote products derived
  22. // from this software without specific prior written permission.
  23. //
  24. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  27. // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  28. // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  29. // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  30. // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  31. // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  32. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33. // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  34. // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  35. // POSSIBILITY OF SUCH DAMAGE.
  36. #include <algorithm>
  37. #include <gtest/gtest.h>
  38. #include "TestFixture.h"
  39. namespace glslangtest {
  40. namespace {
  41. struct IoMapData {
  42. const char* fileName;
  43. const char* entryPoint;
  44. int baseSamplerBinding;
  45. int baseTextureBinding;
  46. int baseImageBinding;
  47. int baseUboBinding;
  48. int baseSsboBinding;
  49. bool autoMapBindings;
  50. bool flattenUniforms;
  51. };
  52. std::string FileNameAsCustomTestSuffixIoMap(
  53. const ::testing::TestParamInfo<IoMapData>& info) {
  54. std::string name = info.param.fileName;
  55. // A valid test case suffix cannot have '.' and '-' inside.
  56. std::replace(name.begin(), name.end(), '.', '_');
  57. std::replace(name.begin(), name.end(), '-', '_');
  58. return name;
  59. }
  60. using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
  61. using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithParam<std::string>>;
  62. using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
  63. using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
  64. using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
  65. using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
  66. using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
  67. using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
  68. using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
  69. using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
  70. using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
  71. using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
  72. using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
  73. using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
  74. // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
  75. // generate SPIR-V.
  76. TEST_P(CompileVulkanToSpirvTest, FromFile)
  77. {
  78. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  79. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  80. Target::Spv);
  81. }
  82. TEST_P(CompileVulkanToSpirvDeadCodeElimTest, FromFile)
  83. {
  84. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  85. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  86. Target::Spv);
  87. }
  88. // Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
  89. // to successfully generate SPIR-V.
  90. TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
  91. {
  92. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  93. Source::GLSL, Semantics::Vulkan,
  94. glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  95. Target::Spv, true, "",
  96. "/baseResults/", false, true);
  97. }
  98. TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
  99. {
  100. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  101. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
  102. Target::Spv);
  103. }
  104. TEST_P(CompileToSpirv14Test, FromFile)
  105. {
  106. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  107. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
  108. Target::Spv);
  109. }
  110. // Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
  111. // generate SPIR-V.
  112. TEST_P(CompileOpenGLToSpirvTest, FromFile)
  113. {
  114. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  115. Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  116. Target::Spv);
  117. }
  118. // GLSL-level Vulkan semantics test. Expected to error out before generating
  119. // SPIR-V.
  120. TEST_P(VulkanSemantics, FromFile)
  121. {
  122. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  123. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  124. Target::Spv, false);
  125. }
  126. // GLSL-level Vulkan semantics test. Expected to error out before generating
  127. // SPIR-V.
  128. TEST_P(OpenGLSemantics, FromFile)
  129. {
  130. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  131. Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  132. Target::Spv, false);
  133. }
  134. // GLSL-level Vulkan semantics test that need to see the AST for validation.
  135. TEST_P(VulkanAstSemantics, FromFile)
  136. {
  137. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  138. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  139. Target::AST);
  140. }
  141. // HLSL-level Vulkan semantics tests.
  142. TEST_P(HlslIoMap, FromFile)
  143. {
  144. loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  145. Source::HLSL, Semantics::Vulkan,
  146. Target::Spv, GetParam().entryPoint,
  147. GetParam().baseSamplerBinding,
  148. GetParam().baseTextureBinding,
  149. GetParam().baseImageBinding,
  150. GetParam().baseUboBinding,
  151. GetParam().baseSsboBinding,
  152. GetParam().autoMapBindings,
  153. GetParam().flattenUniforms);
  154. }
  155. // GLSL-level Vulkan semantics tests.
  156. TEST_P(GlslIoMap, FromFile)
  157. {
  158. loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  159. Source::GLSL, Semantics::Vulkan,
  160. Target::Spv, GetParam().entryPoint,
  161. GetParam().baseSamplerBinding,
  162. GetParam().baseTextureBinding,
  163. GetParam().baseImageBinding,
  164. GetParam().baseUboBinding,
  165. GetParam().baseSsboBinding,
  166. GetParam().autoMapBindings,
  167. GetParam().flattenUniforms);
  168. }
  169. // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
  170. // Expected to successfully generate SPIR-V.
  171. TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
  172. {
  173. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  174. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  175. Target::Spv);
  176. }
  177. // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
  178. // Expected to successfully generate SPIR-V.
  179. TEST_P(CompileVulkanToSpirvTestNV, FromFile)
  180. {
  181. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  182. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
  183. Target::Spv);
  184. }
  185. TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
  186. {
  187. loadCompileUpgradeTextureToSampledTextureAndDropSamplersAndCheck(GlobalTestSettings.testRoot,
  188. GetParam(),
  189. Source::GLSL,
  190. Semantics::Vulkan,
  191. Target::Spv);
  192. }
  193. // clang-format off
  194. INSTANTIATE_TEST_SUITE_P(
  195. Glsl, CompileVulkanToSpirvTest,
  196. ::testing::ValuesIn(std::vector<std::string>({
  197. // Test looping constructs.
  198. // No tests yet for making sure break and continue from a nested loop
  199. // goes to the innermost target.
  200. "spv.barrier.vert",
  201. "spv.do-simple.vert",
  202. "spv.do-while-continue-break.vert",
  203. "spv.for-complex-condition.vert",
  204. "spv.for-continue-break.vert",
  205. "spv.for-simple.vert",
  206. "spv.for-notest.vert",
  207. "spv.for-nobody.vert",
  208. "spv.while-continue-break.vert",
  209. "spv.while-simple.vert",
  210. // vulkan-specific tests
  211. "rayQuery.rgen",
  212. "rayQuery-no-cse.rgen",
  213. "rayQuery-initialize.rgen",
  214. "rayQuery-allOps.rgen",
  215. "rayQuery-allOps.Error.rgen",
  216. "rayQuery-committed.Error.rgen",
  217. "rayQuery-allOps.comp",
  218. "rayQuery-allOps.frag",
  219. "rayQuery-initialization.Error.comp",
  220. "spv.set.vert",
  221. "spv.double.comp",
  222. "spv.100ops.frag",
  223. "spv.130.frag",
  224. "spv.140.frag",
  225. "spv.150.geom",
  226. "spv.150.vert",
  227. "spv.16bitstorage.frag",
  228. "spv.16bitstorage_Error.frag",
  229. "spv.16bitstorage-int.frag",
  230. "spv.16bitstorage_Error-int.frag",
  231. "spv.16bitstorage-uint.frag",
  232. "spv.16bitstorage_Error-uint.frag",
  233. "spv.300BuiltIns.vert",
  234. "spv.300layout.frag",
  235. "spv.300layout.vert",
  236. "spv.300layoutp.vert",
  237. "spv.310.comp",
  238. "spv.310.bitcast.frag",
  239. "spv.330.geom",
  240. "spv.400.frag",
  241. "spv.400.tesc",
  242. "spv.400.tese",
  243. "spv.420.geom",
  244. "spv.430.frag",
  245. "spv.430.vert",
  246. "spv.450.tesc",
  247. "spv.450.geom",
  248. "spv.450.noRedecl.tesc",
  249. "spv.8bitstorage-int.frag",
  250. "spv.8bitstorage_Error-int.frag",
  251. "spv.8bitstorage-uint.frag",
  252. "spv.8bitstorage_Error-uint.frag",
  253. "spv.8bitstorage-ubo.vert",
  254. "spv.8bitstorage-ssbo.vert",
  255. "spv.8bit-16bit-construction.frag",
  256. "spv.accessChain.frag",
  257. "spv.aggOps.frag",
  258. "spv.always-discard.frag",
  259. "spv.always-discard2.frag",
  260. "spv.arbPostDepthCoverage.frag",
  261. "spv.arbPostDepthCoverage_Error.frag",
  262. "spv.atomicCounter.comp",
  263. "spv.bitCast.frag",
  264. "spv.bool.vert",
  265. "spv.boolInBlock.frag",
  266. "spv.branch-return.vert",
  267. "spv.bufferhandle1.frag",
  268. "spv.bufferhandle10.frag",
  269. "spv.bufferhandle11.frag",
  270. "spv.bufferhandle12.frag",
  271. "spv.bufferhandle13.frag",
  272. "spv.bufferhandle14.frag",
  273. "spv.bufferhandle15.frag",
  274. "spv.bufferhandle16.frag",
  275. "spv.bufferhandle17_Errors.frag",
  276. "spv.bufferhandle18.frag",
  277. "spv.bufferhandle19_Errors.frag",
  278. "spv.bufferhandle2.frag",
  279. "spv.bufferhandle3.frag",
  280. "spv.bufferhandle4.frag",
  281. "spv.bufferhandle5.frag",
  282. "spv.bufferhandle6.frag",
  283. "spv.bufferhandle7.frag",
  284. "spv.bufferhandle8.frag",
  285. "spv.bufferhandle9.frag",
  286. "spv.bufferhandleUvec2.frag",
  287. "spv.bufferhandle_Error.frag",
  288. "spv.builtInXFB.vert",
  289. "spv.conditionalDemote.frag",
  290. "spv.conditionalDiscard.frag",
  291. "spv.constructComposite.comp",
  292. "spv.constStruct.vert",
  293. "spv.constConstruct.vert",
  294. "spv.controlFlowAttributes.frag",
  295. "spv.conversion.frag",
  296. "spv.coopmat.comp",
  297. "spv.coopmat_Error.comp",
  298. "spv.dataOut.frag",
  299. "spv.dataOutIndirect.frag",
  300. "spv.dataOutIndirect.vert",
  301. "spv.debugPrintf.frag",
  302. "spv.debugPrintf_Error.frag",
  303. "spv.demoteDisabled.frag",
  304. "spv.deepRvalue.frag",
  305. "spv.depthOut.frag",
  306. "spv.discard-dce.frag",
  307. "spv.doWhileLoop.frag",
  308. "spv.earlyReturnDiscard.frag",
  309. "spv.extPostDepthCoverage.frag",
  310. "spv.extPostDepthCoverage_Error.frag",
  311. "spv.float16convertonlyarith.comp",
  312. "spv.float16convertonlystorage.comp",
  313. "spv.flowControl.frag",
  314. "spv.forLoop.frag",
  315. "spv.forwardFun.frag",
  316. "spv.fragmentDensity.frag",
  317. "spv.fragmentDensity.vert",
  318. "spv.fragmentDensity-es.frag",
  319. "spv.fragmentDensity-neg.frag",
  320. "spv.fsi.frag",
  321. "spv.fsi_Error.frag",
  322. "spv.fullyCovered.frag",
  323. "spv.functionCall.frag",
  324. "spv.functionNestedOpaque.vert",
  325. "spv.functionSemantics.frag",
  326. "spv.functionParameterTypes.frag",
  327. "spv.GeometryShaderPassthrough.geom",
  328. "spv.interpOps.frag",
  329. "spv.int64.frag",
  330. "spv.intcoopmat.comp",
  331. "spv.intOps.vert",
  332. "spv.layer.tese",
  333. "spv.layoutNested.vert",
  334. "spv.length.frag",
  335. "spv.localAggregates.frag",
  336. "spv.loops.frag",
  337. "spv.loopsArtificial.frag",
  338. "spv.matFun.vert",
  339. "spv.matrix.frag",
  340. "spv.matrix2.frag",
  341. "spv.memoryQualifier.frag",
  342. "spv.merge-unreachable.frag",
  343. "spv.multiStruct.comp",
  344. "spv.multiStructFuncall.frag",
  345. "spv.newTexture.frag",
  346. "spv.noDeadDecorations.vert",
  347. "spv.nonSquare.vert",
  348. "spv.nonuniform.frag",
  349. "spv.nonuniform2.frag",
  350. "spv.nonuniform3.frag",
  351. "spv.nonuniform4.frag",
  352. "spv.nonuniform5.frag",
  353. "spv.noWorkgroup.comp",
  354. "spv.offsets.frag",
  355. "spv.Operations.frag",
  356. "spv.paramMemory.frag",
  357. "spv.paramMemory.420.frag",
  358. "spv.precision.frag",
  359. "spv.precisionArgs.frag",
  360. "spv.precisionNonESSamp.frag",
  361. "spv.precisionTexture.frag",
  362. "spv.prepost.frag",
  363. "spv.privateVariableTypes.frag",
  364. "spv.qualifiers.vert",
  365. "spv.sample.frag",
  366. "spv.sampleId.frag",
  367. "spv.samplePosition.frag",
  368. "spv.sampleMaskOverrideCoverage.frag",
  369. "spv.scalarlayout.frag",
  370. "spv.scalarlayoutfloat16.frag",
  371. "spv.shaderBallot.comp",
  372. "spv.shaderDrawParams.vert",
  373. "spv.shaderGroupVote.comp",
  374. "spv.shaderStencilExport.frag",
  375. "spv.shiftOps.frag",
  376. "spv.simpleFunctionCall.frag",
  377. "spv.simpleMat.vert",
  378. "spv.sparseTexture.frag",
  379. "spv.sparseTextureClamp.frag",
  380. "spv.structAssignment.frag",
  381. "spv.structDeref.frag",
  382. "spv.structure.frag",
  383. "spv.switch.frag",
  384. "spv.swizzle.frag",
  385. "spv.swizzleInversion.frag",
  386. "spv.test.frag",
  387. "spv.test.vert",
  388. "spv.texture.frag",
  389. "spv.texture.vert",
  390. "spv.textureBuffer.vert",
  391. "spv.image.frag",
  392. "spv.imageAtomic64.frag",
  393. "spv.types.frag",
  394. "spv.uint.frag",
  395. "spv.uniformArray.frag",
  396. "spv.variableArrayIndex.frag",
  397. "spv.varyingArray.frag",
  398. "spv.varyingArrayIndirect.frag",
  399. "spv.vecMatConstruct.frag",
  400. "spv.voidFunction.frag",
  401. "spv.whileLoop.frag",
  402. "spv.AofA.frag",
  403. "spv.queryL.frag",
  404. "spv.separate.frag",
  405. "spv.shortCircuit.frag",
  406. "spv.pushConstant.vert",
  407. "spv.pushConstantAnon.vert",
  408. "spv.subpass.frag",
  409. "spv.specConstant.vert",
  410. "spv.specConstant.comp",
  411. "spv.specConstantComposite.vert",
  412. "spv.specConstantOperations.vert",
  413. "spv.specConstant.float16.comp",
  414. "spv.specConstant.int16.comp",
  415. "spv.specConstant.int8.comp",
  416. "spv.storageBuffer.vert",
  417. "spv.terminate.frag",
  418. "spv.precise.tese",
  419. "spv.precise.tesc",
  420. "spv.viewportindex.tese",
  421. "spv.volatileAtomic.comp",
  422. "spv.vulkan100.subgroupArithmetic.comp",
  423. "spv.vulkan100.subgroupPartitioned.comp",
  424. "spv.xfb.vert",
  425. "spv.xfb2.vert",
  426. "spv.xfb3.vert",
  427. "spv.samplerlessTextureFunctions.frag",
  428. "spv.smBuiltins.vert",
  429. "spv.smBuiltins.frag",
  430. "spv.builtin.PrimitiveShadingRateEXT.vert",
  431. "spv.builtin.ShadingRateEXT.frag",
  432. })),
  433. FileNameAsCustomTestSuffix
  434. );
  435. // Cases with deliberately unreachable code.
  436. // By default the compiler will aggressively eliminate
  437. // unreachable merges and continues.
  438. INSTANTIATE_TEST_SUITE_P(
  439. GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
  440. ::testing::ValuesIn(std::vector<std::string>({
  441. "spv.dead-after-continue.vert",
  442. "spv.dead-after-discard.frag",
  443. "spv.dead-after-return.vert",
  444. "spv.dead-after-loop-break.vert",
  445. "spv.dead-after-switch-break.vert",
  446. "spv.dead-complex-continue-after-return.vert",
  447. "spv.dead-complex-merge-after-return.vert",
  448. })),
  449. FileNameAsCustomTestSuffix
  450. );
  451. // clang-format off
  452. INSTANTIATE_TEST_SUITE_P(
  453. Glsl, CompileVulkanToDebugSpirvTest,
  454. ::testing::ValuesIn(std::vector<std::string>({
  455. "spv.pp.line.frag",
  456. })),
  457. FileNameAsCustomTestSuffix
  458. );
  459. // clang-format off
  460. INSTANTIATE_TEST_SUITE_P(
  461. Glsl, CompileVulkan1_1ToSpirvTest,
  462. ::testing::ValuesIn(std::vector<std::string>({
  463. "spv.1.3.8bitstorage-ubo.vert",
  464. "spv.1.3.8bitstorage-ssbo.vert",
  465. "spv.1.3.coopmat.comp",
  466. "spv.deviceGroup.frag",
  467. "spv.drawParams.vert",
  468. "spv.int8.frag",
  469. "spv.vulkan110.int16.frag",
  470. "spv.int32.frag",
  471. "spv.explicittypes.frag",
  472. "spv.float32.frag",
  473. "spv.float64.frag",
  474. "spv.memoryScopeSemantics.comp",
  475. "spv.memoryScopeSemantics_Error.comp",
  476. "spv.multiView.frag",
  477. "spv.RayGenShader11.rgen",
  478. "spv.subgroup.frag",
  479. "spv.subgroup.geom",
  480. "spv.subgroup.tesc",
  481. "spv.subgroup.tese",
  482. "spv.subgroup.vert",
  483. "spv.subgroupArithmetic.comp",
  484. "spv.subgroupBasic.comp",
  485. "spv.subgroupBallot.comp",
  486. "spv.subgroupBallotNeg.comp",
  487. "spv.subgroupClustered.comp",
  488. "spv.subgroupClusteredNeg.comp",
  489. "spv.subgroupPartitioned.comp",
  490. "spv.subgroupShuffle.comp",
  491. "spv.subgroupShuffleRelative.comp",
  492. "spv.subgroupQuad.comp",
  493. "spv.subgroupVote.comp",
  494. "spv.subgroupExtendedTypesArithmetic.comp",
  495. "spv.subgroupExtendedTypesArithmeticNeg.comp",
  496. "spv.subgroupExtendedTypesBallot.comp",
  497. "spv.subgroupExtendedTypesBallotNeg.comp",
  498. "spv.subgroupExtendedTypesClustered.comp",
  499. "spv.subgroupExtendedTypesClusteredNeg.comp",
  500. "spv.subgroupExtendedTypesPartitioned.comp",
  501. "spv.subgroupExtendedTypesPartitionedNeg.comp",
  502. "spv.subgroupExtendedTypesShuffle.comp",
  503. "spv.subgroupExtendedTypesShuffleNeg.comp",
  504. "spv.subgroupExtendedTypesShuffleRelative.comp",
  505. "spv.subgroupExtendedTypesShuffleRelativeNeg.comp",
  506. "spv.subgroupExtendedTypesQuad.comp",
  507. "spv.subgroupExtendedTypesQuadNeg.comp",
  508. "spv.subgroupExtendedTypesVote.comp",
  509. "spv.subgroupExtendedTypesVoteNeg.comp",
  510. "spv.vulkan110.storageBuffer.vert",
  511. })),
  512. FileNameAsCustomTestSuffix
  513. );
  514. // clang-format off
  515. INSTANTIATE_TEST_SUITE_P(
  516. Glsl, CompileToSpirv14Test,
  517. ::testing::ValuesIn(std::vector<std::string>({
  518. "spv.1.4.LoopControl.frag",
  519. "spv.1.4.NonWritable.frag",
  520. "spv.1.4.OpEntryPoint.frag",
  521. "spv.1.4.OpEntryPoint.opaqueParams.vert",
  522. "spv.1.4.OpSelect.frag",
  523. "spv.1.4.OpCopyLogical.comp",
  524. "spv.1.4.OpCopyLogicalBool.comp",
  525. "spv.1.4.OpCopyLogical.funcall.frag",
  526. "spv.1.4.image.frag",
  527. "spv.1.4.sparseTexture.frag",
  528. "spv.1.4.texture.frag",
  529. "spv.1.4.constructComposite.comp",
  530. "spv.ext.AnyHitShader.rahit",
  531. "spv.ext.AnyHitShader_Errors.rahit",
  532. "spv.ext.ClosestHitShader.rchit",
  533. "spv.ext.ClosestHitShader_Errors.rchit",
  534. "spv.ext.IntersectShader.rint",
  535. "spv.ext.IntersectShader_Errors.rint",
  536. "spv.ext.MissShader.rmiss",
  537. "spv.ext.MissShader_Errors.rmiss",
  538. "spv.ext.RayPrimCull_Errors.rgen",
  539. "spv.ext.RayCallable.rcall",
  540. "spv.ext.RayCallable_Errors.rcall",
  541. "spv.ext.RayConstants.rgen",
  542. "spv.ext.RayGenShader.rgen",
  543. "spv.ext.RayGenShader11.rgen",
  544. "spv.ext.RayGenShaderArray.rgen",
  545. "spv.ext.World3x4.rahit",
  546. })),
  547. FileNameAsCustomTestSuffix
  548. );
  549. // clang-format off
  550. INSTANTIATE_TEST_SUITE_P(
  551. Hlsl, HlslIoMap,
  552. ::testing::ValuesIn(std::vector<IoMapData>{
  553. { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
  554. { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
  555. { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
  556. { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
  557. { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
  558. { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
  559. { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
  560. { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
  561. { "spv.register.autoassign.rangetest.frag", "main",
  562. glslang::TQualifier::layoutBindingEnd-2,
  563. glslang::TQualifier::layoutBindingEnd+5,
  564. 20, 30, true, false },
  565. }),
  566. FileNameAsCustomTestSuffixIoMap
  567. );
  568. // clang-format off
  569. INSTANTIATE_TEST_SUITE_P(
  570. Hlsl, GlslIoMap,
  571. ::testing::ValuesIn(std::vector<IoMapData>{
  572. { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
  573. { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
  574. }),
  575. FileNameAsCustomTestSuffixIoMap
  576. );
  577. // clang-format off
  578. INSTANTIATE_TEST_SUITE_P(
  579. Glsl, CompileOpenGLToSpirvTest,
  580. ::testing::ValuesIn(std::vector<std::string>({
  581. "spv.460.frag",
  582. "spv.460.vert",
  583. "spv.460.comp",
  584. "spv.atomic.comp",
  585. "spv.atomicFloat.comp",
  586. "spv.atomicFloat_Error.comp",
  587. "spv.glFragColor.frag",
  588. "spv.rankShift.comp",
  589. "spv.specConst.vert",
  590. "spv.specTexture.frag",
  591. "spv.OVR_multiview.vert",
  592. "spv.uniformInitializer.frag",
  593. "spv.uniformInitializerSpecConstant.frag",
  594. "spv.uniformInitializerStruct.frag",
  595. "spv.xfbOffsetOnBlockMembersAssignment.vert",
  596. "spv.xfbOffsetOnStructMembersAssignment.vert",
  597. "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
  598. "spv.xfbStrideJustOnce.vert",
  599. })),
  600. FileNameAsCustomTestSuffix
  601. );
  602. INSTANTIATE_TEST_SUITE_P(
  603. Glsl, VulkanSemantics,
  604. ::testing::ValuesIn(std::vector<std::string>({
  605. "vulkan.frag",
  606. "vulkan.vert",
  607. "vulkan.comp",
  608. "samplerlessTextureFunctions.frag",
  609. "spv.specConstArrayCheck.vert",
  610. })),
  611. FileNameAsCustomTestSuffix
  612. );
  613. INSTANTIATE_TEST_SUITE_P(
  614. Glsl, OpenGLSemantics,
  615. ::testing::ValuesIn(std::vector<std::string>({
  616. "glspv.esversion.vert",
  617. "glspv.version.frag",
  618. "glspv.version.vert",
  619. "glspv.frag",
  620. "glspv.vert",
  621. })),
  622. FileNameAsCustomTestSuffix
  623. );
  624. INSTANTIATE_TEST_SUITE_P(
  625. Glsl, VulkanAstSemantics,
  626. ::testing::ValuesIn(std::vector<std::string>({
  627. "vulkan.ast.vert",
  628. })),
  629. FileNameAsCustomTestSuffix
  630. );
  631. INSTANTIATE_TEST_SUITE_P(
  632. Glsl, CompileVulkanToSpirvTestAMD,
  633. ::testing::ValuesIn(std::vector<std::string>({
  634. "spv.16bitxfb.vert",
  635. "spv.float16.frag",
  636. "spv.float16Fetch.frag",
  637. "spv.imageLoadStoreLod.frag",
  638. "spv.int16.frag",
  639. "spv.int16.amd.frag",
  640. "spv.shaderBallotAMD.comp",
  641. "spv.shaderFragMaskAMD.frag",
  642. "spv.textureGatherBiasLod.frag",
  643. })),
  644. FileNameAsCustomTestSuffix
  645. );
  646. INSTANTIATE_TEST_SUITE_P(
  647. Glsl, CompileVulkanToSpirvTestNV,
  648. ::testing::ValuesIn(std::vector<std::string>({
  649. "spv.sampleMaskOverrideCoverage.frag",
  650. "spv.GeometryShaderPassthrough.geom",
  651. "spv.viewportArray2.vert",
  652. "spv.viewportArray2.tesc",
  653. "spv.stereoViewRendering.vert",
  654. "spv.stereoViewRendering.tesc",
  655. "spv.multiviewPerViewAttributes.vert",
  656. "spv.multiviewPerViewAttributes.tesc",
  657. "spv.atomicInt64.comp",
  658. "spv.shadingRate.frag",
  659. "spv.RayGenShader.rgen",
  660. "spv.RayGenShaderArray.rgen",
  661. "spv.RayGenShader_Errors.rgen",
  662. "spv.RayConstants.rgen",
  663. "spv.IntersectShader.rint",
  664. "spv.IntersectShader_Errors.rint",
  665. "spv.AnyHitShader.rahit",
  666. "spv.AnyHitShader_Errors.rahit",
  667. "spv.ClosestHitShader.rchit",
  668. "spv.ClosestHitShader_Errors.rchit",
  669. "spv.MissShader.rmiss",
  670. "spv.MissShader_Errors.rmiss",
  671. "spv.RayCallable.rcall",
  672. "spv.RayCallable_Errors.rcall",
  673. "spv.fragmentShaderBarycentric.frag",
  674. "spv.fragmentShaderBarycentric2.frag",
  675. "spv.computeShaderDerivatives.comp",
  676. "spv.computeShaderDerivatives2.comp",
  677. "spv.shaderImageFootprint.frag",
  678. "spv.meshShaderBuiltins.mesh",
  679. "spv.meshShaderUserDefined.mesh",
  680. "spv.meshShaderPerViewBuiltins.mesh",
  681. "spv.meshShaderPerViewUserDefined.mesh",
  682. "spv.meshShaderPerView_Errors.mesh",
  683. "spv.meshShaderSharedMem.mesh",
  684. "spv.meshShaderTaskMem.mesh",
  685. "spv.320.meshShaderUserDefined.mesh",
  686. "spv.meshShaderRedeclBuiltins.mesh",
  687. "spv.meshShaderRedeclPerViewBuiltins.mesh",
  688. "spv.meshTaskShader.task",
  689. "spv.perprimitiveNV.frag",
  690. })),
  691. FileNameAsCustomTestSuffix
  692. );
  693. INSTANTIATE_TEST_SUITE_P(
  694. Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
  695. ::testing::ValuesIn(std::vector<std::string>({
  696. "spv.texture.sampler.transform.frag",
  697. })),
  698. FileNameAsCustomTestSuffix
  699. );
  700. // clang-format on
  701. } // anonymous namespace
  702. } // namespace glslangtest