SPV: Fix #1575, fix #1593: Support HLSL #line

SPIR-V OpLines now contain filenames from HLSL-style #lines.
This commit is contained in:
greg-lunarg
2018-12-07 17:36:33 -07:00
committed by John Kessenich
parent 127cea5c9a
commit 5d43c4aac7
18 changed files with 754 additions and 39 deletions

View File

@@ -61,6 +61,7 @@ using HlslCompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointP
using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
// Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
// to successfully generate both AST and SPIR-V.
@@ -95,6 +96,16 @@ TEST_P(HlslLegalizeTest, FromFile)
"/baseLegalResults/", true);
}
// Compiling HLSL to pre-legalized SPIR-V. Expected to successfully generate
// SPIR-V with debug instructions, particularly line info.
TEST_P(HlslDebugTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::Spv, true, GetParam().entryPoint,
"/baseResults/", false, true);
}
// clang-format off
INSTANTIATE_TEST_CASE_P(
ToSpirv, HlslCompileTest,
@@ -437,5 +448,15 @@ INSTANTIATE_TEST_CASE_P(
// clang-format on
#endif
// clang-format off
INSTANTIATE_TEST_CASE_P(
ToSpirv, HlslDebugTest,
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
{"hlsl.pp.line2.frag", "MainPs"}
}),
FileNameAsCustomTestSuffix
);
// clang-format on
} // anonymous namespace
} // namespace glslangtest