Implement NonSemantic.Shader.DebugInfo.100
See https://github.com/KhronosGroup/SPIRV-Registry.
This commit is contained in:
@@ -65,6 +65,7 @@ using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoint
|
||||
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
|
||||
// Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
|
||||
// to successfully generate both AST and SPIR-V.
|
||||
@@ -136,6 +137,13 @@ TEST_P(HlslLegalDebugTest, FromFile)
|
||||
"/baseResults/", true, true);
|
||||
}
|
||||
|
||||
TEST_P(HlslNonSemanticShaderDebugInfoTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, GetParam().entryPoint, "/baseResults/", false, false, true);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ToSpirv, HlslCompileTest,
|
||||
@@ -527,7 +535,21 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
}),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ToSpirv, HlslNonSemanticShaderDebugInfoTest,
|
||||
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
|
||||
{"spv.debuginfo.hlsl.vert", "main"},
|
||||
{"spv.debuginfo.hlsl.frag", "main"},
|
||||
{"spv.debuginfo.hlsl.comp", "main"},
|
||||
{"spv.debuginfo.hlsl.geom", "main"},
|
||||
{"spv.debuginfo.hlsl.tesc", "main"},
|
||||
{"spv.debuginfo.hlsl.tese", "main"},
|
||||
}),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@@ -80,6 +80,7 @@ using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::st
|
||||
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileVulkanToNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
|
||||
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
||||
// generate SPIR-V.
|
||||
@@ -229,6 +230,13 @@ TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
TEST_P(CompileVulkanToNonSemanticShaderDebugInfoTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, "", "/baseResults/", false, false, true);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Glsl, CompileVulkanToSpirvTest,
|
||||
@@ -812,6 +820,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
@@ -819,6 +828,19 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Glsl, CompileVulkanToNonSemanticShaderDebugInfoTest,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
"spv.debuginfo.glsl.vert",
|
||||
"spv.debuginfo.glsl.frag",
|
||||
"spv.debuginfo.glsl.comp",
|
||||
"spv.debuginfo.glsl.geom",
|
||||
"spv.debuginfo.glsl.tesc",
|
||||
"spv.debuginfo.glsl.tese"
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@@ -217,6 +217,7 @@ public:
|
||||
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
|
||||
bool enableOptimizer = false,
|
||||
bool enableDebug = false,
|
||||
bool enableNonSemanticShaderDebugInfo = false,
|
||||
bool automap = true)
|
||||
{
|
||||
const EShLanguage stage = GetShaderStage(GetSuffix(shaderName));
|
||||
@@ -263,6 +264,8 @@ public:
|
||||
std::vector<uint32_t> spirv_binary;
|
||||
options().disableOptimizer = !enableOptimizer;
|
||||
options().generateDebugInfo = enableDebug;
|
||||
options().emitNonSemanticShaderDebugInfo = enableNonSemanticShaderDebugInfo;
|
||||
options().emitNonSemanticShaderDebugSource = enableNonSemanticShaderDebugInfo;
|
||||
glslang::GlslangToSpv(*program.getIntermediate(stage),
|
||||
spirv_binary, &logger, &options());
|
||||
|
||||
@@ -448,7 +451,8 @@ public:
|
||||
const std::string& entryPointName="",
|
||||
const std::string& baseDir="/baseResults/",
|
||||
const bool enableOptimizer = false,
|
||||
const bool enableDebug = false)
|
||||
const bool enableDebug = false,
|
||||
const bool enableNonSemanticShaderDebugInfo = false)
|
||||
{
|
||||
const std::string inputFname = testDir + "/" + testName;
|
||||
const std::string expectedOutputFname =
|
||||
@@ -464,7 +468,8 @@ public:
|
||||
if (enableDebug)
|
||||
controls = static_cast<EShMessages>(controls | EShMsgDebugInfo);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion,
|
||||
targetLanguageVersion, false, EShTexSampTransKeep, enableOptimizer, enableDebug, automap);
|
||||
targetLanguageVersion, false, EShTexSampTransKeep, enableOptimizer, enableDebug,
|
||||
enableNonSemanticShaderDebugInfo, automap);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
std::ostringstream stream;
|
||||
|
||||
Reference in New Issue
Block a user