[tests]: Register Device::SetLoggingCallback()
And print this to the Dawn logger.
Tests will now print any diagnostic logging calls from Dawn.
Change-Id: Idd4bf816303c182809924f9a432570def808e1b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57381
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 9c44378..a5fed42 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -948,6 +948,25 @@
glfwMakeContextCurrent(gTestEnv->GetOpenGLESWindow());
}
#endif // defined(DAWN_ENABLE_BACKEND_OPENGLES)
+
+ device.SetLoggingCallback(
+ [](WGPULoggingType type, char const* message, void*) {
+ switch (type) {
+ case WGPULoggingType_Verbose:
+ dawn::DebugLog() << message;
+ break;
+ case WGPULoggingType_Warning:
+ dawn::WarningLog() << message;
+ break;
+ case WGPULoggingType_Error:
+ dawn::ErrorLog() << message;
+ break;
+ default:
+ dawn::InfoLog() << message;
+ break;
+ }
+ },
+ nullptr);
}
void DawnTestBase::TearDown() {