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 <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez 2020-03-20 09:14:30 +00:00 committed by Commit Bot service account
parent 69c5dd70e7
commit e5753d2fb8
2 changed files with 7 additions and 2 deletions

View File

@ -298,7 +298,12 @@ namespace dawn_native { namespace metal {
while (GetCompletedCommandSerial() != mLastSubmittedSerial) { while (GetCompletedCommandSerial() != mLastSubmittedSerial) {
usleep(100); usleep(100);
} }
Tick();
// Artificially increase the serials so work that was pending knows it can complete.
mCompletedSerial++;
mLastSubmittedSerial++;
DAWN_TRY(TickImpl());
return {}; return {};
} }

View File

@ -471,4 +471,4 @@ TEST_P(DeviceLostTest, LoseForTestingOnce) {
device.LoseForTesting(); device.LoseForTesting();
} }
DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), VulkanBackend()); DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), MetalBackend(), VulkanBackend());