Merge pull request #1627 from greg-lunarg/lines8

Add passes to spirv-opt passes to preserve source line info when compiling -g.
This commit is contained in:
John Kessenich
2018-12-18 10:38:32 -07:00
committed by GitHub
4 changed files with 220 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameE
using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
// Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
// to successfully generate both AST and SPIR-V.
@@ -115,6 +116,17 @@ TEST_P(HlslDX9CompatibleTest, FromFile)
EShMessages::EShMsgHlslDX9Compatible);
}
// Compiling HLSL to legalized SPIR-V with debug instructions. Expected to
// successfully generate SPIR-V with debug instructions preserved through
// legalization, particularly line info.
TEST_P(HlslLegalDebugTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::Spv, true, GetParam().entryPoint,
"/baseResults/", true, true);
}
// clang-format off
INSTANTIATE_TEST_CASE_P(
ToSpirv, HlslCompileTest,
@@ -474,6 +486,16 @@ INSTANTIATE_TEST_CASE_P(
}),
FileNameAsCustomTestSuffix
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
ToSpirv, HlslLegalDebugTest,
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
{"hlsl.pp.line4.frag", "MainPs"}
}),
FileNameAsCustomTestSuffix
);
// clang-format on
} // anonymous namespace