From e3f44e3cd6a1ab416d5e7b64b09c3c08c935a911 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 15 Apr 2020 10:07:25 +0000 Subject: [PATCH] ShutDownBase, only tick frontend facilities if they have been created Bug: chromium:1068886 Bug: chromium:1068887 Change-Id: Ifbec86d806a9e03a7cf029824349a6f94b9fe63c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19290 Reviewed-by: Kai Ninomiya Commit-Queue: Corentin Wallez --- src/dawn_native/Device.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index 9af5bc3507..a48820b4c5 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -111,7 +111,6 @@ namespace dawn_native { switch (mState) { case State::BeingCreated: // The GPU timeline was never started so we don't have to wait. - mState = State::Disconnected; break; case State::Alive: @@ -119,7 +118,6 @@ namespace dawn_native { // complete before proceeding with destruction. // Assert that errors are device loss so that we can continue with destruction AssertAndIgnoreDeviceLossError(WaitForIdleForDestruction()); - mState = State::Disconnected; break; case State::BeingDisconnected: @@ -133,13 +131,20 @@ namespace dawn_native { break; } - // The GPU timeline is finished so all services can be freed immediately. They need to be - // freed before ShutDownImpl() because they might relinquish resources that will be freed by - // backends in the ShutDownImpl() call. - // Still tick the ones that might have pending callbacks. - mErrorScopeTracker->Tick(GetCompletedCommandSerial()); + // Skip handling device facilities if they haven't even been created (or failed doing so) + if (mState != State::BeingCreated) { + // The GPU timeline is finished so all services can be freed immediately. They need to + // be freed before ShutDownImpl() because they might relinquish resources that will be + // freed by backends in the ShutDownImpl() call. Still tick the ones that might have + // pending callbacks. + mErrorScopeTracker->Tick(GetCompletedCommandSerial()); + mFenceSignalTracker->Tick(GetCompletedCommandSerial()); + } + + // At this point GPU operations are always finished, so we are in the disconnected state. + mState = State::Disconnected; + mErrorScopeTracker = nullptr; - mFenceSignalTracker->Tick(GetCompletedCommandSerial()); mFenceSignalTracker = nullptr; mDynamicUploader = nullptr;