Emit validation errors after outputing result.
This Cl removes the SPIR-V validation errors to emit after the desired output format. This means a SPVASM output will have the error at the bottom making it more visible. Change-Id: I010f45ea4f35b2f5489749a49492c3d860410e8a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30080 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
435916e544
commit
f2b8b6e873
|
@ -569,13 +569,16 @@ int main(int argc, const char** argv) {
|
||||||
|
|
||||||
#if TINT_BUILD_SPV_WRITER
|
#if TINT_BUILD_SPV_WRITER
|
||||||
bool dawn_validation_failed = false;
|
bool dawn_validation_failed = false;
|
||||||
|
std::ostringstream stream;
|
||||||
|
|
||||||
if (options.dawn_validation) {
|
if (options.dawn_validation) {
|
||||||
// Use Vulkan 1.1, since this is what Tint, internally, uses.
|
// Use Vulkan 1.1, since this is what Tint, internally, uses.
|
||||||
spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_1);
|
spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_1);
|
||||||
tools.SetMessageConsumer([](spv_message_level_t, const char*,
|
tools.SetMessageConsumer([&stream](spv_message_level_t, const char*,
|
||||||
const spv_position_t& pos, const char* msg) {
|
const spv_position_t& pos,
|
||||||
std::cerr << (pos.line + 1) << ":" << (pos.column + 1) << ": " << msg
|
const char* msg) {
|
||||||
<< std::endl;
|
stream << (pos.line + 1) << ":" << (pos.column + 1) << ": " << msg
|
||||||
|
<< std::endl;
|
||||||
});
|
});
|
||||||
auto* w = static_cast<tint::writer::spirv::Generator*>(writer.get());
|
auto* w = static_cast<tint::writer::spirv::Generator*>(writer.get());
|
||||||
if (!tools.Validate(w->result().data(), w->result().size(),
|
if (!tools.Validate(w->result().data(), w->result().size(),
|
||||||
|
@ -598,6 +601,8 @@ int main(int argc, const char** argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dawn_validation_failed) {
|
if (dawn_validation_failed) {
|
||||||
|
std::cerr << std::endl << std::endl << "Validation Failure:" << std::endl;
|
||||||
|
std::cerr << stream.str();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif // TINT_BUILD_SPV_WRITER
|
#endif // TINT_BUILD_SPV_WRITER
|
||||||
|
|
Loading…
Reference in New Issue