mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Refactor Device destructors to WaitForIdleForDestruction + Destroy
To help with Device Loss, this splits Device backend destructors to WaitForIdleForDestruction and Destroy. WaitForIdleForDestruction waits for GPU to finish, checks errors and gets ready for destruction. Destroy is used to clean up and release resources used by device, does not wait for GPU or check errors. Bug: dawn:68 Change-Id: I054fd735e8d5b289365604209f38e616c723a4e7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14560 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
committed by
Commit Bot service account
parent
1bbbe8f52d
commit
2c8a17ecc7
@@ -17,6 +17,7 @@
|
||||
#include "dawn_native/BackendConnection.h"
|
||||
#include "dawn_native/Commands.h"
|
||||
#include "dawn_native/DynamicUploader.h"
|
||||
#include "dawn_native/ErrorData.h"
|
||||
#include "dawn_native/Instance.h"
|
||||
|
||||
#include <spirv_cross.hpp>
|
||||
@@ -85,10 +86,7 @@ namespace dawn_native { namespace null {
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
mDynamicUploader = nullptr;
|
||||
|
||||
mPendingOperations.clear();
|
||||
ASSERT(mMemoryUsage == 0);
|
||||
BaseDestructor();
|
||||
}
|
||||
|
||||
ResultOrError<BindGroupBase*> Device::CreateBindGroupImpl(
|
||||
@@ -167,6 +165,17 @@ namespace dawn_native { namespace null {
|
||||
return std::move(stagingBuffer);
|
||||
}
|
||||
|
||||
void Device::Destroy() {
|
||||
mDynamicUploader = nullptr;
|
||||
|
||||
mPendingOperations.clear();
|
||||
ASSERT(mMemoryUsage == 0);
|
||||
}
|
||||
|
||||
MaybeError Device::WaitForIdleForDestruction() {
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||
uint64_t sourceOffset,
|
||||
BufferBase* destination,
|
||||
|
||||
@@ -130,6 +130,9 @@ namespace dawn_native { namespace null {
|
||||
TextureBase* texture,
|
||||
const TextureViewDescriptor* descriptor) override;
|
||||
|
||||
void Destroy() override;
|
||||
MaybeError WaitForIdleForDestruction() override;
|
||||
|
||||
Serial mCompletedSerial = 0;
|
||||
Serial mLastSubmittedSerial = 0;
|
||||
std::vector<std::unique_ptr<PendingOperation>> mPendingOperations;
|
||||
|
||||
Reference in New Issue
Block a user