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:
Greg Fischer
2021-09-02 17:37:39 -06:00
parent a0f98ad401
commit 7a49192d23
19 changed files with 556 additions and 218 deletions

View File

@@ -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,