From 4f37ae7f3e7b999617d363af1db97f2ad90546fb Mon Sep 17 00:00:00 2001 From: Loko Kung Date: Sat, 22 Jan 2022 01:40:28 +0000 Subject: [PATCH] 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 Reviewed-by: Kai Ninomiya Commit-Queue: Loko Kung --- src/dawn_native/Device.cpp | 2 +- src/tests/end2end/DeviceLostTests.cpp | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index cdd7197b43..31c6731841 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -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(); diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp index 57a4bffd1f..1d9313d5bd 100644 --- a/src/tests/end2end/DeviceLostTests.cpp +++ b/src/tests/end2end/DeviceLostTests.cpp @@ -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