Create a new logger class for all messages w.r.t. SPIR-V build.

This commit is contained in:
Lei Zhang
2016-05-04 15:55:59 -04:00
parent 09caf12bec
commit 17535f7d55
10 changed files with 184 additions and 61 deletions

View File

@@ -672,12 +672,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if (program.getIntermediate((EShLanguage)stage)) {
std::vector<unsigned int> spirv;
std::string warningsErrors;
glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &warningsErrors);
spv::SpvBuildLogger logger;
glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger);
// Dump the spv to a file or stdout, etc., but only if not doing
// memory/perf testing, as it's not internal to programmatic use.
if (! (Options & EOptionMemoryLeakMode)) {
printf("%s", warningsErrors.c_str());
printf("%s", logger.getAllMessages().c_str());
glslang::OutputSpv(spirv, GetBinaryName((EShLanguage)stage));
if (Options & EOptionHumanReadableSpv) {
spv::Disassemble(std::cout, spirv);