Immediately call fence and map callbacks on device loss.

This is more in line with what happens in dawn_wire and Blink's WebGPU
implementation. It also allows fixing the Fence-related DeviceLost tests
to destroy the mock fence callback on destruction, which in turns fixes
a crash on dawn_end2end_tests exit on MSVC x64 debug.

Bug: dawn:602

Change-Id: I277e7fa284a573854ed46576602d5f6819db1357
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38526
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2021-01-27 15:54:12 +00:00
committed by Commit Bot service account
parent 2df77f4325
commit c1d3a66bd2
8 changed files with 29 additions and 15 deletions

View File

@@ -65,6 +65,7 @@ class DeviceLostTest : public DawnTest {
void TearDown() override {
mockDeviceLostCallback = nullptr;
mockFenceOnCompletionCallback = nullptr;
DawnTest::TearDown();
}
@@ -449,8 +450,8 @@ TEST_P(DeviceLostTest, FenceOnCompletionFails) {
ASSERT_DEVICE_ERROR(fence.OnCompletion(2u, ToMockFenceOnCompletionFails, nullptr));
ASSERT_DEVICE_ERROR(device.Tick());
// completed value should not have changed from initial value
EXPECT_EQ(fence.GetCompletedValue(), 0u);
// completed value is the last value signaled (all previous GPU operations are as if completed)
EXPECT_EQ(fence.GetCompletedValue(), 2u);
}
// Test that Fence::OnCompletion callbacks with device lost status when device is lost after calling
@@ -469,7 +470,7 @@ TEST_P(DeviceLostTest, FenceOnCompletionBeforeLossFails) {
SetCallbackAndLoseForTesting();
ASSERT_DEVICE_ERROR(device.Tick());
EXPECT_EQ(fence.GetCompletedValue(), 0u);
EXPECT_EQ(fence.GetCompletedValue(), 2u);
}
// Regression test for the Null backend not properly setting the completedSerial when