diff options
Diffstat (limited to '3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp')
-rw-r--r-- | 3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp | 139 |
1 files changed, 117 insertions, 22 deletions
diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp index 1e17736fc4d..d0c075156a6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp @@ -63,19 +63,17 @@ std::string FileNameAsCustomTestSuffixIoMap( } using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; +using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; +using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>; using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>; using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>; using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>; using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>; using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>; -#ifdef AMD_EXTENSIONS using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>; -#endif -#ifdef NV_EXTENSIONS using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>; -#endif using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>; // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully @@ -83,14 +81,32 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t TEST_P(CompileVulkanToSpirvTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv); } +// Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected +// to successfully generate SPIR-V. +TEST_P(CompileVulkanToDebugSpirvTest, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::Vulkan, + glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, + Target::Spv, true, "", + "/baseResults/", false, true); +} + TEST_P(CompileVulkan1_1ToSpirvTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3, + Target::Spv); +} + +TEST_P(CompileToSpirv14Test, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4, Target::Spv); } @@ -99,7 +115,7 @@ TEST_P(CompileVulkan1_1ToSpirvTest, FromFile) TEST_P(CompileOpenGLToSpirvTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv); } @@ -108,7 +124,7 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile) TEST_P(VulkanSemantics, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv, false); } @@ -117,7 +133,7 @@ TEST_P(VulkanSemantics, FromFile) TEST_P(OpenGLSemantics, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv, false); } @@ -125,7 +141,7 @@ TEST_P(OpenGLSemantics, FromFile) TEST_P(VulkanAstSemantics, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::AST); } @@ -159,27 +175,23 @@ TEST_P(GlslIoMap, FromFile) GetParam().flattenUniforms); } -#ifdef AMD_EXTENSIONS // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestAMD, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv); } -#endif -#ifdef NV_EXTENSIONS // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestNV, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv); } -#endif TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile) { @@ -253,14 +265,41 @@ INSTANTIATE_TEST_CASE_P( "spv.bool.vert", "spv.boolInBlock.frag", "spv.branch-return.vert", + "spv.bufferhandle1.frag", + "spv.bufferhandle10.frag", + "spv.bufferhandle11.frag", + "spv.bufferhandle12.frag", + "spv.bufferhandle13.frag", + "spv.bufferhandle14.frag", + "spv.bufferhandle15.frag", + "spv.bufferhandle16.frag", + "spv.bufferhandle17_Errors.frag", + "spv.bufferhandle18.frag", + "spv.bufferhandle19_Errors.frag", + "spv.bufferhandle2.frag", + "spv.bufferhandle3.frag", + "spv.bufferhandle4.frag", + "spv.bufferhandle5.frag", + "spv.bufferhandle6.frag", + "spv.bufferhandle7.frag", + "spv.bufferhandle8.frag", + "spv.bufferhandle9.frag", + "spv.bufferhandleUvec2.frag", + "spv.bufferhandle_Error.frag", "spv.builtInXFB.vert", + "spv.conditionalDemote.frag", "spv.conditionalDiscard.frag", + "spv.constructComposite.comp", "spv.constStruct.vert", + "spv.constConstruct.vert", "spv.controlFlowAttributes.frag", "spv.conversion.frag", + "spv.coopmat.comp", + "spv.coopmat_Error.comp", "spv.dataOut.frag", "spv.dataOutIndirect.frag", "spv.dataOutIndirect.vert", + "spv.demoteDisabled.frag", "spv.deepRvalue.frag", "spv.depthOut.frag", "spv.discard-dce.frag", @@ -268,6 +307,8 @@ INSTANTIATE_TEST_CASE_P( "spv.earlyReturnDiscard.frag", "spv.extPostDepthCoverage.frag", "spv.extPostDepthCoverage_Error.frag", + "spv.float16convertonlyarith.comp", + "spv.float16convertonlystorage.comp", "spv.flowControl.frag", "spv.forLoop.frag", "spv.forwardFun.frag", @@ -275,13 +316,17 @@ INSTANTIATE_TEST_CASE_P( "spv.fragmentDensity.vert", "spv.fragmentDensity-es.frag", "spv.fragmentDensity-neg.frag", + "spv.fsi.frag", + "spv.fsi_Error.frag", "spv.fullyCovered.frag", "spv.functionCall.frag", "spv.functionNestedOpaque.vert", "spv.functionSemantics.frag", + "spv.functionParameterTypes.frag", "spv.GeometryShaderPassthrough.geom", "spv.interpOps.frag", "spv.int64.frag", + "spv.intcoopmat.comp", "spv.intOps.vert", "spv.layoutNested.vert", "spv.length.frag", @@ -292,8 +337,6 @@ INSTANTIATE_TEST_CASE_P( "spv.matrix.frag", "spv.matrix2.frag", "spv.memoryQualifier.frag", - "spv.memoryScopeSemantics.comp", - "spv.memoryScopeSemantics_Error.comp", "spv.merge-unreachable.frag", "spv.multiStruct.comp", "spv.multiStructFuncall.frag", @@ -301,6 +344,7 @@ INSTANTIATE_TEST_CASE_P( "spv.noDeadDecorations.vert", "spv.nonSquare.vert", "spv.nonuniform.frag", + "spv.nonuniform2.frag", "spv.noWorkgroup.comp", "spv.offsets.frag", "spv.Operations.frag", @@ -308,6 +352,7 @@ INSTANTIATE_TEST_CASE_P( "spv.precision.frag", "spv.precisionNonESSamp.frag", "spv.prepost.frag", + "spv.privateVariableTypes.frag", "spv.qualifiers.vert", "spv.sample.frag", "spv.sampleId.frag", @@ -365,6 +410,17 @@ INSTANTIATE_TEST_CASE_P( "spv.xfb2.vert", "spv.xfb3.vert", "spv.samplerlessTextureFunctions.frag", + "spv.smBuiltins.vert", + "spv.smBuiltins.frag", + })), + FileNameAsCustomTestSuffix +); + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, CompileVulkanToDebugSpirvTest, + ::testing::ValuesIn(std::vector<std::string>({ + "spv.pp.line.frag", })), FileNameAsCustomTestSuffix ); @@ -375,6 +431,7 @@ INSTANTIATE_TEST_CASE_P( ::testing::ValuesIn(std::vector<std::string>({ "spv.1.3.8bitstorage-ubo.vert", "spv.1.3.8bitstorage-ssbo.vert", + "spv.1.3.coopmat.comp", "spv.deviceGroup.frag", "spv.drawParams.vert", "spv.int8.frag", @@ -383,7 +440,10 @@ INSTANTIATE_TEST_CASE_P( "spv.explicittypes.frag", "spv.float32.frag", "spv.float64.frag", + "spv.memoryScopeSemantics.comp", + "spv.memoryScopeSemantics_Error.comp", "spv.multiView.frag", + "spv.RayGenShader11.rgen", "spv.subgroup.frag", "spv.subgroup.geom", "spv.subgroup.tesc", @@ -400,6 +460,22 @@ INSTANTIATE_TEST_CASE_P( "spv.subgroupShuffleRelative.comp", "spv.subgroupQuad.comp", "spv.subgroupVote.comp", + "spv.subgroupExtendedTypesArithmetic.comp", + "spv.subgroupExtendedTypesArithmeticNeg.comp", + "spv.subgroupExtendedTypesBallot.comp", + "spv.subgroupExtendedTypesBallotNeg.comp", + "spv.subgroupExtendedTypesClustered.comp", + "spv.subgroupExtendedTypesClusteredNeg.comp", + "spv.subgroupExtendedTypesPartitioned.comp", + "spv.subgroupExtendedTypesPartitionedNeg.comp", + "spv.subgroupExtendedTypesShuffle.comp", + "spv.subgroupExtendedTypesShuffleNeg.comp", + "spv.subgroupExtendedTypesShuffleRelative.comp", + "spv.subgroupExtendedTypesShuffleRelativeNeg.comp", + "spv.subgroupExtendedTypesQuad.comp", + "spv.subgroupExtendedTypesQuadNeg.comp", + "spv.subgroupExtendedTypesVote.comp", + "spv.subgroupExtendedTypesVoteNeg.comp", "spv.vulkan110.storageBuffer.vert", })), FileNameAsCustomTestSuffix @@ -407,6 +483,25 @@ INSTANTIATE_TEST_CASE_P( // clang-format off INSTANTIATE_TEST_CASE_P( + Glsl, CompileToSpirv14Test, + ::testing::ValuesIn(std::vector<std::string>({ + "spv.1.4.LoopControl.frag", + "spv.1.4.NonWritable.frag", + "spv.1.4.OpEntryPoint.frag", + "spv.1.4.OpSelect.frag", + "spv.1.4.OpCopyLogical.comp", + "spv.1.4.OpCopyLogicalBool.comp", + "spv.1.4.OpCopyLogical.funcall.frag", + "spv.1.4.image.frag", + "spv.1.4.sparseTexture.frag", + "spv.1.4.texture.frag", + "spv.1.4.constructComposite.comp", + })), + FileNameAsCustomTestSuffix +); + +// clang-format off +INSTANTIATE_TEST_CASE_P( Hlsl, HlslIoMap, ::testing::ValuesIn(std::vector<IoMapData>{ { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false }, @@ -462,6 +557,7 @@ INSTANTIATE_TEST_CASE_P( "vulkan.vert", "vulkan.comp", "samplerlessTextureFunctions.frag", + "spv.specConstArrayCheck.vert", })), FileNameAsCustomTestSuffix ); @@ -486,10 +582,10 @@ INSTANTIATE_TEST_CASE_P( FileNameAsCustomTestSuffix ); -#ifdef AMD_EXTENSIONS INSTANTIATE_TEST_CASE_P( Glsl, CompileVulkanToSpirvTestAMD, ::testing::ValuesIn(std::vector<std::string>({ + "spv.16bitxfb.vert", "spv.float16.frag", "spv.float16Fetch.frag", "spv.imageLoadStoreLod.frag", @@ -501,9 +597,7 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); -#endif -#ifdef NV_EXTENSIONS INSTANTIATE_TEST_CASE_P( Glsl, CompileVulkanToSpirvTestNV, ::testing::ValuesIn(std::vector<std::string>({ @@ -518,6 +612,7 @@ INSTANTIATE_TEST_CASE_P( "spv.atomicInt64.comp", "spv.shadingRate.frag", "spv.RayGenShader.rgen", + "spv.RayGenShaderArray.rgen", "spv.RayGenShader_Errors.rgen", "spv.RayConstants.rgen", "spv.IntersectShader.rint", @@ -539,6 +634,7 @@ INSTANTIATE_TEST_CASE_P( "spv.meshShaderUserDefined.mesh", "spv.meshShaderPerViewBuiltins.mesh", "spv.meshShaderPerViewUserDefined.mesh", + "spv.meshShaderPerView_Errors.mesh", "spv.meshShaderSharedMem.mesh", "spv.meshShaderTaskMem.mesh", "spv.320.meshShaderUserDefined.mesh", @@ -549,7 +645,6 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); -#endif INSTANTIATE_TEST_CASE_P( Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest, |