From e5753d2fb87e4e12c2a03111ce2b736b43094e52 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 20 Mar 2020 09:14:30 +0000 Subject: [PATCH] Enable (and fix) the DeviceLost tests on Metal They were failing because services of the Metal backend like the MapRequestTracker thought that work was still pending since the device only waited for previous commands to complete, and not also pending commands. Bug: dawn:68 Change-Id: I917ecefe90707b0c89f7e9b4b7379a98ed3956d7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17320 Commit-Queue: Corentin Wallez Reviewed-by: Kai Ninomiya --- src/dawn_native/metal/DeviceMTL.mm | 7 ++++++- src/tests/end2end/DeviceLostTests.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm index f91fd95279..c3d2fafb55 100644 --- a/src/dawn_native/metal/DeviceMTL.mm +++ b/src/dawn_native/metal/DeviceMTL.mm @@ -298,7 +298,12 @@ namespace dawn_native { namespace metal { while (GetCompletedCommandSerial() != mLastSubmittedSerial) { usleep(100); } - Tick(); + + // Artificially increase the serials so work that was pending knows it can complete. + mCompletedSerial++; + mLastSubmittedSerial++; + + DAWN_TRY(TickImpl()); return {}; } diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp index b06377ce18..410a5c6990 100644 --- a/src/tests/end2end/DeviceLostTests.cpp +++ b/src/tests/end2end/DeviceLostTests.cpp @@ -471,4 +471,4 @@ TEST_P(DeviceLostTest, LoseForTestingOnce) { device.LoseForTesting(); } -DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), VulkanBackend()); +DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), MetalBackend(), VulkanBackend());