Revert "(3/N) Rename WGPUDeviceLostReason_Undefined to Unknown"
This reverts commit 98012bf2e9bdccf588624d3ba6bc045301de1658.
Reason for revert: This breaks the Dawn->Chromium roll because not all usages have been updated yet. We need Emscripten to be updated with this change before we can update the remaining usages.
Original change's description:
> (3/N) Rename WGPUDeviceLostReason_Undefined to Unknown
>
> Spec change was:
> https://github.com/gpuweb/gpuweb/pull/3976
>
> Stage 3: Remove `WGPUDeviceLostReason_Undefined`
> from Dawn.
>
> Bug: chromium:42241081
> Change-Id: I6865a9cff2494adadab4dbae898ab010401afb94
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/187280
> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
TBR=kainino@chromium.org,enga@chromium.org,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,hocheung@chromium.org
Change-Id: Iaddff04864e965a7d473a737721d52e40be72b06
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:42241081
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/187480
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index fd97565..fde2e91 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -1544,6 +1544,7 @@
"category": "enum",
"emscripten_no_enum_table": true,
"values": [
+ {"value": 0, "name": "undefined", "jsrepr": "undefined"},
{"value": 1, "name": "unknown"},
{"value": 2, "name": "destroyed"},
{"value": 3, "name": "instance dropped"},
diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h
index d8b014d..5e2462c 100644
--- a/src/dawn/native/Device.h
+++ b/src/dawn/native/Device.h
@@ -126,7 +126,7 @@
// users as the respective error rather than causing a device loss instead.
void HandleError(std::unique_ptr<ErrorData> error,
InternalErrorType additionalAllowedErrors = InternalErrorType::None,
- WGPUDeviceLostReason lost_reason = WGPUDeviceLostReason_Unknown);
+ WGPUDeviceLostReason lost_reason = WGPUDeviceLostReason_Undefined);
MaybeError ValidateObject(const ApiObjectBase* object) const;
diff --git a/src/dawn/node/binding/GPUDevice.cpp b/src/dawn/node/binding/GPUDevice.cpp
index de9184c..c0fcc0d 100644
--- a/src/dawn/node/binding/GPUDevice.cpp
+++ b/src/dawn/node/binding/GPUDevice.cpp
@@ -187,6 +187,7 @@
case WGPUDeviceLostReason_InstanceDropped:
UNREACHABLE("WGPUDeviceLostReason_InstanceDropped");
break;
+ case WGPUDeviceLostReason_Undefined:
case WGPUDeviceLostReason_Unknown:
r = interop::GPUDeviceLostReason::kUnknown;
break;
diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp
index 0fbfa98..ab646d7 100644
--- a/src/dawn/tests/DawnTest.cpp
+++ b/src/dawn/tests/DawnTest.cpp
@@ -1234,8 +1234,8 @@
resolvedDevice = device;
}
- EXPECT_CALL(mDeviceLostCallback, Call(_, WGPUDeviceLostReason_Unknown, _, _)).Times(1);
- resolvedDevice.ForceLoss(wgpu::DeviceLostReason::Unknown, "Device lost for testing");
+ EXPECT_CALL(mDeviceLostCallback, Call(_, WGPUDeviceLostReason_Undefined, _, _)).Times(1);
+ resolvedDevice.ForceLoss(wgpu::DeviceLostReason::Undefined, "Device lost for testing");
resolvedDevice.Tick();
}
diff --git a/src/dawn/tests/benchmarks/NullDeviceSetup.cpp b/src/dawn/tests/benchmarks/NullDeviceSetup.cpp
index 2a894c1..203508c 100644
--- a/src/dawn/tests/benchmarks/NullDeviceSetup.cpp
+++ b/src/dawn/tests/benchmarks/NullDeviceSetup.cpp
@@ -80,7 +80,7 @@
device.SetDeviceLostCallback(
[](WGPUDeviceLostReason reason, char const* message, void* userdata) {
- if (reason == WGPUDeviceLostReason_Unknown) {
+ if (reason == WGPUDeviceLostReason_Undefined) {
dawn::ErrorLog() << message;
DAWN_UNREACHABLE();
}
diff --git a/src/dawn/tests/end2end/DeviceLostTests.cpp b/src/dawn/tests/end2end/DeviceLostTests.cpp
index 26837bb..37dba76 100644
--- a/src/dawn/tests/end2end/DeviceLostTests.cpp
+++ b/src/dawn/tests/end2end/DeviceLostTests.cpp
@@ -436,7 +436,7 @@
// First LoseDeviceForTesting call should occur normally. The callback is already set in SetUp.
LoseDeviceForTesting();
- device.ForceLoss(wgpu::DeviceLostReason::Unknown, "Device lost for testing");
+ device.ForceLoss(wgpu::DeviceLostReason::Undefined, "Device lost for testing");
FlushWire();
testing::Mock::VerifyAndClearExpectations(&mDeviceLostCallback);
}
diff --git a/src/dawn/tests/end2end/EventTests.cpp b/src/dawn/tests/end2end/EventTests.cpp
index 4f8e15a..f0b5abf 100644
--- a/src/dawn/tests/end2end/EventTests.cpp
+++ b/src/dawn/tests/end2end/EventTests.cpp
@@ -152,9 +152,9 @@
void LoseTestDevice() {
EXPECT_CALL(mDeviceLostCallback,
- Call(testing::_, WGPUDeviceLostReason_Unknown, testing::_, testing::_))
+ Call(testing::_, WGPUDeviceLostReason_Undefined, testing::_, testing::_))
.Times(1);
- testDevice.ForceLoss(wgpu::DeviceLostReason::Unknown, "Device lost for testing");
+ testDevice.ForceLoss(wgpu::DeviceLostReason::Undefined, "Device lost for testing");
testInstance.ProcessEvents();
}
diff --git a/src/dawn/tests/unittests/native/AllowedErrorTests.cpp b/src/dawn/tests/unittests/native/AllowedErrorTests.cpp
index 6a5b15da..584f109 100644
--- a/src/dawn/tests/unittests/native/AllowedErrorTests.cpp
+++ b/src/dawn/tests/unittests/native/AllowedErrorTests.cpp
@@ -94,7 +94,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
device.GetQueue().Submit(0, nullptr);
@@ -112,7 +112,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
constexpr uint8_t data = 8;
@@ -133,7 +133,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
constexpr uint8_t data[] = {1, 2, 4, 8};
@@ -166,7 +166,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
device.GetQueue().CopyTextureForBrowser(&src, &dst, &size, &options);
}
@@ -207,7 +207,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
device.GetQueue().CopyExternalTextureForBrowser(&src, &dst, &size, &options);
}
@@ -227,7 +227,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
device.CreateComputePipeline(ToCppAPI(&desc));
}
@@ -247,7 +247,7 @@
// Expect the device lost because of the error.
EXPECT_CALL(mDeviceLostCb,
- Call(WGPUDeviceLostReason_Unknown, HasSubstr(kOomErrorMessage), this))
+ Call(WGPUDeviceLostReason_Undefined, HasSubstr(kOomErrorMessage), this))
.Times(1);
device.CreateRenderPipeline(ToCppAPI(&desc));
}
diff --git a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp
index 7b6ebe0..dc9a06d 100644
--- a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp
@@ -91,12 +91,12 @@
// Check that disconnecting the wire client after a device loss does not trigger the callback
// again.
TEST_F(WireDisconnectTests, ServerLostThenDisconnect) {
- api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
+ api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
"some reason");
// Flush the device lost return command.
EXPECT_CALL(deviceLostCallback,
- Call(_, WGPUDeviceLostReason_Unknown, StrEq("some reason"), this))
+ Call(_, WGPUDeviceLostReason_Undefined, StrEq("some reason"), this))
.Times(Exactly(1));
FlushServer();
@@ -112,13 +112,13 @@
wgpuDeviceSetDeviceLostCallback(device, mockDeviceLostCallback.Callback(),
mockDeviceLostCallback.MakeUserdata(this));
- api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
+ api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
"lost reason");
// Disconnect the client inside the lost callback. We should see the callback
// only once.
EXPECT_CALL(mockDeviceLostCallback,
- Call(WGPUDeviceLostReason_Unknown, StrEq("lost reason"), this))
+ Call(WGPUDeviceLostReason_Undefined, StrEq("lost reason"), this))
.WillOnce(InvokeWithoutArgs([&] {
EXPECT_CALL(mockDeviceLostCallback, Call(_, _, _)).Times(Exactly(0));
GetWireClient()->Disconnect();
@@ -139,7 +139,7 @@
// Lose the device on the server. The client callback shouldn't be
// called again.
- api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
+ api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
"lost reason");
EXPECT_CALL(mockDeviceLostCallback, Call(_, _, _)).Times(Exactly(0));
FlushServer();
diff --git a/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp b/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
index 2a91393..a1f52c2 100644
--- a/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
@@ -187,11 +187,11 @@
// Calling the callback on the server side will result in the callback being called on the
// client side
- api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Unknown,
+ api.CallDeviceSetDeviceLostCallbackCallback(apiDevice, WGPUDeviceLostReason_Undefined,
"Some error message");
EXPECT_CALL(*mockDeviceLostCallback,
- Call(WGPUDeviceLostReason_Unknown, StrEq("Some error message"), this))
+ Call(WGPUDeviceLostReason_Undefined, StrEq("Some error message"), this))
.Times(1);
FlushServer();
diff --git a/src/dawn/wire/client/Client.cpp b/src/dawn/wire/client/Client.cpp
index bacb0f1..3cc08d6 100644
--- a/src/dawn/wire/client/Client.cpp
+++ b/src/dawn/wire/client/Client.cpp
@@ -187,7 +187,7 @@
for (LinkNode<ObjectBase>* device = deviceList.head(); device != deviceList.end();
device = device->next()) {
static_cast<Device*>(device->value())
- ->HandleDeviceLost(WGPUDeviceLostReason_Unknown, "GPU connection lost");
+ ->HandleDeviceLost(WGPUDeviceLostReason_Undefined, "GPU connection lost");
}
}
for (auto& objectList : mObjects) {