writer/spirv: Return error message in Disassemble

Instead of printf-ing and returning an empty string.
When there's a lot of other test output, it can be really hard to actually spot the error message.
With the error being returned, this will likely appear in a EXPECT_EQ() style error message.

Change-Id: I733741a68de4843e986037c5e309c5a4c3d66124
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49522
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2021-04-30 19:23:49 +00:00 committed by Commit Bot service account
parent e87ded8567
commit fa9af4b0ef
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ std::string Disassemble(const std::vector<uint32_t>& data) {
std::string result;
if (!tools.Disassemble(data, &result, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)) {
printf("%s\n", spv_errors.c_str());
return "*** Invalid SPIR-V ***\n" + spv_errors;
}
return result;
}