Spv.FromFile.cpp 26 KB

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