Deprecates PopErrorScope returning a bool.
Bug: dawn:526 Change-Id: Ia4e985fbe4fcb5edb3fe80849f5b0df0190eea00 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130340 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Loko Kung <lokokung@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
fab65123e1
commit
4e9ebeff02
|
@ -1203,7 +1203,6 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pop error scope",
|
"name": "pop error scope",
|
||||||
"returns": "bool",
|
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "callback", "type": "error callback"},
|
{"name": "callback", "type": "error callback"},
|
||||||
{"name": "userdata", "type": "void", "annotation": "*"}
|
{"name": "userdata", "type": "void", "annotation": "*"}
|
||||||
|
|
|
@ -631,9 +631,7 @@ void DeviceBase::APIPushErrorScope(wgpu::ErrorFilter filter) {
|
||||||
mErrorScopeStack->Push(filter);
|
mErrorScopeStack->Push(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceBase::APIPopErrorScope(wgpu::ErrorCallback callback, void* userdata) {
|
void 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) {
|
if (callback == nullptr) {
|
||||||
static wgpu::ErrorCallback defaultCallback = [](WGPUErrorType, char const*, void*) {};
|
static wgpu::ErrorCallback defaultCallback = [](WGPUErrorType, char const*, void*) {};
|
||||||
callback = defaultCallback;
|
callback = defaultCallback;
|
||||||
|
@ -642,20 +640,18 @@ bool DeviceBase::APIPopErrorScope(wgpu::ErrorCallback callback, void* userdata)
|
||||||
if (IsLost()) {
|
if (IsLost()) {
|
||||||
mCallbackTaskManager->AddCallbackTask(
|
mCallbackTaskManager->AddCallbackTask(
|
||||||
std::bind(callback, WGPUErrorType_DeviceLost, "GPU device disconnected", userdata));
|
std::bind(callback, WGPUErrorType_DeviceLost, "GPU device disconnected", userdata));
|
||||||
return returnValue;
|
return;
|
||||||
}
|
}
|
||||||
if (mErrorScopeStack->Empty()) {
|
if (mErrorScopeStack->Empty()) {
|
||||||
mCallbackTaskManager->AddCallbackTask(
|
mCallbackTaskManager->AddCallbackTask(
|
||||||
std::bind(callback, WGPUErrorType_Unknown, "No error scopes to pop", userdata));
|
std::bind(callback, WGPUErrorType_Unknown, "No error scopes to pop", userdata));
|
||||||
return returnValue;
|
return;
|
||||||
}
|
}
|
||||||
ErrorScope scope = mErrorScopeStack->Pop();
|
ErrorScope scope = mErrorScopeStack->Pop();
|
||||||
mCallbackTaskManager->AddCallbackTask(
|
mCallbackTaskManager->AddCallbackTask(
|
||||||
[callback, errorType = static_cast<WGPUErrorType>(scope.GetErrorType()),
|
[callback, errorType = static_cast<WGPUErrorType>(scope.GetErrorType()),
|
||||||
message = scope.GetErrorMessage(),
|
message = scope.GetErrorMessage(),
|
||||||
userdata] { callback(errorType, message.c_str(), userdata); });
|
userdata] { callback(errorType, message.c_str(), userdata); });
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobCache* DeviceBase::GetBlobCache() {
|
BlobCache* DeviceBase::GetBlobCache() {
|
||||||
|
|
|
@ -309,7 +309,7 @@ class DeviceBase : public RefCountedWithExternalCount {
|
||||||
void APISetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata);
|
void APISetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata);
|
||||||
void APISetLoggingCallback(wgpu::LoggingCallback callback, void* userdata);
|
void APISetLoggingCallback(wgpu::LoggingCallback callback, void* userdata);
|
||||||
void APIPushErrorScope(wgpu::ErrorFilter filter);
|
void APIPushErrorScope(wgpu::ErrorFilter filter);
|
||||||
bool APIPopErrorScope(wgpu::ErrorCallback callback, void* userdata);
|
void APIPopErrorScope(wgpu::ErrorCallback callback, void* userdata);
|
||||||
|
|
||||||
MaybeError ValidateIsAlive() const;
|
MaybeError ValidateIsAlive() const;
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ TEST_F(WireErrorCallbackTests, PushPopErrorScopeCallback) {
|
||||||
WGPUErrorCallback callback;
|
WGPUErrorCallback callback;
|
||||||
void* userdata;
|
void* userdata;
|
||||||
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
||||||
.WillOnce(DoAll(SaveArg<1>(&callback), SaveArg<2>(&userdata), Return(true)));
|
.WillOnce(DoAll(SaveArg<1>(&callback), SaveArg<2>(&userdata)));
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
|
@ -174,8 +174,8 @@ TEST_F(WireErrorCallbackTests, PopErrorScopeCallbackOrdering) {
|
||||||
void* userdata1;
|
void* userdata1;
|
||||||
void* userdata2;
|
void* userdata2;
|
||||||
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
||||||
.WillOnce(DoAll(SaveArg<1>(&callback1), SaveArg<2>(&userdata1), Return(true)))
|
.WillOnce(DoAll(SaveArg<1>(&callback1), SaveArg<2>(&userdata1)))
|
||||||
.WillOnce(DoAll(SaveArg<1>(&callback2), SaveArg<2>(&userdata2), Return(true)));
|
.WillOnce(DoAll(SaveArg<1>(&callback2), SaveArg<2>(&userdata2)));
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this + 1);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this + 1);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
@ -205,8 +205,8 @@ TEST_F(WireErrorCallbackTests, PopErrorScopeCallbackOrdering) {
|
||||||
void* userdata1;
|
void* userdata1;
|
||||||
void* userdata2;
|
void* userdata2;
|
||||||
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
||||||
.WillOnce(DoAll(SaveArg<1>(&callback1), SaveArg<2>(&userdata1), Return(true)))
|
.WillOnce(DoAll(SaveArg<1>(&callback1), SaveArg<2>(&userdata1)))
|
||||||
.WillOnce(DoAll(SaveArg<1>(&callback2), SaveArg<2>(&userdata2), Return(true)));
|
.WillOnce(DoAll(SaveArg<1>(&callback2), SaveArg<2>(&userdata2)));
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this + 1);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this + 1);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
@ -231,7 +231,7 @@ TEST_F(WireErrorCallbackTests, PopErrorScopeDeviceInFlightDestroy) {
|
||||||
wgpuDevicePushErrorScope(device, WGPUErrorFilter_Validation);
|
wgpuDevicePushErrorScope(device, WGPUErrorFilter_Validation);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).WillOnce(Return(true));
|
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).Times(1);
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ TEST_F(WireErrorCallbackTests, PopErrorScopeThenDisconnect) {
|
||||||
EXPECT_CALL(api, DevicePushErrorScope(apiDevice, WGPUErrorFilter_Validation)).Times(1);
|
EXPECT_CALL(api, DevicePushErrorScope(apiDevice, WGPUErrorFilter_Validation)).Times(1);
|
||||||
wgpuDevicePushErrorScope(device, WGPUErrorFilter_Validation);
|
wgpuDevicePushErrorScope(device, WGPUErrorFilter_Validation);
|
||||||
|
|
||||||
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).WillOnce(Return(true));
|
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).Times(1);
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ TEST_F(WireErrorCallbackTests, PopErrorScopeEmptyStack) {
|
||||||
WGPUErrorCallback callback;
|
WGPUErrorCallback callback;
|
||||||
void* userdata;
|
void* userdata;
|
||||||
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _))
|
||||||
.WillOnce(DoAll(SaveArg<1>(&callback), SaveArg<2>(&userdata), Return(true)));
|
.WillOnce(DoAll(SaveArg<1>(&callback), SaveArg<2>(&userdata)));
|
||||||
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
wgpuDevicePopErrorScope(device, ToMockDevicePopErrorScopeCallback, this);
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
|
|
|
@ -148,12 +148,11 @@ void Device::SetDeviceLostCallback(WGPUDeviceLostCallback callback, void* userda
|
||||||
mDeviceLostUserdata = userdata;
|
mDeviceLostUserdata = userdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::PopErrorScope(WGPUErrorCallback callback, void* userdata) {
|
void Device::PopErrorScope(WGPUErrorCallback callback, void* userdata) {
|
||||||
// TODO(crbug.com/dawn/1324) Replace bool return with void when users are updated.
|
|
||||||
Client* client = GetClient();
|
Client* client = GetClient();
|
||||||
if (client->IsDisconnected()) {
|
if (client->IsDisconnected()) {
|
||||||
callback(WGPUErrorType_DeviceLost, "GPU device disconnected", userdata);
|
callback(WGPUErrorType_DeviceLost, "GPU device disconnected", userdata);
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t serial = mErrorScopes.Add({callback, userdata});
|
uint64_t serial = mErrorScopes.Add({callback, userdata});
|
||||||
|
@ -161,7 +160,6 @@ bool Device::PopErrorScope(WGPUErrorCallback callback, void* userdata) {
|
||||||
cmd.deviceId = GetWireId();
|
cmd.deviceId = GetWireId();
|
||||||
cmd.requestSerial = serial;
|
cmd.requestSerial = serial;
|
||||||
client->SerializeCommand(cmd);
|
client->SerializeCommand(cmd);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::OnPopErrorScopeCallback(uint64_t requestSerial,
|
bool Device::OnPopErrorScopeCallback(uint64_t requestSerial,
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Device final : public ObjectBase {
|
||||||
void SetLoggingCallback(WGPULoggingCallback errorCallback, void* errorUserdata);
|
void SetLoggingCallback(WGPULoggingCallback errorCallback, void* errorUserdata);
|
||||||
void SetDeviceLostCallback(WGPUDeviceLostCallback errorCallback, void* errorUserdata);
|
void SetDeviceLostCallback(WGPUDeviceLostCallback errorCallback, void* errorUserdata);
|
||||||
void InjectError(WGPUErrorType type, const char* message);
|
void InjectError(WGPUErrorType type, const char* message);
|
||||||
bool PopErrorScope(WGPUErrorCallback callback, void* userdata);
|
void PopErrorScope(WGPUErrorCallback callback, void* userdata);
|
||||||
WGPUBuffer CreateBuffer(const WGPUBufferDescriptor* descriptor);
|
WGPUBuffer CreateBuffer(const WGPUBufferDescriptor* descriptor);
|
||||||
WGPUBuffer CreateErrorBuffer(const WGPUBufferDescriptor* descriptor);
|
WGPUBuffer CreateErrorBuffer(const WGPUBufferDescriptor* descriptor);
|
||||||
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||||
|
|
Loading…
Reference in New Issue