Print warning if errors occur and no error callback has been set

Bug: none
Change-Id: Ibbd6f90be5192ad3975bb8b24f9b3053f7f9d74f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32744
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2020-11-16 23:32:36 +00:00
committed by Commit Bot service account
parent 0055d95fa7
commit f2bc3b3edd
2 changed files with 47 additions and 0 deletions

View File

@@ -101,6 +101,31 @@ namespace dawn_native {
mRootErrorScope = AcquireRef(new ErrorScope());
mCurrentErrorScope = mRootErrorScope.Get();
#if defined(DAWN_ENABLE_ASSERTS)
mRootErrorScope->SetCallback(
[](WGPUErrorType, char const*, void*) {
static bool calledOnce = false;
if (!calledOnce) {
calledOnce = true;
dawn::WarningLog()
<< "No Dawn device uncaptured error callback was set. This is "
"probably not intended. If you really want to ignore errors "
"and suppress this message, set the callback to null.";
}
},
nullptr);
mDeviceLostCallback = [](char const*, void*) {
static bool calledOnce = false;
if (!calledOnce) {
calledOnce = true;
dawn::WarningLog() << "No Dawn device lost callback was set. This is probably not "
"intended. If you really want to ignore device lost "
"and suppress this message, set the callback to null.";
}
};
#endif // DAWN_ENABLE_ASSERTS
mCaches = std::make_unique<DeviceBase::Caches>();
mErrorScopeTracker = std::make_unique<ErrorScopeTracker>(this);
mDynamicUploader = std::make_unique<DynamicUploader>(this);