mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
Fixes popErrorScope to match the specs.
- Prepares for removal of unnecessary bool return, and just call callbacks appropriately. For now always returns true until all users are updated. - Removes PushErrorScope from handwritten commands now that we no longer need to do anything special. - Updates tests to reflect the change and make sure to set EXPECTs before calling functions to make tests easier to follow. Bug: dawn:1324, dawn:526 Change-Id: I90b09c54f9adbf2d6d50ad20dcedf68b5ed0b1fa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83942 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
@@ -543,17 +543,25 @@ namespace dawn::native {
|
||||
}
|
||||
|
||||
bool DeviceBase::APIPopErrorScope(wgpu::ErrorCallback callback, void* userdata) {
|
||||
// TODO(crbug.com/dawn/1324) Remove return and make function void when users are updated.
|
||||
bool returnValue = true;
|
||||
if (callback == nullptr) {
|
||||
static wgpu::ErrorCallback defaultCallback = [](WGPUErrorType, char const*, void*) {};
|
||||
callback = defaultCallback;
|
||||
}
|
||||
// TODO(crbug.com/dawn/1122): Call callbacks only on wgpuInstanceProcessEvents
|
||||
if (IsLost()) {
|
||||
callback(WGPUErrorType_DeviceLost, "GPU device disconnected", userdata);
|
||||
return returnValue;
|
||||
}
|
||||
if (mErrorScopeStack->Empty()) {
|
||||
return false;
|
||||
callback(WGPUErrorType_Unknown, "No error scopes to pop", userdata);
|
||||
return returnValue;
|
||||
}
|
||||
ErrorScope scope = mErrorScopeStack->Pop();
|
||||
if (callback != nullptr) {
|
||||
// TODO(crbug.com/dawn/1122): Call callbacks only on wgpuInstanceProcessEvents
|
||||
callback(static_cast<WGPUErrorType>(scope.GetErrorType()), scope.GetErrorMessage(),
|
||||
userdata);
|
||||
}
|
||||
|
||||
return true;
|
||||
callback(static_cast<WGPUErrorType>(scope.GetErrorType()), scope.GetErrorMessage(),
|
||||
userdata);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
PersistentCache* DeviceBase::GetPersistentCache() {
|
||||
|
||||
Reference in New Issue
Block a user