2 // Copyright (C) 2016 Google, Inc.
3 // Copyright (C) 2019 ARM Limited.
4 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
6 // All rights reserved.
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
15 // Redistributions in binary form must reproduce the above
16 // copyright notice, this list of conditions and the following
17 // disclaimer in the documentation and/or other materials provided
18 // with the distribution.
20 // Neither the name of Google Inc. nor the names of its
21 // contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 // POSSIBILITY OF SUCH DAMAGE.
39 #include <gtest/gtest.h>
41 #include "TestFixture.h"
43 namespace glslangtest {
48 const char* entryPoint;
49 int baseSamplerBinding;
50 int baseTextureBinding;
58 std::string FileNameAsCustomTestSuffixIoMap(
59 const ::testing::TestParamInfo<IoMapData>& info) {
60 std::string name = info.param.fileName;
61 // A valid test case suffix cannot have '.' and '-' inside.
62 std::replace(name.begin(), name.end(), '.', '_');
63 std::replace(name.begin(), name.end(), '-', '_');
67 using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
68 using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithParam<std::string>>;
69 using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
70 using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
71 using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
72 using CompileToSpirv16Test = GlslangTest<::testing::TestWithParam<std::string>>;
73 using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
74 using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
75 using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
76 using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
77 using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
78 using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
79 using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
80 using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
81 using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam<std::string>>;
82 using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
84 // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
86 TEST_P(CompileVulkanToSpirvTest, FromFile)
88 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
89 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
93 TEST_P(CompileVulkanToSpirvDeadCodeElimTest, FromFile)
95 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
96 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
100 // Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
101 // to successfully generate SPIR-V.
102 TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
104 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
105 Source::GLSL, Semantics::Vulkan,
106 glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
107 Target::Spv, true, "",
108 "/baseResults/", false, true);
112 TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
114 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
115 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
119 TEST_P(CompileToSpirv14Test, FromFile)
121 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
122 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
126 TEST_P(CompileToSpirv16Test, FromFile)
128 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
129 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_3, glslang::EShTargetSpv_1_6,
133 // Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
135 TEST_P(CompileOpenGLToSpirvTest, FromFile)
137 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
138 Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
142 // GLSL-level Vulkan semantics test. Expected to error out before generating
144 TEST_P(VulkanSemantics, FromFile)
146 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
147 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
151 // GLSL-level Vulkan semantics test. Expected to error out before generating
153 TEST_P(OpenGLSemantics, FromFile)
155 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
156 Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
160 // GLSL-level Vulkan semantics test that need to see the AST for validation.
161 TEST_P(VulkanAstSemantics, FromFile)
163 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
164 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
168 // HLSL-level Vulkan semantics tests.
169 TEST_P(HlslIoMap, FromFile)
171 loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
172 Source::HLSL, Semantics::Vulkan,
173 Target::Spv, GetParam().entryPoint,
174 GetParam().baseSamplerBinding,
175 GetParam().baseTextureBinding,
176 GetParam().baseImageBinding,
177 GetParam().baseUboBinding,
178 GetParam().baseSsboBinding,
179 GetParam().autoMapBindings,
180 GetParam().flattenUniforms);
183 // GLSL-level Vulkan semantics tests.
184 TEST_P(GlslIoMap, FromFile)
186 loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
187 Source::GLSL, Semantics::Vulkan,
188 Target::Spv, GetParam().entryPoint,
189 GetParam().baseSamplerBinding,
190 GetParam().baseTextureBinding,
191 GetParam().baseImageBinding,
192 GetParam().baseUboBinding,
193 GetParam().baseSsboBinding,
194 GetParam().autoMapBindings,
195 GetParam().flattenUniforms);
198 // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
199 // Expected to successfully generate SPIR-V.
200 TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
202 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
203 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
207 // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
208 // Expected to successfully generate SPIR-V.
209 TEST_P(CompileVulkanToSpirvTestNV, FromFile)
211 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
212 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
216 TEST_P(CompileVulkanToSpirv14TestNV, FromFile)
218 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
219 Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
223 TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
225 loadCompileUpgradeTextureToSampledTextureAndDropSamplersAndCheck(GlobalTestSettings.testRoot,
233 INSTANTIATE_TEST_SUITE_P(
234 Glsl, CompileVulkanToSpirvTest,
235 ::testing::ValuesIn(std::vector<std::string>({
236 // Test looping constructs.
237 // No tests yet for making sure break and continue from a nested loop
238 // goes to the innermost target.
240 "spv.do-simple.vert",
241 "spv.do-while-continue-break.vert",
242 "spv.for-complex-condition.vert",
243 "spv.for-continue-break.vert",
244 "spv.for-simple.vert",
245 "spv.for-notest.vert",
246 "spv.for-nobody.vert",
247 "spv.while-continue-break.vert",
248 "spv.while-simple.vert",
249 // vulkan-specific tests
251 "rayQuery-no-cse.rgen",
252 "rayQuery-initialize.rgen",
253 "rayQuery-allOps.rgen",
254 "rayQuery-allOps.Error.rgen",
255 "rayQuery-committed.Error.rgen",
256 "rayQuery-allOps.comp",
257 "rayQuery-allOps.frag",
258 "rayQuery-initialization.Error.comp",
259 "rayQuery-global.rgen",
260 "rayQuery-types.comp",
261 "rayQuery-OpConvertUToAccelerationStructureKHR.comp",
269 "spv.16bitstorage.frag",
270 "spv.16bitstorage_Error.frag",
271 "spv.16bitstorage-int.frag",
272 "spv.16bitstorage_Error-int.frag",
273 "spv.16bitstorage-uint.frag",
274 "spv.16bitstorage_Error-uint.frag",
275 "spv.300BuiltIns.vert",
276 "spv.300layout.frag",
277 "spv.300layout.vert",
278 "spv.300layoutp.vert",
280 "spv.310.bitcast.frag",
290 "spv.450.noRedecl.tesc",
291 "spv.8bitstorage-int.frag",
292 "spv.8bitstorage_Error-int.frag",
293 "spv.8bitstorage-uint.frag",
294 "spv.8bitstorage_Error-uint.frag",
295 "spv.8bitstorage-ubo.vert",
296 "spv.8bitstorage-ssbo.vert",
297 "spv.8bit-16bit-construction.frag",
298 "spv.accessChain.frag",
300 "spv.always-discard.frag",
301 "spv.always-discard2.frag",
302 "spv.arbPostDepthCoverage.frag",
303 "spv.arbPostDepthCoverage_Error.frag",
304 "spv.atomicCounter.comp",
307 "spv.boolInBlock.frag",
308 "spv.branch-return.vert",
309 "spv.bufferhandle1.frag",
310 "spv.bufferhandle10.frag",
311 "spv.bufferhandle11.frag",
312 "spv.bufferhandle12.frag",
313 "spv.bufferhandle13.frag",
314 "spv.bufferhandle14.frag",
315 "spv.bufferhandle15.frag",
316 "spv.bufferhandle16.frag",
317 "spv.bufferhandle17_Errors.frag",
318 "spv.bufferhandle18.frag",
319 "spv.bufferhandle19_Errors.frag",
320 "spv.bufferhandle2.frag",
321 "spv.bufferhandle3.frag",
322 "spv.bufferhandle4.frag",
323 "spv.bufferhandle5.frag",
324 "spv.bufferhandle6.frag",
325 "spv.bufferhandle7.frag",
326 "spv.bufferhandle8.frag",
327 "spv.bufferhandle9.frag",
328 "spv.bufferhandleUvec2.frag",
329 "spv.bufferhandle_Error.frag",
330 "spv.builtInXFB.vert",
331 "spv.conditionalDemote.frag",
332 "spv.conditionalDiscard.frag",
333 "spv.constructComposite.comp",
334 "spv.constStruct.vert",
335 "spv.constConstruct.vert",
336 "spv.controlFlowAttributes.frag",
337 "spv.conversion.frag",
339 "spv.coopmat_Error.comp",
341 "spv.dataOutIndirect.frag",
342 "spv.dataOutIndirect.vert",
343 "spv.debugPrintf.frag",
344 "spv.debugPrintf_Error.frag",
345 "spv.demoteDisabled.frag",
346 "spv.deepRvalue.frag",
348 "spv.depthUnchanged.frag",
349 "spv.discard-dce.frag",
350 "spv.doWhileLoop.frag",
351 "spv.earlyReturnDiscard.frag",
352 "spv.extPostDepthCoverage.frag",
353 "spv.extPostDepthCoverage_Error.frag",
354 "spv.float16convertonlyarith.comp",
355 "spv.float16convertonlystorage.comp",
356 "spv.flowControl.frag",
358 "spv.forwardFun.frag",
359 "spv.fragmentDensity.frag",
360 "spv.fragmentDensity.vert",
361 "spv.fragmentDensity-es.frag",
362 "spv.fragmentDensity-neg.frag",
364 "spv.fsi_Error.frag",
365 "spv.fullyCovered.frag",
366 "spv.functionCall.frag",
367 "spv.functionNestedOpaque.vert",
368 "spv.functionSemantics.frag",
369 "spv.functionParameterTypes.frag",
370 "spv.GeometryShaderPassthrough.geom",
371 "spv.funcall.array.frag",
372 "spv.load.bool.array.interface.block.frag",
373 "spv.interpOps.frag",
375 "spv.intcoopmat.comp",
377 "spv.intrinsicsSpirvByReference.vert",
378 "spv.intrinsicsSpirvDecorate.frag",
379 "spv.intrinsicsSpirvExecutionMode.frag",
380 "spv.intrinsicsSpirvInstruction.vert",
381 "spv.intrinsicsSpirvLiteral.vert",
382 "spv.intrinsicsSpirvStorageClass.rchit",
383 "spv.intrinsicsSpirvType.rgen",
384 "spv.intrinsicsSpirvTypeLocalVar.vert",
385 "spv.invariantAll.vert",
387 "spv.layoutNested.vert",
389 "spv.localAggregates.frag",
391 "spv.loopsArtificial.frag",
395 "spv.memoryQualifier.frag",
396 "spv.merge-unreachable.frag",
397 "spv.multiStruct.comp",
398 "spv.multiStructFuncall.frag",
399 "spv.newTexture.frag",
400 "spv.noDeadDecorations.vert",
401 "spv.nonSquare.vert",
402 "spv.nonuniform.frag",
403 "spv.nonuniform2.frag",
404 "spv.nonuniform3.frag",
405 "spv.nonuniform4.frag",
406 "spv.nonuniform5.frag",
407 "spv.noWorkgroup.comp",
410 "spv.Operations.frag",
411 "spv.paramMemory.frag",
412 "spv.paramMemory.420.frag",
413 "spv.precision.frag",
414 "spv.precisionArgs.frag",
415 "spv.precisionNonESSamp.frag",
416 "spv.precisionTexture.frag",
418 "spv.privateVariableTypes.frag",
419 "spv.qualifiers.vert",
422 "spv.samplePosition.frag",
423 "spv.sampleMaskOverrideCoverage.frag",
424 "spv.scalarlayout.frag",
425 "spv.scalarlayoutfloat16.frag",
426 "spv.shaderBallot.comp",
427 "spv.shaderDrawParams.vert",
428 "spv.shaderGroupVote.comp",
429 "spv.shaderStencilExport.frag",
431 "spv.simpleFunctionCall.frag",
432 "spv.simpleMat.vert",
433 "spv.sparseTexture.frag",
434 "spv.sparseTextureClamp.frag",
435 "spv.structAssignment.frag",
436 "spv.structDeref.frag",
437 "spv.structure.frag",
440 "spv.swizzleInversion.frag",
445 "spv.textureBuffer.vert",
447 "spv.imageAtomic64.frag",
448 "spv.imageAtomic64.comp",
451 "spv.uniformArray.frag",
452 "spv.variableArrayIndex.frag",
453 "spv.varyingArray.frag",
454 "spv.varyingArrayIndirect.frag",
455 "spv.vecMatConstruct.frag",
456 "spv.voidFunction.frag",
457 "spv.whileLoop.frag",
461 "spv.shortCircuit.frag",
462 "spv.pushConstant.vert",
463 "spv.pushConstantAnon.vert",
465 "spv.specConstant.vert",
466 "spv.specConstant.comp",
467 "spv.specConstantComposite.vert",
468 "spv.specConstantOperations.vert",
469 "spv.specConstant.float16.comp",
470 "spv.specConstant.int16.comp",
471 "spv.specConstant.int8.comp",
472 "spv.storageBuffer.vert",
473 "spv.terminate.frag",
474 "spv.subgroupUniformControlFlow.vert",
477 "spv.viewportindex.tese",
478 "spv.volatileAtomic.comp",
479 "spv.vulkan100.subgroupArithmetic.comp",
480 "spv.vulkan100.subgroupPartitioned.comp",
484 "spv.samplerlessTextureFunctions.frag",
485 "spv.smBuiltins.vert",
486 "spv.smBuiltins.frag",
487 "spv.builtin.PrimitiveShadingRateEXT.vert",
488 "spv.builtin.ShadingRateEXT.frag",
489 "spv.atomicAdd.bufferReference.comp",
490 "spv.fragmentShaderBarycentric3.frag",
491 "spv.fragmentShaderBarycentric4.frag",
493 FileNameAsCustomTestSuffix
496 // Cases with deliberately unreachable code.
497 // By default the compiler will aggressively eliminate
498 // unreachable merges and continues.
499 INSTANTIATE_TEST_SUITE_P(
500 GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
501 ::testing::ValuesIn(std::vector<std::string>({
502 "spv.dead-after-continue.vert",
503 "spv.dead-after-discard.frag",
504 "spv.dead-after-return.vert",
505 "spv.dead-after-loop-break.vert",
506 "spv.dead-after-switch-break.vert",
507 "spv.dead-complex-continue-after-return.vert",
508 "spv.dead-complex-merge-after-return.vert",
510 FileNameAsCustomTestSuffix
514 INSTANTIATE_TEST_SUITE_P(
515 Glsl, CompileVulkanToDebugSpirvTest,
516 ::testing::ValuesIn(std::vector<std::string>({
519 FileNameAsCustomTestSuffix
523 INSTANTIATE_TEST_SUITE_P(
524 Glsl, CompileVulkan1_1ToSpirvTest,
525 ::testing::ValuesIn(std::vector<std::string>({
526 "spv.1.3.8bitstorage-ubo.vert",
527 "spv.1.3.8bitstorage-ssbo.vert",
528 "spv.1.3.coopmat.comp",
529 "spv.deviceGroup.frag",
530 "spv.drawParams.vert",
532 "spv.vulkan110.int16.frag",
534 "spv.explicittypes.frag",
535 "spv.float16NoRelaxed.vert",
538 "spv.memoryScopeSemantics.comp",
539 "spv.memoryScopeSemantics_Error.comp",
540 "spv.multiView.frag",
541 "spv.queueFamilyScope.comp",
542 "spv.RayGenShader11.rgen",
548 "spv.subgroupArithmetic.comp",
549 "spv.subgroupBasic.comp",
550 "spv.subgroupBallot.comp",
551 "spv.subgroupBallotNeg.comp",
552 "spv.subgroupClustered.comp",
553 "spv.subgroupClusteredNeg.comp",
554 "spv.subgroupPartitioned.comp",
555 "spv.subgroupShuffle.comp",
556 "spv.subgroupShuffleRelative.comp",
557 "spv.subgroupQuad.comp",
558 "spv.subgroupVote.comp",
559 "spv.subgroupExtendedTypesArithmetic.comp",
560 "spv.subgroupExtendedTypesArithmeticNeg.comp",
561 "spv.subgroupExtendedTypesBallot.comp",
562 "spv.subgroupExtendedTypesBallotNeg.comp",
563 "spv.subgroupExtendedTypesClustered.comp",
564 "spv.subgroupExtendedTypesClusteredNeg.comp",
565 "spv.subgroupExtendedTypesPartitioned.comp",
566 "spv.subgroupExtendedTypesPartitionedNeg.comp",
567 "spv.subgroupExtendedTypesShuffle.comp",
568 "spv.subgroupExtendedTypesShuffleNeg.comp",
569 "spv.subgroupExtendedTypesShuffleRelative.comp",
570 "spv.subgroupExtendedTypesShuffleRelativeNeg.comp",
571 "spv.subgroupExtendedTypesQuad.comp",
572 "spv.subgroupExtendedTypesQuadNeg.comp",
573 "spv.subgroupExtendedTypesVote.comp",
574 "spv.subgroupExtendedTypesVoteNeg.comp",
575 "spv.vulkan110.storageBuffer.vert",
577 FileNameAsCustomTestSuffix
581 INSTANTIATE_TEST_SUITE_P(
582 Glsl, CompileToSpirv14Test,
583 ::testing::ValuesIn(std::vector<std::string>({
584 "spv.1.4.LoopControl.frag",
585 "spv.1.4.NonWritable.frag",
586 "spv.1.4.OpEntryPoint.frag",
587 "spv.1.4.OpEntryPoint.opaqueParams.vert",
588 "spv.1.4.OpSelect.frag",
589 "spv.1.4.OpCopyLogical.comp",
590 "spv.1.4.OpCopyLogicalBool.comp",
591 "spv.1.4.OpCopyLogical.funcall.frag",
592 "spv.1.4.funcall.array.frag",
593 "spv.1.4.load.bool.array.interface.block.frag",
594 "spv.1.4.image.frag",
595 "spv.1.4.sparseTexture.frag",
596 "spv.1.4.texture.frag",
597 "spv.1.4.constructComposite.comp",
598 "spv.ext.AnyHitShader.rahit",
599 "spv.ext.AnyHitShader_Errors.rahit",
600 "spv.ext.ClosestHitShader.rchit",
601 "spv.ext.ClosestHitShader_Subgroup.rchit",
602 "spv.ext.ClosestHitShader_Errors.rchit",
603 "spv.ext.IntersectShader.rint",
604 "spv.ext.IntersectShader_Errors.rint",
605 "spv.ext.MissShader.rmiss",
606 "spv.ext.MissShader_Errors.rmiss",
607 "spv.ext.RayPrimCull_Errors.rgen",
608 "spv.ext.RayCallable.rcall",
609 "spv.ext.RayCallable_Errors.rcall",
610 "spv.ext.RayConstants.rgen",
611 "spv.ext.RayGenShader.rgen",
612 "spv.ext.RayGenShader_Errors.rgen",
613 "spv.ext.RayGenShader11.rgen",
614 "spv.ext.RayGenShaderArray.rgen",
615 "spv.ext.RayGenSBTlayout.rgen",
616 "spv.ext.RayGenSBTlayout140.rgen",
617 "spv.ext.RayGenSBTlayout430.rgen",
618 "spv.ext.RayGenSBTlayoutscalar.rgen",
619 "spv.ext.World3x4.rahit",
620 "spv.ext.AccelDecl.frag",
621 "spv.ext.RayQueryDecl.frag",
623 // SPV_KHR_workgroup_memory_explicit_layout depends on SPIR-V 1.4.
624 "spv.WorkgroupMemoryExplicitLayout.SingleBlock.comp",
625 "spv.WorkgroupMemoryExplicitLayout.MultiBlock.comp",
626 "spv.WorkgroupMemoryExplicitLayout.8BitAccess.comp",
627 "spv.WorkgroupMemoryExplicitLayout.16BitAccess.comp",
628 "spv.WorkgroupMemoryExplicitLayout.NonBlock.comp",
629 "spv.WorkgroupMemoryExplicitLayout.MixBlockNonBlock_Errors.comp",
630 "spv.WorkgroupMemoryExplicitLayout.std140.comp",
631 "spv.WorkgroupMemoryExplicitLayout.std430.comp",
632 "spv.WorkgroupMemoryExplicitLayout.scalar.comp",
634 // SPV_EXT_mesh_shader
635 "spv.ext.meshShaderBuiltins.mesh",
636 "spv.ext.meshShaderRedeclBuiltins.mesh",
637 "spv.ext.meshShaderTaskMem.mesh",
638 "spv.ext.meshShaderUserDefined.mesh",
639 "spv.ext.meshTaskShader.task",
640 "spv.atomiAddEXT.error.mesh",
641 "spv.atomiAddEXT.task",
642 "spv.460.subgroupEXT.task",
643 "spv.460.subgroupEXT.mesh",
645 FileNameAsCustomTestSuffix
649 INSTANTIATE_TEST_SUITE_P(
650 Glsl, CompileToSpirv16Test,
651 ::testing::ValuesIn(std::vector<std::string>({
652 "spv.1.6.conditionalDiscard.frag",
653 "spv.1.6.helperInvocation.frag",
654 "spv.1.6.specConstant.comp",
655 "spv.1.6.samplerBuffer.frag",
656 "spv.1.6.separate.frag",
658 FileNameAsCustomTestSuffix
663 INSTANTIATE_TEST_SUITE_P(
665 ::testing::ValuesIn(std::vector<IoMapData>{
666 { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
667 { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
668 { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
669 { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
670 { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
671 { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
672 { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
673 { "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
674 { "spv.register.autoassign.rangetest.frag", "main",
675 glslang::TQualifier::layoutBindingEnd-2,
676 glslang::TQualifier::layoutBindingEnd+5,
677 20, 30, true, false },
679 FileNameAsCustomTestSuffixIoMap
683 INSTANTIATE_TEST_SUITE_P(
685 ::testing::ValuesIn(std::vector<IoMapData>{
686 { "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
687 { "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
689 FileNameAsCustomTestSuffixIoMap
693 INSTANTIATE_TEST_SUITE_P(
694 Glsl, CompileOpenGLToSpirvTest,
695 ::testing::ValuesIn(std::vector<std::string>({
700 "spv.atomicFloat.comp",
701 "spv.atomicFloat_Error.comp",
702 "spv.glFragColor.frag",
703 "spv.rankShift.comp",
704 "spv.specConst.vert",
705 "spv.specTexture.frag",
706 "spv.OVR_multiview.vert",
707 "spv.uniformInitializer.frag",
708 "spv.uniformInitializerSpecConstant.frag",
709 "spv.uniformInitializerStruct.frag",
710 "spv.xfbOffsetOnBlockMembersAssignment.vert",
711 "spv.xfbOffsetOnStructMembersAssignment.vert",
712 "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
713 "spv.xfbStrideJustOnce.vert",
715 FileNameAsCustomTestSuffix
718 INSTANTIATE_TEST_SUITE_P(
719 Glsl, VulkanSemantics,
720 ::testing::ValuesIn(std::vector<std::string>({
724 "samplerlessTextureFunctions.frag",
725 "spv.specConstArrayCheck.vert",
727 FileNameAsCustomTestSuffix
730 INSTANTIATE_TEST_SUITE_P(
731 Glsl, OpenGLSemantics,
732 ::testing::ValuesIn(std::vector<std::string>({
733 "glspv.esversion.vert",
734 "glspv.version.frag",
735 "glspv.version.vert",
739 FileNameAsCustomTestSuffix
742 INSTANTIATE_TEST_SUITE_P(
743 Glsl, VulkanAstSemantics,
744 ::testing::ValuesIn(std::vector<std::string>({
747 FileNameAsCustomTestSuffix
750 INSTANTIATE_TEST_SUITE_P(
751 Glsl, CompileVulkanToSpirvTestAMD,
752 ::testing::ValuesIn(std::vector<std::string>({
755 "spv.float16Fetch.frag",
756 "spv.imageLoadStoreLod.frag",
758 "spv.int16.amd.frag",
759 "spv.shaderBallotAMD.comp",
760 "spv.shaderFragMaskAMD.frag",
761 "spv.textureGatherBiasLod.frag",
763 FileNameAsCustomTestSuffix
766 INSTANTIATE_TEST_SUITE_P(
767 Glsl, CompileVulkanToSpirvTestNV,
768 ::testing::ValuesIn(std::vector<std::string>({
769 "spv.sampleMaskOverrideCoverage.frag",
770 "spv.GeometryShaderPassthrough.geom",
771 "spv.viewportArray2.vert",
772 "spv.viewportArray2.tesc",
773 "spv.stereoViewRendering.vert",
774 "spv.stereoViewRendering.tesc",
775 "spv.multiviewPerViewAttributes.vert",
776 "spv.multiviewPerViewAttributes.tesc",
777 "spv.atomicInt64.comp",
778 "spv.atomicStoreInt64.comp",
779 "spv.shadingRate.frag",
780 "spv.RayGenShader.rgen",
781 "spv.RayGenShaderArray.rgen",
782 "spv.RayGenShader_Errors.rgen",
783 "spv.RayConstants.rgen",
784 "spv.IntersectShader.rint",
785 "spv.IntersectShader_Errors.rint",
786 "spv.AnyHitShader.rahit",
787 "spv.AnyHitShader_Errors.rahit",
788 "spv.ClosestHitShader.rchit",
789 "spv.ClosestHitShader_Errors.rchit",
790 "spv.MissShader.rmiss",
791 "spv.MissShader_Errors.rmiss",
792 "spv.RayCallable.rcall",
793 "spv.RayCallable_Errors.rcall",
794 "spv.fragmentShaderBarycentric.frag",
795 "spv.fragmentShaderBarycentric2.frag",
796 "spv.computeShaderDerivatives.comp",
797 "spv.computeShaderDerivatives2.comp",
798 "spv.shaderImageFootprint.frag",
799 "spv.meshShaderBuiltins.mesh",
800 "spv.meshShaderUserDefined.mesh",
801 "spv.meshShaderPerViewBuiltins.mesh",
802 "spv.meshShaderPerViewUserDefined.mesh",
803 "spv.meshShaderPerView_Errors.mesh",
804 "spv.meshShaderSharedMem.mesh",
805 "spv.meshShaderTaskMem.mesh",
806 "spv.320.meshShaderUserDefined.mesh",
807 "spv.meshShaderRedeclBuiltins.mesh",
808 "spv.meshShaderRedeclPerViewBuiltins.mesh",
809 "spv.meshTaskShader.task",
810 "spv.perprimitiveNV.frag",
812 FileNameAsCustomTestSuffix
815 INSTANTIATE_TEST_SUITE_P(
816 Glsl, CompileVulkanToSpirv14TestNV,
817 ::testing::ValuesIn(std::vector<std::string>({
818 "spv.RayGenShaderMotion.rgen",
819 "spv.IntersectShaderMotion.rint",
820 "spv.AnyHitShaderMotion.rahit",
821 "spv.ClosestHitShaderMotion.rchit",
822 "spv.MissShaderMotion.rmiss",
824 FileNameAsCustomTestSuffix
826 INSTANTIATE_TEST_SUITE_P(
827 Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
828 ::testing::ValuesIn(std::vector<std::string>({
829 "spv.texture.sampler.transform.frag",
831 FileNameAsCustomTestSuffix
835 } // anonymous namespace
836 } // namespace glslangtest