Spv.FromFile.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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.intcoopmat.comp",
  308. "spv.intOps.vert",
  309. "spv.layoutNested.vert",
  310. "spv.length.frag",
  311. "spv.localAggregates.frag",
  312. "spv.loops.frag",
  313. "spv.loopsArtificial.frag",
  314. "spv.matFun.vert",
  315. "spv.matrix.frag",
  316. "spv.matrix2.frag",
  317. "spv.memoryQualifier.frag",
  318. "spv.merge-unreachable.frag",
  319. "spv.multiStruct.comp",
  320. "spv.multiStructFuncall.frag",
  321. "spv.newTexture.frag",
  322. "spv.noDeadDecorations.vert",
  323. "spv.nonSquare.vert",
  324. "spv.nonuniform.frag",
  325. "spv.nonuniform2.frag",
  326. "spv.noWorkgroup.comp",
  327. "spv.offsets.frag",
  328. "spv.Operations.frag",
  329. "spv.paramMemory.frag",
  330. "spv.precision.frag",
  331. "spv.precisionNonESSamp.frag",
  332. "spv.prepost.frag",
  333. "spv.privateVariableTypes.frag",
  334. "spv.qualifiers.vert",
  335. "spv.sample.frag",
  336. "spv.sampleId.frag",
  337. "spv.samplePosition.frag",
  338. "spv.sampleMaskOverrideCoverage.frag",
  339. "spv.scalarlayout.frag",
  340. "spv.scalarlayoutfloat16.frag",
  341. "spv.shaderBallot.comp",
  342. "spv.shaderDrawParams.vert",
  343. "spv.shaderGroupVote.comp",
  344. "spv.shaderStencilExport.frag",
  345. "spv.shiftOps.frag",
  346. "spv.simpleFunctionCall.frag",
  347. "spv.simpleMat.vert",
  348. "spv.sparseTexture.frag",
  349. "spv.sparseTextureClamp.frag",
  350. "spv.structAssignment.frag",
  351. "spv.structDeref.frag",
  352. "spv.structure.frag",
  353. "spv.switch.frag",
  354. "spv.swizzle.frag",
  355. "spv.swizzleInversion.frag",
  356. "spv.test.frag",
  357. "spv.test.vert",
  358. "spv.texture.frag",
  359. "spv.texture.vert",
  360. "spv.textureBuffer.vert",
  361. "spv.image.frag",
  362. "spv.types.frag",
  363. "spv.uint.frag",
  364. "spv.uniformArray.frag",
  365. "spv.variableArrayIndex.frag",
  366. "spv.varyingArray.frag",
  367. "spv.varyingArrayIndirect.frag",
  368. "spv.vecMatConstruct.frag",
  369. "spv.voidFunction.frag",
  370. "spv.whileLoop.frag",
  371. "spv.AofA.frag",
  372. "spv.queryL.frag",
  373. "spv.separate.frag",
  374. "spv.shortCircuit.frag",
  375. "spv.pushConstant.vert",
  376. "spv.pushConstantAnon.vert",
  377. "spv.subpass.frag",
  378. "spv.specConstant.vert",
  379. "spv.specConstant.comp",
  380. "spv.specConstantComposite.vert",
  381. "spv.specConstantOperations.vert",
  382. "spv.storageBuffer.vert",
  383. "spv.precise.tese",
  384. "spv.precise.tesc",
  385. "spv.vulkan100.subgroupArithmetic.comp",
  386. "spv.vulkan100.subgroupPartitioned.comp",
  387. "spv.xfb.vert",
  388. "spv.xfb2.vert",
  389. "spv.xfb3.vert",
  390. "spv.samplerlessTextureFunctions.frag",
  391. "spv.smBuiltins.vert",
  392. "spv.smBuiltins.frag",
  393. })),
  394. FileNameAsCustomTestSuffix
  395. );
  396. // clang-format off
  397. INSTANTIATE_TEST_CASE_P(
  398. Glsl, CompileVulkanToDebugSpirvTest,
  399. ::testing::ValuesIn(std::vector<std::string>({
  400. "spv.pp.line.frag",
  401. })),
  402. FileNameAsCustomTestSuffix
  403. );
  404. // clang-format off
  405. INSTANTIATE_TEST_CASE_P(
  406. Glsl, CompileVulkan1_1ToSpirvTest,
  407. ::testing::ValuesIn(std::vector<std::string>({
  408. "spv.1.3.8bitstorage-ubo.vert",
  409. "spv.1.3.8bitstorage-ssbo.vert",
  410. "spv.1.3.coopmat.comp",
  411. "spv.deviceGroup.frag",
  412. "spv.drawParams.vert",
  413. "spv.int8.frag",
  414. "spv.vulkan110.int16.frag",
  415. "spv.int32.frag",
  416. "spv.explicittypes.frag",
  417. "spv.float32.frag",
  418. "spv.float64.frag",
  419. "spv.memoryScopeSemantics.comp",
  420. "spv.memoryScopeSemantics_Error.comp",
  421. "spv.multiView.frag",
  422. "spv.RayGenShader11.rgen",
  423. "spv.subgroup.frag",
  424. "spv.subgroup.geom",
  425. "spv.subgroup.tesc",
  426. "spv.subgroup.tese",
  427. "spv.subgroup.vert",
  428. "spv.subgroupArithmetic.comp",
  429. "spv.subgroupBasic.comp",
  430. "spv.subgroupBallot.comp",
  431. "spv.subgroupBallotNeg.comp",
  432. "spv.subgroupClustered.comp",
  433. "spv.subgroupClusteredNeg.comp",
  434. "spv.subgroupPartitioned.comp",
  435. "spv.subgroupShuffle.comp",
  436. "spv.subgroupShuffleRelative.comp",
  437. "spv.subgroupQuad.comp",
  438. "spv.subgroupVote.comp",
  439. "spv.vulkan110.storageBuffer.vert",
  440. })),
  441. FileNameAsCustomTestSuffix
  442. );
  443. // clang-format off
  444. INSTANTIATE_TEST_CASE_P(
  445. Glsl, CompileToSpirv14Test,
  446. ::testing::ValuesIn(std::vector<std::string>({
  447. "spv.1.4.LoopControl.frag",
  448. "spv.1.4.NonWritable.frag",
  449. "spv.1.4.OpEntryPoint.frag",
  450. "spv.1.4.OpSelect.frag",
  451. "spv.1.4.OpCopyLogical.comp",
  452. "spv.1.4.OpCopyLogicalBool.comp",
  453. "spv.1.4.OpCopyLogical.funcall.frag",
  454. "spv.1.4.image.frag",
  455. "spv.1.4.sparseTexture.frag",
  456. "spv.1.4.texture.frag",
  457. "spv.1.4.constructComposite.comp",
  458. })),
  459. FileNameAsCustomTestSuffix
  460. );
  461. // clang-format off
  462. INSTANTIATE_TEST_CASE_P(
  463. Hlsl, HlslIoMap,
  464. ::testing::ValuesIn(std::vector<IoMapData>{
  465. { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
  466. { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
  467. { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
  468. { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
  469. { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
  470. { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
  471. { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
  472. { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
  473. { "spv.register.autoassign.rangetest.frag", "main",
  474. glslang::TQualifier::layoutBindingEnd-2,
  475. glslang::TQualifier::layoutBindingEnd+5,
  476. 20, 30, true, false },
  477. }),
  478. FileNameAsCustomTestSuffixIoMap
  479. );
  480. // clang-format off
  481. INSTANTIATE_TEST_CASE_P(
  482. Hlsl, GlslIoMap,
  483. ::testing::ValuesIn(std::vector<IoMapData>{
  484. { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
  485. { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
  486. }),
  487. FileNameAsCustomTestSuffixIoMap
  488. );
  489. // clang-format off
  490. INSTANTIATE_TEST_CASE_P(
  491. Glsl, CompileOpenGLToSpirvTest,
  492. ::testing::ValuesIn(std::vector<std::string>({
  493. "spv.460.frag",
  494. "spv.460.vert",
  495. "spv.460.comp",
  496. "spv.atomic.comp",
  497. "spv.glFragColor.frag",
  498. "spv.rankShift.comp",
  499. "spv.specConst.vert",
  500. "spv.OVR_multiview.vert",
  501. "spv.xfbOffsetOnBlockMembersAssignment.vert",
  502. "spv.xfbOffsetOnStructMembersAssignment.vert",
  503. "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
  504. "spv.xfbStrideJustOnce.vert",
  505. })),
  506. FileNameAsCustomTestSuffix
  507. );
  508. INSTANTIATE_TEST_CASE_P(
  509. Glsl, VulkanSemantics,
  510. ::testing::ValuesIn(std::vector<std::string>({
  511. "vulkan.frag",
  512. "vulkan.vert",
  513. "vulkan.comp",
  514. "samplerlessTextureFunctions.frag",
  515. "spv.specConstArrayCheck.vert",
  516. })),
  517. FileNameAsCustomTestSuffix
  518. );
  519. INSTANTIATE_TEST_CASE_P(
  520. Glsl, OpenGLSemantics,
  521. ::testing::ValuesIn(std::vector<std::string>({
  522. "glspv.esversion.vert",
  523. "glspv.version.frag",
  524. "glspv.version.vert",
  525. "glspv.frag",
  526. "glspv.vert",
  527. })),
  528. FileNameAsCustomTestSuffix
  529. );
  530. INSTANTIATE_TEST_CASE_P(
  531. Glsl, VulkanAstSemantics,
  532. ::testing::ValuesIn(std::vector<std::string>({
  533. "vulkan.ast.vert",
  534. })),
  535. FileNameAsCustomTestSuffix
  536. );
  537. INSTANTIATE_TEST_CASE_P(
  538. Glsl, CompileVulkanToSpirvTestAMD,
  539. ::testing::ValuesIn(std::vector<std::string>({
  540. "spv.16bitxfb.vert",
  541. "spv.float16.frag",
  542. "spv.float16Fetch.frag",
  543. "spv.imageLoadStoreLod.frag",
  544. "spv.int16.frag",
  545. "spv.int16.amd.frag",
  546. "spv.shaderBallotAMD.comp",
  547. "spv.shaderFragMaskAMD.frag",
  548. "spv.textureGatherBiasLod.frag",
  549. })),
  550. FileNameAsCustomTestSuffix
  551. );
  552. INSTANTIATE_TEST_CASE_P(
  553. Glsl, CompileVulkanToSpirvTestNV,
  554. ::testing::ValuesIn(std::vector<std::string>({
  555. "spv.sampleMaskOverrideCoverage.frag",
  556. "spv.GeometryShaderPassthrough.geom",
  557. "spv.viewportArray2.vert",
  558. "spv.viewportArray2.tesc",
  559. "spv.stereoViewRendering.vert",
  560. "spv.stereoViewRendering.tesc",
  561. "spv.multiviewPerViewAttributes.vert",
  562. "spv.multiviewPerViewAttributes.tesc",
  563. "spv.atomicInt64.comp",
  564. "spv.shadingRate.frag",
  565. "spv.RayGenShader.rgen",
  566. "spv.RayGenShaderArray.rgen",
  567. "spv.RayGenShader_Errors.rgen",
  568. "spv.RayConstants.rgen",
  569. "spv.IntersectShader.rint",
  570. "spv.IntersectShader_Errors.rint",
  571. "spv.AnyHitShader.rahit",
  572. "spv.AnyHitShader_Errors.rahit",
  573. "spv.ClosestHitShader.rchit",
  574. "spv.ClosestHitShader_Errors.rchit",
  575. "spv.MissShader.rmiss",
  576. "spv.MissShader_Errors.rmiss",
  577. "spv.RayCallable.rcall",
  578. "spv.RayCallable_Errors.rcall",
  579. "spv.fragmentShaderBarycentric.frag",
  580. "spv.fragmentShaderBarycentric2.frag",
  581. "spv.computeShaderDerivatives.comp",
  582. "spv.computeShaderDerivatives2.comp",
  583. "spv.shaderImageFootprint.frag",
  584. "spv.meshShaderBuiltins.mesh",
  585. "spv.meshShaderUserDefined.mesh",
  586. "spv.meshShaderPerViewBuiltins.mesh",
  587. "spv.meshShaderPerViewUserDefined.mesh",
  588. "spv.meshShaderPerView_Errors.mesh",
  589. "spv.meshShaderSharedMem.mesh",
  590. "spv.meshShaderTaskMem.mesh",
  591. "spv.320.meshShaderUserDefined.mesh",
  592. "spv.meshShaderRedeclBuiltins.mesh",
  593. "spv.meshShaderRedeclPerViewBuiltins.mesh",
  594. "spv.meshTaskShader.task",
  595. "spv.perprimitiveNV.frag",
  596. })),
  597. FileNameAsCustomTestSuffix
  598. );
  599. INSTANTIATE_TEST_CASE_P(
  600. Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
  601. ::testing::ValuesIn(std::vector<std::string>({
  602. "spv.texture.sampler.transform.frag",
  603. })),
  604. FileNameAsCustomTestSuffix
  605. );
  606. // clang-format on
  607. } // anonymous namespace
  608. } // namespace glslangtest