Linker: Fix #1329: correctly merge unsized arrays, and fix link tests.

This commit is contained in:
John Kessenich
2018-04-01 21:22:34 -06:00
parent ed834895ea
commit 5a867acad5
6 changed files with 355 additions and 47 deletions

View File

@@ -52,6 +52,7 @@ TEST_P(LinkTestVulkan, FromFile)
GlslangResult result;
// Compile each input shader file.
bool success = true;
std::vector<std::unique_ptr<glslang::TShader>> shaders;
for (size_t i = 0; i < fileCount; ++i) {
std::string contents;
@@ -61,7 +62,7 @@ TEST_P(LinkTestVulkan, FromFile)
new glslang::TShader(GetShaderStage(GetSuffix(fileNames[i]))));
auto* shader = shaders.back().get();
shader->setAutoMapLocations(true);
compile(shader, contents, "", controls);
success &= compile(shader, contents, "", controls);
result.shaderResults.push_back(
{fileNames[i], shader->getInfoLog(), shader->getInfoDebugLog()});
}
@@ -69,10 +70,25 @@ TEST_P(LinkTestVulkan, FromFile)
// Link all of them.
glslang::TProgram program;
for (const auto& shader : shaders) program.addShader(shader.get());
program.link(controls);
success &= program.link(controls);
result.linkingOutput = program.getInfoLog();
result.linkingError = program.getInfoDebugLog();
if (success && (controls & EShMsgSpvRules)) {
spv::SpvBuildLogger logger;
std::vector<uint32_t> spirv_binary;
glslang::SpvOptions options;
options.disableOptimizer = true;
glslang::GlslangToSpv(*program.getIntermediate(shaders.front()->getStage()),
spirv_binary, &logger, &options);
std::ostringstream disassembly_stream;
spv::Parameterize();
spv::Disassemble(disassembly_stream, spirv_binary);
result.spirvWarningsErrors = logger.getAllMessages();
result.spirv = disassembly_stream.str();
}
std::ostringstream stream;
outputResultToStream(&stream, result, controls);