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>
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index 3e1f3d9..98cdfa8 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -179,7 +179,8 @@
tint::reader::wgsl::Parser parser(file);
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());
}
@@ -229,7 +230,8 @@
tint::Validator validator;
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());
}