Add passes to legalization to preserve source line info when generated.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user