Spv.FromFile.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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 CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
  62. using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
  63. using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
  64. using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
  65. using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
  66. using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
  67. #ifdef AMD_EXTENSIONS
  68. using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
  69. #endif
  70. #ifdef NV_EXTENSIONS
  71. using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
  72. #endif
  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,
  80. Target::Spv);
  81. }
  82. // Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
  83. // to successfully generate SPIR-V.
  84. TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
  85. {
  86. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  87. Source::GLSL, Semantics::Vulkan,
  88. glslang::EShTargetVulkan_1_0,
  89. Target::Spv, true, "",
  90. "/baseResults/", false, true);
  91. }
  92. TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
  93. {
  94. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  95. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1,
  96. Target::Spv);
  97. }
  98. // Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
  99. // generate SPIR-V.
  100. TEST_P(CompileOpenGLToSpirvTest, FromFile)
  101. {
  102. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  103. Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
  104. Target::Spv);
  105. }
  106. // GLSL-level Vulkan semantics test. Expected to error out before generating
  107. // SPIR-V.
  108. TEST_P(VulkanSemantics, FromFile)
  109. {
  110. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  111. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
  112. Target::Spv, false);
  113. }
  114. // GLSL-level Vulkan semantics test. Expected to error out before generating
  115. // SPIR-V.
  116. TEST_P(OpenGLSemantics, FromFile)
  117. {
  118. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  119. Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
  120. Target::Spv, false);
  121. }
  122. // GLSL-level Vulkan semantics test that need to see the AST for validation.
  123. TEST_P(VulkanAstSemantics, FromFile)
  124. {
  125. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  126. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
  127. Target::AST);
  128. }
  129. // HLSL-level Vulkan semantics tests.
  130. TEST_P(HlslIoMap, FromFile)
  131. {
  132. loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  133. Source::HLSL, Semantics::Vulkan,
  134. Target::Spv, GetParam().entryPoint,
  135. GetParam().baseSamplerBinding,
  136. GetParam().baseTextureBinding,
  137. GetParam().baseImageBinding,
  138. GetParam().baseUboBinding,
  139. GetParam().baseSsboBinding,
  140. GetParam().autoMapBindings,
  141. GetParam().flattenUniforms);
  142. }
  143. // GLSL-level Vulkan semantics tests.
  144. TEST_P(GlslIoMap, FromFile)
  145. {
  146. loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
  147. Source::GLSL, Semantics::Vulkan,
  148. Target::Spv, GetParam().entryPoint,
  149. GetParam().baseSamplerBinding,
  150. GetParam().baseTextureBinding,
  151. GetParam().baseImageBinding,
  152. GetParam().baseUboBinding,
  153. GetParam().baseSsboBinding,
  154. GetParam().autoMapBindings,
  155. GetParam().flattenUniforms);
  156. }
  157. #ifdef AMD_EXTENSIONS
  158. // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
  159. // Expected to successfully generate SPIR-V.
  160. TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
  161. {
  162. loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
  163. Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
  164. Target::Spv);
  165. }
  166. #endif
  167. #ifdef NV_EXTENSIONS
  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,
  174. Target::Spv);
  175. }
  176. #endif
  177. TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
  178. {
  179. loadCompileUpgradeTextureToSampledTextureAndDropSamplersAndCheck(GlobalTestSettings.testRoot,
  180. GetParam(),
  181. Source::GLSL,
  182. Semantics::Vulkan,
  183. Target::Spv);
  184. }
  185. // clang-format off
  186. INSTANTIATE_TEST_CASE_P(
  187. Glsl, CompileVulkanToSpirvTest,
  188. ::testing::ValuesIn(std::vector<std::string>({
  189. // Test looping constructs.
  190. // No tests yet for making sure break and continue from a nested loop
  191. // goes to the innermost target.
  192. "spv.barrier.vert",
  193. "spv.do-simple.vert",
  194. "spv.do-while-continue-break.vert",
  195. "spv.for-complex-condition.vert",
  196. "spv.for-continue-break.vert",
  197. "spv.for-simple.vert",
  198. "spv.for-notest.vert",
  199. "spv.for-nobody.vert",
  200. "spv.while-continue-break.vert",
  201. "spv.while-simple.vert",
  202. // vulkan-specific tests
  203. "spv.set.vert",
  204. "spv.double.comp",
  205. "spv.100ops.frag",
  206. "spv.130.frag",
  207. "spv.140.frag",
  208. "spv.150.geom",
  209. "spv.150.vert",
  210. "spv.16bitstorage.frag",
  211. "spv.16bitstorage_Error.frag",
  212. "spv.16bitstorage-int.frag",
  213. "spv.16bitstorage_Error-int.frag",
  214. "spv.16bitstorage-uint.frag",
  215. "spv.16bitstorage_Error-uint.frag",
  216. "spv.300BuiltIns.vert",
  217. "spv.300layout.frag",
  218. "spv.300layout.vert",
  219. "spv.300layoutp.vert",
  220. "spv.310.comp",
  221. "spv.310.bitcast.frag",
  222. "spv.330.geom",
  223. "spv.400.frag",
  224. "spv.400.tesc",
  225. "spv.400.tese",
  226. "spv.420.geom",
  227. "spv.430.frag",
  228. "spv.430.vert",
  229. "spv.450.tesc",
  230. "spv.450.geom",
  231. "spv.450.noRedecl.tesc",
  232. "spv.8bitstorage-int.frag",
  233. "spv.8bitstorage_Error-int.frag",
  234. "spv.8bitstorage-uint.frag",
  235. "spv.8bitstorage_Error-uint.frag",
  236. "spv.8bitstorage-ubo.vert",
  237. "spv.8bitstorage-ssbo.vert",
  238. "spv.accessChain.frag",
  239. "spv.aggOps.frag",
  240. "spv.always-discard.frag",
  241. "spv.always-discard2.frag",
  242. "spv.arbPostDepthCoverage.frag",
  243. "spv.arbPostDepthCoverage_Error.frag",
  244. "spv.bitCast.frag",
  245. "spv.bool.vert",
  246. "spv.boolInBlock.frag",
  247. "spv.branch-return.vert",
  248. "spv.bufferhandle1.frag",
  249. "spv.bufferhandle10.frag",
  250. "spv.bufferhandle11.frag",
  251. "spv.bufferhandle12.frag",
  252. "spv.bufferhandle13.frag",
  253. "spv.bufferhandle14.frag",
  254. "spv.bufferhandle15.frag",
  255. "spv.bufferhandle2.frag",
  256. "spv.bufferhandle3.frag",
  257. "spv.bufferhandle4.frag",
  258. "spv.bufferhandle5.frag",
  259. "spv.bufferhandle6.frag",
  260. "spv.bufferhandle7.frag",
  261. "spv.bufferhandle8.frag",
  262. "spv.bufferhandle9.frag",
  263. "spv.bufferhandle_Error.frag",
  264. "spv.builtInXFB.vert",
  265. "spv.conditionalDiscard.frag",
  266. "spv.constStruct.vert",
  267. "spv.controlFlowAttributes.frag",
  268. "spv.conversion.frag",
  269. "spv.dataOut.frag",
  270. "spv.dataOutIndirect.frag",
  271. "spv.dataOutIndirect.vert",
  272. "spv.deepRvalue.frag",
  273. "spv.depthOut.frag",
  274. "spv.discard-dce.frag",
  275. "spv.doWhileLoop.frag",
  276. "spv.earlyReturnDiscard.frag",
  277. "spv.extPostDepthCoverage.frag",
  278. "spv.extPostDepthCoverage_Error.frag",
  279. "spv.flowControl.frag",
  280. "spv.forLoop.frag",
  281. "spv.forwardFun.frag",
  282. "spv.fragmentDensity.frag",
  283. "spv.fragmentDensity.vert",
  284. "spv.fragmentDensity-es.frag",
  285. "spv.fragmentDensity-neg.frag",
  286. "spv.fullyCovered.frag",
  287. "spv.functionCall.frag",
  288. "spv.functionNestedOpaque.vert",
  289. "spv.functionSemantics.frag",
  290. "spv.GeometryShaderPassthrough.geom",
  291. "spv.interpOps.frag",
  292. "spv.int64.frag",
  293. "spv.intOps.vert",
  294. "spv.layoutNested.vert",
  295. "spv.length.frag",
  296. "spv.localAggregates.frag",
  297. "spv.loops.frag",
  298. "spv.loopsArtificial.frag",
  299. "spv.matFun.vert",
  300. "spv.matrix.frag",
  301. "spv.matrix2.frag",
  302. "spv.memoryQualifier.frag",
  303. "spv.merge-unreachable.frag",
  304. "spv.multiStruct.comp",
  305. "spv.multiStructFuncall.frag",
  306. "spv.newTexture.frag",
  307. "spv.noDeadDecorations.vert",
  308. "spv.nonSquare.vert",
  309. "spv.nonuniform.frag",
  310. "spv.noWorkgroup.comp",
  311. "spv.offsets.frag",
  312. "spv.Operations.frag",
  313. "spv.paramMemory.frag",
  314. "spv.precision.frag",
  315. "spv.precisionNonESSamp.frag",
  316. "spv.prepost.frag",
  317. "spv.qualifiers.vert",
  318. "spv.sample.frag",
  319. "spv.sampleId.frag",
  320. "spv.samplePosition.frag",
  321. "spv.sampleMaskOverrideCoverage.frag",
  322. "spv.scalarlayout.frag",
  323. "spv.scalarlayoutfloat16.frag",
  324. "spv.shaderBallot.comp",
  325. "spv.shaderDrawParams.vert",
  326. "spv.shaderGroupVote.comp",
  327. "spv.shaderStencilExport.frag",
  328. "spv.shiftOps.frag",
  329. "spv.simpleFunctionCall.frag",
  330. "spv.simpleMat.vert",
  331. "spv.sparseTexture.frag",
  332. "spv.sparseTextureClamp.frag",
  333. "spv.structAssignment.frag",
  334. "spv.structDeref.frag",
  335. "spv.structure.frag",
  336. "spv.switch.frag",
  337. "spv.swizzle.frag",
  338. "spv.swizzleInversion.frag",
  339. "spv.test.frag",
  340. "spv.test.vert",
  341. "spv.texture.frag",
  342. "spv.texture.vert",
  343. "spv.textureBuffer.vert",
  344. "spv.image.frag",
  345. "spv.types.frag",
  346. "spv.uint.frag",
  347. "spv.uniformArray.frag",
  348. "spv.variableArrayIndex.frag",
  349. "spv.varyingArray.frag",
  350. "spv.varyingArrayIndirect.frag",
  351. "spv.vecMatConstruct.frag",
  352. "spv.voidFunction.frag",
  353. "spv.whileLoop.frag",
  354. "spv.AofA.frag",
  355. "spv.queryL.frag",
  356. "spv.separate.frag",
  357. "spv.shortCircuit.frag",
  358. "spv.pushConstant.vert",
  359. "spv.pushConstantAnon.vert",
  360. "spv.subpass.frag",
  361. "spv.specConstant.vert",
  362. "spv.specConstant.comp",
  363. "spv.specConstantComposite.vert",
  364. "spv.specConstantOperations.vert",
  365. "spv.storageBuffer.vert",
  366. "spv.precise.tese",
  367. "spv.precise.tesc",
  368. "spv.vulkan100.subgroupArithmetic.comp",
  369. "spv.vulkan100.subgroupPartitioned.comp",
  370. "spv.xfb.vert",
  371. "spv.xfb2.vert",
  372. "spv.xfb3.vert",
  373. "spv.samplerlessTextureFunctions.frag",
  374. })),
  375. FileNameAsCustomTestSuffix
  376. );
  377. // clang-format off
  378. INSTANTIATE_TEST_CASE_P(
  379. Glsl, CompileVulkanToDebugSpirvTest,
  380. ::testing::ValuesIn(std::vector<std::string>({
  381. "spv.pp.line.frag",
  382. })),
  383. FileNameAsCustomTestSuffix
  384. );
  385. // clang-format off
  386. INSTANTIATE_TEST_CASE_P(
  387. Glsl, CompileVulkan1_1ToSpirvTest,
  388. ::testing::ValuesIn(std::vector<std::string>({
  389. "spv.1.3.8bitstorage-ubo.vert",
  390. "spv.1.3.8bitstorage-ssbo.vert",
  391. "spv.deviceGroup.frag",
  392. "spv.drawParams.vert",
  393. "spv.int8.frag",
  394. "spv.vulkan110.int16.frag",
  395. "spv.int32.frag",
  396. "spv.explicittypes.frag",
  397. "spv.float32.frag",
  398. "spv.float64.frag",
  399. "spv.memoryScopeSemantics.comp",
  400. "spv.memoryScopeSemantics_Error.comp",
  401. "spv.multiView.frag",
  402. "spv.RayGenShader11.rgen",
  403. "spv.subgroup.frag",
  404. "spv.subgroup.geom",
  405. "spv.subgroup.tesc",
  406. "spv.subgroup.tese",
  407. "spv.subgroup.vert",
  408. "spv.subgroupArithmetic.comp",
  409. "spv.subgroupBasic.comp",
  410. "spv.subgroupBallot.comp",
  411. "spv.subgroupBallotNeg.comp",
  412. "spv.subgroupClustered.comp",
  413. "spv.subgroupClusteredNeg.comp",
  414. "spv.subgroupPartitioned.comp",
  415. "spv.subgroupShuffle.comp",
  416. "spv.subgroupShuffleRelative.comp",
  417. "spv.subgroupQuad.comp",
  418. "spv.subgroupVote.comp",
  419. "spv.vulkan110.storageBuffer.vert",
  420. })),
  421. FileNameAsCustomTestSuffix
  422. );
  423. // clang-format off
  424. INSTANTIATE_TEST_CASE_P(
  425. Hlsl, HlslIoMap,
  426. ::testing::ValuesIn(std::vector<IoMapData>{
  427. { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
  428. { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
  429. { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
  430. { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
  431. { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
  432. { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
  433. { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
  434. { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
  435. { "spv.register.autoassign.rangetest.frag", "main",
  436. glslang::TQualifier::layoutBindingEnd-2,
  437. glslang::TQualifier::layoutBindingEnd+5,
  438. 20, 30, true, false },
  439. }),
  440. FileNameAsCustomTestSuffixIoMap
  441. );
  442. // clang-format off
  443. INSTANTIATE_TEST_CASE_P(
  444. Hlsl, GlslIoMap,
  445. ::testing::ValuesIn(std::vector<IoMapData>{
  446. { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
  447. { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
  448. }),
  449. FileNameAsCustomTestSuffixIoMap
  450. );
  451. // clang-format off
  452. INSTANTIATE_TEST_CASE_P(
  453. Glsl, CompileOpenGLToSpirvTest,
  454. ::testing::ValuesIn(std::vector<std::string>({
  455. "spv.460.frag",
  456. "spv.460.vert",
  457. "spv.460.comp",
  458. "spv.atomic.comp",
  459. "spv.glFragColor.frag",
  460. "spv.rankShift.comp",
  461. "spv.specConst.vert",
  462. "spv.OVR_multiview.vert",
  463. "spv.xfbOffsetOnBlockMembersAssignment.vert",
  464. "spv.xfbOffsetOnStructMembersAssignment.vert",
  465. "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
  466. "spv.xfbStrideJustOnce.vert",
  467. })),
  468. FileNameAsCustomTestSuffix
  469. );
  470. INSTANTIATE_TEST_CASE_P(
  471. Glsl, VulkanSemantics,
  472. ::testing::ValuesIn(std::vector<std::string>({
  473. "vulkan.frag",
  474. "vulkan.vert",
  475. "vulkan.comp",
  476. "samplerlessTextureFunctions.frag",
  477. })),
  478. FileNameAsCustomTestSuffix
  479. );
  480. INSTANTIATE_TEST_CASE_P(
  481. Glsl, OpenGLSemantics,
  482. ::testing::ValuesIn(std::vector<std::string>({
  483. "glspv.esversion.vert",
  484. "glspv.version.frag",
  485. "glspv.version.vert",
  486. "glspv.frag",
  487. "glspv.vert",
  488. })),
  489. FileNameAsCustomTestSuffix
  490. );
  491. INSTANTIATE_TEST_CASE_P(
  492. Glsl, VulkanAstSemantics,
  493. ::testing::ValuesIn(std::vector<std::string>({
  494. "vulkan.ast.vert",
  495. })),
  496. FileNameAsCustomTestSuffix
  497. );
  498. #ifdef AMD_EXTENSIONS
  499. INSTANTIATE_TEST_CASE_P(
  500. Glsl, CompileVulkanToSpirvTestAMD,
  501. ::testing::ValuesIn(std::vector<std::string>({
  502. "spv.float16.frag",
  503. "spv.float16Fetch.frag",
  504. "spv.imageLoadStoreLod.frag",
  505. "spv.int16.frag",
  506. "spv.int16.amd.frag",
  507. "spv.shaderBallotAMD.comp",
  508. "spv.shaderFragMaskAMD.frag",
  509. "spv.textureGatherBiasLod.frag",
  510. })),
  511. FileNameAsCustomTestSuffix
  512. );
  513. #endif
  514. #ifdef NV_EXTENSIONS
  515. INSTANTIATE_TEST_CASE_P(
  516. Glsl, CompileVulkanToSpirvTestNV,
  517. ::testing::ValuesIn(std::vector<std::string>({
  518. "spv.sampleMaskOverrideCoverage.frag",
  519. "spv.GeometryShaderPassthrough.geom",
  520. "spv.viewportArray2.vert",
  521. "spv.viewportArray2.tesc",
  522. "spv.stereoViewRendering.vert",
  523. "spv.stereoViewRendering.tesc",
  524. "spv.multiviewPerViewAttributes.vert",
  525. "spv.multiviewPerViewAttributes.tesc",
  526. "spv.atomicInt64.comp",
  527. "spv.shadingRate.frag",
  528. "spv.RayGenShader.rgen",
  529. "spv.RayGenShader_Errors.rgen",
  530. "spv.RayConstants.rgen",
  531. "spv.IntersectShader.rint",
  532. "spv.IntersectShader_Errors.rint",
  533. "spv.AnyHitShader.rahit",
  534. "spv.AnyHitShader_Errors.rahit",
  535. "spv.ClosestHitShader.rchit",
  536. "spv.ClosestHitShader_Errors.rchit",
  537. "spv.MissShader.rmiss",
  538. "spv.MissShader_Errors.rmiss",
  539. "spv.RayCallable.rcall",
  540. "spv.RayCallable_Errors.rcall",
  541. "spv.fragmentShaderBarycentric.frag",
  542. "spv.fragmentShaderBarycentric2.frag",
  543. "spv.computeShaderDerivatives.comp",
  544. "spv.computeShaderDerivatives2.comp",
  545. "spv.shaderImageFootprint.frag",
  546. "spv.meshShaderBuiltins.mesh",
  547. "spv.meshShaderUserDefined.mesh",
  548. "spv.meshShaderPerViewBuiltins.mesh",
  549. "spv.meshShaderPerViewUserDefined.mesh",
  550. "spv.meshShaderSharedMem.mesh",
  551. "spv.meshShaderTaskMem.mesh",
  552. "spv.320.meshShaderUserDefined.mesh",
  553. "spv.meshShaderRedeclBuiltins.mesh",
  554. "spv.meshShaderRedeclPerViewBuiltins.mesh",
  555. "spv.meshTaskShader.task",
  556. "spv.perprimitiveNV.frag",
  557. })),
  558. FileNameAsCustomTestSuffix
  559. );
  560. #endif
  561. INSTANTIATE_TEST_CASE_P(
  562. Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
  563. ::testing::ValuesIn(std::vector<std::string>({
  564. "spv.texture.sampler.transform.frag",
  565. })),
  566. FileNameAsCustomTestSuffix
  567. );
  568. // clang-format on
  569. } // anonymous namespace
  570. } // namespace glslangtest