ShaderModule: Enable the prettier tint diagnostic formatter

Includes code snippits and squiggles of the offending line(s)

Bug: none
Change-Id: If704b5d1118d0246c16f6e729a10d16363a1169b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-01-12 08:55:57 +00:00 committed by Commit Bot service account
parent ede229f313
commit 64275742e0
1 changed files with 4 additions and 2 deletions

View File

@ -179,7 +179,8 @@ namespace dawn_native {
tint::reader::wgsl::Parser parser(file); tint::reader::wgsl::Parser parser(file);
if (!parser.Parse()) { if (!parser.Parse()) {
errorStream << "Parser: " << parser.error() << std::endl; auto err = tint::diag::Formatter{}.format(parser.diagnostics());
errorStream << "Parser: " << err << std::endl;
return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
} }
@ -229,7 +230,8 @@ namespace dawn_native {
tint::Validator validator; tint::Validator validator;
if (!validator.Validate(module)) { if (!validator.Validate(module)) {
errorStream << "Validation: " << validator.error() << std::endl; auto err = tint::diag::Formatter{}.format(validator.diagnostics());
errorStream << "Validation: " << err << std::endl;
return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
} }