Spv.FromFile.cpp 23 KB

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