Add support for spirv1.6
Add command line support which enables the following behavior: - Remap discard Map discard to DemoteToHelperInvocation for HLSL shaders. Map to OpTerminateInvocation for GLSL shaders. - Decorate HelperInvocation with Volatile - Use localSizeId for execution mode WorkGroupSize is deprecated in spirv1.6 Also update known goods to SPIRV 1.6
This commit is contained in:
@@ -59,6 +59,7 @@ std::string FileNameAsCustomTestSuffix(
|
||||
|
||||
using HlslCompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslSpv1_6CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
@@ -81,6 +82,13 @@ TEST_P(HlslVulkan1_1CompileTest, FromFile)
|
||||
Target::BothASTAndSpv, true, GetParam().entryPoint);
|
||||
}
|
||||
|
||||
TEST_P(HlslSpv1_6CompileTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetUniversal, glslang::EShTargetSpv_1_6,
|
||||
Target::BothASTAndSpv, true, GetParam().entryPoint);
|
||||
}
|
||||
|
||||
TEST_P(HlslCompileAndFlattenTest, FromFile)
|
||||
{
|
||||
loadFileCompileFlattenUniformsAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
@@ -450,6 +458,16 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ToSpirv, HlslSpv1_6CompileTest,
|
||||
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
|
||||
{"hlsl.spv.1.6.discard.frag", "PixelShaderFunction"}
|
||||
}),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ToSpirv, HlslCompileAndFlattenTest,
|
||||
|
||||
@@ -69,6 +69,7 @@ using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithPara
|
||||
using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileToSpirv16Test = 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>>;
|
||||
@@ -122,6 +123,13 @@ TEST_P(CompileToSpirv14Test, FromFile)
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
TEST_P(CompileToSpirv16Test, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetUniversal, glslang::EShTargetSpv_1_6,
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
// Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
|
||||
// generate SPIR-V.
|
||||
TEST_P(CompileOpenGLToSpirvTest, FromFile)
|
||||
@@ -621,6 +629,18 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Glsl, CompileToSpirv16Test,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
"spv.1.6.conditionalDiscard.frag",
|
||||
"spv.1.6.helperInvocation.frag",
|
||||
"spv.1.6.specConstant.comp",
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Hlsl, HlslIoMap,
|
||||
|
||||
Reference in New Issue
Block a user