Loosens validation for APITick.

- Validation no longer produces an error if the device is destroyed. Instead it just no-ops now.
- Internal Ticks are still validated the same as before.
- Necessary because Chromium may call Tick after device.destroy() which causes noisy validation errors that can break tests.
- Removes the current tests for this bahavior with new follow up tests in child CL.

Bug: dawn:628
Change-Id: Idc676490c7dcf1edd104b5dfd0e9fa5c023089ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/77200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
This commit is contained in:
Loko Kung 2022-01-22 01:40:28 +00:00 committed by Dawn LUCI CQ
parent 257e85a7b9
commit 4f37ae7f3e
2 changed files with 1 additions and 8 deletions

View File

@ -1102,7 +1102,7 @@ namespace dawn::native {
// Returns true if future ticking is needed.
bool DeviceBase::APITick() {
if (ConsumedError(Tick())) {
if (IsLost() || ConsumedError(Tick())) {
return false;
}
return !IsDeviceIdle();

View File

@ -228,11 +228,6 @@ TEST_P(DeviceLostTest, CreateTextureFails) {
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
TEST_P(DeviceLostTest, TickFails) {
LoseForTesting();
ASSERT_DEVICE_ERROR(device.Tick());
}
// Test that CreateBuffer fails when device is lost
TEST_P(DeviceLostTest, CreateBufferFails) {
LoseForTesting();
@ -413,7 +408,6 @@ TEST_P(DeviceLostTest, QueueOnSubmittedWorkDoneFails) {
EXPECT_CALL(*mockQueueWorkDoneCallback, Call(WGPUQueueWorkDoneStatus_DeviceLost, nullptr))
.Times(1);
ASSERT_DEVICE_ERROR(queue.OnSubmittedWorkDone(0, ToMockQueueWorkDone, nullptr));
ASSERT_DEVICE_ERROR(device.Tick());
}
// Test that QueueOnSubmittedWorkDone when the device is lost after calling OnSubmittedWorkDone
@ -424,7 +418,6 @@ TEST_P(DeviceLostTest, QueueOnSubmittedWorkDoneBeforeLossFails) {
queue.OnSubmittedWorkDone(0, ToMockQueueWorkDone, nullptr);
LoseForTesting();
ASSERT_DEVICE_ERROR(device.Tick());
}
// Test that LostForTesting can only be called on one time